Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome.manifest
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome.manifest	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome.manifest	(revision 5703)
@@ -0,0 +1,12 @@
+
+overlay	chrome://browser/content/browser.xul	chrome://markingcollection/content/overlay.xul
+overlay	chrome://navigator/content/navigator.xul	chrome://markingcollection/content/overlay.xul
+content	markingcollection	chrome/markingcollection/content/markingcollection/
+
+skin	markingcollection	classic/1.0	chrome/markingcollection/skin/classic/markingcollection/
+style	chrome://global/content/customizeToolbar.xul	chrome://markingcollection/skin/overlay.css
+style	chrome://browser/content/browser.xul	chrome://markingcollection/skin/overlay.css
+
+locale	markingcollection	en-US	chrome/markingcollection/locale/en-US/markingcollection/
+# no Japanese version
+# locale	markingcollection	ja-JP	chrome/markingcollection/locale/ja-JP/markingcollection/
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/about.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/about.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/about.xul	(revision 5703)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<window
+	class="dialog"
+	title=""
+	orient="vertical"
+	autostretch="always"
+	onload="sizeToContent()"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _setAboutInfo(addon){
+			document.getElementById("aboutVersion").setAttribute("value","Version "+addon.version);
+			var app_title = document.getElementById("MarkingCollectionOverlayString").getString("APP_DISP_TITLE");
+			document.getElementById("aboutTitle").setAttribute("value",app_title);
+			document.title = app_title + " - About";
+		}
+		function _aboutInit(aEvent){
+			window.setTimeout(
+				function(){
+					var app_id = document.getElementById("MarkingCollectionOverlayString").getString("APP_ID");
+					try{
+						var em = Components.classes["@mozilla.org/extensions/manager;1"].getService(Components.interfaces.nsIExtensionManager);
+						_setAboutInfo(em.getItemForID(app_id));
+					}catch(e){
+						Components.utils.import("resource://gre/modules/AddonManager.jsm");
+						AddonManager.getAddonByID(app_id, _setAboutInfo);
+					}
+				},0);
+		}
+		function _aboutDone(aEvent){
+		}
+		window.addEventListener("load", _aboutInit, false);
+		window.addEventListener("unload", _aboutDone, false);
+	]]>
+	</script>
+	<stringbundleset id="stringbundleset">
+		<stringbundle id="MarkingCollectionOverlayString" src="chrome://markingcollection/locale/markingcollection.properties" />
+	</stringbundleset>
+	<groupbox align="center" orient="horizontal">
+		<vbox flex="1">
+			<hbox>
+				<text id="aboutTitle" value="Wired-Marker" style="font-weight: bold; font-size: x-large;"/>
+				<spring flex="1"/>
+				<!-- <image src="chrome://markingcollection/skin/icon_32.png"/> -->
+                                <image src="chrome://markingcollection/skin/annotator-skin/alphatransparent/dasish_32_32.png"/>                               
+			</hbox>
+			<vbox flex="1" align="right">
+				<text id="aboutVersion" value=""/>
+			</vbox>
+			<separator class="thin"/>
+			<text value="Project scope:" style="font-weight: bold;"/>
+			<vbox flex="1" align="right">
+				<hbox>
+                                    <label value="Developed for the DASISH infrastructure project, WP 5, Data Enrichment and Shared Data Access."/>
+				</hbox>
+			</vbox>
+			<separator class="thin"/>
+			<text value="Home Page:" style="font-weight: bold;"/>
+			<vbox flex="1" align="right">
+                                <label value="http://dasish.eu/" class="text-link" href="http://dasish.eu/"/>
+			</vbox>
+                        <separator class="thin"/>
+			<text value="Original Concept &amp; Design:" style="font-weight: bold;"/>
+			<vbox flex="1" align="right">
+				<hbox>
+				<label value="BITS Co., Ltd." class="text-link" href="http://www.bits.cc/"/><label value="&amp;"/><label value="Prof. Okubo" class="text-link" href="http://www.nig.ac.jp/section/okubo/okubo-j.html"/>
+				</hbox>
+			</vbox>
+			<separator class="thin"/>
+			<text value="Home Page:" style="font-weight: bold;"/>
+			<vbox flex="1" align="right">
+				<label value="http://www.wired-marker.org/" class="text-link" href="http://www.wired-marker.org/"/>
+			</vbox>
+			<separator class="thin"/>
+                        <vbox flex="1">
+				<hbox>
+				<label value="The extension was modified and extended by"/><label style="margin-left: -4px; margin-right: -4px;" value="SND" class="text-link" href="http://snd.gu.se/"/><label value="in collaboration with"/><label style="margin-left: -4px; margin-right: -4px;" value="TLA - MPI." class="text-link" href="http://tla.mpi.nl/"/>
+				</hbox>
+			</vbox>
+                        <separator class="thin"/>
+		</vbox>
+	</groupbox>
+	<hbox>
+		<spacer flex="1"/>
+		<button label="Close" oncommand="window.close();"/>
+	</hbox>
+</window>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/addon.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/addon.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/addon.js	(revision 5703)
@@ -0,0 +1,396 @@
+var bitsScrapPartyAddonService = {
+	_addon : [],
+	_addon_hash : [],
+/////////////////////////////////////////////////////////////////////
+	get STRING() { return document.getElementById("MarkingCollectionOverlayString"); },
+
+	get DataSource() { return bitsObjectMng.DataSource; },
+	get Common()     { return bitsObjectMng.Common;     },
+	get Database()   { return bitsObjectMng.Database;   },
+	get XML()        { return bitsObjectMng.XML;        },
+	get gBrowser()   { return bitsObjectMng.getBrowser();},
+
+/////////////////////////////////////////////////////////////////////
+	init : function(){
+		this.loadAddon();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(){
+
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getAddonDir : function(){
+		var dir = bitsMarkingCollection.getExtInstDir().clone();
+		if(dir) dir.append("addon");
+		if(!dir.exists()) dir.create(dir.DIRECTORY_TYPE, 0700);
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	loadAddon : function(){
+		try{
+			var dir = bitsScrapPartyAddonService.getAddonDir().clone();
+			if(!dir) return;
+			var _addon = [];
+			var _addon_hash = [];
+			var entries = dir.directoryEntries;
+			while(entries.hasMoreElements()){
+				var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+				var addon_file = {};
+				if(entry.isFile() && entry.leafName.match(/^(.+)\.xml$/m)){
+					addon_file.title = RegExp.$1;
+					var xml = this.Common.convertToUnicode(this.Common.readFile(entry),"UTF-8");
+					xml = xml.replace(/[\r\n]+/img,"");
+					if(xml.match(/^.*<ADDON>.*<ID>(.*?)<\/ID>.*<\/ADDON>.*/img)){
+						addon_file.id = RegExp.$1;
+					}
+					if(addon_file.id == undefined) continue;
+
+					try{
+						var parser = new DOMParser();
+						var xmldoc = parser.parseFromString(xml, "text/xml"); //äºéã«èµ·åããæã«ãåž°ã£ãŠæ¥ãªããªãããnglayout.debug.disable_xul_cacheããšé¢ä¿ããããã ãè©³çŽ°ã¯äžæ
+						parser = undefined;
+						var elemADDON = xmldoc.getElementsByTagName("ADDON");
+						if(elemADDON && elemADDON.length>0){
+							var elems = elemADDON[0].getElementsByTagName("*");
+							var i;
+							for(i=0;i<elems.length;i++){
+								var key = elems[i].nodeName.toLowerCase();
+								addon_file[key] = {};
+								if(key.match(/observer/)){
+									//addon_file[key].value = eval(elems[i].textContent);
+								}else{
+									addon_file[key].value = elems[i].textContent;
+
+//this._dump("loadAddon():"+key+"=["+addon_file[key].value+"]");
+
+								}
+								if(elems[i].attributes && elems[i].attributes.length>0){
+									var attrs = {};
+									var attributes = elems[i].attributes;
+									var j;
+									for(j=0;j<attributes.length;j++){
+										attrs[attributes[j].name.toLowerCase()] = attributes[j].value;
+									}
+									addon_file[key].attrs = attrs;
+								}
+							}
+						}
+					}catch(ex2){
+//						bitsScrapPartyAddonService._dump("bitsScrapPartyAddonService.loadAddon(2):"+ex2);
+						continue;
+					}
+					addon_file.file = entry;
+					_addon.push(addon_file);
+					_addon_hash[addon_file.id.value] = addon_file;
+				}
+				addon_file = undefined;
+			}
+
+			bitsScrapPartyAddonService._addon = _addon;
+			bitsScrapPartyAddonService._addon_hash = _addon_hash;
+		}catch(ex){
+			bitsScrapPartyAddonService._dump("bitsScrapPartyAddonService.loadAddon():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	existsAddon : function(aIsDispPopupMenu){
+		bitsScrapPartyAddonService.loadAddon();
+		if(aIsDispPopupMenu == true){
+			var arr = [];
+			try{
+				var i;
+				for(i=0;i<bitsScrapPartyAddonService._addon.length;i++){
+					var addon = bitsScrapPartyAddonService._addon[i];
+					if(addon.id && addon.attr_mod) arr.push(addon.attr_mod.value);
+				}
+			}catch(ex){
+				bitsScrapPartyAddonService._dump("bitsScrapPartyAddonService.existsAddon():"+ex);
+			}
+			return (arr.length>0);
+		}else{
+			return (bitsScrapPartyAddonService._addon.length>0);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getAddonDBType : function(){
+		try{
+			var dbtype_arr = [];
+			var i;
+			for(i=0;i<bitsScrapPartyAddonService._addon.length;i++){
+				if(bitsScrapPartyAddonService._addon[i].dbtype) dbtype_arr.push(bitsScrapPartyAddonService._addon[i].dbtype.value);
+			}
+			if(dbtype_arr.length>0){
+				return dbtype_arr;
+			}else{
+				return undefined;
+			}
+		}catch(ex){
+			bitsScrapPartyAddonService._dump("bitsScrapPartyAddonService.getAddonDBType():"+ex);
+			return undefined;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getAddonInfo : function(){
+		try{
+			var info_arr = [];
+			var i;
+			for(i=0;i<bitsScrapPartyAddonService._addon.length;i++){
+				var info = {};
+				var key;
+				for(key in bitsScrapPartyAddonService._addon[i]){
+				if(typeof bitsScrapPartyAddonService._addon[i][key] == "function") continue;
+					info[key] = bitsScrapPartyAddonService._addon[i][key];
+				}
+				info_arr.push(info);
+			}
+			if(info_arr.length>0){
+				return info_arr;
+			}else{
+				return undefined;
+			}
+		}catch(ex){
+			bitsScrapPartyAddonService._dump("bitsScrapPartyAddonService.getAddonInfo():"+ex);
+			return undefined;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	eventListener : function(aEvent, aType, aRes){
+		try{
+			if(!aRes && aEvent.rangeParent){
+				if(aEvent.rangeParent.nodeName == "tree"){
+					var tree = aEvent.rangeParent;
+					if(tree.view.selection.count >= 1 && tree.currentIndex >= 0){
+						aRes = tree.builderView.getResourceAtIndex(tree.currentIndex);
+					}
+				}
+			}
+			var folder_addon_id = "";
+			if(aRes){
+				if(this.DataSource.isContainer(aRes)){
+					folder_addon_id = this.DataSource.getProperty(aRes, "addon_id");
+				}else{
+					var res = this.DataSource.findParentResource(aRes);
+					if(res) folder_addon_id = this.DataSource.getProperty(res, "addon_id");
+				}
+				if(!folder_addon_id || folder_addon_id == ""){
+					var dbtype = this.DataSource.getProperty(aRes, "dbtype");
+					var addon_info = bitsMarkingCollection.dbinfo.getAddonInfo(dbtype);
+					if(addon_info && addon_info.id && addon_info.id != "") folder_addon_id = addon_info.id
+				}
+			}
+
+			if(folder_addon_id != ""){
+				var addon = bitsScrapPartyAddonService._addon_hash[folder_addon_id];
+				if(addon && addon.observer) addon.observer.value(aEvent, aType, aRes);
+			}else{
+			}
+
+			var i;
+			for(i=0;i<bitsScrapPartyAddonService._addon.length;i++){
+				if(folder_addon_id == bitsScrapPartyAddonService._addon[i].id) continue;
+				var addon = bitsScrapPartyAddonService._addon[i];
+				if(addon && addon.observer) addon.observer.value(aEvent, aType, aRes);
+			}
+
+
+		}catch(ex){
+			bitsScrapPartyAddonService._dump("bitsScrapPartyAddonService.eventListener():"+ex);
+			aEvent.preventDefault();
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	builderViewObserver : {
+		canDrop : function(index, orient, tree){
+			var i;
+			for(i=0;i<bitsScrapPartyAddonService._addon.length;i++){
+				var addon = bitsScrapPartyAddonService._addon[i];
+				if(addon && addon.builderviewobserver && addon.builderviewobserver.value && addon.builderviewobserver.value.canDrop) addon.builderviewobserver.value.canDrop(index, orient, tree);
+			}
+		},
+		onDrop : function(row, orient, tree, XferDataSet, aState){
+			var i;
+			for(i=0;i<bitsScrapPartyAddonService._addon.length;i++){
+				var addon = bitsScrapPartyAddonService._addon[i];
+				if(addon && addon.builderviewobserver && addon.builderviewobserver.value && addon.builderviewobserver.value.onDrop) setTimeout(addon.builderviewobserver.value.onDrop, 0, row, orient, tree, XferDataSet, aState);
+			}
+		},
+		onToggleOpenState     : function(row){},
+		onCycleHeader         : function(){},
+		onSelectionChanged    : function(){},
+		onCycleCell           : function(aRow, pColID ){},
+		isEditable            : function(){},
+		onSetCellText         : function(){},
+		onPerformAction       : function(){},
+		onPerformActionOnRow  : function(){},
+		onPerformActionOnCell : function(aAction, aRow, aColID ){},
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onPopupShowing : function(aEvent,aRes){
+		try{
+			var i;
+			for(i=0;i<bitsScrapPartyAddonService._addon.length;i++){
+				var addon = bitsScrapPartyAddonService._addon[i];
+				if(addon.id && addon.attr_mod) bitsScrapPartyAddonService.createMenu(aEvent.target, addon.id.value, aRes);
+			}
+		}catch(ex){
+			bitsScrapPartyAddonService._dump("bitsScrapPartyAddonService.onPopupShowing():"+ex);
+			aEvent.preventDefault();
+		}
+
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onPopupHiding : function(aEvent){
+		var i;
+		var elem = aEvent.target.lastChild;
+		for(i=aEvent.target.childNodes.length-1;i>=0;i--){
+			aEvent.target.removeChild(aEvent.target.childNodes[i]);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onCommand : function(aEvent,aRes){
+
+		var res = aRes;
+		if(!res){ aEvent.preventDefault(); return; }
+		var fid   = this.DataSource.getProperty(res,"id");
+		var type   = this.DataSource.getProperty(res,"type");
+		var title  = this.DataSource.getProperty(res,"title");
+		var dbtype = this.DataSource.getProperty(res,"dbtype");
+
+		var addon_file = bitsScrapPartyAddonService._addon_hash[aEvent.target.id];
+		var label = aEvent.target.label;
+		if(!this.Common.confirm("[ "+label+" ]"+ this.STRING.getString("CONFIRM_ADDON_FOLDER_ATTR_CHANGE"))){return;}
+
+
+		if(addon_file.icon) this.DataSource.setProperty(res,"icon",addon_file.icon.value);
+
+
+		var property_arr = [];
+		if(addon_file.id) property_arr.push("<ID>"+addon_file.id.value+"</ID>");
+		if(addon_file.title) property_arr.push("<TITLE>"+addon_file.title.value+"</TITLE>");
+		if(addon_file.icon) property_arr.push("<ICON>"+addon_file.icon.value+"</ICON>");
+
+		if(property_arr.length>0){
+			var rtnFolder = this.Database.getFolderFormID(fid,dbtype);
+			if(rtnFolder && rtnFolder.length && rtnFolder.length>0){
+				this.Database.removeFolder(fid,dbtype);
+
+				var fid_property = rtnFolder[0].fid_property;
+				if(!fid_property || fid_property == "") fid_property = "<PROPERTY></PROPERTY>";
+				try{
+					var parser = new DOMParser();
+					var xmldoc = parser.parseFromString(fid_property, "text/xml");
+					parser = undefined;
+				}catch(ex){}
+				if(xmldoc){
+					fid_property = "";
+					var parentNode = null;
+					var xPathResult = bitsObjectMng.XPath.evaluate('/PROPERTY[1]', xmldoc);
+					if(xPathResult && xPathResult.snapshotLength>0){
+						parentNode = xPathResult.snapshotItem(0);
+						var addon_node = parentNode.getElementsByTagName("ADDON")[0];
+						if(addon_node) parentNode.removeChild(addon_node);
+					}
+					xPathResult = undefined;
+
+					var addon_node = xmldoc.createElement("ADDON");
+					if(addon_node){
+						parentNode.appendChild(addon_node);
+						if(addon_file.id){
+							var node = xmldoc.createElement("ID");
+							if(node){
+								node.textContent = addon_file.id.value;
+								addon_node.appendChild(node);
+							}
+						}
+						if(addon_file.title){
+							var node = xmldoc.createElement("TITLE");
+							if(node){
+								node.textContent = addon_file.title.value;
+								addon_node.appendChild(node);
+							}
+						}
+						if(addon_file.icon){
+							var node = xmldoc.createElement("ICON");
+							if(node){
+								node.textContent = addon_file.icon.value;
+								addon_node.appendChild(node);
+							}
+						}
+					}
+					var s = new XMLSerializer();
+					fid_property = s.serializeToString(xmldoc);
+					s = undefined;
+
+				}else{ //å¿µã®ãã
+					fid_property = "<PROPERTY><ADDON>" + property_arr.join("") + "</ADDON></PROPERTY>";
+				}
+
+
+				rtnFolder[0].fid_property = fid_property;
+				if(rtnFolder[0].dbtype) delete rtnFolder[0].dbtype;
+				this.Database.addFolder(rtnFolder[0],dbtype,false);
+				bitsMarkingCollection.checkFolderNameRepetition(dbtype);
+				var newFlds = this.Database.getFolderFormID(fid,dbtype);
+				if(newFlds){
+					this.DataSource.setProperty(res,"title",newFlds[0].fid_title);
+					this.DataSource.setProperty(res,"dbtype",dbtype);
+					if(addon_file.id) this.DataSource.setProperty(res,"addon_id",addon_file.id.value);
+					this.DataSource.flush();
+				}
+			}
+		}
+		return;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createMenu : function(aParentNode,aID,aRes){
+
+		var elemMenuitem = document.createElement("menuitem");
+		if(elemMenuitem){
+			var addon_file = bitsScrapPartyAddonService._addon_hash[aID];
+
+//this._dump("createMenu():addon_file=["+addon_file+"]");
+
+			var label = (addon_file.menu_title?addon_file.menu_title.value:addon_file.title.value);
+			var res = aRes;
+			var fid = this.DataSource.getProperty(res, "id");
+			var dbtype = this.DataSource.getProperty(res, "dbtype");
+			var folder_addon_id = this.DataSource.getProperty(res, "addon_id");
+
+			elemMenuitem.setAttribute("id",aID);
+			elemMenuitem.setAttribute("label",label);
+			if(addon_file.icon.value != ""){
+				elemMenuitem.setAttribute("image",addon_file.icon.value);
+			}else{
+				elemMenuitem.setAttribute("image","chrome://markingcollection/skin/extensions_16.png");
+			}
+			elemMenuitem.setAttribute("class","menuitem-iconic");
+
+			if(addon_file.id.value == folder_addon_id){
+				elemMenuitem.setAttribute("disabled","true");
+			}else{
+				elemMenuitem.removeAttribute("disabled");
+			}
+
+			aParentNode.appendChild(elemMenuitem);
+		}
+
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/annotation-service.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/annotation-service.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/annotation-service.js	(revision 5703)
@@ -0,0 +1,307 @@
+var annotationFramework = (function() {
+    // default value for REST service
+    // SND backend for first tests
+    // var default_backend = "http://pelle.ssd.gu.se:8080/exist/rest/db/annotation-framework/api/annotations.xql";
+    // MPI backend
+    var default_backend = "https://lux17.mpi.nl/ds/webannotator";
+
+    return {
+        getDefaultBackend: function() {
+            return default_backend;
+        },
+        getBackend: function() {
+            // selected_state values: "" (empty value as long as Settings Dialog has not been opened) OR "WM_REST_DEFAULT" OR "WM_REST_UserDefined"
+            // user-specified value for REST service
+            var selected_state = nsPreferences.copyUnicharPref("wiredmarker.marker.initdata.url", "");
+            if (selected_state === "WM_REST_UserDefined") {
+                return nsPreferences.copyUnicharPref("wiredmarker.marker.initdata.url_format", "");
+            } else {
+                return default_backend;
+            }
+        },
+        getAnnotations: function(url, callback) {
+            annotationProxy.log('calling the annotation backend ');
+            
+            //default get all
+            var requestURL = this.getBackend() + '/api/annotations';
+            if(url != '' || url === undefined){
+                requestURL += '?link='+url;
+            }
+            
+            $.ajax({
+                type: "GET",
+                url: this.getBackend() + '/api/annotations?link='+url,
+                dataType: "xml",
+                beforeSend: function(xhr){xhr.setRequestHeader('Content-Type', 'application/xml');},
+                success: function(xml, textStatus, jqXHR) {
+                    var annotations = Array();
+                    
+                    $xml = $.parseXML(jqXHR.responseText);
+                    annotationProxy.log($xml);
+                    
+                    jQuery($xml).find('annotationInfo').each(function() {
+                        annotationProxy.log(this);
+                        annotationProxy.log(this.getAttribute('ref'));
+                        
+                        annotations.push(this.getAttribute('ref'));
+                    });
+                    
+                    callback.call(undefined, annotations);
+                },
+                error: function(result){
+                    annotationProxy.log('ERROR calling the annotation backend '+result);
+                }
+            });
+        },
+        logout : function(){
+          $.ajax({
+                type: "GET",
+                url: this.getBackend() + '/api/authentication/logout',
+                success: function(xml, textStatus, jqXHR) {},
+                error: function(jqXHR, status, thrownError) {
+                    alert('Logout failed. Status code: '+jqXHR.status);
+                }
+            });
+        },
+        getAnnotation: function(annotationURL, callback) {
+            annotationProxy.log('getAnnotation '+annotationURL);
+            $.ajax({
+                type: "GET",
+                url: annotationURL,
+                dataType: "xml",
+                success: function(xml, textStatus, jqXHR) {
+                    $xml = $.parseXML(jqXHR.responseText);
+                    annotationProxy.log('GOT annotation in getAnnotation :'+xml);    
+                    annotationProxy.log(xml);
+                    var om_object = annotation2om_object($xml);
+                    annotationProxy.log('converted to om_object');
+                    annotationProxy.log(om_object);
+                    callback.call(undefined, om_object);
+                },
+                error: function(error) {
+                    annotationProxy.log('ERROR in getAnnotation ');
+                    annotationProxy.log(error);
+                }
+            });
+        },
+        getAnnotationXml: function(aid, callback) {
+            annotationProxy.log('getAnnotationXml '+aid);
+            $.ajax({
+                type: "GET",
+                url: this.getBackend() + '/api/annotations/' + aid,
+                dataType: "xml",
+                success: function(xml, textStatus, jqXHR) {
+                    callback.call(undefined, jqXHR.responseText);
+                },
+                error: function(error) {
+                    annotationProxy.log('ERROR in getAnnotation ');
+                    annotationProxy.log(error);
+                }
+            });
+        },        
+        deleteAnnotationByOid: function(oid) {
+            annotationProxy.log('entering DELETE for oid: '+oid);
+            var aid = annotationProxy.getAidFromOid(oid);
+            
+            annotationProxy.log('Resolved the AID for oid: '+oid+' for aid: '+aid);
+            if (aid) { // ajax request only for annotations posted to and available in backend database
+                return $.ajax({
+                    url: this.getBackend() + '/api/annotations/' + aid,
+                    type: 'DELETE',
+                    error: function(jqXHR, status, thrownError) {
+                        // Log any errors to debug console
+                        annotationProxy.log("+ + + + + + + + + + + + + + + + + + + + + + + +");
+                        annotationProxy.log("Status Code (DELETE request): " + jqXHR.status);
+                        annotationProxy.log("Error DELETE request: " + thrownError);
+                    },
+                    success: function(result) {            
+                        annotationProxy.log("DELETE request was successful.");
+                        annotationProxy.log(result);
+                    }
+                });
+            }
+        },
+        postAnnotation: function(annotation, oid, callback) {
+            $.ajax({
+                type: "POST",
+                url: this.getBackend() + '/api/annotations?store=true',
+                dataType: "xml",
+                data: annotation,
+                contentType: "application/xml",
+                error: function(jqXHR, status, thrownError) {
+                    // Handle any errors
+                    
+                    annotationProxy.log("+ + + + + + + + + + + + + + + + + + + + + + + +");
+                    annotationProxy.log("Status Code: " + jqXHR.status);
+                    annotationProxy.log("Error : " + thrownError);
+                    
+                },
+                complete: function(jqXHR, status, responseText) {
+                    
+                    annotationProxy.log("+ + + + + + + + + + + + + + + + + + + + + + + +");
+                    annotationProxy.log("Status Code POST annotation request: " + jqXHR.status);
+                    annotationProxy.log("Response Body: " + jqXHR.responseText);
+                    annotationProxy.log("+ + + + + + + + + + + + + + + + + + + + + + + +");                    
+                    
+                    if(jqXHR.status === "200") {
+                        var response = jqXHR.responseText.match(/URI="(.+?)"/)[1].split('/');
+                        var aid = response[response.length - 1];
+
+
+
+                        annotationProxy.log("OID: " + oid);
+                        annotationProxy.log("AID: " + aid);
+                        // Firebug.Console.log(bitsObjectMng.Database.getObject({oid: oid}));
+
+                        var aSql = 'UPDATE om_object SET dasish_aid = "' + aid + '" WHERE oid="' + oid + '"';
+                        annotationProxy.log(aSql);
+                        // insert request to local sqlite database where aid gets inserted
+                        if(bitsObjectMng.Database._idExists('local', oid, true)){
+                            var rtn = bitsObjectMng.Database.cmd('local', aSql); // aMode = "" defaults to predefined value; aSql contains sql statement
+                            annotationProxy.log('UPDATE of AID done in local');
+                        }else if(bitsObjectMng.Database._idExists('_uncategorized', oid, true)){
+                             var rtn = bitsObjectMng.Database.cmd('_uncategorized', aSql); // aMode = "" defaults to predefined value; aSql contains sql statement
+                             annotationProxy.log('UPDATE of AID done in _uncategorized');
+                        }
+
+                        // Database insert request is true if successful
+                        // Firebug.Console.log(rtn);
+                        annotationProxy.log('called cache stuff');
+                        callback.call(undefined, aid);  
+                    }else{
+                        annotationProxy.showError({title:"Error posting annotation",info:jqXHR.responseText});
+                    }
+                }
+            });
+        },
+        putAnnotation: function(aid, annotation) {
+            return $.ajax({
+                type: "PUT",
+                url: this.getBackend() + '/api/annotations/'+aid+'/body',
+                dataType: "xml",
+                data: annotation,
+                contentType: "application/xml",
+                error: function(jqXHR, status, thrownError) {
+                    // Handle any errors
+                    
+                    annotationProxy.log("+ + + + + + + + + + + + + + + + + + + + + + + +");
+                    annotationProxy.log("Faild to PUT updated annotation: " + aid);
+                    annotationProxy.log("Status Code: " + jqXHR.status);
+                    annotationProxy.log("Error : " + thrownError);
+                    
+                    annotationProxy.showError(jqXHR.responseText);
+                    
+                },
+                complete: function(jqXHR, status, responseText) {
+                    var response = jqXHR.responseText.match(/URI="(.+?)"/)[1].split('/');
+                    var aid = response[response.length - 1];
+
+                    annotationProxy.log("+ + + + + + + + + + + + + + + + + + + + + + + +");
+                    annotationProxy.log("Status Code PUT request: " + jqXHR.status);
+                    annotationProxy.log("Response Body: " + jqXHR.responseText);
+                    annotationProxy.log("+ + + + + + + + + + + + + + + + + + + + + + + +");
+
+                }
+            });
+        },
+        putFullAnnotation: function(aid, annotation) {
+            return $.ajax({
+                type: "PUT",
+                url: this.getBackend() + '/api/annotations/'+aid,
+                dataType: "xml",
+                data: annotation,
+                contentType: "application/xml",
+                error: function(jqXHR, status, thrownError) {
+                    // Handle any errors
+                    
+                    annotationProxy.log("+ + + + + + + + + + + + + + + + + + + + + + + +");
+                    annotationProxy.log("Faild to PUT updated annotation: " + aid);
+                    annotationProxy.log("Status Code: " + jqXHR.status);
+                    annotationProxy.log("Error : " + thrownError);
+                    
+                    annotationProxy.showError({title:"HTTP: "+jqXHR.status+" - Update annotation error", info:thrownError});
+                },
+                complete: function(jqXHR, status, responseText) {
+                    var response = jqXHR.responseText.match(/URI="(.+?)"/)[1].split('/');
+                    var aid = response[response.length - 1];
+
+                    annotationProxy.log("+ + + + + + + + + + + + + + + + + + + + + + + +");
+                    annotationProxy.log("Status Code PUT request: " + jqXHR.status);
+                    annotationProxy.log("Response Body: " + jqXHR.responseText);
+                    annotationProxy.log("+ + + + + + + + + + + + + + + + + + + + + + + +");
+
+                }
+            });
+        },
+        postCache: function(targetURL, cacheMetadata, cache, cacheMimeType){
+            var xhr = new XMLHttpRequest();
+            xhr.onload = function() {
+                annotationProxy.log("Cache POST status for "+targetURL+": "+xhr.status);
+                annotationProxy.log(xhr.statusText);
+            };
+            xhr.open("POST", targetURL, true);
+            
+            var boundary = '---------------------------'+Date.now();
+            xhr.setRequestHeader("Content-Type","multipart/mixed; boundary="+boundary);
+            
+            //build the multipart body
+            var postBody = '--'+boundary+'\n' +
+                           'Content-Type:application/xml\n\n' +
+                           cacheMetadata+'\n\n' +
+                           '--'+boundary+'\n' +
+                           'Content-Type:'+cacheMimeType+'\n\n' +
+                           cache+'\n\n' +
+                           '--'+boundary+'--';
+            annotationProxy.log(postBody);    
+            
+            xhr.addEventListener("error", function(errorSendingEvent) {
+                annotationProxy.showError({title:"Cache Error", info:"Error sending cached representation to backend"});
+            }, false);
+            
+            xhr.send(postBody);
+        },
+        getTargets : function(aid, callback){
+            $.ajax({
+                type: "GET",
+                url: this.getBackend() + '/api/annotations/'+aid,
+                dataType: "xml",
+                success: function(xml, textStatus, jqXHR) {
+                    var targets = Array();
+                    
+                    $xml = $.parseXML(jqXHR.responseText);
+                    
+                    jQuery($xml).find('targetInfo').each(function() {
+                        annotationProxy.log(this);
+                        annotationProxy.log(this.getAttribute('ref'));
+                        
+                        targets.push(this.getAttribute('ref'));
+                    });
+                    callback.call(undefined, targets);                
+                },
+                error: function(jqXHR, status, thrownError) {
+                    annotationProxy.showError({title:"Resolving targets", info:"Error resolving targets for\n AID "+aid});
+                }
+            });         
+        },
+        getCacheURL: function (targetURL, callback){
+            $.ajax({
+                type: "GET",
+                url: targetURL,
+                dataType: "xml",
+                success: function(xml, textStatus, jqXHR) {
+                    $xml = $.parseXML(jqXHR.responseText);
+                    
+                    jQuery($xml).find('cached').each(function() {
+                        var cacheURL = this.getAttribute('ref');
+                        callback.call(undefined, cacheURL);
+                    });
+                    
+                                 
+                }
+            });               
+        },
+        setBackend: function(url) {
+            this.backend = url;
+        }
+    }
+}());
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/annotations.wired.marker.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/annotations.wired.marker.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/annotations.wired.marker.js	(revision 5703)
@@ -0,0 +1,196 @@
+var annotationProxy = (function() {
+    return {
+        defaltDatabase : 'dwan',
+        /***
+         * Get current user info
+         * @returns {undefined} false if user in not loged in. user object if loged in
+         */
+        getLoggedInInfo: function(callback) {  
+            var authURL = annotationFramework.getBackend() + "/api/authentication/principal";
+            $.ajax({
+                type: 'GET',
+                url: authURL,
+                dataType: "xml",
+                timeout: 4000, // In order to be able to catch server inaccessibility, e.g. due to security restrictions.
+                success: function(xml ,textStatus, jqXHR) {
+                   $xml = $.parseXML(jqXHR.responseText);
+                   var user = new Object();
+                   user.dislayName = jQuery($xml).find('displayName').text();
+                   
+                   user.email = jQuery($xml).find('eMail').text();
+                   callback.call(undefined, {status:jqXHR.status, user:user});
+                },
+                error: function(jqXHR, status, thrownError) {
+                    // alert("statusCode in ajax error method: " + jqXHR.status);
+                    callback.call(undefined, {status: jqXHR.status});
+                }
+            });
+            
+            var user_placeholder = {
+                URI: 'https://lux17.mpi.nl/ds/webannotator/api/users/00000000-0000-0000-0000-0000000009999',
+                uid: '00000000-0000-0000-0000-0000000009999',
+                dislayName: 'Test Testsson',
+                eMail: 'test@test.com'
+            }; 
+
+            //return user_placeholder;
+        },
+        getAnnotations: function(url) {
+            annotationProxy.log('getAnnotations for: ' + url);
+
+            annotationFramework.getAnnotations(url,
+                function(annotations) {
+                    annotationProxy.log('got annotations ');
+                    annotationProxy.log(annotations);
+
+                    $.each(annotations, function(index, annotationURL) {
+                        annotationFramework.getAnnotation(annotationURL, function(result) {
+                            annotationProxy.log('checking if annotation exist in DB:');
+                            annotationProxy.log(result);
+
+                            //check if this annotation is already in the one of the local databases
+                            if (bitsObjectMng.Database._dasish_aid_exists(annotationProxy.defaltDatabase, result.dasish_aid, true)) {
+                                annotationProxy.log('AID already in database '+annotationProxy.defaltDatabase+': ' + result.dasish_aid);
+                            }else if(bitsObjectMng.Database._dasish_aid_exists('_uncategorized', result.dasish_aid, true)){
+                                annotationProxy.log('AID already in database _uncategorized: ' + result.dasish_aid);
+                            } else {
+                                annotationProxy.log('Adding annotation to database : ' + result.dasish_aid);
+                                bitsObjectMng.Database.addObject(result, annotationProxy.defaltDatabase, undefined);
+                            }
+                        });
+                    });
+                }
+            );
+        },
+        postAnnotation: function(om_object) {
+            var annotation = om_object2annotation(om_object);
+            annotationFramework.postAnnotation(annotation, om_object.oid, 
+                function(aid){
+                    annotationProxy.log('Annotation posted and returned AID: '+aid);
+                    annotationProxy.log('Geting target list for posting cache...');
+                    annotationFramework.getTargets(aid, 
+                        function(targets){
+                            //POST cache representation for HTML
+                            var htmlDump = annotationProxy.getCurrentHtmlDocument();
+                            var cacheMetadata = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n'+
+                                                '<cashedRepresentationInfo xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \n'+
+                                                '    URI="tmpNewCacheURI" xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">\n'+
+                                                '    <mimeType>text/html</mimeType>\n'+
+                                                '    <tool>DWAN</tool>\n'+
+                                                '    <type>html</type>\n'+
+                                                '</cashedRepresentationInfo>';
+                            var cacheMimeType = 'text/html';
+                            $.each(targets, function(index, targetURL){
+                                var xpointer = encodeURIComponent(om_object_xpointer(om_object));
+                                
+                                var xpointer = xpointer.replace(/%/g,'--');
+                                annotationProxy.log(xpointer);
+                                targetURL += '/fragment/'+xpointer+'/cached';
+                                
+                                //cache html-dump
+                                annotationFramework.postCache(targetURL, cacheMetadata, htmlDump, cacheMimeType);
+                            });
+                    });
+                });
+        },
+        updateAnnotation: function(om_object) {
+            var aid = this.getAidFromOid(om_object.oid);
+            this.log('updateAnnotation : ' + JSON.stringify(om_object));
+            this.log('UPDATED ANNOTATION AS XML (aid: ' + aid + ')');
+            var xml = om_object_annotation_body(om_object);
+
+            this.log(xml);
+
+            annotationFramework.putAnnotation(aid, xml);
+        },
+        updateFullAnnotation: function(om_object) {
+            var aid = this.getAidFromOid(om_object.oid);
+            annotationFramework.getAnnotationXml(aid, function(annotation){
+                //update the annotation
+                var note = om_object.oid_property.match(/<NOTE>(.+?)<\/NOTE>/)[1];
+                annotation = $.parseXML(annotation);
+                $(annotation).find('headline').text(om_object.oid_title);
+                $(annotation).find('body').find('xhtml\\:span').text(note);
+                
+                var xmlString = (new XMLSerializer()).serializeToString(annotation);
+
+                annotationFramework.putFullAnnotation(aid, xmlString);
+            });
+        },
+        openRemoteCache: function(event){
+            this.log(event);
+            var oid = bitsAutocacheService.bitsItemView.object.oid;
+            var cacheUrl = this.getCacheURL(oid);
+            
+            
+        },
+        getCacheURL: function(oid, tabbed){
+            var aid = this.getAidFromOid(oid);
+            annotationFramework.getTargets(aid, function(targets){
+                var targetURL = targets[0];
+                annotationProxy.log('targets');
+                annotationProxy.log(targets[0]);
+                annotationFramework.getCacheURL(targetURL, function(cacheURL){
+                    cacheURL += '/stream';
+                    annotationProxy.log('cacheURL');
+                    annotationProxy.log(cacheURL);
+                    
+                    bitsAutocacheService.Common.loadURL(cacheURL,tabbed);
+                });
+            });
+            
+        },
+        getAidFromOid: function(oid) {
+            var aSql = 'SELECT dasish_aid FROM om_object WHERE oid="' + oid + '"';
+            var rtn; 
+
+            if(bitsObjectMng.Database._idExists('local', oid, true)){
+                rtn = bitsObjectMng.Database.selectB('local', aSql);
+            }else if(bitsObjectMng.Database._idExists('_uncategorized', oid, true)){
+                 rtn = bitsObjectMng.Database.selectB('_uncategorized', aSql);
+            }
+            
+            return rtn[0].dasish_aid;
+        },
+        getCurrentHtmlDocument : function(){
+            var xmlS = new XMLSerializer();
+            var temp = xmlS.serializeToString(bitsAutocacheService.gBrowser.contentDocument);
+            return temp;
+        },
+        log: function(message) {
+            //log to console
+            if (typeof Firebug != 'undefined' && Firebug.Console) {
+                Firebug.Console.log(message);
+            }
+            //log this to the local proxy
+            /*
+             $.ajax({
+             type: "POST",
+             url: 'http://localhost/annotations/annotator-service/test/proxy.php',
+             data: {log: 'true', message: message}
+             });
+             */
+        },
+        showError: function(message) {
+            
+            if(typeof message != 'object') {
+                var tmp = new Object();
+                tmp.info = message;
+                message = tmp;
+            }
+            
+            message.info = message.info.substring(message.info.lastIndexOf("<body>")+6,message.info.lastIndexOf("</body>"));
+            message.info = message.info.replace("<p>", "\n");
+            message.info = message.info.replace("<h1>", "\n");
+            message.info = message.info.replace("<h3>", "\n");
+            message.info = message.info.replace("</p>", "\n");
+            message.info = message.info.replace(/<(?:.|\n)*?>/gm, '');
+            
+            window.openDialog("chrome://markingcollection/content/infoDialog.xul", "", 
+                              "chrome,centerscreen,modal", 
+                              message);
+            
+            //alert(body);
+        }
+    }
+}());
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/conversion.utils.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/conversion.utils.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/conversion.utils.js	(revision 5703)
@@ -0,0 +1,232 @@
+/***
+ * Convert an DWAN XML annotation to a WiredMarker annotation object
+ * @param {object} annotation annotation object from webservice
+ * @returns {annotationToOmObject.om_object} an object for Wired Marker
+ */
+function annotation2om_object(annotation) {
+    var om_object = {
+        oid: "",
+        pfid: "0",
+        doc_title: "",
+        doc_url: "",
+        con_url: "",
+        bgn_dom: "",
+        end_dom: "",
+        oid_title: "",
+        oid_property: "<PROPERTY><HYPER_ANCHOR></HYPER_ANCHOR><NOTE></NOTE></PROPERTY>",
+        oid_mode: "0",
+        oid_type: "text",
+        oid_txt: "", //must be the marked text!
+        oid_img: null,
+        oid_date: "",
+        pfid_order: 8
+    };
+
+    //example anchor:
+    // http://snd.gu.se/#hyperanchor1.3://div[@id="node-170"]/div[1]/div[1]/div[1]/div[1]/p[1](294)(3)(sse)&
+    // //div[@id="node-170"]/div[1]/div[1]/div[1]/div[1]/p[1](365)(3)(kav)&
+    // border:thin dotted rgb(255,204,0);background-color:rgb(255,255,204);color:rgb(0,0,0); 
+
+    var title = $(annotation).find('headline').text().trim();
+    var body = $(annotation).find('body').find('xhtml\\:span').text().trim();
+    var style = $(annotation).find('body').find('xhtml\\:span').attr('style');
+    var type = $(annotation).find('mimeType').text();
+    var link = $(annotation).find('link').text();
+    var time = $(annotation).find('lastModified').text();
+
+    //get aid
+    var URI = $(annotation).find('annotation').attr('URI');
+    om_object.dasish_aid = URI.split('/annotations/')[1];
+
+    //get xpointer from url
+    var urlParts = link.split("#xpointer");
+
+    om_object.doc_url = urlParts[0];
+    om_object.con_url = urlParts[0];
+    var xpointer = urlParts[1];
+
+    //start dom
+    xpointer.match(/start-point\(string-range\((.+?)\)\)\/range-to\(/);
+    var parts = RegExp.$1.split(',');
+    var parts0 = parts[0].replace('/text()[1]', '');
+    om_object.bgn_dom = parts0 + '(' + parts[2] + ')(3)';
+
+    //end dom
+    xpointer.match(/range-to\(string-range\((.+?)\)\)\)/);
+    var parts = RegExp.$1.split(',');
+    var parts0 = parts[0].replace('/text()[1]', '');
+    om_object.end_dom = parts0 + '(' + parts[2] + ')(3)';
+
+    //build hyperanchor
+    var hyperanchor = '#hyperanchor1.3' + encodeURIComponent(':' + om_object.bgn_dom.replace(/"/g, '&quot;') + '&' + om_object.end_dom.replace(/"/g, '&quot;') + '&' + style);
+
+    om_object.doc_title = title;
+    om_object.oid_title = title;
+
+    //generate oid from aid (hash)
+    om_object.oid = hashCode(om_object.dasish_aid);
+    if (om_object.oid < 0) {
+        om_object.oid = om_object.oid * -1;
+    }
+    
+    //construct annotation structure
+    om_object.oid_property = "<PROPERTY><HYPER_ANCHOR>" + om_object.doc_url + hyperanchor + "</HYPER_ANCHOR><NOTE>" + body + "</NOTE></PROPERTY>";
+
+    if (type === 'application/xml+xhtml') { //TODO: better handeling of the body
+        om_object.oid_txt = $(annotation).find('body').find('xhtml\\:span').attr('title');
+        om_object.oid_type = 'text';
+    }
+    
+    //reformat date
+    var d = new Date(time);
+    om_object.oid_date = (d.getFullYear() + '/' + (parseInt(d.getMonth()) + 1)) + '/' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
+
+    return om_object;
+}
+
+/**
+ * Converts WiredMarker annotation object to DWAN XML annotation
+ * @param {object} om_object contains wired marker object for annotation
+ * @returns {String} annotation in xml
+ */
+function om_object2annotation(om_object) {
+    var note = om_object.oid_property.match(/<NOTE>(.+?)<\/NOTE>/)[1];
+    var hyperanchor = om_object.oid_property.match(/<HYPER_ANCHOR>(.+?)<\/HYPER_ANCHOR>/)[1];
+    var style = '';
+    var timestamp = new Date(om_object.oid_date);
+
+    hyperanchor = unescape(hyperanchor);
+
+    hyperanchor.match(/^(.+\([0-9]+\)\([0-9]+\)\([\s\S]*\))&(.+\([0-9]+\)\([0-9]+\)\([\s\S]*\))&(.+)$/);
+
+    style = RegExp.$3;
+
+    var path = {};
+
+    om_object.bgn_dom.match(/(.+)\(([0-9]+)\)\(([0-9]+)\)/);
+    path.start = RegExp.$1;
+    path.startOffset = RegExp.$2;
+    path.startType = RegExp.$3;
+
+    om_object.end_dom.match(/(.+)\(([0-9]+)\)\(([0-9]+)\)/);
+    path.end = RegExp.$1;
+    path.endOffset = RegExp.$2;
+    path.endType = RegExp.$3;
+
+    var xpointer = "#xpointer(start-point(string-range(" + path.start + "/text()[1],''," + path.startOffset + "))";
+    xpointer    += "/range-to(string-range(" + path.end + "/text()[1],''," + path.endOffset + ")))";
+
+    var annotation = '<?xml version="1.0" encoding="UTF-8"?>\n\
+                      <annotation xmlns="http://www.dasish.eu/ns/addit"\n\
+                            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n\
+                            xsi:schemaLocation="http://www.dasish.eu/ns/addit http://dasish.eu/DASISH-schema.xsd"\n\
+                            xmlns:xhtml="http://www.w3.org/1999/xhtml"\n\
+                            URI="' + annotationFramework.getBackend() + '/api/annotations/00000000-0000-0000-' + om_object.oid.substring(0, 4) + '-' + om_object.oid.substring(4, 14) + '00"\n\
+                            ownerRef="' + annotationFramework.getBackend() + '/api/principals/00000000-0000-0000-' + om_object.oid.substring(0, 4) + '-' + om_object.oid.substring(4, 14) + '00">\n\
+                        <headline>' + om_object.oid_title + '</headline>\n\
+                        <lastModified>' + timestamp.toISOString() + '</lastModified>\n\
+                        <body>\n\
+                            <xmlBody>\n\
+                                <mimeType>application/xml+xhtml</mimeType>\n\
+                                <xhtml:span title="'+om_object.oid_txt+'" style="' + style + '">' + note + '</xhtml:span>\n\
+                            </xmlBody>\n\
+                        </body>\n\
+                        <targets>\n\
+                            <targetInfo ref="' + annotationFramework.getBackend() + '/api/targets/00000000-0000-0000-' + om_object.oid.substring(0, 4) + '-' + om_object.oid.substring(4, 14) + '00">\n\
+                                <link>' + om_object.doc_url + xpointer + '</link>\n\
+                                <version>' + timestamp.toISOString() + '</version>\n\
+                            </targetInfo>\n\
+                        </targets>\n\
+                        <permissions public="read"/>\n\
+                      </annotation>';
+    return annotation;
+}
+
+function om_object_xpointer(om_object){
+    var path = {};
+
+    om_object.bgn_dom.match(/(.+)\(([0-9]+)\)\(([0-9]+)\)/);
+    path.start = RegExp.$1;
+    path.startOffset = RegExp.$2;
+    path.startType = RegExp.$3;
+
+    om_object.end_dom.match(/(.+)\(([0-9]+)\)\(([0-9]+)\)/);
+    path.end = RegExp.$1;
+    path.endOffset = RegExp.$2;
+    path.endType = RegExp.$3;
+
+    var xpointer = "xpointer(start-point(string-range(" + path.start + "/text()[1],''," + path.startOffset + "))";
+    xpointer    += "/range-to(string-range(" + path.end + "/text()[1],''," + path.endOffset + ")))";    
+    
+    return xpointer;
+}
+
+function om_object_annotation_body(om_object){
+    /*{
+       "oid":"1145293257",
+       "oid_title":"erfer der dd",
+       "oid_property":"<PROPERTY><HYPER_ANCHOR>http://snd.gu.se/#hyperanchor1.3%3A%2F%2Fdiv%5B%40id%3D%26quot%3BprofilComp%26quot%3B%5D%2Ffollowing-sibling%3A%3Adiv%5B1%5D%2Fh1%5B1%5D(0)(3)%26%2F%2Fdiv%5B%40id%3D%26quot%3BprofilComp%26quot%3B%5D%2Ffollowing-sibling%3A%3Adiv%5B1%5D%2Fh1%5B1%5D(10)(3)%26border%3Athin%20dotted%20rgb(255%2C204%2C0)%3Bbackground-color%3Argb(255%2C255%2C204)%3Bcolor%3Argb(0%2C0%2C0)%3B</HYPER_ANCHOR><NOTE>Svensk nod</NOTE></PROPERTY>"
+    }*/
+    var note = om_object.oid_property.match(/<NOTE>(.+?)<\/NOTE>/)[1];
+    var hyperanchor = om_object.oid_property.match(/<HYPER_ANCHOR>(.+?)<\/HYPER_ANCHOR>/)[1];
+    var style = '';
+
+    hyperanchor = unescape(hyperanchor);
+    hyperanchor.match(/^(.+\([0-9]+\)\([0-9]+\)\([\s\S]*\))&(.+\([0-9]+\)\([0-9]+\)\([\s\S]*\))&(.+)$/);
+
+    style = RegExp.$3;
+    //TODO: missing om_object.oid_txt
+    /*
+<?xml version="1.0" encoding="UTF-8"?>
+<annotationBody xmlns="http://www.dasish.eu/ns/addit"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xhtml="http://www.w3.org/1999/xhtml/" 
+    xsi:schemaLocation="http://www.dasish.eu/ns/addit file:/Users/olhsha/repositories/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
+    <xmlBody mimeType="application/xml">
+        <any>
+            <xhtml:span style="background-color:rgb(0,0,153);color:rgb(255,255,255);border: thick solid rgb(0, 0, 153);">Some background information on Sagrada FamÃ­lia. attempt # 1</xhtml:span>
+        </any>
+    </xmlBody>
+</annotationBody>
+     */
+        
+    var annotationBody='<?xml version="1.0" encoding="UTF-8"?>\n\
+<annotationBody xmlns="http://www.dasish.eu/ns/addit"\n\
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n\
+    xmlns:xhtml="http://www.w3.org/1999/xhtml/" \n\
+    xsi:schemaLocation="http://www.dasish.eu/ns/addit file:/Users/olhsha/repositories/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">\n\
+    <xmlBody mimeType="application/xml">\n\
+        <any>\n\
+            <xhtml:span title="'+om_object.oid_txt+'" style="' + style + '">' + note + '</xhtml:span>\n\
+        </any>\n\
+    </xmlBody>\n\
+</annotationBody>';
+    
+    return annotationBody;
+}
+
+function hashCode(str) {
+    var hash = 0;
+    if (str == undefined || str.length == 0)
+        return hash;
+    for (i = 0; i < str.length; i++) {
+        char = str.charCodeAt(i);
+        hash = ((hash << 5) - hash) + char;
+        hash = hash & hash; // Convert to 32bit integer
+    }
+    return hash;
+}
+
+if (!Date.prototype.toISOString) {
+    Date.prototype.toISOString = function() {
+        function pad(n) {
+            return n < 10 ? '0' + n : n
+        }
+        return this.getUTCFullYear() + '-'
+                + pad(this.getUTCMonth() + 1) + '-'
+                + pad(this.getUTCDate()) + 'T'
+                + pad(this.getUTCHours()) + ':'
+                + pad(this.getUTCMinutes()) + ':'
+                + pad(this.getUTCSeconds()) + 'Z';
+    };
+}
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery-1.10.2.min.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery-1.10.2.min.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery-1.10.2.min.js	(revision 5703)
@@ -0,0 +1,6 @@
+/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
+//@ sourceMappingURL=jquery-1.10.2.min.map
+*/
+(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=st(),k=st(),E=st(),S=!1,A=function(e,t){return e===t?(S=!0,0):0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=mt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+yt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,n,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function lt(e){return e[b]=!0,e}function ut(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ct(e,t){var n=e.split("|"),r=e.length;while(r--)o.attrHandle[n[r]]=t}function pt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return lt(function(t){return t=+t,lt(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ut(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ut(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=K.test(n.querySelectorAll))&&(ut(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ut(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ut(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return pt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?pt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:lt,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?lt(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:lt(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?lt(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:lt(function(e){return function(t){return at(e,t).length>0}}),contains:lt(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:lt(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},o.pseudos.nth=o.pseudos.eq;for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=ft(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=dt(n);function gt(){}gt.prototype=o.filters=o.pseudos,o.setFilters=new gt;function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function yt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)),lt(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||Nt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:xt(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=xt(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=xt(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=vt(function(e){return e===t},s,!0),p=vt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[vt(bt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return wt(l>1&&bt(f),l>1&&yt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&Tt(e.slice(l,r)),i>r&&Tt(e=e.slice(r)),i>r&&yt(e))}f.push(n)}return bt(f)}function Ct(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=xt(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?lt(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=mt(e)),n=t.length;while(n--)o=Tt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Ct(i,r))}return o};function Nt(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&yt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}r.sortStable=b.split("").sort(A).join("")===b,r.detectDuplicates=S,p(),r.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(f.createElement("div"))}),ut(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ct("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||ct(B,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!l||i&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t
+}({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n)return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!I(r):!x.isEmptyObject(r))return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]));x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else r=t}return r}function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l));return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,r=0,o=x(this),a=e.match(T)||[];while(t=a[r++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++)if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--)r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--)s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--)if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)x.event.remove(e,d+t[u],n,r,!0);x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),f=u;f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault();if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(x.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return!!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(st.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Ct=/^(?:checkbox|radio)$/i,Nt=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:x.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h))return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++)i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u);if(o)for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++)i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")));l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++)x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)x.event.add(t,n,s[n][r])}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events)x.removeEvent(t,r,i.handle);t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n));return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a)r[a]&&Ot(i,r[a]);if(t)if(n)for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++)Mt(i,r[a]);else Mt(e,o);return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===x.type(o))x.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++)if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events)for(r in a.events)f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle);
+u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push(o))}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e))return this.each(function(t){x(this).wrapAll(e.call(this,t))});if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}x.fn.extend({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=x.css(e,n[s],!1,o);return a}return r!==t?x.style(e,n,r):x.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){nn(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:u[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{u[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(Pt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=un(e,t),Pt.detach()),Gt[e]=n),n}function un(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(x.css(e,"display"))?x.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x.support.opacity||(x.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=x.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===x.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,n){return n?x.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,n){x.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?x(e).position()[n]+"px":r):t}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!x.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||x.css(e,"display"))},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(x.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Ct.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),x.param=function(e,n){var r,i=[],o=function(e,t){t=x.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,yn,vn=x.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Cn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Nn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=x.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=o.href}catch(Ln){yn=a.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(l){var u;return o[l]=!0,x.each(e[l]||[],function(e,l){var c=l(n,r,i);return"string"!=typeof c||a||o[c]?a?!(u=c):t:(n.dataTypes.unshift(c),s(c),!1)}),u}return s(n.dataTypes[0])||!o["*"]&&s("*")}function _n(e,n){var r,i,o=x.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,l=e.indexOf(" ");return l>=0&&(i=e.slice(l,e.length),e=e.slice(0,l)),x.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&x.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?x("<div>").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b)return C;l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)C.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b))return C.abort();w="abort";for(i in{success:1,error:1,complete:1})C[i](p[i]);if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b))throw N;k(-1,N)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in l)if(l[s]&&l[s].test(o)){u.unshift(s);break}if(u[0]in r)a=u[0];else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(i in u)if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials"in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i)4!==l.readyState&&l.abort();else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,x.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++)u.tweens[a].run(o);return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++)if(r=Gn[o].call(u,e,c,u.opts))return r;return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=d&&d[r]||x.style(e,r)}if(!x.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery-1.8.3.min.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery-1.8.3.min.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery-1.8.3.min.js	(revision 5703)
@@ -0,0 +1,2 @@
+/*! jQuery v1.8.3 jquery.com | jquery.org/license */
+(function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r<i;r++)v.event.add(t,n,u[n][r])}o.data&&(o.data=v.extend({},o.data))}function Ot(e,t){var n;if(t.nodeType!==1)return;t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),n==="object"?(t.parentNode&&(t.outerHTML=e.outerHTML),v.support.html5Clone&&e.innerHTML&&!v.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):n==="input"&&Et.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):n==="option"?t.selected=e.defaultSelected:n==="input"||n==="textarea"?t.defaultValue=e.defaultValue:n==="script"&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(v.expando)}function Mt(e){return typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName("*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll("*"):[]}function _t(e){Et.test(e.type)&&(e.defaultChecked=e.checked)}function Qt(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Jt.length;while(i--){t=Jt[i]+n;if(t in e)return t}return r}function Gt(e,t){return e=t||e,v.css(e,"display")==="none"||!v.contains(e.ownerDocument,e)}function Yt(e,t){var n,r,i=[],s=0,o=e.length;for(;s<o;s++){n=e[s];if(!n.style)continue;i[s]=v._data(n,"olddisplay"),t?(!i[s]&&n.style.display==="none"&&(n.style.display=""),n.style.display===""&&Gt(n)&&(i[s]=v._data(n,"olddisplay",nn(n.nodeName)))):(r=Dt(n,"display"),!i[s]&&r!=="none"&&v._data(n,"olddisplay",r))}for(s=0;s<o;s++){n=e[s];if(!n.style)continue;if(!t||n.style.display==="none"||n.style.display==="")n.style.display=t?i[s]||"":"none"}return e}function Zt(e,t,n){var r=Rt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function en(e,t,n,r){var i=n===(r?"border":"content")?4:t==="width"?1:0,s=0;for(;i<4;i+=2)n==="margin"&&(s+=v.css(e,n+$t[i],!0)),r?(n==="content"&&(s-=parseFloat(Dt(e,"padding"+$t[i]))||0),n!=="margin"&&(s-=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0)):(s+=parseFloat(Dt(e,"padding"+$t[i]))||0,n!=="padding"&&(s+=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0));return s}function tn(e,t,n){var r=t==="width"?e.offsetWidth:e.offsetHeight,i=!0,s=v.support.boxSizing&&v.css(e,"boxSizing")==="border-box";if(r<=0||r==null){r=Dt(e,t);if(r<0||r==null)r=e.style[t];if(Ut.test(r))return r;i=s&&(v.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+en(e,t,n||(s?"border":"content"),i)+"px"}function nn(e){if(Wt[e])return Wt[e];var t=v("<"+e+">").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write("<!doctype html><html><body>"),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u<a;u++)r=o[u],s=/^\+/.test(r),s&&(r=r.substr(1)||"*"),i=e[r]=e[r]||[],i[s?"unshift":"push"](n)}}function kn(e,n,r,i,s,o){s=s||n.dataTypes[0],o=o||{},o[s]=!0;var u,a=e[s],f=0,l=a?a.length:0,c=e===Sn;for(;f<l&&(c||!u);f++)u=a[f](n,r,i),typeof u=="string"&&(!c||o[u]?u=t:(n.dataTypes.unshift(u),u=kn(e,n,r,i,u,o)));return(c||!u)&&!o["*"]&&(u=kn(e,n,r,i,"*",o)),u}function Ln(e,n){var r,i,s=v.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((s[r]?e:i||(i={}))[r]=n[r]);i&&v.extend(!0,e,i)}function An(e,n,r){var i,s,o,u,a=e.contents,f=e.dataTypes,l=e.responseFields;for(s in l)s in r&&(n[l[s]]=r[s]);while(f[0]==="*")f.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("content-type"));if(i)for(s in a)if(a[s]&&a[s].test(i)){f.unshift(s);break}if(f[0]in r)o=f[0];else{for(s in r){if(!f[0]||e.converters[s+" "+f[0]]){o=s;break}u||(u=s)}o=o||u}if(o)return o!==f[0]&&f.unshift(o),r[o]}function On(e,t){var n,r,i,s,o=e.dataTypes.slice(),u=o[0],a={},f=0;e.dataFilter&&(t=e.dataFilter(t,e.dataType));if(o[1])for(n in e.converters)a[n.toLowerCase()]=e.converters[n];for(;i=o[++f];)if(i!=="*"){if(u!=="*"&&u!==i){n=a[u+" "+i]||a["* "+i];if(!n)for(r in a){s=r.split(" ");if(s[1]===i){n=a[u+" "+s[0]]||a["* "+s[0]];if(n){n===!0?n=a[r]:a[r]!==!0&&(i=s[0],o.splice(f--,0,i));break}}}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(l){return{state:"parsererror",error:n?l:"No conversion from "+u+" to "+i}}}u=i}return{state:"success",data:t}}function Fn(){try{return new e.XMLHttpRequest}catch(t){}}function In(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function $n(){return setTimeout(function(){qn=t},0),qn=v.now()}function Jn(e,t){v.each(t,function(t,n){var r=(Vn[t]||[]).concat(Vn["*"]),i=0,s=r.length;for(;i<s;i++)if(r[i].call(e,t,n))return})}function Kn(e,t,n){var r,i=0,s=0,o=Xn.length,u=v.Deferred().always(function(){delete a.elem}),a=function(){var t=qn||$n(),n=Math.max(0,f.startTime+f.duration-t),r=n/f.duration||0,i=1-r,s=0,o=f.tweens.length;for(;s<o;s++)f.tweens[s].run(i);return u.notifyWith(e,[f,i,n]),i<1&&o?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:v.extend({},t),opts:v.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:qn||$n(),duration:n.duration,tweens:[],createTween:function(t,n,r){var i=v.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(i),i},stop:function(t){var n=0,r=t?f.tweens.length:0;for(;n<r;n++)f.tweens[n].run(1);return t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]),this}}),l=f.props;Qn(l,f.opts.specialEasing);for(;i<o;i++){r=Xn[i].call(f,e,l,f.opts);if(r)return r}return Jn(f,l),v.isFunction(f.opts.start)&&f.opts.start.call(e,f),v.fx.timer(v.extend(a,{anim:f,queue:f.opts.queue,elem:e})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function Qn(e,t){var n,r,i,s,o;for(n in e){r=v.camelCase(n),i=t[r],s=e[n],v.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=v.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function Gn(e,t,n){var r,i,s,o,u,a,f,l,c,h=this,p=e.style,d={},m=[],g=e.nodeType&&Gt(e);n.queue||(l=v._queueHooks(e,"fx"),l.unqueued==null&&(l.unqueued=0,c=l.empty.fire,l.empty.fire=function(){l.unqueued||c()}),l.unqueued++,h.always(function(){h.always(function(){l.unqueued--,v.queue(e,"fx").length||l.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],v.css(e,"display")==="inline"&&v.css(e,"float")==="none"&&(!v.support.inlineBlockNeedsLayout||nn(e.nodeName)==="inline"?p.display="inline-block":p.zoom=1)),n.overflow&&(p.overflow="hidden",v.support.shrinkWrapBlocks||h.done(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t){s=t[r];if(Un.exec(s)){delete t[r],a=a||s==="toggle";if(s===(g?"hide":"show"))continue;m.push(r)}}o=m.length;if(o){u=v._data(e,"fxshow")||v._data(e,"fxshow",{}),"hidden"in u&&(g=u.hidden),a&&(u.hidden=!g),g?v(e).show():h.done(function(){v(e).hide()}),h.done(function(){var t;v.removeData(e,"fxshow",!0);for(t in d)v.style(e,t,d[t])});for(r=0;r<o;r++)i=m[r],f=h.createTween(i,g?u[i]:0),d[i]=u[i]||v.style(e,i),i in u||(u[i]=f.start,g&&(f.end=f.start,f.start=i==="width"||i==="height"?1:0))}}function Yn(e,t,n,r,i){return new Yn.prototype.init(e,t,n,r,i)}function Zn(e,t){var n,r={height:e},i=0;t=t?1:0;for(;i<4;i+=2-t)n=$t[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function tr(e){return v.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n,r,i=e.document,s=e.location,o=e.navigator,u=e.jQuery,a=e.$,f=Array.prototype.push,l=Array.prototype.slice,c=Array.prototype.indexOf,h=Object.prototype.toString,p=Object.prototype.hasOwnProperty,d=String.prototype.trim,v=function(e,t){return new v.fn.init(e,t,n)},m=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,g=/\S/,y=/\s+/,b=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,w=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a<f;a++)if((e=arguments[a])!=null)for(n in e){r=u[n],i=e[n];if(u===i)continue;l&&i&&(v.isPlainObject(i)||(s=v.isArray(i)))?(s?(s=!1,o=r&&v.isArray(r)?r:[]):o=r&&v.isPlainObject(r)?r:{},u[n]=v.extend(l,o,i)):i!==t&&(u[n]=i)}return u},v.extend({noConflict:function(t){return e.$===v&&(e.$=a),t&&e.jQuery===v&&(e.jQuery=u),v},isReady:!1,readyWait:1,holdReady:function(e){e?v.readyWait++:v.ready(!0)},ready:function(e){if(e===!0?--v.readyWait:v.isReady)return;if(!i.body)return setTimeout(v.ready,1);v.isReady=!0;if(e!==!0&&--v.readyWait>0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s<o;)if(n.apply(e[s++],r)===!1)break}else if(u){for(i in e)if(n.call(e[i],i,e[i])===!1)break}else for(;s<o;)if(n.call(e[s],s,e[s++])===!1)break;return e},trim:d&&!d.call("\ufeff\u00a0")?function(e){return e==null?"":d.call(e)}:function(e){return e==null?"":(e+"").replace(b,"")},makeArray:function(e,t){var n,r=t||[];return e!=null&&(n=v.type(e),e.length==null||n==="string"||n==="function"||n==="regexp"||v.isWindow(e)?f.call(r,e):v.merge(r,e)),r},inArray:function(e,t,n){var r;if(t){if(c)return c.call(t,e,n);r=t.length,n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,s=0;if(typeof r=="number")for(;s<r;s++)e[i++]=n[s];else while(n[s]!==t)e[i++]=n[s++];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length;n=!!n;for(;s<o;s++)r=!!t(e[s],s),n!==r&&i.push(e[s]);return i},map:function(e,n,r){var i,s,o=[],u=0,a=e.length,f=e instanceof v||a!==t&&typeof a=="number"&&(a>0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u<a;u++)i=n(e[u],u,r),i!=null&&(o[o.length]=i);else for(s in e)i=n(e[s],s,r),i!=null&&(o[o.length]=i);return o.concat.apply([],o)},guid:1,proxy:function(e,n){var r,i,s;return typeof n=="string"&&(r=e[n],n=e,e=r),v.isFunction(e)?(i=l.call(arguments,2),s=function(){return e.apply(n,i.concat(l.call(arguments)))},s.guid=e.guid=e.guid||v.guid++,s):t},access:function(e,n,r,i,s,o,u){var a,f=r==null,l=0,c=e.length;if(r&&typeof r=="object"){for(l in r)v.access(e,n,l,r[l],1,o,i);s=1}else if(i!==t){a=u===t&&v.isFunction(i),f&&(a?(a=n,n=function(e,t,n){return a.call(v(e),n)}):(n.call(e,i),n=null));if(n)for(;l<c;l++)n(e[l],r,a?i.call(e[l],l,n(e[l],r)):i,u);s=1}return s?e:f?n.call(e):c?n(e[0],r):o},now:function(){return(new Date).getTime()}}),v.ready.promise=function(t){if(!r){r=v.Deferred();if(i.readyState==="complete")setTimeout(v.ready,1);else if(i.addEventListener)i.addEventListener("DOMContentLoaded",A,!1),e.addEventListener("load",v.ready,!1);else{i.attachEvent("onreadystatechange",A),e.attachEvent("onload",v.ready);var n=!1;try{n=e.frameElement==null&&i.documentElement}catch(s){}n&&n.doScroll&&function o(){if(!v.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}v.ready()}}()}}return r.promise(t)},v.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){O["[object "+t+"]"]=t.toLowerCase()}),n=v(i);var M={};v.Callbacks=function(e){e=typeof e=="string"?M[e]||_(e):v.extend({},e);var n,r,i,s,o,u,a=[],f=!e.once&&[],l=function(t){n=e.memory&&t,r=!0,u=s||0,s=0,o=a.length,i=!0;for(;a&&u<o;u++)if(a[u].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}i=!1,a&&(f?f.length&&l(f.shift()):n?a=[]:c.disable())},c={add:function(){if(a){var t=a.length;(function r(t){v.each(t,function(t,n){var i=v.type(n);i==="function"?(!e.unique||!c.has(n))&&a.push(n):n&&n.length&&i!=="string"&&r(n)})})(arguments),i?o=a.length:n&&(s=t,l(n))}return this},remove:function(){return a&&v.each(arguments,function(e,t){var n;while((n=v.inArray(t,a,n))>-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t<r;t++)n[t]&&v.isFunction(n[t].promise)?n[t].promise().done(o(t,f,n)).fail(s.reject).progress(o(t,a,u)):--i}return i||s.resolveWith(f,n),s.promise()}}),v.support=function(){var t,n,r,s,o,u,a,f,l,c,h,p=i.createElement("div");p.setAttribute("className","t"),p.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="<table><tr><td></td><td>t</td></tr></table>",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="<div></div>",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i<s;i++)delete r[t[i]];if(!(n?B:v.isEmptyObject)(r))return}}if(!n){delete u[a].data;if(!B(u[a]))return}o?v.cleanData([e],!0):v.support.deleteExpando||u!=u.window?delete u[a]:u[a]=null},_data:function(e,t,n){return v.data(e,t,n,!0)},acceptData:function(e){var t=e.nodeName&&v.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),v.fn.extend({data:function(e,n){var r,i,s,o,u,a=this[0],f=0,l=null;if(e===t){if(this.length){l=v.data(a);if(a.nodeType===1&&!v._data(a,"parsedAttrs")){s=a.attributes;for(u=s.length;f<u;f++)o=s[f].name,o.indexOf("data-")||(o=v.camelCase(o.substring(5)),H(a,o,l[o]));v._data(a,"parsedAttrs",!0)}}return l}return typeof e=="object"?this.each(function(){v.data(this,e)}):(r=e.split(".",2),r[1]=r[1]?"."+r[1]:"",i=r[1]+"!",v.access(this,function(n){if(n===t)return l=this.triggerHandler("getData"+i,[r[0]]),l===t&&a&&(l=v.data(a,e),l=H(a,e,l)),l===t&&r[1]?this.data(r[0]):l;r[1]=n,this.each(function(){var t=v(this);t.triggerHandler("setData"+i,r),v.data(this,e,n),t.triggerHandler("changeData"+i,r)})},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length<r?v.queue(this[0],e):n===t?this:this.each(function(){var t=v.queue(this,e,n);v._queueHooks(this,e),e==="fx"&&t[0]!=="inprogress"&&v.dequeue(this,e)})},dequeue:function(e){return this.each(function(){v.dequeue(this,e)})},delay:function(e,t){return e=v.fx?v.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,s=v.Deferred(),o=this,u=this.length,a=function(){--i||s.resolveWith(o,[o])};typeof e!="string"&&(n=e,e=t),e=e||"fx";while(u--)r=v._data(o[u],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(a));return a(),s.promise(n)}});var j,F,I,q=/[\t\r\n]/g,R=/\r/g,U=/^(?:button|input)$/i,z=/^(?:button|input|object|select|textarea)$/i,W=/^a(?:rea|)$/i,X=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,V=v.support.getSetAttribute;v.fn.extend({attr:function(e,t){return v.access(this,v.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n<r;n++){i=this[n];if(i.nodeType===1)if(!i.className&&t.length===1)i.className=e;else{s=" "+i.className+" ";for(o=0,u=t.length;o<u;o++)s.indexOf(" "+t[o]+" ")<0&&(s+=t[o]+" ");i.className=v.trim(s)}}}return this},removeClass:function(e){var n,r,i,s,o,u,a;if(v.isFunction(e))return this.each(function(t){v(this).removeClass(e.call(this,t,this.className))});if(e&&typeof e=="string"||e===t){n=(e||"").split(y);for(u=0,a=this.length;u<a;u++){i=this[u];if(i.nodeType===1&&i.className){r=(" "+i.className+" ").replace(q," ");for(s=0,o=n.length;s<o;s++)while(r.indexOf(" "+n[s]+" ")>=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(q," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a<u;a++){n=r[a];if((n.selected||a===i)&&(v.support.optDisabled?!n.disabled:n.getAttribute("disabled")===null)&&(!n.parentNode.disabled||!v.nodeName(n.parentNode,"optgroup"))){t=v(n).val();if(s)return t;o.push(t)}}return o},set:function(e,t){var n=v.makeArray(t);return v(e).find("option").each(function(){this.selected=v.inArray(v(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o<r.length;o++)i=r[o],i&&(n=v.propFix[i]||i,s=X.test(i),s||v.attr(e,i,""),e.removeAttribute(V?i:n),s&&n in e&&(e[n]=!1))}},attrHooks:{type:{set:function(e,t){if(U.test(e.nodeName)&&e.parentNode)v.error("type property can't be changed");else if(!v.support.radioValue&&t==="radio"&&v.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return j&&v.nodeName(e,"button")?j.get(e,t):t in e?e.value:null},set:function(e,t,n){if(j&&v.nodeName(e,"button"))return j.set(e,t,n);e.value=t}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,s,o,u=e.nodeType;if(!e||u===3||u===8||u===2)return;return o=u!==1||!v.isXMLDoc(e),o&&(n=v.propFix[n]||n,s=v.propHooks[n]),r!==t?s&&"set"in s&&(i=s.set(e,r,n))!==t?i:e[n]=r:s&&"get"in s&&(i=s.get(e,n))!==null?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):z.test(e.nodeName)||W.test(e.nodeName)&&e.href?0:t}}}}),F={get:function(e,n){var r,i=v.prop(e,n);return i===!0||typeof i!="boolean"&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?v.removeAttr(e,n):(r=v.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},V||(I={name:!0,id:!0,coords:!0},j=v.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(I[n]?r.value!=="":r.specified)?r.value:t},set:function(e,t,n){var r=e.getAttributeNode(n);return r||(r=i.createAttribute(n),e.setAttributeNode(r)),r.value=t+""}},v.each(["width","height"],function(e,t){v.attrHooks[t]=v.extend(v.attrHooks[t],{set:function(e,n){if(n==="")return e.setAttribute(t,"auto"),n}})}),v.attrHooks.contenteditable={get:j.get,set:function(e,t,n){t===""&&(t="false"),j.set(e,t,n)}}),v.support.hrefNormalized||v.each(["href","src","width","height"],function(e,n){v.attrHooks[n]=v.extend(v.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return r===null?t:r}})}),v.support.style||(v.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=t+""}}),v.support.optSelected||(v.propHooks.selected=v.extend(v.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),v.support.enctype||(v.propFix.enctype="encoding"),v.support.checkOn||v.each(["radio","checkbox"],function(){v.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}}),v.each(["radio","checkbox"],function(){v.valHooks[this]=v.extend(v.valHooks[this],{set:function(e,t){if(v.isArray(t))return e.checked=v.inArray(v(e).val(),t)>=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f<n.length;f++){l=J.exec(n[f])||[],c=l[1],h=(l[2]||"").split(".").sort(),g=v.event.special[c]||{},c=(s?g.delegateType:g.bindType)||c,g=v.event.special[c]||{},p=v.extend({type:c,origType:l[1],data:i,handler:r,guid:r.guid,selector:s,needsContext:s&&v.expr.match.needsContext.test(s),namespace:h.join(".")},d),m=a[c];if(!m){m=a[c]=[],m.delegateCount=0;if(!g.setup||g.setup.call(e,i,h,u)===!1)e.addEventListener?e.addEventListener(c,u,!1):e.attachEvent&&e.attachEvent("on"+c,u)}g.add&&(g.add.call(e,p),p.handler.guid||(p.handler.guid=r.guid)),s?m.splice(m.delegateCount++,0,p):m.push(p),v.event.global[c]=!0}e=null},global:{},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,m,g=v.hasData(e)&&v._data(e);if(!g||!(h=g.events))return;t=v.trim(Z(t||"")).split(" ");for(s=0;s<t.length;s++){o=J.exec(t[s])||[],u=a=o[1],f=o[2];if(!u){for(u in h)v.event.remove(e,u+t[s],n,r,!0);continue}p=v.event.special[u]||{},u=(r?p.delegateType:p.bindType)||u,d=h[u]||[],l=d.length,f=f?new RegExp("(^|\\.)"+f.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(c=0;c<d.length;c++)m=d[c],(i||a===m.origType)&&(!n||n.guid===m.guid)&&(!f||f.test(m.namespace))&&(!r||r===m.selector||r==="**"&&m.selector)&&(d.splice(c--,1),m.selector&&d.delegateCount--,p.remove&&p.remove.call(e,m));d.length===0&&l!==d.length&&((!p.teardown||p.teardown.call(e,f,g.handle)===!1)&&v.removeEvent(e,u,g.handle),delete h[u])}v.isEmptyObject(h)&&(delete g.handle,v.removeData(e,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,s,o){if(!s||s.nodeType!==3&&s.nodeType!==8){var u,a,f,l,c,h,p,d,m,g,y=n.type||n,b=[];if(Y.test(y+v.event.triggered))return;y.indexOf("!")>=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f<m.length&&!n.isPropagationStopped();f++)l=m[f][0],n.type=m[f][1],d=(v._data(l,"events")||{})[n.type]&&v._data(l,"handle"),d&&d.apply(l,r),d=h&&l[h],d&&v.acceptData(l)&&d.apply&&d.apply(l,r)===!1&&n.preventDefault();return n.type=y,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(s.ownerDocument,r)===!1)&&(y!=="click"||!v.nodeName(s,"a"))&&v.acceptData(s)&&h&&s[y]&&(y!=="focus"&&y!=="blur"||n.target.offsetWidth!==0)&&!v.isWindow(s)&&(c=s[h],c&&(s[h]=null),v.event.triggered=y,s[y](),v.event.triggered=t,c&&(s[h]=c)),n.result}return},dispatch:function(n){n=v.event.fix(n||e.event);var r,i,s,o,u,a,f,c,h,p,d=(v._data(this,"events")||{})[n.type]||[],m=d.delegateCount,g=l.call(arguments),y=!n.exclusive&&!n.namespace,b=v.event.special[n.type]||{},w=[];g[0]=n,n.delegateTarget=this;if(b.preDispatch&&b.preDispatch.call(this,n)===!1)return;if(m&&(!n.button||n.type!=="click"))for(s=n.target;s!=this;s=s.parentNode||this)if(s.disabled!==!0||n.type!=="click"){u={},f=[];for(r=0;r<m;r++)c=d[r],h=c.selector,u[h]===t&&(u[h]=c.needsContext?v(h,this).index(s)>=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r<w.length&&!n.isPropagationStopped();r++){a=w[r],n.currentTarget=a.elem;for(i=0;i<a.matches.length&&!n.isImmediatePropagationStopped();i++){c=a.matches[i];if(y||!n.namespace&&!c.namespace||n.namespace_re&&n.namespace_re.test(c.namespace))n.data=c.data,n.handleObj=c,o=((v.event.special[c.origType]||{}).handle||c.handler).apply(a.elem,g),o!==t&&(n.result=o,o===!1&&(n.preventDefault(),n.stopPropagation()))}}return b.postDispatch&&b.postDispatch.call(this,n),n.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,s,o,u=n.button,a=n.fromElement;return e.pageX==null&&n.clientX!=null&&(r=e.target.ownerDocument||i,s=r.documentElement,o=r.body,e.pageX=n.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=n.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?n.toElement:a),!e.which&&u!==t&&(e.which=u&1?1:u&2?3:u&4?2:0),e}},fix:function(e){if(e[v.expando])return e;var t,n,r=e,s=v.event.fixHooks[e.type]||{},o=s.props?this.props.concat(s.props):this.props;e=v.Event(r);for(t=o.length;t;)n=o[--t],e[n]=r[n];return e.target||(e.target=r.srcElement||i),e.target.nodeType===3&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,r):e},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){v.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var i=v.extend(new v.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?v.event.trigger(i,null,t):v.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},v.event.handle=v.event.dispatch,v.removeEvent=i.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]=="undefined"&&(e[r]=null),e.detachEvent(r,n))},v.Event=function(e,t){if(!(this instanceof v.Event))return new v.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?tt:et):this.type=e,t&&v.extend(this,t),this.timeStamp=e&&e.timeStamp||v.now(),this[v.expando]=!0},v.Event.prototype={preventDefault:function(){this.isDefaultPrevented=tt;var e=this.originalEvent;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=tt;var e=this.originalEvent;if(!e)return;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=tt,this.stopPropagation()},isDefaultPrevented:et,isPropagationStopped:et,isImmediatePropagationStopped:et},v.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){v.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj,o=s.selector;if(!i||i!==r&&!v.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),v.support.submitBubbles||(v.event.special.submit={setup:function(){if(v.nodeName(this,"form"))return!1;v.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=v.nodeName(n,"input")||v.nodeName(n,"button")?n.form:t;r&&!v._data(r,"_submit_attached")&&(v.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),v._data(r,"_submit_attached",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&v.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){if(v.nodeName(this,"form"))return!1;v.event.remove(this,"._submit")}}),v.support.changeBubbles||(v.event.special.change={setup:function(){if($.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")v.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),v.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),v.event.simulate("change",this,e,!0)});return!1}v.event.add(this,"beforeactivate._change",function(e){var t=e.target;$.test(t.nodeName)&&!v._data(t,"_change_attached")&&(v.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&v.event.simulate("change",this.parentNode,e,!0)}),v._data(t,"_change_attached",!0))})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){return v.event.remove(this,"._change"),!$.test(this.nodeName)}}),v.support.focusinBubbles||v.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){v.event.simulate(t,e.target,v.event.fix(e),!0)};v.event.special[t]={setup:function(){n++===0&&i.addEventListener(e,r,!0)},teardown:function(){--n===0&&i.removeEventListener(e,r,!0)}}}),v.fn.extend({on:function(e,n,r,i,s){var o,u;if(typeof e=="object"){typeof n!="string"&&(r=r||n,n=t);for(u in e)this.on(u,n,r,e[u],s);return this}r==null&&i==null?(i=n,r=n=t):i==null&&(typeof n=="string"?(i=r,r=t):(i=r,r=n,n=t));if(i===!1)i=et;else if(!i)return this;return s===1&&(o=i,i=function(e){return v().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=v.guid++)),this.each(function(){v.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,s;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,v(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if(typeof e=="object"){for(s in e)this.off(s,n,e[s]);return this}if(n===!1||typeof n=="function")r=n,n=t;return r===!1&&(r=et),this.each(function(){v.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return v(this.context).on(e,this.selector,t,n),this},die:function(e,t){return v(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){v.event.trigger(e,t,this)})},triggerHandler:function(e,t){if(this[0])return v.event.trigger(e,t,this[0],!0)},toggle:function(e){var t=arguments,n=e.guid||v.guid++,r=0,i=function(n){var i=(v._data(this,"lastToggle"+e.guid)||0)%r;return v._data(this,"lastToggle"+e.guid,i+1),n.preventDefault(),t[i].apply(this,arguments)||!1};i.guid=n;while(r<t.length)t[r++].guid=n;return this.click(i)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),v.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){v.fn[t]=function(e,n){return n==null&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u<a;u++)if(s=e[u])if(!n||n(s,r,i))o.push(s),f&&t.push(u);return o}function ct(e,t,n,r,i,s){return r&&!r[d]&&(r=ct(r)),i&&!i[d]&&(i=ct(i,s)),N(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||dt(t||"*",u.nodeType?[u]:u,[]),m=e&&(s||!t)?lt(v,h,e,u,a):v,g=n?i||(s?e:d||r)?[]:o:m;n&&n(m,g,u,a);if(r){f=lt(g,p),r(f,[],u,a),l=f.length;while(l--)if(c=f[l])g[p[l]]=!(m[p[l]]=c)}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?T.call(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a<s;a++)if(n=i.relative[e[a].type])h=[at(ft(h),n)];else{n=i.filter[e[a].type].apply(null,e[a].matches);if(n[d]){r=++a;for(;r<s;r++)if(i.relative[e[r].type])break;return ct(a>1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a<r&&ht(e.slice(a,r)),r<s&&ht(e=e.slice(r)),r<s&&e.join(""))}h.push(n)}return ft(h)}function pt(e,t){var r=t.length>0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r<i;r++)nt(e,t[r],n);return n}function vt(e,t,n,r,s){var o,u,f,l,c,h=ut(e),p=h.length;if(!r&&h.length===1){u=h[0]=h[0].slice(0);if(u.length>2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;t<n;t++)if(this[t]===e)return t;return-1},N=function(e,t){return e[d]=t==null||t,e},C=function(){var e={},t=[];return N(function(n,r){return t.push(n)>i.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="<a name='"+d+"'></a><div name='"+d+"'></div>",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:st(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:st(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}},f=y.compareDocumentPosition?function(e,t){return e===t?(l=!0,0):(!e.compareDocumentPosition||!t.compareDocumentPosition?e.compareDocumentPosition:e.compareDocumentPosition(t)&4)?-1:1}:function(e,t){if(e===t)return l=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,i=[],s=[],o=e.parentNode,u=t.parentNode,a=o;if(o===u)return ot(e,t);if(!o)return-1;if(!u)return 1;while(a)i.unshift(a),a=a.parentNode;a=u;while(a)s.unshift(a),a=a.parentNode;n=i.length,r=s.length;for(var f=0;f<n&&f<r;f++)if(i[f]!==s[f])return ot(i[f],s[f]);return f===n?ot(e,s[f],-1):ot(i[f],t,1)},[0,0].sort(f),h=!l,nt.uniqueSort=function(e){var t,n=[],r=1,i=0;l=h,e.sort(f);if(l){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e},nt.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},a=nt.compile=function(e,t){var n,r=[],i=[],s=A[d][e+" "];if(!s){t||(t=ut(e)),n=t.length;while(n--)s=ht(t[n]),s[d]?r.push(s):i.push(s);s=A(e,pt(i,r))}return s},g.querySelectorAll&&function(){var e,t=vt,n=/'|\\/g,r=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,i=[":focus"],s=[":active"],u=y.matchesSelector||y.mozMatchesSelector||y.webkitMatchesSelector||y.oMatchesSelector||y.msMatchesSelector;K(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'/>",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t<n;t++)if(v.contains(u[t],this))return!0});o=this.pushStack("","find",e);for(t=0,n=this.length;t<n;t++){r=o.length,v.find(e,this[t],o);if(t>0)for(i=r;i<o.length;i++)for(s=0;s<r;s++)if(o[s]===o[i]){o.splice(i--,1);break}}return o},has:function(e){var t,n=v(e,this),r=n.length;return this.filter(function(){for(t=0;t<r;t++)if(v.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1),"not",e)},filter:function(e){return this.pushStack(ft(this,e,!0),"filter",e)},is:function(e){return!!e&&(typeof e=="string"?st.test(e)?v(e,this.context).index(this[0])>=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r<i;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&n.nodeType!==11){if(o?o.index(n)>-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/<tbody/i,gt=/<|&#?\w+;/,yt=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,wt=new RegExp("<(?:"+ct+")[\\s/>]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Nt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X<div>","</div>"]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1></$2>");try{for(;r<i;r++)n=this[r]||{},n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(s){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return ut(this[0])?this.length?this.pushStack(v(v.isFunction(e)?e():e),"replaceWith",e):this:v.isFunction(e)?this.each(function(t){var n=v(this),r=n.html();n.replaceWith(e.call(this,t,r))}):(typeof e!="string"&&(e=v(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;v(this).remove(),t?v(t).before(e):v(n).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=[].concat.apply([],e);var i,s,o,u,a=0,f=e[0],l=[],c=this.length;if(!v.support.checkClone&&c>1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a<c;a++)r.call(n&&v.nodeName(this[a],"table")?Lt(this[a],"tbody"):this[a],a===u?o:v.clone(o,!0,!0))}o=s=null,l.length&&v.each(l,function(e,t){t.src?v.ajax?v.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):v.error("no ajax"):v.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Tt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),v.buildFragment=function(e,n,r){var s,o,u,a=e[0];return n=n||i,n=!n.nodeType&&n[0]||n,n=n.ownerDocument||n,e.length===1&&typeof a=="string"&&a.length<512&&n===i&&a.charAt(0)==="<"&&!bt.test(a)&&(v.support.checkClone||!St.test(a))&&(v.support.html5Clone||!wt.test(a))&&(o=!0,s=v.fragments[a],u=s!==t),s||(s=n.createDocumentFragment(),v.clean(e,n,s,r),o&&(v.fragments[a]=u&&s)),{fragment:s,cacheable:o}},v.fragments={},v.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){v.fn[e]=function(n){var r,i=0,s=[],o=v(n),u=o.length,a=this.length===1&&this[0].parentNode;if((a==null||a&&a.nodeType===11&&a.childNodes.length===1)&&u===1)return o[t](this[0]),this;for(;i<u;i++)r=(i>0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1></$2>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]==="<table>"&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("<div>").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===ln[1]&&a[2]===ln[2]&&(a[3]||(a[1]==="http:"?80:443))==(ln[3]||(ln[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(p){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++)n=e[r],Vn[n]=Vn[n]||[],Vn[n].unshift(t)},prefilter:function(e,t){t?Xn.unshift(e):Xn.push(e)}}),v.Tween=Yn,Yn.prototype={constructor:Yn,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(v.cssNumber[n]?"":"px")},cur:function(){var e=Yn.propHooks[this.prop];return e&&e.get?e.get(this):Yn.propHooks._default.get(this)},run:function(e){var t,n=Yn.propHooks[this.prop];return this.options.duration?this.pos=t=v.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Yn.propHooks._default.set(this),this}},Yn.prototype.init.prototype=Yn.prototype,Yn.propHooks={_default:{get:function(e){var t;return e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null?(t=v.css(e.elem,e.prop,!1,""),!t||t==="auto"?0:t):e.elem[e.prop]},set:function(e){v.fx.step[e.prop]?v.fx.step[e.prop](e):e.elem.style&&(e.elem.style[v.cssProps[e.prop]]!=null||v.cssHooks[e.prop])?v.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Yn.propHooks.scrollTop=Yn.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},v.each(["toggle","show","hide"],function(e,t){var n=v.fn[t];v.fn[t]=function(r,i,s){return r==null||typeof r=="boolean"||!e&&v.isFunction(r)&&v.isFunction(i)?n.apply(this,arguments):this.animate(Zn(t,!0),r,i,s)}}),v.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Gt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=v.isEmptyObject(e),s=v.speed(t,n,r),o=function(){var t=Kn(this,v.extend({},e),s);i&&t.stop(!0)};return i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return typeof e!="string"&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=e!=null&&e+"queueHooks",s=v.timers,o=v._data(this);if(n)o[n]&&o[n].stop&&i(o[n]);else for(n in o)o[n]&&o[n].stop&&Wn.test(n)&&i(o[n]);for(n=s.length;n--;)s[n].elem===this&&(e==null||s[n].queue===e)&&(s[n].anim.stop(r),t=!1,s.splice(n,1));(t||!r)&&v.dequeue(this,e)})}}),v.each({slideDown:Zn("show"),slideUp:Zn("hide"),slideToggle:Zn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){v.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),v.speed=function(e,t,n){var r=e&&typeof e=="object"?v.extend({},e):{complete:n||!n&&t||v.isFunction(e)&&e,duration:e,easing:n&&t||t&&!v.isFunction(t)&&t};r.duration=v.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in v.fx.speeds?v.fx.speeds[r.duration]:v.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){v.isFunction(r.old)&&r.old.call(this),r.queue&&v.dequeue(this,r.queue)},r},v.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},v.timers=[],v.fx=Yn.prototype.init,v.fx.tick=function(){var e,n=v.timers,r=0;qn=v.now();for(;r<n.length;r++)e=n[r],!e()&&n[r]===e&&n.splice(r--,1);n.length||v.fx.stop(),qn=t},v.fx.timer=function(e){e()&&v.timers.push(e)&&!Rn&&(Rn=setInterval(v.fx.tick,v.fx.interval))},v.fx.interval=13,v.fx.stop=function(){clearInterval(Rn),Rn=null},v.fx.speeds={slow:600,fast:200,_default:400},v.fx.step={},v.expr&&v.expr.filters&&(v.expr.filters.animated=function(e){return v.grep(v.timers,function(t){return e===t.elem}).length});var er=/^(?:body|html)$/i;v.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){v.offset.setOffset(this,e,t)});var n,r,i,s,o,u,a,f={top:0,left:0},l=this[0],c=l&&l.ownerDocument;if(!c)return;return(r=c.body)===l?v.offset.bodyOffset(l):(n=c.documentElement,v.contains(n,l)?(typeof l.getBoundingClientRect!="undefined"&&(f=l.getBoundingClientRect()),i=tr(c),s=n.clientTop||r.clientTop||0,o=n.clientLeft||r.clientLeft||0,u=i.pageYOffset||n.scrollTop,a=i.pageXOffset||n.scrollLeft,{top:f.top+u-s,left:f.left+a-o}):f)},v.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return v.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(v.css(e,"marginTop"))||0,n+=parseFloat(v.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=v.css(e,"position");r==="static"&&(e.style.position="relative");var i=v(e),s=i.offset(),o=v.css(e,"top"),u=v.css(e,"left"),a=(r==="absolute"||r==="fixed")&&v.inArray("auto",[o,u])>-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})})(window);
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery-1.9.1.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery-1.9.1.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery-1.9.1.js	(revision 5703)
@@ -0,0 +1,9597 @@
+/*!
+ * jQuery JavaScript Library v1.9.1
+ * http://jquery.com/
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ *
+ * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: 2013-2-4
+ */
+(function( window, undefined ) {
+
+// Can't do this because several apps including ASP.NET trace
+// the stack via arguments.caller.callee and Firefox dies if
+// you try to trace through "use strict" call chains. (#13335)
+// Support: Firefox 18+
+//"use strict";
+var
+	// The deferred used on DOM ready
+	readyList,
+
+	// A central reference to the root jQuery(document)
+	rootjQuery,
+
+	// Support: IE<9
+	// For `typeof node.method` instead of `node.method !== undefined`
+	core_strundefined = typeof undefined,
+
+	// Use the correct document accordingly with window argument (sandbox)
+	document = window.document,
+	location = window.location,
+
+	// Map over jQuery in case of overwrite
+	_jQuery = window.jQuery,
+
+	// Map over the $ in case of overwrite
+	_$ = window.$,
+
+	// [[Class]] -> type pairs
+	class2type = {},
+
+	// List of deleted data cache ids, so we can reuse them
+	core_deletedIds = [],
+
+	core_version = "1.9.1",
+
+	// Save a reference to some core methods
+	core_concat = core_deletedIds.concat,
+	core_push = core_deletedIds.push,
+	core_slice = core_deletedIds.slice,
+	core_indexOf = core_deletedIds.indexOf,
+	core_toString = class2type.toString,
+	core_hasOwn = class2type.hasOwnProperty,
+	core_trim = core_version.trim,
+
+	// Define a local copy of jQuery
+	jQuery = function( selector, context ) {
+		// The jQuery object is actually just the init constructor 'enhanced'
+		return new jQuery.fn.init( selector, context, rootjQuery );
+	},
+
+	// Used for matching numbers
+	core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
+
+	// Used for splitting on whitespace
+	core_rnotwhite = /\S+/g,
+
+	// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
+	rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
+
+	// A simple way to check for HTML strings
+	// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
+	// Strict HTML recognition (#11290: must start with <)
+	rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,
+
+	// Match a standalone tag
+	rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
+
+	// JSON RegExp
+	rvalidchars = /^[\],:{}\s]*$/,
+	rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
+	rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
+	rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
+
+	// Matches dashed string for camelizing
+	rmsPrefix = /^-ms-/,
+	rdashAlpha = /-([\da-z])/gi,
+
+	// Used by jQuery.camelCase as callback to replace()
+	fcamelCase = function( all, letter ) {
+		return letter.toUpperCase();
+	},
+
+	// The ready event handler
+	completed = function( event ) {
+
+		// readyState === "complete" is good enough for us to call the dom ready in oldIE
+		if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
+			detach();
+			jQuery.ready();
+		}
+	},
+	// Clean-up method for dom ready events
+	detach = function() {
+		if ( document.addEventListener ) {
+			document.removeEventListener( "DOMContentLoaded", completed, false );
+			window.removeEventListener( "load", completed, false );
+
+		} else {
+			document.detachEvent( "onreadystatechange", completed );
+			window.detachEvent( "onload", completed );
+		}
+	};
+
+jQuery.fn = jQuery.prototype = {
+	// The current version of jQuery being used
+	jquery: core_version,
+
+	constructor: jQuery,
+	init: function( selector, context, rootjQuery ) {
+		var match, elem;
+
+		// HANDLE: $(""), $(null), $(undefined), $(false)
+		if ( !selector ) {
+			return this;
+		}
+
+		// Handle HTML strings
+		if ( typeof selector === "string" ) {
+			if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
+				// Assume that strings that start and end with <> are HTML and skip the regex check
+				match = [ null, selector, null ];
+
+			} else {
+				match = rquickExpr.exec( selector );
+			}
+
+			// Match html or make sure no context is specified for #id
+			if ( match && (match[1] || !context) ) {
+
+				// HANDLE: $(html) -> $(array)
+				if ( match[1] ) {
+					context = context instanceof jQuery ? context[0] : context;
+
+					// scripts is true for back-compat
+					jQuery.merge( this, jQuery.parseHTML(
+						match[1],
+						context && context.nodeType ? context.ownerDocument || context : document,
+						true
+					) );
+
+					// HANDLE: $(html, props)
+					if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
+						for ( match in context ) {
+							// Properties of context are called as methods if possible
+							if ( jQuery.isFunction( this[ match ] ) ) {
+								this[ match ]( context[ match ] );
+
+							// ...and otherwise set as attributes
+							} else {
+								this.attr( match, context[ match ] );
+							}
+						}
+					}
+
+					return this;
+
+				// HANDLE: $(#id)
+				} else {
+					elem = document.getElementById( match[2] );
+
+					// Check parentNode to catch when Blackberry 4.6 returns
+					// nodes that are no longer in the document #6963
+					if ( elem && elem.parentNode ) {
+						// Handle the case where IE and Opera return items
+						// by name instead of ID
+						if ( elem.id !== match[2] ) {
+							return rootjQuery.find( selector );
+						}
+
+						// Otherwise, we inject the element directly into the jQuery object
+						this.length = 1;
+						this[0] = elem;
+					}
+
+					this.context = document;
+					this.selector = selector;
+					return this;
+				}
+
+			// HANDLE: $(expr, $(...))
+			} else if ( !context || context.jquery ) {
+				return ( context || rootjQuery ).find( selector );
+
+			// HANDLE: $(expr, context)
+			// (which is just equivalent to: $(context).find(expr)
+			} else {
+				return this.constructor( context ).find( selector );
+			}
+
+		// HANDLE: $(DOMElement)
+		} else if ( selector.nodeType ) {
+			this.context = this[0] = selector;
+			this.length = 1;
+			return this;
+
+		// HANDLE: $(function)
+		// Shortcut for document ready
+		} else if ( jQuery.isFunction( selector ) ) {
+			return rootjQuery.ready( selector );
+		}
+
+		if ( selector.selector !== undefined ) {
+			this.selector = selector.selector;
+			this.context = selector.context;
+		}
+
+		return jQuery.makeArray( selector, this );
+	},
+
+	// Start with an empty selector
+	selector: "",
+
+	// The default length of a jQuery object is 0
+	length: 0,
+
+	// The number of elements contained in the matched element set
+	size: function() {
+		return this.length;
+	},
+
+	toArray: function() {
+		return core_slice.call( this );
+	},
+
+	// Get the Nth element in the matched element set OR
+	// Get the whole matched element set as a clean array
+	get: function( num ) {
+		return num == null ?
+
+			// Return a 'clean' array
+			this.toArray() :
+
+			// Return just the object
+			( num < 0 ? this[ this.length + num ] : this[ num ] );
+	},
+
+	// Take an array of elements and push it onto the stack
+	// (returning the new matched element set)
+	pushStack: function( elems ) {
+
+		// Build a new jQuery matched element set
+		var ret = jQuery.merge( this.constructor(), elems );
+
+		// Add the old object onto the stack (as a reference)
+		ret.prevObject = this;
+		ret.context = this.context;
+
+		// Return the newly-formed element set
+		return ret;
+	},
+
+	// Execute a callback for every element in the matched set.
+	// (You can seed the arguments with an array of args, but this is
+	// only used internally.)
+	each: function( callback, args ) {
+		return jQuery.each( this, callback, args );
+	},
+
+	ready: function( fn ) {
+		// Add the callback
+		jQuery.ready.promise().done( fn );
+
+		return this;
+	},
+
+	slice: function() {
+		return this.pushStack( core_slice.apply( this, arguments ) );
+	},
+
+	first: function() {
+		return this.eq( 0 );
+	},
+
+	last: function() {
+		return this.eq( -1 );
+	},
+
+	eq: function( i ) {
+		var len = this.length,
+			j = +i + ( i < 0 ? len : 0 );
+		return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
+	},
+
+	map: function( callback ) {
+		return this.pushStack( jQuery.map(this, function( elem, i ) {
+			return callback.call( elem, i, elem );
+		}));
+	},
+
+	end: function() {
+		return this.prevObject || this.constructor(null);
+	},
+
+	// For internal use only.
+	// Behaves like an Array's method, not like a jQuery method.
+	push: core_push,
+	sort: [].sort,
+	splice: [].splice
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
+
+jQuery.extend = jQuery.fn.extend = function() {
+	var src, copyIsArray, copy, name, options, clone,
+		target = arguments[0] || {},
+		i = 1,
+		length = arguments.length,
+		deep = false;
+
+	// Handle a deep copy situation
+	if ( typeof target === "boolean" ) {
+		deep = target;
+		target = arguments[1] || {};
+		// skip the boolean and the target
+		i = 2;
+	}
+
+	// Handle case when target is a string or something (possible in deep copy)
+	if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
+		target = {};
+	}
+
+	// extend jQuery itself if only one argument is passed
+	if ( length === i ) {
+		target = this;
+		--i;
+	}
+
+	for ( ; i < length; i++ ) {
+		// Only deal with non-null/undefined values
+		if ( (options = arguments[ i ]) != null ) {
+			// Extend the base object
+			for ( name in options ) {
+				src = target[ name ];
+				copy = options[ name ];
+
+				// Prevent never-ending loop
+				if ( target === copy ) {
+					continue;
+				}
+
+				// Recurse if we're merging plain objects or arrays
+				if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
+					if ( copyIsArray ) {
+						copyIsArray = false;
+						clone = src && jQuery.isArray(src) ? src : [];
+
+					} else {
+						clone = src && jQuery.isPlainObject(src) ? src : {};
+					}
+
+					// Never move original objects, clone them
+					target[ name ] = jQuery.extend( deep, clone, copy );
+
+				// Don't bring in undefined values
+				} else if ( copy !== undefined ) {
+					target[ name ] = copy;
+				}
+			}
+		}
+	}
+
+	// Return the modified object
+	return target;
+};
+
+jQuery.extend({
+	noConflict: function( deep ) {
+		if ( window.$ === jQuery ) {
+			window.$ = _$;
+		}
+
+		if ( deep && window.jQuery === jQuery ) {
+			window.jQuery = _jQuery;
+		}
+
+		return jQuery;
+	},
+
+	// Is the DOM ready to be used? Set to true once it occurs.
+	isReady: false,
+
+	// A counter to track how many items to wait for before
+	// the ready event fires. See #6781
+	readyWait: 1,
+
+	// Hold (or release) the ready event
+	holdReady: function( hold ) {
+		if ( hold ) {
+			jQuery.readyWait++;
+		} else {
+			jQuery.ready( true );
+		}
+	},
+
+	// Handle when the DOM is ready
+	ready: function( wait ) {
+
+		// Abort if there are pending holds or we're already ready
+		if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
+			return;
+		}
+
+		// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+		if ( !document.body ) {
+			return setTimeout( jQuery.ready );
+		}
+
+		// Remember that the DOM is ready
+		jQuery.isReady = true;
+
+		// If a normal DOM Ready event fired, decrement, and wait if need be
+		if ( wait !== true && --jQuery.readyWait > 0 ) {
+			return;
+		}
+
+		// If there are functions bound, to execute
+		readyList.resolveWith( document, [ jQuery ] );
+
+		// Trigger any bound ready events
+		if ( jQuery.fn.trigger ) {
+			jQuery( document ).trigger("ready").off("ready");
+		}
+	},
+
+	// See test/unit/core.js for details concerning isFunction.
+	// Since version 1.3, DOM methods and functions like alert
+	// aren't supported. They return false on IE (#2968).
+	isFunction: function( obj ) {
+		return jQuery.type(obj) === "function";
+	},
+
+	isArray: Array.isArray || function( obj ) {
+		return jQuery.type(obj) === "array";
+	},
+
+	isWindow: function( obj ) {
+		return obj != null && obj == obj.window;
+	},
+
+	isNumeric: function( obj ) {
+		return !isNaN( parseFloat(obj) ) && isFinite( obj );
+	},
+
+	type: function( obj ) {
+		if ( obj == null ) {
+			return String( obj );
+		}
+		return typeof obj === "object" || typeof obj === "function" ?
+			class2type[ core_toString.call(obj) ] || "object" :
+			typeof obj;
+	},
+
+	isPlainObject: function( obj ) {
+		// Must be an Object.
+		// Because of IE, we also have to check the presence of the constructor property.
+		// Make sure that DOM nodes and window objects don't pass through, as well
+		if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
+			return false;
+		}
+
+		try {
+			// Not own constructor property must be Object
+			if ( obj.constructor &&
+				!core_hasOwn.call(obj, "constructor") &&
+				!core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+				return false;
+			}
+		} catch ( e ) {
+			// IE8,9 Will throw exceptions on certain host objects #9897
+			return false;
+		}
+
+		// Own properties are enumerated firstly, so to speed up,
+		// if last one is own, then all properties are own.
+
+		var key;
+		for ( key in obj ) {}
+
+		return key === undefined || core_hasOwn.call( obj, key );
+	},
+
+	isEmptyObject: function( obj ) {
+		var name;
+		for ( name in obj ) {
+			return false;
+		}
+		return true;
+	},
+
+	error: function( msg ) {
+		throw new Error( msg );
+	},
+
+	// data: string of html
+	// context (optional): If specified, the fragment will be created in this context, defaults to document
+	// keepScripts (optional): If true, will include scripts passed in the html string
+	parseHTML: function( data, context, keepScripts ) {
+		if ( !data || typeof data !== "string" ) {
+			return null;
+		}
+		if ( typeof context === "boolean" ) {
+			keepScripts = context;
+			context = false;
+		}
+		context = context || document;
+
+		var parsed = rsingleTag.exec( data ),
+			scripts = !keepScripts && [];
+
+		// Single tag
+		if ( parsed ) {
+			return [ context.createElement( parsed[1] ) ];
+		}
+
+		parsed = jQuery.buildFragment( [ data ], context, scripts );
+		if ( scripts ) {
+			jQuery( scripts ).remove();
+		}
+		return jQuery.merge( [], parsed.childNodes );
+	},
+
+	parseJSON: function( data ) {
+		// Attempt to parse using the native JSON parser first
+		if ( window.JSON && window.JSON.parse ) {
+			return window.JSON.parse( data );
+		}
+
+		if ( data === null ) {
+			return data;
+		}
+
+		if ( typeof data === "string" ) {
+
+			// Make sure leading/trailing whitespace is removed (IE can't handle it)
+			data = jQuery.trim( data );
+
+			if ( data ) {
+				// Make sure the incoming data is actual JSON
+				// Logic borrowed from http://json.org/json2.js
+				if ( rvalidchars.test( data.replace( rvalidescape, "@" )
+					.replace( rvalidtokens, "]" )
+					.replace( rvalidbraces, "")) ) {
+
+					return ( new Function( "return " + data ) )();
+				}
+			}
+		}
+
+		jQuery.error( "Invalid JSON: " + data );
+	},
+
+	// Cross-browser xml parsing
+	parseXML: function( data ) {
+		var xml, tmp;
+		if ( !data || typeof data !== "string" ) {
+			return null;
+		}
+		try {
+			if ( window.DOMParser ) { // Standard
+				tmp = new DOMParser();
+				xml = tmp.parseFromString( data , "text/xml" );
+			} else { // IE
+				xml = new ActiveXObject( "Microsoft.XMLDOM" );
+				xml.async = "false";
+				xml.loadXML( data );
+			}
+		} catch( e ) {
+			xml = undefined;
+		}
+		if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
+			jQuery.error( "Invalid XML: " + data );
+		}
+		return xml;
+	},
+
+	noop: function() {},
+
+	// Evaluates a script in a global context
+	// Workarounds based on findings by Jim Driscoll
+	// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
+	globalEval: function( data ) {
+		if ( data && jQuery.trim( data ) ) {
+			// We use execScript on Internet Explorer
+			// We use an anonymous function so that context is window
+			// rather than jQuery in Firefox
+			( window.execScript || function( data ) {
+				window[ "eval" ].call( window, data );
+			} )( data );
+		}
+	},
+
+	// Convert dashed to camelCase; used by the css and data modules
+	// Microsoft forgot to hump their vendor prefix (#9572)
+	camelCase: function( string ) {
+		return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
+	},
+
+	nodeName: function( elem, name ) {
+		return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
+	},
+
+	// args is for internal usage only
+	each: function( obj, callback, args ) {
+		var value,
+			i = 0,
+			length = obj.length,
+			isArray = isArraylike( obj );
+
+		if ( args ) {
+			if ( isArray ) {
+				for ( ; i < length; i++ ) {
+					value = callback.apply( obj[ i ], args );
+
+					if ( value === false ) {
+						break;
+					}
+				}
+			} else {
+				for ( i in obj ) {
+					value = callback.apply( obj[ i ], args );
+
+					if ( value === false ) {
+						break;
+					}
+				}
+			}
+
+		// A special, fast, case for the most common use of each
+		} else {
+			if ( isArray ) {
+				for ( ; i < length; i++ ) {
+					value = callback.call( obj[ i ], i, obj[ i ] );
+
+					if ( value === false ) {
+						break;
+					}
+				}
+			} else {
+				for ( i in obj ) {
+					value = callback.call( obj[ i ], i, obj[ i ] );
+
+					if ( value === false ) {
+						break;
+					}
+				}
+			}
+		}
+
+		return obj;
+	},
+
+	// Use native String.trim function wherever possible
+	trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
+		function( text ) {
+			return text == null ?
+				"" :
+				core_trim.call( text );
+		} :
+
+		// Otherwise use our own trimming functionality
+		function( text ) {
+			return text == null ?
+				"" :
+				( text + "" ).replace( rtrim, "" );
+		},
+
+	// results is for internal usage only
+	makeArray: function( arr, results ) {
+		var ret = results || [];
+
+		if ( arr != null ) {
+			if ( isArraylike( Object(arr) ) ) {
+				jQuery.merge( ret,
+					typeof arr === "string" ?
+					[ arr ] : arr
+				);
+			} else {
+				core_push.call( ret, arr );
+			}
+		}
+
+		return ret;
+	},
+
+	inArray: function( elem, arr, i ) {
+		var len;
+
+		if ( arr ) {
+			if ( core_indexOf ) {
+				return core_indexOf.call( arr, elem, i );
+			}
+
+			len = arr.length;
+			i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
+
+			for ( ; i < len; i++ ) {
+				// Skip accessing in sparse arrays
+				if ( i in arr && arr[ i ] === elem ) {
+					return i;
+				}
+			}
+		}
+
+		return -1;
+	},
+
+	merge: function( first, second ) {
+		var l = second.length,
+			i = first.length,
+			j = 0;
+
+		if ( typeof l === "number" ) {
+			for ( ; j < l; j++ ) {
+				first[ i++ ] = second[ j ];
+			}
+		} else {
+			while ( second[j] !== undefined ) {
+				first[ i++ ] = second[ j++ ];
+			}
+		}
+
+		first.length = i;
+
+		return first;
+	},
+
+	grep: function( elems, callback, inv ) {
+		var retVal,
+			ret = [],
+			i = 0,
+			length = elems.length;
+		inv = !!inv;
+
+		// Go through the array, only saving the items
+		// that pass the validator function
+		for ( ; i < length; i++ ) {
+			retVal = !!callback( elems[ i ], i );
+			if ( inv !== retVal ) {
+				ret.push( elems[ i ] );
+			}
+		}
+
+		return ret;
+	},
+
+	// arg is for internal usage only
+	map: function( elems, callback, arg ) {
+		var value,
+			i = 0,
+			length = elems.length,
+			isArray = isArraylike( elems ),
+			ret = [];
+
+		// Go through the array, translating each of the items to their
+		if ( isArray ) {
+			for ( ; i < length; i++ ) {
+				value = callback( elems[ i ], i, arg );
+
+				if ( value != null ) {
+					ret[ ret.length ] = value;
+				}
+			}
+
+		// Go through every key on the object,
+		} else {
+			for ( i in elems ) {
+				value = callback( elems[ i ], i, arg );
+
+				if ( value != null ) {
+					ret[ ret.length ] = value;
+				}
+			}
+		}
+
+		// Flatten any nested arrays
+		return core_concat.apply( [], ret );
+	},
+
+	// A global GUID counter for objects
+	guid: 1,
+
+	// Bind a function to a context, optionally partially applying any
+	// arguments.
+	proxy: function( fn, context ) {
+		var args, proxy, tmp;
+
+		if ( typeof context === "string" ) {
+			tmp = fn[ context ];
+			context = fn;
+			fn = tmp;
+		}
+
+		// Quick check to determine if target is callable, in the spec
+		// this throws a TypeError, but we will just return undefined.
+		if ( !jQuery.isFunction( fn ) ) {
+			return undefined;
+		}
+
+		// Simulated bind
+		args = core_slice.call( arguments, 2 );
+		proxy = function() {
+			return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
+		};
+
+		// Set the guid of unique handler to the same of original handler, so it can be removed
+		proxy.guid = fn.guid = fn.guid || jQuery.guid++;
+
+		return proxy;
+	},
+
+	// Multifunctional method to get and set values of a collection
+	// The value/s can optionally be executed if it's a function
+	access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
+		var i = 0,
+			length = elems.length,
+			bulk = key == null;
+
+		// Sets many values
+		if ( jQuery.type( key ) === "object" ) {
+			chainable = true;
+			for ( i in key ) {
+				jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
+			}
+
+		// Sets one value
+		} else if ( value !== undefined ) {
+			chainable = true;
+
+			if ( !jQuery.isFunction( value ) ) {
+				raw = true;
+			}
+
+			if ( bulk ) {
+				// Bulk operations run against the entire set
+				if ( raw ) {
+					fn.call( elems, value );
+					fn = null;
+
+				// ...except when executing function values
+				} else {
+					bulk = fn;
+					fn = function( elem, key, value ) {
+						return bulk.call( jQuery( elem ), value );
+					};
+				}
+			}
+
+			if ( fn ) {
+				for ( ; i < length; i++ ) {
+					fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
+				}
+			}
+		}
+
+		return chainable ?
+			elems :
+
+			// Gets
+			bulk ?
+				fn.call( elems ) :
+				length ? fn( elems[0], key ) : emptyGet;
+	},
+
+	now: function() {
+		return ( new Date() ).getTime();
+	}
+});
+
+jQuery.ready.promise = function( obj ) {
+	if ( !readyList ) {
+
+		readyList = jQuery.Deferred();
+
+		// Catch cases where $(document).ready() is called after the browser event has already occurred.
+		// we once tried to use readyState "interactive" here, but it caused issues like the one
+		// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
+		if ( document.readyState === "complete" ) {
+			// Handle it asynchronously to allow scripts the opportunity to delay ready
+			setTimeout( jQuery.ready );
+
+		// Standards-based browsers support DOMContentLoaded
+		} else if ( document.addEventListener ) {
+			// Use the handy event callback
+			document.addEventListener( "DOMContentLoaded", completed, false );
+
+			// A fallback to window.onload, that will always work
+			window.addEventListener( "load", completed, false );
+
+		// If IE event model is used
+		} else {
+			// Ensure firing before onload, maybe late but safe also for iframes
+			document.attachEvent( "onreadystatechange", completed );
+
+			// A fallback to window.onload, that will always work
+			window.attachEvent( "onload", completed );
+
+			// If IE and not a frame
+			// continually check to see if the document is ready
+			var top = false;
+
+			try {
+				top = window.frameElement == null && document.documentElement;
+			} catch(e) {}
+
+			if ( top && top.doScroll ) {
+				(function doScrollCheck() {
+					if ( !jQuery.isReady ) {
+
+						try {
+							// Use the trick by Diego Perini
+							// http://javascript.nwbox.com/IEContentLoaded/
+							top.doScroll("left");
+						} catch(e) {
+							return setTimeout( doScrollCheck, 50 );
+						}
+
+						// detach all dom ready events
+						detach();
+
+						// and execute any waiting functions
+						jQuery.ready();
+					}
+				})();
+			}
+		}
+	}
+	return readyList.promise( obj );
+};
+
+// Populate the class2type map
+jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
+	class2type[ "[object " + name + "]" ] = name.toLowerCase();
+});
+
+function isArraylike( obj ) {
+	var length = obj.length,
+		type = jQuery.type( obj );
+
+	if ( jQuery.isWindow( obj ) ) {
+		return false;
+	}
+
+	if ( obj.nodeType === 1 && length ) {
+		return true;
+	}
+
+	return type === "array" || type !== "function" &&
+		( length === 0 ||
+		typeof length === "number" && length > 0 && ( length - 1 ) in obj );
+}
+
+// All jQuery objects should point back to these
+rootjQuery = jQuery(document);
+// String to Object options format cache
+var optionsCache = {};
+
+// Convert String-formatted options into Object-formatted ones and store in cache
+function createOptions( options ) {
+	var object = optionsCache[ options ] = {};
+	jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
+		object[ flag ] = true;
+	});
+	return object;
+}
+
+/*
+ * Create a callback list using the following parameters:
+ *
+ *	options: an optional list of space-separated options that will change how
+ *			the callback list behaves or a more traditional option object
+ *
+ * By default a callback list will act like an event callback list and can be
+ * "fired" multiple times.
+ *
+ * Possible options:
+ *
+ *	once:			will ensure the callback list can only be fired once (like a Deferred)
+ *
+ *	memory:			will keep track of previous values and will call any callback added
+ *					after the list has been fired right away with the latest "memorized"
+ *					values (like a Deferred)
+ *
+ *	unique:			will ensure a callback can only be added once (no duplicate in the list)
+ *
+ *	stopOnFalse:	interrupt callings when a callback returns false
+ *
+ */
+jQuery.Callbacks = function( options ) {
+
+	// Convert options from String-formatted to Object-formatted if needed
+	// (we check in cache first)
+	options = typeof options === "string" ?
+		( optionsCache[ options ] || createOptions( options ) ) :
+		jQuery.extend( {}, options );
+
+	var // Flag to know if list is currently firing
+		firing,
+		// Last fire value (for non-forgettable lists)
+		memory,
+		// Flag to know if list was already fired
+		fired,
+		// End of the loop when firing
+		firingLength,
+		// Index of currently firing callback (modified by remove if needed)
+		firingIndex,
+		// First callback to fire (used internally by add and fireWith)
+		firingStart,
+		// Actual callback list
+		list = [],
+		// Stack of fire calls for repeatable lists
+		stack = !options.once && [],
+		// Fire callbacks
+		fire = function( data ) {
+			memory = options.memory && data;
+			fired = true;
+			firingIndex = firingStart || 0;
+			firingStart = 0;
+			firingLength = list.length;
+			firing = true;
+			for ( ; list && firingIndex < firingLength; firingIndex++ ) {
+				if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
+					memory = false; // To prevent further calls using add
+					break;
+				}
+			}
+			firing = false;
+			if ( list ) {
+				if ( stack ) {
+					if ( stack.length ) {
+						fire( stack.shift() );
+					}
+				} else if ( memory ) {
+					list = [];
+				} else {
+					self.disable();
+				}
+			}
+		},
+		// Actual Callbacks object
+		self = {
+			// Add a callback or a collection of callbacks to the list
+			add: function() {
+				if ( list ) {
+					// First, we save the current length
+					var start = list.length;
+					(function add( args ) {
+						jQuery.each( args, function( _, arg ) {
+							var type = jQuery.type( arg );
+							if ( type === "function" ) {
+								if ( !options.unique || !self.has( arg ) ) {
+									list.push( arg );
+								}
+							} else if ( arg && arg.length && type !== "string" ) {
+								// Inspect recursively
+								add( arg );
+							}
+						});
+					})( arguments );
+					// Do we need to add the callbacks to the
+					// current firing batch?
+					if ( firing ) {
+						firingLength = list.length;
+					// With memory, if we're not firing then
+					// we should call right away
+					} else if ( memory ) {
+						firingStart = start;
+						fire( memory );
+					}
+				}
+				return this;
+			},
+			// Remove a callback from the list
+			remove: function() {
+				if ( list ) {
+					jQuery.each( arguments, function( _, arg ) {
+						var index;
+						while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
+							list.splice( index, 1 );
+							// Handle firing indexes
+							if ( firing ) {
+								if ( index <= firingLength ) {
+									firingLength--;
+								}
+								if ( index <= firingIndex ) {
+									firingIndex--;
+								}
+							}
+						}
+					});
+				}
+				return this;
+			},
+			// Check if a given callback is in the list.
+			// If no argument is given, return whether or not list has callbacks attached.
+			has: function( fn ) {
+				return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
+			},
+			// Remove all callbacks from the list
+			empty: function() {
+				list = [];
+				return this;
+			},
+			// Have the list do nothing anymore
+			disable: function() {
+				list = stack = memory = undefined;
+				return this;
+			},
+			// Is it disabled?
+			disabled: function() {
+				return !list;
+			},
+			// Lock the list in its current state
+			lock: function() {
+				stack = undefined;
+				if ( !memory ) {
+					self.disable();
+				}
+				return this;
+			},
+			// Is it locked?
+			locked: function() {
+				return !stack;
+			},
+			// Call all callbacks with the given context and arguments
+			fireWith: function( context, args ) {
+				args = args || [];
+				args = [ context, args.slice ? args.slice() : args ];
+				if ( list && ( !fired || stack ) ) {
+					if ( firing ) {
+						stack.push( args );
+					} else {
+						fire( args );
+					}
+				}
+				return this;
+			},
+			// Call all the callbacks with the given arguments
+			fire: function() {
+				self.fireWith( this, arguments );
+				return this;
+			},
+			// To know if the callbacks have already been called at least once
+			fired: function() {
+				return !!fired;
+			}
+		};
+
+	return self;
+};
+jQuery.extend({
+
+	Deferred: function( func ) {
+		var tuples = [
+				// action, add listener, listener list, final state
+				[ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
+				[ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
+				[ "notify", "progress", jQuery.Callbacks("memory") ]
+			],
+			state = "pending",
+			promise = {
+				state: function() {
+					return state;
+				},
+				always: function() {
+					deferred.done( arguments ).fail( arguments );
+					return this;
+				},
+				then: function( /* fnDone, fnFail, fnProgress */ ) {
+					var fns = arguments;
+					return jQuery.Deferred(function( newDefer ) {
+						jQuery.each( tuples, function( i, tuple ) {
+							var action = tuple[ 0 ],
+								fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
+							// deferred[ done | fail | progress ] for forwarding actions to newDefer
+							deferred[ tuple[1] ](function() {
+								var returned = fn && fn.apply( this, arguments );
+								if ( returned && jQuery.isFunction( returned.promise ) ) {
+									returned.promise()
+										.done( newDefer.resolve )
+										.fail( newDefer.reject )
+										.progress( newDefer.notify );
+								} else {
+									newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
+								}
+							});
+						});
+						fns = null;
+					}).promise();
+				},
+				// Get a promise for this deferred
+				// If obj is provided, the promise aspect is added to the object
+				promise: function( obj ) {
+					return obj != null ? jQuery.extend( obj, promise ) : promise;
+				}
+			},
+			deferred = {};
+
+		// Keep pipe for back-compat
+		promise.pipe = promise.then;
+
+		// Add list-specific methods
+		jQuery.each( tuples, function( i, tuple ) {
+			var list = tuple[ 2 ],
+				stateString = tuple[ 3 ];
+
+			// promise[ done | fail | progress ] = list.add
+			promise[ tuple[1] ] = list.add;
+
+			// Handle state
+			if ( stateString ) {
+				list.add(function() {
+					// state = [ resolved | rejected ]
+					state = stateString;
+
+				// [ reject_list | resolve_list ].disable; progress_list.lock
+				}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
+			}
+
+			// deferred[ resolve | reject | notify ]
+			deferred[ tuple[0] ] = function() {
+				deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
+				return this;
+			};
+			deferred[ tuple[0] + "With" ] = list.fireWith;
+		});
+
+		// Make the deferred a promise
+		promise.promise( deferred );
+
+		// Call given func if any
+		if ( func ) {
+			func.call( deferred, deferred );
+		}
+
+		// All done!
+		return deferred;
+	},
+
+	// Deferred helper
+	when: function( subordinate /* , ..., subordinateN */ ) {
+		var i = 0,
+			resolveValues = core_slice.call( arguments ),
+			length = resolveValues.length,
+
+			// the count of uncompleted subordinates
+			remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
+
+			// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
+			deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
+
+			// Update function for both resolve and progress values
+			updateFunc = function( i, contexts, values ) {
+				return function( value ) {
+					contexts[ i ] = this;
+					values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
+					if( values === progressValues ) {
+						deferred.notifyWith( contexts, values );
+					} else if ( !( --remaining ) ) {
+						deferred.resolveWith( contexts, values );
+					}
+				};
+			},
+
+			progressValues, progressContexts, resolveContexts;
+
+		// add listeners to Deferred subordinates; treat others as resolved
+		if ( length > 1 ) {
+			progressValues = new Array( length );
+			progressContexts = new Array( length );
+			resolveContexts = new Array( length );
+			for ( ; i < length; i++ ) {
+				if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
+					resolveValues[ i ].promise()
+						.done( updateFunc( i, resolveContexts, resolveValues ) )
+						.fail( deferred.reject )
+						.progress( updateFunc( i, progressContexts, progressValues ) );
+				} else {
+					--remaining;
+				}
+			}
+		}
+
+		// if we're not waiting on anything, resolve the master
+		if ( !remaining ) {
+			deferred.resolveWith( resolveContexts, resolveValues );
+		}
+
+		return deferred.promise();
+	}
+});
+jQuery.support = (function() {
+
+	var support, all, a,
+		input, select, fragment,
+		opt, eventName, isSupported, i,
+		div = document.createElement("div");
+
+	// Setup
+	div.setAttribute( "className", "t" );
+	div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
+
+	// Support tests won't run in some limited or non-browser environments
+	all = div.getElementsByTagName("*");
+	a = div.getElementsByTagName("a")[ 0 ];
+	if ( !all || !a || !all.length ) {
+		return {};
+	}
+
+	// First batch of tests
+	select = document.createElement("select");
+	opt = select.appendChild( document.createElement("option") );
+	input = div.getElementsByTagName("input")[ 0 ];
+
+	a.style.cssText = "top:1px;float:left;opacity:.5";
+	support = {
+		// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
+		getSetAttribute: div.className !== "t",
+
+		// IE strips leading whitespace when .innerHTML is used
+		leadingWhitespace: div.firstChild.nodeType === 3,
+
+		// Make sure that tbody elements aren't automatically inserted
+		// IE will insert them into empty tables
+		tbody: !div.getElementsByTagName("tbody").length,
+
+		// Make sure that link elements get serialized correctly by innerHTML
+		// This requires a wrapper element in IE
+		htmlSerialize: !!div.getElementsByTagName("link").length,
+
+		// Get the style information from getAttribute
+		// (IE uses .cssText instead)
+		style: /top/.test( a.getAttribute("style") ),
+
+		// Make sure that URLs aren't manipulated
+		// (IE normalizes it by default)
+		hrefNormalized: a.getAttribute("href") === "/a",
+
+		// Make sure that element opacity exists
+		// (IE uses filter instead)
+		// Use a regex to work around a WebKit issue. See #5145
+		opacity: /^0.5/.test( a.style.opacity ),
+
+		// Verify style float existence
+		// (IE uses styleFloat instead of cssFloat)
+		cssFloat: !!a.style.cssFloat,
+
+		// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
+		checkOn: !!input.value,
+
+		// Make sure that a selected-by-default option has a working selected property.
+		// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
+		optSelected: opt.selected,
+
+		// Tests for enctype support on a form (#6743)
+		enctype: !!document.createElement("form").enctype,
+
+		// Makes sure cloning an html5 element does not cause problems
+		// Where outerHTML is undefined, this still works
+		html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
+
+		// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
+		boxModel: document.compatMode === "CSS1Compat",
+
+		// Will be defined later
+		deleteExpando: true,
+		noCloneEvent: true,
+		inlineBlockNeedsLayout: false,
+		shrinkWrapBlocks: false,
+		reliableMarginRight: true,
+		boxSizingReliable: true,
+		pixelPosition: false
+	};
+
+	// Make sure checked status is properly cloned
+	input.checked = true;
+	support.noCloneChecked = input.cloneNode( true ).checked;
+
+	// Make sure that the options inside disabled selects aren't marked as disabled
+	// (WebKit marks them as disabled)
+	select.disabled = true;
+	support.optDisabled = !opt.disabled;
+
+	// Support: IE<9
+	try {
+		delete div.test;
+	} catch( e ) {
+		support.deleteExpando = false;
+	}
+
+	// Check if we can trust getAttribute("value")
+	input = document.createElement("input");
+	input.setAttribute( "value", "" );
+	support.input = input.getAttribute( "value" ) === "";
+
+	// Check if an input maintains its value after becoming a radio
+	input.value = "t";
+	input.setAttribute( "type", "radio" );
+	support.radioValue = input.value === "t";
+
+	// #11217 - WebKit loses check when the name is after the checked attribute
+	input.setAttribute( "checked", "t" );
+	input.setAttribute( "name", "t" );
+
+	fragment = document.createDocumentFragment();
+	fragment.appendChild( input );
+
+	// Check if a disconnected checkbox will retain its checked
+	// value of true after appended to the DOM (IE6/7)
+	support.appendChecked = input.checked;
+
+	// WebKit doesn't clone checked state correctly in fragments
+	support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
+
+	// Support: IE<9
+	// Opera does not clone events (and typeof div.attachEvent === undefined).
+	// IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
+	if ( div.attachEvent ) {
+		div.attachEvent( "onclick", function() {
+			support.noCloneEvent = false;
+		});
+
+		div.cloneNode( true ).click();
+	}
+
+	// Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
+	// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php
+	for ( i in { submit: true, change: true, focusin: true }) {
+		div.setAttribute( eventName = "on" + i, "t" );
+
+		support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
+	}
+
+	div.style.backgroundClip = "content-box";
+	div.cloneNode( true ).style.backgroundClip = "";
+	support.clearCloneStyle = div.style.backgroundClip === "content-box";
+
+	// Run tests that need a body at doc ready
+	jQuery(function() {
+		var container, marginDiv, tds,
+			divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
+			body = document.getElementsByTagName("body")[0];
+
+		if ( !body ) {
+			// Return for frameset docs that don't have a body
+			return;
+		}
+
+		container = document.createElement("div");
+		container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
+
+		body.appendChild( container ).appendChild( div );
+
+		// Support: IE8
+		// Check if table cells still have offsetWidth/Height when they are set
+		// to display:none and there are still other visible table cells in a
+		// table row; if so, offsetWidth/Height are not reliable for use when
+		// determining if an element has been hidden directly using
+		// display:none (it is still safe to use offsets if a parent element is
+		// hidden; don safety goggles and see bug #4512 for more information).
+		div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
+		tds = div.getElementsByTagName("td");
+		tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
+		isSupported = ( tds[ 0 ].offsetHeight === 0 );
+
+		tds[ 0 ].style.display = "";
+		tds[ 1 ].style.display = "none";
+
+		// Support: IE8
+		// Check if empty table cells still have offsetWidth/Height
+		support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
+
+		// Check box-sizing and margin behavior
+		div.innerHTML = "";
+		div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
+		support.boxSizing = ( div.offsetWidth === 4 );
+		support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
+
+		// Use window.getComputedStyle because jsdom on node.js will break without it.
+		if ( window.getComputedStyle ) {
+			support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
+			support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
+
+			// Check if div with explicit width and no margin-right incorrectly
+			// gets computed margin-right based on width of container. (#3333)
+			// Fails in WebKit before Feb 2011 nightlies
+			// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+			marginDiv = div.appendChild( document.createElement("div") );
+			marginDiv.style.cssText = div.style.cssText = divReset;
+			marginDiv.style.marginRight = marginDiv.style.width = "0";
+			div.style.width = "1px";
+
+			support.reliableMarginRight =
+				!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
+		}
+
+		if ( typeof div.style.zoom !== core_strundefined ) {
+			// Support: IE<8
+			// Check if natively block-level elements act like inline-block
+			// elements when setting their display to 'inline' and giving
+			// them layout
+			div.innerHTML = "";
+			div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
+			support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
+
+			// Support: IE6
+			// Check if elements with layout shrink-wrap their children
+			div.style.display = "block";
+			div.innerHTML = "<div></div>";
+			div.firstChild.style.width = "5px";
+			support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
+
+			if ( support.inlineBlockNeedsLayout ) {
+				// Prevent IE 6 from affecting layout for positioned elements #11048
+				// Prevent IE from shrinking the body in IE 7 mode #12869
+				// Support: IE<8
+				body.style.zoom = 1;
+			}
+		}
+
+		body.removeChild( container );
+
+		// Null elements to avoid leaks in IE
+		container = div = tds = marginDiv = null;
+	});
+
+	// Null elements to avoid leaks in IE
+	all = select = fragment = opt = a = input = null;
+
+	return support;
+})();
+
+var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
+	rmultiDash = /([A-Z])/g;
+
+function internalData( elem, name, data, pvt /* Internal Use Only */ ){
+	if ( !jQuery.acceptData( elem ) ) {
+		return;
+	}
+
+	var thisCache, ret,
+		internalKey = jQuery.expando,
+		getByName = typeof name === "string",
+
+		// We have to handle DOM nodes and JS objects differently because IE6-7
+		// can't GC object references properly across the DOM-JS boundary
+		isNode = elem.nodeType,
+
+		// Only DOM nodes need the global jQuery cache; JS object data is
+		// attached directly to the object so GC can occur automatically
+		cache = isNode ? jQuery.cache : elem,
+
+		// Only defining an ID for JS objects if its cache already exists allows
+		// the code to shortcut on the same path as a DOM node with no cache
+		id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
+
+	// Avoid doing any more work than we need to when trying to get data on an
+	// object that has no data at all
+	if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
+		return;
+	}
+
+	if ( !id ) {
+		// Only DOM nodes need a new unique ID for each element since their data
+		// ends up in the global cache
+		if ( isNode ) {
+			elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++;
+		} else {
+			id = internalKey;
+		}
+	}
+
+	if ( !cache[ id ] ) {
+		cache[ id ] = {};
+
+		// Avoids exposing jQuery metadata on plain JS objects when the object
+		// is serialized using JSON.stringify
+		if ( !isNode ) {
+			cache[ id ].toJSON = jQuery.noop;
+		}
+	}
+
+	// An object can be passed to jQuery.data instead of a key/value pair; this gets
+	// shallow copied over onto the existing cache
+	if ( typeof name === "object" || typeof name === "function" ) {
+		if ( pvt ) {
+			cache[ id ] = jQuery.extend( cache[ id ], name );
+		} else {
+			cache[ id ].data = jQuery.extend( cache[ id ].data, name );
+		}
+	}
+
+	thisCache = cache[ id ];
+
+	// jQuery data() is stored in a separate object inside the object's internal data
+	// cache in order to avoid key collisions between internal data and user-defined
+	// data.
+	if ( !pvt ) {
+		if ( !thisCache.data ) {
+			thisCache.data = {};
+		}
+
+		thisCache = thisCache.data;
+	}
+
+	if ( data !== undefined ) {
+		thisCache[ jQuery.camelCase( name ) ] = data;
+	}
+
+	// Check for both converted-to-camel and non-converted data property names
+	// If a data property was specified
+	if ( getByName ) {
+
+		// First Try to find as-is property data
+		ret = thisCache[ name ];
+
+		// Test for null|undefined property data
+		if ( ret == null ) {
+
+			// Try to find the camelCased property
+			ret = thisCache[ jQuery.camelCase( name ) ];
+		}
+	} else {
+		ret = thisCache;
+	}
+
+	return ret;
+}
+
+function internalRemoveData( elem, name, pvt ) {
+	if ( !jQuery.acceptData( elem ) ) {
+		return;
+	}
+
+	var i, l, thisCache,
+		isNode = elem.nodeType,
+
+		// See jQuery.data for more information
+		cache = isNode ? jQuery.cache : elem,
+		id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
+
+	// If there is already no cache entry for this object, there is no
+	// purpose in continuing
+	if ( !cache[ id ] ) {
+		return;
+	}
+
+	if ( name ) {
+
+		thisCache = pvt ? cache[ id ] : cache[ id ].data;
+
+		if ( thisCache ) {
+
+			// Support array or space separated string names for data keys
+			if ( !jQuery.isArray( name ) ) {
+
+				// try the string as a key before any manipulation
+				if ( name in thisCache ) {
+					name = [ name ];
+				} else {
+
+					// split the camel cased version by spaces unless a key with the spaces exists
+					name = jQuery.camelCase( name );
+					if ( name in thisCache ) {
+						name = [ name ];
+					} else {
+						name = name.split(" ");
+					}
+				}
+			} else {
+				// If "name" is an array of keys...
+				// When data is initially created, via ("key", "val") signature,
+				// keys will be converted to camelCase.
+				// Since there is no way to tell _how_ a key was added, remove
+				// both plain key and camelCase key. #12786
+				// This will only penalize the array argument path.
+				name = name.concat( jQuery.map( name, jQuery.camelCase ) );
+			}
+
+			for ( i = 0, l = name.length; i < l; i++ ) {
+				delete thisCache[ name[i] ];
+			}
+
+			// If there is no data left in the cache, we want to continue
+			// and let the cache object itself get destroyed
+			if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
+				return;
+			}
+		}
+	}
+
+	// See jQuery.data for more information
+	if ( !pvt ) {
+		delete cache[ id ].data;
+
+		// Don't destroy the parent cache unless the internal data object
+		// had been the only thing left in it
+		if ( !isEmptyDataObject( cache[ id ] ) ) {
+			return;
+		}
+	}
+
+	// Destroy the cache
+	if ( isNode ) {
+		jQuery.cleanData( [ elem ], true );
+
+	// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
+	} else if ( jQuery.support.deleteExpando || cache != cache.window ) {
+		delete cache[ id ];
+
+	// When all else fails, null
+	} else {
+		cache[ id ] = null;
+	}
+}
+
+jQuery.extend({
+	cache: {},
+
+	// Unique for each copy of jQuery on the page
+	// Non-digits removed to match rinlinejQuery
+	expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
+
+	// The following elements throw uncatchable exceptions if you
+	// attempt to add expando properties to them.
+	noData: {
+		"embed": true,
+		// Ban all objects except for Flash (which handle expandos)
+		"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
+		"applet": true
+	},
+
+	hasData: function( elem ) {
+		elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
+		return !!elem && !isEmptyDataObject( elem );
+	},
+
+	data: function( elem, name, data ) {
+		return internalData( elem, name, data );
+	},
+
+	removeData: function( elem, name ) {
+		return internalRemoveData( elem, name );
+	},
+
+	// For internal use only.
+	_data: function( elem, name, data ) {
+		return internalData( elem, name, data, true );
+	},
+
+	_removeData: function( elem, name ) {
+		return internalRemoveData( elem, name, true );
+	},
+
+	// A method for determining if a DOM node can handle the data expando
+	acceptData: function( elem ) {
+		// Do not set data on non-element because it will not be cleared (#8335).
+		if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
+			return false;
+		}
+
+		var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
+
+		// nodes accept data unless otherwise specified; rejection can be conditional
+		return !noData || noData !== true && elem.getAttribute("classid") === noData;
+	}
+});
+
+jQuery.fn.extend({
+	data: function( key, value ) {
+		var attrs, name,
+			elem = this[0],
+			i = 0,
+			data = null;
+
+		// Gets all values
+		if ( key === undefined ) {
+			if ( this.length ) {
+				data = jQuery.data( elem );
+
+				if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
+					attrs = elem.attributes;
+					for ( ; i < attrs.length; i++ ) {
+						name = attrs[i].name;
+
+						if ( !name.indexOf( "data-" ) ) {
+							name = jQuery.camelCase( name.slice(5) );
+
+							dataAttr( elem, name, data[ name ] );
+						}
+					}
+					jQuery._data( elem, "parsedAttrs", true );
+				}
+			}
+
+			return data;
+		}
+
+		// Sets multiple values
+		if ( typeof key === "object" ) {
+			return this.each(function() {
+				jQuery.data( this, key );
+			});
+		}
+
+		return jQuery.access( this, function( value ) {
+
+			if ( value === undefined ) {
+				// Try to fetch any internally stored data first
+				return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
+			}
+
+			this.each(function() {
+				jQuery.data( this, key, value );
+			});
+		}, null, value, arguments.length > 1, null, true );
+	},
+
+	removeData: function( key ) {
+		return this.each(function() {
+			jQuery.removeData( this, key );
+		});
+	}
+});
+
+function dataAttr( elem, key, data ) {
+	// If nothing was found internally, try to fetch any
+	// data from the HTML5 data-* attribute
+	if ( data === undefined && elem.nodeType === 1 ) {
+
+		var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
+
+		data = elem.getAttribute( name );
+
+		if ( typeof data === "string" ) {
+			try {
+				data = data === "true" ? true :
+					data === "false" ? false :
+					data === "null" ? null :
+					// Only convert to a number if it doesn't change the string
+					+data + "" === data ? +data :
+					rbrace.test( data ) ? jQuery.parseJSON( data ) :
+						data;
+			} catch( e ) {}
+
+			// Make sure we set the data so it isn't changed later
+			jQuery.data( elem, key, data );
+
+		} else {
+			data = undefined;
+		}
+	}
+
+	return data;
+}
+
+// checks a cache object for emptiness
+function isEmptyDataObject( obj ) {
+	var name;
+	for ( name in obj ) {
+
+		// if the public data object is empty, the private is still empty
+		if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
+			continue;
+		}
+		if ( name !== "toJSON" ) {
+			return false;
+		}
+	}
+
+	return true;
+}
+jQuery.extend({
+	queue: function( elem, type, data ) {
+		var queue;
+
+		if ( elem ) {
+			type = ( type || "fx" ) + "queue";
+			queue = jQuery._data( elem, type );
+
+			// Speed up dequeue by getting out quickly if this is just a lookup
+			if ( data ) {
+				if ( !queue || jQuery.isArray(data) ) {
+					queue = jQuery._data( elem, type, jQuery.makeArray(data) );
+				} else {
+					queue.push( data );
+				}
+			}
+			return queue || [];
+		}
+	},
+
+	dequeue: function( elem, type ) {
+		type = type || "fx";
+
+		var queue = jQuery.queue( elem, type ),
+			startLength = queue.length,
+			fn = queue.shift(),
+			hooks = jQuery._queueHooks( elem, type ),
+			next = function() {
+				jQuery.dequeue( elem, type );
+			};
+
+		// If the fx queue is dequeued, always remove the progress sentinel
+		if ( fn === "inprogress" ) {
+			fn = queue.shift();
+			startLength--;
+		}
+
+		hooks.cur = fn;
+		if ( fn ) {
+
+			// Add a progress sentinel to prevent the fx queue from being
+			// automatically dequeued
+			if ( type === "fx" ) {
+				queue.unshift( "inprogress" );
+			}
+
+			// clear up the last queue stop function
+			delete hooks.stop;
+			fn.call( elem, next, hooks );
+		}
+
+		if ( !startLength && hooks ) {
+			hooks.empty.fire();
+		}
+	},
+
+	// not intended for public consumption - generates a queueHooks object, or returns the current one
+	_queueHooks: function( elem, type ) {
+		var key = type + "queueHooks";
+		return jQuery._data( elem, key ) || jQuery._data( elem, key, {
+			empty: jQuery.Callbacks("once memory").add(function() {
+				jQuery._removeData( elem, type + "queue" );
+				jQuery._removeData( elem, key );
+			})
+		});
+	}
+});
+
+jQuery.fn.extend({
+	queue: function( type, data ) {
+		var setter = 2;
+
+		if ( typeof type !== "string" ) {
+			data = type;
+			type = "fx";
+			setter--;
+		}
+
+		if ( arguments.length < setter ) {
+			return jQuery.queue( this[0], type );
+		}
+
+		return data === undefined ?
+			this :
+			this.each(function() {
+				var queue = jQuery.queue( this, type, data );
+
+				// ensure a hooks for this queue
+				jQuery._queueHooks( this, type );
+
+				if ( type === "fx" && queue[0] !== "inprogress" ) {
+					jQuery.dequeue( this, type );
+				}
+			});
+	},
+	dequeue: function( type ) {
+		return this.each(function() {
+			jQuery.dequeue( this, type );
+		});
+	},
+	// Based off of the plugin by Clint Helfers, with permission.
+	// http://blindsignals.com/index.php/2009/07/jquery-delay/
+	delay: function( time, type ) {
+		time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
+		type = type || "fx";
+
+		return this.queue( type, function( next, hooks ) {
+			var timeout = setTimeout( next, time );
+			hooks.stop = function() {
+				clearTimeout( timeout );
+			};
+		});
+	},
+	clearQueue: function( type ) {
+		return this.queue( type || "fx", [] );
+	},
+	// Get a promise resolved when queues of a certain type
+	// are emptied (fx is the type by default)
+	promise: function( type, obj ) {
+		var tmp,
+			count = 1,
+			defer = jQuery.Deferred(),
+			elements = this,
+			i = this.length,
+			resolve = function() {
+				if ( !( --count ) ) {
+					defer.resolveWith( elements, [ elements ] );
+				}
+			};
+
+		if ( typeof type !== "string" ) {
+			obj = type;
+			type = undefined;
+		}
+		type = type || "fx";
+
+		while( i-- ) {
+			tmp = jQuery._data( elements[ i ], type + "queueHooks" );
+			if ( tmp && tmp.empty ) {
+				count++;
+				tmp.empty.add( resolve );
+			}
+		}
+		resolve();
+		return defer.promise( obj );
+	}
+});
+var nodeHook, boolHook,
+	rclass = /[\t\r\n]/g,
+	rreturn = /\r/g,
+	rfocusable = /^(?:input|select|textarea|button|object)$/i,
+	rclickable = /^(?:a|area)$/i,
+	rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,
+	ruseDefault = /^(?:checked|selected)$/i,
+	getSetAttribute = jQuery.support.getSetAttribute,
+	getSetInput = jQuery.support.input;
+
+jQuery.fn.extend({
+	attr: function( name, value ) {
+		return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
+	},
+
+	removeAttr: function( name ) {
+		return this.each(function() {
+			jQuery.removeAttr( this, name );
+		});
+	},
+
+	prop: function( name, value ) {
+		return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
+	},
+
+	removeProp: function( name ) {
+		name = jQuery.propFix[ name ] || name;
+		return this.each(function() {
+			// try/catch handles cases where IE balks (such as removing a property on window)
+			try {
+				this[ name ] = undefined;
+				delete this[ name ];
+			} catch( e ) {}
+		});
+	},
+
+	addClass: function( value ) {
+		var classes, elem, cur, clazz, j,
+			i = 0,
+			len = this.length,
+			proceed = typeof value === "string" && value;
+
+		if ( jQuery.isFunction( value ) ) {
+			return this.each(function( j ) {
+				jQuery( this ).addClass( value.call( this, j, this.className ) );
+			});
+		}
+
+		if ( proceed ) {
+			// The disjunction here is for better compressibility (see removeClass)
+			classes = ( value || "" ).match( core_rnotwhite ) || [];
+
+			for ( ; i < len; i++ ) {
+				elem = this[ i ];
+				cur = elem.nodeType === 1 && ( elem.className ?
+					( " " + elem.className + " " ).replace( rclass, " " ) :
+					" "
+				);
+
+				if ( cur ) {
+					j = 0;
+					while ( (clazz = classes[j++]) ) {
+						if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
+							cur += clazz + " ";
+						}
+					}
+					elem.className = jQuery.trim( cur );
+
+				}
+			}
+		}
+
+		return this;
+	},
+
+	removeClass: function( value ) {
+		var classes, elem, cur, clazz, j,
+			i = 0,
+			len = this.length,
+			proceed = arguments.length === 0 || typeof value === "string" && value;
+
+		if ( jQuery.isFunction( value ) ) {
+			return this.each(function( j ) {
+				jQuery( this ).removeClass( value.call( this, j, this.className ) );
+			});
+		}
+		if ( proceed ) {
+			classes = ( value || "" ).match( core_rnotwhite ) || [];
+
+			for ( ; i < len; i++ ) {
+				elem = this[ i ];
+				// This expression is here for better compressibility (see addClass)
+				cur = elem.nodeType === 1 && ( elem.className ?
+					( " " + elem.className + " " ).replace( rclass, " " ) :
+					""
+				);
+
+				if ( cur ) {
+					j = 0;
+					while ( (clazz = classes[j++]) ) {
+						// Remove *all* instances
+						while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
+							cur = cur.replace( " " + clazz + " ", " " );
+						}
+					}
+					elem.className = value ? jQuery.trim( cur ) : "";
+				}
+			}
+		}
+
+		return this;
+	},
+
+	toggleClass: function( value, stateVal ) {
+		var type = typeof value,
+			isBool = typeof stateVal === "boolean";
+
+		if ( jQuery.isFunction( value ) ) {
+			return this.each(function( i ) {
+				jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
+			});
+		}
+
+		return this.each(function() {
+			if ( type === "string" ) {
+				// toggle individual class names
+				var className,
+					i = 0,
+					self = jQuery( this ),
+					state = stateVal,
+					classNames = value.match( core_rnotwhite ) || [];
+
+				while ( (className = classNames[ i++ ]) ) {
+					// check each className given, space separated list
+					state = isBool ? state : !self.hasClass( className );
+					self[ state ? "addClass" : "removeClass" ]( className );
+				}
+
+			// Toggle whole class name
+			} else if ( type === core_strundefined || type === "boolean" ) {
+				if ( this.className ) {
+					// store className if set
+					jQuery._data( this, "__className__", this.className );
+				}
+
+				// If the element has a class name or if we're passed "false",
+				// then remove the whole classname (if there was one, the above saved it).
+				// Otherwise bring back whatever was previously saved (if anything),
+				// falling back to the empty string if nothing was stored.
+				this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
+			}
+		});
+	},
+
+	hasClass: function( selector ) {
+		var className = " " + selector + " ",
+			i = 0,
+			l = this.length;
+		for ( ; i < l; i++ ) {
+			if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
+				return true;
+			}
+		}
+
+		return false;
+	},
+
+	val: function( value ) {
+		var ret, hooks, isFunction,
+			elem = this[0];
+
+		if ( !arguments.length ) {
+			if ( elem ) {
+				hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
+
+				if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
+					return ret;
+				}
+
+				ret = elem.value;
+
+				return typeof ret === "string" ?
+					// handle most common string cases
+					ret.replace(rreturn, "") :
+					// handle cases where value is null/undef or number
+					ret == null ? "" : ret;
+			}
+
+			return;
+		}
+
+		isFunction = jQuery.isFunction( value );
+
+		return this.each(function( i ) {
+			var val,
+				self = jQuery(this);
+
+			if ( this.nodeType !== 1 ) {
+				return;
+			}
+
+			if ( isFunction ) {
+				val = value.call( this, i, self.val() );
+			} else {
+				val = value;
+			}
+
+			// Treat null/undefined as ""; convert numbers to string
+			if ( val == null ) {
+				val = "";
+			} else if ( typeof val === "number" ) {
+				val += "";
+			} else if ( jQuery.isArray( val ) ) {
+				val = jQuery.map(val, function ( value ) {
+					return value == null ? "" : value + "";
+				});
+			}
+
+			hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
+
+			// If set returns undefined, fall back to normal setting
+			if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
+				this.value = val;
+			}
+		});
+	}
+});
+
+jQuery.extend({
+	valHooks: {
+		option: {
+			get: function( elem ) {
+				// attributes.value is undefined in Blackberry 4.7 but
+				// uses .value. See #6932
+				var val = elem.attributes.value;
+				return !val || val.specified ? elem.value : elem.text;
+			}
+		},
+		select: {
+			get: function( elem ) {
+				var value, option,
+					options = elem.options,
+					index = elem.selectedIndex,
+					one = elem.type === "select-one" || index < 0,
+					values = one ? null : [],
+					max = one ? index + 1 : options.length,
+					i = index < 0 ?
+						max :
+						one ? index : 0;
+
+				// Loop through all the selected options
+				for ( ; i < max; i++ ) {
+					option = options[ i ];
+
+					// oldIE doesn't update selected after form reset (#2551)
+					if ( ( option.selected || i === index ) &&
+							// Don't return options that are disabled or in a disabled optgroup
+							( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
+							( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
+
+						// Get the specific value for the option
+						value = jQuery( option ).val();
+
+						// We don't need an array for one selects
+						if ( one ) {
+							return value;
+						}
+
+						// Multi-Selects return an array
+						values.push( value );
+					}
+				}
+
+				return values;
+			},
+
+			set: function( elem, value ) {
+				var values = jQuery.makeArray( value );
+
+				jQuery(elem).find("option").each(function() {
+					this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
+				});
+
+				if ( !values.length ) {
+					elem.selectedIndex = -1;
+				}
+				return values;
+			}
+		}
+	},
+
+	attr: function( elem, name, value ) {
+		var hooks, notxml, ret,
+			nType = elem.nodeType;
+
+		// don't get/set attributes on text, comment and attribute nodes
+		if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+			return;
+		}
+
+		// Fallback to prop when attributes are not supported
+		if ( typeof elem.getAttribute === core_strundefined ) {
+			return jQuery.prop( elem, name, value );
+		}
+
+		notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+		// All attributes are lowercase
+		// Grab necessary hook if one is defined
+		if ( notxml ) {
+			name = name.toLowerCase();
+			hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
+		}
+
+		if ( value !== undefined ) {
+
+			if ( value === null ) {
+				jQuery.removeAttr( elem, name );
+
+			} else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+				return ret;
+
+			} else {
+				elem.setAttribute( name, value + "" );
+				return value;
+			}
+
+		} else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+			return ret;
+
+		} else {
+
+			// In IE9+, Flash objects don't have .getAttribute (#12945)
+			// Support: IE9+
+			if ( typeof elem.getAttribute !== core_strundefined ) {
+				ret =  elem.getAttribute( name );
+			}
+
+			// Non-existent attributes return null, we normalize to undefined
+			return ret == null ?
+				undefined :
+				ret;
+		}
+	},
+
+	removeAttr: function( elem, value ) {
+		var name, propName,
+			i = 0,
+			attrNames = value && value.match( core_rnotwhite );
+
+		if ( attrNames && elem.nodeType === 1 ) {
+			while ( (name = attrNames[i++]) ) {
+				propName = jQuery.propFix[ name ] || name;
+
+				// Boolean attributes get special treatment (#10870)
+				if ( rboolean.test( name ) ) {
+					// Set corresponding property to false for boolean attributes
+					// Also clear defaultChecked/defaultSelected (if appropriate) for IE<8
+					if ( !getSetAttribute && ruseDefault.test( name ) ) {
+						elem[ jQuery.camelCase( "default-" + name ) ] =
+							elem[ propName ] = false;
+					} else {
+						elem[ propName ] = false;
+					}
+
+				// See #9699 for explanation of this approach (setting first, then removal)
+				} else {
+					jQuery.attr( elem, name, "" );
+				}
+
+				elem.removeAttribute( getSetAttribute ? name : propName );
+			}
+		}
+	},
+
+	attrHooks: {
+		type: {
+			set: function( elem, value ) {
+				if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
+					// Setting the type on a radio button after the value resets the value in IE6-9
+					// Reset value to default in case type is set after value during creation
+					var val = elem.value;
+					elem.setAttribute( "type", value );
+					if ( val ) {
+						elem.value = val;
+					}
+					return value;
+				}
+			}
+		}
+	},
+
+	propFix: {
+		tabindex: "tabIndex",
+		readonly: "readOnly",
+		"for": "htmlFor",
+		"class": "className",
+		maxlength: "maxLength",
+		cellspacing: "cellSpacing",
+		cellpadding: "cellPadding",
+		rowspan: "rowSpan",
+		colspan: "colSpan",
+		usemap: "useMap",
+		frameborder: "frameBorder",
+		contenteditable: "contentEditable"
+	},
+
+	prop: function( elem, name, value ) {
+		var ret, hooks, notxml,
+			nType = elem.nodeType;
+
+		// don't get/set properties on text, comment and attribute nodes
+		if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+			return;
+		}
+
+		notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+		if ( notxml ) {
+			// Fix name and attach hooks
+			name = jQuery.propFix[ name ] || name;
+			hooks = jQuery.propHooks[ name ];
+		}
+
+		if ( value !== undefined ) {
+			if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+				return ret;
+
+			} else {
+				return ( elem[ name ] = value );
+			}
+
+		} else {
+			if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+				return ret;
+
+			} else {
+				return elem[ name ];
+			}
+		}
+	},
+
+	propHooks: {
+		tabIndex: {
+			get: function( elem ) {
+				// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+				// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
+				var attributeNode = elem.getAttributeNode("tabindex");
+
+				return attributeNode && attributeNode.specified ?
+					parseInt( attributeNode.value, 10 ) :
+					rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
+						0 :
+						undefined;
+			}
+		}
+	}
+});
+
+// Hook for boolean attributes
+boolHook = {
+	get: function( elem, name ) {
+		var
+			// Use .prop to determine if this attribute is understood as boolean
+			prop = jQuery.prop( elem, name ),
+
+			// Fetch it accordingly
+			attr = typeof prop === "boolean" && elem.getAttribute( name ),
+			detail = typeof prop === "boolean" ?
+
+				getSetInput && getSetAttribute ?
+					attr != null :
+					// oldIE fabricates an empty string for missing boolean attributes
+					// and conflates checked/selected into attroperties
+					ruseDefault.test( name ) ?
+						elem[ jQuery.camelCase( "default-" + name ) ] :
+						!!attr :
+
+				// fetch an attribute node for properties not recognized as boolean
+				elem.getAttributeNode( name );
+
+		return detail && detail.value !== false ?
+			name.toLowerCase() :
+			undefined;
+	},
+	set: function( elem, value, name ) {
+		if ( value === false ) {
+			// Remove boolean attributes when set to false
+			jQuery.removeAttr( elem, name );
+		} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
+			// IE<8 needs the *property* name
+			elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
+
+		// Use defaultChecked and defaultSelected for oldIE
+		} else {
+			elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
+		}
+
+		return name;
+	}
+};
+
+// fix oldIE value attroperty
+if ( !getSetInput || !getSetAttribute ) {
+	jQuery.attrHooks.value = {
+		get: function( elem, name ) {
+			var ret = elem.getAttributeNode( name );
+			return jQuery.nodeName( elem, "input" ) ?
+
+				// Ignore the value *property* by using defaultValue
+				elem.defaultValue :
+
+				ret && ret.specified ? ret.value : undefined;
+		},
+		set: function( elem, value, name ) {
+			if ( jQuery.nodeName( elem, "input" ) ) {
+				// Does not return so that setAttribute is also used
+				elem.defaultValue = value;
+			} else {
+				// Use nodeHook if defined (#1954); otherwise setAttribute is fine
+				return nodeHook && nodeHook.set( elem, value, name );
+			}
+		}
+	};
+}
+
+// IE6/7 do not support getting/setting some attributes with get/setAttribute
+if ( !getSetAttribute ) {
+
+	// Use this for any attribute in IE6/7
+	// This fixes almost every IE6/7 issue
+	nodeHook = jQuery.valHooks.button = {
+		get: function( elem, name ) {
+			var ret = elem.getAttributeNode( name );
+			return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ?
+				ret.value :
+				undefined;
+		},
+		set: function( elem, value, name ) {
+			// Set the existing or create a new attribute node
+			var ret = elem.getAttributeNode( name );
+			if ( !ret ) {
+				elem.setAttributeNode(
+					(ret = elem.ownerDocument.createAttribute( name ))
+				);
+			}
+
+			ret.value = value += "";
+
+			// Break association with cloned elements by also using setAttribute (#9646)
+			return name === "value" || value === elem.getAttribute( name ) ?
+				value :
+				undefined;
+		}
+	};
+
+	// Set contenteditable to false on removals(#10429)
+	// Setting to empty string throws an error as an invalid value
+	jQuery.attrHooks.contenteditable = {
+		get: nodeHook.get,
+		set: function( elem, value, name ) {
+			nodeHook.set( elem, value === "" ? false : value, name );
+		}
+	};
+
+	// Set width and height to auto instead of 0 on empty string( Bug #8150 )
+	// This is for removals
+	jQuery.each([ "width", "height" ], function( i, name ) {
+		jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+			set: function( elem, value ) {
+				if ( value === "" ) {
+					elem.setAttribute( name, "auto" );
+					return value;
+				}
+			}
+		});
+	});
+}
+
+
+// Some attributes require a special call on IE
+// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
+if ( !jQuery.support.hrefNormalized ) {
+	jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
+		jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+			get: function( elem ) {
+				var ret = elem.getAttribute( name, 2 );
+				return ret == null ? undefined : ret;
+			}
+		});
+	});
+
+	// href/src property should get the full normalized URL (#10299/#12915)
+	jQuery.each([ "href", "src" ], function( i, name ) {
+		jQuery.propHooks[ name ] = {
+			get: function( elem ) {
+				return elem.getAttribute( name, 4 );
+			}
+		};
+	});
+}
+
+if ( !jQuery.support.style ) {
+	jQuery.attrHooks.style = {
+		get: function( elem ) {
+			// Return undefined in the case of empty string
+			// Note: IE uppercases css property names, but if we were to .toLowerCase()
+			// .cssText, that would destroy case senstitivity in URL's, like in "background"
+			return elem.style.cssText || undefined;
+		},
+		set: function( elem, value ) {
+			return ( elem.style.cssText = value + "" );
+		}
+	};
+}
+
+// Safari mis-reports the default selected property of an option
+// Accessing the parent's selectedIndex property fixes it
+if ( !jQuery.support.optSelected ) {
+	jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
+		get: function( elem ) {
+			var parent = elem.parentNode;
+
+			if ( parent ) {
+				parent.selectedIndex;
+
+				// Make sure that it also works with optgroups, see #5701
+				if ( parent.parentNode ) {
+					parent.parentNode.selectedIndex;
+				}
+			}
+			return null;
+		}
+	});
+}
+
+// IE6/7 call enctype encoding
+if ( !jQuery.support.enctype ) {
+	jQuery.propFix.enctype = "encoding";
+}
+
+// Radios and checkboxes getter/setter
+if ( !jQuery.support.checkOn ) {
+	jQuery.each([ "radio", "checkbox" ], function() {
+		jQuery.valHooks[ this ] = {
+			get: function( elem ) {
+				// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
+				return elem.getAttribute("value") === null ? "on" : elem.value;
+			}
+		};
+	});
+}
+jQuery.each([ "radio", "checkbox" ], function() {
+	jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
+		set: function( elem, value ) {
+			if ( jQuery.isArray( value ) ) {
+				return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
+			}
+		}
+	});
+});
+var rformElems = /^(?:input|select|textarea)$/i,
+	rkeyEvent = /^key/,
+	rmouseEvent = /^(?:mouse|contextmenu)|click/,
+	rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
+	rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
+
+function returnTrue() {
+	return true;
+}
+
+function returnFalse() {
+	return false;
+}
+
+/*
+ * Helper functions for managing events -- not part of the public interface.
+ * Props to Dean Edwards' addEvent library for many of the ideas.
+ */
+jQuery.event = {
+
+	global: {},
+
+	add: function( elem, types, handler, data, selector ) {
+		var tmp, events, t, handleObjIn,
+			special, eventHandle, handleObj,
+			handlers, type, namespaces, origType,
+			elemData = jQuery._data( elem );
+
+		// Don't attach events to noData or text/comment nodes (but allow plain objects)
+		if ( !elemData ) {
+			return;
+		}
+
+		// Caller can pass in an object of custom data in lieu of the handler
+		if ( handler.handler ) {
+			handleObjIn = handler;
+			handler = handleObjIn.handler;
+			selector = handleObjIn.selector;
+		}
+
+		// Make sure that the handler has a unique ID, used to find/remove it later
+		if ( !handler.guid ) {
+			handler.guid = jQuery.guid++;
+		}
+
+		// Init the element's event structure and main handler, if this is the first
+		if ( !(events = elemData.events) ) {
+			events = elemData.events = {};
+		}
+		if ( !(eventHandle = elemData.handle) ) {
+			eventHandle = elemData.handle = function( e ) {
+				// Discard the second event of a jQuery.event.trigger() and
+				// when an event is called after a page has unloaded
+				return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ?
+					jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
+					undefined;
+			};
+			// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
+			eventHandle.elem = elem;
+		}
+
+		// Handle multiple events separated by a space
+		// jQuery(...).bind("mouseover mouseout", fn);
+		types = ( types || "" ).match( core_rnotwhite ) || [""];
+		t = types.length;
+		while ( t-- ) {
+			tmp = rtypenamespace.exec( types[t] ) || [];
+			type = origType = tmp[1];
+			namespaces = ( tmp[2] || "" ).split( "." ).sort();
+
+			// If event changes its type, use the special event handlers for the changed type
+			special = jQuery.event.special[ type ] || {};
+
+			// If selector defined, determine special event api type, otherwise given type
+			type = ( selector ? special.delegateType : special.bindType ) || type;
+
+			// Update special based on newly reset type
+			special = jQuery.event.special[ type ] || {};
+
+			// handleObj is passed to all event handlers
+			handleObj = jQuery.extend({
+				type: type,
+				origType: origType,
+				data: data,
+				handler: handler,
+				guid: handler.guid,
+				selector: selector,
+				needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
+				namespace: namespaces.join(".")
+			}, handleObjIn );
+
+			// Init the event handler queue if we're the first
+			if ( !(handlers = events[ type ]) ) {
+				handlers = events[ type ] = [];
+				handlers.delegateCount = 0;
+
+				// Only use addEventListener/attachEvent if the special events handler returns false
+				if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
+					// Bind the global event handler to the element
+					if ( elem.addEventListener ) {
+						elem.addEventListener( type, eventHandle, false );
+
+					} else if ( elem.attachEvent ) {
+						elem.attachEvent( "on" + type, eventHandle );
+					}
+				}
+			}
+
+			if ( special.add ) {
+				special.add.call( elem, handleObj );
+
+				if ( !handleObj.handler.guid ) {
+					handleObj.handler.guid = handler.guid;
+				}
+			}
+
+			// Add to the element's handler list, delegates in front
+			if ( selector ) {
+				handlers.splice( handlers.delegateCount++, 0, handleObj );
+			} else {
+				handlers.push( handleObj );
+			}
+
+			// Keep track of which events have ever been used, for event optimization
+			jQuery.event.global[ type ] = true;
+		}
+
+		// Nullify elem to prevent memory leaks in IE
+		elem = null;
+	},
+
+	// Detach an event or set of events from an element
+	remove: function( elem, types, handler, selector, mappedTypes ) {
+		var j, handleObj, tmp,
+			origCount, t, events,
+			special, handlers, type,
+			namespaces, origType,
+			elemData = jQuery.hasData( elem ) && jQuery._data( elem );
+
+		if ( !elemData || !(events = elemData.events) ) {
+			return;
+		}
+
+		// Once for each type.namespace in types; type may be omitted
+		types = ( types || "" ).match( core_rnotwhite ) || [""];
+		t = types.length;
+		while ( t-- ) {
+			tmp = rtypenamespace.exec( types[t] ) || [];
+			type = origType = tmp[1];
+			namespaces = ( tmp[2] || "" ).split( "." ).sort();
+
+			// Unbind all events (on this namespace, if provided) for the element
+			if ( !type ) {
+				for ( type in events ) {
+					jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
+				}
+				continue;
+			}
+
+			special = jQuery.event.special[ type ] || {};
+			type = ( selector ? special.delegateType : special.bindType ) || type;
+			handlers = events[ type ] || [];
+			tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
+
+			// Remove matching events
+			origCount = j = handlers.length;
+			while ( j-- ) {
+				handleObj = handlers[ j ];
+
+				if ( ( mappedTypes || origType === handleObj.origType ) &&
+					( !handler || handler.guid === handleObj.guid ) &&
+					( !tmp || tmp.test( handleObj.namespace ) ) &&
+					( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
+					handlers.splice( j, 1 );
+
+					if ( handleObj.selector ) {
+						handlers.delegateCount--;
+					}
+					if ( special.remove ) {
+						special.remove.call( elem, handleObj );
+					}
+				}
+			}
+
+			// Remove generic event handler if we removed something and no more handlers exist
+			// (avoids potential for endless recursion during removal of special event handlers)
+			if ( origCount && !handlers.length ) {
+				if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
+					jQuery.removeEvent( elem, type, elemData.handle );
+				}
+
+				delete events[ type ];
+			}
+		}
+
+		// Remove the expando if it's no longer used
+		if ( jQuery.isEmptyObject( events ) ) {
+			delete elemData.handle;
+
+			// removeData also checks for emptiness and clears the expando if empty
+			// so use it instead of delete
+			jQuery._removeData( elem, "events" );
+		}
+	},
+
+	trigger: function( event, data, elem, onlyHandlers ) {
+		var handle, ontype, cur,
+			bubbleType, special, tmp, i,
+			eventPath = [ elem || document ],
+			type = core_hasOwn.call( event, "type" ) ? event.type : event,
+			namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
+
+		cur = tmp = elem = elem || document;
+
+		// Don't do events on text and comment nodes
+		if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
+			return;
+		}
+
+		// focus/blur morphs to focusin/out; ensure we're not firing them right now
+		if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
+			return;
+		}
+
+		if ( type.indexOf(".") >= 0 ) {
+			// Namespaced trigger; create a regexp to match event type in handle()
+			namespaces = type.split(".");
+			type = namespaces.shift();
+			namespaces.sort();
+		}
+		ontype = type.indexOf(":") < 0 && "on" + type;
+
+		// Caller can pass in a jQuery.Event object, Object, or just an event type string
+		event = event[ jQuery.expando ] ?
+			event :
+			new jQuery.Event( type, typeof event === "object" && event );
+
+		event.isTrigger = true;
+		event.namespace = namespaces.join(".");
+		event.namespace_re = event.namespace ?
+			new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
+			null;
+
+		// Clean up the event in case it is being reused
+		event.result = undefined;
+		if ( !event.target ) {
+			event.target = elem;
+		}
+
+		// Clone any incoming data and prepend the event, creating the handler arg list
+		data = data == null ?
+			[ event ] :
+			jQuery.makeArray( data, [ event ] );
+
+		// Allow special events to draw outside the lines
+		special = jQuery.event.special[ type ] || {};
+		if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
+			return;
+		}
+
+		// Determine event propagation path in advance, per W3C events spec (#9951)
+		// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
+		if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
+
+			bubbleType = special.delegateType || type;
+			if ( !rfocusMorph.test( bubbleType + type ) ) {
+				cur = cur.parentNode;
+			}
+			for ( ; cur; cur = cur.parentNode ) {
+				eventPath.push( cur );
+				tmp = cur;
+			}
+
+			// Only add window if we got to document (e.g., not plain obj or detached DOM)
+			if ( tmp === (elem.ownerDocument || document) ) {
+				eventPath.push( tmp.defaultView || tmp.parentWindow || window );
+			}
+		}
+
+		// Fire handlers on the event path
+		i = 0;
+		while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
+
+			event.type = i > 1 ?
+				bubbleType :
+				special.bindType || type;
+
+			// jQuery handler
+			handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
+			if ( handle ) {
+				handle.apply( cur, data );
+			}
+
+			// Native handler
+			handle = ontype && cur[ ontype ];
+			if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
+				event.preventDefault();
+			}
+		}
+		event.type = type;
+
+		// If nobody prevented the default action, do it now
+		if ( !onlyHandlers && !event.isDefaultPrevented() ) {
+
+			if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
+				!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
+
+				// Call a native DOM method on the target with the same name name as the event.
+				// Can't use an .isFunction() check here because IE6/7 fails that test.
+				// Don't do default actions on window, that's where global variables be (#6170)
+				if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
+
+					// Don't re-trigger an onFOO event when we call its FOO() method
+					tmp = elem[ ontype ];
+
+					if ( tmp ) {
+						elem[ ontype ] = null;
+					}
+
+					// Prevent re-triggering of the same event, since we already bubbled it above
+					jQuery.event.triggered = type;
+					try {
+						elem[ type ]();
+					} catch ( e ) {
+						// IE<9 dies on focus/blur to hidden element (#1486,#12518)
+						// only reproducible on winXP IE8 native, not IE9 in IE8 mode
+					}
+					jQuery.event.triggered = undefined;
+
+					if ( tmp ) {
+						elem[ ontype ] = tmp;
+					}
+				}
+			}
+		}
+
+		return event.result;
+	},
+
+	dispatch: function( event ) {
+
+		// Make a writable jQuery.Event from the native event object
+		event = jQuery.event.fix( event );
+
+		var i, ret, handleObj, matched, j,
+			handlerQueue = [],
+			args = core_slice.call( arguments ),
+			handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
+			special = jQuery.event.special[ event.type ] || {};
+
+		// Use the fix-ed jQuery.Event rather than the (read-only) native event
+		args[0] = event;
+		event.delegateTarget = this;
+
+		// Call the preDispatch hook for the mapped type, and let it bail if desired
+		if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
+			return;
+		}
+
+		// Determine handlers
+		handlerQueue = jQuery.event.handlers.call( this, event, handlers );
+
+		// Run delegates first; they may want to stop propagation beneath us
+		i = 0;
+		while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
+			event.currentTarget = matched.elem;
+
+			j = 0;
+			while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
+
+				// Triggered event must either 1) have no namespace, or
+				// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
+				if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
+
+					event.handleObj = handleObj;
+					event.data = handleObj.data;
+
+					ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
+							.apply( matched.elem, args );
+
+					if ( ret !== undefined ) {
+						if ( (event.result = ret) === false ) {
+							event.preventDefault();
+							event.stopPropagation();
+						}
+					}
+				}
+			}
+		}
+
+		// Call the postDispatch hook for the mapped type
+		if ( special.postDispatch ) {
+			special.postDispatch.call( this, event );
+		}
+
+		return event.result;
+	},
+
+	handlers: function( event, handlers ) {
+		var sel, handleObj, matches, i,
+			handlerQueue = [],
+			delegateCount = handlers.delegateCount,
+			cur = event.target;
+
+		// Find delegate handlers
+		// Black-hole SVG <use> instance trees (#13180)
+		// Avoid non-left-click bubbling in Firefox (#3861)
+		if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
+
+			for ( ; cur != this; cur = cur.parentNode || this ) {
+
+				// Don't check non-elements (#13208)
+				// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
+				if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
+					matches = [];
+					for ( i = 0; i < delegateCount; i++ ) {
+						handleObj = handlers[ i ];
+
+						// Don't conflict with Object.prototype properties (#13203)
+						sel = handleObj.selector + " ";
+
+						if ( matches[ sel ] === undefined ) {
+							matches[ sel ] = handleObj.needsContext ?
+								jQuery( sel, this ).index( cur ) >= 0 :
+								jQuery.find( sel, this, null, [ cur ] ).length;
+						}
+						if ( matches[ sel ] ) {
+							matches.push( handleObj );
+						}
+					}
+					if ( matches.length ) {
+						handlerQueue.push({ elem: cur, handlers: matches });
+					}
+				}
+			}
+		}
+
+		// Add the remaining (directly-bound) handlers
+		if ( delegateCount < handlers.length ) {
+			handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
+		}
+
+		return handlerQueue;
+	},
+
+	fix: function( event ) {
+		if ( event[ jQuery.expando ] ) {
+			return event;
+		}
+
+		// Create a writable copy of the event object and normalize some properties
+		var i, prop, copy,
+			type = event.type,
+			originalEvent = event,
+			fixHook = this.fixHooks[ type ];
+
+		if ( !fixHook ) {
+			this.fixHooks[ type ] = fixHook =
+				rmouseEvent.test( type ) ? this.mouseHooks :
+				rkeyEvent.test( type ) ? this.keyHooks :
+				{};
+		}
+		copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
+
+		event = new jQuery.Event( originalEvent );
+
+		i = copy.length;
+		while ( i-- ) {
+			prop = copy[ i ];
+			event[ prop ] = originalEvent[ prop ];
+		}
+
+		// Support: IE<9
+		// Fix target property (#1925)
+		if ( !event.target ) {
+			event.target = originalEvent.srcElement || document;
+		}
+
+		// Support: Chrome 23+, Safari?
+		// Target should not be a text node (#504, #13143)
+		if ( event.target.nodeType === 3 ) {
+			event.target = event.target.parentNode;
+		}
+
+		// Support: IE<9
+		// For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
+		event.metaKey = !!event.metaKey;
+
+		return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
+	},
+
+	// Includes some event props shared by KeyEvent and MouseEvent
+	props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
+
+	fixHooks: {},
+
+	keyHooks: {
+		props: "char charCode key keyCode".split(" "),
+		filter: function( event, original ) {
+
+			// Add which for key events
+			if ( event.which == null ) {
+				event.which = original.charCode != null ? original.charCode : original.keyCode;
+			}
+
+			return event;
+		}
+	},
+
+	mouseHooks: {
+		props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
+		filter: function( event, original ) {
+			var body, eventDoc, doc,
+				button = original.button,
+				fromElement = original.fromElement;
+
+			// Calculate pageX/Y if missing and clientX/Y available
+			if ( event.pageX == null && original.clientX != null ) {
+				eventDoc = event.target.ownerDocument || document;
+				doc = eventDoc.documentElement;
+				body = eventDoc.body;
+
+				event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
+				event.pageY = original.clientY + ( doc && doc.scrollTop  || body && body.scrollTop  || 0 ) - ( doc && doc.clientTop  || body && body.clientTop  || 0 );
+			}
+
+			// Add relatedTarget, if necessary
+			if ( !event.relatedTarget && fromElement ) {
+				event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
+			}
+
+			// Add which for click: 1 === left; 2 === middle; 3 === right
+			// Note: button is not normalized, so don't use it
+			if ( !event.which && button !== undefined ) {
+				event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
+			}
+
+			return event;
+		}
+	},
+
+	special: {
+		load: {
+			// Prevent triggered image.load events from bubbling to window.load
+			noBubble: true
+		},
+		click: {
+			// For checkbox, fire native event so checked state will be right
+			trigger: function() {
+				if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
+					this.click();
+					return false;
+				}
+			}
+		},
+		focus: {
+			// Fire native event if possible so blur/focus sequence is correct
+			trigger: function() {
+				if ( this !== document.activeElement && this.focus ) {
+					try {
+						this.focus();
+						return false;
+					} catch ( e ) {
+						// Support: IE<9
+						// If we error on focus to hidden element (#1486, #12518),
+						// let .trigger() run the handlers
+					}
+				}
+			},
+			delegateType: "focusin"
+		},
+		blur: {
+			trigger: function() {
+				if ( this === document.activeElement && this.blur ) {
+					this.blur();
+					return false;
+				}
+			},
+			delegateType: "focusout"
+		},
+
+		beforeunload: {
+			postDispatch: function( event ) {
+
+				// Even when returnValue equals to undefined Firefox will still show alert
+				if ( event.result !== undefined ) {
+					event.originalEvent.returnValue = event.result;
+				}
+			}
+		}
+	},
+
+	simulate: function( type, elem, event, bubble ) {
+		// Piggyback on a donor event to simulate a different one.
+		// Fake originalEvent to avoid donor's stopPropagation, but if the
+		// simulated event prevents default then we do the same on the donor.
+		var e = jQuery.extend(
+			new jQuery.Event(),
+			event,
+			{ type: type,
+				isSimulated: true,
+				originalEvent: {}
+			}
+		);
+		if ( bubble ) {
+			jQuery.event.trigger( e, null, elem );
+		} else {
+			jQuery.event.dispatch.call( elem, e );
+		}
+		if ( e.isDefaultPrevented() ) {
+			event.preventDefault();
+		}
+	}
+};
+
+jQuery.removeEvent = document.removeEventListener ?
+	function( elem, type, handle ) {
+		if ( elem.removeEventListener ) {
+			elem.removeEventListener( type, handle, false );
+		}
+	} :
+	function( elem, type, handle ) {
+		var name = "on" + type;
+
+		if ( elem.detachEvent ) {
+
+			// #8545, #7054, preventing memory leaks for custom events in IE6-8
+			// detachEvent needed property on element, by name of that event, to properly expose it to GC
+			if ( typeof elem[ name ] === core_strundefined ) {
+				elem[ name ] = null;
+			}
+
+			elem.detachEvent( name, handle );
+		}
+	};
+
+jQuery.Event = function( src, props ) {
+	// Allow instantiation without the 'new' keyword
+	if ( !(this instanceof jQuery.Event) ) {
+		return new jQuery.Event( src, props );
+	}
+
+	// Event object
+	if ( src && src.type ) {
+		this.originalEvent = src;
+		this.type = src.type;
+
+		// Events bubbling up the document may have been marked as prevented
+		// by a handler lower down the tree; reflect the correct value.
+		this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
+			src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
+
+	// Event type
+	} else {
+		this.type = src;
+	}
+
+	// Put explicitly provided properties onto the event object
+	if ( props ) {
+		jQuery.extend( this, props );
+	}
+
+	// Create a timestamp if incoming event doesn't have one
+	this.timeStamp = src && src.timeStamp || jQuery.now();
+
+	// Mark it as fixed
+	this[ jQuery.expando ] = true;
+};
+
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
+jQuery.Event.prototype = {
+	isDefaultPrevented: returnFalse,
+	isPropagationStopped: returnFalse,
+	isImmediatePropagationStopped: returnFalse,
+
+	preventDefault: function() {
+		var e = this.originalEvent;
+
+		this.isDefaultPrevented = returnTrue;
+		if ( !e ) {
+			return;
+		}
+
+		// If preventDefault exists, run it on the original event
+		if ( e.preventDefault ) {
+			e.preventDefault();
+
+		// Support: IE
+		// Otherwise set the returnValue property of the original event to false
+		} else {
+			e.returnValue = false;
+		}
+	},
+	stopPropagation: function() {
+		var e = this.originalEvent;
+
+		this.isPropagationStopped = returnTrue;
+		if ( !e ) {
+			return;
+		}
+		// If stopPropagation exists, run it on the original event
+		if ( e.stopPropagation ) {
+			e.stopPropagation();
+		}
+
+		// Support: IE
+		// Set the cancelBubble property of the original event to true
+		e.cancelBubble = true;
+	},
+	stopImmediatePropagation: function() {
+		this.isImmediatePropagationStopped = returnTrue;
+		this.stopPropagation();
+	}
+};
+
+// Create mouseenter/leave events using mouseover/out and event-time checks
+jQuery.each({
+	mouseenter: "mouseover",
+	mouseleave: "mouseout"
+}, function( orig, fix ) {
+	jQuery.event.special[ orig ] = {
+		delegateType: fix,
+		bindType: fix,
+
+		handle: function( event ) {
+			var ret,
+				target = this,
+				related = event.relatedTarget,
+				handleObj = event.handleObj;
+
+			// For mousenter/leave call the handler if related is outside the target.
+			// NB: No relatedTarget if the mouse left/entered the browser window
+			if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
+				event.type = handleObj.origType;
+				ret = handleObj.handler.apply( this, arguments );
+				event.type = fix;
+			}
+			return ret;
+		}
+	};
+});
+
+// IE submit delegation
+if ( !jQuery.support.submitBubbles ) {
+
+	jQuery.event.special.submit = {
+		setup: function() {
+			// Only need this for delegated form submit events
+			if ( jQuery.nodeName( this, "form" ) ) {
+				return false;
+			}
+
+			// Lazy-add a submit handler when a descendant form may potentially be submitted
+			jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
+				// Node name check avoids a VML-related crash in IE (#9807)
+				var elem = e.target,
+					form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
+				if ( form && !jQuery._data( form, "submitBubbles" ) ) {
+					jQuery.event.add( form, "submit._submit", function( event ) {
+						event._submit_bubble = true;
+					});
+					jQuery._data( form, "submitBubbles", true );
+				}
+			});
+			// return undefined since we don't need an event listener
+		},
+
+		postDispatch: function( event ) {
+			// If form was submitted by the user, bubble the event up the tree
+			if ( event._submit_bubble ) {
+				delete event._submit_bubble;
+				if ( this.parentNode && !event.isTrigger ) {
+					jQuery.event.simulate( "submit", this.parentNode, event, true );
+				}
+			}
+		},
+
+		teardown: function() {
+			// Only need this for delegated form submit events
+			if ( jQuery.nodeName( this, "form" ) ) {
+				return false;
+			}
+
+			// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
+			jQuery.event.remove( this, "._submit" );
+		}
+	};
+}
+
+// IE change delegation and checkbox/radio fix
+if ( !jQuery.support.changeBubbles ) {
+
+	jQuery.event.special.change = {
+
+		setup: function() {
+
+			if ( rformElems.test( this.nodeName ) ) {
+				// IE doesn't fire change on a check/radio until blur; trigger it on click
+				// after a propertychange. Eat the blur-change in special.change.handle.
+				// This still fires onchange a second time for check/radio after blur.
+				if ( this.type === "checkbox" || this.type === "radio" ) {
+					jQuery.event.add( this, "propertychange._change", function( event ) {
+						if ( event.originalEvent.propertyName === "checked" ) {
+							this._just_changed = true;
+						}
+					});
+					jQuery.event.add( this, "click._change", function( event ) {
+						if ( this._just_changed && !event.isTrigger ) {
+							this._just_changed = false;
+						}
+						// Allow triggered, simulated change events (#11500)
+						jQuery.event.simulate( "change", this, event, true );
+					});
+				}
+				return false;
+			}
+			// Delegated event; lazy-add a change handler on descendant inputs
+			jQuery.event.add( this, "beforeactivate._change", function( e ) {
+				var elem = e.target;
+
+				if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
+					jQuery.event.add( elem, "change._change", function( event ) {
+						if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
+							jQuery.event.simulate( "change", this.parentNode, event, true );
+						}
+					});
+					jQuery._data( elem, "changeBubbles", true );
+				}
+			});
+		},
+
+		handle: function( event ) {
+			var elem = event.target;
+
+			// Swallow native change events from checkbox/radio, we already triggered them above
+			if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
+				return event.handleObj.handler.apply( this, arguments );
+			}
+		},
+
+		teardown: function() {
+			jQuery.event.remove( this, "._change" );
+
+			return !rformElems.test( this.nodeName );
+		}
+	};
+}
+
+// Create "bubbling" focus and blur events
+if ( !jQuery.support.focusinBubbles ) {
+	jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
+
+		// Attach a single capturing handler while someone wants focusin/focusout
+		var attaches = 0,
+			handler = function( event ) {
+				jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
+			};
+
+		jQuery.event.special[ fix ] = {
+			setup: function() {
+				if ( attaches++ === 0 ) {
+					document.addEventListener( orig, handler, true );
+				}
+			},
+			teardown: function() {
+				if ( --attaches === 0 ) {
+					document.removeEventListener( orig, handler, true );
+				}
+			}
+		};
+	});
+}
+
+jQuery.fn.extend({
+
+	on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
+		var type, origFn;
+
+		// Types can be a map of types/handlers
+		if ( typeof types === "object" ) {
+			// ( types-Object, selector, data )
+			if ( typeof selector !== "string" ) {
+				// ( types-Object, data )
+				data = data || selector;
+				selector = undefined;
+			}
+			for ( type in types ) {
+				this.on( type, selector, data, types[ type ], one );
+			}
+			return this;
+		}
+
+		if ( data == null && fn == null ) {
+			// ( types, fn )
+			fn = selector;
+			data = selector = undefined;
+		} else if ( fn == null ) {
+			if ( typeof selector === "string" ) {
+				// ( types, selector, fn )
+				fn = data;
+				data = undefined;
+			} else {
+				// ( types, data, fn )
+				fn = data;
+				data = selector;
+				selector = undefined;
+			}
+		}
+		if ( fn === false ) {
+			fn = returnFalse;
+		} else if ( !fn ) {
+			return this;
+		}
+
+		if ( one === 1 ) {
+			origFn = fn;
+			fn = function( event ) {
+				// Can use an empty set, since event contains the info
+				jQuery().off( event );
+				return origFn.apply( this, arguments );
+			};
+			// Use same guid so caller can remove using origFn
+			fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
+		}
+		return this.each( function() {
+			jQuery.event.add( this, types, fn, data, selector );
+		});
+	},
+	one: function( types, selector, data, fn ) {
+		return this.on( types, selector, data, fn, 1 );
+	},
+	off: function( types, selector, fn ) {
+		var handleObj, type;
+		if ( types && types.preventDefault && types.handleObj ) {
+			// ( event )  dispatched jQuery.Event
+			handleObj = types.handleObj;
+			jQuery( types.delegateTarget ).off(
+				handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
+				handleObj.selector,
+				handleObj.handler
+			);
+			return this;
+		}
+		if ( typeof types === "object" ) {
+			// ( types-object [, selector] )
+			for ( type in types ) {
+				this.off( type, selector, types[ type ] );
+			}
+			return this;
+		}
+		if ( selector === false || typeof selector === "function" ) {
+			// ( types [, fn] )
+			fn = selector;
+			selector = undefined;
+		}
+		if ( fn === false ) {
+			fn = returnFalse;
+		}
+		return this.each(function() {
+			jQuery.event.remove( this, types, fn, selector );
+		});
+	},
+
+	bind: function( types, data, fn ) {
+		return this.on( types, null, data, fn );
+	},
+	unbind: function( types, fn ) {
+		return this.off( types, null, fn );
+	},
+
+	delegate: function( selector, types, data, fn ) {
+		return this.on( types, selector, data, fn );
+	},
+	undelegate: function( selector, types, fn ) {
+		// ( namespace ) or ( selector, types [, fn] )
+		return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
+	},
+
+	trigger: function( type, data ) {
+		return this.each(function() {
+			jQuery.event.trigger( type, data, this );
+		});
+	},
+	triggerHandler: function( type, data ) {
+		var elem = this[0];
+		if ( elem ) {
+			return jQuery.event.trigger( type, data, elem, true );
+		}
+	}
+});
+/*!
+ * Sizzle CSS Selector Engine
+ * Copyright 2012 jQuery Foundation and other contributors
+ * Released under the MIT license
+ * http://sizzlejs.com/
+ */
+(function( window, undefined ) {
+
+var i,
+	cachedruns,
+	Expr,
+	getText,
+	isXML,
+	compile,
+	hasDuplicate,
+	outermostContext,
+
+	// Local document vars
+	setDocument,
+	document,
+	docElem,
+	documentIsXML,
+	rbuggyQSA,
+	rbuggyMatches,
+	matches,
+	contains,
+	sortOrder,
+
+	// Instance-specific data
+	expando = "sizzle" + -(new Date()),
+	preferredDoc = window.document,
+	support = {},
+	dirruns = 0,
+	done = 0,
+	classCache = createCache(),
+	tokenCache = createCache(),
+	compilerCache = createCache(),
+
+	// General-purpose constants
+	strundefined = typeof undefined,
+	MAX_NEGATIVE = 1 << 31,
+
+	// Array methods
+	arr = [],
+	pop = arr.pop,
+	push = arr.push,
+	slice = arr.slice,
+	// Use a stripped-down indexOf if we can't use a native one
+	indexOf = arr.indexOf || function( elem ) {
+		var i = 0,
+			len = this.length;
+		for ( ; i < len; i++ ) {
+			if ( this[i] === elem ) {
+				return i;
+			}
+		}
+		return -1;
+	},
+
+
+	// Regular expressions
+
+	// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
+	whitespace = "[\\x20\\t\\r\\n\\f]",
+	// http://www.w3.org/TR/css3-syntax/#characters
+	characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
+
+	// Loosely modeled on CSS identifier characters
+	// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
+	// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
+	identifier = characterEncoding.replace( "w", "w#" ),
+
+	// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
+	operators = "([*^$|!~]?=)",
+	attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
+		"*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
+
+	// Prefer arguments quoted,
+	//   then not containing pseudos/brackets,
+	//   then attribute selectors/non-parenthetical expressions,
+	//   then anything else
+	// These preferences are here to reduce the number of selectors
+	//   needing tokenize in the PSEUDO preFilter
+	pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
+
+	// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
+	rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
+
+	rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
+	rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
+	rpseudo = new RegExp( pseudos ),
+	ridentifier = new RegExp( "^" + identifier + "$" ),
+
+	matchExpr = {
+		"ID": new RegExp( "^#(" + characterEncoding + ")" ),
+		"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
+		"NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
+		"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
+		"ATTR": new RegExp( "^" + attributes ),
+		"PSEUDO": new RegExp( "^" + pseudos ),
+		"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
+			"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
+			"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
+		// For use in libraries implementing .is()
+		// We use this for POS matching in `select`
+		"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
+			whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
+	},
+
+	rsibling = /[\x20\t\r\n\f]*[+~]/,
+
+	rnative = /^[^{]+\{\s*\[native code/,
+
+	// Easily-parseable/retrievable ID or TAG or CLASS selectors
+	rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
+
+	rinputs = /^(?:input|select|textarea|button)$/i,
+	rheader = /^h\d$/i,
+
+	rescape = /'|\\/g,
+	rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
+
+	// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
+	runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,
+	funescape = function( _, escaped ) {
+		var high = "0x" + escaped - 0x10000;
+		// NaN means non-codepoint
+		return high !== high ?
+			escaped :
+			// BMP codepoint
+			high < 0 ?
+				String.fromCharCode( high + 0x10000 ) :
+				// Supplemental Plane codepoint (surrogate pair)
+				String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
+	};
+
+// Use a stripped-down slice if we can't use a native one
+try {
+	slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType;
+} catch ( e ) {
+	slice = function( i ) {
+		var elem,
+			results = [];
+		while ( (elem = this[i++]) ) {
+			results.push( elem );
+		}
+		return results;
+	};
+}
+
+/**
+ * For feature detection
+ * @param {Function} fn The function to test for native support
+ */
+function isNative( fn ) {
+	return rnative.test( fn + "" );
+}
+
+/**
+ * Create key-value caches of limited size
+ * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
+ *	property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
+ *	deleting the oldest entry
+ */
+function createCache() {
+	var cache,
+		keys = [];
+
+	return (cache = function( key, value ) {
+		// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
+		if ( keys.push( key += " " ) > Expr.cacheLength ) {
+			// Only keep the most recent entries
+			delete cache[ keys.shift() ];
+		}
+		return (cache[ key ] = value);
+	});
+}
+
+/**
+ * Mark a function for special use by Sizzle
+ * @param {Function} fn The function to mark
+ */
+function markFunction( fn ) {
+	fn[ expando ] = true;
+	return fn;
+}
+
+/**
+ * Support testing using an element
+ * @param {Function} fn Passed the created div and expects a boolean result
+ */
+function assert( fn ) {
+	var div = document.createElement("div");
+
+	try {
+		return fn( div );
+	} catch (e) {
+		return false;
+	} finally {
+		// release memory in IE
+		div = null;
+	}
+}
+
+function Sizzle( selector, context, results, seed ) {
+	var match, elem, m, nodeType,
+		// QSA vars
+		i, groups, old, nid, newContext, newSelector;
+
+	if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
+		setDocument( context );
+	}
+
+	context = context || document;
+	results = results || [];
+
+	if ( !selector || typeof selector !== "string" ) {
+		return results;
+	}
+
+	if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
+		return [];
+	}
+
+	if ( !documentIsXML && !seed ) {
+
+		// Shortcuts
+		if ( (match = rquickExpr.exec( selector )) ) {
+			// Speed-up: Sizzle("#ID")
+			if ( (m = match[1]) ) {
+				if ( nodeType === 9 ) {
+					elem = context.getElementById( m );
+					// Check parentNode to catch when Blackberry 4.6 returns
+					// nodes that are no longer in the document #6963
+					if ( elem && elem.parentNode ) {
+						// Handle the case where IE, Opera, and Webkit return items
+						// by name instead of ID
+						if ( elem.id === m ) {
+							results.push( elem );
+							return results;
+						}
+					} else {
+						return results;
+					}
+				} else {
+					// Context is not a document
+					if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
+						contains( context, elem ) && elem.id === m ) {
+						results.push( elem );
+						return results;
+					}
+				}
+
+			// Speed-up: Sizzle("TAG")
+			} else if ( match[2] ) {
+				push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
+				return results;
+
+			// Speed-up: Sizzle(".CLASS")
+			} else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) {
+				push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
+				return results;
+			}
+		}
+
+		// QSA path
+		if ( support.qsa && !rbuggyQSA.test(selector) ) {
+			old = true;
+			nid = expando;
+			newContext = context;
+			newSelector = nodeType === 9 && selector;
+
+			// qSA works strangely on Element-rooted queries
+			// We can work around this by specifying an extra ID on the root
+			// and working up from there (Thanks to Andrew Dupont for the technique)
+			// IE 8 doesn't work on object elements
+			if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
+				groups = tokenize( selector );
+
+				if ( (old = context.getAttribute("id")) ) {
+					nid = old.replace( rescape, "\\$&" );
+				} else {
+					context.setAttribute( "id", nid );
+				}
+				nid = "[id='" + nid + "'] ";
+
+				i = groups.length;
+				while ( i-- ) {
+					groups[i] = nid + toSelector( groups[i] );
+				}
+				newContext = rsibling.test( selector ) && context.parentNode || context;
+				newSelector = groups.join(",");
+			}
+
+			if ( newSelector ) {
+				try {
+					push.apply( results, slice.call( newContext.querySelectorAll(
+						newSelector
+					), 0 ) );
+					return results;
+				} catch(qsaError) {
+				} finally {
+					if ( !old ) {
+						context.removeAttribute("id");
+					}
+				}
+			}
+		}
+	}
+
+	// All others
+	return select( selector.replace( rtrim, "$1" ), context, results, seed );
+}
+
+/**
+ * Detect xml
+ * @param {Element|Object} elem An element or a document
+ */
+isXML = Sizzle.isXML = function( elem ) {
+	// documentElement is verified for cases where it doesn't yet exist
+	// (such as loading iframes in IE - #4833)
+	var documentElement = elem && (elem.ownerDocument || elem).documentElement;
+	return documentElement ? documentElement.nodeName !== "HTML" : false;
+};
+
+/**
+ * Sets document-related variables once based on the current document
+ * @param {Element|Object} [doc] An element or document object to use to set the document
+ * @returns {Object} Returns the current document
+ */
+setDocument = Sizzle.setDocument = function( node ) {
+	var doc = node ? node.ownerDocument || node : preferredDoc;
+
+	// If no document and documentElement is available, return
+	if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
+		return document;
+	}
+
+	// Set our document
+	document = doc;
+	docElem = doc.documentElement;
+
+	// Support tests
+	documentIsXML = isXML( doc );
+
+	// Check if getElementsByTagName("*") returns only elements
+	support.tagNameNoComments = assert(function( div ) {
+		div.appendChild( doc.createComment("") );
+		return !div.getElementsByTagName("*").length;
+	});
+
+	// Check if attributes should be retrieved by attribute nodes
+	support.attributes = assert(function( div ) {
+		div.innerHTML = "<select></select>";
+		var type = typeof div.lastChild.getAttribute("multiple");
+		// IE8 returns a string for some attributes even when not present
+		return type !== "boolean" && type !== "string";
+	});
+
+	// Check if getElementsByClassName can be trusted
+	support.getByClassName = assert(function( div ) {
+		// Opera can't find a second classname (in 9.6)
+		div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
+		if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
+			return false;
+		}
+
+		// Safari 3.2 caches class attributes and doesn't catch changes
+		div.lastChild.className = "e";
+		return div.getElementsByClassName("e").length === 2;
+	});
+
+	// Check if getElementById returns elements by name
+	// Check if getElementsByName privileges form controls or returns elements by ID
+	support.getByName = assert(function( div ) {
+		// Inject content
+		div.id = expando + 0;
+		div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
+		docElem.insertBefore( div, docElem.firstChild );
+
+		// Test
+		var pass = doc.getElementsByName &&
+			// buggy browsers will return fewer than the correct 2
+			doc.getElementsByName( expando ).length === 2 +
+			// buggy browsers will return more than the correct 0
+			doc.getElementsByName( expando + 0 ).length;
+		support.getIdNotName = !doc.getElementById( expando );
+
+		// Cleanup
+		docElem.removeChild( div );
+
+		return pass;
+	});
+
+	// IE6/7 return modified attributes
+	Expr.attrHandle = assert(function( div ) {
+		div.innerHTML = "<a href='#'></a>";
+		return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
+			div.firstChild.getAttribute("href") === "#";
+	}) ?
+		{} :
+		{
+			"href": function( elem ) {
+				return elem.getAttribute( "href", 2 );
+			},
+			"type": function( elem ) {
+				return elem.getAttribute("type");
+			}
+		};
+
+	// ID find and filter
+	if ( support.getIdNotName ) {
+		Expr.find["ID"] = function( id, context ) {
+			if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
+				var m = context.getElementById( id );
+				// Check parentNode to catch when Blackberry 4.6 returns
+				// nodes that are no longer in the document #6963
+				return m && m.parentNode ? [m] : [];
+			}
+		};
+		Expr.filter["ID"] = function( id ) {
+			var attrId = id.replace( runescape, funescape );
+			return function( elem ) {
+				return elem.getAttribute("id") === attrId;
+			};
+		};
+	} else {
+		Expr.find["ID"] = function( id, context ) {
+			if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
+				var m = context.getElementById( id );
+
+				return m ?
+					m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
+						[m] :
+						undefined :
+					[];
+			}
+		};
+		Expr.filter["ID"] =  function( id ) {
+			var attrId = id.replace( runescape, funescape );
+			return function( elem ) {
+				var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
+				return node && node.value === attrId;
+			};
+		};
+	}
+
+	// Tag
+	Expr.find["TAG"] = support.tagNameNoComments ?
+		function( tag, context ) {
+			if ( typeof context.getElementsByTagName !== strundefined ) {
+				return context.getElementsByTagName( tag );
+			}
+		} :
+		function( tag, context ) {
+			var elem,
+				tmp = [],
+				i = 0,
+				results = context.getElementsByTagName( tag );
+
+			// Filter out possible comments
+			if ( tag === "*" ) {
+				while ( (elem = results[i++]) ) {
+					if ( elem.nodeType === 1 ) {
+						tmp.push( elem );
+					}
+				}
+
+				return tmp;
+			}
+			return results;
+		};
+
+	// Name
+	Expr.find["NAME"] = support.getByName && function( tag, context ) {
+		if ( typeof context.getElementsByName !== strundefined ) {
+			return context.getElementsByName( name );
+		}
+	};
+
+	// Class
+	Expr.find["CLASS"] = support.getByClassName && function( className, context ) {
+		if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) {
+			return context.getElementsByClassName( className );
+		}
+	};
+
+	// QSA and matchesSelector support
+
+	// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
+	rbuggyMatches = [];
+
+	// qSa(:focus) reports false when true (Chrome 21),
+	// no need to also add to buggyMatches since matches checks buggyQSA
+	// A support test would require too much code (would include document ready)
+	rbuggyQSA = [ ":focus" ];
+
+	if ( (support.qsa = isNative(doc.querySelectorAll)) ) {
+		// Build QSA regex
+		// Regex strategy adopted from Diego Perini
+		assert(function( div ) {
+			// Select is set to empty string on purpose
+			// This is to test IE's treatment of not explictly
+			// setting a boolean content attribute,
+			// since its presence should be enough
+			// http://bugs.jquery.com/ticket/12359
+			div.innerHTML = "<select><option selected=''></option></select>";
+
+			// IE8 - Some boolean attributes are not treated correctly
+			if ( !div.querySelectorAll("[selected]").length ) {
+				rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
+			}
+
+			// Webkit/Opera - :checked should return selected option elements
+			// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+			// IE8 throws error here and will not see later tests
+			if ( !div.querySelectorAll(":checked").length ) {
+				rbuggyQSA.push(":checked");
+			}
+		});
+
+		assert(function( div ) {
+
+			// Opera 10-12/IE8 - ^= $= *= and empty values
+			// Should not select anything
+			div.innerHTML = "<input type='hidden' i=''/>";
+			if ( div.querySelectorAll("[i^='']").length ) {
+				rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
+			}
+
+			// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
+			// IE8 throws error here and will not see later tests
+			if ( !div.querySelectorAll(":enabled").length ) {
+				rbuggyQSA.push( ":enabled", ":disabled" );
+			}
+
+			// Opera 10-11 does not throw on post-comma invalid pseudos
+			div.querySelectorAll("*,:x");
+			rbuggyQSA.push(",.*:");
+		});
+	}
+
+	if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector ||
+		docElem.mozMatchesSelector ||
+		docElem.webkitMatchesSelector ||
+		docElem.oMatchesSelector ||
+		docElem.msMatchesSelector) )) ) {
+
+		assert(function( div ) {
+			// Check to see if it's possible to do matchesSelector
+			// on a disconnected node (IE 9)
+			support.disconnectedMatch = matches.call( div, "div" );
+
+			// This should fail with an exception
+			// Gecko does not error, returns false instead
+			matches.call( div, "[s!='']:x" );
+			rbuggyMatches.push( "!=", pseudos );
+		});
+	}
+
+	rbuggyQSA = new RegExp( rbuggyQSA.join("|") );
+	rbuggyMatches = new RegExp( rbuggyMatches.join("|") );
+
+	// Element contains another
+	// Purposefully does not implement inclusive descendent
+	// As in, an element does not contain itself
+	contains = isNative(docElem.contains) || docElem.compareDocumentPosition ?
+		function( a, b ) {
+			var adown = a.nodeType === 9 ? a.documentElement : a,
+				bup = b && b.parentNode;
+			return a === bup || !!( bup && bup.nodeType === 1 && (
+				adown.contains ?
+					adown.contains( bup ) :
+					a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
+			));
+		} :
+		function( a, b ) {
+			if ( b ) {
+				while ( (b = b.parentNode) ) {
+					if ( b === a ) {
+						return true;
+					}
+				}
+			}
+			return false;
+		};
+
+	// Document order sorting
+	sortOrder = docElem.compareDocumentPosition ?
+	function( a, b ) {
+		var compare;
+
+		if ( a === b ) {
+			hasDuplicate = true;
+			return 0;
+		}
+
+		if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) {
+			if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) {
+				if ( a === doc || contains( preferredDoc, a ) ) {
+					return -1;
+				}
+				if ( b === doc || contains( preferredDoc, b ) ) {
+					return 1;
+				}
+				return 0;
+			}
+			return compare & 4 ? -1 : 1;
+		}
+
+		return a.compareDocumentPosition ? -1 : 1;
+	} :
+	function( a, b ) {
+		var cur,
+			i = 0,
+			aup = a.parentNode,
+			bup = b.parentNode,
+			ap = [ a ],
+			bp = [ b ];
+
+		// Exit early if the nodes are identical
+		if ( a === b ) {
+			hasDuplicate = true;
+			return 0;
+
+		// Parentless nodes are either documents or disconnected
+		} else if ( !aup || !bup ) {
+			return a === doc ? -1 :
+				b === doc ? 1 :
+				aup ? -1 :
+				bup ? 1 :
+				0;
+
+		// If the nodes are siblings, we can do a quick check
+		} else if ( aup === bup ) {
+			return siblingCheck( a, b );
+		}
+
+		// Otherwise we need full lists of their ancestors for comparison
+		cur = a;
+		while ( (cur = cur.parentNode) ) {
+			ap.unshift( cur );
+		}
+		cur = b;
+		while ( (cur = cur.parentNode) ) {
+			bp.unshift( cur );
+		}
+
+		// Walk down the tree looking for a discrepancy
+		while ( ap[i] === bp[i] ) {
+			i++;
+		}
+
+		return i ?
+			// Do a sibling check if the nodes have a common ancestor
+			siblingCheck( ap[i], bp[i] ) :
+
+			// Otherwise nodes in our document sort first
+			ap[i] === preferredDoc ? -1 :
+			bp[i] === preferredDoc ? 1 :
+			0;
+	};
+
+	// Always assume the presence of duplicates if sort doesn't
+	// pass them to our comparison function (as in Google Chrome).
+	hasDuplicate = false;
+	[0, 0].sort( sortOrder );
+	support.detectDuplicates = hasDuplicate;
+
+	return document;
+};
+
+Sizzle.matches = function( expr, elements ) {
+	return Sizzle( expr, null, null, elements );
+};
+
+Sizzle.matchesSelector = function( elem, expr ) {
+	// Set document vars if needed
+	if ( ( elem.ownerDocument || elem ) !== document ) {
+		setDocument( elem );
+	}
+
+	// Make sure that attribute selectors are quoted
+	expr = expr.replace( rattributeQuotes, "='$1']" );
+
+	// rbuggyQSA always contains :focus, so no need for an existence check
+	if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) {
+		try {
+			var ret = matches.call( elem, expr );
+
+			// IE 9's matchesSelector returns false on disconnected nodes
+			if ( ret || support.disconnectedMatch ||
+					// As well, disconnected nodes are said to be in a document
+					// fragment in IE 9
+					elem.document && elem.document.nodeType !== 11 ) {
+				return ret;
+			}
+		} catch(e) {}
+	}
+
+	return Sizzle( expr, document, null, [elem] ).length > 0;
+};
+
+Sizzle.contains = function( context, elem ) {
+	// Set document vars if needed
+	if ( ( context.ownerDocument || context ) !== document ) {
+		setDocument( context );
+	}
+	return contains( context, elem );
+};
+
+Sizzle.attr = function( elem, name ) {
+	var val;
+
+	// Set document vars if needed
+	if ( ( elem.ownerDocument || elem ) !== document ) {
+		setDocument( elem );
+	}
+
+	if ( !documentIsXML ) {
+		name = name.toLowerCase();
+	}
+	if ( (val = Expr.attrHandle[ name ]) ) {
+		return val( elem );
+	}
+	if ( documentIsXML || support.attributes ) {
+		return elem.getAttribute( name );
+	}
+	return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ?
+		name :
+		val && val.specified ? val.value : null;
+};
+
+Sizzle.error = function( msg ) {
+	throw new Error( "Syntax error, unrecognized expression: " + msg );
+};
+
+// Document sorting and removing duplicates
+Sizzle.uniqueSort = function( results ) {
+	var elem,
+		duplicates = [],
+		i = 1,
+		j = 0;
+
+	// Unless we *know* we can detect duplicates, assume their presence
+	hasDuplicate = !support.detectDuplicates;
+	results.sort( sortOrder );
+
+	if ( hasDuplicate ) {
+		for ( ; (elem = results[i]); i++ ) {
+			if ( elem === results[ i - 1 ] ) {
+				j = duplicates.push( i );
+			}
+		}
+		while ( j-- ) {
+			results.splice( duplicates[ j ], 1 );
+		}
+	}
+
+	return results;
+};
+
+function siblingCheck( a, b ) {
+	var cur = b && a,
+		diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE );
+
+	// Use IE sourceIndex if available on both nodes
+	if ( diff ) {
+		return diff;
+	}
+
+	// Check if b follows a
+	if ( cur ) {
+		while ( (cur = cur.nextSibling) ) {
+			if ( cur === b ) {
+				return -1;
+			}
+		}
+	}
+
+	return a ? 1 : -1;
+}
+
+// Returns a function to use in pseudos for input types
+function createInputPseudo( type ) {
+	return function( elem ) {
+		var name = elem.nodeName.toLowerCase();
+		return name === "input" && elem.type === type;
+	};
+}
+
+// Returns a function to use in pseudos for buttons
+function createButtonPseudo( type ) {
+	return function( elem ) {
+		var name = elem.nodeName.toLowerCase();
+		return (name === "input" || name === "button") && elem.type === type;
+	};
+}
+
+// Returns a function to use in pseudos for positionals
+function createPositionalPseudo( fn ) {
+	return markFunction(function( argument ) {
+		argument = +argument;
+		return markFunction(function( seed, matches ) {
+			var j,
+				matchIndexes = fn( [], seed.length, argument ),
+				i = matchIndexes.length;
+
+			// Match elements found at the specified indexes
+			while ( i-- ) {
+				if ( seed[ (j = matchIndexes[i]) ] ) {
+					seed[j] = !(matches[j] = seed[j]);
+				}
+			}
+		});
+	});
+}
+
+/**
+ * Utility function for retrieving the text value of an array of DOM nodes
+ * @param {Array|Element} elem
+ */
+getText = Sizzle.getText = function( elem ) {
+	var node,
+		ret = "",
+		i = 0,
+		nodeType = elem.nodeType;
+
+	if ( !nodeType ) {
+		// If no nodeType, this is expected to be an array
+		for ( ; (node = elem[i]); i++ ) {
+			// Do not traverse comment nodes
+			ret += getText( node );
+		}
+	} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
+		// Use textContent for elements
+		// innerText usage removed for consistency of new lines (see #11153)
+		if ( typeof elem.textContent === "string" ) {
+			return elem.textContent;
+		} else {
+			// Traverse its children
+			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
+				ret += getText( elem );
+			}
+		}
+	} else if ( nodeType === 3 || nodeType === 4 ) {
+		return elem.nodeValue;
+	}
+	// Do not include comment or processing instruction nodes
+
+	return ret;
+};
+
+Expr = Sizzle.selectors = {
+
+	// Can be adjusted by the user
+	cacheLength: 50,
+
+	createPseudo: markFunction,
+
+	match: matchExpr,
+
+	find: {},
+
+	relative: {
+		">": { dir: "parentNode", first: true },
+		" ": { dir: "parentNode" },
+		"+": { dir: "previousSibling", first: true },
+		"~": { dir: "previousSibling" }
+	},
+
+	preFilter: {
+		"ATTR": function( match ) {
+			match[1] = match[1].replace( runescape, funescape );
+
+			// Move the given value to match[3] whether quoted or unquoted
+			match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
+
+			if ( match[2] === "~=" ) {
+				match[3] = " " + match[3] + " ";
+			}
+
+			return match.slice( 0, 4 );
+		},
+
+		"CHILD": function( match ) {
+			/* matches from matchExpr["CHILD"]
+				1 type (only|nth|...)
+				2 what (child|of-type)
+				3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
+				4 xn-component of xn+y argument ([+-]?\d*n|)
+				5 sign of xn-component
+				6 x of xn-component
+				7 sign of y-component
+				8 y of y-component
+			*/
+			match[1] = match[1].toLowerCase();
+
+			if ( match[1].slice( 0, 3 ) === "nth" ) {
+				// nth-* requires argument
+				if ( !match[3] ) {
+					Sizzle.error( match[0] );
+				}
+
+				// numeric x and y parameters for Expr.filter.CHILD
+				// remember that false/true cast respectively to 0/1
+				match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
+				match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
+
+			// other types prohibit arguments
+			} else if ( match[3] ) {
+				Sizzle.error( match[0] );
+			}
+
+			return match;
+		},
+
+		"PSEUDO": function( match ) {
+			var excess,
+				unquoted = !match[5] && match[2];
+
+			if ( matchExpr["CHILD"].test( match[0] ) ) {
+				return null;
+			}
+
+			// Accept quoted arguments as-is
+			if ( match[4] ) {
+				match[2] = match[4];
+
+			// Strip excess characters from unquoted arguments
+			} else if ( unquoted && rpseudo.test( unquoted ) &&
+				// Get excess from tokenize (recursively)
+				(excess = tokenize( unquoted, true )) &&
+				// advance to the next closing parenthesis
+				(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
+
+				// excess is a negative index
+				match[0] = match[0].slice( 0, excess );
+				match[2] = unquoted.slice( 0, excess );
+			}
+
+			// Return only captures needed by the pseudo filter method (type and argument)
+			return match.slice( 0, 3 );
+		}
+	},
+
+	filter: {
+
+		"TAG": function( nodeName ) {
+			if ( nodeName === "*" ) {
+				return function() { return true; };
+			}
+
+			nodeName = nodeName.replace( runescape, funescape ).toLowerCase();
+			return function( elem ) {
+				return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
+			};
+		},
+
+		"CLASS": function( className ) {
+			var pattern = classCache[ className + " " ];
+
+			return pattern ||
+				(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
+				classCache( className, function( elem ) {
+					return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
+				});
+		},
+
+		"ATTR": function( name, operator, check ) {
+			return function( elem ) {
+				var result = Sizzle.attr( elem, name );
+
+				if ( result == null ) {
+					return operator === "!=";
+				}
+				if ( !operator ) {
+					return true;
+				}
+
+				result += "";
+
+				return operator === "=" ? result === check :
+					operator === "!=" ? result !== check :
+					operator === "^=" ? check && result.indexOf( check ) === 0 :
+					operator === "*=" ? check && result.indexOf( check ) > -1 :
+					operator === "$=" ? check && result.slice( -check.length ) === check :
+					operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
+					operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
+					false;
+			};
+		},
+
+		"CHILD": function( type, what, argument, first, last ) {
+			var simple = type.slice( 0, 3 ) !== "nth",
+				forward = type.slice( -4 ) !== "last",
+				ofType = what === "of-type";
+
+			return first === 1 && last === 0 ?
+
+				// Shortcut for :nth-*(n)
+				function( elem ) {
+					return !!elem.parentNode;
+				} :
+
+				function( elem, context, xml ) {
+					var cache, outerCache, node, diff, nodeIndex, start,
+						dir = simple !== forward ? "nextSibling" : "previousSibling",
+						parent = elem.parentNode,
+						name = ofType && elem.nodeName.toLowerCase(),
+						useCache = !xml && !ofType;
+
+					if ( parent ) {
+
+						// :(first|last|only)-(child|of-type)
+						if ( simple ) {
+							while ( dir ) {
+								node = elem;
+								while ( (node = node[ dir ]) ) {
+									if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
+										return false;
+									}
+								}
+								// Reverse direction for :only-* (if we haven't yet done so)
+								start = dir = type === "only" && !start && "nextSibling";
+							}
+							return true;
+						}
+
+						start = [ forward ? parent.firstChild : parent.lastChild ];
+
+						// non-xml :nth-child(...) stores cache data on `parent`
+						if ( forward && useCache ) {
+							// Seek `elem` from a previously-cached index
+							outerCache = parent[ expando ] || (parent[ expando ] = {});
+							cache = outerCache[ type ] || [];
+							nodeIndex = cache[0] === dirruns && cache[1];
+							diff = cache[0] === dirruns && cache[2];
+							node = nodeIndex && parent.childNodes[ nodeIndex ];
+
+							while ( (node = ++nodeIndex && node && node[ dir ] ||
+
+								// Fallback to seeking `elem` from the start
+								(diff = nodeIndex = 0) || start.pop()) ) {
+
+								// When found, cache indexes on `parent` and break
+								if ( node.nodeType === 1 && ++diff && node === elem ) {
+									outerCache[ type ] = [ dirruns, nodeIndex, diff ];
+									break;
+								}
+							}
+
+						// Use previously-cached element index if available
+						} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
+							diff = cache[1];
+
+						// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
+						} else {
+							// Use the same loop as above to seek `elem` from the start
+							while ( (node = ++nodeIndex && node && node[ dir ] ||
+								(diff = nodeIndex = 0) || start.pop()) ) {
+
+								if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
+									// Cache the index of each encountered element
+									if ( useCache ) {
+										(node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
+									}
+
+									if ( node === elem ) {
+										break;
+									}
+								}
+							}
+						}
+
+						// Incorporate the offset, then check against cycle size
+						diff -= last;
+						return diff === first || ( diff % first === 0 && diff / first >= 0 );
+					}
+				};
+		},
+
+		"PSEUDO": function( pseudo, argument ) {
+			// pseudo-class names are case-insensitive
+			// http://www.w3.org/TR/selectors/#pseudo-classes
+			// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
+			// Remember that setFilters inherits from pseudos
+			var args,
+				fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
+					Sizzle.error( "unsupported pseudo: " + pseudo );
+
+			// The user may use createPseudo to indicate that
+			// arguments are needed to create the filter function
+			// just as Sizzle does
+			if ( fn[ expando ] ) {
+				return fn( argument );
+			}
+
+			// But maintain support for old signatures
+			if ( fn.length > 1 ) {
+				args = [ pseudo, pseudo, "", argument ];
+				return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
+					markFunction(function( seed, matches ) {
+						var idx,
+							matched = fn( seed, argument ),
+							i = matched.length;
+						while ( i-- ) {
+							idx = indexOf.call( seed, matched[i] );
+							seed[ idx ] = !( matches[ idx ] = matched[i] );
+						}
+					}) :
+					function( elem ) {
+						return fn( elem, 0, args );
+					};
+			}
+
+			return fn;
+		}
+	},
+
+	pseudos: {
+		// Potentially complex pseudos
+		"not": markFunction(function( selector ) {
+			// Trim the selector passed to compile
+			// to avoid treating leading and trailing
+			// spaces as combinators
+			var input = [],
+				results = [],
+				matcher = compile( selector.replace( rtrim, "$1" ) );
+
+			return matcher[ expando ] ?
+				markFunction(function( seed, matches, context, xml ) {
+					var elem,
+						unmatched = matcher( seed, null, xml, [] ),
+						i = seed.length;
+
+					// Match elements unmatched by `matcher`
+					while ( i-- ) {
+						if ( (elem = unmatched[i]) ) {
+							seed[i] = !(matches[i] = elem);
+						}
+					}
+				}) :
+				function( elem, context, xml ) {
+					input[0] = elem;
+					matcher( input, null, xml, results );
+					return !results.pop();
+				};
+		}),
+
+		"has": markFunction(function( selector ) {
+			return function( elem ) {
+				return Sizzle( selector, elem ).length > 0;
+			};
+		}),
+
+		"contains": markFunction(function( text ) {
+			return function( elem ) {
+				return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
+			};
+		}),
+
+		// "Whether an element is represented by a :lang() selector
+		// is based solely on the element's language value
+		// being equal to the identifier C,
+		// or beginning with the identifier C immediately followed by "-".
+		// The matching of C against the element's language value is performed case-insensitively.
+		// The identifier C does not have to be a valid language name."
+		// http://www.w3.org/TR/selectors/#lang-pseudo
+		"lang": markFunction( function( lang ) {
+			// lang value must be a valid identifider
+			if ( !ridentifier.test(lang || "") ) {
+				Sizzle.error( "unsupported lang: " + lang );
+			}
+			lang = lang.replace( runescape, funescape ).toLowerCase();
+			return function( elem ) {
+				var elemLang;
+				do {
+					if ( (elemLang = documentIsXML ?
+						elem.getAttribute("xml:lang") || elem.getAttribute("lang") :
+						elem.lang) ) {
+
+						elemLang = elemLang.toLowerCase();
+						return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
+					}
+				} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
+				return false;
+			};
+		}),
+
+		// Miscellaneous
+		"target": function( elem ) {
+			var hash = window.location && window.location.hash;
+			return hash && hash.slice( 1 ) === elem.id;
+		},
+
+		"root": function( elem ) {
+			return elem === docElem;
+		},
+
+		"focus": function( elem ) {
+			return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
+		},
+
+		// Boolean properties
+		"enabled": function( elem ) {
+			return elem.disabled === false;
+		},
+
+		"disabled": function( elem ) {
+			return elem.disabled === true;
+		},
+
+		"checked": function( elem ) {
+			// In CSS3, :checked should return both checked and selected elements
+			// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+			var nodeName = elem.nodeName.toLowerCase();
+			return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
+		},
+
+		"selected": function( elem ) {
+			// Accessing this property makes selected-by-default
+			// options in Safari work properly
+			if ( elem.parentNode ) {
+				elem.parentNode.selectedIndex;
+			}
+
+			return elem.selected === true;
+		},
+
+		// Contents
+		"empty": function( elem ) {
+			// http://www.w3.org/TR/selectors/#empty-pseudo
+			// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
+			//   not comment, processing instructions, or others
+			// Thanks to Diego Perini for the nodeName shortcut
+			//   Greater than "@" means alpha characters (specifically not starting with "#" or "?")
+			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
+				if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
+					return false;
+				}
+			}
+			return true;
+		},
+
+		"parent": function( elem ) {
+			return !Expr.pseudos["empty"]( elem );
+		},
+
+		// Element/input types
+		"header": function( elem ) {
+			return rheader.test( elem.nodeName );
+		},
+
+		"input": function( elem ) {
+			return rinputs.test( elem.nodeName );
+		},
+
+		"button": function( elem ) {
+			var name = elem.nodeName.toLowerCase();
+			return name === "input" && elem.type === "button" || name === "button";
+		},
+
+		"text": function( elem ) {
+			var attr;
+			// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
+			// use getAttribute instead to test this case
+			return elem.nodeName.toLowerCase() === "input" &&
+				elem.type === "text" &&
+				( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
+		},
+
+		// Position-in-collection
+		"first": createPositionalPseudo(function() {
+			return [ 0 ];
+		}),
+
+		"last": createPositionalPseudo(function( matchIndexes, length ) {
+			return [ length - 1 ];
+		}),
+
+		"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
+			return [ argument < 0 ? argument + length : argument ];
+		}),
+
+		"even": createPositionalPseudo(function( matchIndexes, length ) {
+			var i = 0;
+			for ( ; i < length; i += 2 ) {
+				matchIndexes.push( i );
+			}
+			return matchIndexes;
+		}),
+
+		"odd": createPositionalPseudo(function( matchIndexes, length ) {
+			var i = 1;
+			for ( ; i < length; i += 2 ) {
+				matchIndexes.push( i );
+			}
+			return matchIndexes;
+		}),
+
+		"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+			var i = argument < 0 ? argument + length : argument;
+			for ( ; --i >= 0; ) {
+				matchIndexes.push( i );
+			}
+			return matchIndexes;
+		}),
+
+		"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+			var i = argument < 0 ? argument + length : argument;
+			for ( ; ++i < length; ) {
+				matchIndexes.push( i );
+			}
+			return matchIndexes;
+		})
+	}
+};
+
+// Add button/input type pseudos
+for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
+	Expr.pseudos[ i ] = createInputPseudo( i );
+}
+for ( i in { submit: true, reset: true } ) {
+	Expr.pseudos[ i ] = createButtonPseudo( i );
+}
+
+function tokenize( selector, parseOnly ) {
+	var matched, match, tokens, type,
+		soFar, groups, preFilters,
+		cached = tokenCache[ selector + " " ];
+
+	if ( cached ) {
+		return parseOnly ? 0 : cached.slice( 0 );
+	}
+
+	soFar = selector;
+	groups = [];
+	preFilters = Expr.preFilter;
+
+	while ( soFar ) {
+
+		// Comma and first run
+		if ( !matched || (match = rcomma.exec( soFar )) ) {
+			if ( match ) {
+				// Don't consume trailing commas as valid
+				soFar = soFar.slice( match[0].length ) || soFar;
+			}
+			groups.push( tokens = [] );
+		}
+
+		matched = false;
+
+		// Combinators
+		if ( (match = rcombinators.exec( soFar )) ) {
+			matched = match.shift();
+			tokens.push( {
+				value: matched,
+				// Cast descendant combinators to space
+				type: match[0].replace( rtrim, " " )
+			} );
+			soFar = soFar.slice( matched.length );
+		}
+
+		// Filters
+		for ( type in Expr.filter ) {
+			if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
+				(match = preFilters[ type ]( match ))) ) {
+				matched = match.shift();
+				tokens.push( {
+					value: matched,
+					type: type,
+					matches: match
+				} );
+				soFar = soFar.slice( matched.length );
+			}
+		}
+
+		if ( !matched ) {
+			break;
+		}
+	}
+
+	// Return the length of the invalid excess
+	// if we're just parsing
+	// Otherwise, throw an error or return tokens
+	return parseOnly ?
+		soFar.length :
+		soFar ?
+			Sizzle.error( selector ) :
+			// Cache the tokens
+			tokenCache( selector, groups ).slice( 0 );
+}
+
+function toSelector( tokens ) {
+	var i = 0,
+		len = tokens.length,
+		selector = "";
+	for ( ; i < len; i++ ) {
+		selector += tokens[i].value;
+	}
+	return selector;
+}
+
+function addCombinator( matcher, combinator, base ) {
+	var dir = combinator.dir,
+		checkNonElements = base && dir === "parentNode",
+		doneName = done++;
+
+	return combinator.first ?
+		// Check against closest ancestor/preceding element
+		function( elem, context, xml ) {
+			while ( (elem = elem[ dir ]) ) {
+				if ( elem.nodeType === 1 || checkNonElements ) {
+					return matcher( elem, context, xml );
+				}
+			}
+		} :
+
+		// Check against all ancestor/preceding elements
+		function( elem, context, xml ) {
+			var data, cache, outerCache,
+				dirkey = dirruns + " " + doneName;
+
+			// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
+			if ( xml ) {
+				while ( (elem = elem[ dir ]) ) {
+					if ( elem.nodeType === 1 || checkNonElements ) {
+						if ( matcher( elem, context, xml ) ) {
+							return true;
+						}
+					}
+				}
+			} else {
+				while ( (elem = elem[ dir ]) ) {
+					if ( elem.nodeType === 1 || checkNonElements ) {
+						outerCache = elem[ expando ] || (elem[ expando ] = {});
+						if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
+							if ( (data = cache[1]) === true || data === cachedruns ) {
+								return data === true;
+							}
+						} else {
+							cache = outerCache[ dir ] = [ dirkey ];
+							cache[1] = matcher( elem, context, xml ) || cachedruns;
+							if ( cache[1] === true ) {
+								return true;
+							}
+						}
+					}
+				}
+			}
+		};
+}
+
+function elementMatcher( matchers ) {
+	return matchers.length > 1 ?
+		function( elem, context, xml ) {
+			var i = matchers.length;
+			while ( i-- ) {
+				if ( !matchers[i]( elem, context, xml ) ) {
+					return false;
+				}
+			}
+			return true;
+		} :
+		matchers[0];
+}
+
+function condense( unmatched, map, filter, context, xml ) {
+	var elem,
+		newUnmatched = [],
+		i = 0,
+		len = unmatched.length,
+		mapped = map != null;
+
+	for ( ; i < len; i++ ) {
+		if ( (elem = unmatched[i]) ) {
+			if ( !filter || filter( elem, context, xml ) ) {
+				newUnmatched.push( elem );
+				if ( mapped ) {
+					map.push( i );
+				}
+			}
+		}
+	}
+
+	return newUnmatched;
+}
+
+function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
+	if ( postFilter && !postFilter[ expando ] ) {
+		postFilter = setMatcher( postFilter );
+	}
+	if ( postFinder && !postFinder[ expando ] ) {
+		postFinder = setMatcher( postFinder, postSelector );
+	}
+	return markFunction(function( seed, results, context, xml ) {
+		var temp, i, elem,
+			preMap = [],
+			postMap = [],
+			preexisting = results.length,
+
+			// Get initial elements from seed or context
+			elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
+
+			// Prefilter to get matcher input, preserving a map for seed-results synchronization
+			matcherIn = preFilter && ( seed || !selector ) ?
+				condense( elems, preMap, preFilter, context, xml ) :
+				elems,
+
+			matcherOut = matcher ?
+				// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
+				postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
+
+					// ...intermediate processing is necessary
+					[] :
+
+					// ...otherwise use results directly
+					results :
+				matcherIn;
+
+		// Find primary matches
+		if ( matcher ) {
+			matcher( matcherIn, matcherOut, context, xml );
+		}
+
+		// Apply postFilter
+		if ( postFilter ) {
+			temp = condense( matcherOut, postMap );
+			postFilter( temp, [], context, xml );
+
+			// Un-match failing elements by moving them back to matcherIn
+			i = temp.length;
+			while ( i-- ) {
+				if ( (elem = temp[i]) ) {
+					matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
+				}
+			}
+		}
+
+		if ( seed ) {
+			if ( postFinder || preFilter ) {
+				if ( postFinder ) {
+					// Get the final matcherOut by condensing this intermediate into postFinder contexts
+					temp = [];
+					i = matcherOut.length;
+					while ( i-- ) {
+						if ( (elem = matcherOut[i]) ) {
+							// Restore matcherIn since elem is not yet a final match
+							temp.push( (matcherIn[i] = elem) );
+						}
+					}
+					postFinder( null, (matcherOut = []), temp, xml );
+				}
+
+				// Move matched elements from seed to results to keep them synchronized
+				i = matcherOut.length;
+				while ( i-- ) {
+					if ( (elem = matcherOut[i]) &&
+						(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
+
+						seed[temp] = !(results[temp] = elem);
+					}
+				}
+			}
+
+		// Add elements to results, through postFinder if defined
+		} else {
+			matcherOut = condense(
+				matcherOut === results ?
+					matcherOut.splice( preexisting, matcherOut.length ) :
+					matcherOut
+			);
+			if ( postFinder ) {
+				postFinder( null, results, matcherOut, xml );
+			} else {
+				push.apply( results, matcherOut );
+			}
+		}
+	});
+}
+
+function matcherFromTokens( tokens ) {
+	var checkContext, matcher, j,
+		len = tokens.length,
+		leadingRelative = Expr.relative[ tokens[0].type ],
+		implicitRelative = leadingRelative || Expr.relative[" "],
+		i = leadingRelative ? 1 : 0,
+
+		// The foundational matcher ensures that elements are reachable from top-level context(s)
+		matchContext = addCombinator( function( elem ) {
+			return elem === checkContext;
+		}, implicitRelative, true ),
+		matchAnyContext = addCombinator( function( elem ) {
+			return indexOf.call( checkContext, elem ) > -1;
+		}, implicitRelative, true ),
+		matchers = [ function( elem, context, xml ) {
+			return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
+				(checkContext = context).nodeType ?
+					matchContext( elem, context, xml ) :
+					matchAnyContext( elem, context, xml ) );
+		} ];
+
+	for ( ; i < len; i++ ) {
+		if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
+			matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
+		} else {
+			matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
+
+			// Return special upon seeing a positional matcher
+			if ( matcher[ expando ] ) {
+				// Find the next relative operator (if any) for proper handling
+				j = ++i;
+				for ( ; j < len; j++ ) {
+					if ( Expr.relative[ tokens[j].type ] ) {
+						break;
+					}
+				}
+				return setMatcher(
+					i > 1 && elementMatcher( matchers ),
+					i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ),
+					matcher,
+					i < j && matcherFromTokens( tokens.slice( i, j ) ),
+					j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
+					j < len && toSelector( tokens )
+				);
+			}
+			matchers.push( matcher );
+		}
+	}
+
+	return elementMatcher( matchers );
+}
+
+function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
+	// A counter to specify which element is currently being matched
+	var matcherCachedRuns = 0,
+		bySet = setMatchers.length > 0,
+		byElement = elementMatchers.length > 0,
+		superMatcher = function( seed, context, xml, results, expandContext ) {
+			var elem, j, matcher,
+				setMatched = [],
+				matchedCount = 0,
+				i = "0",
+				unmatched = seed && [],
+				outermost = expandContext != null,
+				contextBackup = outermostContext,
+				// We must always have either seed elements or context
+				elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
+				// Use integer dirruns iff this is the outermost matcher
+				dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
+
+			if ( outermost ) {
+				outermostContext = context !== document && context;
+				cachedruns = matcherCachedRuns;
+			}
+
+			// Add elements passing elementMatchers directly to results
+			// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
+			for ( ; (elem = elems[i]) != null; i++ ) {
+				if ( byElement && elem ) {
+					j = 0;
+					while ( (matcher = elementMatchers[j++]) ) {
+						if ( matcher( elem, context, xml ) ) {
+							results.push( elem );
+							break;
+						}
+					}
+					if ( outermost ) {
+						dirruns = dirrunsUnique;
+						cachedruns = ++matcherCachedRuns;
+					}
+				}
+
+				// Track unmatched elements for set filters
+				if ( bySet ) {
+					// They will have gone through all possible matchers
+					if ( (elem = !matcher && elem) ) {
+						matchedCount--;
+					}
+
+					// Lengthen the array for every element, matched or not
+					if ( seed ) {
+						unmatched.push( elem );
+					}
+				}
+			}
+
+			// Apply set filters to unmatched elements
+			matchedCount += i;
+			if ( bySet && i !== matchedCount ) {
+				j = 0;
+				while ( (matcher = setMatchers[j++]) ) {
+					matcher( unmatched, setMatched, context, xml );
+				}
+
+				if ( seed ) {
+					// Reintegrate element matches to eliminate the need for sorting
+					if ( matchedCount > 0 ) {
+						while ( i-- ) {
+							if ( !(unmatched[i] || setMatched[i]) ) {
+								setMatched[i] = pop.call( results );
+							}
+						}
+					}
+
+					// Discard index placeholder values to get only actual matches
+					setMatched = condense( setMatched );
+				}
+
+				// Add matches to results
+				push.apply( results, setMatched );
+
+				// Seedless set matches succeeding multiple successful matchers stipulate sorting
+				if ( outermost && !seed && setMatched.length > 0 &&
+					( matchedCount + setMatchers.length ) > 1 ) {
+
+					Sizzle.uniqueSort( results );
+				}
+			}
+
+			// Override manipulation of globals by nested matchers
+			if ( outermost ) {
+				dirruns = dirrunsUnique;
+				outermostContext = contextBackup;
+			}
+
+			return unmatched;
+		};
+
+	return bySet ?
+		markFunction( superMatcher ) :
+		superMatcher;
+}
+
+compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
+	var i,
+		setMatchers = [],
+		elementMatchers = [],
+		cached = compilerCache[ selector + " " ];
+
+	if ( !cached ) {
+		// Generate a function of recursive functions that can be used to check each element
+		if ( !group ) {
+			group = tokenize( selector );
+		}
+		i = group.length;
+		while ( i-- ) {
+			cached = matcherFromTokens( group[i] );
+			if ( cached[ expando ] ) {
+				setMatchers.push( cached );
+			} else {
+				elementMatchers.push( cached );
+			}
+		}
+
+		// Cache the compiled function
+		cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
+	}
+	return cached;
+};
+
+function multipleContexts( selector, contexts, results ) {
+	var i = 0,
+		len = contexts.length;
+	for ( ; i < len; i++ ) {
+		Sizzle( selector, contexts[i], results );
+	}
+	return results;
+}
+
+function select( selector, context, results, seed ) {
+	var i, tokens, token, type, find,
+		match = tokenize( selector );
+
+	if ( !seed ) {
+		// Try to minimize operations if there is only one group
+		if ( match.length === 1 ) {
+
+			// Take a shortcut and set the context if the root selector is an ID
+			tokens = match[0] = match[0].slice( 0 );
+			if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
+					context.nodeType === 9 && !documentIsXML &&
+					Expr.relative[ tokens[1].type ] ) {
+
+				context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0];
+				if ( !context ) {
+					return results;
+				}
+
+				selector = selector.slice( tokens.shift().value.length );
+			}
+
+			// Fetch a seed set for right-to-left matching
+			i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
+			while ( i-- ) {
+				token = tokens[i];
+
+				// Abort if we hit a combinator
+				if ( Expr.relative[ (type = token.type) ] ) {
+					break;
+				}
+				if ( (find = Expr.find[ type ]) ) {
+					// Search, expanding context for leading sibling combinators
+					if ( (seed = find(
+						token.matches[0].replace( runescape, funescape ),
+						rsibling.test( tokens[0].type ) && context.parentNode || context
+					)) ) {
+
+						// If seed is empty or no tokens remain, we can return early
+						tokens.splice( i, 1 );
+						selector = seed.length && toSelector( tokens );
+						if ( !selector ) {
+							push.apply( results, slice.call( seed, 0 ) );
+							return results;
+						}
+
+						break;
+					}
+				}
+			}
+		}
+	}
+
+	// Compile and execute a filtering function
+	// Provide `match` to avoid retokenization if we modified the selector above
+	compile( selector, match )(
+		seed,
+		context,
+		documentIsXML,
+		results,
+		rsibling.test( selector )
+	);
+	return results;
+}
+
+// Deprecated
+Expr.pseudos["nth"] = Expr.pseudos["eq"];
+
+// Easy API for creating new setFilters
+function setFilters() {}
+Expr.filters = setFilters.prototype = Expr.pseudos;
+Expr.setFilters = new setFilters();
+
+// Initialize with the default document
+setDocument();
+
+// Override sizzle attribute retrieval
+Sizzle.attr = jQuery.attr;
+jQuery.find = Sizzle;
+jQuery.expr = Sizzle.selectors;
+jQuery.expr[":"] = jQuery.expr.pseudos;
+jQuery.unique = Sizzle.uniqueSort;
+jQuery.text = Sizzle.getText;
+jQuery.isXMLDoc = Sizzle.isXML;
+jQuery.contains = Sizzle.contains;
+
+
+})( window );
+var runtil = /Until$/,
+	rparentsprev = /^(?:parents|prev(?:Until|All))/,
+	isSimple = /^.[^:#\[\.,]*$/,
+	rneedsContext = jQuery.expr.match.needsContext,
+	// methods guaranteed to produce a unique set when starting from a unique set
+	guaranteedUnique = {
+		children: true,
+		contents: true,
+		next: true,
+		prev: true
+	};
+
+jQuery.fn.extend({
+	find: function( selector ) {
+		var i, ret, self,
+			len = this.length;
+
+		if ( typeof selector !== "string" ) {
+			self = this;
+			return this.pushStack( jQuery( selector ).filter(function() {
+				for ( i = 0; i < len; i++ ) {
+					if ( jQuery.contains( self[ i ], this ) ) {
+						return true;
+					}
+				}
+			}) );
+		}
+
+		ret = [];
+		for ( i = 0; i < len; i++ ) {
+			jQuery.find( selector, this[ i ], ret );
+		}
+
+		// Needed because $( selector, context ) becomes $( context ).find( selector )
+		ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
+		ret.selector = ( this.selector ? this.selector + " " : "" ) + selector;
+		return ret;
+	},
+
+	has: function( target ) {
+		var i,
+			targets = jQuery( target, this ),
+			len = targets.length;
+
+		return this.filter(function() {
+			for ( i = 0; i < len; i++ ) {
+				if ( jQuery.contains( this, targets[i] ) ) {
+					return true;
+				}
+			}
+		});
+	},
+
+	not: function( selector ) {
+		return this.pushStack( winnow(this, selector, false) );
+	},
+
+	filter: function( selector ) {
+		return this.pushStack( winnow(this, selector, true) );
+	},
+
+	is: function( selector ) {
+		return !!selector && (
+			typeof selector === "string" ?
+				// If this is a positional/relative selector, check membership in the returned set
+				// so $("p:first").is("p:last") won't return true for a doc with two "p".
+				rneedsContext.test( selector ) ?
+					jQuery( selector, this.context ).index( this[0] ) >= 0 :
+					jQuery.filter( selector, this ).length > 0 :
+				this.filter( selector ).length > 0 );
+	},
+
+	closest: function( selectors, context ) {
+		var cur,
+			i = 0,
+			l = this.length,
+			ret = [],
+			pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
+				jQuery( selectors, context || this.context ) :
+				0;
+
+		for ( ; i < l; i++ ) {
+			cur = this[i];
+
+			while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
+				if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
+					ret.push( cur );
+					break;
+				}
+				cur = cur.parentNode;
+			}
+		}
+
+		return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
+	},
+
+	// Determine the position of an element within
+	// the matched set of elements
+	index: function( elem ) {
+
+		// No argument, return index in parent
+		if ( !elem ) {
+			return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
+		}
+
+		// index in selector
+		if ( typeof elem === "string" ) {
+			return jQuery.inArray( this[0], jQuery( elem ) );
+		}
+
+		// Locate the position of the desired element
+		return jQuery.inArray(
+			// If it receives a jQuery object, the first element is used
+			elem.jquery ? elem[0] : elem, this );
+	},
+
+	add: function( selector, context ) {
+		var set = typeof selector === "string" ?
+				jQuery( selector, context ) :
+				jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
+			all = jQuery.merge( this.get(), set );
+
+		return this.pushStack( jQuery.unique(all) );
+	},
+
+	addBack: function( selector ) {
+		return this.add( selector == null ?
+			this.prevObject : this.prevObject.filter(selector)
+		);
+	}
+});
+
+jQuery.fn.andSelf = jQuery.fn.addBack;
+
+function sibling( cur, dir ) {
+	do {
+		cur = cur[ dir ];
+	} while ( cur && cur.nodeType !== 1 );
+
+	return cur;
+}
+
+jQuery.each({
+	parent: function( elem ) {
+		var parent = elem.parentNode;
+		return parent && parent.nodeType !== 11 ? parent : null;
+	},
+	parents: function( elem ) {
+		return jQuery.dir( elem, "parentNode" );
+	},
+	parentsUntil: function( elem, i, until ) {
+		return jQuery.dir( elem, "parentNode", until );
+	},
+	next: function( elem ) {
+		return sibling( elem, "nextSibling" );
+	},
+	prev: function( elem ) {
+		return sibling( elem, "previousSibling" );
+	},
+	nextAll: function( elem ) {
+		return jQuery.dir( elem, "nextSibling" );
+	},
+	prevAll: function( elem ) {
+		return jQuery.dir( elem, "previousSibling" );
+	},
+	nextUntil: function( elem, i, until ) {
+		return jQuery.dir( elem, "nextSibling", until );
+	},
+	prevUntil: function( elem, i, until ) {
+		return jQuery.dir( elem, "previousSibling", until );
+	},
+	siblings: function( elem ) {
+		return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
+	},
+	children: function( elem ) {
+		return jQuery.sibling( elem.firstChild );
+	},
+	contents: function( elem ) {
+		return jQuery.nodeName( elem, "iframe" ) ?
+			elem.contentDocument || elem.contentWindow.document :
+			jQuery.merge( [], elem.childNodes );
+	}
+}, function( name, fn ) {
+	jQuery.fn[ name ] = function( until, selector ) {
+		var ret = jQuery.map( this, fn, until );
+
+		if ( !runtil.test( name ) ) {
+			selector = until;
+		}
+
+		if ( selector && typeof selector === "string" ) {
+			ret = jQuery.filter( selector, ret );
+		}
+
+		ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
+
+		if ( this.length > 1 && rparentsprev.test( name ) ) {
+			ret = ret.reverse();
+		}
+
+		return this.pushStack( ret );
+	};
+});
+
+jQuery.extend({
+	filter: function( expr, elems, not ) {
+		if ( not ) {
+			expr = ":not(" + expr + ")";
+		}
+
+		return elems.length === 1 ?
+			jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
+			jQuery.find.matches(expr, elems);
+	},
+
+	dir: function( elem, dir, until ) {
+		var matched = [],
+			cur = elem[ dir ];
+
+		while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
+			if ( cur.nodeType === 1 ) {
+				matched.push( cur );
+			}
+			cur = cur[dir];
+		}
+		return matched;
+	},
+
+	sibling: function( n, elem ) {
+		var r = [];
+
+		for ( ; n; n = n.nextSibling ) {
+			if ( n.nodeType === 1 && n !== elem ) {
+				r.push( n );
+			}
+		}
+
+		return r;
+	}
+});
+
+// Implement the identical functionality for filter and not
+function winnow( elements, qualifier, keep ) {
+
+	// Can't pass null or undefined to indexOf in Firefox 4
+	// Set to 0 to skip string check
+	qualifier = qualifier || 0;
+
+	if ( jQuery.isFunction( qualifier ) ) {
+		return jQuery.grep(elements, function( elem, i ) {
+			var retVal = !!qualifier.call( elem, i, elem );
+			return retVal === keep;
+		});
+
+	} else if ( qualifier.nodeType ) {
+		return jQuery.grep(elements, function( elem ) {
+			return ( elem === qualifier ) === keep;
+		});
+
+	} else if ( typeof qualifier === "string" ) {
+		var filtered = jQuery.grep(elements, function( elem ) {
+			return elem.nodeType === 1;
+		});
+
+		if ( isSimple.test( qualifier ) ) {
+			return jQuery.filter(qualifier, filtered, !keep);
+		} else {
+			qualifier = jQuery.filter( qualifier, filtered );
+		}
+	}
+
+	return jQuery.grep(elements, function( elem ) {
+		return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
+	});
+}
+function createSafeFragment( document ) {
+	var list = nodeNames.split( "|" ),
+		safeFrag = document.createDocumentFragment();
+
+	if ( safeFrag.createElement ) {
+		while ( list.length ) {
+			safeFrag.createElement(
+				list.pop()
+			);
+		}
+	}
+	return safeFrag;
+}
+
+var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
+		"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
+	rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
+	rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
+	rleadingWhitespace = /^\s+/,
+	rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
+	rtagName = /<([\w:]+)/,
+	rtbody = /<tbody/i,
+	rhtml = /<|&#?\w+;/,
+	rnoInnerhtml = /<(?:script|style|link)/i,
+	manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
+	// checked="checked" or checked
+	rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
+	rscriptType = /^$|\/(?:java|ecma)script/i,
+	rscriptTypeMasked = /^true\/(.*)/,
+	rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
+
+	// We have to close these tags to support XHTML (#13200)
+	wrapMap = {
+		option: [ 1, "<select multiple='multiple'>", "</select>" ],
+		legend: [ 1, "<fieldset>", "</fieldset>" ],
+		area: [ 1, "<map>", "</map>" ],
+		param: [ 1, "<object>", "</object>" ],
+		thead: [ 1, "<table>", "</table>" ],
+		tr: [ 2, "<table><tbody>", "</tbody></table>" ],
+		col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
+		td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
+
+		// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
+		// unless wrapped in a div with non-breaking characters in front of it.
+		_default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>"  ]
+	},
+	safeFragment = createSafeFragment( document ),
+	fragmentDiv = safeFragment.appendChild( document.createElement("div") );
+
+wrapMap.optgroup = wrapMap.option;
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
+
+jQuery.fn.extend({
+	text: function( value ) {
+		return jQuery.access( this, function( value ) {
+			return value === undefined ?
+				jQuery.text( this ) :
+				this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
+		}, null, value, arguments.length );
+	},
+
+	wrapAll: function( html ) {
+		if ( jQuery.isFunction( html ) ) {
+			return this.each(function(i) {
+				jQuery(this).wrapAll( html.call(this, i) );
+			});
+		}
+
+		if ( this[0] ) {
+			// The elements to wrap the target around
+			var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
+
+			if ( this[0].parentNode ) {
+				wrap.insertBefore( this[0] );
+			}
+
+			wrap.map(function() {
+				var elem = this;
+
+				while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
+					elem = elem.firstChild;
+				}
+
+				return elem;
+			}).append( this );
+		}
+
+		return this;
+	},
+
+	wrapInner: function( html ) {
+		if ( jQuery.isFunction( html ) ) {
+			return this.each(function(i) {
+				jQuery(this).wrapInner( html.call(this, i) );
+			});
+		}
+
+		return this.each(function() {
+			var self = jQuery( this ),
+				contents = self.contents();
+
+			if ( contents.length ) {
+				contents.wrapAll( html );
+
+			} else {
+				self.append( html );
+			}
+		});
+	},
+
+	wrap: function( html ) {
+		var isFunction = jQuery.isFunction( html );
+
+		return this.each(function(i) {
+			jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
+		});
+	},
+
+	unwrap: function() {
+		return this.parent().each(function() {
+			if ( !jQuery.nodeName( this, "body" ) ) {
+				jQuery( this ).replaceWith( this.childNodes );
+			}
+		}).end();
+	},
+
+	append: function() {
+		return this.domManip(arguments, true, function( elem ) {
+			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
+				this.appendChild( elem );
+			}
+		});
+	},
+
+	prepend: function() {
+		return this.domManip(arguments, true, function( elem ) {
+			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
+				this.insertBefore( elem, this.firstChild );
+			}
+		});
+	},
+
+	before: function() {
+		return this.domManip( arguments, false, function( elem ) {
+			if ( this.parentNode ) {
+				this.parentNode.insertBefore( elem, this );
+			}
+		});
+	},
+
+	after: function() {
+		return this.domManip( arguments, false, function( elem ) {
+			if ( this.parentNode ) {
+				this.parentNode.insertBefore( elem, this.nextSibling );
+			}
+		});
+	},
+
+	// keepData is for internal use only--do not document
+	remove: function( selector, keepData ) {
+		var elem,
+			i = 0;
+
+		for ( ; (elem = this[i]) != null; i++ ) {
+			if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) {
+				if ( !keepData && elem.nodeType === 1 ) {
+					jQuery.cleanData( getAll( elem ) );
+				}
+
+				if ( elem.parentNode ) {
+					if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
+						setGlobalEval( getAll( elem, "script" ) );
+					}
+					elem.parentNode.removeChild( elem );
+				}
+			}
+		}
+
+		return this;
+	},
+
+	empty: function() {
+		var elem,
+			i = 0;
+
+		for ( ; (elem = this[i]) != null; i++ ) {
+			// Remove element nodes and prevent memory leaks
+			if ( elem.nodeType === 1 ) {
+				jQuery.cleanData( getAll( elem, false ) );
+			}
+
+			// Remove any remaining nodes
+			while ( elem.firstChild ) {
+				elem.removeChild( elem.firstChild );
+			}
+
+			// If this is a select, ensure that it displays empty (#12336)
+			// Support: IE<9
+			if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
+				elem.options.length = 0;
+			}
+		}
+
+		return this;
+	},
+
+	clone: function( dataAndEvents, deepDataAndEvents ) {
+		dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
+		deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
+
+		return this.map( function () {
+			return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
+		});
+	},
+
+	html: function( value ) {
+		return jQuery.access( this, function( value ) {
+			var elem = this[0] || {},
+				i = 0,
+				l = this.length;
+
+			if ( value === undefined ) {
+				return elem.nodeType === 1 ?
+					elem.innerHTML.replace( rinlinejQuery, "" ) :
+					undefined;
+			}
+
+			// See if we can take a shortcut and just use innerHTML
+			if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
+				( jQuery.support.htmlSerialize || !rnoshimcache.test( value )  ) &&
+				( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
+				!wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
+
+				value = value.replace( rxhtmlTag, "<$1></$2>" );
+
+				try {
+					for (; i < l; i++ ) {
+						// Remove element nodes and prevent memory leaks
+						elem = this[i] || {};
+						if ( elem.nodeType === 1 ) {
+							jQuery.cleanData( getAll( elem, false ) );
+							elem.innerHTML = value;
+						}
+					}
+
+					elem = 0;
+
+				// If using innerHTML throws an exception, use the fallback method
+				} catch(e) {}
+			}
+
+			if ( elem ) {
+				this.empty().append( value );
+			}
+		}, null, value, arguments.length );
+	},
+
+	replaceWith: function( value ) {
+		var isFunc = jQuery.isFunction( value );
+
+		// Make sure that the elements are removed from the DOM before they are inserted
+		// this can help fix replacing a parent with child elements
+		if ( !isFunc && typeof value !== "string" ) {
+			value = jQuery( value ).not( this ).detach();
+		}
+
+		return this.domManip( [ value ], true, function( elem ) {
+			var next = this.nextSibling,
+				parent = this.parentNode;
+
+			if ( parent ) {
+				jQuery( this ).remove();
+				parent.insertBefore( elem, next );
+			}
+		});
+	},
+
+	detach: function( selector ) {
+		return this.remove( selector, true );
+	},
+
+	domManip: function( args, table, callback ) {
+
+		// Flatten any nested arrays
+		args = core_concat.apply( [], args );
+
+		var first, node, hasScripts,
+			scripts, doc, fragment,
+			i = 0,
+			l = this.length,
+			set = this,
+			iNoClone = l - 1,
+			value = args[0],
+			isFunction = jQuery.isFunction( value );
+
+		// We can't cloneNode fragments that contain checked, in WebKit
+		if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
+			return this.each(function( index ) {
+				var self = set.eq( index );
+				if ( isFunction ) {
+					args[0] = value.call( this, index, table ? self.html() : undefined );
+				}
+				self.domManip( args, table, callback );
+			});
+		}
+
+		if ( l ) {
+			fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
+			first = fragment.firstChild;
+
+			if ( fragment.childNodes.length === 1 ) {
+				fragment = first;
+			}
+
+			if ( first ) {
+				table = table && jQuery.nodeName( first, "tr" );
+				scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
+				hasScripts = scripts.length;
+
+				// Use the original fragment for the last item instead of the first because it can end up
+				// being emptied incorrectly in certain situations (#8070).
+				for ( ; i < l; i++ ) {
+					node = fragment;
+
+					if ( i !== iNoClone ) {
+						node = jQuery.clone( node, true, true );
+
+						// Keep references to cloned scripts for later restoration
+						if ( hasScripts ) {
+							jQuery.merge( scripts, getAll( node, "script" ) );
+						}
+					}
+
+					callback.call(
+						table && jQuery.nodeName( this[i], "table" ) ?
+							findOrAppend( this[i], "tbody" ) :
+							this[i],
+						node,
+						i
+					);
+				}
+
+				if ( hasScripts ) {
+					doc = scripts[ scripts.length - 1 ].ownerDocument;
+
+					// Reenable scripts
+					jQuery.map( scripts, restoreScript );
+
+					// Evaluate executable scripts on first document insertion
+					for ( i = 0; i < hasScripts; i++ ) {
+						node = scripts[ i ];
+						if ( rscriptType.test( node.type || "" ) &&
+							!jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
+
+							if ( node.src ) {
+								// Hope ajax is available...
+								jQuery.ajax({
+									url: node.src,
+									type: "GET",
+									dataType: "script",
+									async: false,
+									global: false,
+									"throws": true
+								});
+							} else {
+								jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
+							}
+						}
+					}
+				}
+
+				// Fix #11809: Avoid leaking memory
+				fragment = first = null;
+			}
+		}
+
+		return this;
+	}
+});
+
+function findOrAppend( elem, tag ) {
+	return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
+}
+
+// Replace/restore the type attribute of script elements for safe DOM manipulation
+function disableScript( elem ) {
+	var attr = elem.getAttributeNode("type");
+	elem.type = ( attr && attr.specified ) + "/" + elem.type;
+	return elem;
+}
+function restoreScript( elem ) {
+	var match = rscriptTypeMasked.exec( elem.type );
+	if ( match ) {
+		elem.type = match[1];
+	} else {
+		elem.removeAttribute("type");
+	}
+	return elem;
+}
+
+// Mark scripts as having already been evaluated
+function setGlobalEval( elems, refElements ) {
+	var elem,
+		i = 0;
+	for ( ; (elem = elems[i]) != null; i++ ) {
+		jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
+	}
+}
+
+function cloneCopyEvent( src, dest ) {
+
+	if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
+		return;
+	}
+
+	var type, i, l,
+		oldData = jQuery._data( src ),
+		curData = jQuery._data( dest, oldData ),
+		events = oldData.events;
+
+	if ( events ) {
+		delete curData.handle;
+		curData.events = {};
+
+		for ( type in events ) {
+			for ( i = 0, l = events[ type ].length; i < l; i++ ) {
+				jQuery.event.add( dest, type, events[ type ][ i ] );
+			}
+		}
+	}
+
+	// make the cloned public data object a copy from the original
+	if ( curData.data ) {
+		curData.data = jQuery.extend( {}, curData.data );
+	}
+}
+
+function fixCloneNodeIssues( src, dest ) {
+	var nodeName, e, data;
+
+	// We do not need to do anything for non-Elements
+	if ( dest.nodeType !== 1 ) {
+		return;
+	}
+
+	nodeName = dest.nodeName.toLowerCase();
+
+	// IE6-8 copies events bound via attachEvent when using cloneNode.
+	if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
+		data = jQuery._data( dest );
+
+		for ( e in data.events ) {
+			jQuery.removeEvent( dest, e, data.handle );
+		}
+
+		// Event data gets referenced instead of copied if the expando gets copied too
+		dest.removeAttribute( jQuery.expando );
+	}
+
+	// IE blanks contents when cloning scripts, and tries to evaluate newly-set text
+	if ( nodeName === "script" && dest.text !== src.text ) {
+		disableScript( dest ).text = src.text;
+		restoreScript( dest );
+
+	// IE6-10 improperly clones children of object elements using classid.
+	// IE10 throws NoModificationAllowedError if parent is null, #12132.
+	} else if ( nodeName === "object" ) {
+		if ( dest.parentNode ) {
+			dest.outerHTML = src.outerHTML;
+		}
+
+		// This path appears unavoidable for IE9. When cloning an object
+		// element in IE9, the outerHTML strategy above is not sufficient.
+		// If the src has innerHTML and the destination does not,
+		// copy the src.innerHTML into the dest.innerHTML. #10324
+		if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
+			dest.innerHTML = src.innerHTML;
+		}
+
+	} else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
+		// IE6-8 fails to persist the checked state of a cloned checkbox
+		// or radio button. Worse, IE6-7 fail to give the cloned element
+		// a checked appearance if the defaultChecked value isn't also set
+
+		dest.defaultChecked = dest.checked = src.checked;
+
+		// IE6-7 get confused and end up setting the value of a cloned
+		// checkbox/radio button to an empty string instead of "on"
+		if ( dest.value !== src.value ) {
+			dest.value = src.value;
+		}
+
+	// IE6-8 fails to return the selected option to the default selected
+	// state when cloning options
+	} else if ( nodeName === "option" ) {
+		dest.defaultSelected = dest.selected = src.defaultSelected;
+
+	// IE6-8 fails to set the defaultValue to the correct value when
+	// cloning other types of input fields
+	} else if ( nodeName === "input" || nodeName === "textarea" ) {
+		dest.defaultValue = src.defaultValue;
+	}
+}
+
+jQuery.each({
+	appendTo: "append",
+	prependTo: "prepend",
+	insertBefore: "before",
+	insertAfter: "after",
+	replaceAll: "replaceWith"
+}, function( name, original ) {
+	jQuery.fn[ name ] = function( selector ) {
+		var elems,
+			i = 0,
+			ret = [],
+			insert = jQuery( selector ),
+			last = insert.length - 1;
+
+		for ( ; i <= last; i++ ) {
+			elems = i === last ? this : this.clone(true);
+			jQuery( insert[i] )[ original ]( elems );
+
+			// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
+			core_push.apply( ret, elems.get() );
+		}
+
+		return this.pushStack( ret );
+	};
+});
+
+function getAll( context, tag ) {
+	var elems, elem,
+		i = 0,
+		found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
+			typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
+			undefined;
+
+	if ( !found ) {
+		for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
+			if ( !tag || jQuery.nodeName( elem, tag ) ) {
+				found.push( elem );
+			} else {
+				jQuery.merge( found, getAll( elem, tag ) );
+			}
+		}
+	}
+
+	return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
+		jQuery.merge( [ context ], found ) :
+		found;
+}
+
+// Used in buildFragment, fixes the defaultChecked property
+function fixDefaultChecked( elem ) {
+	if ( manipulation_rcheckableType.test( elem.type ) ) {
+		elem.defaultChecked = elem.checked;
+	}
+}
+
+jQuery.extend({
+	clone: function( elem, dataAndEvents, deepDataAndEvents ) {
+		var destElements, node, clone, i, srcElements,
+			inPage = jQuery.contains( elem.ownerDocument, elem );
+
+		if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
+			clone = elem.cloneNode( true );
+
+		// IE<=8 does not properly clone detached, unknown element nodes
+		} else {
+			fragmentDiv.innerHTML = elem.outerHTML;
+			fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
+		}
+
+		if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
+				(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
+
+			// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
+			destElements = getAll( clone );
+			srcElements = getAll( elem );
+
+			// Fix all IE cloning issues
+			for ( i = 0; (node = srcElements[i]) != null; ++i ) {
+				// Ensure that the destination node is not null; Fixes #9587
+				if ( destElements[i] ) {
+					fixCloneNodeIssues( node, destElements[i] );
+				}
+			}
+		}
+
+		// Copy the events from the original to the clone
+		if ( dataAndEvents ) {
+			if ( deepDataAndEvents ) {
+				srcElements = srcElements || getAll( elem );
+				destElements = destElements || getAll( clone );
+
+				for ( i = 0; (node = srcElements[i]) != null; i++ ) {
+					cloneCopyEvent( node, destElements[i] );
+				}
+			} else {
+				cloneCopyEvent( elem, clone );
+			}
+		}
+
+		// Preserve script evaluation history
+		destElements = getAll( clone, "script" );
+		if ( destElements.length > 0 ) {
+			setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
+		}
+
+		destElements = srcElements = node = null;
+
+		// Return the cloned set
+		return clone;
+	},
+
+	buildFragment: function( elems, context, scripts, selection ) {
+		var j, elem, contains,
+			tmp, tag, tbody, wrap,
+			l = elems.length,
+
+			// Ensure a safe fragment
+			safe = createSafeFragment( context ),
+
+			nodes = [],
+			i = 0;
+
+		for ( ; i < l; i++ ) {
+			elem = elems[ i ];
+
+			if ( elem || elem === 0 ) {
+
+				// Add nodes directly
+				if ( jQuery.type( elem ) === "object" ) {
+					jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
+
+				// Convert non-html into a text node
+				} else if ( !rhtml.test( elem ) ) {
+					nodes.push( context.createTextNode( elem ) );
+
+				// Convert html into DOM nodes
+				} else {
+					tmp = tmp || safe.appendChild( context.createElement("div") );
+
+					// Deserialize a standard representation
+					tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
+					wrap = wrapMap[ tag ] || wrapMap._default;
+
+					tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
+
+					// Descend through wrappers to the right content
+					j = wrap[0];
+					while ( j-- ) {
+						tmp = tmp.lastChild;
+					}
+
+					// Manually add leading whitespace removed by IE
+					if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
+						nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
+					}
+
+					// Remove IE's autoinserted <tbody> from table fragments
+					if ( !jQuery.support.tbody ) {
+
+						// String was a <table>, *may* have spurious <tbody>
+						elem = tag === "table" && !rtbody.test( elem ) ?
+							tmp.firstChild :
+
+							// String was a bare <thead> or <tfoot>
+							wrap[1] === "<table>" && !rtbody.test( elem ) ?
+								tmp :
+								0;
+
+						j = elem && elem.childNodes.length;
+						while ( j-- ) {
+							if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
+								elem.removeChild( tbody );
+							}
+						}
+					}
+
+					jQuery.merge( nodes, tmp.childNodes );
+
+					// Fix #12392 for WebKit and IE > 9
+					tmp.textContent = "";
+
+					// Fix #12392 for oldIE
+					while ( tmp.firstChild ) {
+						tmp.removeChild( tmp.firstChild );
+					}
+
+					// Remember the top-level container for proper cleanup
+					tmp = safe.lastChild;
+				}
+			}
+		}
+
+		// Fix #11356: Clear elements from fragment
+		if ( tmp ) {
+			safe.removeChild( tmp );
+		}
+
+		// Reset defaultChecked for any radios and checkboxes
+		// about to be appended to the DOM in IE 6/7 (#8060)
+		if ( !jQuery.support.appendChecked ) {
+			jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
+		}
+
+		i = 0;
+		while ( (elem = nodes[ i++ ]) ) {
+
+			// #4087 - If origin and destination elements are the same, and this is
+			// that element, do not do anything
+			if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
+				continue;
+			}
+
+			contains = jQuery.contains( elem.ownerDocument, elem );
+
+			// Append to fragment
+			tmp = getAll( safe.appendChild( elem ), "script" );
+
+			// Preserve script evaluation history
+			if ( contains ) {
+				setGlobalEval( tmp );
+			}
+
+			// Capture executables
+			if ( scripts ) {
+				j = 0;
+				while ( (elem = tmp[ j++ ]) ) {
+					if ( rscriptType.test( elem.type || "" ) ) {
+						scripts.push( elem );
+					}
+				}
+			}
+		}
+
+		tmp = null;
+
+		return safe;
+	},
+
+	cleanData: function( elems, /* internal */ acceptData ) {
+		var elem, type, id, data,
+			i = 0,
+			internalKey = jQuery.expando,
+			cache = jQuery.cache,
+			deleteExpando = jQuery.support.deleteExpando,
+			special = jQuery.event.special;
+
+		for ( ; (elem = elems[i]) != null; i++ ) {
+
+			if ( acceptData || jQuery.acceptData( elem ) ) {
+
+				id = elem[ internalKey ];
+				data = id && cache[ id ];
+
+				if ( data ) {
+					if ( data.events ) {
+						for ( type in data.events ) {
+							if ( special[ type ] ) {
+								jQuery.event.remove( elem, type );
+
+							// This is a shortcut to avoid jQuery.event.remove's overhead
+							} else {
+								jQuery.removeEvent( elem, type, data.handle );
+							}
+						}
+					}
+
+					// Remove cache only if it was not already removed by jQuery.event.remove
+					if ( cache[ id ] ) {
+
+						delete cache[ id ];
+
+						// IE does not allow us to delete expando properties from nodes,
+						// nor does it have a removeAttribute function on Document nodes;
+						// we must handle all of these cases
+						if ( deleteExpando ) {
+							delete elem[ internalKey ];
+
+						} else if ( typeof elem.removeAttribute !== core_strundefined ) {
+							elem.removeAttribute( internalKey );
+
+						} else {
+							elem[ internalKey ] = null;
+						}
+
+						core_deletedIds.push( id );
+					}
+				}
+			}
+		}
+	}
+});
+var iframe, getStyles, curCSS,
+	ralpha = /alpha\([^)]*\)/i,
+	ropacity = /opacity\s*=\s*([^)]*)/,
+	rposition = /^(top|right|bottom|left)$/,
+	// swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
+	// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
+	rdisplayswap = /^(none|table(?!-c[ea]).+)/,
+	rmargin = /^margin/,
+	rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
+	rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
+	rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
+	elemdisplay = { BODY: "block" },
+
+	cssShow = { position: "absolute", visibility: "hidden", display: "block" },
+	cssNormalTransform = {
+		letterSpacing: 0,
+		fontWeight: 400
+	},
+
+	cssExpand = [ "Top", "Right", "Bottom", "Left" ],
+	cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
+
+// return a css property mapped to a potentially vendor prefixed property
+function vendorPropName( style, name ) {
+
+	// shortcut for names that are not vendor prefixed
+	if ( name in style ) {
+		return name;
+	}
+
+	// check for vendor prefixed names
+	var capName = name.charAt(0).toUpperCase() + name.slice(1),
+		origName = name,
+		i = cssPrefixes.length;
+
+	while ( i-- ) {
+		name = cssPrefixes[ i ] + capName;
+		if ( name in style ) {
+			return name;
+		}
+	}
+
+	return origName;
+}
+
+function isHidden( elem, el ) {
+	// isHidden might be called from jQuery#filter function;
+	// in that case, element will be second argument
+	elem = el || elem;
+	return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
+}
+
+function showHide( elements, show ) {
+	var display, elem, hidden,
+		values = [],
+		index = 0,
+		length = elements.length;
+
+	for ( ; index < length; index++ ) {
+		elem = elements[ index ];
+		if ( !elem.style ) {
+			continue;
+		}
+
+		values[ index ] = jQuery._data( elem, "olddisplay" );
+		display = elem.style.display;
+		if ( show ) {
+			// Reset the inline display of this element to learn if it is
+			// being hidden by cascaded rules or not
+			if ( !values[ index ] && display === "none" ) {
+				elem.style.display = "";
+			}
+
+			// Set elements which have been overridden with display: none
+			// in a stylesheet to whatever the default browser style is
+			// for such an element
+			if ( elem.style.display === "" && isHidden( elem ) ) {
+				values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
+			}
+		} else {
+
+			if ( !values[ index ] ) {
+				hidden = isHidden( elem );
+
+				if ( display && display !== "none" || !hidden ) {
+					jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
+				}
+			}
+		}
+	}
+
+	// Set the display of most of the elements in a second loop
+	// to avoid the constant reflow
+	for ( index = 0; index < length; index++ ) {
+		elem = elements[ index ];
+		if ( !elem.style ) {
+			continue;
+		}
+		if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
+			elem.style.display = show ? values[ index ] || "" : "none";
+		}
+	}
+
+	return elements;
+}
+
+jQuery.fn.extend({
+	css: function( name, value ) {
+		return jQuery.access( this, function( elem, name, value ) {
+			var len, styles,
+				map = {},
+				i = 0;
+
+			if ( jQuery.isArray( name ) ) {
+				styles = getStyles( elem );
+				len = name.length;
+
+				for ( ; i < len; i++ ) {
+					map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
+				}
+
+				return map;
+			}
+
+			return value !== undefined ?
+				jQuery.style( elem, name, value ) :
+				jQuery.css( elem, name );
+		}, name, value, arguments.length > 1 );
+	},
+	show: function() {
+		return showHide( this, true );
+	},
+	hide: function() {
+		return showHide( this );
+	},
+	toggle: function( state ) {
+		var bool = typeof state === "boolean";
+
+		return this.each(function() {
+			if ( bool ? state : isHidden( this ) ) {
+				jQuery( this ).show();
+			} else {
+				jQuery( this ).hide();
+			}
+		});
+	}
+});
+
+jQuery.extend({
+	// Add in style property hooks for overriding the default
+	// behavior of getting and setting a style property
+	cssHooks: {
+		opacity: {
+			get: function( elem, computed ) {
+				if ( computed ) {
+					// We should always get a number back from opacity
+					var ret = curCSS( elem, "opacity" );
+					return ret === "" ? "1" : ret;
+				}
+			}
+		}
+	},
+
+	// Exclude the following css properties to add px
+	cssNumber: {
+		"columnCount": true,
+		"fillOpacity": true,
+		"fontWeight": true,
+		"lineHeight": true,
+		"opacity": true,
+		"orphans": true,
+		"widows": true,
+		"zIndex": true,
+		"zoom": true
+	},
+
+	// Add in properties whose names you wish to fix before
+	// setting or getting the value
+	cssProps: {
+		// normalize float css property
+		"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
+	},
+
+	// Get and set the style property on a DOM Node
+	style: function( elem, name, value, extra ) {
+		// Don't set styles on text and comment nodes
+		if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
+			return;
+		}
+
+		// Make sure that we're working with the right name
+		var ret, type, hooks,
+			origName = jQuery.camelCase( name ),
+			style = elem.style;
+
+		name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
+
+		// gets hook for the prefixed version
+		// followed by the unprefixed version
+		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
+
+		// Check if we're setting a value
+		if ( value !== undefined ) {
+			type = typeof value;
+
+			// convert relative number strings (+= or -=) to relative numbers. #7345
+			if ( type === "string" && (ret = rrelNum.exec( value )) ) {
+				value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
+				// Fixes bug #9237
+				type = "number";
+			}
+
+			// Make sure that NaN and null values aren't set. See: #7116
+			if ( value == null || type === "number" && isNaN( value ) ) {
+				return;
+			}
+
+			// If a number was passed in, add 'px' to the (except for certain CSS properties)
+			if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
+				value += "px";
+			}
+
+			// Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
+			// but it would mean to define eight (for every problematic property) identical functions
+			if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
+				style[ name ] = "inherit";
+			}
+
+			// If a hook was provided, use that value, otherwise just set the specified value
+			if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
+
+				// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
+				// Fixes bug #5509
+				try {
+					style[ name ] = value;
+				} catch(e) {}
+			}
+
+		} else {
+			// If a hook was provided get the non-computed value from there
+			if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
+				return ret;
+			}
+
+			// Otherwise just get the value from the style object
+			return style[ name ];
+		}
+	},
+
+	css: function( elem, name, extra, styles ) {
+		var num, val, hooks,
+			origName = jQuery.camelCase( name );
+
+		// Make sure that we're working with the right name
+		name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
+
+		// gets hook for the prefixed version
+		// followed by the unprefixed version
+		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
+
+		// If a hook was provided get the computed value from there
+		if ( hooks && "get" in hooks ) {
+			val = hooks.get( elem, true, extra );
+		}
+
+		// Otherwise, if a way to get the computed value exists, use that
+		if ( val === undefined ) {
+			val = curCSS( elem, name, styles );
+		}
+
+		//convert "normal" to computed value
+		if ( val === "normal" && name in cssNormalTransform ) {
+			val = cssNormalTransform[ name ];
+		}
+
+		// Return, converting to number if forced or a qualifier was provided and val looks numeric
+		if ( extra === "" || extra ) {
+			num = parseFloat( val );
+			return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
+		}
+		return val;
+	},
+
+	// A method for quickly swapping in/out CSS properties to get correct calculations
+	swap: function( elem, options, callback, args ) {
+		var ret, name,
+			old = {};
+
+		// Remember the old values, and insert the new ones
+		for ( name in options ) {
+			old[ name ] = elem.style[ name ];
+			elem.style[ name ] = options[ name ];
+		}
+
+		ret = callback.apply( elem, args || [] );
+
+		// Revert the old values
+		for ( name in options ) {
+			elem.style[ name ] = old[ name ];
+		}
+
+		return ret;
+	}
+});
+
+// NOTE: we've included the "window" in window.getComputedStyle
+// because jsdom on node.js will break without it.
+if ( window.getComputedStyle ) {
+	getStyles = function( elem ) {
+		return window.getComputedStyle( elem, null );
+	};
+
+	curCSS = function( elem, name, _computed ) {
+		var width, minWidth, maxWidth,
+			computed = _computed || getStyles( elem ),
+
+			// getPropertyValue is only needed for .css('filter') in IE9, see #12537
+			ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
+			style = elem.style;
+
+		if ( computed ) {
+
+			if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
+				ret = jQuery.style( elem, name );
+			}
+
+			// A tribute to the "awesome hack by Dean Edwards"
+			// Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
+			// Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
+			// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
+			if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
+
+				// Remember the original values
+				width = style.width;
+				minWidth = style.minWidth;
+				maxWidth = style.maxWidth;
+
+				// Put in the new values to get a computed value out
+				style.minWidth = style.maxWidth = style.width = ret;
+				ret = computed.width;
+
+				// Revert the changed values
+				style.width = width;
+				style.minWidth = minWidth;
+				style.maxWidth = maxWidth;
+			}
+		}
+
+		return ret;
+	};
+} else if ( document.documentElement.currentStyle ) {
+	getStyles = function( elem ) {
+		return elem.currentStyle;
+	};
+
+	curCSS = function( elem, name, _computed ) {
+		var left, rs, rsLeft,
+			computed = _computed || getStyles( elem ),
+			ret = computed ? computed[ name ] : undefined,
+			style = elem.style;
+
+		// Avoid setting ret to empty string here
+		// so we don't default to auto
+		if ( ret == null && style && style[ name ] ) {
+			ret = style[ name ];
+		}
+
+		// From the awesome hack by Dean Edwards
+		// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+
+		// If we're not dealing with a regular pixel number
+		// but a number that has a weird ending, we need to convert it to pixels
+		// but not position css attributes, as those are proportional to the parent element instead
+		// and we can't measure the parent instead because it might trigger a "stacking dolls" problem
+		if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
+
+			// Remember the original values
+			left = style.left;
+			rs = elem.runtimeStyle;
+			rsLeft = rs && rs.left;
+
+			// Put in the new values to get a computed value out
+			if ( rsLeft ) {
+				rs.left = elem.currentStyle.left;
+			}
+			style.left = name === "fontSize" ? "1em" : ret;
+			ret = style.pixelLeft + "px";
+
+			// Revert the changed values
+			style.left = left;
+			if ( rsLeft ) {
+				rs.left = rsLeft;
+			}
+		}
+
+		return ret === "" ? "auto" : ret;
+	};
+}
+
+function setPositiveNumber( elem, value, subtract ) {
+	var matches = rnumsplit.exec( value );
+	return matches ?
+		// Guard against undefined "subtract", e.g., when used as in cssHooks
+		Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
+		value;
+}
+
+function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
+	var i = extra === ( isBorderBox ? "border" : "content" ) ?
+		// If we already have the right measurement, avoid augmentation
+		4 :
+		// Otherwise initialize for horizontal or vertical properties
+		name === "width" ? 1 : 0,
+
+		val = 0;
+
+	for ( ; i < 4; i += 2 ) {
+		// both box models exclude margin, so add it if we want it
+		if ( extra === "margin" ) {
+			val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
+		}
+
+		if ( isBorderBox ) {
+			// border-box includes padding, so remove it if we want content
+			if ( extra === "content" ) {
+				val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
+			}
+
+			// at this point, extra isn't border nor margin, so remove border
+			if ( extra !== "margin" ) {
+				val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
+			}
+		} else {
+			// at this point, extra isn't content, so add padding
+			val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
+
+			// at this point, extra isn't content nor padding, so add border
+			if ( extra !== "padding" ) {
+				val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
+			}
+		}
+	}
+
+	return val;
+}
+
+function getWidthOrHeight( elem, name, extra ) {
+
+	// Start with offset property, which is equivalent to the border-box value
+	var valueIsBorderBox = true,
+		val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
+		styles = getStyles( elem ),
+		isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
+
+	// some non-html elements return undefined for offsetWidth, so check for null/undefined
+	// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
+	// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
+	if ( val <= 0 || val == null ) {
+		// Fall back to computed then uncomputed css if necessary
+		val = curCSS( elem, name, styles );
+		if ( val < 0 || val == null ) {
+			val = elem.style[ name ];
+		}
+
+		// Computed unit is not pixels. Stop here and return.
+		if ( rnumnonpx.test(val) ) {
+			return val;
+		}
+
+		// we need the check for style in case a browser which returns unreliable values
+		// for getComputedStyle silently falls back to the reliable elem.style
+		valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
+
+		// Normalize "", auto, and prepare for extra
+		val = parseFloat( val ) || 0;
+	}
+
+	// use the active box-sizing model to add/subtract irrelevant styles
+	return ( val +
+		augmentWidthOrHeight(
+			elem,
+			name,
+			extra || ( isBorderBox ? "border" : "content" ),
+			valueIsBorderBox,
+			styles
+		)
+	) + "px";
+}
+
+// Try to determine the default display value of an element
+function css_defaultDisplay( nodeName ) {
+	var doc = document,
+		display = elemdisplay[ nodeName ];
+
+	if ( !display ) {
+		display = actualDisplay( nodeName, doc );
+
+		// If the simple way fails, read from inside an iframe
+		if ( display === "none" || !display ) {
+			// Use the already-created iframe if possible
+			iframe = ( iframe ||
+				jQuery("<iframe frameborder='0' width='0' height='0'/>")
+				.css( "cssText", "display:block !important" )
+			).appendTo( doc.documentElement );
+
+			// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
+			doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
+			doc.write("<!doctype html><html><body>");
+			doc.close();
+
+			display = actualDisplay( nodeName, doc );
+			iframe.detach();
+		}
+
+		// Store the correct default display
+		elemdisplay[ nodeName ] = display;
+	}
+
+	return display;
+}
+
+// Called ONLY from within css_defaultDisplay
+function actualDisplay( name, doc ) {
+	var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
+		display = jQuery.css( elem[0], "display" );
+	elem.remove();
+	return display;
+}
+
+jQuery.each([ "height", "width" ], function( i, name ) {
+	jQuery.cssHooks[ name ] = {
+		get: function( elem, computed, extra ) {
+			if ( computed ) {
+				// certain elements can have dimension info if we invisibly show them
+				// however, it must have a current display style that would benefit from this
+				return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
+					jQuery.swap( elem, cssShow, function() {
+						return getWidthOrHeight( elem, name, extra );
+					}) :
+					getWidthOrHeight( elem, name, extra );
+			}
+		},
+
+		set: function( elem, value, extra ) {
+			var styles = extra && getStyles( elem );
+			return setPositiveNumber( elem, value, extra ?
+				augmentWidthOrHeight(
+					elem,
+					name,
+					extra,
+					jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
+					styles
+				) : 0
+			);
+		}
+	};
+});
+
+if ( !jQuery.support.opacity ) {
+	jQuery.cssHooks.opacity = {
+		get: function( elem, computed ) {
+			// IE uses filters for opacity
+			return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
+				( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
+				computed ? "1" : "";
+		},
+
+		set: function( elem, value ) {
+			var style = elem.style,
+				currentStyle = elem.currentStyle,
+				opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
+				filter = currentStyle && currentStyle.filter || style.filter || "";
+
+			// IE has trouble with opacity if it does not have layout
+			// Force it by setting the zoom level
+			style.zoom = 1;
+
+			// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
+			// if value === "", then remove inline opacity #12685
+			if ( ( value >= 1 || value === "" ) &&
+					jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
+					style.removeAttribute ) {
+
+				// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
+				// if "filter:" is present at all, clearType is disabled, we want to avoid this
+				// style.removeAttribute is IE Only, but so apparently is this code path...
+				style.removeAttribute( "filter" );
+
+				// if there is no filter style applied in a css rule or unset inline opacity, we are done
+				if ( value === "" || currentStyle && !currentStyle.filter ) {
+					return;
+				}
+			}
+
+			// otherwise, set new filter values
+			style.filter = ralpha.test( filter ) ?
+				filter.replace( ralpha, opacity ) :
+				filter + " " + opacity;
+		}
+	};
+}
+
+// These hooks cannot be added until DOM ready because the support test
+// for it is not run until after DOM ready
+jQuery(function() {
+	if ( !jQuery.support.reliableMarginRight ) {
+		jQuery.cssHooks.marginRight = {
+			get: function( elem, computed ) {
+				if ( computed ) {
+					// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+					// Work around by temporarily setting element display to inline-block
+					return jQuery.swap( elem, { "display": "inline-block" },
+						curCSS, [ elem, "marginRight" ] );
+				}
+			}
+		};
+	}
+
+	// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
+	// getComputedStyle returns percent when specified for top/left/bottom/right
+	// rather than make the css module depend on the offset module, we just check for it here
+	if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
+		jQuery.each( [ "top", "left" ], function( i, prop ) {
+			jQuery.cssHooks[ prop ] = {
+				get: function( elem, computed ) {
+					if ( computed ) {
+						computed = curCSS( elem, prop );
+						// if curCSS returns percentage, fallback to offset
+						return rnumnonpx.test( computed ) ?
+							jQuery( elem ).position()[ prop ] + "px" :
+							computed;
+					}
+				}
+			};
+		});
+	}
+
+});
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+	jQuery.expr.filters.hidden = function( elem ) {
+		// Support: Opera <= 12.12
+		// Opera reports offsetWidths and offsetHeights less than zero on some elements
+		return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
+			(!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
+	};
+
+	jQuery.expr.filters.visible = function( elem ) {
+		return !jQuery.expr.filters.hidden( elem );
+	};
+}
+
+// These hooks are used by animate to expand properties
+jQuery.each({
+	margin: "",
+	padding: "",
+	border: "Width"
+}, function( prefix, suffix ) {
+	jQuery.cssHooks[ prefix + suffix ] = {
+		expand: function( value ) {
+			var i = 0,
+				expanded = {},
+
+				// assumes a single number if not a string
+				parts = typeof value === "string" ? value.split(" ") : [ value ];
+
+			for ( ; i < 4; i++ ) {
+				expanded[ prefix + cssExpand[ i ] + suffix ] =
+					parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
+			}
+
+			return expanded;
+		}
+	};
+
+	if ( !rmargin.test( prefix ) ) {
+		jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
+	}
+});
+var r20 = /%20/g,
+	rbracket = /\[\]$/,
+	rCRLF = /\r?\n/g,
+	rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
+	rsubmittable = /^(?:input|select|textarea|keygen)/i;
+
+jQuery.fn.extend({
+	serialize: function() {
+		return jQuery.param( this.serializeArray() );
+	},
+	serializeArray: function() {
+		return this.map(function(){
+			// Can add propHook for "elements" to filter or add form elements
+			var elements = jQuery.prop( this, "elements" );
+			return elements ? jQuery.makeArray( elements ) : this;
+		})
+		.filter(function(){
+			var type = this.type;
+			// Use .is(":disabled") so that fieldset[disabled] works
+			return this.name && !jQuery( this ).is( ":disabled" ) &&
+				rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
+				( this.checked || !manipulation_rcheckableType.test( type ) );
+		})
+		.map(function( i, elem ){
+			var val = jQuery( this ).val();
+
+			return val == null ?
+				null :
+				jQuery.isArray( val ) ?
+					jQuery.map( val, function( val ){
+						return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+					}) :
+					{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+		}).get();
+	}
+});
+
+//Serialize an array of form elements or a set of
+//key/values into a query string
+jQuery.param = function( a, traditional ) {
+	var prefix,
+		s = [],
+		add = function( key, value ) {
+			// If value is a function, invoke it and return its value
+			value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
+			s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
+		};
+
+	// Set traditional to true for jQuery <= 1.3.2 behavior.
+	if ( traditional === undefined ) {
+		traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
+	}
+
+	// If an array was passed in, assume that it is an array of form elements.
+	if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
+		// Serialize the form elements
+		jQuery.each( a, function() {
+			add( this.name, this.value );
+		});
+
+	} else {
+		// If traditional, encode the "old" way (the way 1.3.2 or older
+		// did it), otherwise encode params recursively.
+		for ( prefix in a ) {
+			buildParams( prefix, a[ prefix ], traditional, add );
+		}
+	}
+
+	// Return the resulting serialization
+	return s.join( "&" ).replace( r20, "+" );
+};
+
+function buildParams( prefix, obj, traditional, add ) {
+	var name;
+
+	if ( jQuery.isArray( obj ) ) {
+		// Serialize array item.
+		jQuery.each( obj, function( i, v ) {
+			if ( traditional || rbracket.test( prefix ) ) {
+				// Treat each array item as a scalar.
+				add( prefix, v );
+
+			} else {
+				// Item is non-scalar (array or object), encode its numeric index.
+				buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
+			}
+		});
+
+	} else if ( !traditional && jQuery.type( obj ) === "object" ) {
+		// Serialize object item.
+		for ( name in obj ) {
+			buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
+		}
+
+	} else {
+		// Serialize scalar item.
+		add( prefix, obj );
+	}
+}
+jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
+	"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
+	"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
+
+	// Handle event binding
+	jQuery.fn[ name ] = function( data, fn ) {
+		return arguments.length > 0 ?
+			this.on( name, null, data, fn ) :
+			this.trigger( name );
+	};
+});
+
+jQuery.fn.hover = function( fnOver, fnOut ) {
+	return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
+};
+var
+	// Document location
+	ajaxLocParts,
+	ajaxLocation,
+	ajax_nonce = jQuery.now(),
+
+	ajax_rquery = /\?/,
+	rhash = /#.*$/,
+	rts = /([?&])_=[^&]*/,
+	rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
+	// #7653, #8125, #8152: local protocol detection
+	rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
+	rnoContent = /^(?:GET|HEAD)$/,
+	rprotocol = /^\/\//,
+	rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
+
+	// Keep a copy of the old load method
+	_load = jQuery.fn.load,
+
+	/* Prefilters
+	 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
+	 * 2) These are called:
+	 *    - BEFORE asking for a transport
+	 *    - AFTER param serialization (s.data is a string if s.processData is true)
+	 * 3) key is the dataType
+	 * 4) the catchall symbol "*" can be used
+	 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
+	 */
+	prefilters = {},
+
+	/* Transports bindings
+	 * 1) key is the dataType
+	 * 2) the catchall symbol "*" can be used
+	 * 3) selection will start with transport dataType and THEN go to "*" if needed
+	 */
+	transports = {},
+
+	// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
+	allTypes = "*/".concat("*");
+
+// #8138, IE may throw an exception when accessing
+// a field from window.location if document.domain has been set
+try {
+	ajaxLocation = location.href;
+} catch( e ) {
+	// Use the href attribute of an A element
+	// since IE will modify it given document.location
+	ajaxLocation = document.createElement( "a" );
+	ajaxLocation.href = "";
+	ajaxLocation = ajaxLocation.href;
+}
+
+// Segment location into parts
+ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
+
+// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
+function addToPrefiltersOrTransports( structure ) {
+
+	// dataTypeExpression is optional and defaults to "*"
+	return function( dataTypeExpression, func ) {
+
+		if ( typeof dataTypeExpression !== "string" ) {
+			func = dataTypeExpression;
+			dataTypeExpression = "*";
+		}
+
+		var dataType,
+			i = 0,
+			dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
+
+		if ( jQuery.isFunction( func ) ) {
+			// For each dataType in the dataTypeExpression
+			while ( (dataType = dataTypes[i++]) ) {
+				// Prepend if requested
+				if ( dataType[0] === "+" ) {
+					dataType = dataType.slice( 1 ) || "*";
+					(structure[ dataType ] = structure[ dataType ] || []).unshift( func );
+
+				// Otherwise append
+				} else {
+					(structure[ dataType ] = structure[ dataType ] || []).push( func );
+				}
+			}
+		}
+	};
+}
+
+// Base inspection function for prefilters and transports
+function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
+
+	var inspected = {},
+		seekingTransport = ( structure === transports );
+
+	function inspect( dataType ) {
+		var selected;
+		inspected[ dataType ] = true;
+		jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
+			var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
+			if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
+				options.dataTypes.unshift( dataTypeOrTransport );
+				inspect( dataTypeOrTransport );
+				return false;
+			} else if ( seekingTransport ) {
+				return !( selected = dataTypeOrTransport );
+			}
+		});
+		return selected;
+	}
+
+	return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
+}
+
+// A special extend for ajax options
+// that takes "flat" options (not to be deep extended)
+// Fixes #9887
+function ajaxExtend( target, src ) {
+	var deep, key,
+		flatOptions = jQuery.ajaxSettings.flatOptions || {};
+
+	for ( key in src ) {
+		if ( src[ key ] !== undefined ) {
+			( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
+		}
+	}
+	if ( deep ) {
+		jQuery.extend( true, target, deep );
+	}
+
+	return target;
+}
+
+jQuery.fn.load = function( url, params, callback ) {
+	if ( typeof url !== "string" && _load ) {
+		return _load.apply( this, arguments );
+	}
+
+	var selector, response, type,
+		self = this,
+		off = url.indexOf(" ");
+
+	if ( off >= 0 ) {
+		selector = url.slice( off, url.length );
+		url = url.slice( 0, off );
+	}
+
+	// If it's a function
+	if ( jQuery.isFunction( params ) ) {
+
+		// We assume that it's the callback
+		callback = params;
+		params = undefined;
+
+	// Otherwise, build a param string
+	} else if ( params && typeof params === "object" ) {
+		type = "POST";
+	}
+
+	// If we have elements to modify, make the request
+	if ( self.length > 0 ) {
+		jQuery.ajax({
+			url: url,
+
+			// if "type" variable is undefined, then "GET" method will be used
+			type: type,
+			dataType: "html",
+			data: params
+		}).done(function( responseText ) {
+
+			// Save response for use in complete callback
+			response = arguments;
+
+			self.html( selector ?
+
+				// If a selector was specified, locate the right elements in a dummy div
+				// Exclude scripts to avoid IE 'Permission Denied' errors
+				jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
+
+				// Otherwise use the full result
+				responseText );
+
+		}).complete( callback && function( jqXHR, status ) {
+			self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
+		});
+	}
+
+	return this;
+};
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
+	jQuery.fn[ type ] = function( fn ){
+		return this.on( type, fn );
+	};
+});
+
+jQuery.each( [ "get", "post" ], function( i, method ) {
+	jQuery[ method ] = function( url, data, callback, type ) {
+		// shift arguments if data argument was omitted
+		if ( jQuery.isFunction( data ) ) {
+			type = type || callback;
+			callback = data;
+			data = undefined;
+		}
+
+		return jQuery.ajax({
+			url: url,
+			type: method,
+			dataType: type,
+			data: data,
+			success: callback
+		});
+	};
+});
+
+jQuery.extend({
+
+	// Counter for holding the number of active queries
+	active: 0,
+
+	// Last-Modified header cache for next request
+	lastModified: {},
+	etag: {},
+
+	ajaxSettings: {
+		url: ajaxLocation,
+		type: "GET",
+		isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
+		global: true,
+		processData: true,
+		async: true,
+		contentType: "application/x-www-form-urlencoded; charset=UTF-8",
+		/*
+		timeout: 0,
+		data: null,
+		dataType: null,
+		username: null,
+		password: null,
+		cache: null,
+		throws: false,
+		traditional: false,
+		headers: {},
+		*/
+
+		accepts: {
+			"*": allTypes,
+			text: "text/plain",
+			html: "text/html",
+			xml: "application/xml, text/xml",
+			json: "application/json, text/javascript"
+		},
+
+		contents: {
+			xml: /xml/,
+			html: /html/,
+			json: /json/
+		},
+
+		responseFields: {
+			xml: "responseXML",
+			text: "responseText"
+		},
+
+		// Data converters
+		// Keys separate source (or catchall "*") and destination types with a single space
+		converters: {
+
+			// Convert anything to text
+			"* text": window.String,
+
+			// Text to html (true = no transformation)
+			"text html": true,
+
+			// Evaluate text as a json expression
+			"text json": jQuery.parseJSON,
+
+			// Parse text as xml
+			"text xml": jQuery.parseXML
+		},
+
+		// For options that shouldn't be deep extended:
+		// you can add your own custom options here if
+		// and when you create one that shouldn't be
+		// deep extended (see ajaxExtend)
+		flatOptions: {
+			url: true,
+			context: true
+		}
+	},
+
+	// Creates a full fledged settings object into target
+	// with both ajaxSettings and settings fields.
+	// If target is omitted, writes into ajaxSettings.
+	ajaxSetup: function( target, settings ) {
+		return settings ?
+
+			// Building a settings object
+			ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
+
+			// Extending ajaxSettings
+			ajaxExtend( jQuery.ajaxSettings, target );
+	},
+
+	ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
+	ajaxTransport: addToPrefiltersOrTransports( transports ),
+
+	// Main method
+	ajax: function( url, options ) {
+
+		// If url is an object, simulate pre-1.5 signature
+		if ( typeof url === "object" ) {
+			options = url;
+			url = undefined;
+		}
+
+		// Force options to be an object
+		options = options || {};
+
+		var // Cross-domain detection vars
+			parts,
+			// Loop variable
+			i,
+			// URL without anti-cache param
+			cacheURL,
+			// Response headers as string
+			responseHeadersString,
+			// timeout handle
+			timeoutTimer,
+
+			// To know if global events are to be dispatched
+			fireGlobals,
+
+			transport,
+			// Response headers
+			responseHeaders,
+			// Create the final options object
+			s = jQuery.ajaxSetup( {}, options ),
+			// Callbacks context
+			callbackContext = s.context || s,
+			// Context for global events is callbackContext if it is a DOM node or jQuery collection
+			globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
+				jQuery( callbackContext ) :
+				jQuery.event,
+			// Deferreds
+			deferred = jQuery.Deferred(),
+			completeDeferred = jQuery.Callbacks("once memory"),
+			// Status-dependent callbacks
+			statusCode = s.statusCode || {},
+			// Headers (they are sent all at once)
+			requestHeaders = {},
+			requestHeadersNames = {},
+			// The jqXHR state
+			state = 0,
+			// Default abort message
+			strAbort = "canceled",
+			// Fake xhr
+			jqXHR = {
+				readyState: 0,
+
+				// Builds headers hashtable if needed
+				getResponseHeader: function( key ) {
+					var match;
+					if ( state === 2 ) {
+						if ( !responseHeaders ) {
+							responseHeaders = {};
+							while ( (match = rheaders.exec( responseHeadersString )) ) {
+								responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
+							}
+						}
+						match = responseHeaders[ key.toLowerCase() ];
+					}
+					return match == null ? null : match;
+				},
+
+				// Raw string
+				getAllResponseHeaders: function() {
+					return state === 2 ? responseHeadersString : null;
+				},
+
+				// Caches the header
+				setRequestHeader: function( name, value ) {
+					var lname = name.toLowerCase();
+					if ( !state ) {
+						name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
+						requestHeaders[ name ] = value;
+					}
+					return this;
+				},
+
+				// Overrides response content-type header
+				overrideMimeType: function( type ) {
+					if ( !state ) {
+						s.mimeType = type;
+					}
+					return this;
+				},
+
+				// Status-dependent callbacks
+				statusCode: function( map ) {
+					var code;
+					if ( map ) {
+						if ( state < 2 ) {
+							for ( code in map ) {
+								// Lazy-add the new callback in a way that preserves old ones
+								statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
+							}
+						} else {
+							// Execute the appropriate callbacks
+							jqXHR.always( map[ jqXHR.status ] );
+						}
+					}
+					return this;
+				},
+
+				// Cancel the request
+				abort: function( statusText ) {
+					var finalText = statusText || strAbort;
+					if ( transport ) {
+						transport.abort( finalText );
+					}
+					done( 0, finalText );
+					return this;
+				}
+			};
+
+		// Attach deferreds
+		deferred.promise( jqXHR ).complete = completeDeferred.add;
+		jqXHR.success = jqXHR.done;
+		jqXHR.error = jqXHR.fail;
+
+		// Remove hash character (#7531: and string promotion)
+		// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
+		// Handle falsy url in the settings object (#10093: consistency with old signature)
+		// We also use the url parameter if available
+		s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
+
+		// Alias method option to type as per ticket #12004
+		s.type = options.method || options.type || s.method || s.type;
+
+		// Extract dataTypes list
+		s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
+
+		// A cross-domain request is in order when we have a protocol:host:port mismatch
+		if ( s.crossDomain == null ) {
+			parts = rurl.exec( s.url.toLowerCase() );
+			s.crossDomain = !!( parts &&
+				( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
+					( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
+						( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
+			);
+		}
+
+		// Convert data if not already a string
+		if ( s.data && s.processData && typeof s.data !== "string" ) {
+			s.data = jQuery.param( s.data, s.traditional );
+		}
+
+		// Apply prefilters
+		inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
+
+		// If request was aborted inside a prefilter, stop there
+		if ( state === 2 ) {
+			return jqXHR;
+		}
+
+		// We can fire global events as of now if asked to
+		fireGlobals = s.global;
+
+		// Watch for a new set of requests
+		if ( fireGlobals && jQuery.active++ === 0 ) {
+			jQuery.event.trigger("ajaxStart");
+		}
+
+		// Uppercase the type
+		s.type = s.type.toUpperCase();
+
+		// Determine if request has content
+		s.hasContent = !rnoContent.test( s.type );
+
+		// Save the URL in case we're toying with the If-Modified-Since
+		// and/or If-None-Match header later on
+		cacheURL = s.url;
+
+		// More options handling for requests with no content
+		if ( !s.hasContent ) {
+
+			// If data is available, append data to url
+			if ( s.data ) {
+				cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
+				// #9682: remove data so that it's not used in an eventual retry
+				delete s.data;
+			}
+
+			// Add anti-cache in url if needed
+			if ( s.cache === false ) {
+				s.url = rts.test( cacheURL ) ?
+
+					// If there is already a '_' parameter, set its value
+					cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
+
+					// Otherwise add one to the end
+					cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
+			}
+		}
+
+		// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+		if ( s.ifModified ) {
+			if ( jQuery.lastModified[ cacheURL ] ) {
+				jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
+			}
+			if ( jQuery.etag[ cacheURL ] ) {
+				jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
+			}
+		}
+
+		// Set the correct header, if data is being sent
+		if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
+			jqXHR.setRequestHeader( "Content-Type", s.contentType );
+		}
+
+		// Set the Accepts header for the server, depending on the dataType
+		jqXHR.setRequestHeader(
+			"Accept",
+			s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
+				s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
+				s.accepts[ "*" ]
+		);
+
+		// Check for headers option
+		for ( i in s.headers ) {
+			jqXHR.setRequestHeader( i, s.headers[ i ] );
+		}
+
+		// Allow custom headers/mimetypes and early abort
+		if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
+			// Abort if not done already and return
+			return jqXHR.abort();
+		}
+
+		// aborting is no longer a cancellation
+		strAbort = "abort";
+
+		// Install callbacks on deferreds
+		for ( i in { success: 1, error: 1, complete: 1 } ) {
+			jqXHR[ i ]( s[ i ] );
+		}
+
+		// Get transport
+		transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
+
+		// If no transport, we auto-abort
+		if ( !transport ) {
+			done( -1, "No Transport" );
+		} else {
+			jqXHR.readyState = 1;
+
+			// Send global event
+			if ( fireGlobals ) {
+				globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
+			}
+			// Timeout
+			if ( s.async && s.timeout > 0 ) {
+				timeoutTimer = setTimeout(function() {
+					jqXHR.abort("timeout");
+				}, s.timeout );
+			}
+
+			try {
+				state = 1;
+				transport.send( requestHeaders, done );
+			} catch ( e ) {
+				// Propagate exception as error if not done
+				if ( state < 2 ) {
+					done( -1, e );
+				// Simply rethrow otherwise
+				} else {
+					throw e;
+				}
+			}
+		}
+
+		// Callback for when everything is done
+		function done( status, nativeStatusText, responses, headers ) {
+			var isSuccess, success, error, response, modified,
+				statusText = nativeStatusText;
+
+			// Called once
+			if ( state === 2 ) {
+				return;
+			}
+
+			// State is "done" now
+			state = 2;
+
+			// Clear timeout if it exists
+			if ( timeoutTimer ) {
+				clearTimeout( timeoutTimer );
+			}
+
+			// Dereference transport for early garbage collection
+			// (no matter how long the jqXHR object will be used)
+			transport = undefined;
+
+			// Cache response headers
+			responseHeadersString = headers || "";
+
+			// Set readyState
+			jqXHR.readyState = status > 0 ? 4 : 0;
+
+			// Get response data
+			if ( responses ) {
+				response = ajaxHandleResponses( s, jqXHR, responses );
+			}
+
+			// If successful, handle type chaining
+			if ( status >= 200 && status < 300 || status === 304 ) {
+
+				// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+				if ( s.ifModified ) {
+					modified = jqXHR.getResponseHeader("Last-Modified");
+					if ( modified ) {
+						jQuery.lastModified[ cacheURL ] = modified;
+					}
+					modified = jqXHR.getResponseHeader("etag");
+					if ( modified ) {
+						jQuery.etag[ cacheURL ] = modified;
+					}
+				}
+
+				// if no content
+				if ( status === 204 ) {
+					isSuccess = true;
+					statusText = "nocontent";
+
+				// if not modified
+				} else if ( status === 304 ) {
+					isSuccess = true;
+					statusText = "notmodified";
+
+				// If we have data, let's convert it
+				} else {
+					isSuccess = ajaxConvert( s, response );
+					statusText = isSuccess.state;
+					success = isSuccess.data;
+					error = isSuccess.error;
+					isSuccess = !error;
+				}
+			} else {
+				// We extract error from statusText
+				// then normalize statusText and status for non-aborts
+				error = statusText;
+				if ( status || !statusText ) {
+					statusText = "error";
+					if ( status < 0 ) {
+						status = 0;
+					}
+				}
+			}
+
+			// Set data for the fake xhr object
+			jqXHR.status = status;
+			jqXHR.statusText = ( nativeStatusText || statusText ) + "";
+
+			// Success/Error
+			if ( isSuccess ) {
+				deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
+			} else {
+				deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
+			}
+
+			// Status-dependent callbacks
+			jqXHR.statusCode( statusCode );
+			statusCode = undefined;
+
+			if ( fireGlobals ) {
+				globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
+					[ jqXHR, s, isSuccess ? success : error ] );
+			}
+
+			// Complete
+			completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
+
+			if ( fireGlobals ) {
+				globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
+				// Handle the global AJAX counter
+				if ( !( --jQuery.active ) ) {
+					jQuery.event.trigger("ajaxStop");
+				}
+			}
+		}
+
+		return jqXHR;
+	},
+
+	getScript: function( url, callback ) {
+		return jQuery.get( url, undefined, callback, "script" );
+	},
+
+	getJSON: function( url, data, callback ) {
+		return jQuery.get( url, data, callback, "json" );
+	}
+});
+
+/* Handles responses to an ajax request:
+ * - sets all responseXXX fields accordingly
+ * - finds the right dataType (mediates between content-type and expected dataType)
+ * - returns the corresponding response
+ */
+function ajaxHandleResponses( s, jqXHR, responses ) {
+	var firstDataType, ct, finalDataType, type,
+		contents = s.contents,
+		dataTypes = s.dataTypes,
+		responseFields = s.responseFields;
+
+	// Fill responseXXX fields
+	for ( type in responseFields ) {
+		if ( type in responses ) {
+			jqXHR[ responseFields[type] ] = responses[ type ];
+		}
+	}
+
+	// Remove auto dataType and get content-type in the process
+	while( dataTypes[ 0 ] === "*" ) {
+		dataTypes.shift();
+		if ( ct === undefined ) {
+			ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
+		}
+	}
+
+	// Check if we're dealing with a known content-type
+	if ( ct ) {
+		for ( type in contents ) {
+			if ( contents[ type ] && contents[ type ].test( ct ) ) {
+				dataTypes.unshift( type );
+				break;
+			}
+		}
+	}
+
+	// Check to see if we have a response for the expected dataType
+	if ( dataTypes[ 0 ] in responses ) {
+		finalDataType = dataTypes[ 0 ];
+	} else {
+		// Try convertible dataTypes
+		for ( type in responses ) {
+			if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
+				finalDataType = type;
+				break;
+			}
+			if ( !firstDataType ) {
+				firstDataType = type;
+			}
+		}
+		// Or just use first one
+		finalDataType = finalDataType || firstDataType;
+	}
+
+	// If we found a dataType
+	// We add the dataType to the list if needed
+	// and return the corresponding response
+	if ( finalDataType ) {
+		if ( finalDataType !== dataTypes[ 0 ] ) {
+			dataTypes.unshift( finalDataType );
+		}
+		return responses[ finalDataType ];
+	}
+}
+
+// Chain conversions given the request and the original response
+function ajaxConvert( s, response ) {
+	var conv2, current, conv, tmp,
+		converters = {},
+		i = 0,
+		// Work with a copy of dataTypes in case we need to modify it for conversion
+		dataTypes = s.dataTypes.slice(),
+		prev = dataTypes[ 0 ];
+
+	// Apply the dataFilter if provided
+	if ( s.dataFilter ) {
+		response = s.dataFilter( response, s.dataType );
+	}
+
+	// Create converters map with lowercased keys
+	if ( dataTypes[ 1 ] ) {
+		for ( conv in s.converters ) {
+			converters[ conv.toLowerCase() ] = s.converters[ conv ];
+		}
+	}
+
+	// Convert to each sequential dataType, tolerating list modification
+	for ( ; (current = dataTypes[++i]); ) {
+
+		// There's only work to do if current dataType is non-auto
+		if ( current !== "*" ) {
+
+			// Convert response if prev dataType is non-auto and differs from current
+			if ( prev !== "*" && prev !== current ) {
+
+				// Seek a direct converter
+				conv = converters[ prev + " " + current ] || converters[ "* " + current ];
+
+				// If none found, seek a pair
+				if ( !conv ) {
+					for ( conv2 in converters ) {
+
+						// If conv2 outputs current
+						tmp = conv2.split(" ");
+						if ( tmp[ 1 ] === current ) {
+
+							// If prev can be converted to accepted input
+							conv = converters[ prev + " " + tmp[ 0 ] ] ||
+								converters[ "* " + tmp[ 0 ] ];
+							if ( conv ) {
+								// Condense equivalence converters
+								if ( conv === true ) {
+									conv = converters[ conv2 ];
+
+								// Otherwise, insert the intermediate dataType
+								} else if ( converters[ conv2 ] !== true ) {
+									current = tmp[ 0 ];
+									dataTypes.splice( i--, 0, current );
+								}
+
+								break;
+							}
+						}
+					}
+				}
+
+				// Apply converter (if not an equivalence)
+				if ( conv !== true ) {
+
+					// Unless errors are allowed to bubble, catch and return them
+					if ( conv && s["throws"] ) {
+						response = conv( response );
+					} else {
+						try {
+							response = conv( response );
+						} catch ( e ) {
+							return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
+						}
+					}
+				}
+			}
+
+			// Update prev for next iteration
+			prev = current;
+		}
+	}
+
+	return { state: "success", data: response };
+}
+// Install script dataType
+jQuery.ajaxSetup({
+	accepts: {
+		script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
+	},
+	contents: {
+		script: /(?:java|ecma)script/
+	},
+	converters: {
+		"text script": function( text ) {
+			jQuery.globalEval( text );
+			return text;
+		}
+	}
+});
+
+// Handle cache's special case and global
+jQuery.ajaxPrefilter( "script", function( s ) {
+	if ( s.cache === undefined ) {
+		s.cache = false;
+	}
+	if ( s.crossDomain ) {
+		s.type = "GET";
+		s.global = false;
+	}
+});
+
+// Bind script tag hack transport
+jQuery.ajaxTransport( "script", function(s) {
+
+	// This transport only deals with cross domain requests
+	if ( s.crossDomain ) {
+
+		var script,
+			head = document.head || jQuery("head")[0] || document.documentElement;
+
+		return {
+
+			send: function( _, callback ) {
+
+				script = document.createElement("script");
+
+				script.async = true;
+
+				if ( s.scriptCharset ) {
+					script.charset = s.scriptCharset;
+				}
+
+				script.src = s.url;
+
+				// Attach handlers for all browsers
+				script.onload = script.onreadystatechange = function( _, isAbort ) {
+
+					if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
+
+						// Handle memory leak in IE
+						script.onload = script.onreadystatechange = null;
+
+						// Remove the script
+						if ( script.parentNode ) {
+							script.parentNode.removeChild( script );
+						}
+
+						// Dereference the script
+						script = null;
+
+						// Callback if not abort
+						if ( !isAbort ) {
+							callback( 200, "success" );
+						}
+					}
+				};
+
+				// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
+				// Use native DOM manipulation to avoid our domManip AJAX trickery
+				head.insertBefore( script, head.firstChild );
+			},
+
+			abort: function() {
+				if ( script ) {
+					script.onload( undefined, true );
+				}
+			}
+		};
+	}
+});
+var oldCallbacks = [],
+	rjsonp = /(=)\?(?=&|$)|\?\?/;
+
+// Default jsonp settings
+jQuery.ajaxSetup({
+	jsonp: "callback",
+	jsonpCallback: function() {
+		var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
+		this[ callback ] = true;
+		return callback;
+	}
+});
+
+// Detect, normalize options and install callbacks for jsonp requests
+jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
+
+	var callbackName, overwritten, responseContainer,
+		jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
+			"url" :
+			typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
+		);
+
+	// Handle iff the expected data type is "jsonp" or we have a parameter to set
+	if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
+
+		// Get callback name, remembering preexisting value associated with it
+		callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
+			s.jsonpCallback() :
+			s.jsonpCallback;
+
+		// Insert callback into url or form data
+		if ( jsonProp ) {
+			s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
+		} else if ( s.jsonp !== false ) {
+			s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
+		}
+
+		// Use data converter to retrieve json after script execution
+		s.converters["script json"] = function() {
+			if ( !responseContainer ) {
+				jQuery.error( callbackName + " was not called" );
+			}
+			return responseContainer[ 0 ];
+		};
+
+		// force json dataType
+		s.dataTypes[ 0 ] = "json";
+
+		// Install callback
+		overwritten = window[ callbackName ];
+		window[ callbackName ] = function() {
+			responseContainer = arguments;
+		};
+
+		// Clean-up function (fires after converters)
+		jqXHR.always(function() {
+			// Restore preexisting value
+			window[ callbackName ] = overwritten;
+
+			// Save back as free
+			if ( s[ callbackName ] ) {
+				// make sure that re-using the options doesn't screw things around
+				s.jsonpCallback = originalSettings.jsonpCallback;
+
+				// save the callback name for future use
+				oldCallbacks.push( callbackName );
+			}
+
+			// Call if it was a function and we have a response
+			if ( responseContainer && jQuery.isFunction( overwritten ) ) {
+				overwritten( responseContainer[ 0 ] );
+			}
+
+			responseContainer = overwritten = undefined;
+		});
+
+		// Delegate to script
+		return "script";
+	}
+});
+var xhrCallbacks, xhrSupported,
+	xhrId = 0,
+	// #5280: Internet Explorer will keep connections alive if we don't abort on unload
+	xhrOnUnloadAbort = window.ActiveXObject && function() {
+		// Abort all pending requests
+		var key;
+		for ( key in xhrCallbacks ) {
+			xhrCallbacks[ key ]( undefined, true );
+		}
+	};
+
+// Functions to create xhrs
+function createStandardXHR() {
+	try {
+		return new window.XMLHttpRequest();
+	} catch( e ) {}
+}
+
+function createActiveXHR() {
+	try {
+		return new window.ActiveXObject("Microsoft.XMLHTTP");
+	} catch( e ) {}
+}
+
+// Create the request object
+// (This is still attached to ajaxSettings for backward compatibility)
+jQuery.ajaxSettings.xhr = window.ActiveXObject ?
+	/* Microsoft failed to properly
+	 * implement the XMLHttpRequest in IE7 (can't request local files),
+	 * so we use the ActiveXObject when it is available
+	 * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
+	 * we need a fallback.
+	 */
+	function() {
+		return !this.isLocal && createStandardXHR() || createActiveXHR();
+	} :
+	// For all other browsers, use the standard XMLHttpRequest object
+	createStandardXHR;
+
+// Determine support properties
+xhrSupported = jQuery.ajaxSettings.xhr();
+jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
+xhrSupported = jQuery.support.ajax = !!xhrSupported;
+
+// Create transport if the browser can provide an xhr
+if ( xhrSupported ) {
+
+	jQuery.ajaxTransport(function( s ) {
+		// Cross domain only allowed if supported through XMLHttpRequest
+		if ( !s.crossDomain || jQuery.support.cors ) {
+
+			var callback;
+
+			return {
+				send: function( headers, complete ) {
+
+					// Get a new xhr
+					var handle, i,
+						xhr = s.xhr();
+
+					// Open the socket
+					// Passing null username, generates a login popup on Opera (#2865)
+					if ( s.username ) {
+						xhr.open( s.type, s.url, s.async, s.username, s.password );
+					} else {
+						xhr.open( s.type, s.url, s.async );
+					}
+
+					// Apply custom fields if provided
+					if ( s.xhrFields ) {
+						for ( i in s.xhrFields ) {
+							xhr[ i ] = s.xhrFields[ i ];
+						}
+					}
+
+					// Override mime type if needed
+					if ( s.mimeType && xhr.overrideMimeType ) {
+						xhr.overrideMimeType( s.mimeType );
+					}
+
+					// X-Requested-With header
+					// For cross-domain requests, seeing as conditions for a preflight are
+					// akin to a jigsaw puzzle, we simply never set it to be sure.
+					// (it can always be set on a per-request basis or even using ajaxSetup)
+					// For same-domain requests, won't change header if already provided.
+					if ( !s.crossDomain && !headers["X-Requested-With"] ) {
+						headers["X-Requested-With"] = "XMLHttpRequest";
+					}
+
+					// Need an extra try/catch for cross domain requests in Firefox 3
+					try {
+						for ( i in headers ) {
+							xhr.setRequestHeader( i, headers[ i ] );
+						}
+					} catch( err ) {}
+
+					// Do send the request
+					// This may raise an exception which is actually
+					// handled in jQuery.ajax (so no try/catch here)
+					xhr.send( ( s.hasContent && s.data ) || null );
+
+					// Listener
+					callback = function( _, isAbort ) {
+						var status, responseHeaders, statusText, responses;
+
+						// Firefox throws exceptions when accessing properties
+						// of an xhr when a network error occurred
+						// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
+						try {
+
+							// Was never called and is aborted or complete
+							if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
+
+								// Only called once
+								callback = undefined;
+
+								// Do not keep as active anymore
+								if ( handle ) {
+									xhr.onreadystatechange = jQuery.noop;
+									if ( xhrOnUnloadAbort ) {
+										delete xhrCallbacks[ handle ];
+									}
+								}
+
+								// If it's an abort
+								if ( isAbort ) {
+									// Abort it manually if needed
+									if ( xhr.readyState !== 4 ) {
+										xhr.abort();
+									}
+								} else {
+									responses = {};
+									status = xhr.status;
+									responseHeaders = xhr.getAllResponseHeaders();
+
+									// When requesting binary data, IE6-9 will throw an exception
+									// on any attempt to access responseText (#11426)
+									if ( typeof xhr.responseText === "string" ) {
+										responses.text = xhr.responseText;
+									}
+
+									// Firefox throws an exception when accessing
+									// statusText for faulty cross-domain requests
+									try {
+										statusText = xhr.statusText;
+									} catch( e ) {
+										// We normalize with Webkit giving an empty statusText
+										statusText = "";
+									}
+
+									// Filter status for non standard behaviors
+
+									// If the request is local and we have data: assume a success
+									// (success with no data won't get notified, that's the best we
+									// can do given current implementations)
+									if ( !status && s.isLocal && !s.crossDomain ) {
+										status = responses.text ? 200 : 404;
+									// IE - #1450: sometimes returns 1223 when it should be 204
+									} else if ( status === 1223 ) {
+										status = 204;
+									}
+								}
+							}
+						} catch( firefoxAccessException ) {
+							if ( !isAbort ) {
+								complete( -1, firefoxAccessException );
+							}
+						}
+
+						// Call complete if needed
+						if ( responses ) {
+							complete( status, statusText, responses, responseHeaders );
+						}
+					};
+
+					if ( !s.async ) {
+						// if we're in sync mode we fire the callback
+						callback();
+					} else if ( xhr.readyState === 4 ) {
+						// (IE6 & IE7) if it's in cache and has been
+						// retrieved directly we need to fire the callback
+						setTimeout( callback );
+					} else {
+						handle = ++xhrId;
+						if ( xhrOnUnloadAbort ) {
+							// Create the active xhrs callbacks list if needed
+							// and attach the unload handler
+							if ( !xhrCallbacks ) {
+								xhrCallbacks = {};
+								jQuery( window ).unload( xhrOnUnloadAbort );
+							}
+							// Add to list of active xhrs callbacks
+							xhrCallbacks[ handle ] = callback;
+						}
+						xhr.onreadystatechange = callback;
+					}
+				},
+
+				abort: function() {
+					if ( callback ) {
+						callback( undefined, true );
+					}
+				}
+			};
+		}
+	});
+}
+var fxNow, timerId,
+	rfxtypes = /^(?:toggle|show|hide)$/,
+	rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
+	rrun = /queueHooks$/,
+	animationPrefilters = [ defaultPrefilter ],
+	tweeners = {
+		"*": [function( prop, value ) {
+			var end, unit,
+				tween = this.createTween( prop, value ),
+				parts = rfxnum.exec( value ),
+				target = tween.cur(),
+				start = +target || 0,
+				scale = 1,
+				maxIterations = 20;
+
+			if ( parts ) {
+				end = +parts[2];
+				unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
+
+				// We need to compute starting value
+				if ( unit !== "px" && start ) {
+					// Iteratively approximate from a nonzero starting point
+					// Prefer the current property, because this process will be trivial if it uses the same units
+					// Fallback to end or a simple constant
+					start = jQuery.css( tween.elem, prop, true ) || end || 1;
+
+					do {
+						// If previous iteration zeroed out, double until we get *something*
+						// Use a string for doubling factor so we don't accidentally see scale as unchanged below
+						scale = scale || ".5";
+
+						// Adjust and apply
+						start = start / scale;
+						jQuery.style( tween.elem, prop, start + unit );
+
+					// Update scale, tolerating zero or NaN from tween.cur()
+					// And breaking the loop if scale is unchanged or perfect, or if we've just had enough
+					} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
+				}
+
+				tween.unit = unit;
+				tween.start = start;
+				// If a +=/-= token was provided, we're doing a relative animation
+				tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
+			}
+			return tween;
+		}]
+	};
+
+// Animations created synchronously will run synchronously
+function createFxNow() {
+	setTimeout(function() {
+		fxNow = undefined;
+	});
+	return ( fxNow = jQuery.now() );
+}
+
+function createTweens( animation, props ) {
+	jQuery.each( props, function( prop, value ) {
+		var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
+			index = 0,
+			length = collection.length;
+		for ( ; index < length; index++ ) {
+			if ( collection[ index ].call( animation, prop, value ) ) {
+
+				// we're done with this property
+				return;
+			}
+		}
+	});
+}
+
+function Animation( elem, properties, options ) {
+	var result,
+		stopped,
+		index = 0,
+		length = animationPrefilters.length,
+		deferred = jQuery.Deferred().always( function() {
+			// don't match elem in the :animated selector
+			delete tick.elem;
+		}),
+		tick = function() {
+			if ( stopped ) {
+				return false;
+			}
+			var currentTime = fxNow || createFxNow(),
+				remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
+				// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
+				temp = remaining / animation.duration || 0,
+				percent = 1 - temp,
+				index = 0,
+				length = animation.tweens.length;
+
+			for ( ; index < length ; index++ ) {
+				animation.tweens[ index ].run( percent );
+			}
+
+			deferred.notifyWith( elem, [ animation, percent, remaining ]);
+
+			if ( percent < 1 && length ) {
+				return remaining;
+			} else {
+				deferred.resolveWith( elem, [ animation ] );
+				return false;
+			}
+		},
+		animation = deferred.promise({
+			elem: elem,
+			props: jQuery.extend( {}, properties ),
+			opts: jQuery.extend( true, { specialEasing: {} }, options ),
+			originalProperties: properties,
+			originalOptions: options,
+			startTime: fxNow || createFxNow(),
+			duration: options.duration,
+			tweens: [],
+			createTween: function( prop, end ) {
+				var tween = jQuery.Tween( elem, animation.opts, prop, end,
+						animation.opts.specialEasing[ prop ] || animation.opts.easing );
+				animation.tweens.push( tween );
+				return tween;
+			},
+			stop: function( gotoEnd ) {
+				var index = 0,
+					// if we are going to the end, we want to run all the tweens
+					// otherwise we skip this part
+					length = gotoEnd ? animation.tweens.length : 0;
+				if ( stopped ) {
+					return this;
+				}
+				stopped = true;
+				for ( ; index < length ; index++ ) {
+					animation.tweens[ index ].run( 1 );
+				}
+
+				// resolve when we played the last frame
+				// otherwise, reject
+				if ( gotoEnd ) {
+					deferred.resolveWith( elem, [ animation, gotoEnd ] );
+				} else {
+					deferred.rejectWith( elem, [ animation, gotoEnd ] );
+				}
+				return this;
+			}
+		}),
+		props = animation.props;
+
+	propFilter( props, animation.opts.specialEasing );
+
+	for ( ; index < length ; index++ ) {
+		result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
+		if ( result ) {
+			return result;
+		}
+	}
+
+	createTweens( animation, props );
+
+	if ( jQuery.isFunction( animation.opts.start ) ) {
+		animation.opts.start.call( elem, animation );
+	}
+
+	jQuery.fx.timer(
+		jQuery.extend( tick, {
+			elem: elem,
+			anim: animation,
+			queue: animation.opts.queue
+		})
+	);
+
+	// attach callbacks from options
+	return animation.progress( animation.opts.progress )
+		.done( animation.opts.done, animation.opts.complete )
+		.fail( animation.opts.fail )
+		.always( animation.opts.always );
+}
+
+function propFilter( props, specialEasing ) {
+	var value, name, index, easing, hooks;
+
+	// camelCase, specialEasing and expand cssHook pass
+	for ( index in props ) {
+		name = jQuery.camelCase( index );
+		easing = specialEasing[ name ];
+		value = props[ index ];
+		if ( jQuery.isArray( value ) ) {
+			easing = value[ 1 ];
+			value = props[ index ] = value[ 0 ];
+		}
+
+		if ( index !== name ) {
+			props[ name ] = value;
+			delete props[ index ];
+		}
+
+		hooks = jQuery.cssHooks[ name ];
+		if ( hooks && "expand" in hooks ) {
+			value = hooks.expand( value );
+			delete props[ name ];
+
+			// not quite $.extend, this wont overwrite keys already present.
+			// also - reusing 'index' from above because we have the correct "name"
+			for ( index in value ) {
+				if ( !( index in props ) ) {
+					props[ index ] = value[ index ];
+					specialEasing[ index ] = easing;
+				}
+			}
+		} else {
+			specialEasing[ name ] = easing;
+		}
+	}
+}
+
+jQuery.Animation = jQuery.extend( Animation, {
+
+	tweener: function( props, callback ) {
+		if ( jQuery.isFunction( props ) ) {
+			callback = props;
+			props = [ "*" ];
+		} else {
+			props = props.split(" ");
+		}
+
+		var prop,
+			index = 0,
+			length = props.length;
+
+		for ( ; index < length ; index++ ) {
+			prop = props[ index ];
+			tweeners[ prop ] = tweeners[ prop ] || [];
+			tweeners[ prop ].unshift( callback );
+		}
+	},
+
+	prefilter: function( callback, prepend ) {
+		if ( prepend ) {
+			animationPrefilters.unshift( callback );
+		} else {
+			animationPrefilters.push( callback );
+		}
+	}
+});
+
+function defaultPrefilter( elem, props, opts ) {
+	/*jshint validthis:true */
+	var prop, index, length,
+		value, dataShow, toggle,
+		tween, hooks, oldfire,
+		anim = this,
+		style = elem.style,
+		orig = {},
+		handled = [],
+		hidden = elem.nodeType && isHidden( elem );
+
+	// handle queue: false promises
+	if ( !opts.queue ) {
+		hooks = jQuery._queueHooks( elem, "fx" );
+		if ( hooks.unqueued == null ) {
+			hooks.unqueued = 0;
+			oldfire = hooks.empty.fire;
+			hooks.empty.fire = function() {
+				if ( !hooks.unqueued ) {
+					oldfire();
+				}
+			};
+		}
+		hooks.unqueued++;
+
+		anim.always(function() {
+			// doing this makes sure that the complete handler will be called
+			// before this completes
+			anim.always(function() {
+				hooks.unqueued--;
+				if ( !jQuery.queue( elem, "fx" ).length ) {
+					hooks.empty.fire();
+				}
+			});
+		});
+	}
+
+	// height/width overflow pass
+	if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
+		// Make sure that nothing sneaks out
+		// Record all 3 overflow attributes because IE does not
+		// change the overflow attribute when overflowX and
+		// overflowY are set to the same value
+		opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
+
+		// Set display property to inline-block for height/width
+		// animations on inline elements that are having width/height animated
+		if ( jQuery.css( elem, "display" ) === "inline" &&
+				jQuery.css( elem, "float" ) === "none" ) {
+
+			// inline-level elements accept inline-block;
+			// block-level elements need to be inline with layout
+			if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
+				style.display = "inline-block";
+
+			} else {
+				style.zoom = 1;
+			}
+		}
+	}
+
+	if ( opts.overflow ) {
+		style.overflow = "hidden";
+		if ( !jQuery.support.shrinkWrapBlocks ) {
+			anim.always(function() {
+				style.overflow = opts.overflow[ 0 ];
+				style.overflowX = opts.overflow[ 1 ];
+				style.overflowY = opts.overflow[ 2 ];
+			});
+		}
+	}
+
+
+	// show/hide pass
+	for ( index in props ) {
+		value = props[ index ];
+		if ( rfxtypes.exec( value ) ) {
+			delete props[ index ];
+			toggle = toggle || value === "toggle";
+			if ( value === ( hidden ? "hide" : "show" ) ) {
+				continue;
+			}
+			handled.push( index );
+		}
+	}
+
+	length = handled.length;
+	if ( length ) {
+		dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
+		if ( "hidden" in dataShow ) {
+			hidden = dataShow.hidden;
+		}
+
+		// store state if its toggle - enables .stop().toggle() to "reverse"
+		if ( toggle ) {
+			dataShow.hidden = !hidden;
+		}
+		if ( hidden ) {
+			jQuery( elem ).show();
+		} else {
+			anim.done(function() {
+				jQuery( elem ).hide();
+			});
+		}
+		anim.done(function() {
+			var prop;
+			jQuery._removeData( elem, "fxshow" );
+			for ( prop in orig ) {
+				jQuery.style( elem, prop, orig[ prop ] );
+			}
+		});
+		for ( index = 0 ; index < length ; index++ ) {
+			prop = handled[ index ];
+			tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
+			orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
+
+			if ( !( prop in dataShow ) ) {
+				dataShow[ prop ] = tween.start;
+				if ( hidden ) {
+					tween.end = tween.start;
+					tween.start = prop === "width" || prop === "height" ? 1 : 0;
+				}
+			}
+		}
+	}
+}
+
+function Tween( elem, options, prop, end, easing ) {
+	return new Tween.prototype.init( elem, options, prop, end, easing );
+}
+jQuery.Tween = Tween;
+
+Tween.prototype = {
+	constructor: Tween,
+	init: function( elem, options, prop, end, easing, unit ) {
+		this.elem = elem;
+		this.prop = prop;
+		this.easing = easing || "swing";
+		this.options = options;
+		this.start = this.now = this.cur();
+		this.end = end;
+		this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
+	},
+	cur: function() {
+		var hooks = Tween.propHooks[ this.prop ];
+
+		return hooks && hooks.get ?
+			hooks.get( this ) :
+			Tween.propHooks._default.get( this );
+	},
+	run: function( percent ) {
+		var eased,
+			hooks = Tween.propHooks[ this.prop ];
+
+		if ( this.options.duration ) {
+			this.pos = eased = jQuery.easing[ this.easing ](
+				percent, this.options.duration * percent, 0, 1, this.options.duration
+			);
+		} else {
+			this.pos = eased = percent;
+		}
+		this.now = ( this.end - this.start ) * eased + this.start;
+
+		if ( this.options.step ) {
+			this.options.step.call( this.elem, this.now, this );
+		}
+
+		if ( hooks && hooks.set ) {
+			hooks.set( this );
+		} else {
+			Tween.propHooks._default.set( this );
+		}
+		return this;
+	}
+};
+
+Tween.prototype.init.prototype = Tween.prototype;
+
+Tween.propHooks = {
+	_default: {
+		get: function( tween ) {
+			var result;
+
+			if ( tween.elem[ tween.prop ] != null &&
+				(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
+				return tween.elem[ tween.prop ];
+			}
+
+			// passing an empty string as a 3rd parameter to .css will automatically
+			// attempt a parseFloat and fallback to a string if the parse fails
+			// so, simple values such as "10px" are parsed to Float.
+			// complex values such as "rotate(1rad)" are returned as is.
+			result = jQuery.css( tween.elem, tween.prop, "" );
+			// Empty strings, null, undefined and "auto" are converted to 0.
+			return !result || result === "auto" ? 0 : result;
+		},
+		set: function( tween ) {
+			// use step hook for back compat - use cssHook if its there - use .style if its
+			// available and use plain properties where available
+			if ( jQuery.fx.step[ tween.prop ] ) {
+				jQuery.fx.step[ tween.prop ]( tween );
+			} else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
+				jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
+			} else {
+				tween.elem[ tween.prop ] = tween.now;
+			}
+		}
+	}
+};
+
+// Remove in 2.0 - this supports IE8's panic based approach
+// to setting things on disconnected nodes
+
+Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
+	set: function( tween ) {
+		if ( tween.elem.nodeType && tween.elem.parentNode ) {
+			tween.elem[ tween.prop ] = tween.now;
+		}
+	}
+};
+
+jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
+	var cssFn = jQuery.fn[ name ];
+	jQuery.fn[ name ] = function( speed, easing, callback ) {
+		return speed == null || typeof speed === "boolean" ?
+			cssFn.apply( this, arguments ) :
+			this.animate( genFx( name, true ), speed, easing, callback );
+	};
+});
+
+jQuery.fn.extend({
+	fadeTo: function( speed, to, easing, callback ) {
+
+		// show any hidden elements after setting opacity to 0
+		return this.filter( isHidden ).css( "opacity", 0 ).show()
+
+			// animate to the value specified
+			.end().animate({ opacity: to }, speed, easing, callback );
+	},
+	animate: function( prop, speed, easing, callback ) {
+		var empty = jQuery.isEmptyObject( prop ),
+			optall = jQuery.speed( speed, easing, callback ),
+			doAnimation = function() {
+				// Operate on a copy of prop so per-property easing won't be lost
+				var anim = Animation( this, jQuery.extend( {}, prop ), optall );
+				doAnimation.finish = function() {
+					anim.stop( true );
+				};
+				// Empty animations, or finishing resolves immediately
+				if ( empty || jQuery._data( this, "finish" ) ) {
+					anim.stop( true );
+				}
+			};
+			doAnimation.finish = doAnimation;
+
+		return empty || optall.queue === false ?
+			this.each( doAnimation ) :
+			this.queue( optall.queue, doAnimation );
+	},
+	stop: function( type, clearQueue, gotoEnd ) {
+		var stopQueue = function( hooks ) {
+			var stop = hooks.stop;
+			delete hooks.stop;
+			stop( gotoEnd );
+		};
+
+		if ( typeof type !== "string" ) {
+			gotoEnd = clearQueue;
+			clearQueue = type;
+			type = undefined;
+		}
+		if ( clearQueue && type !== false ) {
+			this.queue( type || "fx", [] );
+		}
+
+		return this.each(function() {
+			var dequeue = true,
+				index = type != null && type + "queueHooks",
+				timers = jQuery.timers,
+				data = jQuery._data( this );
+
+			if ( index ) {
+				if ( data[ index ] && data[ index ].stop ) {
+					stopQueue( data[ index ] );
+				}
+			} else {
+				for ( index in data ) {
+					if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
+						stopQueue( data[ index ] );
+					}
+				}
+			}
+
+			for ( index = timers.length; index--; ) {
+				if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
+					timers[ index ].anim.stop( gotoEnd );
+					dequeue = false;
+					timers.splice( index, 1 );
+				}
+			}
+
+			// start the next in the queue if the last step wasn't forced
+			// timers currently will call their complete callbacks, which will dequeue
+			// but only if they were gotoEnd
+			if ( dequeue || !gotoEnd ) {
+				jQuery.dequeue( this, type );
+			}
+		});
+	},
+	finish: function( type ) {
+		if ( type !== false ) {
+			type = type || "fx";
+		}
+		return this.each(function() {
+			var index,
+				data = jQuery._data( this ),
+				queue = data[ type + "queue" ],
+				hooks = data[ type + "queueHooks" ],
+				timers = jQuery.timers,
+				length = queue ? queue.length : 0;
+
+			// enable finishing flag on private data
+			data.finish = true;
+
+			// empty the queue first
+			jQuery.queue( this, type, [] );
+
+			if ( hooks && hooks.cur && hooks.cur.finish ) {
+				hooks.cur.finish.call( this );
+			}
+
+			// look for any active animations, and finish them
+			for ( index = timers.length; index--; ) {
+				if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
+					timers[ index ].anim.stop( true );
+					timers.splice( index, 1 );
+				}
+			}
+
+			// look for any animations in the old queue and finish them
+			for ( index = 0; index < length; index++ ) {
+				if ( queue[ index ] && queue[ index ].finish ) {
+					queue[ index ].finish.call( this );
+				}
+			}
+
+			// turn off finishing flag
+			delete data.finish;
+		});
+	}
+});
+
+// Generate parameters to create a standard animation
+function genFx( type, includeWidth ) {
+	var which,
+		attrs = { height: type },
+		i = 0;
+
+	// if we include width, step value is 1 to do all cssExpand values,
+	// if we don't include width, step value is 2 to skip over Left and Right
+	includeWidth = includeWidth? 1 : 0;
+	for( ; i < 4 ; i += 2 - includeWidth ) {
+		which = cssExpand[ i ];
+		attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
+	}
+
+	if ( includeWidth ) {
+		attrs.opacity = attrs.width = type;
+	}
+
+	return attrs;
+}
+
+// Generate shortcuts for custom animations
+jQuery.each({
+	slideDown: genFx("show"),
+	slideUp: genFx("hide"),
+	slideToggle: genFx("toggle"),
+	fadeIn: { opacity: "show" },
+	fadeOut: { opacity: "hide" },
+	fadeToggle: { opacity: "toggle" }
+}, function( name, props ) {
+	jQuery.fn[ name ] = function( speed, easing, callback ) {
+		return this.animate( props, speed, easing, callback );
+	};
+});
+
+jQuery.speed = function( speed, easing, fn ) {
+	var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
+		complete: fn || !fn && easing ||
+			jQuery.isFunction( speed ) && speed,
+		duration: speed,
+		easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
+	};
+
+	opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
+		opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
+
+	// normalize opt.queue - true/undefined/null -> "fx"
+	if ( opt.queue == null || opt.queue === true ) {
+		opt.queue = "fx";
+	}
+
+	// Queueing
+	opt.old = opt.complete;
+
+	opt.complete = function() {
+		if ( jQuery.isFunction( opt.old ) ) {
+			opt.old.call( this );
+		}
+
+		if ( opt.queue ) {
+			jQuery.dequeue( this, opt.queue );
+		}
+	};
+
+	return opt;
+};
+
+jQuery.easing = {
+	linear: function( p ) {
+		return p;
+	},
+	swing: function( p ) {
+		return 0.5 - Math.cos( p*Math.PI ) / 2;
+	}
+};
+
+jQuery.timers = [];
+jQuery.fx = Tween.prototype.init;
+jQuery.fx.tick = function() {
+	var timer,
+		timers = jQuery.timers,
+		i = 0;
+
+	fxNow = jQuery.now();
+
+	for ( ; i < timers.length; i++ ) {
+		timer = timers[ i ];
+		// Checks the timer has not already been removed
+		if ( !timer() && timers[ i ] === timer ) {
+			timers.splice( i--, 1 );
+		}
+	}
+
+	if ( !timers.length ) {
+		jQuery.fx.stop();
+	}
+	fxNow = undefined;
+};
+
+jQuery.fx.timer = function( timer ) {
+	if ( timer() && jQuery.timers.push( timer ) ) {
+		jQuery.fx.start();
+	}
+};
+
+jQuery.fx.interval = 13;
+
+jQuery.fx.start = function() {
+	if ( !timerId ) {
+		timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
+	}
+};
+
+jQuery.fx.stop = function() {
+	clearInterval( timerId );
+	timerId = null;
+};
+
+jQuery.fx.speeds = {
+	slow: 600,
+	fast: 200,
+	// Default speed
+	_default: 400
+};
+
+// Back Compat <1.8 extension point
+jQuery.fx.step = {};
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+	jQuery.expr.filters.animated = function( elem ) {
+		return jQuery.grep(jQuery.timers, function( fn ) {
+			return elem === fn.elem;
+		}).length;
+	};
+}
+jQuery.fn.offset = function( options ) {
+	if ( arguments.length ) {
+		return options === undefined ?
+			this :
+			this.each(function( i ) {
+				jQuery.offset.setOffset( this, options, i );
+			});
+	}
+
+	var docElem, win,
+		box = { top: 0, left: 0 },
+		elem = this[ 0 ],
+		doc = elem && elem.ownerDocument;
+
+	if ( !doc ) {
+		return;
+	}
+
+	docElem = doc.documentElement;
+
+	// Make sure it's not a disconnected DOM node
+	if ( !jQuery.contains( docElem, elem ) ) {
+		return box;
+	}
+
+	// If we don't have gBCR, just use 0,0 rather than error
+	// BlackBerry 5, iOS 3 (original iPhone)
+	if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
+		box = elem.getBoundingClientRect();
+	}
+	win = getWindow( doc );
+	return {
+		top: box.top  + ( win.pageYOffset || docElem.scrollTop )  - ( docElem.clientTop  || 0 ),
+		left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
+	};
+};
+
+jQuery.offset = {
+
+	setOffset: function( elem, options, i ) {
+		var position = jQuery.css( elem, "position" );
+
+		// set position first, in-case top/left are set even on static elem
+		if ( position === "static" ) {
+			elem.style.position = "relative";
+		}
+
+		var curElem = jQuery( elem ),
+			curOffset = curElem.offset(),
+			curCSSTop = jQuery.css( elem, "top" ),
+			curCSSLeft = jQuery.css( elem, "left" ),
+			calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
+			props = {}, curPosition = {}, curTop, curLeft;
+
+		// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
+		if ( calculatePosition ) {
+			curPosition = curElem.position();
+			curTop = curPosition.top;
+			curLeft = curPosition.left;
+		} else {
+			curTop = parseFloat( curCSSTop ) || 0;
+			curLeft = parseFloat( curCSSLeft ) || 0;
+		}
+
+		if ( jQuery.isFunction( options ) ) {
+			options = options.call( elem, i, curOffset );
+		}
+
+		if ( options.top != null ) {
+			props.top = ( options.top - curOffset.top ) + curTop;
+		}
+		if ( options.left != null ) {
+			props.left = ( options.left - curOffset.left ) + curLeft;
+		}
+
+		if ( "using" in options ) {
+			options.using.call( elem, props );
+		} else {
+			curElem.css( props );
+		}
+	}
+};
+
+
+jQuery.fn.extend({
+
+	position: function() {
+		if ( !this[ 0 ] ) {
+			return;
+		}
+
+		var offsetParent, offset,
+			parentOffset = { top: 0, left: 0 },
+			elem = this[ 0 ];
+
+		// fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
+		if ( jQuery.css( elem, "position" ) === "fixed" ) {
+			// we assume that getBoundingClientRect is available when computed position is fixed
+			offset = elem.getBoundingClientRect();
+		} else {
+			// Get *real* offsetParent
+			offsetParent = this.offsetParent();
+
+			// Get correct offsets
+			offset = this.offset();
+			if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
+				parentOffset = offsetParent.offset();
+			}
+
+			// Add offsetParent borders
+			parentOffset.top  += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
+			parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
+		}
+
+		// Subtract parent offsets and element margins
+		// note: when an element has margin: auto the offsetLeft and marginLeft
+		// are the same in Safari causing offset.left to incorrectly be 0
+		return {
+			top:  offset.top  - parentOffset.top - jQuery.css( elem, "marginTop", true ),
+			left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
+		};
+	},
+
+	offsetParent: function() {
+		return this.map(function() {
+			var offsetParent = this.offsetParent || document.documentElement;
+			while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
+				offsetParent = offsetParent.offsetParent;
+			}
+			return offsetParent || document.documentElement;
+		});
+	}
+});
+
+
+// Create scrollLeft and scrollTop methods
+jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
+	var top = /Y/.test( prop );
+
+	jQuery.fn[ method ] = function( val ) {
+		return jQuery.access( this, function( elem, method, val ) {
+			var win = getWindow( elem );
+
+			if ( val === undefined ) {
+				return win ? (prop in win) ? win[ prop ] :
+					win.document.documentElement[ method ] :
+					elem[ method ];
+			}
+
+			if ( win ) {
+				win.scrollTo(
+					!top ? val : jQuery( win ).scrollLeft(),
+					top ? val : jQuery( win ).scrollTop()
+				);
+
+			} else {
+				elem[ method ] = val;
+			}
+		}, method, val, arguments.length, null );
+	};
+});
+
+function getWindow( elem ) {
+	return jQuery.isWindow( elem ) ?
+		elem :
+		elem.nodeType === 9 ?
+			elem.defaultView || elem.parentWindow :
+			false;
+}
+// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
+jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
+	jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
+		// margin is only for outerHeight, outerWidth
+		jQuery.fn[ funcName ] = function( margin, value ) {
+			var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
+				extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
+
+			return jQuery.access( this, function( elem, type, value ) {
+				var doc;
+
+				if ( jQuery.isWindow( elem ) ) {
+					// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
+					// isn't a whole lot we can do. See pull request at this URL for discussion:
+					// https://github.com/jquery/jquery/pull/764
+					return elem.document.documentElement[ "client" + name ];
+				}
+
+				// Get document width or height
+				if ( elem.nodeType === 9 ) {
+					doc = elem.documentElement;
+
+					// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
+					// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
+					return Math.max(
+						elem.body[ "scroll" + name ], doc[ "scroll" + name ],
+						elem.body[ "offset" + name ], doc[ "offset" + name ],
+						doc[ "client" + name ]
+					);
+				}
+
+				return value === undefined ?
+					// Get width or height on the element, requesting but not forcing parseFloat
+					jQuery.css( elem, type, extra ) :
+
+					// Set width or height on the element
+					jQuery.style( elem, type, value, extra );
+			}, type, chainable ? margin : undefined, chainable, null );
+		};
+	});
+});
+// Limit scope pollution from any deprecated API
+// (function() {
+
+// })();
+// Expose jQuery to the global object
+window.jQuery = window.$ = jQuery;
+
+// Expose jQuery as an AMD module, but only for AMD loaders that
+// understand the issues with loading multiple versions of jQuery
+// in a page that all might call define(). The loader will indicate
+// they have special allowances for multiple jQuery versions by
+// specifying define.amd.jQuery = true. Register as a named module,
+// since jQuery can be concatenated with other files that may use define,
+// but not use a proper concatenation script that understands anonymous
+// AMD modules. A named AMD is safest and most robust way to register.
+// Lowercase jquery is used because AMD module names are derived from
+// file names, and jQuery is normally delivered in a lowercase file name.
+// Do this after creating the global so that if an AMD module wants to call
+// noConflict to hide this version of jQuery, it will work.
+if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
+	define( "jquery", [], function () { return jQuery; } );
+}
+
+})( window );
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery-migrate-1.2.1.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery-migrate-1.2.1.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery-migrate-1.2.1.js	(revision 5703)
@@ -0,0 +1,521 @@
+/*!
+ * jQuery Migrate - v1.2.1 - 2013-05-08
+ * https://github.com/jquery/jquery-migrate
+ * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
+ */
+(function( jQuery, window, undefined ) {
+// See http://bugs.jquery.com/ticket/13335
+// "use strict";
+
+
+var warnedAbout = {};
+
+// List of warnings already given; public read only
+jQuery.migrateWarnings = [];
+
+// Set to true to prevent console output; migrateWarnings still maintained
+// jQuery.migrateMute = false;
+
+// Show a message on the console so devs know we're active
+if ( !jQuery.migrateMute && window.console && window.console.log ) {
+	window.console.log("JQMIGRATE: Logging is active");
+}
+
+// Set to false to disable traces that appear with warnings
+if ( jQuery.migrateTrace === undefined ) {
+	jQuery.migrateTrace = true;
+}
+
+// Forget any warnings we've already given; public
+jQuery.migrateReset = function() {
+	warnedAbout = {};
+	jQuery.migrateWarnings.length = 0;
+};
+
+function migrateWarn( msg) {
+	var console = window.console;
+	if ( !warnedAbout[ msg ] ) {
+		warnedAbout[ msg ] = true;
+		jQuery.migrateWarnings.push( msg );
+		if ( console && console.warn && !jQuery.migrateMute ) {
+			console.warn( "JQMIGRATE: " + msg );
+			if ( jQuery.migrateTrace && console.trace ) {
+				console.trace();
+			}
+		}
+	}
+}
+
+function migrateWarnProp( obj, prop, value, msg ) {
+	if ( Object.defineProperty ) {
+		// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
+		// allow property to be overwritten in case some other plugin wants it
+		try {
+			Object.defineProperty( obj, prop, {
+				configurable: true,
+				enumerable: true,
+				get: function() {
+					migrateWarn( msg );
+					return value;
+				},
+				set: function( newValue ) {
+					migrateWarn( msg );
+					value = newValue;
+				}
+			});
+			return;
+		} catch( err ) {
+			// IE8 is a dope about Object.defineProperty, can't warn there
+		}
+	}
+
+	// Non-ES5 (or broken) browser; just set the property
+	jQuery._definePropertyBroken = true;
+	obj[ prop ] = value;
+}
+
+if ( document.compatMode === "BackCompat" ) {
+	// jQuery has never supported or tested Quirks Mode
+	migrateWarn( "jQuery is not compatible with Quirks Mode" );
+}
+
+
+var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn,
+	oldAttr = jQuery.attr,
+	valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
+		function() { return null; },
+	valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
+		function() { return undefined; },
+	rnoType = /^(?:input|button)$/i,
+	rnoAttrNodeType = /^[238]$/,
+	rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
+	ruseDefault = /^(?:checked|selected)$/i;
+
+// jQuery.attrFn
+migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" );
+
+jQuery.attr = function( elem, name, value, pass ) {
+	var lowerName = name.toLowerCase(),
+		nType = elem && elem.nodeType;
+
+	if ( pass ) {
+		// Since pass is used internally, we only warn for new jQuery
+		// versions where there isn't a pass arg in the formal params
+		if ( oldAttr.length < 4 ) {
+			migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
+		}
+		if ( elem && !rnoAttrNodeType.test( nType ) &&
+			(attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) {
+			return jQuery( elem )[ name ]( value );
+		}
+	}
+
+	// Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking
+	// for disconnected elements we don't warn on $( "<button>", { type: "button" } ).
+	if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {
+		migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
+	}
+
+	// Restore boolHook for boolean property/attribute synchronization
+	if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
+		jQuery.attrHooks[ lowerName ] = {
+			get: function( elem, name ) {
+				// Align boolean attributes with corresponding properties
+				// Fall back to attribute presence where some booleans are not supported
+				var attrNode,
+					property = jQuery.prop( elem, name );
+				return property === true || typeof property !== "boolean" &&
+					( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
+
+					name.toLowerCase() :
+					undefined;
+			},
+			set: function( elem, value, name ) {
+				var propName;
+				if ( value === false ) {
+					// Remove boolean attributes when set to false
+					jQuery.removeAttr( elem, name );
+				} else {
+					// value is true since we know at this point it's type boolean and not false
+					// Set boolean attributes to the same name and set the DOM property
+					propName = jQuery.propFix[ name ] || name;
+					if ( propName in elem ) {
+						// Only set the IDL specifically if it already exists on the element
+						elem[ propName ] = true;
+					}
+
+					elem.setAttribute( name, name.toLowerCase() );
+				}
+				return name;
+			}
+		};
+
+		// Warn only for attributes that can remain distinct from their properties post-1.9
+		if ( ruseDefault.test( lowerName ) ) {
+			migrateWarn( "jQuery.fn.attr('" + lowerName + "') may use property instead of attribute" );
+		}
+	}
+
+	return oldAttr.call( jQuery, elem, name, value );
+};
+
+// attrHooks: value
+jQuery.attrHooks.value = {
+	get: function( elem, name ) {
+		var nodeName = ( elem.nodeName || "" ).toLowerCase();
+		if ( nodeName === "button" ) {
+			return valueAttrGet.apply( this, arguments );
+		}
+		if ( nodeName !== "input" && nodeName !== "option" ) {
+			migrateWarn("jQuery.fn.attr('value') no longer gets properties");
+		}
+		return name in elem ?
+			elem.value :
+			null;
+	},
+	set: function( elem, value ) {
+		var nodeName = ( elem.nodeName || "" ).toLowerCase();
+		if ( nodeName === "button" ) {
+			return valueAttrSet.apply( this, arguments );
+		}
+		if ( nodeName !== "input" && nodeName !== "option" ) {
+			migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");
+		}
+		// Does not return so that setAttribute is also used
+		elem.value = value;
+	}
+};
+
+
+var matched, browser,
+	oldInit = jQuery.fn.init,
+	oldParseJSON = jQuery.parseJSON,
+	// Note: XSS check is done below after string is trimmed
+	rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/;
+
+// $(html) "looks like html" rule change
+jQuery.fn.init = function( selector, context, rootjQuery ) {
+	var match;
+
+	if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
+			(match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
+		// This is an HTML string according to the "old" rules; is it still?
+		if ( selector.charAt( 0 ) !== "<" ) {
+			migrateWarn("$(html) HTML strings must start with '<' character");
+		}
+		if ( match[ 3 ] ) {
+			migrateWarn("$(html) HTML text after last tag is ignored");
+		}
+		// Consistently reject any HTML-like string starting with a hash (#9521)
+		// Note that this may break jQuery 1.6.x code that otherwise would work.
+		if ( match[ 0 ].charAt( 0 ) === "#" ) {
+			migrateWarn("HTML string cannot start with a '#' character");
+			jQuery.error("JQMIGRATE: Invalid selector string (XSS)");
+		}
+		// Now process using loose rules; let pre-1.8 play too
+		if ( context && context.context ) {
+			// jQuery object as context; parseHTML expects a DOM object
+			context = context.context;
+		}
+		if ( jQuery.parseHTML ) {
+			return oldInit.call( this, jQuery.parseHTML( match[ 2 ], context, true ),
+					context, rootjQuery );
+		}
+	}
+	return oldInit.apply( this, arguments );
+};
+jQuery.fn.init.prototype = jQuery.fn;
+
+// Let $.parseJSON(falsy_value) return null
+jQuery.parseJSON = function( json ) {
+	if ( !json && json !== null ) {
+		migrateWarn("jQuery.parseJSON requires a valid JSON string");
+		return null;
+	}
+	return oldParseJSON.apply( this, arguments );
+};
+
+jQuery.uaMatch = function( ua ) {
+	ua = ua.toLowerCase();
+
+	var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
+		/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
+		/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
+		/(msie) ([\w.]+)/.exec( ua ) ||
+		ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
+		[];
+
+	return {
+		browser: match[ 1 ] || "",
+		version: match[ 2 ] || "0"
+	};
+};
+
+// Don't clobber any existing jQuery.browser in case it's different
+if ( !jQuery.browser ) {
+	matched = jQuery.uaMatch( navigator.userAgent );
+	browser = {};
+
+	if ( matched.browser ) {
+		browser[ matched.browser ] = true;
+		browser.version = matched.version;
+	}
+
+	// Chrome is Webkit, but Webkit is also Safari.
+	if ( browser.chrome ) {
+		browser.webkit = true;
+	} else if ( browser.webkit ) {
+		browser.safari = true;
+	}
+
+	jQuery.browser = browser;
+}
+
+// Warn if the code tries to get jQuery.browser
+migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
+
+jQuery.sub = function() {
+	function jQuerySub( selector, context ) {
+		return new jQuerySub.fn.init( selector, context );
+	}
+	jQuery.extend( true, jQuerySub, this );
+	jQuerySub.superclass = this;
+	jQuerySub.fn = jQuerySub.prototype = this();
+	jQuerySub.fn.constructor = jQuerySub;
+	jQuerySub.sub = this.sub;
+	jQuerySub.fn.init = function init( selector, context ) {
+		if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
+			context = jQuerySub( context );
+		}
+
+		return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
+	};
+	jQuerySub.fn.init.prototype = jQuerySub.fn;
+	var rootjQuerySub = jQuerySub(document);
+	migrateWarn( "jQuery.sub() is deprecated" );
+	return jQuerySub;
+};
+
+
+// Ensure that $.ajax gets the new parseJSON defined in core.js
+jQuery.ajaxSetup({
+	converters: {
+		"text json": jQuery.parseJSON
+	}
+});
+
+
+var oldFnData = jQuery.fn.data;
+
+jQuery.fn.data = function( name ) {
+	var ret, evt,
+		elem = this[0];
+
+	// Handles 1.7 which has this behavior and 1.8 which doesn't
+	if ( elem && name === "events" && arguments.length === 1 ) {
+		ret = jQuery.data( elem, name );
+		evt = jQuery._data( elem, name );
+		if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
+			migrateWarn("Use of jQuery.fn.data('events') is deprecated");
+			return evt;
+		}
+	}
+	return oldFnData.apply( this, arguments );
+};
+
+
+var rscriptType = /\/(java|ecma)script/i,
+	oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
+
+jQuery.fn.andSelf = function() {
+	migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
+	return oldSelf.apply( this, arguments );
+};
+
+// Since jQuery.clean is used internally on older versions, we only shim if it's missing
+if ( !jQuery.clean ) {
+	jQuery.clean = function( elems, context, fragment, scripts ) {
+		// Set context per 1.8 logic
+		context = context || document;
+		context = !context.nodeType && context[0] || context;
+		context = context.ownerDocument || context;
+
+		migrateWarn("jQuery.clean() is deprecated");
+
+		var i, elem, handleScript, jsTags,
+			ret = [];
+
+		jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
+
+		// Complex logic lifted directly from jQuery 1.8
+		if ( fragment ) {
+			// Special handling of each script element
+			handleScript = function( elem ) {
+				// Check if we consider it executable
+				if ( !elem.type || rscriptType.test( elem.type ) ) {
+					// Detach the script and store it in the scripts array (if provided) or the fragment
+					// Return truthy to indicate that it has been handled
+					return scripts ?
+						scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
+						fragment.appendChild( elem );
+				}
+			};
+
+			for ( i = 0; (elem = ret[i]) != null; i++ ) {
+				// Check if we're done after handling an executable script
+				if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
+					// Append to fragment and handle embedded scripts
+					fragment.appendChild( elem );
+					if ( typeof elem.getElementsByTagName !== "undefined" ) {
+						// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
+						jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
+
+						// Splice the scripts into ret after their former ancestor and advance our index beyond them
+						ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
+						i += jsTags.length;
+					}
+				}
+			}
+		}
+
+		return ret;
+	};
+}
+
+var eventAdd = jQuery.event.add,
+	eventRemove = jQuery.event.remove,
+	eventTrigger = jQuery.event.trigger,
+	oldToggle = jQuery.fn.toggle,
+	oldLive = jQuery.fn.live,
+	oldDie = jQuery.fn.die,
+	ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
+	rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
+	rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
+	hoverHack = function( events ) {
+		if ( typeof( events ) !== "string" || jQuery.event.special.hover ) {
+			return events;
+		}
+		if ( rhoverHack.test( events ) ) {
+			migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
+		}
+		return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
+	};
+
+// Event props removed in 1.9, put them back if needed; no practical way to warn them
+if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
+	jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
+}
+
+// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
+if ( jQuery.event.dispatch ) {
+	migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
+}
+
+// Support for 'hover' pseudo-event and ajax event warnings
+jQuery.event.add = function( elem, types, handler, data, selector ){
+	if ( elem !== document && rajaxEvent.test( types ) ) {
+		migrateWarn( "AJAX events should be attached to document: " + types );
+	}
+	eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
+};
+jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
+	eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
+};
+
+jQuery.fn.error = function() {
+	var args = Array.prototype.slice.call( arguments, 0);
+	migrateWarn("jQuery.fn.error() is deprecated");
+	args.splice( 0, 0, "error" );
+	if ( arguments.length ) {
+		return this.bind.apply( this, args );
+	}
+	// error event should not bubble to window, although it does pre-1.7
+	this.triggerHandler.apply( this, args );
+	return this;
+};
+
+jQuery.fn.toggle = function( fn, fn2 ) {
+
+	// Don't mess with animation or css toggles
+	if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
+		return oldToggle.apply( this, arguments );
+	}
+	migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
+
+	// Save reference to arguments for access in closure
+	var args = arguments,
+		guid = fn.guid || jQuery.guid++,
+		i = 0,
+		toggler = function( event ) {
+			// Figure out which function to execute
+			var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
+			jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
+
+			// Make sure that clicks stop
+			event.preventDefault();
+
+			// and execute the function
+			return args[ lastToggle ].apply( this, arguments ) || false;
+		};
+
+	// link all the functions, so any of them can unbind this click handler
+	toggler.guid = guid;
+	while ( i < args.length ) {
+		args[ i++ ].guid = guid;
+	}
+
+	return this.click( toggler );
+};
+
+jQuery.fn.live = function( types, data, fn ) {
+	migrateWarn("jQuery.fn.live() is deprecated");
+	if ( oldLive ) {
+		return oldLive.apply( this, arguments );
+	}
+	jQuery( this.context ).on( types, this.selector, data, fn );
+	return this;
+};
+
+jQuery.fn.die = function( types, fn ) {
+	migrateWarn("jQuery.fn.die() is deprecated");
+	if ( oldDie ) {
+		return oldDie.apply( this, arguments );
+	}
+	jQuery( this.context ).off( types, this.selector || "**", fn );
+	return this;
+};
+
+// Turn global events into document-triggered events
+jQuery.event.trigger = function( event, data, elem, onlyHandlers  ){
+	if ( !elem && !rajaxEvent.test( event ) ) {
+		migrateWarn( "Global events are undocumented and deprecated" );
+	}
+	return eventTrigger.call( this,  event, data, elem || document, onlyHandlers  );
+};
+jQuery.each( ajaxEvents.split("|"),
+	function( _, name ) {
+		jQuery.event.special[ name ] = {
+			setup: function() {
+				var elem = this;
+
+				// The document needs no shimming; must be !== for oldIE
+				if ( elem !== document ) {
+					jQuery.event.add( document, name + "." + jQuery.guid, function() {
+						jQuery.event.trigger( name, null, elem, true );
+					});
+					jQuery._data( this, name, jQuery.guid++ );
+				}
+				return false;
+			},
+			teardown: function() {
+				if ( this !== document ) {
+					jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
+				}
+				return false;
+			}
+		};
+	}
+);
+
+
+})( jQuery, window );
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery-migrate-1.2.1.min.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery-migrate-1.2.1.min.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery-migrate-1.2.1.min.js	(revision 5703)
@@ -0,0 +1,2 @@
+/*! jQuery Migrate v1.2.1 | (c) 2005, 2013 jQuery Foundation, Inc. and other contributors | jquery.org/license */
+jQuery.migrateMute===void 0&&(jQuery.migrateMute=!0),function(e,t,n){function r(n){var r=t.console;i[n]||(i[n]=!0,e.migrateWarnings.push(n),r&&r.warn&&!e.migrateMute&&(r.warn("JQMIGRATE: "+n),e.migrateTrace&&r.trace&&r.trace()))}function a(t,a,i,o){if(Object.defineProperty)try{return Object.defineProperty(t,a,{configurable:!0,enumerable:!0,get:function(){return r(o),i},set:function(e){r(o),i=e}}),n}catch(s){}e._definePropertyBroken=!0,t[a]=i}var i={};e.migrateWarnings=[],!e.migrateMute&&t.console&&t.console.log&&t.console.log("JQMIGRATE: Logging is active"),e.migrateTrace===n&&(e.migrateTrace=!0),e.migrateReset=function(){i={},e.migrateWarnings.length=0},"BackCompat"===document.compatMode&&r("jQuery is not compatible with Quirks Mode");var o=e("<input/>",{size:1}).attr("size")&&e.attrFn,s=e.attr,u=e.attrHooks.value&&e.attrHooks.value.get||function(){return null},c=e.attrHooks.value&&e.attrHooks.value.set||function(){return n},l=/^(?:input|button)$/i,d=/^[238]$/,p=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,f=/^(?:checked|selected)$/i;a(e,"attrFn",o||{},"jQuery.attrFn is deprecated"),e.attr=function(t,a,i,u){var c=a.toLowerCase(),g=t&&t.nodeType;return u&&(4>s.length&&r("jQuery.fn.attr( props, pass ) is deprecated"),t&&!d.test(g)&&(o?a in o:e.isFunction(e.fn[a])))?e(t)[a](i):("type"===a&&i!==n&&l.test(t.nodeName)&&t.parentNode&&r("Can't change the 'type' of an input or button in IE 6/7/8"),!e.attrHooks[c]&&p.test(c)&&(e.attrHooks[c]={get:function(t,r){var a,i=e.prop(t,r);return i===!0||"boolean"!=typeof i&&(a=t.getAttributeNode(r))&&a.nodeValue!==!1?r.toLowerCase():n},set:function(t,n,r){var a;return n===!1?e.removeAttr(t,r):(a=e.propFix[r]||r,a in t&&(t[a]=!0),t.setAttribute(r,r.toLowerCase())),r}},f.test(c)&&r("jQuery.fn.attr('"+c+"') may use property instead of attribute")),s.call(e,t,a,i))},e.attrHooks.value={get:function(e,t){var n=(e.nodeName||"").toLowerCase();return"button"===n?u.apply(this,arguments):("input"!==n&&"option"!==n&&r("jQuery.fn.attr('value') no longer gets properties"),t in e?e.value:null)},set:function(e,t){var a=(e.nodeName||"").toLowerCase();return"button"===a?c.apply(this,arguments):("input"!==a&&"option"!==a&&r("jQuery.fn.attr('value', val) no longer sets properties"),e.value=t,n)}};var g,h,v=e.fn.init,m=e.parseJSON,y=/^([^<]*)(<[\w\W]+>)([^>]*)$/;e.fn.init=function(t,n,a){var i;return t&&"string"==typeof t&&!e.isPlainObject(n)&&(i=y.exec(e.trim(t)))&&i[0]&&("<"!==t.charAt(0)&&r("$(html) HTML strings must start with '<' character"),i[3]&&r("$(html) HTML text after last tag is ignored"),"#"===i[0].charAt(0)&&(r("HTML string cannot start with a '#' character"),e.error("JQMIGRATE: Invalid selector string (XSS)")),n&&n.context&&(n=n.context),e.parseHTML)?v.call(this,e.parseHTML(i[2],n,!0),n,a):v.apply(this,arguments)},e.fn.init.prototype=e.fn,e.parseJSON=function(e){return e||null===e?m.apply(this,arguments):(r("jQuery.parseJSON requires a valid JSON string"),null)},e.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e.browser||(g=e.uaMatch(navigator.userAgent),h={},g.browser&&(h[g.browser]=!0,h.version=g.version),h.chrome?h.webkit=!0:h.webkit&&(h.safari=!0),e.browser=h),a(e,"browser",e.browser,"jQuery.browser is deprecated"),e.sub=function(){function t(e,n){return new t.fn.init(e,n)}e.extend(!0,t,this),t.superclass=this,t.fn=t.prototype=this(),t.fn.constructor=t,t.sub=this.sub,t.fn.init=function(r,a){return a&&a instanceof e&&!(a instanceof t)&&(a=t(a)),e.fn.init.call(this,r,a,n)},t.fn.init.prototype=t.fn;var n=t(document);return r("jQuery.sub() is deprecated"),t},e.ajaxSetup({converters:{"text json":e.parseJSON}});var b=e.fn.data;e.fn.data=function(t){var a,i,o=this[0];return!o||"events"!==t||1!==arguments.length||(a=e.data(o,t),i=e._data(o,t),a!==n&&a!==i||i===n)?b.apply(this,arguments):(r("Use of jQuery.fn.data('events') is deprecated"),i)};var j=/\/(java|ecma)script/i,w=e.fn.andSelf||e.fn.addBack;e.fn.andSelf=function(){return r("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"),w.apply(this,arguments)},e.clean||(e.clean=function(t,a,i,o){a=a||document,a=!a.nodeType&&a[0]||a,a=a.ownerDocument||a,r("jQuery.clean() is deprecated");var s,u,c,l,d=[];if(e.merge(d,e.buildFragment(t,a).childNodes),i)for(c=function(e){return!e.type||j.test(e.type)?o?o.push(e.parentNode?e.parentNode.removeChild(e):e):i.appendChild(e):n},s=0;null!=(u=d[s]);s++)e.nodeName(u,"script")&&c(u)||(i.appendChild(u),u.getElementsByTagName!==n&&(l=e.grep(e.merge([],u.getElementsByTagName("script")),c),d.splice.apply(d,[s+1,0].concat(l)),s+=l.length));return d});var Q=e.event.add,x=e.event.remove,k=e.event.trigger,N=e.fn.toggle,T=e.fn.live,M=e.fn.die,S="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",C=RegExp("\\b(?:"+S+")\\b"),H=/(?:^|\s)hover(\.\S+|)\b/,A=function(t){return"string"!=typeof t||e.event.special.hover?t:(H.test(t)&&r("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"),t&&t.replace(H,"mouseenter$1 mouseleave$1"))};e.event.props&&"attrChange"!==e.event.props[0]&&e.event.props.unshift("attrChange","attrName","relatedNode","srcElement"),e.event.dispatch&&a(e.event,"handle",e.event.dispatch,"jQuery.event.handle is undocumented and deprecated"),e.event.add=function(e,t,n,a,i){e!==document&&C.test(t)&&r("AJAX events should be attached to document: "+t),Q.call(this,e,A(t||""),n,a,i)},e.event.remove=function(e,t,n,r,a){x.call(this,e,A(t)||"",n,r,a)},e.fn.error=function(){var e=Array.prototype.slice.call(arguments,0);return r("jQuery.fn.error() is deprecated"),e.splice(0,0,"error"),arguments.length?this.bind.apply(this,e):(this.triggerHandler.apply(this,e),this)},e.fn.toggle=function(t,n){if(!e.isFunction(t)||!e.isFunction(n))return N.apply(this,arguments);r("jQuery.fn.toggle(handler, handler...) is deprecated");var a=arguments,i=t.guid||e.guid++,o=0,s=function(n){var r=(e._data(this,"lastToggle"+t.guid)||0)%o;return e._data(this,"lastToggle"+t.guid,r+1),n.preventDefault(),a[r].apply(this,arguments)||!1};for(s.guid=i;a.length>o;)a[o++].guid=i;return this.click(s)},e.fn.live=function(t,n,a){return r("jQuery.fn.live() is deprecated"),T?T.apply(this,arguments):(e(this.context).on(t,this.selector,n,a),this)},e.fn.die=function(t,n){return r("jQuery.fn.die() is deprecated"),M?M.apply(this,arguments):(e(this.context).off(t,this.selector||"**",n),this)},e.event.trigger=function(e,t,n,a){return n||C.test(e)||r("Global events are undocumented and deprecated"),k.call(this,e,t,n||document,a)},e.each(S.split("|"),function(t,n){e.event.special[n]={setup:function(){var t=this;return t!==document&&(e.event.add(document,n+"."+e.guid,function(){e.event.trigger(n,null,t,!0)}),e._data(this,n,e.guid++)),!1},teardown:function(){return this!==document&&e.event.remove(document,n+"."+e._data(this,n)),!1}}})}(jQuery,window);
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery.mockjax.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery.mockjax.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery.mockjax.js	(revision 5703)
@@ -0,0 +1,580 @@
+/*!
+ * MockJax - jQuery Plugin to Mock Ajax requests
+ *
+ * Version:  1.5.2
+ * Released:
+ * Home:   http://github.com/appendto/jquery-mockjax
+ * Author:   Jonathan Sharp (http://jdsharp.com)
+ * License:  MIT,GPL
+ *
+ * Copyright (c) 2011 appendTo LLC.
+ * Dual licensed under the MIT or GPL licenses.
+ * http://appendto.com/open-source-licenses
+ */
+(function($) {
+	var _ajax = $.ajax,
+		mockHandlers = [],
+		mockedAjaxCalls = [],
+		CALLBACK_REGEX = /=\?(&|$)/,
+		jsc = (new Date()).getTime();
+
+
+	// Parse the given XML string.
+	function parseXML(xml) {
+		if ( window.DOMParser == undefined && window.ActiveXObject ) {
+			DOMParser = function() { };
+			DOMParser.prototype.parseFromString = function( xmlString ) {
+				var doc = new ActiveXObject('Microsoft.XMLDOM');
+				doc.async = 'false';
+				doc.loadXML( xmlString );
+				return doc;
+			};
+		}
+
+		try {
+			var xmlDoc = ( new DOMParser() ).parseFromString( xml, 'text/xml' );
+			if ( $.isXMLDoc( xmlDoc ) ) {
+				var err = $('parsererror', xmlDoc);
+				if ( err.length == 1 ) {
+					throw('Error: ' + $(xmlDoc).text() );
+				}
+			} else {
+				throw('Unable to parse XML');
+			}
+			return xmlDoc;
+		} catch( e ) {
+			var msg = ( e.name == undefined ? e : e.name + ': ' + e.message );
+			$(document).trigger('xmlParseError', [ msg ]);
+			return undefined;
+		}
+	}
+
+	// Trigger a jQuery event
+	function trigger(s, type, args) {
+		(s.context ? $(s.context) : $.event).trigger(type, args);
+	}
+
+	// Check if the data field on the mock handler and the request match. This
+	// can be used to restrict a mock handler to being used only when a certain
+	// set of data is passed to it.
+	function isMockDataEqual( mock, live ) {
+		var identical = true;
+		// Test for situations where the data is a querystring (not an object)
+		if (typeof live === 'string') {
+			// Querystring may be a regex
+			return $.isFunction( mock.test ) ? mock.test(live) : mock == live;
+		}
+		$.each(mock, function(k) {
+			if ( live[k] === undefined ) {
+				identical = false;
+				return identical;
+			} else {
+				if ( typeof live[k] == 'object' ) {
+					identical = identical && isMockDataEqual(mock[k], live[k]);
+				} else {
+					if ( $.isFunction( mock[k].test ) ) {
+						identical = identical && mock[k].test(live[k]);
+					} else {
+						identical = identical && ( mock[k] == live[k] );
+					}
+				}
+			}
+		});
+
+		return identical;
+	}
+
+	// Check the given handler should mock the given request
+	function getMockForRequest( handler, requestSettings ) {
+		// If the mock was registered with a function, let the function decide if we
+		// want to mock this request
+		if ( $.isFunction(handler) ) {
+			return handler( requestSettings );
+		}
+
+		// Inspect the URL of the request and check if the mock handler's url
+		// matches the url for this ajax request
+		if ( $.isFunction(handler.url.test) ) {
+			// The user provided a regex for the url, test it
+			if ( !handler.url.test( requestSettings.url ) ) {
+				return null;
+			}
+		} else {
+			// Look for a simple wildcard '*' or a direct URL match
+			var star = handler.url.indexOf('*');
+			if (handler.url !== requestSettings.url && star === -1 ||
+					!new RegExp(handler.url.replace(/[-[\]{}()+?.,\\^$|#\s]/g, "\\$&").replace(/\*/g, '.+')).test(requestSettings.url)) {
+				return null;
+			}
+		}
+
+		// Inspect the data submitted in the request (either POST body or GET query string)
+		if ( handler.data && requestSettings.data ) {
+			if ( !isMockDataEqual(handler.data, requestSettings.data) ) {
+				// They're not identical, do not mock this request
+				return null;
+			}
+		}
+		// Inspect the request type
+		if ( handler && handler.type &&
+				handler.type.toLowerCase() != requestSettings.type.toLowerCase() ) {
+			// The request type doesn't match (GET vs. POST)
+			return null;
+		}
+
+		return handler;
+	}
+
+	// Process the xhr objects send operation
+	function _xhrSend(mockHandler, requestSettings, origSettings) {
+
+		// This is a substitute for < 1.4 which lacks $.proxy
+		var process = (function(that) {
+			return function() {
+				return (function() {
+					var onReady;
+
+					// The request has returned
+					this.status     = mockHandler.status;
+					this.statusText = mockHandler.statusText;
+					this.readyState	= 4;
+
+					// We have an executable function, call it to give
+					// the mock handler a chance to update it's data
+					if ( $.isFunction(mockHandler.response) ) {
+						mockHandler.response(origSettings);
+					}
+					// Copy over our mock to our xhr object before passing control back to
+					// jQuery's onreadystatechange callback
+					if ( requestSettings.dataType == 'json' && ( typeof mockHandler.responseText == 'object' ) ) {
+						this.responseText = JSON.stringify(mockHandler.responseText);
+					} else if ( requestSettings.dataType == 'xml' ) {
+						if ( typeof mockHandler.responseXML == 'string' ) {
+							this.responseXML = parseXML(mockHandler.responseXML);
+							//in jQuery 1.9.1+, responseXML is processed differently and relies on responseText
+							this.responseText = mockHandler.responseXML;
+						} else {
+							this.responseXML = mockHandler.responseXML;
+						}
+					} else {
+						this.responseText = mockHandler.responseText;
+					}
+					if( typeof mockHandler.status == 'number' || typeof mockHandler.status == 'string' ) {
+						this.status = mockHandler.status;
+					}
+					if( typeof mockHandler.statusText === "string") {
+						this.statusText = mockHandler.statusText;
+					}
+					// jQuery 2.0 renamed onreadystatechange to onload
+					onReady = this.onreadystatechange || this.onload;
+
+					// jQuery < 1.4 doesn't have onreadystate change for xhr
+					if ( $.isFunction( onReady ) ) {
+						if( mockHandler.isTimeout) {
+							this.status = -1;
+						}
+						onReady.call( this, mockHandler.isTimeout ? 'timeout' : undefined );
+					} else if ( mockHandler.isTimeout ) {
+						// Fix for 1.3.2 timeout to keep success from firing.
+						this.status = -1;
+					}
+				}).apply(that);
+			};
+		})(this);
+
+		if ( mockHandler.proxy ) {
+			// We're proxying this request and loading in an external file instead
+			_ajax({
+				global: false,
+				url: mockHandler.proxy,
+				type: mockHandler.proxyType,
+				data: mockHandler.data,
+				dataType: requestSettings.dataType === "script" ? "text/plain" : requestSettings.dataType,
+				complete: function(xhr) {
+					mockHandler.responseXML = xhr.responseXML;
+					mockHandler.responseText = xhr.responseText;
+					mockHandler.status = xhr.status;
+					mockHandler.statusText = xhr.statusText;
+					this.responseTimer = setTimeout(process, mockHandler.responseTime || 0);
+				}
+			});
+		} else {
+			// type == 'POST' || 'GET' || 'DELETE'
+			if ( requestSettings.async === false ) {
+				// TODO: Blocking delay
+				process();
+			} else {
+				this.responseTimer = setTimeout(process, mockHandler.responseTime || 50);
+			}
+		}
+	}
+
+	// Construct a mocked XHR Object
+	function xhr(mockHandler, requestSettings, origSettings, origHandler) {
+		// Extend with our default mockjax settings
+		mockHandler = $.extend(true, {}, $.mockjaxSettings, mockHandler);
+
+		if (typeof mockHandler.headers === 'undefined') {
+			mockHandler.headers = {};
+		}
+		if ( mockHandler.contentType ) {
+			mockHandler.headers['content-type'] = mockHandler.contentType;
+		}
+
+		return {
+			status: mockHandler.status,
+			statusText: mockHandler.statusText,
+			readyState: 1,
+			open: function() { },
+			send: function() {
+				origHandler.fired = true;
+				_xhrSend.call(this, mockHandler, requestSettings, origSettings);
+			},
+			abort: function() {
+				clearTimeout(this.responseTimer);
+			},
+			setRequestHeader: function(header, value) {
+				mockHandler.headers[header] = value;
+			},
+			getResponseHeader: function(header) {
+				// 'Last-modified', 'Etag', 'content-type' are all checked by jQuery
+				if ( mockHandler.headers && mockHandler.headers[header] ) {
+					// Return arbitrary headers
+					return mockHandler.headers[header];
+				} else if ( header.toLowerCase() == 'last-modified' ) {
+					return mockHandler.lastModified || (new Date()).toString();
+				} else if ( header.toLowerCase() == 'etag' ) {
+					return mockHandler.etag || '';
+				} else if ( header.toLowerCase() == 'content-type' ) {
+					return mockHandler.contentType || 'text/plain';
+				}
+			},
+			getAllResponseHeaders: function() {
+				var headers = '';
+				$.each(mockHandler.headers, function(k, v) {
+					headers += k + ': ' + v + "\n";
+				});
+				return headers;
+			}
+		};
+	}
+
+	// Process a JSONP mock request.
+	function processJsonpMock( requestSettings, mockHandler, origSettings ) {
+		// Handle JSONP Parameter Callbacks, we need to replicate some of the jQuery core here
+		// because there isn't an easy hook for the cross domain script tag of jsonp
+
+		processJsonpUrl( requestSettings );
+
+		requestSettings.dataType = "json";
+		if(requestSettings.data && CALLBACK_REGEX.test(requestSettings.data) || CALLBACK_REGEX.test(requestSettings.url)) {
+			createJsonpCallback(requestSettings, mockHandler, origSettings);
+
+			// We need to make sure
+			// that a JSONP style response is executed properly
+
+			var rurl = /^(\w+:)?\/\/([^\/?#]+)/,
+				parts = rurl.exec( requestSettings.url ),
+				remote = parts && (parts[1] && parts[1] !== location.protocol || parts[2] !== location.host);
+
+			requestSettings.dataType = "script";
+			if(requestSettings.type.toUpperCase() === "GET" && remote ) {
+				var newMockReturn = processJsonpRequest( requestSettings, mockHandler, origSettings );
+
+				// Check if we are supposed to return a Deferred back to the mock call, or just
+				// signal success
+				if(newMockReturn) {
+					return newMockReturn;
+				} else {
+					return true;
+				}
+			}
+		}
+		return null;
+	}
+
+	// Append the required callback parameter to the end of the request URL, for a JSONP request
+	function processJsonpUrl( requestSettings ) {
+		if ( requestSettings.type.toUpperCase() === "GET" ) {
+			if ( !CALLBACK_REGEX.test( requestSettings.url ) ) {
+				requestSettings.url += (/\?/.test( requestSettings.url ) ? "&" : "?") +
+					(requestSettings.jsonp || "callback") + "=?";
+			}
+		} else if ( !requestSettings.data || !CALLBACK_REGEX.test(requestSettings.data) ) {
+			requestSettings.data = (requestSettings.data ? requestSettings.data + "&" : "") + (requestSettings.jsonp || "callback") + "=?";
+		}
+	}
+
+	// Process a JSONP request by evaluating the mocked response text
+	function processJsonpRequest( requestSettings, mockHandler, origSettings ) {
+		// Synthesize the mock request for adding a script tag
+		var callbackContext = origSettings && origSettings.context || requestSettings,
+			newMock = null;
+
+
+		// If the response handler on the moock is a function, call it
+		if ( mockHandler.response && $.isFunction(mockHandler.response) ) {
+			mockHandler.response(origSettings);
+		} else {
+
+			// Evaluate the responseText javascript in a global context
+			if( typeof mockHandler.responseText === 'object' ) {
+				$.globalEval( '(' + JSON.stringify( mockHandler.responseText ) + ')');
+			} else {
+				$.globalEval( '(' + mockHandler.responseText + ')');
+			}
+		}
+
+		// Successful response
+		jsonpSuccess( requestSettings, callbackContext, mockHandler );
+		jsonpComplete( requestSettings, callbackContext, mockHandler );
+
+		// If we are running under jQuery 1.5+, return a deferred object
+		if($.Deferred){
+			newMock = new $.Deferred();
+			if(typeof mockHandler.responseText == "object"){
+				newMock.resolveWith( callbackContext, [mockHandler.responseText] );
+			}
+			else{
+				newMock.resolveWith( callbackContext, [$.parseJSON( mockHandler.responseText )] );
+			}
+		}
+		return newMock;
+	}
+
+
+	// Create the required JSONP callback function for the request
+	function createJsonpCallback( requestSettings, mockHandler, origSettings ) {
+		var callbackContext = origSettings && origSettings.context || requestSettings;
+		var jsonp = requestSettings.jsonpCallback || ("jsonp" + jsc++);
+
+		// Replace the =? sequence both in the query string and the data
+		if ( requestSettings.data ) {
+			requestSettings.data = (requestSettings.data + "").replace(CALLBACK_REGEX, "=" + jsonp + "$1");
+		}
+
+		requestSettings.url = requestSettings.url.replace(CALLBACK_REGEX, "=" + jsonp + "$1");
+
+
+		// Handle JSONP-style loading
+		window[ jsonp ] = window[ jsonp ] || function( tmp ) {
+			data = tmp;
+			jsonpSuccess( requestSettings, callbackContext, mockHandler );
+			jsonpComplete( requestSettings, callbackContext, mockHandler );
+			// Garbage collect
+			window[ jsonp ] = undefined;
+
+			try {
+				delete window[ jsonp ];
+			} catch(e) {}
+
+			if ( head ) {
+				head.removeChild( script );
+			}
+		};
+	}
+
+	// The JSONP request was successful
+	function jsonpSuccess(requestSettings, callbackContext, mockHandler) {
+		// If a local callback was specified, fire it and pass it the data
+		if ( requestSettings.success ) {
+			requestSettings.success.call( callbackContext, mockHandler.responseText || "", status, {} );
+		}
+
+		// Fire the global callback
+		if ( requestSettings.global ) {
+			trigger(requestSettings, "ajaxSuccess", [{}, requestSettings] );
+		}
+	}
+
+	// The JSONP request was completed
+	function jsonpComplete(requestSettings, callbackContext) {
+		// Process result
+		if ( requestSettings.complete ) {
+			requestSettings.complete.call( callbackContext, {} , status );
+		}
+
+		// The request was completed
+		if ( requestSettings.global ) {
+			trigger( "ajaxComplete", [{}, requestSettings] );
+		}
+
+		// Handle the global AJAX counter
+		if ( requestSettings.global && ! --$.active ) {
+			$.event.trigger( "ajaxStop" );
+		}
+	}
+
+
+	// The core $.ajax replacement.
+	function handleAjax( url, origSettings ) {
+		var mockRequest, requestSettings, mockHandler;
+
+		// If url is an object, simulate pre-1.5 signature
+		if ( typeof url === "object" ) {
+			origSettings = url;
+			url = undefined;
+		} else {
+			// work around to support 1.5 signature
+			origSettings.url = url;
+		}
+
+		// Extend the original settings for the request
+		requestSettings = $.extend(true, {}, $.ajaxSettings, origSettings);
+
+		// Iterate over our mock handlers (in registration order) until we find
+		// one that is willing to intercept the request
+		for(var k = 0; k < mockHandlers.length; k++) {
+			if ( !mockHandlers[k] ) {
+				continue;
+			}
+
+			mockHandler = getMockForRequest( mockHandlers[k], requestSettings );
+			if(!mockHandler) {
+				// No valid mock found for this request
+				continue;
+			}
+
+			mockedAjaxCalls.push(requestSettings);
+
+			// If logging is enabled, log the mock to the console
+			$.mockjaxSettings.log( mockHandler, requestSettings );
+
+
+			if ( requestSettings.dataType === "jsonp" ) {
+				if ((mockRequest = processJsonpMock( requestSettings, mockHandler, origSettings ))) {
+					// This mock will handle the JSONP request
+					return mockRequest;
+				}
+			}
+
+
+			// Removed to fix #54 - keep the mocking data object intact
+			//mockHandler.data = requestSettings.data;
+
+			mockHandler.cache = requestSettings.cache;
+			mockHandler.timeout = requestSettings.timeout;
+			mockHandler.global = requestSettings.global;
+
+			copyUrlParameters(mockHandler, origSettings);
+
+			(function(mockHandler, requestSettings, origSettings, origHandler) {
+				mockRequest = _ajax.call($, $.extend(true, {}, origSettings, {
+					// Mock the XHR object
+					xhr: function() { return xhr( mockHandler, requestSettings, origSettings, origHandler ); }
+				}));
+			})(mockHandler, requestSettings, origSettings, mockHandlers[k]);
+
+			return mockRequest;
+		}
+
+		// We don't have a mock request, trigger a normal request
+		return _ajax.apply($, [origSettings]);
+	}
+
+	/**
+	* Copies URL parameter values if they were captured by a regular expression
+	* @param {Object} mockHandler
+	* @param {Object} origSettings
+	*/
+	function copyUrlParameters(mockHandler, origSettings) {
+		//parameters aren't captured if the URL isn't a RegExp
+		if (!(mockHandler.url instanceof RegExp)) {
+			return;
+		}
+		//if no URL params were defined on the handler, don't attempt a capture
+		if (!mockHandler.hasOwnProperty('urlParams')) {
+			return;
+		}
+		var captures = mockHandler.url.exec(origSettings.url);
+		//the whole RegExp match is always the first value in the capture results
+		if (captures.length === 1) {
+			return;
+		}
+		captures.shift();
+		//use handler params as keys and capture resuts as values
+		var i = 0,
+		capturesLength = captures.length,
+		paramsLength = mockHandler.urlParams.length,
+		//in case the number of params specified is less than actual captures
+		maxIterations = Math.min(capturesLength, paramsLength),
+		paramValues = {};
+		for (i; i < maxIterations; i++) {
+			var key = mockHandler.urlParams[i];
+			paramValues[key] = captures[i];
+		}
+		origSettings.urlParams = paramValues;
+	}
+
+
+	// Public
+
+	$.extend({
+		ajax: handleAjax
+	});
+
+	$.mockjaxSettings = {
+		//url:        null,
+		//type:       'GET',
+		log:          function( mockHandler, requestSettings ) {
+			if ( mockHandler.logging === false ||
+				 ( typeof mockHandler.logging === 'undefined' && $.mockjaxSettings.logging === false ) ) {
+				return;
+			}
+			if ( window.console && console.log ) {
+				var message = 'MOCK ' + requestSettings.type.toUpperCase() + ': ' + requestSettings.url;
+				var request = $.extend({}, requestSettings);
+
+				if (typeof console.log === 'function') {
+					console.log(message, request);
+				} else {
+					try {
+						console.log( message + ' ' + JSON.stringify(request) );
+					} catch (e) {
+						console.log(message);
+					}
+				}
+			}
+		},
+		logging:      true,
+		status:       200,
+		statusText:   "OK",
+		responseTime: 500,
+		isTimeout:    false,
+		contentType:  'text/plain',
+		response:     '',
+		responseText: '',
+		responseXML:  '',
+		proxy:        '',
+		proxyType:    'GET',
+
+		lastModified: null,
+		etag:         '',
+		headers: {
+			etag: 'IJF@H#@923uf8023hFO@I#H#',
+			'content-type' : 'text/plain'
+		}
+	};
+
+	$.mockjax = function(settings) {
+		var i = mockHandlers.length;
+		mockHandlers[i] = settings;
+		return i;
+	};
+	$.mockjaxClear = function(i) {
+		if ( arguments.length == 1 ) {
+			mockHandlers[i] = null;
+		} else {
+			mockHandlers = [];
+		}
+		mockedAjaxCalls = [];
+	};
+	$.mockjax.handler = function(i) {
+		if ( arguments.length == 1 ) {
+			return mockHandlers[i];
+		}
+	};
+	$.mockjax.mockedAjaxCalls = function() {
+		return mockedAjaxCalls;
+	};
+})(jQuery);
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery.popupWindow.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery.popupWindow.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery.popupWindow.js	(revision 5703)
@@ -0,0 +1,62 @@
+(function($){ 		  
+	$.fn.popupWindow = function(instanceSettings){
+		
+		return this.each(function(){
+		
+		$(this).click(function(){
+		
+		$.fn.popupWindow.defaultSettings = {
+			centerBrowser:0, // center window over browser window? {1 (YES) or 0 (NO)}. overrides top and left
+			centerScreen:0, // center window over entire screen? {1 (YES) or 0 (NO)}. overrides top and left
+			height:500, // sets the height in pixels of the window.
+			left:0, // left position when the window appears.
+			location:0, // determines whether the address bar is displayed {1 (YES) or 0 (NO)}.
+			menubar:0, // determines whether the menu bar is displayed {1 (YES) or 0 (NO)}.
+			resizable:0, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable.
+			scrollbars:0, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}.
+			status:0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}.
+			width:500, // sets the width in pixels of the window.
+			windowName:null, // name of window set from the name attribute of the element that invokes the click
+			windowURL:null, // url used for the popup
+			top:0, // top position when the window appears.
+			toolbar:0 // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}.
+		};
+		
+		settings = $.extend({}, $.fn.popupWindow.defaultSettings, instanceSettings || {});
+		
+		var windowFeatures =    'height=' + settings.height +
+								',width=' + settings.width +
+								',toolbar=' + settings.toolbar +
+								',scrollbars=' + settings.scrollbars +
+								',status=' + settings.status + 
+								',resizable=' + settings.resizable +
+								',location=' + settings.location +
+								',menuBar=' + settings.menubar;
+
+				settings.windowName = this.name || settings.windowName;
+				settings.windowURL = this.href || settings.windowURL;
+				var centeredY,centeredX;
+			
+				if(settings.centerBrowser){
+						
+					if ($.browser.msie) {//hacked together for IE browsers
+						centeredY = (window.screenTop - 120) + ((((document.documentElement.clientHeight + 120)/2) - (settings.height/2)));
+						centeredX = window.screenLeft + ((((document.body.offsetWidth + 20)/2) - (settings.width/2)));
+					}else{
+						centeredY = window.screenY + (((window.outerHeight/2) - (settings.height/2)));
+						centeredX = window.screenX + (((window.outerWidth/2) - (settings.width/2)));
+					}
+					window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();
+				}else if(settings.centerScreen){
+					centeredY = (screen.height - settings.height)/2;
+					centeredX = (screen.width - settings.width)/2;
+					window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();
+				}else{
+					window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + settings.left +',top=' + settings.top).focus();	
+				}
+				return false;
+			});
+			
+		});	
+	};
+})(jQuery);
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery.xml2json.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery.xml2json.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery.xml2json.js	(revision 5703)
@@ -0,0 +1,185 @@
+/*
+ ### jQuery XML to JSON Plugin v1.2 - 2013-02-18 ###
+ * http://www.fyneworks.com/ - diego@fyneworks.com
+	* Licensed under http://en.wikipedia.org/wiki/MIT_License
+ ###
+ Website: http://www.fyneworks.com/jquery/xml-to-json/
+*//*
+ # INSPIRED BY: http://www.terracoder.com/
+           AND: http://www.thomasfrank.se/xml_to_json.html
+											AND: http://www.kawa.net/works/js/xml/objtree-e.html
+*//*
+ This simple script converts XML (document of code) into a JSON object. It is the combination of 2
+ 'xml to json' great parsers (see below) which allows for both 'simple' and 'extended' parsing modes.
+*/
+// Avoid collisions
+;if(window.jQuery) (function($){
+ 
+ // Add function to jQuery namespace
+ $.extend({
+  
+  // converts xml documents and xml text to json object
+  xml2json: function(xml, extended) {
+   if(!xml) return {}; // quick fail
+   
+   //### PARSER LIBRARY
+   // Core function
+   function parseXML(node, simple){
+    if(!node) return null;
+    var txt = '', obj = null, att = null;
+    var nt = node.nodeType, nn = jsVar(node.localName || node.nodeName);
+    var nv = node.text || node.nodeValue || '';
+    /*DBG*/ //if(window.console) console.log(['x2j',nn,nt,nv.length+' bytes']);
+    if(node.childNodes){
+     if(node.childNodes.length>0){
+      /*DBG*/ //if(window.console) console.log(['x2j',nn,'CHILDREN',node.childNodes]);
+      $.each(node.childNodes, function(n,cn){
+       var cnt = cn.nodeType, cnn = jsVar(cn.localName || cn.nodeName);
+       var cnv = cn.text || cn.nodeValue || '';
+       /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>a',cnn,cnt,cnv]);
+       if(cnt == 8){
+        /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>b',cnn,'COMMENT (ignore)']);
+        return; // ignore comment node
+       }
+       else if(cnt == 3 || cnt == 4 || !cnn){
+        // ignore white-space in between tags
+        if(cnv.match(/^\s+$/)){
+         /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>c',cnn,'WHITE-SPACE (ignore)']);
+         return;
+        };
+        /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>d',cnn,'TEXT']);
+        txt += cnv.replace(/^\s+/,'').replace(/\s+$/,'');
+								// make sure we ditch trailing spaces from markup
+       }
+       else{
+        /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>e',cnn,'OBJECT']);
+        obj = obj || {};
+        if(obj[cnn]){
+         /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>f',cnn,'ARRAY']);
+         
+									// http://forum.jquery.com/topic/jquery-jquery-xml2json-problems-when-siblings-of-the-same-tagname-only-have-a-textnode-as-a-child
+									if(!obj[cnn].length) obj[cnn] = myArr(obj[cnn]);
+									obj[cnn] = myArr(obj[cnn]);
+         
+									obj[cnn][ obj[cnn].length ] = parseXML(cn, true/* simple */);
+         obj[cnn].length = obj[cnn].length;
+        }
+        else{
+         /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>g',cnn,'dig deeper...']);
+         obj[cnn] = parseXML(cn);
+        };
+       };
+      });
+     };//node.childNodes.length>0
+    };//node.childNodes
+    if(node.attributes){
+     if(node.attributes.length>0){
+      /*DBG*/ //if(window.console) console.log(['x2j',nn,'ATTRIBUTES',node.attributes])
+      att = {}; obj = obj || {};
+      $.each(node.attributes, function(a,at){
+       var atn = jsVar(at.name), atv = at.value;
+       att[atn] = atv;
+       if(obj[atn]){
+        /*DBG*/ //if(window.console) console.log(['x2j',nn,'attr>',atn,'ARRAY']);
+        
+								// http://forum.jquery.com/topic/jquery-jquery-xml2json-problems-when-siblings-of-the-same-tagname-only-have-a-textnode-as-a-child
+								//if(!obj[atn].length) obj[atn] = myArr(obj[atn]);//[ obj[ atn ] ];
+        obj[cnn] = myArr(obj[cnn]);
+								
+								obj[atn][ obj[atn].length ] = atv;
+        obj[atn].length = obj[atn].length;
+       }
+       else{
+        /*DBG*/ //if(window.console) console.log(['x2j',nn,'attr>',atn,'TEXT']);
+        obj[atn] = atv;
+       };
+      });
+      //obj['attributes'] = att;
+     };//node.attributes.length>0
+    };//node.attributes
+    if(obj){
+     obj = $.extend( (txt!='' ? new String(txt) : {}),/* {text:txt},*/ obj || {}/*, att || {}*/);
+     txt = (obj.text) ? (typeof(obj.text)=='object' ? obj.text : [obj.text || '']).concat([txt]) : txt;
+     if(txt) obj.text = txt;
+     txt = '';
+    };
+    var out = obj || txt;
+    //console.log([extended, simple, out]);
+    if(extended){
+     if(txt) out = {};//new String(out);
+     txt = out.text || txt || '';
+     if(txt) out.text = txt;
+     if(!simple) out = myArr(out);
+    };
+    return out;
+   };// parseXML
+   // Core Function End
+   // Utility functions
+   var jsVar = function(s){ return String(s || '').replace(/-/g,"_"); };
+   
+			// NEW isNum function: 01/09/2010
+			// Thanks to Emile Grau, GigaTecnologies S.L., www.gigatransfer.com, www.mygigamail.com
+			function isNum(s){
+				// based on utility function isNum from xml2json plugin (http://www.fyneworks.com/ - diego@fyneworks.com)
+				// few bugs corrected from original function :
+				// - syntax error : regexp.test(string) instead of string.test(reg)
+				// - regexp modified to accept  comma as decimal mark (latin syntax : 25,24 )
+				// - regexp modified to reject if no number before decimal mark  : ".7" is not accepted
+				// - string is "trimmed", allowing to accept space at the beginning and end of string
+				var regexp=/^((-)?([0-9]+)(([\.\,]{0,1})([0-9]+))?$)/
+				return (typeof s == "number") || regexp.test(String((s && typeof s == "string") ? jQuery.trim(s) : ''));
+			};
+			// OLD isNum function: (for reference only)
+			//var isNum = function(s){ return (typeof s == "number") || String((s && typeof s == "string") ? s : '').test(/^((-)?([0-9]*)((\.{0,1})([0-9]+))?$)/); };
+																
+   var myArr = function(o){
+    
+				// http://forum.jquery.com/topic/jquery-jquery-xml2json-problems-when-siblings-of-the-same-tagname-only-have-a-textnode-as-a-child
+				//if(!o.length) o = [ o ]; o.length=o.length;
+    if(!$.isArray(o)) o = [ o ]; o.length=o.length;
+				
+				// here is where you can attach additional functionality, such as searching and sorting...
+    return o;
+   };
+   // Utility functions End
+   //### PARSER LIBRARY END
+   
+   // Convert plain text to xml
+   if(typeof xml=='string') xml = $.text2xml(xml);
+   
+   // Quick fail if not xml (or if this is a node)
+   if(!xml.nodeType) return;
+   if(xml.nodeType == 3 || xml.nodeType == 4) return xml.nodeValue;
+   
+   // Find xml root node
+   var root = (xml.nodeType == 9) ? xml.documentElement : xml;
+   
+   // Convert xml to json
+   var out = parseXML(root, true /* simple */);
+   
+   // Clean-up memory
+   xml = null; root = null;
+   
+   // Send output
+   return out;
+  },
+  
+  // Convert text to XML DOM
+  text2xml: function(str) {
+   // NOTE: I'd like to use jQuery for this, but jQuery makes all tags uppercase
+   //return $(xml)[0];
+   var out;
+   try{
+    var xml = ((!$.support.opacity && !$.support.style))?new ActiveXObject("Microsoft.XMLDOM"):new DOMParser();
+    xml.async = false;
+   }catch(e){ throw new Error("XML Parser could not be instantiated") };
+   try{
+    if((!$.support.opacity && !$.support.style)) out = (xml.loadXML(str))?xml:false;
+    else out = xml.parseFromString(str, "text/xml");
+   }catch(e){ throw new Error("Error parsing XML string") };
+   return out;
+  }
+		
+ }); // extend $
+
+})(jQuery);
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery.xmldom.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery.xmldom.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/jquery.xmldom.js	(revision 5703)
@@ -0,0 +1,604 @@
+
+
+
+<!DOCTYPE html>
+<html>
+  <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# githubog: http://ogp.me/ns/fb/githubog#">
+    <meta charset='utf-8'>
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+        <title>jquery-mockjax/lib/jquery.xmldom.js at master Â· appendto/jquery-mockjax Â· GitHub</title>
+    <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub" />
+    <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub" />
+    <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-114.png" />
+    <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114.png" />
+    <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png" />
+    <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png" />
+    <link rel="logo" type="image/svg" href="https://github-media-downloads.s3.amazonaws.com/github-logo.svg" />
+    <meta property="og:image" content="https://github.global.ssl.fastly.net/images/modules/logos_page/Octocat.png">
+    <meta name="hostname" content="fe3.rs.github.com">
+    <link rel="assets" href="https://github.global.ssl.fastly.net/">
+    <link rel="xhr-socket" href="/_sockets" />
+    
+    
+
+
+    <meta name="msapplication-TileImage" content="/windows-tile.png" />
+    <meta name="msapplication-TileColor" content="#ffffff" />
+    <meta name="selected-link" value="repo_source" data-pjax-transient />
+    <meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" />
+
+    
+    
+    <link rel="icon" type="image/x-icon" href="/favicon.ico" />
+
+    <meta content="authenticity_token" name="csrf-param" />
+<meta content="qdwsOGj+2VdOu8ydMXZkGP5Cn4PW++ZwXmi8HtN9O98=" name="csrf-token" />
+
+    <link href="https://github.global.ssl.fastly.net/assets/github-c6ca95663cba6496fe7a5bdd98671b82cd956df3.css" media="all" rel="stylesheet" type="text/css" />
+    <link href="https://github.global.ssl.fastly.net/assets/github2-d35b02ba3940bde9b9f2c3e58f2dfb1ceff5886c.css" media="all" rel="stylesheet" type="text/css" />
+    
+
+
+      <script src="https://github.global.ssl.fastly.net/assets/frameworks-eae23340ab2a6ba722166712e699c87aaf60ad8f.js" type="text/javascript"></script>
+      <script src="https://github.global.ssl.fastly.net/assets/github-9339835a99ecd32fb1a6de9d7d9bf56f272a0b39.js" type="text/javascript"></script>
+      
+      <meta http-equiv="x-pjax-version" content="7bb0bd2d60adf37e0211fafb1d0d1ba9">
+
+        <link data-pjax-transient rel='permalink' href='/appendto/jquery-mockjax/blob/66d263ae49a7949b20f0807f9ed6e9140edfab47/lib/jquery.xmldom.js'>
+  <meta property="og:title" content="jquery-mockjax"/>
+  <meta property="og:type" content="githubog:gitrepository"/>
+  <meta property="og:url" content="https://github.com/appendto/jquery-mockjax"/>
+  <meta property="og:image" content="https://github.global.ssl.fastly.net/images/gravatars/gravatar-user-420.png"/>
+  <meta property="og:site_name" content="GitHub"/>
+  <meta property="og:description" content="jquery-mockjax - The jQuery Mockjax Plugin provides a simple and extremely flexible interface for mocking or simulating ajax requests and responses"/>
+
+  <meta name="description" content="jquery-mockjax - The jQuery Mockjax Plugin provides a simple and extremely flexible interface for mocking or simulating ajax requests and responses" />
+
+  <meta content="225791" name="octolytics-dimension-user_id" /><meta content="appendto" name="octolytics-dimension-user_login" /><meta content="647892" name="octolytics-dimension-repository_id" /><meta content="appendto/jquery-mockjax" name="octolytics-dimension-repository_nwo" /><meta content="true" name="octolytics-dimension-repository_public" /><meta content="false" name="octolytics-dimension-repository_is_fork" /><meta content="647892" name="octolytics-dimension-repository_network_root_id" /><meta content="appendto/jquery-mockjax" name="octolytics-dimension-repository_network_root_nwo" />
+  <link href="https://github.com/appendto/jquery-mockjax/commits/master.atom" rel="alternate" title="Recent Commits to jquery-mockjax:master" type="application/atom+xml" />
+
+  </head>
+
+
+  <body class="logged_out page-blob macintosh vis-public env-production ">
+
+    <div class="wrapper">
+      
+      
+      
+
+
+      
+      <div class="header header-logged-out">
+  <div class="container clearfix">
+
+    <a class="header-logo-wordmark" href="https://github.com/">
+      <span class="mega-octicon octicon-logo-github"></span>
+    </a>
+
+    <div class="header-actions">
+        <a class="button primary" href="/signup">Sign up</a>
+      <a class="button" href="/login?return_to=%2Fappendto%2Fjquery-mockjax%2Fblob%2Fmaster%2Flib%2Fjquery.xmldom.js">Sign in</a>
+    </div>
+
+    <div class="command-bar js-command-bar  in-repository">
+
+
+      <ul class="top-nav">
+          <li class="explore"><a href="/explore">Explore</a></li>
+        <li class="features"><a href="/features">Features</a></li>
+          <li class="enterprise"><a href="https://enterprise.github.com/">Enterprise</a></li>
+          <li class="blog"><a href="/blog">Blog</a></li>
+      </ul>
+        <form accept-charset="UTF-8" action="/search" class="command-bar-form" id="top_search_form" method="get">
+
+<input type="text" data-hotkey="/ s" name="q" id="js-command-bar-field" placeholder="Search or type a command" tabindex="1" autocapitalize="off"
+    
+    
+      data-repo="appendto/jquery-mockjax"
+      data-branch="master"
+      data-sha="ac55331bd264bf031448282731e289f1126dffa3"
+  >
+
+    <input type="hidden" name="nwo" value="appendto/jquery-mockjax" />
+
+    <div class="select-menu js-menu-container js-select-menu search-context-select-menu">
+      <span class="minibutton select-menu-button js-menu-target">
+        <span class="js-select-button">This repository</span>
+      </span>
+
+      <div class="select-menu-modal-holder js-menu-content js-navigation-container">
+        <div class="select-menu-modal">
+
+          <div class="select-menu-item js-navigation-item js-this-repository-navigation-item selected">
+            <span class="select-menu-item-icon octicon octicon-check"></span>
+            <input type="radio" class="js-search-this-repository" name="search_target" value="repository" checked="checked" />
+            <div class="select-menu-item-text js-select-button-text">This repository</div>
+          </div> <!-- /.select-menu-item -->
+
+          <div class="select-menu-item js-navigation-item js-all-repositories-navigation-item">
+            <span class="select-menu-item-icon octicon octicon-check"></span>
+            <input type="radio" name="search_target" value="global" />
+            <div class="select-menu-item-text js-select-button-text">All repositories</div>
+          </div> <!-- /.select-menu-item -->
+
+        </div>
+      </div>
+    </div>
+
+  <span class="octicon help tooltipped downwards" title="Show command bar help">
+    <span class="octicon octicon-question"></span>
+  </span>
+
+
+  <input type="hidden" name="ref" value="cmdform">
+
+</form>
+    </div>
+
+  </div>
+</div>
+
+
+      
+
+
+          <div class="site" itemscope itemtype="http://schema.org/WebPage">
+    
+    <div class="pagehead repohead instapaper_ignore readability-menu">
+      <div class="container">
+        
+
+<ul class="pagehead-actions">
+
+
+  <li>
+  <a href="/login?return_to=%2Fappendto%2Fjquery-mockjax"
+  class="minibutton with-count js-toggler-target star-button entice tooltipped upwards "
+  title="You must be signed in to use this feature" rel="nofollow">
+  <span class="octicon octicon-star"></span>Star
+</a>
+<a class="social-count js-social-count" href="/appendto/jquery-mockjax/stargazers">
+  886
+</a>
+
+  </li>
+
+    <li>
+      <a href="/login?return_to=%2Fappendto%2Fjquery-mockjax"
+        class="minibutton with-count js-toggler-target fork-button entice tooltipped upwards"
+        title="You must be signed in to fork a repository" rel="nofollow">
+        <span class="octicon octicon-git-branch"></span>Fork
+      </a>
+      <a href="/appendto/jquery-mockjax/network" class="social-count">
+        147
+      </a>
+    </li>
+</ul>
+
+        <h1 itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public">
+          <span class="repo-label"><span>public</span></span>
+          <span class="mega-octicon octicon-repo"></span>
+          <span class="author">
+            <a href="/appendto" class="url fn" itemprop="url" rel="author"><span itemprop="title">appendto</span></a></span
+          ><span class="repohead-name-divider">/</span><strong
+          ><a href="/appendto/jquery-mockjax" class="js-current-repository js-repo-home-link">jquery-mockjax</a></strong>
+
+          <span class="page-context-loader">
+            <img alt="Octocat-spinner-32" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+          </span>
+
+        </h1>
+      </div><!-- /.container -->
+    </div><!-- /.repohead -->
+
+    <div class="container">
+
+      <div class="repository-with-sidebar repo-container ">
+
+        <div class="repository-sidebar">
+            
+
+<div class="repo-nav repo-nav-full js-repository-container-pjax js-octicon-loaders">
+  <div class="repo-nav-contents">
+    <ul class="repo-menu">
+      <li class="tooltipped leftwards" title="Code">
+        <a href="/appendto/jquery-mockjax" aria-label="Code" class="js-selected-navigation-item selected" data-gotokey="c" data-pjax="true" data-selected-links="repo_source repo_downloads repo_commits repo_tags repo_branches /appendto/jquery-mockjax">
+          <span class="octicon octicon-code"></span> <span class="full-word">Code</span>
+          <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>      </li>
+
+        <li class="tooltipped leftwards" title="Issues">
+          <a href="/appendto/jquery-mockjax/issues" aria-label="Issues" class="js-selected-navigation-item js-disable-pjax" data-gotokey="i" data-selected-links="repo_issues /appendto/jquery-mockjax/issues">
+            <span class="octicon octicon-issue-opened"></span> <span class="full-word">Issues</span>
+            <span class='counter'>16</span>
+            <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>        </li>
+
+      <li class="tooltipped leftwards" title="Pull Requests"><a href="/appendto/jquery-mockjax/pulls" aria-label="Pull Requests" class="js-selected-navigation-item js-disable-pjax" data-gotokey="p" data-selected-links="repo_pulls /appendto/jquery-mockjax/pulls">
+            <span class="octicon octicon-git-pull-request"></span> <span class="full-word">Pull Requests</span>
+            <span class='counter'>7</span>
+            <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>      </li>
+
+
+        <li class="tooltipped leftwards" title="Wiki">
+          <a href="/appendto/jquery-mockjax/wiki" aria-label="Wiki" class="js-selected-navigation-item " data-pjax="true" data-selected-links="repo_wiki /appendto/jquery-mockjax/wiki">
+            <span class="octicon octicon-book"></span> <span class="full-word">Wiki</span>
+            <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>        </li>
+    </ul>
+    <div class="repo-menu-separator"></div>
+    <ul class="repo-menu">
+
+      <li class="tooltipped leftwards" title="Pulse">
+        <a href="/appendto/jquery-mockjax/pulse" aria-label="Pulse" class="js-selected-navigation-item " data-pjax="true" data-selected-links="pulse /appendto/jquery-mockjax/pulse">
+          <span class="octicon octicon-pulse"></span> <span class="full-word">Pulse</span>
+          <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>      </li>
+
+      <li class="tooltipped leftwards" title="Graphs">
+        <a href="/appendto/jquery-mockjax/graphs" aria-label="Graphs" class="js-selected-navigation-item " data-pjax="true" data-selected-links="repo_graphs repo_contributors /appendto/jquery-mockjax/graphs">
+          <span class="octicon octicon-graph"></span> <span class="full-word">Graphs</span>
+          <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>      </li>
+
+      <li class="tooltipped leftwards" title="Network">
+        <a href="/appendto/jquery-mockjax/network" aria-label="Network" class="js-selected-navigation-item js-disable-pjax" data-selected-links="repo_network /appendto/jquery-mockjax/network">
+          <span class="octicon octicon-git-branch"></span> <span class="full-word">Network</span>
+          <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>      </li>
+
+    </ul>
+
+  </div>
+</div>
+
+            <div class="only-with-full-nav">
+              
+
+  
+
+<div class="clone-url open"
+  data-protocol-type="http"
+  data-url="/users/set_protocol?protocol_selector=http&amp;protocol_type=clone">
+  <h3><strong>HTTPS</strong> clone URL</h3>
+
+  <input type="text" class="clone js-url-field"
+         value="https://github.com/appendto/jquery-mockjax.git" readonly="readonly">
+
+  <span class="js-zeroclipboard url-box-clippy minibutton zeroclipboard-button" data-clipboard-text="https://github.com/appendto/jquery-mockjax.git" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
+</div>
+
+  
+
+<div class="clone-url "
+  data-protocol-type="subversion"
+  data-url="/users/set_protocol?protocol_selector=subversion&amp;protocol_type=clone">
+  <h3><strong>Subversion</strong> checkout URL</h3>
+
+  <input type="text" class="clone js-url-field"
+         value="https://github.com/appendto/jquery-mockjax" readonly="readonly">
+
+  <span class="js-zeroclipboard url-box-clippy minibutton zeroclipboard-button" data-clipboard-text="https://github.com/appendto/jquery-mockjax" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
+</div>
+
+
+
+<p class="clone-options">You can clone with
+    <a href="#" class="js-clone-selector" data-protocol="http">HTTPS</a>,
+    <a href="#" class="js-clone-selector" data-protocol="subversion">Subversion</a>,
+  and <a href="https://help.github.com/articles/which-remote-url-should-i-use">other methods.</a>
+</p>
+
+  <a href="http://mac.github.com" class="minibutton sidebar-button">
+    <span class="octicon octicon-device-desktop"></span>
+    Clone in Desktop
+  </a>
+
+
+                <a href="/appendto/jquery-mockjax/archive/master.zip"
+                   class="minibutton sidebar-button"
+                   title="Download this repository as a zip file"
+                   rel="nofollow">
+                  <span class="octicon octicon-cloud-download"></span>
+                  Download ZIP
+                </a>
+            </div>
+        </div><!-- /.repository-sidebar -->
+
+        <div id="js-repo-pjax-container" class="repository-content context-loader-container" data-pjax-container>
+          
+
+
+<!-- blob contrib key: blob_contributors:v21:96f01532ffb6364e7c49874addd81cd1 -->
+<!-- blob contrib frag key: views10/v8/blob_contributors:v21:96f01532ffb6364e7c49874addd81cd1 -->
+
+<p title="This is a placeholder element" class="js-history-link-replace hidden"></p>
+
+<a href="/appendto/jquery-mockjax/find/master" data-pjax data-hotkey="t" style="display:none">Show File Finder</a>
+
+<div class="file-navigation">
+  
+
+
+<div class="select-menu js-menu-container js-select-menu" >
+  <span class="minibutton select-menu-button js-menu-target" data-hotkey="w"
+    data-master-branch="master"
+    data-ref="master">
+    <span class="octicon octicon-git-branch"></span>
+    <i>branch:</i>
+    <span class="js-select-button">master</span>
+  </span>
+
+  <div class="select-menu-modal-holder js-menu-content js-navigation-container" data-pjax>
+
+    <div class="select-menu-modal">
+      <div class="select-menu-header">
+        <span class="select-menu-title">Switch branches/tags</span>
+        <span class="octicon octicon-remove-close js-menu-close"></span>
+      </div> <!-- /.select-menu-header -->
+
+      <div class="select-menu-filters">
+        <div class="select-menu-text-filter">
+          <input type="text" id="context-commitish-filter-field" class="js-filterable-field js-navigation-enable" placeholder="Filter branches/tags">
+        </div>
+        <div class="select-menu-tabs">
+          <ul>
+            <li class="select-menu-tab">
+              <a href="#" data-tab-filter="branches" class="js-select-menu-tab">Branches</a>
+            </li>
+            <li class="select-menu-tab">
+              <a href="#" data-tab-filter="tags" class="js-select-menu-tab">Tags</a>
+            </li>
+          </ul>
+        </div><!-- /.select-menu-tabs -->
+      </div><!-- /.select-menu-filters -->
+
+      <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="branches">
+
+        <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring">
+
+
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/99-isMockDataEqual-checks-for-additional-props/lib/jquery.xmldom.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="99-isMockDataEqual-checks-for-additional-props" data-skip-pjax="true" rel="nofollow" title="99-isMockDataEqual-checks-for-additional-props">99-isMockDataEqual-checks-for-additional-props</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/anvil/lib/jquery.xmldom.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="anvil" data-skip-pjax="true" rel="nofollow" title="anvil">anvil</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/fuzzy-wildcard/lib/jquery.xmldom.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="fuzzy-wildcard" data-skip-pjax="true" rel="nofollow" title="fuzzy-wildcard">fuzzy-wildcard</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/gh-pages/lib/jquery.xmldom.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="gh-pages" data-skip-pjax="true" rel="nofollow" title="gh-pages">gh-pages</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item selected">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/master/lib/jquery.xmldom.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="master" data-skip-pjax="true" rel="nofollow" title="master">master</a>
+            </div> <!-- /.select-menu-item -->
+        </div>
+
+          <div class="select-menu-no-results">Nothing to show</div>
+      </div> <!-- /.select-menu-list -->
+
+      <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="tags">
+        <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring">
+
+
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/v1.5.2/lib/jquery.xmldom.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="v1.5.2" data-skip-pjax="true" rel="nofollow" title="v1.5.2">v1.5.2</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/v1.5.1/lib/jquery.xmldom.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="v1.5.1" data-skip-pjax="true" rel="nofollow" title="v1.5.1">v1.5.1</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/v1.5.0/lib/jquery.xmldom.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="v1.5.0" data-skip-pjax="true" rel="nofollow" title="v1.5.0">v1.5.0</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/v1.4.0/lib/jquery.xmldom.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="v1.4.0" data-skip-pjax="true" rel="nofollow" title="v1.4.0">v1.4.0</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/v1.3.2/lib/jquery.xmldom.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="v1.3.2" data-skip-pjax="true" rel="nofollow" title="v1.3.2">v1.3.2</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/v1.3.1/lib/jquery.xmldom.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="v1.3.1" data-skip-pjax="true" rel="nofollow" title="v1.3.1">v1.3.1</a>
+            </div> <!-- /.select-menu-item -->
+        </div>
+
+        <div class="select-menu-no-results">Nothing to show</div>
+      </div> <!-- /.select-menu-list -->
+
+    </div> <!-- /.select-menu-modal -->
+  </div> <!-- /.select-menu-modal-holder -->
+</div> <!-- /.select-menu -->
+
+  <div class="breadcrumb">
+    <span class='repo-root js-repo-root'><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/appendto/jquery-mockjax" data-branch="master" data-direction="back" data-pjax="true" itemscope="url"><span itemprop="title">jquery-mockjax</span></a></span></span><span class="separator"> / </span><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/appendto/jquery-mockjax/tree/master/lib" data-branch="master" data-direction="back" data-pjax="true" itemscope="url"><span itemprop="title">lib</span></a></span><span class="separator"> / </span><strong class="final-path">jquery.xmldom.js</strong> <span class="js-zeroclipboard minibutton zeroclipboard-button" data-clipboard-text="lib/jquery.xmldom.js" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
+  </div>
+</div>
+
+
+  <div class="commit commit-loader file-history-tease js-deferred-content" data-url="/appendto/jquery-mockjax/contributors/master/lib/jquery.xmldom.js">
+    Fetching contributorsâŠ
+
+    <div class="participation">
+      <p class="loader-loading"><img alt="Octocat-spinner-32-eaf2f5" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32-EAF2F5.gif" width="16" /></p>
+      <p class="loader-error">Cannot retrieve contributors at this time</p>
+    </div>
+  </div>
+
+<div id="files" class="bubble">
+  <div class="file">
+    <div class="meta">
+      <div class="info">
+        <span class="icon"><b class="octicon octicon-file-text"></b></span>
+        <span class="mode" title="File Mode">file</span>
+          <span>46 lines (45 sloc)</span>
+        <span>1.212 kb</span>
+      </div>
+      <div class="actions">
+        <div class="button-group">
+              <a class="minibutton js-entice" href=""
+                 data-entice="You must be signed in to make or propose changes">Edit</a>
+          <a href="/appendto/jquery-mockjax/raw/master/lib/jquery.xmldom.js" class="button minibutton " id="raw-url">Raw</a>
+            <a href="/appendto/jquery-mockjax/blame/master/lib/jquery.xmldom.js" class="button minibutton ">Blame</a>
+          <a href="/appendto/jquery-mockjax/commits/master/lib/jquery.xmldom.js" class="button minibutton " rel="nofollow">History</a>
+        </div><!-- /.button-group -->
+            <a class="minibutton danger empty-icon js-entice" href=""
+               data-entice="You must be signed in and on a branch to make or propose changes">
+            Delete
+          </a>
+      </div><!-- /.actions -->
+
+    </div>
+        <div class="blob-wrapper data type-javascript js-blob-data">
+      <table class="file-code file-diff">
+        <tr class="file-code-line">
+          <td class="blob-line-nums">
+            <span id="L1" rel="#L1">1</span>
+<span id="L2" rel="#L2">2</span>
+<span id="L3" rel="#L3">3</span>
+<span id="L4" rel="#L4">4</span>
+<span id="L5" rel="#L5">5</span>
+<span id="L6" rel="#L6">6</span>
+<span id="L7" rel="#L7">7</span>
+<span id="L8" rel="#L8">8</span>
+<span id="L9" rel="#L9">9</span>
+<span id="L10" rel="#L10">10</span>
+<span id="L11" rel="#L11">11</span>
+<span id="L12" rel="#L12">12</span>
+<span id="L13" rel="#L13">13</span>
+<span id="L14" rel="#L14">14</span>
+<span id="L15" rel="#L15">15</span>
+<span id="L16" rel="#L16">16</span>
+<span id="L17" rel="#L17">17</span>
+<span id="L18" rel="#L18">18</span>
+<span id="L19" rel="#L19">19</span>
+<span id="L20" rel="#L20">20</span>
+<span id="L21" rel="#L21">21</span>
+<span id="L22" rel="#L22">22</span>
+<span id="L23" rel="#L23">23</span>
+<span id="L24" rel="#L24">24</span>
+<span id="L25" rel="#L25">25</span>
+<span id="L26" rel="#L26">26</span>
+<span id="L27" rel="#L27">27</span>
+<span id="L28" rel="#L28">28</span>
+<span id="L29" rel="#L29">29</span>
+<span id="L30" rel="#L30">30</span>
+<span id="L31" rel="#L31">31</span>
+<span id="L32" rel="#L32">32</span>
+<span id="L33" rel="#L33">33</span>
+<span id="L34" rel="#L34">34</span>
+<span id="L35" rel="#L35">35</span>
+<span id="L36" rel="#L36">36</span>
+<span id="L37" rel="#L37">37</span>
+<span id="L38" rel="#L38">38</span>
+<span id="L39" rel="#L39">39</span>
+<span id="L40" rel="#L40">40</span>
+<span id="L41" rel="#L41">41</span>
+<span id="L42" rel="#L42">42</span>
+<span id="L43" rel="#L43">43</span>
+<span id="L44" rel="#L44">44</span>
+<span id="L45" rel="#L45">45</span>
+<span id="L46" rel="#L46">46</span>
+
+          </td>
+          <td class="blob-line-code">
+                  <div class="highlight"><pre><div class='line' id='LC1'><span class="cm">/*!</span></div><div class='line' id='LC2'><span class="cm"> * jQuery xmlDOM Plugin v1.0</span></div><div class='line' id='LC3'><span class="cm"> * http://outwestmedia.com/jquery-plugins/xmldom/</span></div><div class='line' id='LC4'><span class="cm"> *</span></div><div class='line' id='LC5'><span class="cm"> * Released: 2009-04-06</span></div><div class='line' id='LC6'><span class="cm"> * Version: 1.0</span></div><div class='line' id='LC7'><span class="cm"> *</span></div><div class='line' id='LC8'><span class="cm"> * Copyright (c) 2009 Jonathan Sharp, Out West Media LLC.</span></div><div class='line' id='LC9'><span class="cm"> * Dual licensed under the MIT and GPL licenses.</span></div><div class='line' id='LC10'><span class="cm"> * http://docs.jquery.com/License</span></div><div class='line' id='LC11'><span class="cm"> */</span></div><div class='line' id='LC12'><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">$</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC13'>	<span class="c1">// IE DOMParser wrapper</span></div><div class='line' id='LC14'>	<span class="k">if</span> <span class="p">(</span> <span class="nb">window</span><span class="p">[</span><span class="s1">&#39;DOMParser&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="kc">undefined</span> <span class="o">&amp;&amp;</span> <span class="nb">window</span><span class="p">.</span><span class="nx">ActiveXObject</span> <span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC15'>		<span class="nx">DOMParser</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span> <span class="p">};</span></div><div class='line' id='LC16'>		<span class="nx">DOMParser</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">parseFromString</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span> <span class="nx">xmlString</span> <span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC17'>			<span class="kd">var</span> <span class="nx">doc</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">ActiveXObject</span><span class="p">(</span><span class="s1">&#39;Microsoft.XMLDOM&#39;</span><span class="p">);</span></div><div class='line' id='LC18'>	        <span class="nx">doc</span><span class="p">.</span><span class="nx">async</span> <span class="o">=</span> <span class="s1">&#39;false&#39;</span><span class="p">;</span></div><div class='line' id='LC19'>	        <span class="nx">doc</span><span class="p">.</span><span class="nx">loadXML</span><span class="p">(</span> <span class="nx">xmlString</span> <span class="p">);</span></div><div class='line' id='LC20'>			<span class="k">return</span> <span class="nx">doc</span><span class="p">;</span></div><div class='line' id='LC21'>		<span class="p">};</span></div><div class='line' id='LC22'>	<span class="p">}</span></div><div class='line' id='LC23'><br/></div><div class='line' id='LC24'>	<span class="nx">$</span><span class="p">.</span><span class="nx">xmlDOM</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">xml</span><span class="p">,</span> <span class="nx">onErrorFn</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC25'>		<span class="k">try</span> <span class="p">{</span></div><div class='line' id='LC26'>			<span class="kd">var</span> <span class="nx">xmlDoc</span> 	<span class="o">=</span> <span class="p">(</span> <span class="k">new</span> <span class="nx">DOMParser</span><span class="p">()</span> <span class="p">).</span><span class="nx">parseFromString</span><span class="p">(</span> <span class="nx">xml</span><span class="p">,</span> <span class="s1">&#39;text/xml&#39;</span> <span class="p">);</span></div><div class='line' id='LC27'>			<span class="k">if</span> <span class="p">(</span> <span class="nx">$</span><span class="p">.</span><span class="nx">isXMLDoc</span><span class="p">(</span> <span class="nx">xmlDoc</span> <span class="p">)</span> <span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC28'>				<span class="kd">var</span> <span class="nx">err</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span><span class="s1">&#39;parsererror&#39;</span><span class="p">,</span> <span class="nx">xmlDoc</span><span class="p">);</span></div><div class='line' id='LC29'>				<span class="k">if</span> <span class="p">(</span> <span class="nx">err</span><span class="p">.</span><span class="nx">length</span> <span class="o">==</span> <span class="mi">1</span> <span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC30'>					<span class="k">throw</span><span class="p">(</span><span class="s1">&#39;Error: &#39;</span> <span class="o">+</span> <span class="nx">$</span><span class="p">(</span><span class="nx">xmlDoc</span><span class="p">).</span><span class="nx">text</span><span class="p">()</span> <span class="p">);</span></div><div class='line' id='LC31'>				<span class="p">}</span></div><div class='line' id='LC32'>			<span class="p">}</span> <span class="k">else</span> <span class="p">{</span></div><div class='line' id='LC33'>				<span class="k">throw</span><span class="p">(</span><span class="s1">&#39;Unable to parse XML&#39;</span><span class="p">);</span></div><div class='line' id='LC34'>			<span class="p">}</span></div><div class='line' id='LC35'>		<span class="p">}</span> <span class="k">catch</span><span class="p">(</span> <span class="nx">e</span> <span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC36'>			<span class="kd">var</span> <span class="nx">msg</span> <span class="o">=</span> <span class="p">(</span> <span class="nx">e</span><span class="p">.</span><span class="nx">name</span> <span class="o">==</span> <span class="kc">undefined</span> <span class="o">?</span> <span class="nx">e</span> <span class="o">:</span> <span class="nx">e</span><span class="p">.</span><span class="nx">name</span> <span class="o">+</span> <span class="s1">&#39;: &#39;</span> <span class="o">+</span> <span class="nx">e</span><span class="p">.</span><span class="nx">message</span> <span class="p">);</span></div><div class='line' id='LC37'>			<span class="k">if</span> <span class="p">(</span> <span class="nx">$</span><span class="p">.</span><span class="nx">isFunction</span><span class="p">(</span> <span class="nx">onErrorFn</span> <span class="p">)</span> <span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC38'>				<span class="nx">onErrorFn</span><span class="p">(</span> <span class="nx">msg</span> <span class="p">);</span></div><div class='line' id='LC39'>			<span class="p">}</span> <span class="k">else</span> <span class="p">{</span></div><div class='line' id='LC40'>				<span class="nx">$</span><span class="p">(</span><span class="nb">document</span><span class="p">).</span><span class="nx">trigger</span><span class="p">(</span><span class="s1">&#39;xmlParseError&#39;</span><span class="p">,</span> <span class="p">[</span> <span class="nx">msg</span> <span class="p">]);</span></div><div class='line' id='LC41'>			<span class="p">}</span></div><div class='line' id='LC42'>			<span class="k">return</span> <span class="nx">$</span><span class="p">([]);</span></div><div class='line' id='LC43'>		<span class="p">}</span></div><div class='line' id='LC44'>		<span class="k">return</span> <span class="nx">$</span><span class="p">(</span> <span class="nx">xmlDoc</span> <span class="p">);</span></div><div class='line' id='LC45'>	<span class="p">};</span></div><div class='line' id='LC46'><span class="p">})(</span><span class="nx">jQuery</span><span class="p">);</span></div></pre></div>
+          </td>
+        </tr>
+      </table>
+  </div>
+
+  </div>
+</div>
+
+<a href="#jump-to-line" rel="facebox[.linejump]" data-hotkey="l" class="js-jump-to-line" style="display:none">Jump to Line</a>
+<div id="jump-to-line" style="display:none">
+  <form accept-charset="UTF-8" class="js-jump-to-line-form">
+    <input class="linejump-input js-jump-to-line-field" type="text" placeholder="Jump to line&hellip;" autofocus>
+    <button type="submit" class="button">Go</button>
+  </form>
+</div>
+
+        </div>
+
+      </div><!-- /.repo-container -->
+      <div class="modal-backdrop"></div>
+    </div><!-- /.container -->
+  </div><!-- /.site -->
+
+
+    </div><!-- /.wrapper -->
+
+      <div class="container">
+  <div class="site-footer">
+    <ul class="site-footer-links right">
+      <li><a href="https://status.github.com/">Status</a></li>
+      <li><a href="http://developer.github.com">API</a></li>
+      <li><a href="http://training.github.com">Training</a></li>
+      <li><a href="http://shop.github.com">Shop</a></li>
+      <li><a href="/blog">Blog</a></li>
+      <li><a href="/about">About</a></li>
+
+    </ul>
+
+    <a href="/">
+      <span class="mega-octicon octicon-mark-github"></span>
+    </a>
+
+    <ul class="site-footer-links">
+      <li>&copy; 2013 <span title="0.13153s from fe3.rs.github.com">GitHub</span>, Inc.</li>
+        <li><a href="/site/terms">Terms</a></li>
+        <li><a href="/site/privacy">Privacy</a></li>
+        <li><a href="/security">Security</a></li>
+        <li><a href="/contact">Contact</a></li>
+    </ul>
+  </div><!-- /.site-footer -->
+</div><!-- /.container -->
+
+
+    <div class="fullscreen-overlay js-fullscreen-overlay" id="fullscreen_overlay">
+  <div class="fullscreen-container js-fullscreen-container">
+    <div class="textarea-wrap">
+      <textarea name="fullscreen-contents" id="fullscreen-contents" class="js-fullscreen-contents" placeholder="" data-suggester="fullscreen_suggester"></textarea>
+          <div class="suggester-container">
+              <div class="suggester fullscreen-suggester js-navigation-container" id="fullscreen_suggester"
+                 data-url="/appendto/jquery-mockjax/suggestions/commit">
+              </div>
+          </div>
+    </div>
+  </div>
+  <div class="fullscreen-sidebar">
+    <a href="#" class="exit-fullscreen js-exit-fullscreen tooltipped leftwards" title="Exit Zen Mode">
+      <span class="mega-octicon octicon-screen-normal"></span>
+    </a>
+    <a href="#" class="theme-switcher js-theme-switcher tooltipped leftwards"
+      title="Switch themes">
+      <span class="octicon octicon-color-mode"></span>
+    </a>
+  </div>
+</div>
+
+
+
+    <div id="ajax-error-message" class="flash flash-error">
+      <span class="octicon octicon-alert"></span>
+      <a href="#" class="octicon octicon-remove-close close ajax-error-dismiss"></a>
+      Something went wrong with that request. Please try again.
+    </div>
+
+    
+  </body>
+</html>
+
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/json2.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/json2.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/lib/json2.js	(revision 5703)
@@ -0,0 +1,1041 @@
+
+
+
+<!DOCTYPE html>
+<html>
+  <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# githubog: http://ogp.me/ns/fb/githubog#">
+    <meta charset='utf-8'>
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+        <title>jquery-mockjax/lib/json2.js at master Â· appendto/jquery-mockjax Â· GitHub</title>
+    <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub" />
+    <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub" />
+    <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-114.png" />
+    <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114.png" />
+    <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png" />
+    <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png" />
+    <link rel="logo" type="image/svg" href="https://github-media-downloads.s3.amazonaws.com/github-logo.svg" />
+    <meta property="og:image" content="https://github.global.ssl.fastly.net/images/modules/logos_page/Octocat.png">
+    <meta name="hostname" content="fe3.rs.github.com">
+    <link rel="assets" href="https://github.global.ssl.fastly.net/">
+    <link rel="xhr-socket" href="/_sockets" />
+    
+    
+
+
+    <meta name="msapplication-TileImage" content="/windows-tile.png" />
+    <meta name="msapplication-TileColor" content="#ffffff" />
+    <meta name="selected-link" value="repo_source" data-pjax-transient />
+    <meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" />
+
+    
+    
+    <link rel="icon" type="image/x-icon" href="/favicon.ico" />
+
+    <meta content="authenticity_token" name="csrf-param" />
+<meta content="qdwsOGj+2VdOu8ydMXZkGP5Cn4PW++ZwXmi8HtN9O98=" name="csrf-token" />
+
+    <link href="https://github.global.ssl.fastly.net/assets/github-c6ca95663cba6496fe7a5bdd98671b82cd956df3.css" media="all" rel="stylesheet" type="text/css" />
+    <link href="https://github.global.ssl.fastly.net/assets/github2-d35b02ba3940bde9b9f2c3e58f2dfb1ceff5886c.css" media="all" rel="stylesheet" type="text/css" />
+    
+
+
+      <script src="https://github.global.ssl.fastly.net/assets/frameworks-eae23340ab2a6ba722166712e699c87aaf60ad8f.js" type="text/javascript"></script>
+      <script src="https://github.global.ssl.fastly.net/assets/github-9339835a99ecd32fb1a6de9d7d9bf56f272a0b39.js" type="text/javascript"></script>
+      
+      <meta http-equiv="x-pjax-version" content="7bb0bd2d60adf37e0211fafb1d0d1ba9">
+
+        <link data-pjax-transient rel='permalink' href='/appendto/jquery-mockjax/blob/66d263ae49a7949b20f0807f9ed6e9140edfab47/lib/json2.js'>
+  <meta property="og:title" content="jquery-mockjax"/>
+  <meta property="og:type" content="githubog:gitrepository"/>
+  <meta property="og:url" content="https://github.com/appendto/jquery-mockjax"/>
+  <meta property="og:image" content="https://github.global.ssl.fastly.net/images/gravatars/gravatar-user-420.png"/>
+  <meta property="og:site_name" content="GitHub"/>
+  <meta property="og:description" content="jquery-mockjax - The jQuery Mockjax Plugin provides a simple and extremely flexible interface for mocking or simulating ajax requests and responses"/>
+
+  <meta name="description" content="jquery-mockjax - The jQuery Mockjax Plugin provides a simple and extremely flexible interface for mocking or simulating ajax requests and responses" />
+
+  <meta content="225791" name="octolytics-dimension-user_id" /><meta content="appendto" name="octolytics-dimension-user_login" /><meta content="647892" name="octolytics-dimension-repository_id" /><meta content="appendto/jquery-mockjax" name="octolytics-dimension-repository_nwo" /><meta content="true" name="octolytics-dimension-repository_public" /><meta content="false" name="octolytics-dimension-repository_is_fork" /><meta content="647892" name="octolytics-dimension-repository_network_root_id" /><meta content="appendto/jquery-mockjax" name="octolytics-dimension-repository_network_root_nwo" />
+  <link href="https://github.com/appendto/jquery-mockjax/commits/master.atom" rel="alternate" title="Recent Commits to jquery-mockjax:master" type="application/atom+xml" />
+
+  </head>
+
+
+  <body class="logged_out page-blob macintosh vis-public env-production ">
+
+    <div class="wrapper">
+      
+      
+      
+
+
+      
+      <div class="header header-logged-out">
+  <div class="container clearfix">
+
+    <a class="header-logo-wordmark" href="https://github.com/">
+      <span class="mega-octicon octicon-logo-github"></span>
+    </a>
+
+    <div class="header-actions">
+        <a class="button primary" href="/signup">Sign up</a>
+      <a class="button" href="/login?return_to=%2Fappendto%2Fjquery-mockjax%2Fblob%2Fmaster%2Flib%2Fjson2.js">Sign in</a>
+    </div>
+
+    <div class="command-bar js-command-bar  in-repository">
+
+
+      <ul class="top-nav">
+          <li class="explore"><a href="/explore">Explore</a></li>
+        <li class="features"><a href="/features">Features</a></li>
+          <li class="enterprise"><a href="https://enterprise.github.com/">Enterprise</a></li>
+          <li class="blog"><a href="/blog">Blog</a></li>
+      </ul>
+        <form accept-charset="UTF-8" action="/search" class="command-bar-form" id="top_search_form" method="get">
+
+<input type="text" data-hotkey="/ s" name="q" id="js-command-bar-field" placeholder="Search or type a command" tabindex="1" autocapitalize="off"
+    
+    
+      data-repo="appendto/jquery-mockjax"
+      data-branch="master"
+      data-sha="ac55331bd264bf031448282731e289f1126dffa3"
+  >
+
+    <input type="hidden" name="nwo" value="appendto/jquery-mockjax" />
+
+    <div class="select-menu js-menu-container js-select-menu search-context-select-menu">
+      <span class="minibutton select-menu-button js-menu-target">
+        <span class="js-select-button">This repository</span>
+      </span>
+
+      <div class="select-menu-modal-holder js-menu-content js-navigation-container">
+        <div class="select-menu-modal">
+
+          <div class="select-menu-item js-navigation-item js-this-repository-navigation-item selected">
+            <span class="select-menu-item-icon octicon octicon-check"></span>
+            <input type="radio" class="js-search-this-repository" name="search_target" value="repository" checked="checked" />
+            <div class="select-menu-item-text js-select-button-text">This repository</div>
+          </div> <!-- /.select-menu-item -->
+
+          <div class="select-menu-item js-navigation-item js-all-repositories-navigation-item">
+            <span class="select-menu-item-icon octicon octicon-check"></span>
+            <input type="radio" name="search_target" value="global" />
+            <div class="select-menu-item-text js-select-button-text">All repositories</div>
+          </div> <!-- /.select-menu-item -->
+
+        </div>
+      </div>
+    </div>
+
+  <span class="octicon help tooltipped downwards" title="Show command bar help">
+    <span class="octicon octicon-question"></span>
+  </span>
+
+
+  <input type="hidden" name="ref" value="cmdform">
+
+</form>
+    </div>
+
+  </div>
+</div>
+
+
+      
+
+
+          <div class="site" itemscope itemtype="http://schema.org/WebPage">
+    
+    <div class="pagehead repohead instapaper_ignore readability-menu">
+      <div class="container">
+        
+
+<ul class="pagehead-actions">
+
+
+  <li>
+  <a href="/login?return_to=%2Fappendto%2Fjquery-mockjax"
+  class="minibutton with-count js-toggler-target star-button entice tooltipped upwards "
+  title="You must be signed in to use this feature" rel="nofollow">
+  <span class="octicon octicon-star"></span>Star
+</a>
+<a class="social-count js-social-count" href="/appendto/jquery-mockjax/stargazers">
+  886
+</a>
+
+  </li>
+
+    <li>
+      <a href="/login?return_to=%2Fappendto%2Fjquery-mockjax"
+        class="minibutton with-count js-toggler-target fork-button entice tooltipped upwards"
+        title="You must be signed in to fork a repository" rel="nofollow">
+        <span class="octicon octicon-git-branch"></span>Fork
+      </a>
+      <a href="/appendto/jquery-mockjax/network" class="social-count">
+        147
+      </a>
+    </li>
+</ul>
+
+        <h1 itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public">
+          <span class="repo-label"><span>public</span></span>
+          <span class="mega-octicon octicon-repo"></span>
+          <span class="author">
+            <a href="/appendto" class="url fn" itemprop="url" rel="author"><span itemprop="title">appendto</span></a></span
+          ><span class="repohead-name-divider">/</span><strong
+          ><a href="/appendto/jquery-mockjax" class="js-current-repository js-repo-home-link">jquery-mockjax</a></strong>
+
+          <span class="page-context-loader">
+            <img alt="Octocat-spinner-32" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+          </span>
+
+        </h1>
+      </div><!-- /.container -->
+    </div><!-- /.repohead -->
+
+    <div class="container">
+
+      <div class="repository-with-sidebar repo-container ">
+
+        <div class="repository-sidebar">
+            
+
+<div class="repo-nav repo-nav-full js-repository-container-pjax js-octicon-loaders">
+  <div class="repo-nav-contents">
+    <ul class="repo-menu">
+      <li class="tooltipped leftwards" title="Code">
+        <a href="/appendto/jquery-mockjax" aria-label="Code" class="js-selected-navigation-item selected" data-gotokey="c" data-pjax="true" data-selected-links="repo_source repo_downloads repo_commits repo_tags repo_branches /appendto/jquery-mockjax">
+          <span class="octicon octicon-code"></span> <span class="full-word">Code</span>
+          <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>      </li>
+
+        <li class="tooltipped leftwards" title="Issues">
+          <a href="/appendto/jquery-mockjax/issues" aria-label="Issues" class="js-selected-navigation-item js-disable-pjax" data-gotokey="i" data-selected-links="repo_issues /appendto/jquery-mockjax/issues">
+            <span class="octicon octicon-issue-opened"></span> <span class="full-word">Issues</span>
+            <span class='counter'>16</span>
+            <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>        </li>
+
+      <li class="tooltipped leftwards" title="Pull Requests"><a href="/appendto/jquery-mockjax/pulls" aria-label="Pull Requests" class="js-selected-navigation-item js-disable-pjax" data-gotokey="p" data-selected-links="repo_pulls /appendto/jquery-mockjax/pulls">
+            <span class="octicon octicon-git-pull-request"></span> <span class="full-word">Pull Requests</span>
+            <span class='counter'>7</span>
+            <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>      </li>
+
+
+        <li class="tooltipped leftwards" title="Wiki">
+          <a href="/appendto/jquery-mockjax/wiki" aria-label="Wiki" class="js-selected-navigation-item " data-pjax="true" data-selected-links="repo_wiki /appendto/jquery-mockjax/wiki">
+            <span class="octicon octicon-book"></span> <span class="full-word">Wiki</span>
+            <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>        </li>
+    </ul>
+    <div class="repo-menu-separator"></div>
+    <ul class="repo-menu">
+
+      <li class="tooltipped leftwards" title="Pulse">
+        <a href="/appendto/jquery-mockjax/pulse" aria-label="Pulse" class="js-selected-navigation-item " data-pjax="true" data-selected-links="pulse /appendto/jquery-mockjax/pulse">
+          <span class="octicon octicon-pulse"></span> <span class="full-word">Pulse</span>
+          <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>      </li>
+
+      <li class="tooltipped leftwards" title="Graphs">
+        <a href="/appendto/jquery-mockjax/graphs" aria-label="Graphs" class="js-selected-navigation-item " data-pjax="true" data-selected-links="repo_graphs repo_contributors /appendto/jquery-mockjax/graphs">
+          <span class="octicon octicon-graph"></span> <span class="full-word">Graphs</span>
+          <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>      </li>
+
+      <li class="tooltipped leftwards" title="Network">
+        <a href="/appendto/jquery-mockjax/network" aria-label="Network" class="js-selected-navigation-item js-disable-pjax" data-selected-links="repo_network /appendto/jquery-mockjax/network">
+          <span class="octicon octicon-git-branch"></span> <span class="full-word">Network</span>
+          <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>      </li>
+
+    </ul>
+
+  </div>
+</div>
+
+            <div class="only-with-full-nav">
+              
+
+  
+
+<div class="clone-url open"
+  data-protocol-type="http"
+  data-url="/users/set_protocol?protocol_selector=http&amp;protocol_type=clone">
+  <h3><strong>HTTPS</strong> clone URL</h3>
+
+  <input type="text" class="clone js-url-field"
+         value="https://github.com/appendto/jquery-mockjax.git" readonly="readonly">
+
+  <span class="js-zeroclipboard url-box-clippy minibutton zeroclipboard-button" data-clipboard-text="https://github.com/appendto/jquery-mockjax.git" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
+</div>
+
+  
+
+<div class="clone-url "
+  data-protocol-type="subversion"
+  data-url="/users/set_protocol?protocol_selector=subversion&amp;protocol_type=clone">
+  <h3><strong>Subversion</strong> checkout URL</h3>
+
+  <input type="text" class="clone js-url-field"
+         value="https://github.com/appendto/jquery-mockjax" readonly="readonly">
+
+  <span class="js-zeroclipboard url-box-clippy minibutton zeroclipboard-button" data-clipboard-text="https://github.com/appendto/jquery-mockjax" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
+</div>
+
+
+
+<p class="clone-options">You can clone with
+    <a href="#" class="js-clone-selector" data-protocol="http">HTTPS</a>,
+    <a href="#" class="js-clone-selector" data-protocol="subversion">Subversion</a>,
+  and <a href="https://help.github.com/articles/which-remote-url-should-i-use">other methods.</a>
+</p>
+
+  <a href="http://mac.github.com" class="minibutton sidebar-button">
+    <span class="octicon octicon-device-desktop"></span>
+    Clone in Desktop
+  </a>
+
+
+                <a href="/appendto/jquery-mockjax/archive/master.zip"
+                   class="minibutton sidebar-button"
+                   title="Download this repository as a zip file"
+                   rel="nofollow">
+                  <span class="octicon octicon-cloud-download"></span>
+                  Download ZIP
+                </a>
+            </div>
+        </div><!-- /.repository-sidebar -->
+
+        <div id="js-repo-pjax-container" class="repository-content context-loader-container" data-pjax-container>
+          
+
+
+<!-- blob contrib key: blob_contributors:v21:f4ac92c23ae2ba59199ae72517b109c9 -->
+<!-- blob contrib frag key: views10/v8/blob_contributors:v21:f4ac92c23ae2ba59199ae72517b109c9 -->
+
+<p title="This is a placeholder element" class="js-history-link-replace hidden"></p>
+
+<a href="/appendto/jquery-mockjax/find/master" data-pjax data-hotkey="t" style="display:none">Show File Finder</a>
+
+<div class="file-navigation">
+  
+
+
+<div class="select-menu js-menu-container js-select-menu" >
+  <span class="minibutton select-menu-button js-menu-target" data-hotkey="w"
+    data-master-branch="master"
+    data-ref="master">
+    <span class="octicon octicon-git-branch"></span>
+    <i>branch:</i>
+    <span class="js-select-button">master</span>
+  </span>
+
+  <div class="select-menu-modal-holder js-menu-content js-navigation-container" data-pjax>
+
+    <div class="select-menu-modal">
+      <div class="select-menu-header">
+        <span class="select-menu-title">Switch branches/tags</span>
+        <span class="octicon octicon-remove-close js-menu-close"></span>
+      </div> <!-- /.select-menu-header -->
+
+      <div class="select-menu-filters">
+        <div class="select-menu-text-filter">
+          <input type="text" id="context-commitish-filter-field" class="js-filterable-field js-navigation-enable" placeholder="Filter branches/tags">
+        </div>
+        <div class="select-menu-tabs">
+          <ul>
+            <li class="select-menu-tab">
+              <a href="#" data-tab-filter="branches" class="js-select-menu-tab">Branches</a>
+            </li>
+            <li class="select-menu-tab">
+              <a href="#" data-tab-filter="tags" class="js-select-menu-tab">Tags</a>
+            </li>
+          </ul>
+        </div><!-- /.select-menu-tabs -->
+      </div><!-- /.select-menu-filters -->
+
+      <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="branches">
+
+        <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring">
+
+
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/99-isMockDataEqual-checks-for-additional-props/lib/json2.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="99-isMockDataEqual-checks-for-additional-props" data-skip-pjax="true" rel="nofollow" title="99-isMockDataEqual-checks-for-additional-props">99-isMockDataEqual-checks-for-additional-props</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/anvil/lib/json2.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="anvil" data-skip-pjax="true" rel="nofollow" title="anvil">anvil</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/fuzzy-wildcard/lib/json2.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="fuzzy-wildcard" data-skip-pjax="true" rel="nofollow" title="fuzzy-wildcard">fuzzy-wildcard</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/gh-pages/lib/json2.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="gh-pages" data-skip-pjax="true" rel="nofollow" title="gh-pages">gh-pages</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item selected">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/master/lib/json2.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="master" data-skip-pjax="true" rel="nofollow" title="master">master</a>
+            </div> <!-- /.select-menu-item -->
+        </div>
+
+          <div class="select-menu-no-results">Nothing to show</div>
+      </div> <!-- /.select-menu-list -->
+
+      <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="tags">
+        <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring">
+
+
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/v1.5.2/lib/json2.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="v1.5.2" data-skip-pjax="true" rel="nofollow" title="v1.5.2">v1.5.2</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/v1.5.1/lib/json2.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="v1.5.1" data-skip-pjax="true" rel="nofollow" title="v1.5.1">v1.5.1</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/v1.5.0/lib/json2.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="v1.5.0" data-skip-pjax="true" rel="nofollow" title="v1.5.0">v1.5.0</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/v1.4.0/lib/json2.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="v1.4.0" data-skip-pjax="true" rel="nofollow" title="v1.4.0">v1.4.0</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/v1.3.2/lib/json2.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="v1.3.2" data-skip-pjax="true" rel="nofollow" title="v1.3.2">v1.3.2</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/appendto/jquery-mockjax/blob/v1.3.1/lib/json2.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="v1.3.1" data-skip-pjax="true" rel="nofollow" title="v1.3.1">v1.3.1</a>
+            </div> <!-- /.select-menu-item -->
+        </div>
+
+        <div class="select-menu-no-results">Nothing to show</div>
+      </div> <!-- /.select-menu-list -->
+
+    </div> <!-- /.select-menu-modal -->
+  </div> <!-- /.select-menu-modal-holder -->
+</div> <!-- /.select-menu -->
+
+  <div class="breadcrumb">
+    <span class='repo-root js-repo-root'><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/appendto/jquery-mockjax" data-branch="master" data-direction="back" data-pjax="true" itemscope="url"><span itemprop="title">jquery-mockjax</span></a></span></span><span class="separator"> / </span><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/appendto/jquery-mockjax/tree/master/lib" data-branch="master" data-direction="back" data-pjax="true" itemscope="url"><span itemprop="title">lib</span></a></span><span class="separator"> / </span><strong class="final-path">json2.js</strong> <span class="js-zeroclipboard minibutton zeroclipboard-button" data-clipboard-text="lib/json2.js" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
+  </div>
+</div>
+
+
+  <div class="commit commit-loader file-history-tease js-deferred-content" data-url="/appendto/jquery-mockjax/contributors/master/lib/json2.js">
+    Fetching contributorsâŠ
+
+    <div class="participation">
+      <p class="loader-loading"><img alt="Octocat-spinner-32-eaf2f5" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32-EAF2F5.gif" width="16" /></p>
+      <p class="loader-error">Cannot retrieve contributors at this time</p>
+    </div>
+  </div>
+
+<div id="files" class="bubble">
+  <div class="file">
+    <div class="meta">
+      <div class="info">
+        <span class="icon"><b class="octicon octicon-file-text"></b></span>
+        <span class="mode" title="File Mode">file</span>
+          <span>484 lines (365 sloc)</span>
+        <span>17.383 kb</span>
+      </div>
+      <div class="actions">
+        <div class="button-group">
+              <a class="minibutton js-entice" href=""
+                 data-entice="You must be signed in to make or propose changes">Edit</a>
+          <a href="/appendto/jquery-mockjax/raw/master/lib/json2.js" class="button minibutton " id="raw-url">Raw</a>
+            <a href="/appendto/jquery-mockjax/blame/master/lib/json2.js" class="button minibutton ">Blame</a>
+          <a href="/appendto/jquery-mockjax/commits/master/lib/json2.js" class="button minibutton " rel="nofollow">History</a>
+        </div><!-- /.button-group -->
+            <a class="minibutton danger empty-icon js-entice" href=""
+               data-entice="You must be signed in and on a branch to make or propose changes">
+            Delete
+          </a>
+      </div><!-- /.actions -->
+
+    </div>
+        <div class="blob-wrapper data type-javascript js-blob-data">
+      <table class="file-code file-diff">
+        <tr class="file-code-line">
+          <td class="blob-line-nums">
+            <span id="L1" rel="#L1">1</span>
+<span id="L2" rel="#L2">2</span>
+<span id="L3" rel="#L3">3</span>
+<span id="L4" rel="#L4">4</span>
+<span id="L5" rel="#L5">5</span>
+<span id="L6" rel="#L6">6</span>
+<span id="L7" rel="#L7">7</span>
+<span id="L8" rel="#L8">8</span>
+<span id="L9" rel="#L9">9</span>
+<span id="L10" rel="#L10">10</span>
+<span id="L11" rel="#L11">11</span>
+<span id="L12" rel="#L12">12</span>
+<span id="L13" rel="#L13">13</span>
+<span id="L14" rel="#L14">14</span>
+<span id="L15" rel="#L15">15</span>
+<span id="L16" rel="#L16">16</span>
+<span id="L17" rel="#L17">17</span>
+<span id="L18" rel="#L18">18</span>
+<span id="L19" rel="#L19">19</span>
+<span id="L20" rel="#L20">20</span>
+<span id="L21" rel="#L21">21</span>
+<span id="L22" rel="#L22">22</span>
+<span id="L23" rel="#L23">23</span>
+<span id="L24" rel="#L24">24</span>
+<span id="L25" rel="#L25">25</span>
+<span id="L26" rel="#L26">26</span>
+<span id="L27" rel="#L27">27</span>
+<span id="L28" rel="#L28">28</span>
+<span id="L29" rel="#L29">29</span>
+<span id="L30" rel="#L30">30</span>
+<span id="L31" rel="#L31">31</span>
+<span id="L32" rel="#L32">32</span>
+<span id="L33" rel="#L33">33</span>
+<span id="L34" rel="#L34">34</span>
+<span id="L35" rel="#L35">35</span>
+<span id="L36" rel="#L36">36</span>
+<span id="L37" rel="#L37">37</span>
+<span id="L38" rel="#L38">38</span>
+<span id="L39" rel="#L39">39</span>
+<span id="L40" rel="#L40">40</span>
+<span id="L41" rel="#L41">41</span>
+<span id="L42" rel="#L42">42</span>
+<span id="L43" rel="#L43">43</span>
+<span id="L44" rel="#L44">44</span>
+<span id="L45" rel="#L45">45</span>
+<span id="L46" rel="#L46">46</span>
+<span id="L47" rel="#L47">47</span>
+<span id="L48" rel="#L48">48</span>
+<span id="L49" rel="#L49">49</span>
+<span id="L50" rel="#L50">50</span>
+<span id="L51" rel="#L51">51</span>
+<span id="L52" rel="#L52">52</span>
+<span id="L53" rel="#L53">53</span>
+<span id="L54" rel="#L54">54</span>
+<span id="L55" rel="#L55">55</span>
+<span id="L56" rel="#L56">56</span>
+<span id="L57" rel="#L57">57</span>
+<span id="L58" rel="#L58">58</span>
+<span id="L59" rel="#L59">59</span>
+<span id="L60" rel="#L60">60</span>
+<span id="L61" rel="#L61">61</span>
+<span id="L62" rel="#L62">62</span>
+<span id="L63" rel="#L63">63</span>
+<span id="L64" rel="#L64">64</span>
+<span id="L65" rel="#L65">65</span>
+<span id="L66" rel="#L66">66</span>
+<span id="L67" rel="#L67">67</span>
+<span id="L68" rel="#L68">68</span>
+<span id="L69" rel="#L69">69</span>
+<span id="L70" rel="#L70">70</span>
+<span id="L71" rel="#L71">71</span>
+<span id="L72" rel="#L72">72</span>
+<span id="L73" rel="#L73">73</span>
+<span id="L74" rel="#L74">74</span>
+<span id="L75" rel="#L75">75</span>
+<span id="L76" rel="#L76">76</span>
+<span id="L77" rel="#L77">77</span>
+<span id="L78" rel="#L78">78</span>
+<span id="L79" rel="#L79">79</span>
+<span id="L80" rel="#L80">80</span>
+<span id="L81" rel="#L81">81</span>
+<span id="L82" rel="#L82">82</span>
+<span id="L83" rel="#L83">83</span>
+<span id="L84" rel="#L84">84</span>
+<span id="L85" rel="#L85">85</span>
+<span id="L86" rel="#L86">86</span>
+<span id="L87" rel="#L87">87</span>
+<span id="L88" rel="#L88">88</span>
+<span id="L89" rel="#L89">89</span>
+<span id="L90" rel="#L90">90</span>
+<span id="L91" rel="#L91">91</span>
+<span id="L92" rel="#L92">92</span>
+<span id="L93" rel="#L93">93</span>
+<span id="L94" rel="#L94">94</span>
+<span id="L95" rel="#L95">95</span>
+<span id="L96" rel="#L96">96</span>
+<span id="L97" rel="#L97">97</span>
+<span id="L98" rel="#L98">98</span>
+<span id="L99" rel="#L99">99</span>
+<span id="L100" rel="#L100">100</span>
+<span id="L101" rel="#L101">101</span>
+<span id="L102" rel="#L102">102</span>
+<span id="L103" rel="#L103">103</span>
+<span id="L104" rel="#L104">104</span>
+<span id="L105" rel="#L105">105</span>
+<span id="L106" rel="#L106">106</span>
+<span id="L107" rel="#L107">107</span>
+<span id="L108" rel="#L108">108</span>
+<span id="L109" rel="#L109">109</span>
+<span id="L110" rel="#L110">110</span>
+<span id="L111" rel="#L111">111</span>
+<span id="L112" rel="#L112">112</span>
+<span id="L113" rel="#L113">113</span>
+<span id="L114" rel="#L114">114</span>
+<span id="L115" rel="#L115">115</span>
+<span id="L116" rel="#L116">116</span>
+<span id="L117" rel="#L117">117</span>
+<span id="L118" rel="#L118">118</span>
+<span id="L119" rel="#L119">119</span>
+<span id="L120" rel="#L120">120</span>
+<span id="L121" rel="#L121">121</span>
+<span id="L122" rel="#L122">122</span>
+<span id="L123" rel="#L123">123</span>
+<span id="L124" rel="#L124">124</span>
+<span id="L125" rel="#L125">125</span>
+<span id="L126" rel="#L126">126</span>
+<span id="L127" rel="#L127">127</span>
+<span id="L128" rel="#L128">128</span>
+<span id="L129" rel="#L129">129</span>
+<span id="L130" rel="#L130">130</span>
+<span id="L131" rel="#L131">131</span>
+<span id="L132" rel="#L132">132</span>
+<span id="L133" rel="#L133">133</span>
+<span id="L134" rel="#L134">134</span>
+<span id="L135" rel="#L135">135</span>
+<span id="L136" rel="#L136">136</span>
+<span id="L137" rel="#L137">137</span>
+<span id="L138" rel="#L138">138</span>
+<span id="L139" rel="#L139">139</span>
+<span id="L140" rel="#L140">140</span>
+<span id="L141" rel="#L141">141</span>
+<span id="L142" rel="#L142">142</span>
+<span id="L143" rel="#L143">143</span>
+<span id="L144" rel="#L144">144</span>
+<span id="L145" rel="#L145">145</span>
+<span id="L146" rel="#L146">146</span>
+<span id="L147" rel="#L147">147</span>
+<span id="L148" rel="#L148">148</span>
+<span id="L149" rel="#L149">149</span>
+<span id="L150" rel="#L150">150</span>
+<span id="L151" rel="#L151">151</span>
+<span id="L152" rel="#L152">152</span>
+<span id="L153" rel="#L153">153</span>
+<span id="L154" rel="#L154">154</span>
+<span id="L155" rel="#L155">155</span>
+<span id="L156" rel="#L156">156</span>
+<span id="L157" rel="#L157">157</span>
+<span id="L158" rel="#L158">158</span>
+<span id="L159" rel="#L159">159</span>
+<span id="L160" rel="#L160">160</span>
+<span id="L161" rel="#L161">161</span>
+<span id="L162" rel="#L162">162</span>
+<span id="L163" rel="#L163">163</span>
+<span id="L164" rel="#L164">164</span>
+<span id="L165" rel="#L165">165</span>
+<span id="L166" rel="#L166">166</span>
+<span id="L167" rel="#L167">167</span>
+<span id="L168" rel="#L168">168</span>
+<span id="L169" rel="#L169">169</span>
+<span id="L170" rel="#L170">170</span>
+<span id="L171" rel="#L171">171</span>
+<span id="L172" rel="#L172">172</span>
+<span id="L173" rel="#L173">173</span>
+<span id="L174" rel="#L174">174</span>
+<span id="L175" rel="#L175">175</span>
+<span id="L176" rel="#L176">176</span>
+<span id="L177" rel="#L177">177</span>
+<span id="L178" rel="#L178">178</span>
+<span id="L179" rel="#L179">179</span>
+<span id="L180" rel="#L180">180</span>
+<span id="L181" rel="#L181">181</span>
+<span id="L182" rel="#L182">182</span>
+<span id="L183" rel="#L183">183</span>
+<span id="L184" rel="#L184">184</span>
+<span id="L185" rel="#L185">185</span>
+<span id="L186" rel="#L186">186</span>
+<span id="L187" rel="#L187">187</span>
+<span id="L188" rel="#L188">188</span>
+<span id="L189" rel="#L189">189</span>
+<span id="L190" rel="#L190">190</span>
+<span id="L191" rel="#L191">191</span>
+<span id="L192" rel="#L192">192</span>
+<span id="L193" rel="#L193">193</span>
+<span id="L194" rel="#L194">194</span>
+<span id="L195" rel="#L195">195</span>
+<span id="L196" rel="#L196">196</span>
+<span id="L197" rel="#L197">197</span>
+<span id="L198" rel="#L198">198</span>
+<span id="L199" rel="#L199">199</span>
+<span id="L200" rel="#L200">200</span>
+<span id="L201" rel="#L201">201</span>
+<span id="L202" rel="#L202">202</span>
+<span id="L203" rel="#L203">203</span>
+<span id="L204" rel="#L204">204</span>
+<span id="L205" rel="#L205">205</span>
+<span id="L206" rel="#L206">206</span>
+<span id="L207" rel="#L207">207</span>
+<span id="L208" rel="#L208">208</span>
+<span id="L209" rel="#L209">209</span>
+<span id="L210" rel="#L210">210</span>
+<span id="L211" rel="#L211">211</span>
+<span id="L212" rel="#L212">212</span>
+<span id="L213" rel="#L213">213</span>
+<span id="L214" rel="#L214">214</span>
+<span id="L215" rel="#L215">215</span>
+<span id="L216" rel="#L216">216</span>
+<span id="L217" rel="#L217">217</span>
+<span id="L218" rel="#L218">218</span>
+<span id="L219" rel="#L219">219</span>
+<span id="L220" rel="#L220">220</span>
+<span id="L221" rel="#L221">221</span>
+<span id="L222" rel="#L222">222</span>
+<span id="L223" rel="#L223">223</span>
+<span id="L224" rel="#L224">224</span>
+<span id="L225" rel="#L225">225</span>
+<span id="L226" rel="#L226">226</span>
+<span id="L227" rel="#L227">227</span>
+<span id="L228" rel="#L228">228</span>
+<span id="L229" rel="#L229">229</span>
+<span id="L230" rel="#L230">230</span>
+<span id="L231" rel="#L231">231</span>
+<span id="L232" rel="#L232">232</span>
+<span id="L233" rel="#L233">233</span>
+<span id="L234" rel="#L234">234</span>
+<span id="L235" rel="#L235">235</span>
+<span id="L236" rel="#L236">236</span>
+<span id="L237" rel="#L237">237</span>
+<span id="L238" rel="#L238">238</span>
+<span id="L239" rel="#L239">239</span>
+<span id="L240" rel="#L240">240</span>
+<span id="L241" rel="#L241">241</span>
+<span id="L242" rel="#L242">242</span>
+<span id="L243" rel="#L243">243</span>
+<span id="L244" rel="#L244">244</span>
+<span id="L245" rel="#L245">245</span>
+<span id="L246" rel="#L246">246</span>
+<span id="L247" rel="#L247">247</span>
+<span id="L248" rel="#L248">248</span>
+<span id="L249" rel="#L249">249</span>
+<span id="L250" rel="#L250">250</span>
+<span id="L251" rel="#L251">251</span>
+<span id="L252" rel="#L252">252</span>
+<span id="L253" rel="#L253">253</span>
+<span id="L254" rel="#L254">254</span>
+<span id="L255" rel="#L255">255</span>
+<span id="L256" rel="#L256">256</span>
+<span id="L257" rel="#L257">257</span>
+<span id="L258" rel="#L258">258</span>
+<span id="L259" rel="#L259">259</span>
+<span id="L260" rel="#L260">260</span>
+<span id="L261" rel="#L261">261</span>
+<span id="L262" rel="#L262">262</span>
+<span id="L263" rel="#L263">263</span>
+<span id="L264" rel="#L264">264</span>
+<span id="L265" rel="#L265">265</span>
+<span id="L266" rel="#L266">266</span>
+<span id="L267" rel="#L267">267</span>
+<span id="L268" rel="#L268">268</span>
+<span id="L269" rel="#L269">269</span>
+<span id="L270" rel="#L270">270</span>
+<span id="L271" rel="#L271">271</span>
+<span id="L272" rel="#L272">272</span>
+<span id="L273" rel="#L273">273</span>
+<span id="L274" rel="#L274">274</span>
+<span id="L275" rel="#L275">275</span>
+<span id="L276" rel="#L276">276</span>
+<span id="L277" rel="#L277">277</span>
+<span id="L278" rel="#L278">278</span>
+<span id="L279" rel="#L279">279</span>
+<span id="L280" rel="#L280">280</span>
+<span id="L281" rel="#L281">281</span>
+<span id="L282" rel="#L282">282</span>
+<span id="L283" rel="#L283">283</span>
+<span id="L284" rel="#L284">284</span>
+<span id="L285" rel="#L285">285</span>
+<span id="L286" rel="#L286">286</span>
+<span id="L287" rel="#L287">287</span>
+<span id="L288" rel="#L288">288</span>
+<span id="L289" rel="#L289">289</span>
+<span id="L290" rel="#L290">290</span>
+<span id="L291" rel="#L291">291</span>
+<span id="L292" rel="#L292">292</span>
+<span id="L293" rel="#L293">293</span>
+<span id="L294" rel="#L294">294</span>
+<span id="L295" rel="#L295">295</span>
+<span id="L296" rel="#L296">296</span>
+<span id="L297" rel="#L297">297</span>
+<span id="L298" rel="#L298">298</span>
+<span id="L299" rel="#L299">299</span>
+<span id="L300" rel="#L300">300</span>
+<span id="L301" rel="#L301">301</span>
+<span id="L302" rel="#L302">302</span>
+<span id="L303" rel="#L303">303</span>
+<span id="L304" rel="#L304">304</span>
+<span id="L305" rel="#L305">305</span>
+<span id="L306" rel="#L306">306</span>
+<span id="L307" rel="#L307">307</span>
+<span id="L308" rel="#L308">308</span>
+<span id="L309" rel="#L309">309</span>
+<span id="L310" rel="#L310">310</span>
+<span id="L311" rel="#L311">311</span>
+<span id="L312" rel="#L312">312</span>
+<span id="L313" rel="#L313">313</span>
+<span id="L314" rel="#L314">314</span>
+<span id="L315" rel="#L315">315</span>
+<span id="L316" rel="#L316">316</span>
+<span id="L317" rel="#L317">317</span>
+<span id="L318" rel="#L318">318</span>
+<span id="L319" rel="#L319">319</span>
+<span id="L320" rel="#L320">320</span>
+<span id="L321" rel="#L321">321</span>
+<span id="L322" rel="#L322">322</span>
+<span id="L323" rel="#L323">323</span>
+<span id="L324" rel="#L324">324</span>
+<span id="L325" rel="#L325">325</span>
+<span id="L326" rel="#L326">326</span>
+<span id="L327" rel="#L327">327</span>
+<span id="L328" rel="#L328">328</span>
+<span id="L329" rel="#L329">329</span>
+<span id="L330" rel="#L330">330</span>
+<span id="L331" rel="#L331">331</span>
+<span id="L332" rel="#L332">332</span>
+<span id="L333" rel="#L333">333</span>
+<span id="L334" rel="#L334">334</span>
+<span id="L335" rel="#L335">335</span>
+<span id="L336" rel="#L336">336</span>
+<span id="L337" rel="#L337">337</span>
+<span id="L338" rel="#L338">338</span>
+<span id="L339" rel="#L339">339</span>
+<span id="L340" rel="#L340">340</span>
+<span id="L341" rel="#L341">341</span>
+<span id="L342" rel="#L342">342</span>
+<span id="L343" rel="#L343">343</span>
+<span id="L344" rel="#L344">344</span>
+<span id="L345" rel="#L345">345</span>
+<span id="L346" rel="#L346">346</span>
+<span id="L347" rel="#L347">347</span>
+<span id="L348" rel="#L348">348</span>
+<span id="L349" rel="#L349">349</span>
+<span id="L350" rel="#L350">350</span>
+<span id="L351" rel="#L351">351</span>
+<span id="L352" rel="#L352">352</span>
+<span id="L353" rel="#L353">353</span>
+<span id="L354" rel="#L354">354</span>
+<span id="L355" rel="#L355">355</span>
+<span id="L356" rel="#L356">356</span>
+<span id="L357" rel="#L357">357</span>
+<span id="L358" rel="#L358">358</span>
+<span id="L359" rel="#L359">359</span>
+<span id="L360" rel="#L360">360</span>
+<span id="L361" rel="#L361">361</span>
+<span id="L362" rel="#L362">362</span>
+<span id="L363" rel="#L363">363</span>
+<span id="L364" rel="#L364">364</span>
+<span id="L365" rel="#L365">365</span>
+<span id="L366" rel="#L366">366</span>
+<span id="L367" rel="#L367">367</span>
+<span id="L368" rel="#L368">368</span>
+<span id="L369" rel="#L369">369</span>
+<span id="L370" rel="#L370">370</span>
+<span id="L371" rel="#L371">371</span>
+<span id="L372" rel="#L372">372</span>
+<span id="L373" rel="#L373">373</span>
+<span id="L374" rel="#L374">374</span>
+<span id="L375" rel="#L375">375</span>
+<span id="L376" rel="#L376">376</span>
+<span id="L377" rel="#L377">377</span>
+<span id="L378" rel="#L378">378</span>
+<span id="L379" rel="#L379">379</span>
+<span id="L380" rel="#L380">380</span>
+<span id="L381" rel="#L381">381</span>
+<span id="L382" rel="#L382">382</span>
+<span id="L383" rel="#L383">383</span>
+<span id="L384" rel="#L384">384</span>
+<span id="L385" rel="#L385">385</span>
+<span id="L386" rel="#L386">386</span>
+<span id="L387" rel="#L387">387</span>
+<span id="L388" rel="#L388">388</span>
+<span id="L389" rel="#L389">389</span>
+<span id="L390" rel="#L390">390</span>
+<span id="L391" rel="#L391">391</span>
+<span id="L392" rel="#L392">392</span>
+<span id="L393" rel="#L393">393</span>
+<span id="L394" rel="#L394">394</span>
+<span id="L395" rel="#L395">395</span>
+<span id="L396" rel="#L396">396</span>
+<span id="L397" rel="#L397">397</span>
+<span id="L398" rel="#L398">398</span>
+<span id="L399" rel="#L399">399</span>
+<span id="L400" rel="#L400">400</span>
+<span id="L401" rel="#L401">401</span>
+<span id="L402" rel="#L402">402</span>
+<span id="L403" rel="#L403">403</span>
+<span id="L404" rel="#L404">404</span>
+<span id="L405" rel="#L405">405</span>
+<span id="L406" rel="#L406">406</span>
+<span id="L407" rel="#L407">407</span>
+<span id="L408" rel="#L408">408</span>
+<span id="L409" rel="#L409">409</span>
+<span id="L410" rel="#L410">410</span>
+<span id="L411" rel="#L411">411</span>
+<span id="L412" rel="#L412">412</span>
+<span id="L413" rel="#L413">413</span>
+<span id="L414" rel="#L414">414</span>
+<span id="L415" rel="#L415">415</span>
+<span id="L416" rel="#L416">416</span>
+<span id="L417" rel="#L417">417</span>
+<span id="L418" rel="#L418">418</span>
+<span id="L419" rel="#L419">419</span>
+<span id="L420" rel="#L420">420</span>
+<span id="L421" rel="#L421">421</span>
+<span id="L422" rel="#L422">422</span>
+<span id="L423" rel="#L423">423</span>
+<span id="L424" rel="#L424">424</span>
+<span id="L425" rel="#L425">425</span>
+<span id="L426" rel="#L426">426</span>
+<span id="L427" rel="#L427">427</span>
+<span id="L428" rel="#L428">428</span>
+<span id="L429" rel="#L429">429</span>
+<span id="L430" rel="#L430">430</span>
+<span id="L431" rel="#L431">431</span>
+<span id="L432" rel="#L432">432</span>
+<span id="L433" rel="#L433">433</span>
+<span id="L434" rel="#L434">434</span>
+<span id="L435" rel="#L435">435</span>
+<span id="L436" rel="#L436">436</span>
+<span id="L437" rel="#L437">437</span>
+<span id="L438" rel="#L438">438</span>
+<span id="L439" rel="#L439">439</span>
+<span id="L440" rel="#L440">440</span>
+<span id="L441" rel="#L441">441</span>
+<span id="L442" rel="#L442">442</span>
+<span id="L443" rel="#L443">443</span>
+<span id="L444" rel="#L444">444</span>
+<span id="L445" rel="#L445">445</span>
+<span id="L446" rel="#L446">446</span>
+<span id="L447" rel="#L447">447</span>
+<span id="L448" rel="#L448">448</span>
+<span id="L449" rel="#L449">449</span>
+<span id="L450" rel="#L450">450</span>
+<span id="L451" rel="#L451">451</span>
+<span id="L452" rel="#L452">452</span>
+<span id="L453" rel="#L453">453</span>
+<span id="L454" rel="#L454">454</span>
+<span id="L455" rel="#L455">455</span>
+<span id="L456" rel="#L456">456</span>
+<span id="L457" rel="#L457">457</span>
+<span id="L458" rel="#L458">458</span>
+<span id="L459" rel="#L459">459</span>
+<span id="L460" rel="#L460">460</span>
+<span id="L461" rel="#L461">461</span>
+<span id="L462" rel="#L462">462</span>
+<span id="L463" rel="#L463">463</span>
+<span id="L464" rel="#L464">464</span>
+<span id="L465" rel="#L465">465</span>
+<span id="L466" rel="#L466">466</span>
+<span id="L467" rel="#L467">467</span>
+<span id="L468" rel="#L468">468</span>
+<span id="L469" rel="#L469">469</span>
+<span id="L470" rel="#L470">470</span>
+<span id="L471" rel="#L471">471</span>
+<span id="L472" rel="#L472">472</span>
+<span id="L473" rel="#L473">473</span>
+<span id="L474" rel="#L474">474</span>
+<span id="L475" rel="#L475">475</span>
+<span id="L476" rel="#L476">476</span>
+<span id="L477" rel="#L477">477</span>
+<span id="L478" rel="#L478">478</span>
+<span id="L479" rel="#L479">479</span>
+<span id="L480" rel="#L480">480</span>
+<span id="L481" rel="#L481">481</span>
+<span id="L482" rel="#L482">482</span>
+<span id="L483" rel="#L483">483</span>
+
+          </td>
+          <td class="blob-line-code">
+                  <div class="highlight"><pre><div class='line' id='LC1'><span class="cm">/*</span></div><div class='line' id='LC2'><span class="cm">    http://www.JSON.org/json2.js</span></div><div class='line' id='LC3'><span class="cm">    2010-03-20</span></div><div class='line' id='LC4'><br/></div><div class='line' id='LC5'><span class="cm">    Public Domain.</span></div><div class='line' id='LC6'><br/></div><div class='line' id='LC7'><span class="cm">    NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.</span></div><div class='line' id='LC8'><br/></div><div class='line' id='LC9'><span class="cm">    See http://www.JSON.org/js.html</span></div><div class='line' id='LC10'><br/></div><div class='line' id='LC11'><br/></div><div class='line' id='LC12'><span class="cm">    This code should be minified before deployment.</span></div><div class='line' id='LC13'><span class="cm">    See http://javascript.crockford.com/jsmin.html</span></div><div class='line' id='LC14'><br/></div><div class='line' id='LC15'><span class="cm">    USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO</span></div><div class='line' id='LC16'><span class="cm">    NOT CONTROL.</span></div><div class='line' id='LC17'><br/></div><div class='line' id='LC18'><br/></div><div class='line' id='LC19'><span class="cm">    This file creates a global JSON object containing two methods: stringify</span></div><div class='line' id='LC20'><span class="cm">    and parse.</span></div><div class='line' id='LC21'><br/></div><div class='line' id='LC22'><span class="cm">        JSON.stringify(value, replacer, space)</span></div><div class='line' id='LC23'><span class="cm">            value       any JavaScript value, usually an object or array.</span></div><div class='line' id='LC24'><br/></div><div class='line' id='LC25'><span class="cm">            replacer    an optional parameter that determines how object</span></div><div class='line' id='LC26'><span class="cm">                        values are stringified for objects. It can be a</span></div><div class='line' id='LC27'><span class="cm">                        function or an array of strings.</span></div><div class='line' id='LC28'><br/></div><div class='line' id='LC29'><span class="cm">            space       an optional parameter that specifies the indentation</span></div><div class='line' id='LC30'><span class="cm">                        of nested structures. If it is omitted, the text will</span></div><div class='line' id='LC31'><span class="cm">                        be packed without extra whitespace. If it is a number,</span></div><div class='line' id='LC32'><span class="cm">                        it will specify the number of spaces to indent at each</span></div><div class='line' id='LC33'><span class="cm">                        level. If it is a string (such as &#39;\t&#39; or &#39;&amp;nbsp;&#39;),</span></div><div class='line' id='LC34'><span class="cm">                        it contains the characters used to indent at each level.</span></div><div class='line' id='LC35'><br/></div><div class='line' id='LC36'><span class="cm">            This method produces a JSON text from a JavaScript value.</span></div><div class='line' id='LC37'><br/></div><div class='line' id='LC38'><span class="cm">            When an object value is found, if the object contains a toJSON</span></div><div class='line' id='LC39'><span class="cm">            method, its toJSON method will be called and the result will be</span></div><div class='line' id='LC40'><span class="cm">            stringified. A toJSON method does not serialize: it returns the</span></div><div class='line' id='LC41'><span class="cm">            value represented by the name/value pair that should be serialized,</span></div><div class='line' id='LC42'><span class="cm">            or undefined if nothing should be serialized. The toJSON method</span></div><div class='line' id='LC43'><span class="cm">            will be passed the key associated with the value, and this will be</span></div><div class='line' id='LC44'><span class="cm">            bound to the value</span></div><div class='line' id='LC45'><br/></div><div class='line' id='LC46'><span class="cm">            For example, this would serialize Dates as ISO strings.</span></div><div class='line' id='LC47'><br/></div><div class='line' id='LC48'><span class="cm">                Date.prototype.toJSON = function (key) {</span></div><div class='line' id='LC49'><span class="cm">                    function f(n) {</span></div><div class='line' id='LC50'><span class="cm">                        // Format integers to have at least two digits.</span></div><div class='line' id='LC51'><span class="cm">                        return n &lt; 10 ? &#39;0&#39; + n : n;</span></div><div class='line' id='LC52'><span class="cm">                    }</span></div><div class='line' id='LC53'><br/></div><div class='line' id='LC54'><span class="cm">                    return this.getUTCFullYear()   + &#39;-&#39; +</span></div><div class='line' id='LC55'><span class="cm">                         f(this.getUTCMonth() + 1) + &#39;-&#39; +</span></div><div class='line' id='LC56'><span class="cm">                         f(this.getUTCDate())      + &#39;T&#39; +</span></div><div class='line' id='LC57'><span class="cm">                         f(this.getUTCHours())     + &#39;:&#39; +</span></div><div class='line' id='LC58'><span class="cm">                         f(this.getUTCMinutes())   + &#39;:&#39; +</span></div><div class='line' id='LC59'><span class="cm">                         f(this.getUTCSeconds())   + &#39;Z&#39;;</span></div><div class='line' id='LC60'><span class="cm">                };</span></div><div class='line' id='LC61'><br/></div><div class='line' id='LC62'><span class="cm">            You can provide an optional replacer method. It will be passed the</span></div><div class='line' id='LC63'><span class="cm">            key and value of each member, with this bound to the containing</span></div><div class='line' id='LC64'><span class="cm">            object. The value that is returned from your method will be</span></div><div class='line' id='LC65'><span class="cm">            serialized. If your method returns undefined, then the member will</span></div><div class='line' id='LC66'><span class="cm">            be excluded from the serialization.</span></div><div class='line' id='LC67'><br/></div><div class='line' id='LC68'><span class="cm">            If the replacer parameter is an array of strings, then it will be</span></div><div class='line' id='LC69'><span class="cm">            used to select the members to be serialized. It filters the results</span></div><div class='line' id='LC70'><span class="cm">            such that only members with keys listed in the replacer array are</span></div><div class='line' id='LC71'><span class="cm">            stringified.</span></div><div class='line' id='LC72'><br/></div><div class='line' id='LC73'><span class="cm">            Values that do not have JSON representations, such as undefined or</span></div><div class='line' id='LC74'><span class="cm">            functions, will not be serialized. Such values in objects will be</span></div><div class='line' id='LC75'><span class="cm">            dropped; in arrays they will be replaced with null. You can use</span></div><div class='line' id='LC76'><span class="cm">            a replacer function to replace those with JSON values.</span></div><div class='line' id='LC77'><span class="cm">            JSON.stringify(undefined) returns undefined.</span></div><div class='line' id='LC78'><br/></div><div class='line' id='LC79'><span class="cm">            The optional space parameter produces a stringification of the</span></div><div class='line' id='LC80'><span class="cm">            value that is filled with line breaks and indentation to make it</span></div><div class='line' id='LC81'><span class="cm">            easier to read.</span></div><div class='line' id='LC82'><br/></div><div class='line' id='LC83'><span class="cm">            If the space parameter is a non-empty string, then that string will</span></div><div class='line' id='LC84'><span class="cm">            be used for indentation. If the space parameter is a number, then</span></div><div class='line' id='LC85'><span class="cm">            the indentation will be that many spaces.</span></div><div class='line' id='LC86'><br/></div><div class='line' id='LC87'><span class="cm">            Example:</span></div><div class='line' id='LC88'><br/></div><div class='line' id='LC89'><span class="cm">            text = JSON.stringify([&#39;e&#39;, {pluribus: &#39;unum&#39;}]);</span></div><div class='line' id='LC90'><span class="cm">            // text is &#39;[&quot;e&quot;,{&quot;pluribus&quot;:&quot;unum&quot;}]&#39;</span></div><div class='line' id='LC91'><br/></div><div class='line' id='LC92'><br/></div><div class='line' id='LC93'><span class="cm">            text = JSON.stringify([&#39;e&#39;, {pluribus: &#39;unum&#39;}], null, &#39;\t&#39;);</span></div><div class='line' id='LC94'><span class="cm">            // text is &#39;[\n\t&quot;e&quot;,\n\t{\n\t\t&quot;pluribus&quot;: &quot;unum&quot;\n\t}\n]&#39;</span></div><div class='line' id='LC95'><br/></div><div class='line' id='LC96'><span class="cm">            text = JSON.stringify([new Date()], function (key, value) {</span></div><div class='line' id='LC97'><span class="cm">                return this[key] instanceof Date ?</span></div><div class='line' id='LC98'><span class="cm">                    &#39;Date(&#39; + this[key] + &#39;)&#39; : value;</span></div><div class='line' id='LC99'><span class="cm">            });</span></div><div class='line' id='LC100'><span class="cm">            // text is &#39;[&quot;Date(---current time---)&quot;]&#39;</span></div><div class='line' id='LC101'><br/></div><div class='line' id='LC102'><br/></div><div class='line' id='LC103'><span class="cm">        JSON.parse(text, reviver)</span></div><div class='line' id='LC104'><span class="cm">            This method parses a JSON text to produce an object or array.</span></div><div class='line' id='LC105'><span class="cm">            It can throw a SyntaxError exception.</span></div><div class='line' id='LC106'><br/></div><div class='line' id='LC107'><span class="cm">            The optional reviver parameter is a function that can filter and</span></div><div class='line' id='LC108'><span class="cm">            transform the results. It receives each of the keys and values,</span></div><div class='line' id='LC109'><span class="cm">            and its return value is used instead of the original value.</span></div><div class='line' id='LC110'><span class="cm">            If it returns what it received, then the structure is not modified.</span></div><div class='line' id='LC111'><span class="cm">            If it returns undefined then the member is deleted.</span></div><div class='line' id='LC112'><br/></div><div class='line' id='LC113'><span class="cm">            Example:</span></div><div class='line' id='LC114'><br/></div><div class='line' id='LC115'><span class="cm">            // Parse the text. Values that look like ISO date strings will</span></div><div class='line' id='LC116'><span class="cm">            // be converted to Date objects.</span></div><div class='line' id='LC117'><br/></div><div class='line' id='LC118'><span class="cm">            myData = JSON.parse(text, function (key, value) {</span></div><div class='line' id='LC119'><span class="cm">                var a;</span></div><div class='line' id='LC120'><span class="cm">                if (typeof value === &#39;string&#39;) {</span></div><div class='line' id='LC121'><span class="cm">                    a =</span></div><div class='line' id='LC122'><span class="cm">/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);</span></div><div class='line' id='LC123'><span class="cm">                    if (a) {</span></div><div class='line' id='LC124'><span class="cm">                        return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],</span></div><div class='line' id='LC125'><span class="cm">                            +a[5], +a[6]));</span></div><div class='line' id='LC126'><span class="cm">                    }</span></div><div class='line' id='LC127'><span class="cm">                }</span></div><div class='line' id='LC128'><span class="cm">                return value;</span></div><div class='line' id='LC129'><span class="cm">            });</span></div><div class='line' id='LC130'><br/></div><div class='line' id='LC131'><span class="cm">            myData = JSON.parse(&#39;[&quot;Date(09/09/2001)&quot;]&#39;, function (key, value) {</span></div><div class='line' id='LC132'><span class="cm">                var d;</span></div><div class='line' id='LC133'><span class="cm">                if (typeof value === &#39;string&#39; &amp;&amp;</span></div><div class='line' id='LC134'><span class="cm">                        value.slice(0, 5) === &#39;Date(&#39; &amp;&amp;</span></div><div class='line' id='LC135'><span class="cm">                        value.slice(-1) === &#39;)&#39;) {</span></div><div class='line' id='LC136'><span class="cm">                    d = new Date(value.slice(5, -1));</span></div><div class='line' id='LC137'><span class="cm">                    if (d) {</span></div><div class='line' id='LC138'><span class="cm">                        return d;</span></div><div class='line' id='LC139'><span class="cm">                    }</span></div><div class='line' id='LC140'><span class="cm">                }</span></div><div class='line' id='LC141'><span class="cm">                return value;</span></div><div class='line' id='LC142'><span class="cm">            });</span></div><div class='line' id='LC143'><br/></div><div class='line' id='LC144'><br/></div><div class='line' id='LC145'><span class="cm">    This is a reference implementation. You are free to copy, modify, or</span></div><div class='line' id='LC146'><span class="cm">    redistribute.</span></div><div class='line' id='LC147'><span class="cm">*/</span></div><div class='line' id='LC148'><br/></div><div class='line' id='LC149'><span class="cm">/*jslint evil: true, strict: false */</span></div><div class='line' id='LC150'><br/></div><div class='line' id='LC151'><span class="cm">/*members &quot;&quot;, &quot;\b&quot;, &quot;\t&quot;, &quot;\n&quot;, &quot;\f&quot;, &quot;\r&quot;, &quot;\&quot;&quot;, JSON, &quot;\\&quot;, apply,</span></div><div class='line' id='LC152'><span class="cm">    call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,</span></div><div class='line' id='LC153'><span class="cm">    getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,</span></div><div class='line' id='LC154'><span class="cm">    lastIndex, length, parse, prototype, push, replace, slice, stringify,</span></div><div class='line' id='LC155'><span class="cm">    test, toJSON, toString, valueOf</span></div><div class='line' id='LC156'><span class="cm">*/</span></div><div class='line' id='LC157'><br/></div><div class='line' id='LC158'><br/></div><div class='line' id='LC159'><span class="c1">// Create a JSON object only if one does not already exist. We create the</span></div><div class='line' id='LC160'><span class="c1">// methods in a closure to avoid creating global variables.</span></div><div class='line' id='LC161'><br/></div><div class='line' id='LC162'><span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">JSON</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC163'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">this</span><span class="p">.</span><span class="nx">JSON</span> <span class="o">=</span> <span class="p">{};</span></div><div class='line' id='LC164'><span class="p">}</span></div><div class='line' id='LC165'><br/></div><div class='line' id='LC166'><span class="p">(</span><span class="kd">function</span> <span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC167'><br/></div><div class='line' id='LC168'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">function</span> <span class="nx">f</span><span class="p">(</span><span class="nx">n</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC169'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">// Format integers to have at least two digits.</span></div><div class='line' id='LC170'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="nx">n</span> <span class="o">&lt;</span> <span class="mi">10</span> <span class="o">?</span> <span class="s1">&#39;0&#39;</span> <span class="o">+</span> <span class="nx">n</span> <span class="o">:</span> <span class="nx">n</span><span class="p">;</span></div><div class='line' id='LC171'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC172'><br/></div><div class='line' id='LC173'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="k">typeof</span> <span class="nb">Date</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">toJSON</span> <span class="o">!==</span> <span class="s1">&#39;function&#39;</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC174'><br/></div><div class='line' id='LC175'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nb">Date</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">toJSON</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">key</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC176'><br/></div><div class='line' id='LC177'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="nb">isFinite</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">valueOf</span><span class="p">())</span> <span class="o">?</span></div><div class='line' id='LC178'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">this</span><span class="p">.</span><span class="nx">getUTCFullYear</span><span class="p">()</span>   <span class="o">+</span> <span class="s1">&#39;-&#39;</span> <span class="o">+</span></div><div class='line' id='LC179'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">f</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">getUTCMonth</span><span class="p">()</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span> <span class="o">+</span> <span class="s1">&#39;-&#39;</span> <span class="o">+</span></div><div class='line' id='LC180'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">f</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">getUTCDate</span><span class="p">())</span>      <span class="o">+</span> <span class="s1">&#39;T&#39;</span> <span class="o">+</span></div><div class='line' id='LC181'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">f</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">getUTCHours</span><span class="p">())</span>     <span class="o">+</span> <span class="s1">&#39;:&#39;</span> <span class="o">+</span></div><div class='line' id='LC182'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">f</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">getUTCMinutes</span><span class="p">())</span>   <span class="o">+</span> <span class="s1">&#39;:&#39;</span> <span class="o">+</span></div><div class='line' id='LC183'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">f</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">getUTCSeconds</span><span class="p">())</span>   <span class="o">+</span> <span class="s1">&#39;Z&#39;</span> <span class="o">:</span> <span class="kc">null</span><span class="p">;</span></div><div class='line' id='LC184'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">};</span></div><div class='line' id='LC185'><br/></div><div class='line' id='LC186'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nb">String</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">toJSON</span> <span class="o">=</span></div><div class='line' id='LC187'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nb">Number</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">toJSON</span> <span class="o">=</span></div><div class='line' id='LC188'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nb">Boolean</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">toJSON</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">key</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC189'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">valueOf</span><span class="p">();</span></div><div class='line' id='LC190'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">};</span></div><div class='line' id='LC191'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC192'><br/></div><div class='line' id='LC193'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">var</span> <span class="nx">cx</span> <span class="o">=</span> <span class="sr">/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g</span><span class="p">,</span></div><div class='line' id='LC194'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">escapable</span> <span class="o">=</span> <span class="sr">/[\\\&quot;\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g</span><span class="p">,</span></div><div class='line' id='LC195'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">gap</span><span class="p">,</span></div><div class='line' id='LC196'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">indent</span><span class="p">,</span></div><div class='line' id='LC197'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">meta</span> <span class="o">=</span> <span class="p">{</span>    <span class="c1">// table of character substitutions</span></div><div class='line' id='LC198'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39;\b&#39;</span><span class="o">:</span> <span class="s1">&#39;\\b&#39;</span><span class="p">,</span></div><div class='line' id='LC199'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39;\t&#39;</span><span class="o">:</span> <span class="s1">&#39;\\t&#39;</span><span class="p">,</span></div><div class='line' id='LC200'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39;\n&#39;</span><span class="o">:</span> <span class="s1">&#39;\\n&#39;</span><span class="p">,</span></div><div class='line' id='LC201'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39;\f&#39;</span><span class="o">:</span> <span class="s1">&#39;\\f&#39;</span><span class="p">,</span></div><div class='line' id='LC202'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39;\r&#39;</span><span class="o">:</span> <span class="s1">&#39;\\r&#39;</span><span class="p">,</span></div><div class='line' id='LC203'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39;&quot;&#39;</span> <span class="o">:</span> <span class="s1">&#39;\\&quot;&#39;</span><span class="p">,</span></div><div class='line' id='LC204'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39;\\&#39;</span><span class="o">:</span> <span class="s1">&#39;\\\\&#39;</span></div><div class='line' id='LC205'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">},</span></div><div class='line' id='LC206'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">rep</span><span class="p">;</span></div><div class='line' id='LC207'><br/></div><div class='line' id='LC208'><br/></div><div class='line' id='LC209'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">function</span> <span class="nx">quote</span><span class="p">(</span><span class="nx">string</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC210'><br/></div><div class='line' id='LC211'><span class="c1">// If the string contains no control characters, no quote characters, and no</span></div><div class='line' id='LC212'><span class="c1">// backslash characters, then we can safely slap some quotes around it.</span></div><div class='line' id='LC213'><span class="c1">// Otherwise we must also replace the offending characters with safe escape</span></div><div class='line' id='LC214'><span class="c1">// sequences.</span></div><div class='line' id='LC215'><br/></div><div class='line' id='LC216'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">escapable</span><span class="p">.</span><span class="nx">lastIndex</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span></div><div class='line' id='LC217'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="nx">escapable</span><span class="p">.</span><span class="nx">test</span><span class="p">(</span><span class="nx">string</span><span class="p">)</span> <span class="o">?</span></div><div class='line' id='LC218'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39;&quot;&#39;</span> <span class="o">+</span> <span class="nx">string</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="nx">escapable</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">a</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC219'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">var</span> <span class="nx">c</span> <span class="o">=</span> <span class="nx">meta</span><span class="p">[</span><span class="nx">a</span><span class="p">];</span></div><div class='line' id='LC220'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="k">typeof</span> <span class="nx">c</span> <span class="o">===</span> <span class="s1">&#39;string&#39;</span> <span class="o">?</span> <span class="nx">c</span> <span class="o">:</span></div><div class='line' id='LC221'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39;\\u&#39;</span> <span class="o">+</span> <span class="p">(</span><span class="s1">&#39;0000&#39;</span> <span class="o">+</span> <span class="nx">a</span><span class="p">.</span><span class="nx">charCodeAt</span><span class="p">(</span><span class="mi">0</span><span class="p">).</span><span class="nx">toString</span><span class="p">(</span><span class="mi">16</span><span class="p">)).</span><span class="nx">slice</span><span class="p">(</span><span class="o">-</span><span class="mi">4</span><span class="p">);</span></div><div class='line' id='LC222'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">})</span> <span class="o">+</span> <span class="s1">&#39;&quot;&#39;</span> <span class="o">:</span></div><div class='line' id='LC223'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39;&quot;&#39;</span> <span class="o">+</span> <span class="nx">string</span> <span class="o">+</span> <span class="s1">&#39;&quot;&#39;</span><span class="p">;</span></div><div class='line' id='LC224'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC225'><br/></div><div class='line' id='LC226'><br/></div><div class='line' id='LC227'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">function</span> <span class="nx">str</span><span class="p">(</span><span class="nx">key</span><span class="p">,</span> <span class="nx">holder</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC228'><br/></div><div class='line' id='LC229'><span class="c1">// Produce a string from holder[key].</span></div><div class='line' id='LC230'><br/></div><div class='line' id='LC231'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">var</span> <span class="nx">i</span><span class="p">,</span>          <span class="c1">// The loop counter.</span></div><div class='line' id='LC232'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">k</span><span class="p">,</span>          <span class="c1">// The member key.</span></div><div class='line' id='LC233'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">v</span><span class="p">,</span>          <span class="c1">// The member value.</span></div><div class='line' id='LC234'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">length</span><span class="p">,</span></div><div class='line' id='LC235'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">mind</span> <span class="o">=</span> <span class="nx">gap</span><span class="p">,</span></div><div class='line' id='LC236'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">partial</span><span class="p">,</span></div><div class='line' id='LC237'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">value</span> <span class="o">=</span> <span class="nx">holder</span><span class="p">[</span><span class="nx">key</span><span class="p">];</span></div><div class='line' id='LC238'><br/></div><div class='line' id='LC239'><span class="c1">// If the value has a toJSON method, call it to obtain a replacement value.</span></div><div class='line' id='LC240'><br/></div><div class='line' id='LC241'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="nx">value</span> <span class="o">&amp;&amp;</span> <span class="k">typeof</span> <span class="nx">value</span> <span class="o">===</span> <span class="s1">&#39;object&#39;</span> <span class="o">&amp;&amp;</span></div><div class='line' id='LC242'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">typeof</span> <span class="nx">value</span><span class="p">.</span><span class="nx">toJSON</span> <span class="o">===</span> <span class="s1">&#39;function&#39;</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC243'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">value</span> <span class="o">=</span> <span class="nx">value</span><span class="p">.</span><span class="nx">toJSON</span><span class="p">(</span><span class="nx">key</span><span class="p">);</span></div><div class='line' id='LC244'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC245'><br/></div><div class='line' id='LC246'><span class="c1">// If we were called with a replacer function, then call the replacer to</span></div><div class='line' id='LC247'><span class="c1">// obtain a replacement value.</span></div><div class='line' id='LC248'><br/></div><div class='line' id='LC249'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="k">typeof</span> <span class="nx">rep</span> <span class="o">===</span> <span class="s1">&#39;function&#39;</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC250'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">value</span> <span class="o">=</span> <span class="nx">rep</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">holder</span><span class="p">,</span> <span class="nx">key</span><span class="p">,</span> <span class="nx">value</span><span class="p">);</span></div><div class='line' id='LC251'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC252'><br/></div><div class='line' id='LC253'><span class="c1">// What happens next depends on the value&#39;s type.</span></div><div class='line' id='LC254'><br/></div><div class='line' id='LC255'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">switch</span> <span class="p">(</span><span class="k">typeof</span> <span class="nx">value</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC256'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">case</span> <span class="s1">&#39;string&#39;</span><span class="o">:</span></div><div class='line' id='LC257'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="nx">quote</span><span class="p">(</span><span class="nx">value</span><span class="p">);</span></div><div class='line' id='LC258'><br/></div><div class='line' id='LC259'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">case</span> <span class="s1">&#39;number&#39;</span><span class="o">:</span></div><div class='line' id='LC260'><br/></div><div class='line' id='LC261'><span class="c1">// JSON numbers must be finite. Encode non-finite numbers as null.</span></div><div class='line' id='LC262'><br/></div><div class='line' id='LC263'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="nb">isFinite</span><span class="p">(</span><span class="nx">value</span><span class="p">)</span> <span class="o">?</span> <span class="nb">String</span><span class="p">(</span><span class="nx">value</span><span class="p">)</span> <span class="o">:</span> <span class="s1">&#39;null&#39;</span><span class="p">;</span></div><div class='line' id='LC264'><br/></div><div class='line' id='LC265'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">case</span> <span class="s1">&#39;boolean&#39;</span><span class="o">:</span></div><div class='line' id='LC266'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">case</span> <span class="s1">&#39;null&#39;</span><span class="o">:</span></div><div class='line' id='LC267'><br/></div><div class='line' id='LC268'><span class="c1">// If the value is a boolean or null, convert it to a string. Note:</span></div><div class='line' id='LC269'><span class="c1">// typeof null does not produce &#39;null&#39;. The case is included here in</span></div><div class='line' id='LC270'><span class="c1">// the remote chance that this gets fixed someday.</span></div><div class='line' id='LC271'><br/></div><div class='line' id='LC272'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="nb">String</span><span class="p">(</span><span class="nx">value</span><span class="p">);</span></div><div class='line' id='LC273'><br/></div><div class='line' id='LC274'><span class="c1">// If the type is &#39;object&#39;, we might be dealing with an object or an array or</span></div><div class='line' id='LC275'><span class="c1">// null.</span></div><div class='line' id='LC276'><br/></div><div class='line' id='LC277'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">case</span> <span class="s1">&#39;object&#39;</span><span class="o">:</span></div><div class='line' id='LC278'><br/></div><div class='line' id='LC279'><span class="c1">// Due to a specification blunder in ECMAScript, typeof null is &#39;object&#39;,</span></div><div class='line' id='LC280'><span class="c1">// so watch out for that case.</span></div><div class='line' id='LC281'><br/></div><div class='line' id='LC282'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">value</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC283'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="s1">&#39;null&#39;</span><span class="p">;</span></div><div class='line' id='LC284'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC285'><br/></div><div class='line' id='LC286'><span class="c1">// Make an array to hold the partial results of stringifying this object value.</span></div><div class='line' id='LC287'><br/></div><div class='line' id='LC288'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">gap</span> <span class="o">+=</span> <span class="nx">indent</span><span class="p">;</span></div><div class='line' id='LC289'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">partial</span> <span class="o">=</span> <span class="p">[];</span></div><div class='line' id='LC290'><br/></div><div class='line' id='LC291'><span class="c1">// Is the value an array?</span></div><div class='line' id='LC292'><br/></div><div class='line' id='LC293'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="nb">Object</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">toString</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">value</span><span class="p">)</span> <span class="o">===</span> <span class="s1">&#39;[object Array]&#39;</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC294'><br/></div><div class='line' id='LC295'><span class="c1">// The value is an array. Stringify every element. Use null as a placeholder</span></div><div class='line' id='LC296'><span class="c1">// for non-JSON values.</span></div><div class='line' id='LC297'><br/></div><div class='line' id='LC298'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">length</span> <span class="o">=</span> <span class="nx">value</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span></div><div class='line' id='LC299'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">for</span> <span class="p">(</span><span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">length</span><span class="p">;</span> <span class="nx">i</span> <span class="o">+=</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC300'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">partial</span><span class="p">[</span><span class="nx">i</span><span class="p">]</span> <span class="o">=</span> <span class="nx">str</span><span class="p">(</span><span class="nx">i</span><span class="p">,</span> <span class="nx">value</span><span class="p">)</span> <span class="o">||</span> <span class="s1">&#39;null&#39;</span><span class="p">;</span></div><div class='line' id='LC301'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC302'><br/></div><div class='line' id='LC303'><span class="c1">// Join all of the elements together, separated with commas, and wrap them in</span></div><div class='line' id='LC304'><span class="c1">// brackets.</span></div><div class='line' id='LC305'><br/></div><div class='line' id='LC306'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">v</span> <span class="o">=</span> <span class="nx">partial</span><span class="p">.</span><span class="nx">length</span> <span class="o">===</span> <span class="mi">0</span> <span class="o">?</span> <span class="s1">&#39;[]&#39;</span> <span class="o">:</span></div><div class='line' id='LC307'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">gap</span> <span class="o">?</span> <span class="s1">&#39;[\n&#39;</span> <span class="o">+</span> <span class="nx">gap</span> <span class="o">+</span></div><div class='line' id='LC308'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">partial</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39;,\n&#39;</span> <span class="o">+</span> <span class="nx">gap</span><span class="p">)</span> <span class="o">+</span> <span class="s1">&#39;\n&#39;</span> <span class="o">+</span></div><div class='line' id='LC309'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">mind</span> <span class="o">+</span> <span class="s1">&#39;]&#39;</span> <span class="o">:</span></div><div class='line' id='LC310'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39;[&#39;</span> <span class="o">+</span> <span class="nx">partial</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39;,&#39;</span><span class="p">)</span> <span class="o">+</span> <span class="s1">&#39;]&#39;</span><span class="p">;</span></div><div class='line' id='LC311'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">gap</span> <span class="o">=</span> <span class="nx">mind</span><span class="p">;</span></div><div class='line' id='LC312'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="nx">v</span><span class="p">;</span></div><div class='line' id='LC313'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC314'><br/></div><div class='line' id='LC315'><span class="c1">// If the replacer is an array, use it to select the members to be stringified.</span></div><div class='line' id='LC316'><br/></div><div class='line' id='LC317'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="nx">rep</span> <span class="o">&amp;&amp;</span> <span class="k">typeof</span> <span class="nx">rep</span> <span class="o">===</span> <span class="s1">&#39;object&#39;</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC318'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">length</span> <span class="o">=</span> <span class="nx">rep</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span></div><div class='line' id='LC319'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">for</span> <span class="p">(</span><span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">length</span><span class="p">;</span> <span class="nx">i</span> <span class="o">+=</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC320'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">k</span> <span class="o">=</span> <span class="nx">rep</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span></div><div class='line' id='LC321'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="k">typeof</span> <span class="nx">k</span> <span class="o">===</span> <span class="s1">&#39;string&#39;</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC322'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">v</span> <span class="o">=</span> <span class="nx">str</span><span class="p">(</span><span class="nx">k</span><span class="p">,</span> <span class="nx">value</span><span class="p">);</span></div><div class='line' id='LC323'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="nx">v</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC324'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">partial</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">quote</span><span class="p">(</span><span class="nx">k</span><span class="p">)</span> <span class="o">+</span> <span class="p">(</span><span class="nx">gap</span> <span class="o">?</span> <span class="s1">&#39;: &#39;</span> <span class="o">:</span> <span class="s1">&#39;:&#39;</span><span class="p">)</span> <span class="o">+</span> <span class="nx">v</span><span class="p">);</span></div><div class='line' id='LC325'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC326'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC327'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC328'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span> <span class="k">else</span> <span class="p">{</span></div><div class='line' id='LC329'><br/></div><div class='line' id='LC330'><span class="c1">// Otherwise, iterate through all of the keys in the object.</span></div><div class='line' id='LC331'><br/></div><div class='line' id='LC332'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">for</span> <span class="p">(</span><span class="nx">k</span> <span class="k">in</span> <span class="nx">value</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC333'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="nb">Object</span><span class="p">.</span><span class="nx">hasOwnProperty</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">value</span><span class="p">,</span> <span class="nx">k</span><span class="p">))</span> <span class="p">{</span></div><div class='line' id='LC334'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">v</span> <span class="o">=</span> <span class="nx">str</span><span class="p">(</span><span class="nx">k</span><span class="p">,</span> <span class="nx">value</span><span class="p">);</span></div><div class='line' id='LC335'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="nx">v</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC336'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">partial</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">quote</span><span class="p">(</span><span class="nx">k</span><span class="p">)</span> <span class="o">+</span> <span class="p">(</span><span class="nx">gap</span> <span class="o">?</span> <span class="s1">&#39;: &#39;</span> <span class="o">:</span> <span class="s1">&#39;:&#39;</span><span class="p">)</span> <span class="o">+</span> <span class="nx">v</span><span class="p">);</span></div><div class='line' id='LC337'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC338'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC339'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC340'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC341'><br/></div><div class='line' id='LC342'><span class="c1">// Join all of the member texts together, separated with commas,</span></div><div class='line' id='LC343'><span class="c1">// and wrap them in braces.</span></div><div class='line' id='LC344'><br/></div><div class='line' id='LC345'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">v</span> <span class="o">=</span> <span class="nx">partial</span><span class="p">.</span><span class="nx">length</span> <span class="o">===</span> <span class="mi">0</span> <span class="o">?</span> <span class="s1">&#39;{}&#39;</span> <span class="o">:</span></div><div class='line' id='LC346'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">gap</span> <span class="o">?</span> <span class="s1">&#39;{\n&#39;</span> <span class="o">+</span> <span class="nx">gap</span> <span class="o">+</span> <span class="nx">partial</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39;,\n&#39;</span> <span class="o">+</span> <span class="nx">gap</span><span class="p">)</span> <span class="o">+</span> <span class="s1">&#39;\n&#39;</span> <span class="o">+</span></div><div class='line' id='LC347'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">mind</span> <span class="o">+</span> <span class="s1">&#39;}&#39;</span> <span class="o">:</span> <span class="s1">&#39;{&#39;</span> <span class="o">+</span> <span class="nx">partial</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39;,&#39;</span><span class="p">)</span> <span class="o">+</span> <span class="s1">&#39;}&#39;</span><span class="p">;</span></div><div class='line' id='LC348'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">gap</span> <span class="o">=</span> <span class="nx">mind</span><span class="p">;</span></div><div class='line' id='LC349'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="nx">v</span><span class="p">;</span></div><div class='line' id='LC350'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC351'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC352'><br/></div><div class='line' id='LC353'><span class="c1">// If the JSON object does not yet have a stringify method, give it one.</span></div><div class='line' id='LC354'><br/></div><div class='line' id='LC355'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="k">typeof</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span> <span class="o">!==</span> <span class="s1">&#39;function&#39;</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC356'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">value</span><span class="p">,</span> <span class="nx">replacer</span><span class="p">,</span> <span class="nx">space</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC357'><br/></div><div class='line' id='LC358'><span class="c1">// The stringify method takes a value and an optional replacer, and an optional</span></div><div class='line' id='LC359'><span class="c1">// space parameter, and returns a JSON text. The replacer can be a function</span></div><div class='line' id='LC360'><span class="c1">// that can replace values, or an array of strings that will select the keys.</span></div><div class='line' id='LC361'><span class="c1">// A default replacer method can be provided. Use of the space parameter can</span></div><div class='line' id='LC362'><span class="c1">// produce text that is more easily readable.</span></div><div class='line' id='LC363'><br/></div><div class='line' id='LC364'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">var</span> <span class="nx">i</span><span class="p">;</span></div><div class='line' id='LC365'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">gap</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span><span class="p">;</span></div><div class='line' id='LC366'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">indent</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span><span class="p">;</span></div><div class='line' id='LC367'><br/></div><div class='line' id='LC368'><span class="c1">// If the space parameter is a number, make an indent string containing that</span></div><div class='line' id='LC369'><span class="c1">// many spaces.</span></div><div class='line' id='LC370'><br/></div><div class='line' id='LC371'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="k">typeof</span> <span class="nx">space</span> <span class="o">===</span> <span class="s1">&#39;number&#39;</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC372'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">for</span> <span class="p">(</span><span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">space</span><span class="p">;</span> <span class="nx">i</span> <span class="o">+=</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC373'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">indent</span> <span class="o">+=</span> <span class="s1">&#39; &#39;</span><span class="p">;</span></div><div class='line' id='LC374'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC375'><br/></div><div class='line' id='LC376'><span class="c1">// If the space parameter is a string, it will be used as the indent string.</span></div><div class='line' id='LC377'><br/></div><div class='line' id='LC378'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="k">typeof</span> <span class="nx">space</span> <span class="o">===</span> <span class="s1">&#39;string&#39;</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC379'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">indent</span> <span class="o">=</span> <span class="nx">space</span><span class="p">;</span></div><div class='line' id='LC380'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC381'><br/></div><div class='line' id='LC382'><span class="c1">// If there is a replacer, it must be a function or an array.</span></div><div class='line' id='LC383'><span class="c1">// Otherwise, throw an error.</span></div><div class='line' id='LC384'><br/></div><div class='line' id='LC385'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">rep</span> <span class="o">=</span> <span class="nx">replacer</span><span class="p">;</span></div><div class='line' id='LC386'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="nx">replacer</span> <span class="o">&amp;&amp;</span> <span class="k">typeof</span> <span class="nx">replacer</span> <span class="o">!==</span> <span class="s1">&#39;function&#39;</span> <span class="o">&amp;&amp;</span></div><div class='line' id='LC387'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">typeof</span> <span class="nx">replacer</span> <span class="o">!==</span> <span class="s1">&#39;object&#39;</span> <span class="o">||</span></div><div class='line' id='LC388'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">typeof</span> <span class="nx">replacer</span><span class="p">.</span><span class="nx">length</span> <span class="o">!==</span> <span class="s1">&#39;number&#39;</span><span class="p">))</span> <span class="p">{</span></div><div class='line' id='LC389'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s1">&#39;JSON.stringify&#39;</span><span class="p">);</span></div><div class='line' id='LC390'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC391'><br/></div><div class='line' id='LC392'><span class="c1">// Make a fake root object containing our value under the key of &#39;&#39;.</span></div><div class='line' id='LC393'><span class="c1">// Return the result of stringifying the value.</span></div><div class='line' id='LC394'><br/></div><div class='line' id='LC395'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="nx">str</span><span class="p">(</span><span class="s1">&#39;&#39;</span><span class="p">,</span> <span class="p">{</span><span class="s1">&#39;&#39;</span><span class="o">:</span> <span class="nx">value</span><span class="p">});</span></div><div class='line' id='LC396'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">};</span></div><div class='line' id='LC397'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC398'><br/></div><div class='line' id='LC399'><br/></div><div class='line' id='LC400'><span class="c1">// If the JSON object does not yet have a parse method, give it one.</span></div><div class='line' id='LC401'><br/></div><div class='line' id='LC402'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="k">typeof</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span> <span class="o">!==</span> <span class="s1">&#39;function&#39;</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC403'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">text</span><span class="p">,</span> <span class="nx">reviver</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC404'><br/></div><div class='line' id='LC405'><span class="c1">// The parse method takes a text and an optional reviver function, and returns</span></div><div class='line' id='LC406'><span class="c1">// a JavaScript value if the text is a valid JSON text.</span></div><div class='line' id='LC407'><br/></div><div class='line' id='LC408'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">var</span> <span class="nx">j</span><span class="p">;</span></div><div class='line' id='LC409'><br/></div><div class='line' id='LC410'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">function</span> <span class="nx">walk</span><span class="p">(</span><span class="nx">holder</span><span class="p">,</span> <span class="nx">key</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC411'><br/></div><div class='line' id='LC412'><span class="c1">// The walk method is used to recursively walk the resulting structure so</span></div><div class='line' id='LC413'><span class="c1">// that modifications can be made.</span></div><div class='line' id='LC414'><br/></div><div class='line' id='LC415'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">var</span> <span class="nx">k</span><span class="p">,</span> <span class="nx">v</span><span class="p">,</span> <span class="nx">value</span> <span class="o">=</span> <span class="nx">holder</span><span class="p">[</span><span class="nx">key</span><span class="p">];</span></div><div class='line' id='LC416'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="nx">value</span> <span class="o">&amp;&amp;</span> <span class="k">typeof</span> <span class="nx">value</span> <span class="o">===</span> <span class="s1">&#39;object&#39;</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC417'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">for</span> <span class="p">(</span><span class="nx">k</span> <span class="k">in</span> <span class="nx">value</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC418'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="nb">Object</span><span class="p">.</span><span class="nx">hasOwnProperty</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">value</span><span class="p">,</span> <span class="nx">k</span><span class="p">))</span> <span class="p">{</span></div><div class='line' id='LC419'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">v</span> <span class="o">=</span> <span class="nx">walk</span><span class="p">(</span><span class="nx">value</span><span class="p">,</span> <span class="nx">k</span><span class="p">);</span></div><div class='line' id='LC420'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="nx">v</span> <span class="o">!==</span> <span class="kc">undefined</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC421'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">value</span><span class="p">[</span><span class="nx">k</span><span class="p">]</span> <span class="o">=</span> <span class="nx">v</span><span class="p">;</span></div><div class='line' id='LC422'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span> <span class="k">else</span> <span class="p">{</span></div><div class='line' id='LC423'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">delete</span> <span class="nx">value</span><span class="p">[</span><span class="nx">k</span><span class="p">];</span></div><div class='line' id='LC424'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC425'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC426'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC427'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC428'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="nx">reviver</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">holder</span><span class="p">,</span> <span class="nx">key</span><span class="p">,</span> <span class="nx">value</span><span class="p">);</span></div><div class='line' id='LC429'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC430'><br/></div><div class='line' id='LC431'><br/></div><div class='line' id='LC432'><span class="c1">// Parsing happens in four stages. In the first stage, we replace certain</span></div><div class='line' id='LC433'><span class="c1">// Unicode characters with escape sequences. JavaScript handles many characters</span></div><div class='line' id='LC434'><span class="c1">// incorrectly, either silently deleting them, or treating them as line endings.</span></div><div class='line' id='LC435'><br/></div><div class='line' id='LC436'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">text</span> <span class="o">=</span> <span class="nb">String</span><span class="p">(</span><span class="nx">text</span><span class="p">);</span></div><div class='line' id='LC437'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">cx</span><span class="p">.</span><span class="nx">lastIndex</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span></div><div class='line' id='LC438'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="nx">cx</span><span class="p">.</span><span class="nx">test</span><span class="p">(</span><span class="nx">text</span><span class="p">))</span> <span class="p">{</span></div><div class='line' id='LC439'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">text</span> <span class="o">=</span> <span class="nx">text</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="nx">cx</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">a</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC440'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="s1">&#39;\\u&#39;</span> <span class="o">+</span></div><div class='line' id='LC441'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s1">&#39;0000&#39;</span> <span class="o">+</span> <span class="nx">a</span><span class="p">.</span><span class="nx">charCodeAt</span><span class="p">(</span><span class="mi">0</span><span class="p">).</span><span class="nx">toString</span><span class="p">(</span><span class="mi">16</span><span class="p">)).</span><span class="nx">slice</span><span class="p">(</span><span class="o">-</span><span class="mi">4</span><span class="p">);</span></div><div class='line' id='LC442'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">});</span></div><div class='line' id='LC443'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC444'><br/></div><div class='line' id='LC445'><span class="c1">// In the second stage, we run the text against regular expressions that look</span></div><div class='line' id='LC446'><span class="c1">// for non-JSON patterns. We are especially concerned with &#39;()&#39; and &#39;new&#39;</span></div><div class='line' id='LC447'><span class="c1">// because they can cause invocation, and &#39;=&#39; because it can cause mutation.</span></div><div class='line' id='LC448'><span class="c1">// But just to be safe, we want to reject all unexpected forms.</span></div><div class='line' id='LC449'><br/></div><div class='line' id='LC450'><span class="c1">// We split the second stage into 4 regexp operations in order to work around</span></div><div class='line' id='LC451'><span class="c1">// crippling inefficiencies in IE&#39;s and Safari&#39;s regexp engines. First we</span></div><div class='line' id='LC452'><span class="c1">// replace the JSON backslash pairs with &#39;@&#39; (a non-JSON character). Second, we</span></div><div class='line' id='LC453'><span class="c1">// replace all simple value tokens with &#39;]&#39; characters. Third, we delete all</span></div><div class='line' id='LC454'><span class="c1">// open brackets that follow a colon or comma or that begin the text. Finally,</span></div><div class='line' id='LC455'><span class="c1">// we look to see that the remaining characters are only whitespace or &#39;]&#39; or</span></div><div class='line' id='LC456'><span class="c1">// &#39;,&#39; or &#39;:&#39; or &#39;{&#39; or &#39;}&#39;. If that is so, then the text is safe for eval.</span></div><div class='line' id='LC457'><br/></div><div class='line' id='LC458'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="sr">/^[\],:{}\s]*$/</span><span class="p">.</span></div><div class='line' id='LC459'><span class="nx">test</span><span class="p">(</span><span class="nx">text</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="sr">/\\(?:[&quot;\\\/bfnrt]|u[0-9a-fA-F]{4})/g</span><span class="p">,</span> <span class="s1">&#39;@&#39;</span><span class="p">).</span></div><div class='line' id='LC460'><span class="nx">replace</span><span class="p">(</span><span class="sr">/&quot;[^&quot;\\\n\r]*&quot;|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g</span><span class="p">,</span> <span class="s1">&#39;]&#39;</span><span class="p">).</span></div><div class='line' id='LC461'><span class="nx">replace</span><span class="p">(</span><span class="sr">/(?:^|:|,)(?:\s*\[)+/g</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">)))</span> <span class="p">{</span></div><div class='line' id='LC462'><br/></div><div class='line' id='LC463'><span class="c1">// In the third stage we use the eval function to compile the text into a</span></div><div class='line' id='LC464'><span class="c1">// JavaScript structure. The &#39;{&#39; operator is subject to a syntactic ambiguity</span></div><div class='line' id='LC465'><span class="c1">// in JavaScript: it can begin a block or an object literal. We wrap the text</span></div><div class='line' id='LC466'><span class="c1">// in parens to eliminate the ambiguity.</span></div><div class='line' id='LC467'><br/></div><div class='line' id='LC468'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">j</span> <span class="o">=</span> <span class="nb">eval</span><span class="p">(</span><span class="s1">&#39;(&#39;</span> <span class="o">+</span> <span class="nx">text</span> <span class="o">+</span> <span class="s1">&#39;)&#39;</span><span class="p">);</span></div><div class='line' id='LC469'><br/></div><div class='line' id='LC470'><span class="c1">// In the optional fourth stage, we recursively walk the new structure, passing</span></div><div class='line' id='LC471'><span class="c1">// each name/value pair to a reviver function for possible transformation.</span></div><div class='line' id='LC472'><br/></div><div class='line' id='LC473'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="k">typeof</span> <span class="nx">reviver</span> <span class="o">===</span> <span class="s1">&#39;function&#39;</span> <span class="o">?</span></div><div class='line' id='LC474'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">walk</span><span class="p">({</span><span class="s1">&#39;&#39;</span><span class="o">:</span> <span class="nx">j</span><span class="p">},</span> <span class="s1">&#39;&#39;</span><span class="p">)</span> <span class="o">:</span> <span class="nx">j</span><span class="p">;</span></div><div class='line' id='LC475'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC476'><br/></div><div class='line' id='LC477'><span class="c1">// If the text is not JSON parseable, then a SyntaxError is thrown.</span></div><div class='line' id='LC478'><br/></div><div class='line' id='LC479'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">throw</span> <span class="k">new</span> <span class="nx">SyntaxError</span><span class="p">(</span><span class="s1">&#39;JSON.parse&#39;</span><span class="p">);</span></div><div class='line' id='LC480'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">};</span></div><div class='line' id='LC481'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC482'><span class="p">}());</span></div><div class='line' id='LC483'><br/></div></pre></div>
+          </td>
+        </tr>
+      </table>
+  </div>
+
+  </div>
+</div>
+
+<a href="#jump-to-line" rel="facebox[.linejump]" data-hotkey="l" class="js-jump-to-line" style="display:none">Jump to Line</a>
+<div id="jump-to-line" style="display:none">
+  <form accept-charset="UTF-8" class="js-jump-to-line-form">
+    <input class="linejump-input js-jump-to-line-field" type="text" placeholder="Jump to line&hellip;" autofocus>
+    <button type="submit" class="button">Go</button>
+  </form>
+</div>
+
+        </div>
+
+      </div><!-- /.repo-container -->
+      <div class="modal-backdrop"></div>
+    </div><!-- /.container -->
+  </div><!-- /.site -->
+
+
+    </div><!-- /.wrapper -->
+
+      <div class="container">
+  <div class="site-footer">
+    <ul class="site-footer-links right">
+      <li><a href="https://status.github.com/">Status</a></li>
+      <li><a href="http://developer.github.com">API</a></li>
+      <li><a href="http://training.github.com">Training</a></li>
+      <li><a href="http://shop.github.com">Shop</a></li>
+      <li><a href="/blog">Blog</a></li>
+      <li><a href="/about">About</a></li>
+
+    </ul>
+
+    <a href="/">
+      <span class="mega-octicon octicon-mark-github"></span>
+    </a>
+
+    <ul class="site-footer-links">
+      <li>&copy; 2013 <span title="0.12529s from fe3.rs.github.com">GitHub</span>, Inc.</li>
+        <li><a href="/site/terms">Terms</a></li>
+        <li><a href="/site/privacy">Privacy</a></li>
+        <li><a href="/security">Security</a></li>
+        <li><a href="/contact">Contact</a></li>
+    </ul>
+  </div><!-- /.site-footer -->
+</div><!-- /.container -->
+
+
+    <div class="fullscreen-overlay js-fullscreen-overlay" id="fullscreen_overlay">
+  <div class="fullscreen-container js-fullscreen-container">
+    <div class="textarea-wrap">
+      <textarea name="fullscreen-contents" id="fullscreen-contents" class="js-fullscreen-contents" placeholder="" data-suggester="fullscreen_suggester"></textarea>
+          <div class="suggester-container">
+              <div class="suggester fullscreen-suggester js-navigation-container" id="fullscreen_suggester"
+                 data-url="/appendto/jquery-mockjax/suggestions/commit">
+              </div>
+          </div>
+    </div>
+  </div>
+  <div class="fullscreen-sidebar">
+    <a href="#" class="exit-fullscreen js-exit-fullscreen tooltipped leftwards" title="Exit Zen Mode">
+      <span class="mega-octicon octicon-screen-normal"></span>
+    </a>
+    <a href="#" class="theme-switcher js-theme-switcher tooltipped leftwards"
+      title="Switch themes">
+      <span class="octicon octicon-color-mode"></span>
+    </a>
+  </div>
+</div>
+
+
+
+    <div id="ajax-error-message" class="flash flash-error">
+      <span class="octicon octicon-alert"></span>
+      <a href="#" class="octicon octicon-remove-close close ajax-error-dismiss"></a>
+      Something went wrong with that request. Please try again.
+    </div>
+
+    
+  </body>
+</html>
+
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mockjax-helper.txt
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mockjax-helper.txt	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mockjax-helper.txt	(revision 5703)
@@ -0,0 +1,20 @@
+/* https://github.com/appendto/jquery-mockjax/blob/master/README.md */
+
+/* Set up mocks */
+
+$.mockjax(options); /* Sets up a mockjax handler. */
+
+/* options */
+/* responseXML: A string specifying the mocked XML for the request. */
+/* proxy: A string specifying a path to a file, from which the contents will be returned for the request. */
+/* etag: A string specifying a unique identifier referencing a specific version of the requested data.
+ * This is used by $.ajax to determine if the requested data is new since the last request. (see HTTP_ETag) */
+
+/* Remove mocks */
+
+$.mockjaxClear(); /* Removes all mockjax handlers. */
+
+$.mockjaxClear(id); /* Remove a single mockjax handler. id is the string returned from $.mockjax. */
+
+/* Return mocks */
+$.mockjax.mockedAjaxCalls(); /* Returns all mocked ajax calls so you can e.g. check that expected data is sent to backend. */
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mockjax-xml.html
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mockjax-xml.html	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mockjax-xml.html	(revision 5703)
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML>
+<html>
+    <head>
+        <meta charset="UTF-8">
+        <title>Test MockJax</title>
+
+        <style type="text/css">
+            #xmlContents {
+                background-color: #F0F0F0 ;
+                border: 1px solid #CCCCCC ;
+                padding: 15px 15px 15px 15px ;
+                width: 90% ;
+            }
+        </style>
+
+        <!-- Libraries -->
+        <!-- <script src="../lib/jquery-1.10.2.min.js"></script> -->
+        
+        <!-- Observe: jquery 1.8.3 version required in order to have proxy approach work with mockjax! -->
+        <script src="../../lib/jquery-1.8.3.min.js"></script>
+        
+        <script src="../../lib/jquery-migrate-1.2.1.min.js"></script>
+        <script src="../../lib/jquery.mockjax.js"></script>
+
+        <!-- Include xmlDOM plugin, if you need to translate responseXML into DOM. -->
+        <!-- <script src="../lib/jquery.xmldom.js"></script> -->
+
+        <!-- Functionality -->
+        <script src="mockjax-xml.js"></script>
+
+        <!-- Annotation transformations -->
+        <script src="../../conversion.utils.js"></script>
+        
+        <script type="text/javascript">
+            //<![CDATA[
+            
+            //]]>
+        </script>
+
+    </head>
+
+    <body>
+
+        <h3>XML Content Retrieval</h3>
+        <div id="xmlContents"></div>
+        <!--
+        <br />
+        <button type="button">Click Me!</button>
+        -->
+
+    </body>
+</html>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mockjax-xml.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mockjax-xml.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mockjax-xml.js	(revision 5703)
@@ -0,0 +1,164 @@
+/*
+ * @content Mocking retrieval of annotations
+ * (see: https://trac.clarin.eu/wiki/DASISH/XSD%20and%20XML#RespondingGETapiannotationslinkhttp:en.wikipedia.orgwikiSagrada_FamC3ADliaaccessread;
+ * Scenario - visiting an annotated web page: https://trac.clarin.eu/wiki/DASISH/Scenario)
+ */
+
+//var url = '/api/annotations?link="http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia"';
+var url = '/api/annotations?link="http://snd.gu.se/"';
+
+
+// Mock for Responding GET api/annotations?link="URI"
+$.mockjax({
+    /* url: A string or regular expression specifying the url of the request that the data should be mocked for. */
+    // url: '/api/annotations?link="http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia"&access=read',
+    url: '/api/annotations?link="http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia"',
+    // url: '/api/annotations?link="http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia"',
+    /* type: Specify what HTTP method to match, usually GET or POST. Case-insensitive, so get and post also work. */
+    type: 'GET',
+    /* dataType: Allowed data formats are Text, HTML, JSON, Script and XML. */
+    dataType: 'xml',
+    /* responseTime: An integer that specifies a simulated network and server latency (in milliseconds). */
+    responseTime: 750,
+    /* proxy: A string specifying a path to a file, from which the contents will be returned for the request. */
+    proxy: 'mocks/annotations-sagrada-GET.xml',
+});
+
+$.mockjax({
+    /* url: A string or regular expression specifying the url of the request that the data should be mocked for. */
+    // url: '/api/annotations?link="http://snd.gu.se/"&access=read',
+    url: '/api/annotations?link="http://snd.gu.se/"',
+    // url: '/api/annotations?link="http://snd.gu.se/"',
+    /* type: Specify what HTTP method to match, usually GET or POST. Case-insensitive, so get and post also work. */
+    type: 'GET',
+    /* dataType: Allowed data formats are Text, HTML, JSON, Script and XML. */
+    dataType: 'xml',
+    /* responseTime: An integer that specifies a simulated network and server latency (in milliseconds). */
+    responseTime: 750,
+    /* proxy: A string specifying a path to a file, from which the contents will be returned for the request. */
+    proxy: 'mocks/annotations-snd-GET.xml',
+});
+
+// Mock for Responding GET api/annotations/AID20130808114716 (annot-0001-GET.xml)
+$.mockjax({
+    url: '/api/annotations/AID20130808114716',
+    type: 'GET',
+    dataType: 'xml',
+    responseTime: 750,
+    proxy: 'mocks/annot-0001-GET.xml',
+});
+
+// Mock for Responding GET api/annotations/AID20130808124131 (annot-0002-GET.xml)
+$.mockjax({
+    url: '/api/annotations/AID20130808124131',
+    type: 'GET',
+    dataType: 'xml',
+    responseTime: 750,
+    proxy: 'mocks/annot-0002-GET.xml',
+});
+
+// Mock for Responding GET api/annotations/AID20130809151651 (annot-0003-GET.xml)
+$.mockjax({
+    url: '/api/annotations/AID20130809151651',
+    type: 'GET',
+    dataType: 'xml',
+    responseTime: 750,
+    proxy: 'mocks/annot-0003-GET.xml',
+});
+
+// Mock for Responding GET api/annotations/AID20130816145322 (annot-0004-GET.xml)
+$.mockjax({
+    url: '/api/annotations/AID20130816145322',
+    type: 'GET',
+    dataType: 'xml',
+    responseTime: 750,
+    proxy: 'mocks/annot-0004-GET.xml',
+});
+
+// Mock for Responding GET api/annotations/AID20130816170015 (annot-0005-GET.xml)
+$.mockjax({
+    url: '/api/annotations/AID20130816170015',
+    type: 'GET',
+    dataType: 'xml',
+    responseTime: 750,
+    proxy: 'mocks/annot-0005-GET.xml',
+});
+
+// Mock for Responding GET api/annotations/AID20130920110032 (annot-0006-GET.xml)
+$.mockjax({
+    url: '/api/annotations/AID20130920110032',
+    type: 'GET',
+    dataType: 'xml',
+    responseTime: 750,
+    proxy: 'mocks/annot-0006-GET.xml',
+});
+
+var XMLData = function() {
+    return {
+        getMockAnnotations: function(url) {
+            $.ajax({
+                url: url,
+                dataType: 'xml',
+                type: 'GET',
+                success: function(xml, textStatus, jqXHR) {
+                    // success: function(xml) {    
+                    // can be used if parameters textStatus and jqXHR are not required within the following code block
+
+                    $xml = $(xml);
+                    
+                    console.log('Data: ' + $xml);
+                    console.log($xml);
+                    console.log('Status: ' + textStatus);
+                    console.log('XMLHttpRequest object: ' + jqXHR);
+                    console.log(jqXHR);
+                    
+                    var aidArr = [];
+                    var aid_string = "";
+                    
+                    $xml.find('annotations annotation').each(function() {
+                        $aid_uri = $(this).attr('ref');
+                        aidArr.push($aid_uri.substr($aid_uri.lastIndexOf('/')+1)); // http://dasish.eu/annotations/ is erased
+                    });
+
+                    console.log(aidArr);
+
+                    for (var i in aidArr) {
+                        aid_string += '<br />' + aidArr[i];
+                        $('#xmlContents').html('<h4 style="margin-bottom: 0;">List of AIDs returned from REST service address<br />GET api/annotations?link="URI":</h4>' + aid_string);
+                        url = "";
+                        url = '/api/annotations/' + aidArr[i];
+                        
+                        $.ajax({
+                            url: url,
+                            dataType: 'xml',
+                            type: 'GET',
+                            success: function(xml) {
+                                
+                                $xml = $(xml);
+   
+                                var body = "";
+                                var aid = "";
+                                
+                                $xml.find('annotation').each(function() {
+                                    body = $(this).find('body').text();
+                                    aid = $(this).attr('URI').substr($(this).attr('URI').lastIndexOf('/')+1);
+  
+                                    $('#xmlContents').append("<br /><br /><strong>Body content of " + aid + ":</strong><br /><em>" + body + "</em>");
+                                    
+                                    var om_object = annotation2om_object(this);
+                                    $('#xmlContents').append("<br /><strong>converted to om_object:</strong><br/><textarea cols='130' rows='18'>"+JSON.stringify(om_object, null, '  ')+"</textarea>");
+                                });   
+                                
+                            }
+                        });
+
+                    }
+
+                }
+
+            });
+        }
+    }
+}();
+
+XMLData.getMockAnnotations(url);
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0001-GET.xml
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0001-GET.xml	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0001-GET.xml	(revision 5703)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<annotation xmlns="http://www.dasish.eu/ns/addit"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xhtml="http://www.w3.org/1999/xhtml"
+    xsi:schemaLocation="http://www.dasish.eu/ns/addit http://dasish.eu/DASISH-schema.xsd"
+    URI="http://dasish.eu/annotations/AID20130808114716"
+    timeStamp="2013-08-08T09:46:06.000Z">
+    <owner ref="http://dasish.eu/users/UID0001"/>
+    <headline>Background - Sagrada FamÃ­lia - Wikipedia, the free encyclopedia</headline>
+    <body type="Note">
+        <xhtml:span style="background-color:rgb(0,0,153);color:rgb(255,255,255);border: thick solid rgb(0, 0, 153);">Some background information on Sagrada FamÃ­lia.</xhtml:span>
+    </body>
+    <targetSources>
+        <target>
+            <source ref="http://dasish.eu/sources/SID20130808114716">
+                <link>http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#xpointer(start-point(string-range(//span[@id="Background"]/text()[1],'',0))/range-to(string-range(//span[@id="Background"]/text()[1],'',10)))</link>
+                <version>2013-08-08T09:46:06.000Z</version>
+            </source>
+        </target>
+    </targetSources>
+    <permissions ref="http://dasish.eu/permissions/PermissionsListID20130808114716"/>
+</annotation>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0001-POST.xml
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0001-POST.xml	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0001-POST.xml	(revision 5703)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<annotation xmlns="http://www.dasish.eu/ns/addit"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xhtml="http://www.w3.org/1999/xhtml"
+    xsi:schemaLocation="http://www.dasish.eu/ns/addit http://dasish.eu/DASISH-schema.xsd"
+    URI="temp-annotation-20130808114716"
+    timeStamp="2013-08-08T09:46:06.000Z">
+    <owner ref="http://dasish.eu/users//UIxyz/how_will_this_be_sent_from_the_client"/>
+    <headline>1 - Sagrada FamÃ­lia - Wikipedia, the free encyclopedia</headline>
+    <body type="Note" ref="tmp20130808114716">
+        <xhtml:span style="background-color:rgb(0,0,153);color:rgb(255,255,255);border: thick solid rgb(0, 0, 153);">Some background information on Sagrada FamÃ­lia.</xhtml:span>
+    </body>
+    <targetSources>
+        <target>
+            <newSource xml:id="tmp20130808114716">
+                <link>http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#xpointer(start-point(string-range(//span[@id="Background"]/text()[1],'',0))/range-to(string-range(//span[@id="Background"]/text()[1],'',10)))</link>
+                <version>2013-08-08T09:46:06.000Z</version>
+            </newSource>
+        </target>
+    </targetSources>
+    <permissions ref="tmpPermissionsListID20130808114716"/>
+</annotation>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0002-GET.xml
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0002-GET.xml	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0002-GET.xml	(revision 5703)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<annotation xmlns="http://www.dasish.eu/ns/addit"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xhtml="http://www.w3.org/1999/xhtml"
+    xsi:schemaLocation="http://www.dasish.eu/ns/addit http://dasish.eu/DASISH-schema.xsd"
+    URI="http://dasish.eu/annotations/AID20130808124131"
+    timeStamp="2013-08-08T10:41:04.000Z">
+    <owner ref="http://dasish.eu/users/UID0002"/>
+    <headline>AVE tunnel - Sagrada FamÃ­lia - Wikipedia, the free encyclopedia</headline>
+    <body type="Note">
+        <xhtml:span style="background-color:rgb(0,0,153);color:rgb(255,255,255);border: thick solid rgb(0, 0, 153);">High speed train tunnel poses risk to church building?</xhtml:span>
+    </body>
+    <targetSources>
+        <target>
+            <source ref="http://dasish.eu/sources/SID20130808124131">
+                <link>http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#xpointer(start-point(string-range(//span[@id="AVE_tunnel"]/text()[1],'',0))/range-to(string-range(//span[@id="AVE_tunnel"]/text()[1],'',10)))</link>
+                <version>2013-08-08T10:41:04.000Z</version>
+            </source>
+        </target>
+    </targetSources>
+    <permissions ref="http://dasish.eu/permissions/PermissionsListID20130808124131"/>
+</annotation>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0002-POST.xml
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0002-POST.xml	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0002-POST.xml	(revision 5703)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<annotation xmlns="http://www.dasish.eu/ns/addit"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xhtml="http://www.w3.org/1999/xhtml"
+    xsi:schemaLocation="http://www.dasish.eu/ns/addit http://dasish.eu/DASISH-schema.xsd"
+    URI="tempAID20130808124131"
+    timeStamp="2013-08-08T10:41:04.000Z">
+    <owner ref="http://dasish.eu/users//UIxyz/how_will_this_be_sent_from_the_client"/>
+    <headline>AVE tunnel - Sagrada FamÃ­lia - Wikipedia, the free encyclopedia</headline>
+    <body type="Note" ref="tmp20130808124131">
+        <xhtml:span style="background-color:rgb(0,0,153);color:rgb(255,255,255);border: thick solid rgb(0, 0, 153);">High speed train tunnel poses risk to church building?</xhtml:span>
+    </body>
+    <targetSources>
+        <target>
+            <newSource xml:id="tmp20130808124131">
+                <link>http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#xpointer(start-point(string-range(//span[@id="AVE_tunnel"]/text()[1],'',0))/range-to(string-range(//span[@id="AVE_tunnel"]/text()[1],'',10)))</link>
+                <version>2013-08-08T10:41:04.000Z</version>
+            </newSource>
+        </target>
+    </targetSources>
+    <permissions ref="tmpPermissionsListID20130808124131"/>
+</annotation>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0003-GET.xml
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0003-GET.xml	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0003-GET.xml	(revision 5703)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<annotation xmlns="http://www.dasish.eu/ns/addit"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xhtml="http://www.w3.org/1999/xhtml"
+    xsi:schemaLocation="http://www.dasish.eu/ns/addit http://dasish.eu/DASISH-schema.xsd"
+    URI="http://dasish.eu/annotations/AID20130809151651"
+    timeStamp="2013-08-09T13:16:42.000Z">
+    <owner ref="http://dasish.eu/users/UID0003"/>
+    <headline>Fire - Sagrada FamÃ­lia - Wikipedia, the free encyclopedia</headline>
+    <body type="Note">
+        <xhtml:span style="background-color:rgb(0,0,153);color:rgb(255,255,255);border: thick solid rgb(0, 0, 153);">Fire destroyed sacristy in 2011.</xhtml:span>
+    </body>
+    <targetSources>
+        <target>
+            <source ref="http://dasish.eu/sources/SID20130809151651">
+                <link>http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#xpointer(start-point(string-range(//span[@id="Fire"]/text()[1],'',0))/range-to(string-range(//span[@id="Fire"]/text()[1],'',4)))</link>
+                <version>2013-08-09T13:16:42.000Z</version>
+            </source>
+        </target>
+    </targetSources>
+    <permissions ref="http://dasish.eu/permissions/PermissionsListID20130809151651"/>
+</annotation>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0003-POST.xml
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0003-POST.xml	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0003-POST.xml	(revision 5703)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<annotation xmlns="http://www.dasish.eu/ns/addit"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xhtml="http://www.w3.org/1999/xhtml"
+    xsi:schemaLocation="http://www.dasish.eu/ns/addit http://dasish.eu/DASISH-schema.xsd"
+    URI="tempAID20130809151651"
+    timeStamp="2013-08-09T13:16:42.000Z">
+    <owner ref="http://dasish.eu/users/UIxyz/how_will_this_be_sent_from_the_client"/>
+    <headline>Fire - Sagrada FamÃ­lia - Wikipedia, the free encyclopedia</headline>
+    <body type="Note" ref="tmp20130809151651">
+        <xhtml:span style="background-color:rgb(0,0,153);color:rgb(255,255,255);border: thick solid rgb(0, 0, 153);">Fire destroyed sacristy in 2011.</xhtml:span>
+    </body>
+    <targetSources>
+        <target>
+            <newSource xml:id="tmp20130809151651">
+                <link>http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#xpointer(start-point(string-range(//span[@id="Fire"]/text()[1],'',0))/range-to(string-range(//span[@id="Fire"]/text()[1],'',4)))</link>
+                <version>2013-08-09T13:16:42.000Z</version>
+            </newSource>
+        </target>
+    </targetSources>
+    <permissions ref="tmpPermissionsListID20130809151651"/>
+</annotation>
+
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0004-GET.xml
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0004-GET.xml	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0004-GET.xml	(revision 5703)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<annotation xmlns="http://www.dasish.eu/ns/addit"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xhtml="http://www.w3.org/1999/xhtml"
+    xsi:schemaLocation="http://www.dasish.eu/ns/addit http://dasish.eu/DASISH-schema.xsd"
+    URI="http://dasish.eu/annotations/AID20130816145322"
+    timeStamp="2013-08-16T12:48:30.000Z">
+    <owner ref="http://dasish.eu/users/UID0004"/>
+    <headline>Spires - Sagrada FamÃ­lia - Wikipedia, the free encyclopedia</headline>
+    <body type="Note">
+        <xhtml:span style="background-color:rgb(0,0,153);color:rgb(255,255,255);border: thick solid rgb(0, 0, 153);">Spire design cut in numbers.</xhtml:span>
+    </body>
+    <targetSources>
+        <target>
+            <source ref="http://dasish.eu/sources/SID20130816145322">
+                <link>http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#xpointer(start-point(string-range(//span[@id="Spires"]/text()[1],'',0))/range-to(string-range(//span[@id="Spires"]/text()[1],'',6)))</link>
+                <version>2013-08-16T12:48:30.000Z</version>
+            </source>
+        </target>
+    </targetSources>
+    <permissions ref="http://dasish.eu/permissions/PermissionsListID20130816145322"/>
+</annotation>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0004-POST.xml
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0004-POST.xml	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0004-POST.xml	(revision 5703)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<annotation xmlns="http://www.dasish.eu/ns/addit"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xhtml="http://www.w3.org/1999/xhtml"
+    xsi:schemaLocation="http://www.dasish.eu/ns/addit http://dasish.eu/DASISH-schema.xsd"
+    URI="tempAID20130816145322"
+    timeStamp="2013-08-16T12:48:30.000Z">
+    <owner ref="http://dasish.eu/users/UIxyz/how_will_this_be_sent_from_the_client"/>
+    <headline>Spires - Sagrada FamÃ­lia - Wikipedia, the free encyclopedia</headline>
+    <body type="Note" ref="tmp20130816145322">
+        <xhtml:span style="background-color:rgb(0,0,153);color:rgb(255,255,255);border: thick solid rgb(0, 0, 153);">Spire design cut in numbers.</xhtml:span>
+    </body>
+    <targetSources>
+        <target>
+            <newSource xml:id="tmp20130816145322">
+                <link>http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#xpointer(start-point(string-range(//span[@id="Spires"]/text()[1],'',0))/range-to(string-range(//span[@id="Spires"]/text()[1],'',6)))</link>
+                <version>2013-08-16T12:48:30.000Z</version>
+            </newSource>
+        </target>
+    </targetSources>
+    <permissions ref="tmpPermissionsListID20130816145322"/>
+</annotation>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0005-GET.xml
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0005-GET.xml	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0005-GET.xml	(revision 5703)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<annotation xmlns="http://www.dasish.eu/ns/addit"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xhtml="http://www.w3.org/1999/xhtml"
+    xsi:schemaLocation="http://www.dasish.eu/ns/addit http://dasish.eu/DASISH-schema.xsd"
+    URI="http://dasish.eu/annotations/AID20130816170015"
+    timeStamp="2013-08-16T14:12:03.000Z">
+    <owner ref="http://dasish.eu/users/UID0005"/>
+    <headline>Construction - Sagrada FamÃ­lia - Wikipedia, the free encyclopedia</headline>
+    <body type="Note">
+        <xhtml:span style="background-color:rgb(0,0,153);color:rgb(255,255,255);border: thick solid rgb(0, 0, 153);">The construction of the basilica takes time.</xhtml:span>
+    </body>
+    <targetSources>
+        <target>
+            <source ref="http://dasish.eu/sources/SID20130816170015">
+                <link>http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#xpointer(start-point(string-range(//span[@id="Construction"]/text()[1],'',0))/range-to(string-range(//span[@id="Construction"]/text()[1],'',12)))</link>
+                <version>2013-08-16T14:12:03.000Z</version>
+            </source>
+        </target>
+    </targetSources>
+    <permissions ref="http://dasish.eu/permissions/PermissionsListID20130816170015"/>
+</annotation>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0005-POST.xml
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0005-POST.xml	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0005-POST.xml	(revision 5703)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<annotation xmlns="http://www.dasish.eu/ns/addit"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xhtml="http://www.w3.org/1999/xhtml"
+    xsi:schemaLocation="http://www.dasish.eu/ns/addit http://dasish.eu/DASISH-schema.xsd"
+    URI="tempAID20130816170015"
+    timeStamp="2013-08-16T14:12:03.000Z">
+    <owner ref="http://dasish.eu/users/UIxyz/how_will_this_be_sent_from_the_client"/>
+    <headline>Construction - Sagrada FamÃ­lia - Wikipedia, the free encyclopedia</headline>
+    <body type="Note" ref="tmp20130816170015">
+        <xhtml:span style="background-color:rgb(0,0,153);color:rgb(255,255,255);border: thick solid rgb(0, 0, 153);">The construction of the basilica takes time.</xhtml:span>
+    </body>
+    <targetSources>
+        <target>
+            <newSource xml:id="tmp20130816170015">
+                <link>http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#xpointer(start-point(string-range(//span[@id="Construction"]/text()[1],'',0))/range-to(string-range(//span[@id="Construction"]/text()[1],'',12)))</link>
+                <version>2013-08-16T14:12:03.000Z</version>
+            </newSource>
+        </target>
+    </targetSources>
+    <permissions ref="tmpPermissionsListID20130816170015"/>
+</annotation>
+
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0006-GET.xml
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0006-GET.xml	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0006-GET.xml	(revision 5703)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<annotation xmlns="http://www.dasish.eu/ns/addit"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xhtml="http://www.w3.org/1999/xhtml"
+    xsi:schemaLocation="http://www.dasish.eu/ns/addit http://dasish.eu/DASISH-schema.xsd"
+    URI="http://dasish.eu/annotations/AID20130920110032"
+    timeStamp="2013-09-20T09:00:22.000Z">
+    <owner ref="http://dasish.eu/users/UID0005"/>
+    <headline>Svensk nationell datatjÃ€nst | Svensk Nationell DatatjÃ€nst</headline>
+    <body type="Note">
+        <xhtml:span style="border:thin dotted rgb(255,204,0);background-color:rgb(255,255,204);color:rgb(0,0,0);">SND is a service organization</xhtml:span>
+    </body>
+    <targetSources>
+        <target>
+            <source xml:id="http://dasish.eu/sources/SID20130920110032">
+                <link>http://snd.gu.se/#xpointer(start-point(string-range(//div[@id="node-170"]/div[1]/div[1]/div[1]/div[1]/p[1]/text()[1],'',34))/range-to(string-range(//div[@id="node-170"]/div[1]/div[1]/div[1]/div[1]/p[1]/text()[1],'',54)))</link>
+                <version>2013-09-20T09:00:22.000Z</version>
+            </source>
+        </target>
+    </targetSources>
+    <permissions ref="http://dasish.eu/permissions/PermissionsListID20130920110032"/>
+</annotation>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0006-POST.xml
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0006-POST.xml	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annot-0006-POST.xml	(revision 5703)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<annotation xmlns="http://www.dasish.eu/ns/addit"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xhtml="http://www.w3.org/1999/xhtml"
+    xsi:schemaLocation="http://www.dasish.eu/ns/addit http://dasish.eu/DASISH-schema.xsd"
+    URI="tempAID20130920110032"
+    timeStamp="2013-09-20T09:00:22.000Z">
+    <owner ref="http://dasish.eu/users/UIxyz/how_will_this_be_sent_from_the_client"/>
+    <headline>Svensk nationell datatjÃ€nst | Svensk Nationell DatatjÃ€nst</headline>
+    <body type="Note" ref="tmp20130920110032">
+        <xhtml:span style="border:thin dotted rgb(255,204,0);background-color:rgb(255,255,204);color:rgb(0,0,0);">serviceorganisation </xhtml:span>
+    </body>
+    <targetSources>
+        <target>
+            <newSource xml:id="tmp20130920110032">
+                <link>http://snd.gu.se/#xpointer(start-point(string-range(//div[@id="node-170"]/div[1]/div[1]/div[1]/div[1]/p[1]/text()[1],'',34))/range-to(string-range(//div[@id="node-170"]/div[1]/div[1]/div[1]/div[1]/p[1]/text()[1],'',54)))</link>
+                <version>2013-09-20T09:00:22.000Z</version>
+            </newSource>
+        </target>
+    </targetSources>
+    <permissions ref="tmpPermissionsListID20130920110032"/>
+</annotation>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annotations-sagrada-GET.xml
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annotations-sagrada-GET.xml	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annotations-sagrada-GET.xml	(revision 5703)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- list of annotation-infos -->
+<annotations xmlns="http://www.dasish.eu/ns/addit"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.dasish.eu/ns/addit http://dasish.eu/DASISH-schema.xsd">
+    <annotation ref="http://dasish.eu/annotations/AID20130808114716">
+        <owner ref="http://dasish.eu/users/UID0001"/>
+        <headline>Background - Sagrada FamÃ­lia - Wikipedia, the free encyclopedia</headline>
+        <targetSources>
+            <targetSource ref="http://dasish.eu/sources/SID20130808114716"/>
+        </targetSources>
+    </annotation>
+    <annotation ref="http://dasish.eu/annotations/AID20130808124131">
+        <owner ref="http://dasish.eu/users/UID0002"/>
+        <headline>AVE tunnel - Sagrada FamÃ­lia - Wikipedia, the free encyclopedia</headline>
+        <targetSources>
+            <targetSource ref="http://dasish.eu/sources/SID20130808124131"/>
+        </targetSources>
+    </annotation>
+    <annotation ref="http://dasish.eu/annotations/AID20130809151651">
+        <owner ref="http://dasish.eu/users/UID0003"/>
+        <headline>Fire - Sagrada FamÃ­lia - Wikipedia, the free encyclopedia</headline>
+        <targetSources>
+            <targetSource ref="http://dasish.eu/sources/SID20130809151651"/>
+        </targetSources>
+    </annotation>
+    <annotation ref="http://dasish.eu/annotations/AID20130816145322">
+        <owner ref="http://dasish.eu/users/UID0004"/>
+        <headline>Spires - Sagrada FamÃ­lia - Wikipedia, the free encyclopedia</headline>
+        <targetSources>
+            <targetSource ref="http://dasish.eu/sources/SID20130816145322"/>
+        </targetSources>
+    </annotation>
+    <annotation ref="http://dasish.eu/annotations/AID20130816170015">
+        <owner ref="http://dasish.eu/users/UID0005"/>
+        <headline>Construction - Sagrada FamÃ­lia - Wikipedia, the free encyclopedia</headline>
+        <targetSources>
+            <targetSource ref="http://dasish.eu/sources/SID20130816170015"/>
+        </targetSources>
+    </annotation>
+</annotations>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annotations-snd-GET.xml
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annotations-snd-GET.xml	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annotations-snd-GET.xml	(revision 5703)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- list of annotation-infos -->
+<annotations xmlns="http://www.dasish.eu/ns/addit"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.dasish.eu/ns/addit http://dasish.eu/DASISH-schema.xsd">
+    <annotation ref="http://dasish.eu/annotations/AID20130920110032">
+        <owner ref="http://dasish.eu/users/UID0005"/>
+        <headline>Svensk nationell datatjÃ€nst | Svensk Nationell DatatjÃ€nst</headline>
+        <targetSources>
+            <targetSource ref="http://dasish.eu/sources/SID20130920110032"/>
+        </targetSources>
+    </annotation>
+</annotations>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/proxy.php
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/proxy.php	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/proxy.php	(revision 5703)
@@ -0,0 +1,25 @@
+<?php
+  //simple local proxy script for testing remote-service
+  $params = '';
+
+  foreach($_GET as $key=>$value){
+    if($key != 'url'){
+      $params .= $key.'='.$value.'&';
+    }
+  }
+  
+  if($_REQUEST['log']){
+      file_put_contents('log.txt', date("c")."\t".$_REQUEST['message']."\n",  FILE_APPEND);
+  }
+  
+  if($_GET['store']){
+      $postdata = file_get_contents("php://input");
+      file_put_contents('log.txt', date("c")."\tstore in: ".date('Y-m-d_H.i.s').".xml\n",  FILE_APPEND);
+      file_put_contents(date('Y-m-d_H.i.s').'.xml', $postdata);
+  }
+
+  $response = file_get_contents($_GET['url'].'?'.$params);
+
+  header( 'Content-type: text/xml');
+  print $response;
+?>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/test-render-annotations.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/test-render-annotations.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/test-render-annotations.js	(revision 5703)
@@ -0,0 +1,36 @@
+/*Holds test-renders for listing results from backend
+ * 
+ * 
+ */
+
+function listAnnotations(annotations){
+    $.each(annotations, function(i, annotation){
+        annotation.om_object = annotation2om_object(annotation);
+        
+        var output = '';
+        $.each( annotation, function( key, value ) {
+            if(key === 'om_object'){
+                output += '<strong>om_object</strong><br/>';
+                output += '<table>';
+                
+                $.each( value, function( k, v ) {
+                    if(k === 'oid_property'){
+                        output += '<tr><td>'+k+'</td><td><textarea cols="70" rows="4">'+v+'</textarea></td></tr>';
+                    }else{
+                        output += '<tr><td>'+k+'</td><td>'+v+'</td></tr>';
+                    }
+                });
+                output += '</table>';
+            }else{
+                output += '<span>'+key+': '+value+'</span><br/>';
+            }
+        });
+        
+        $("#annotations").append(
+                '<li>'+
+                    '<strong>'+annotation.body.text+'</strong><br/>'+
+                    output+
+                '</li>'
+        );
+    });
+}
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/test-service.html
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/test-service.html	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/annotator-service/test/test-service.html	(revision 5703)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="../lib/jquery-1.9.1.js"></script>
+	<script src="../lib/jquery.xml2json.js"></script>
+        <script src="../annotation-service.js"></script>
+	<script src="../../hyperanchor.js"></script>
+        <script src="test-render-annotations.js"></script>
+        <script src="../conversion.utils.js"></script>
+    </head>
+    <body>
+        <div style="float:left;width:40%;">
+            <ul id="annotations"></ul>
+        </div>
+        <div style="float:left;width:40%;">
+            <p>
+                An example text about Douglas Adams; a writer and a cool dude.
+            </p>
+        </div>
+
+        <script>
+            // Enable Universal Browser Read
+          
+            //use remote backend via local proxy
+            var proxyURL = "http://localhost/annotations/annotator-service/test/proxy.php?url="+encodeURIComponent('http://pelle.ssd.gu.se:8080/exist/rest/db/annotation-framework/api/annotations.xql');
+            annotationFramework.setBackend(proxyURL);
+            
+            //get a specofic annotation
+            annotationFramework.getAnnotations({aid:'AID011'}, listAnnotations);
+        </script>
+    </body>
+</html>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/articlenavigation.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/articlenavigation.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/articlenavigation.js	(revision 5703)
@@ -0,0 +1,748 @@
+var bitsArticleNavigation = {
+/////////////////////////////////////////////////////////////////////
+	_init   : false,
+	_timer  : null,
+	_zoomtimer  : null,
+	_select : false,
+	_height : 0,
+	_moveovertimer  : null,
+	_contentDocument : null,
+
+	_textZoom : 0,
+
+	_no_dbtype : "articleip",
+
+	prefObserver : {
+		domain  : 'wiredmarker',
+			//"wiredmarker.xxx"ãšããååã®èš­å®ãå€æŽãããå Žåå
+šãŠã§åŠçãè¡ã
+			observe : function(aSubject, aTopic, aPrefstring) {
+				if (aTopic == 'nsPref:changed') {
+					switch (aPrefstring){
+						case "wiredmarker.last_update":
+//							var inittime = bitsObjectMng.DataSource.inittime;
+//							var value = nsPreferences.copyUnicharPref(aPrefstring);
+//							var arr = value.split("\t");
+//							if(inittime == arr[2]) return;
+							if(!bitsArticleNavigation) return;
+							if(!bitsArticleNavigation.disp) return;
+
+							var value = nsPreferences.copyUnicharPref(aPrefstring,"");
+							var arr = value.split("\t");
+//							bitsArticleNavigation._dump(arr[3]+"\t"+arr[4]);
+							if(arr[3] == "INSERT" && arr[4] == "FOLDER") return;
+
+							if(bitsArticleNavigation._timer) clearTimeout(bitsArticleNavigation._timer);
+							bitsArticleNavigation._timer = setTimeout(function(){ bitsArticleNavigation.drawConcordance(); },100);
+							break;
+
+						case "wiredmarker.concordance":
+							var mode = nsPreferences.copyUnicharPref("wiredmarker.concordance","");
+							var checked = document.getElementById("viewMarkingCollection").getAttribute("checked");
+							bitsArticleNavigation.done();
+							bitsArticleNavigation.init();
+							if(mode == "" && checked == "true"){
+								bitsArticleNavigation._sidebarshow();
+							}
+							break;
+
+						default:
+							break;
+					}
+				}
+			}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	get STRING()     { return document.getElementById("ArticleNavigationOverlayString"); },
+	get DataSource() { return bitsObjectMng.DataSource; },
+	get Common()     { return bitsObjectMng.Common;     },
+	get XPath()      { return bitsObjectMng.XPath;      },
+	get Database()   { return bitsObjectMng.Database;   },
+	get gBrowser()   { return bitsObjectMng.getBrowser();},
+
+	get SIDEBAR()              { return document.getElementById("sidebar"); },
+	get CONCORDANCE()          { return document.getElementById("ArticleNavigationConcordance"); },
+	get CONCORDANCE_Splitter() { return document.getElementById("ArticleNavigationConcordanceSplitter"); },
+
+	get CONCORDANCE_AREAT()    { return document.getElementById("ArticleNavigationConcordanceArea"); },
+	get CONCORDANCE_BASELINE() { return document.getElementById("ArticleNavigationConcordanceBaseLine");},
+	get CONCORDANCE_SENTENCE() { return document.getElementById("ArticleNavigationConcordanceItemSentence");},
+	get CONCORDANCE_MAPPING()  { return document.getElementById("ArticleNavigationConcordanceItemMapping");},
+	get CONCORDANCE_SECTION()  { return document.getElementById("ArticleNavigationConcordanceItemSection"); },
+
+	get ZoomReduce()  { return (top.document.getElementById("cmd_textZoomReduce")?top.document.getElementById("cmd_textZoomReduce"):top.document.getElementById("cmd_fullZoomReduce")); },
+	get ZoomEnlarge() { return (top.document.getElementById("cmd_textZoomEnlarge")?top.document.getElementById("cmd_textZoomEnlarge"):top.document.getElementById("cmd_fullZoomEnlarge")); },
+	get ZoomReset()   { return (top.document.getElementById("cmd_textZoomReset")?top.document.getElementById("cmd_textZoomReset"):top.document.getElementById("cmd_fullZoomReset")); },
+
+	get MarkingCollectionWindowID() { return "MarkingCollectionWindow"; },
+	get ArticleIPWindowID()         { return "ArticleIPWindow"; },
+
+	get disp() { return (this.CONCORDANCE.getAttribute("hidden")=="true"?false:true); },
+
+/////////////////////////////////////////////////////////////////////
+	init : function(aEvent){
+		if(bitsArticleNavigation._init) return;
+		try{
+			if(!bitsObjectMng){
+				setTimeout(function(){bitsArticleNavigation.init(aEvent)},1000);
+				return;
+			}
+		}catch(ex){
+			setTimeout(function(){bitsArticleNavigation.init(aEvent)},1000);
+			return;
+		}
+		try{
+			this.Common.addPrefListener(this.prefObserver);
+
+			bitsArticleNavigation._textZoom = bitsArticleNavigation.gBrowser.markupDocumentViewer.textZoom;
+
+			var mode = nsPreferences.copyUnicharPref("wiredmarker.concordance","");
+			if(mode == ""){
+				bitsArticleNavigation.SIDEBAR.addEventListener("pageshow", bitsArticleNavigation.sidebarshow, false);
+				bitsArticleNavigation.SIDEBAR.addEventListener("pagehide", bitsArticleNavigation.sidebarhide, false);
+			}else if(mode == "display"){
+				bitsArticleNavigation._sidebarshow();
+			}
+
+			bitsArticleNavigation._init = true;
+
+		}catch(ex){
+			this.Common.alert("bitsArticleNavigation.init():"+ex);
+			bitsArticleNavigation._init = false;
+		}
+
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(event){
+		if(bitsArticleNavigation._init){
+			bitsArticleNavigation._sidebarhide();
+
+			bitsArticleNavigation.SIDEBAR.removeEventListener("pageshow", bitsArticleNavigation.sidebarshow, false);
+			bitsArticleNavigation.SIDEBAR.removeEventListener("pagehide", bitsArticleNavigation.sidebarhide, false);
+
+			bitsArticleNavigation.Common.removePrefListener(bitsArticleNavigation.prefObserver);
+		}
+		bitsArticleNavigation._init = false;
+
+		if(bitsArticleNavigation._timer) clearTimeout(bitsArticleNavigation._timer);
+		bitsArticleNavigation._timer = null;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	startObserver : function(){
+		try{
+			this.Common.addPrefListener(this.prefObserver);
+			if(!this.disp) return;
+			if(this._timer) clearTimeout(bitsArticleNavigation._timer);
+			var self = this;
+			this._timer = setTimeout(function(){ self.drawConcordance(); },100);
+		}catch(e){}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	stopObserver : function(){
+		try{
+			this.Common.removePrefListener(this.prefObserver);
+		}catch(e){}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	zoom : function(aEvent){
+		if(bitsArticleNavigation._zoomtimer) clearTimeout(bitsArticleNavigation._zoomtimer);
+		bitsArticleNavigation._zoomtimer = setTimeout(bitsArticleNavigation.zoomConcordance,0);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	zoomConcordance : function(){
+		if(bitsArticleNavigation._zoomtimer) clearTimeout(bitsArticleNavigation._zoomtimer);
+		bitsArticleNavigation._zoomtimer = null;
+		if(bitsArticleNavigation._textZoom != bitsArticleNavigation.gBrowser.markupDocumentViewer.textZoom) bitsArticleNavigation.redrawConcordance();
+		bitsArticleNavigation.scrollConcordance(bitsArticleNavigation.gBrowser.contentDocument);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	sidebarshow : function(event){
+		if(!event.target.documentElement) return;
+		if(
+			event.target.documentElement.id != bitsArticleNavigation.MarkingCollectionWindowID &&
+			event.target.documentElement.id != bitsArticleNavigation.ArticleIPWindowID
+		) return;
+		bitsArticleNavigation._sidebarshow();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_sidebarshow : function(event){
+
+		if(this._timer) clearTimeout(this._timer);
+		this._timer = setTimeout(bitsArticleNavigation.drawConcordance,0);
+
+		this.CONCORDANCE.removeAttribute("hidden");
+
+		this.gBrowser.addEventListener("pageshow", this.pageshow, false);
+		this.gBrowser.addEventListener("select", this.pageselect, false);
+		this.gBrowser.addEventListener("resize", this.resizeListener, false);
+
+		this.CONCORDANCE.addEventListener("click", this.clickConcordance, false);
+
+
+
+		this.ZoomReduce.addEventListener("command", bitsArticleNavigation.zoom, false);
+		this.ZoomEnlarge.addEventListener("command", bitsArticleNavigation.zoom, false);
+		this.ZoomReset.addEventListener("command", bitsArticleNavigation.zoom, false);
+
+		this.pageshow(this.gBrowser.contentDocument);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	sidebarhide : function(event){
+		if(!event.target.documentElement) return;
+		if(
+			event.target.documentElement.id != bitsArticleNavigation.MarkingCollectionWindowID &&
+			event.target.documentElement.id != bitsArticleNavigation.ArticleIPWindowID
+		) return;
+		bitsArticleNavigation._sidebarhide();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_sidebarhide : function(){
+		this.hideConcordanceAll();
+
+		this.gBrowser.removeEventListener("pageshow", this.pageshow, false);
+		this.gBrowser.removeEventListener("select", this.pageselect, false);
+		this.gBrowser.removeEventListener("resize", this.resizeListener, false);
+
+		this.CONCORDANCE.removeEventListener("click", this.clickConcordance, false);
+
+		this.ZoomReduce.removeEventListener("command", this.zoom, false);
+		this.ZoomEnlarge.removeEventListener("command", this.zoom, false);
+		this.ZoomReset.removeEventListener("command", this.zoom, false);
+
+		this.CONCORDANCE.setAttribute("hidden",true);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	pageshow : function(event){
+		if(bitsArticleNavigation._timer) clearTimeout(bitsArticleNavigation._timer);
+		bitsArticleNavigation._timer = setTimeout(bitsArticleNavigation.drawConcordance,0);
+
+		bitsArticleNavigation._contentDocument = bitsArticleNavigation.gBrowser.contentDocument;
+		var doc = bitsArticleNavigation._contentDocument;
+
+		if(doc.defaultView.frames && doc.defaultView.frames.length>0){
+			for(var wincnt=0;wincnt<doc.defaultView.frames.length;wincnt++){
+				if(!doc.defaultView.frames[wincnt].document.documentElement) continue;
+				doc.defaultView.frames[wincnt].document.addEventListener("scroll", bitsArticleNavigation.scrollListener, false);
+				doc.defaultView.frames[wincnt].document.addEventListener("mouseover", bitsArticleNavigation.mouseoverListener, false);
+			}
+		}
+		if(doc.documentElement){
+			doc.addEventListener("scroll", bitsArticleNavigation.scrollListener, false);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	pageselect : function(event){
+		if(!bitsArticleNavigation._select){
+			bitsArticleNavigation._select = true;
+			return;
+		}
+		bitsArticleNavigation._select = false;
+
+		bitsArticleNavigation._contentDocument = bitsArticleNavigation.gBrowser.contentDocument;
+
+		if(bitsArticleNavigation._timer) clearTimeout(bitsArticleNavigation._timer);
+		bitsArticleNavigation._timer = setTimeout(bitsArticleNavigation.drawConcordance,0);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getElemOffsetHeight : function(elem,height){
+		if(!elem) return 0;
+		if(!height) height = 0;
+		if(height < elem.offsetHeight) height = elem.offsetHeight;
+		for(var i=0;i<elem.childNodes.length;i++){
+			var c_elem = elem.childNodes[i];
+			if(c_elem.firstChild){
+				height = bitsArticleNavigation.getElemOffsetHeight(c_elem,height);
+			}else{
+				if(height < c_elem.offsetHeight) height = c_elem.offsetHeight;
+			}
+		}
+		return height;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getElementById : function(pElemId){
+		try {
+			if(!pElemId || pElemId=="") return null;
+
+			var DOC = [];
+			if(this.gBrowser.contentWindow.frames){
+				for(var wincnt=0;wincnt<this.gBrowser.contentWindow.frames.length;wincnt++){
+					DOC.push(this.gBrowser.contentWindow.frames[wincnt].document);
+				}
+			}
+			DOC.push(this.gBrowser.contentDocument);
+			var elem = null;
+			for(var i=0;i<DOC.length;i++){
+				var doc = DOC[i];
+				elem = doc.getElementById(pElemId);
+				if(elem) break;
+			}
+			return elem;
+		}catch(ex){
+			this._dump("getElementById():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	drawConcordanceFromID : function(aID,aStyle){
+		var elem_id = aID;
+		var elem = bitsArticleNavigation.getElementById(elem_id);
+		if(!elem) return;
+		if(!elem.ownerDocument.documentElement.offsetWidth) return;
+
+		var xPathResult = bitsArticleNavigation.XPath.evaluate('//*[@id="'+elem_id+'"]', elem.ownerDocument);
+
+		var elemOffset = bitsArticleNavigation.getPageOffset(elem);
+		if(!elemOffset) return;
+
+		var elemMinOffset = elemOffset;
+		var elemMinHeight = bitsArticleNavigation.getElemOffsetHeight(elem) + elemMinOffset.top;
+
+		var elemMaxOffset = elemOffset;
+		var elemMaxHeight = elemMinHeight;
+
+
+		for(var j=0;j<xPathResult.snapshotLength;j++){
+			var node = xPathResult.snapshotItem(j);
+			var offset = bitsArticleNavigation.getPageOffset(node);
+			var height = bitsArticleNavigation.getElemOffsetHeight(node);
+			if(offset.top+height>elemMaxHeight){
+				elemMaxOffset = offset;
+				elemMaxHeight = height+offset.top;
+			}
+			if(offset.top+height<elemMinHeight){
+				elemMinOffset = offset;
+				elemMinHeight = height+offset.top;
+			}
+		}
+
+		var ConcordanceItemMapping = bitsArticleNavigation.CONCORDANCE_MAPPING;
+		var ConcordanceBaseLine = bitsArticleNavigation.CONCORDANCE_BASELINE;
+
+		var ConcordanceItemMappingClone = ConcordanceBaseLine.ownerDocument.getElementById(elem_id);
+		if(!ConcordanceItemMappingClone){
+			ConcordanceItemMappingClone = ConcordanceItemMapping.cloneNode(true);
+			if(!ConcordanceItemMappingClone) return;
+			ConcordanceBaseLine.appendChild(ConcordanceItemMappingClone);
+			ConcordanceItemMappingClone.id = elem_id;
+		}
+
+		var lastElemOffset = {width:elem.ownerDocument.documentElement.offsetWidth,height:elem.ownerDocument.documentElement.offsetHeight};
+		if(elem.ownerDocument.body){
+			if(elem.ownerDocument.body.offsetWidth > lastElemOffset.width)   lastElemOffset.width  = elem.ownerDocument.body.offsetWidth;
+			if(elem.ownerDocument.body.offsetHeight > lastElemOffset.height) lastElemOffset.height = elem.ownerDocument.body.offsetHeight;
+		}
+		var itemHeightRate = ConcordanceBaseLine.offsetHeight/lastElemOffset.height;
+
+		if(aStyle){
+			ConcordanceItemMappingClone.setAttribute("style",aStyle);
+			if(ConcordanceItemMappingClone.style.borderBottom){
+				ConcordanceItemMappingClone.style.border = ConcordanceItemMappingClone.style.borderBottom;
+				ConcordanceItemMappingClone.style.borderWidth = 'thin';
+			}else if(!ConcordanceItemMappingClone.style.backgroundColor && ConcordanceItemMappingClone.style.color){
+				ConcordanceItemMappingClone.style.border = 'thin solid '+ ConcordanceItemMappingClone.style.color;
+			}else if(ConcordanceItemMappingClone.style.backgroundColor){
+				ConcordanceItemMappingClone.style.border = 'thin solid '+ ConcordanceItemMappingClone.style.backgroundColor;
+			}
+		}else{
+			ConcordanceItemMappingClone.style.border = 'thin solid #000';
+		}
+
+		ConcordanceItemMappingClone.style.position = 'absolute';
+		ConcordanceItemMappingClone.style.left = '0px';
+		ConcordanceItemMappingClone.style.width = (ConcordanceBaseLine.offsetWidth-4) +'px';
+		ConcordanceItemMappingClone.style.display = '';
+
+		var rtnHeight = Math.round((elemMaxHeight-elemMinOffset.top)*itemHeightRate)-2;
+		if(rtnHeight<0) rtnHeight = 0;
+		var rtnTop =Math.round(elemMinOffset.top*itemHeightRate);
+		if(rtnTop<0) rtnTop = 0;
+
+		ConcordanceItemMappingClone.style.top =rtnTop + 'px';
+		ConcordanceItemMappingClone.style.height = rtnHeight + 'px';
+	},
+
+/////////////////////////////////////////////////////////////////////
+	drawConcordanceFromObject : function(aObject,aStyle){
+		if(!aObject) return;
+
+		var elem_id = aObject.oid;
+
+		var DOC = [];
+		if(this.gBrowser.contentWindow.frames){
+			for(var wincnt=0;wincnt<this.gBrowser.contentWindow.frames.length;wincnt++){
+				DOC.push(this.gBrowser.contentWindow.frames[wincnt].document);
+			}
+		}
+		DOC.push(this.gBrowser.contentDocument);
+
+		var doc = null;
+		var i;
+		for(i=0;i<DOC.length;i++){
+//			if(aObject.con_url == this.Common.getURLStringFromDocument(DOC[i])){
+			if(aObject.con_url == bitsAutocacheService.convertCacheURLToOriginalURL(this.Common.getURLStringFromDocument(DOC[i]))){
+				doc = DOC[i];
+				break;
+			}
+		}
+
+		if(!doc) return;
+
+		var aXPath = {};
+		aObject.bgn_dom.match(/(.+)\(([0-9]+)\)\(([0-9]+)\)/);
+		aXPath.startPath   = RegExp.$1;
+		aXPath.startOffset = RegExp.$2;
+		aXPath.startType   = RegExp.$3;
+
+		aObject.end_dom.match(/(.+)\(([0-9]+)\)\(([0-9]+)\)/);
+		aXPath.endPath   = RegExp.$1;
+		aXPath.endOffset = RegExp.$2;
+		aXPath.endType   = RegExp.$3;
+
+		var elem = null;
+		if(aObject.bgn_dom != aObject.end_dom){
+
+			var startNode = this.XPath.getCurrentNodeFromXPath(doc,aXPath.startPath,aXPath.startOffset,aXPath.startType);
+			if(!startNode || !startNode.node) return;
+			var endNode = this.XPath.getCurrentNodeFromXPath(doc,aXPath.endPath,aXPath.endOffset,aXPath.endType);
+			if(!endNode || !endNode.node) return;
+
+			var range = doc.createRange();
+			try{
+				range.setStart(startNode.node, startNode.offset);
+				range.setEnd(endNode.node, endNode.offset);
+			}catch(ex2){
+				this._dump("bitsArticleNavigation.drawConcordanceFromObject():"+ex2);
+				return false;
+			}
+
+
+			var nodeWalker = doc.createTreeWalker(range.commonAncestorContainer,NodeFilter.SHOW_ELEMENT,null,false);
+			if(nodeWalker){
+				var txtNode=nodeWalker.nextNode();
+				for(;txtNode;txtNode = nodeWalker.nextNode()){
+
+					if(range.compareNode(txtNode) == range.NODE_BEFORE) continue;
+					if(range.compareNode(txtNode) == range.NODE_AFTER) break;
+
+
+					if(txtNode.nodeName != "IMG") continue;
+					if(txtNode.src != aObject.oid_txt) continue;
+					elem = txtNode;
+					break;
+				}
+			}
+		}else{
+			var startNode = this.XPath.getCurrentNodeFromXPath(doc,aXPath.startPath,aXPath.startOffset,aXPath.startType);
+			if(!startNode || !startNode.node) return;
+			elem = startNode.node;
+		}
+
+
+
+
+
+
+		var elemOffset = bitsArticleNavigation.getPageOffset(elem);
+		if(!elemOffset) return;
+
+		var elemMinOffset = elemOffset;
+		var elemMinHeight = bitsArticleNavigation.getElemOffsetHeight(elem) + elemMinOffset.top;
+
+		var elemMaxOffset = elemOffset;
+		var elemMaxHeight = elemMinHeight;
+
+		var ConcordanceItemMapping = bitsArticleNavigation.CONCORDANCE_MAPPING;
+		var ConcordanceBaseLine = bitsArticleNavigation.CONCORDANCE_BASELINE;
+
+		var ConcordanceItemMappingClone = ConcordanceBaseLine.ownerDocument.getElementById(elem_id);
+		if(!ConcordanceItemMappingClone){
+			ConcordanceItemMappingClone = ConcordanceItemMapping.cloneNode(true);
+			if(!ConcordanceItemMappingClone) return;
+			ConcordanceBaseLine.appendChild(ConcordanceItemMappingClone);
+			ConcordanceItemMappingClone.id = elem_id;
+		}
+
+		var lastElemOffset = {width:elem.ownerDocument.documentElement.offsetWidth,height:elem.ownerDocument.documentElement.offsetHeight};
+		var itemHeightRate = ConcordanceBaseLine.offsetHeight/lastElemOffset.height;
+
+
+		if(aStyle){
+			ConcordanceItemMappingClone.setAttribute("style",aStyle);
+			if(ConcordanceItemMappingClone.style.borderBottom){
+				ConcordanceItemMappingClone.style.border = ConcordanceItemMappingClone.style.borderBottom;
+				ConcordanceItemMappingClone.style.borderWidth = 'thin';
+			}else if(!ConcordanceItemMappingClone.style.backgroundColor && ConcordanceItemMappingClone.style.color){
+				ConcordanceItemMappingClone.style.border = 'thin solid '+ ConcordanceItemMappingClone.style.color;
+			}else if(ConcordanceItemMappingClone.style.backgroundColor){
+				ConcordanceItemMappingClone.style.border = 'thin solid '+ ConcordanceItemMappingClone.style.backgroundColor;
+			}
+		}else{
+			ConcordanceItemMappingClone.style.border = 'thin solid #000';
+		}
+
+		ConcordanceItemMappingClone.style.position = 'absolute';
+		ConcordanceItemMappingClone.style.left = '0px';
+		ConcordanceItemMappingClone.style.width = (ConcordanceBaseLine.offsetWidth-4) +'px';
+		ConcordanceItemMappingClone.style.display = '';
+
+		var rtnHeight = Math.round((elemMaxHeight-elemMinOffset.top)*itemHeightRate)-2;
+		if(rtnHeight<0) rtnHeight = 0;
+		var rtnTop =Math.round(elemMinOffset.top*itemHeightRate);
+		if(rtnTop<0) rtnTop = 0;
+
+		ConcordanceItemMappingClone.style.top =rtnTop + 'px';
+		ConcordanceItemMappingClone.style.height = rtnHeight + 'px';
+	},
+
+/////////////////////////////////////////////////////////////////////
+	drawConcordance : function(){
+		try{
+			var self = bitsArticleNavigation;
+//self._dump("bitsArticleNavigation.drawConcordance()");
+			self.hideConcordanceAll();
+			var urlString = self.Common.getURLStringFromDocument(self.gBrowser.contentDocument);
+			var rtnObj = self.Database.getAllObjectFormContentURL(bitsAutocacheService.convertCacheURLToOriginalURL(urlString));
+			if(rtnObj){
+				self._timer = setTimeout(function(){ self._drawConcordance(rtnObj); },0);
+			}else{
+				self.scrollConcordance(self.gBrowser.contentDocument);
+				self._textZoom = self.gBrowser.markupDocumentViewer.textZoom;
+			}
+		}catch(e){
+			self._dump("bitsArticleNavigation.drawConcordance():"+e);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_drawConcordance : function(aObjs){
+//this._dump("bitsArticleNavigation._drawConcordance():aObjs=["+ (aObjs?aObjs.length:0) + "]");
+		try{
+			var i;
+			for(i=0;i<10 && aObjs.length>0;i++){
+				var obj = aObjs.shift();
+				if(obj.oid_type.match(/^image.+$/im)){
+					this.drawConcordanceFromObject(obj,obj.fid_style);
+				}else{
+					var elem_id = bitsMarker.id_key+obj.dbtype+obj.oid;
+					this.drawConcordanceFromID(elem_id,obj.fid_style);
+				}
+			}
+			if(aObjs.length == 0){
+				this.scrollConcordance(this.gBrowser.contentDocument);
+				this._textZoom = this.gBrowser.markupDocumentViewer.textZoom;
+				return;
+			}
+			var self = this;
+			this._timer = setTimeout(function(){ self._drawConcordance(aObjs); },500);
+		}catch(e){
+			this._dump("bitsArticleNavigation._drawConcordance():"+e);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	hideConcordanceAll : function(){
+		var conChild = this.CONCORDANCE_BASELINE.lastChild;
+		var previousSibling = null;
+		while(conChild){
+			previousSibling = conChild.previousSibling;
+			this.CONCORDANCE_BASELINE.removeChild(conChild);
+			conChild = previousSibling;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getPageOffset : function(aElem){
+		try {
+			if(!aElem) return null;
+			var elem = aElem;
+			var top = elem.offsetTop;
+			var left = elem.offsetLeft;
+			while(elem.offsetParent != null){
+				if(elem.parentNode && elem.parentNode.offsetHeight != elem.parentNode.scrollHeight){
+					elem = elem.parentNode;
+					top = elem.offsetTop;
+					left = elem.offsetLeft;
+				}
+				if(!elem || !elem.offsetParent) break;
+				elem = elem.offsetParent;
+				top += elem.offsetTop;
+				left += elem.offsetLeft;
+			}
+			return {left:left,top:top};
+		} catch( e ){
+			bitsArticleNavigation._dump("bitsArticleNavigation.getPageOffset():["+e+"]");
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	clickConcordance : function(aEvent){
+		try {
+			if(!bitsArticleNavigation._contentDocument) return;
+			var curDocument = bitsArticleNavigation._contentDocument;
+			var ConcordanceBaseLine = bitsArticleNavigation.CONCORDANCE_BASELINE;
+			var pageOffset = bitsArticleNavigation.getPageOffset(ConcordanceBaseLine);
+			var frame = bitsArticleNavigation._contentDocument.defaultView;;
+			if(!frame) return;
+			if(bitsArticleNavigation._textZoom != bitsArticleNavigation.gBrowser.markupDocumentViewer.textZoom) bitsArticleNavigation.redrawConcordance();
+
+			var y_offs = aEvent.pageY-pageOffset.top;
+			if(bitsArticleNavigation._height>0) y_offs -= Math.round(bitsArticleNavigation._height/2);
+			var offsetHeight = curDocument.documentElement.offsetHeight;
+			if(curDocument.body && offsetHeight < curDocument.body.offsetHeight) offsetHeight = curDocument.body.offsetHeight;
+			y_offs = Math.round((y_offs/ConcordanceBaseLine.offsetHeight) * offsetHeight);
+			frame.scroll( frame.pageXOffset, y_offs );
+			bitsArticleNavigation.scrollConcordance(curDocument);
+
+		} catch( e ){
+			bitsArticleNavigation._dump("bitsArticleNavigation.clickConcordance():["+e+"]");
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	scrollListener : function(aEvent){
+		if(bitsArticleNavigation._textZoom != bitsArticleNavigation.gBrowser.markupDocumentViewer.textZoom) bitsArticleNavigation.redrawConcordance();
+		bitsArticleNavigation.scrollConcordance(aEvent.target);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	mouseoverListener : function(aEvent){
+		if(!aEvent.target.ownerDocument) return;
+
+		if(bitsArticleNavigation._contentDocument == aEvent.target.ownerDocument) return;
+		bitsArticleNavigation._contentDocument = aEvent.target.ownerDocument;
+		if(bitsArticleNavigation._textZoom != bitsArticleNavigation.gBrowser.markupDocumentViewer.textZoom) bitsArticleNavigation.redrawConcordance();
+		bitsArticleNavigation.scrollConcordance(aEvent.target.ownerDocument);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	scrollConcordance : function(aDoc){
+		try{
+			if(!aDoc || !aDoc.documentElement) return;
+
+			const cloneElemId = 'ArticleNavigationConcordanceDispPos';
+			const topElemId  = 'ArticleNavigationConcordanceDispPosLeft';
+			const bottomElemId = 'ArticleNavigationConcordanceDispPosRight';
+
+			const scrollHeight = aDoc.documentElement.scrollHeight
+			var scrollTop = aDoc.documentElement.scrollTop;
+			var clientHeight = aDoc.documentElement.clientHeight
+			if(scrollHeight == clientHeight && aDoc.body){
+				if(aDoc.body.scrollTop)    scrollTop    = aDoc.body.scrollTop;
+				if(aDoc.body.clientHeight) clientHeight = aDoc.body.clientHeight;
+			}
+			var concordanceBaseLine = bitsArticleNavigation.CONCORDANCE_BASELINE;
+			var rate = concordanceBaseLine.offsetHeight/scrollHeight;
+
+			var topElem = document.getElementById(topElemId);
+			if(!topElem){
+				topElem = document.getElementById(cloneElemId).cloneNode(true);
+				topElem.setAttribute("id",topElemId);
+				concordanceBaseLine.appendChild(topElem);
+			}
+			var bottomElem = top.document.getElementById(bottomElemId);
+			if(!bottomElem){
+				bottomElem = top.document.getElementById(cloneElemId).cloneNode(true);
+				bottomElem.setAttribute("id",bottomElemId);
+				concordanceBaseLine.appendChild(bottomElem);
+			}
+			topElem.style.display = '';
+			bottomElem.style.display = '';
+
+			topElem.style.left = "0px";
+			topElem.style.top = "0px";
+			topElem.style.height = parseInt(scrollTop*rate) + "px";
+			topElem.style.width = "100%";
+			if(scrollTop == 0) topElem.style.height = "0px";
+
+			bottomElem.style.left = "0px";
+			bottomElem.style.top = parseInt((scrollTop+clientHeight)*rate)+1 + "px";
+			bottomElem.style.height = parseInt((scrollHeight-(scrollTop+clientHeight))*rate)+2 + "px";
+			bottomElem.style.width = "100%";
+
+			bitsArticleNavigation._height = bottomElem.offsetTop - (topElem.offsetTop+topElem.offsetHeight);
+		}catch(e){
+			bitsArticleNavigation._dump("bitsArticleNavigation.scrollConcordance():"+e);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	resizeListener : function (aEvent){
+		bitsArticleNavigation.redrawConcordance();
+		bitsArticleNavigation.scrollConcordance(bitsArticleNavigation.gBrowser.contentDocument);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	redrawConcordance : function (){
+		var self = bitsArticleNavigation;
+		try{
+			var ConcordanceBaseLine = self.CONCORDANCE_BASELINE;
+			if(!ConcordanceBaseLine) return;
+			var conChild = ConcordanceBaseLine.lastChild;
+			if(conChild){
+				if(self._timer) clearTimeout(self._timer);
+				self._timer = setTimeout(function(){ self._redrawConcordance(conChild); },0);
+			}
+			self._textZoom = self.gBrowser.markupDocumentViewer.textZoom;
+		}catch(e){
+			bitsArticleNavigation._dump("bitsArticleNavigation.redrawConcordance():["+e+"]");
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_redrawConcordance : function (aElem){
+		var self = bitsArticleNavigation;
+		try{
+			var i;
+			var conChild = aElem;
+			for(i=0;i<100 && conChild;i++){
+				var elem = self.getElementById(conChild.id);
+				if(!elem){
+					conChild = conChild.previousSibling;
+					continue;
+				}
+				self.drawConcordanceFromID(conChild.id,conChild.style.cssText);
+				conChild = conChild.previousSibling;
+			}
+			if(conChild){
+				self._timer = setTimeout(function(){ self._redrawConcordance(conChild); },500);
+			}else{
+				self._textZoom = self.gBrowser.markupDocumentViewer.textZoom;
+			}
+		}catch(e){
+			bitsArticleNavigation._dump("bitsArticleNavigation._redrawConcordance():["+e+"]");
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/autocache.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/autocache.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/autocache.js	(revision 5703)
@@ -0,0 +1,3581 @@
+var bitsAutocacheObserver = {
+	domain  : 'wiredmarker', //"objectmng.xxx"ãšããååã®èš­å®ãå€æŽãããå Žåå
+šãŠã§åŠçãè¡ã //I do treatment at all if the setting named has changed
+	observe : function(aSubject, aTopic, aPrefstring) {
+		try{
+			if (aTopic == 'nsPref:changed') {
+				switch (aPrefstring){
+					case "wiredmarker.autocache.use":
+						var use = nsPreferences.copyUnicharPref(aPrefstring,"valid");
+						var exec = nsPreferences.getBoolPref("wiredmarker.autocache.manually.exec",false);
+						var btn = bitsAutocacheService.BUTTON;
+						if(btn){
+							if(use == "switching"){
+								btn.removeAttribute("hidden");
+							}else if(use == "valid"){
+								btn.setAttribute("hidden",true);
+							}else{
+								var exec = nsPreferences.getBoolPref("wiredmarker.autocache.manually.exec",false);
+								if(exec){
+									btn.removeAttribute("hidden");
+								}else{
+									btn.setAttribute("hidden",true);
+								}
+							}
+						}
+						var btn = bitsAutocacheService.TOGGLE_BUTTON;
+						if(btn){
+							if(use == "valid" || exec){
+								btn.removeAttribute("hidden");
+								if(bitsAutocacheService._pref.view.disp) btn.setAttribute("checked","true");
+							}else{
+								btn.setAttribute("hidden","true");
+								btn.removeAttribute("checked");
+								bitsAutocacheService._pref.view.disp = false;
+							}
+						}
+						bitsAutocacheService.toggleCacheView();
+						var menu = bitsAutocacheService.CACHEMENU;
+						if(menu){
+							menu.setAttribute("hidden","true");
+							if(use == "valid" || exec) menu.removeAttribute("hidden");
+						}
+						break;
+					case "wiredmarker.autocache.manually.exec":
+						var value = nsPreferences.getBoolPref(aPrefstring,false);
+						var btn = bitsAutocacheService.BUTTON;
+						if(btn){
+							if(value){
+								btn.removeAttribute("hidden");
+							}else{
+								btn.setAttribute("hidden",true);
+							}
+						}
+						var btn = bitsAutocacheService.TOGGLE_BUTTON;
+						if(btn){
+							if(value){
+								btn.removeAttribute("hidden");
+							}else{
+								btn.setAttribute("hidden",true);
+							}
+							if(bitsAutocacheService._pref.view.disp) btn.setAttribute("checked","true");
+						}
+						bitsAutocacheService.toggleCacheView();
+						var menu = bitsAutocacheService.CACHEMENU;
+						if(menu){
+							menu.setAttribute("hidden","true");
+							if(value) menu.removeAttribute("hidden");
+						}
+						break;
+					case "wiredmarker.autocache.topmenu.display":
+						var display = nsPreferences.getBoolPref(aPrefstring, true);
+						var menu = bitsAutocacheService.CACHEMENU;
+						if(menu){
+							if(display){
+								menu.removeAttribute("hidden");
+							}else{
+								menu.setAttribute("hidden","true");
+							}
+						}
+						break;
+					default:
+						break;
+				}
+			}
+		}catch(ex){
+			window.top.bitsObjectMng.Common.alert("bitsAutocacheObserver:"+ex);
+		}
+	}
+};
+
+var bitsAutocacheService = {
+	_refreshFlag : true,
+	_cahceinfo : {},
+	_url2timestamp : {},
+	_disabledTimer : null,
+	_refreshTimer : null,
+	_refreshDTimer : null,
+	_openobject : null,
+	_pref : {},
+	_cacheList : [],
+	_cacheList2URL : {},
+	_dbConn : null,
+	_dbName : "autocache.sqlite",
+	_debuginfo : null,
+	_debug_idlist : null,
+
+	get STRING() { return document.getElementById("MarkingCollectionOverlayString"); },
+	get DataSource() { return window.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.top.bitsObjectMng.Common;     },
+	get Database()   { return window.top.bitsObjectMng.Database;   },
+	get XML()        { return window.top.bitsObjectMng.XML;        },
+	get XPath()      { return window.top.bitsObjectMng.XPath;      },
+	get gBrowser()   { return window.top.bitsObjectMng.getBrowser();},
+	get SIDEBAR() { return window.top.document.getElementById("sidebar"); },
+	get SIDEBAR_DOC() {try{return this.SIDEBAR.contentDocument;}catch(e){return undefined;}},
+	get SIDEBAR_WIN() {try{return this.SIDEBAR.contentWindow;}catch(e){return undefined;}},
+	get mcTreeHandler() {try{return this.SIDEBAR_WIN.mcTreeHandler;}catch(e){return undefined;}},
+	get mcMainService() {try{return this.SIDEBAR_WIN.mcMainService;}catch(e){return undefined;}},
+	get mcController() {try{return this.SIDEBAR_WIN.mcController;}catch(e){return undefined;}},
+	get mcPropertyView() {try{return this.SIDEBAR_WIN.mcPropertyView;}catch(e){return undefined;}},
+	get bitsItemView() {try{return this.SIDEBAR_WIN.bitsItemView;}catch(e){return undefined;}},
+	get mcTreeViewModeService() {try{return this.SIDEBAR_WIN.mcTreeViewModeService;}catch(e){return undefined;}},
+	get BUTTON(){try{return this.SIDEBAR_DOC.getElementById("mcToolbarAutocacheButton");}catch(e){return undefined;}},
+	get OPEN1() {try{return this.SIDEBAR_DOC.getElementById("mcPopupCache");}catch(e){return undefined;}},
+	get OPEN2() {try{return this.SIDEBAR_DOC.getElementById("bitsItemTreePopupCache");}catch(e){return undefined;}},
+	get OPEN3() {try{return this.SIDEBAR_DOC.getElementById("mcPopupObjectCache");}catch(e){return undefined;}},
+	get OPEN_MENUTREE(){return window.top.document.getElementById("bitsMenuTreeObjectContextmenuCache");},
+	get CACHEMENU(){return window.top.document.getElementById("bitsCacheMenu");},
+	get SPLITTER(){try{return this.SIDEBAR_DOC.getElementById("bitsBrowserAutocacheSplitter");}catch(e){return undefined;}},
+	get TOGGLE_BUTTON(){try{return this.SIDEBAR_DOC.getElementById("mcToolbarAutocacheView");}catch(e){return undefined;}},
+	get VBOX(){try{return this.SIDEBAR_DOC.getElementById("bitsBrowserAutocacheVBox");}catch(e){return undefined;}},
+	get TREE(){try{return this.SIDEBAR_DOC.getElementById("bitsAutocacheTree");}catch(e){return undefined;}},
+	get VSB(){try{return this.SIDEBAR_DOC.getElementById("bitsAutocacheSearchButton");}catch(e){return undefined;}},
+	get VSM(){try{return this.SIDEBAR_DOC.getElementById("bitsAutocacheSearchTextbox");}catch(e){return undefined;}},
+	get idTREE_IFAVICON()  { return "bitsAutocacheIFavicon";   },
+	get idTREE_IURL()      { return "bitsAutocacheIUrl";       },
+	get idTREE_ITITLE()    { return "bitsAutocacheITitle";     },
+	get idTREE_IDATE()     { return "bitsAutocacheIDate";      },
+	get idTREE_ICACHE()    { return "bitsAutocacheICache";     },
+	get idTREE_IMARKER()   { return "bitsAutocacheIMarker";    },
+	get idTREE_ICACHESIZE(){ return "bitsAutocacheICacheSize"; },
+	get TREE_IFAVICON()    { try{return this.SIDEBAR_DOC.getElementById(this.idTREE_IFAVICON);}catch(e){return undefined;}  },
+	get TREE_IURL()        { try{return this.SIDEBAR_DOC.getElementById(this.idTREE_IURL);}catch(e){return undefined;}      },
+	get TREE_ITITLE()      { try{return this.SIDEBAR_DOC.getElementById(this.idTREE_ITITLE);}catch(e){return undefined;}    },
+	get TREE_IDATE()       { try{return this.SIDEBAR_DOC.getElementById(this.idTREE_IDATE);}catch(e){return undefined;}     },
+	get TREE_ICACHE()      { try{return this.SIDEBAR_DOC.getElementById(this.idTREE_ICACHE);}catch(e){return undefined;}    },
+	get TREE_IMARKER()     { try{return this.SIDEBAR_DOC.getElementById(this.idTREE_IMARKER);}catch(e){return undefined;}   },
+	get TREE_ICACHESIZE()  { try{return this.SIDEBAR_DOC.getElementById(this.idTREE_ICACHESIZE);}catch(e){return undefined;}},
+	get idCONTEXTMENU_OPENALL(){ return "bitsAutocacheTreeContextmenuCacheOpenAll"; },
+	get CONTEXTMENU_OPENALL(){try{return this.SIDEBAR_DOC.getElementById(this.idCONTEXTMENU_OPENALL);}catch(e){return undefined;}},
+
+/////////////////////////////////////////////////////////////////////
+	get default_cachedir(){
+		var dir = this.Common.getExtensionDir();
+		dir.append("cache");
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	get cachedir(){
+		try{
+			var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
+			var cache_folder = prefs.getComplexValue("wiredmarker.autocache.save.folder", Components.interfaces.nsILocalFile);
+		}catch(e){
+			cache_folder = undefined;
+		}
+		var save_default = nsPreferences.getBoolPref("wiredmarker.autocache.save.default", true);
+		if(save_default || !cache_folder){
+			return this.default_cachedir;
+		}else{
+			return cache_folder;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getCacheDir : function(){
+		var dir;
+		if(this.bitsItemView && this.bitsItemView.isChecked){
+			var object = this.bitsItemView.object;
+			if(object) dir = this.getURLCacheDirFromTimeStamp(object.doc_url,object.oid_date);
+		}else{
+			var curIdx = this.mcTreeHandler.TREE.currentIndex;
+			var curRes = null;
+			if(curIdx>=0 && !this.mcTreeHandler.TREE.view.isContainer(curIdx)) curRes = this.mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+			if(curRes) dir = this.getURLCacheDirFromTimeStamp(this.DataSource.getProperty(curRes,"uri"),this.DataSource.getProperty(curRes,"date"));
+		}
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	setCacheInfo : function(aURLString,aCacheInfo){
+		if(!aURLString || !aCacheInfo) return;
+		if(this.isCacheURL(aURLString)) return;
+		if(!this._cahceinfo[aURLString]) this._cahceinfo[aURLString] = {};
+		for(var key in aCacheInfo){
+			this._cahceinfo[aURLString][key] = aCacheInfo[key];
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getCacheInfo : function(aURLString){
+		if(!aURLString) return undefined;
+		return (this._cahceinfo[aURLString]?this._cahceinfo[aURLString]:undefined);
+	},
+
+/////////////////////////////////////////////////////////////////////
+// æå®URLãã­ã£ãã·ã¥ãã­ã¥ã¡ã³ããžã®URLã
+// Specified URL is the URL of the document for the cache
+/////////////////////////////////////////////////////////////////////
+	isCacheURL : function(aURLString){
+		if(!aURLString || !aURLString.match(/^file:/)) return false;
+		var docFile = this.Common.convertURLToFile(aURLString);
+		var autocachedir = this.cachedir;
+		var rtn = (autocachedir.path == docFile.path.substr(0,autocachedir.path.length));
+		if(rtn) return rtn;
+		var url = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURL);
+		url.spec = aURLString;
+		var path = url.scheme + "://" + url.host +url.directory;
+		var histdbs = this._selectHistoryDB({hid_file:url.fileName,hid_path:path});
+		return (histdbs?true:false);
+	},
+
+/////////////////////////////////////////////////////////////////////
+// ã­ã£ãã·ã¥ãã­ã¥ã¡ã³ãã®å ŽåãããŒã­ã³ã°ããã
+// If the cache document or marking
+/////////////////////////////////////////////////////////////////////
+	isMarking : function(aURLString){
+		
+		var use = nsPreferences.copyUnicharPref("wiredmarker.autocache.use", "valid");
+		if(use == "disabled") return true;
+		if(!this.isCacheURL(aURLString)) return true;
+		var autocache_marking = nsPreferences.copyUnicharPref("wiredmarker.autocache.marking","confirm");
+		if(autocache_marking == "disabled"){
+			this.Common.alert(this.STRING.getString("ALERT_CACHEPAGE_MARKING"));
+			return false;
+		}
+		if(autocache_marking == "confirm"){
+			var info = this.getSaveCacheInfo(aURLString);
+			var prompts = this.Common.PROMPT;
+			var title = this.STRING.getString("APP_DISP_TITLE");
+			var flags;
+			if(info && info.URL){
+				flags = prompts.BUTTON_POS_0 * prompts.BUTTON_TITLE_YES +
+					prompts.BUTTON_POS_1 * prompts.BUTTON_TITLE_IS_STRING  +
+					prompts.BUTTON_POS_2 * prompts.BUTTON_TITLE_NO +
+					prompts.BUTTON_POS_2_DEFAULT;
+			}else{
+				flags = prompts.BUTTON_POS_0 * prompts.BUTTON_TITLE_YES +
+					prompts.BUTTON_POS_1 * prompts.BUTTON_TITLE_NO +
+					prompts.BUTTON_POS_1_DEFAULT;
+			}
+			var checkMsg = null;
+			var checkState = {value: false};
+			var button = prompts.confirmEx(
+				window,
+				title,
+				this.STRING.getString("CONFIRM_CACHEPAGE_MARKING"),
+				flags, "", this.STRING.getString("BUTTON_CACHEPAGE_MARKING"), "", checkMsg, checkState);
+			if(button!=0){
+				if(info && info.URL && button==1) this.Common.loadURL(info.URL);
+				return false;
+			}
+		}
+		return true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+// æå®ããæ¥æã®ã­ã£ãã·ã¥ãå­åšããã
+// Cache of a specified date and time exists
+/////////////////////////////////////////////////////////////////////
+	existsCache : function(aURLString,aTimeStamp){
+		if(!aURLString){
+			var dir = this.cachedir.clone();
+			var dir_arr = [];
+			if(dir.exists() && dir.directoryEntries){
+				var entries = dir.directoryEntries;
+				while(entries.hasMoreElements()){
+					var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+					if(!entry.isDirectory() || (entry.isDirectory() && entry.leafName.match(/^\./))) continue;
+					dir_arr.push(entry);
+				}
+			}
+			return (dir_arr.length>0?true:false);
+		}
+		if(aTimeStamp && aTimeStamp.match(/^(\d{2})\/(\d{2})\/(\d{4})\s+(\d{2}):(\d{2}):(\d{2})$/)) aTimeStamp = RegExp.$3 + RegExp.$1 + RegExp.$2 + RegExp.$4 + RegExp.$5 + RegExp.$6;
+		var dir = this.getURLCacheDir(aURLString);
+		if(dir || !dir.exists()) return false;
+		if(aTimeStamp) dir.append(aTimeStamp);
+		return dir.exists();
+	},
+
+/////////////////////////////////////////////////////////////////////
+// ãã­ã¥ã¡ã³ããéããæ¥æ
+// Date and time the document is opened
+/////////////////////////////////////////////////////////////////////
+	getURLTimeStamp : function(aURLString){
+		if(!aURLString) return undefined;
+		// ã­ã£ãã·ã¥ã®å Žåãã­ã£ãã·ã¥ããæ¥æãè¿ã
+                // The case of a cache, I return the date and time for which the cache
+		if(this.isCacheURL(aURLString)){
+			var file = this.getSaveCacheInfoFile(aURLString);
+			if(file && file.parent) return file.parent.leafName;
+		}
+		if(this._url2timestamp[aURLString] == undefined) this._url2timestamp[aURLString] = this.Common.getTimeStamp();
+		return this._url2timestamp[aURLString];
+	},
+
+	getURLTimeStampFormatDate : function(aURLString){
+		if(!aURLString) return undefined;
+		var timeStamp = this.getURLTimeStamp(aURLString);
+		if(!timeStamp) return undefined;
+		if(timeStamp.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/)){
+			return RegExp.$2+"/"+RegExp.$3+"/"+RegExp.$1+" "+RegExp.$4+":"+RegExp.$5+":"+RegExp.$6;
+		}else{
+			return undefined;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+// ã­ã£ãã·ã¥URLããªãªãžãã«ã®URLãžå€æ
+// The conversion to the URL of the original cache URL
+/////////////////////////////////////////////////////////////////////
+	convertCacheURLToOriginalURL : function(aURLString){
+		if(!aURLString) return undefined;
+		if(!this.isCacheURL(aURLString)) return aURLString;
+		try{
+			var infofile = this.getSaveCacheInfoFile(aURLString);
+			var infodir = infofile.parent.clone();
+			var baseURL = this.Common.convertFilePathToURL(infodir.path);
+			var urlinfo_str = this._getSaveCacheUrlInfo(infodir);
+			var urlinfo = {};
+			var urlinfo_arr = urlinfo_str.split("\n");
+			var i;
+			var arr;
+			for(i=0;i<urlinfo_arr.length;i++){
+				arr = urlinfo_arr[i].split("\t");
+				if(arr.length>1) urlinfo[arr[1]] = arr[0];
+			}
+			var cacheurl = aURLString.substring(baseURL.length);
+			if(cacheurl.match(/^([^\?#;]+)([\?#;].*)$/)){
+				cacheurl = RegExp.$1;
+				if(urlinfo[cacheurl] != undefined) return urlinfo[cacheurl] + RegExp.$2;
+			}else{
+				if(urlinfo[cacheurl] != undefined) return urlinfo[cacheurl];
+			}
+		}catch(e){
+			this._dump("bitsAutocacheService.convertCacheURLToOriginalURL():aURLString=["+aURLString+"]");
+			this._dump("bitsAutocacheService.convertCacheURLToOriginalURL():"+e);
+			return aURLString;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+// URLãšã¿ã€ã ã¹ã¿ã³ãã§ãã©ã«ã
+// Folder timestamp and URL
+/////////////////////////////////////////////////////////////////////
+	getURLCacheDirFromTimeStamp : function(aURLString,aTimeStamp){
+		if(!aURLString || !aTimeStamp) return undefined;
+		var dir = this.cachedir.clone();
+		if(aTimeStamp.match(/^(\d{2})\/(\d{2})\/(\d{4})\s+(\d{2}):(\d{2}):(\d{2})$/)) aTimeStamp = RegExp.$3 + RegExp.$1 + RegExp.$2 + RegExp.$4 + RegExp.$5 + RegExp.$6;
+		if(aTimeStamp.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/)){
+			dir.append(RegExp.$1);
+			dir.append(RegExp.$2);
+			dir.append(RegExp.$3);
+			dir.append(RegExp.$4);
+		}else{
+			dir.append(aTimeStamp.substr(0,4));
+			if(aTimeStamp.length>3) dir.append(aTimeStamp.substr(3,2));
+			if(aTimeStamp.length>5) dir.append(aTimeStamp.substr(5,2));
+			if(aTimeStamp.length>7) dir.append(aTimeStamp.substr(7,2));
+		}
+		dir.append(this._string2CryptoHash(aURLString));
+		dir.append(aTimeStamp);
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+// URLã®BaseCacheãã©ã«ã
+/////////////////////////////////////////////////////////////////////
+	getURLCacheDir : function(aURLString,aBaseDir){
+		if(!aURLString) return undefined;
+		var dir;
+		if(aBaseDir){
+			dir = aBaseDir.clone();
+		}else{
+			dir = this.cachedir.clone();
+		}
+		dir.append(this._string2CryptoHash(aURLString));
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+// æ°èŠã®Cacheãã©ã«ã
+/////////////////////////////////////////////////////////////////////
+	getNewCacheDir : function(aURLString,aBaseDir){
+		if(!aURLString) return undefined;
+		var dir = this.getURLCacheDir(aURLString,aBaseDir);
+		dir.append(this.getURLTimeStamp(aURLString));
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+// ææ°ã®Cacheã®ã¿ã€ã ã¹ã¿ã³ã
+/////////////////////////////////////////////////////////////////////
+	getNewestCacheTimeStamp : function(aURLString,aBaseDir){
+		if(!aURLString) return undefined;
+		var dir = this.getURLCacheDir(aURLString,aBaseDir);
+		if(!dir.exists()) return undefined;
+		var dir_arr = [];
+		var entries = dir.directoryEntries;
+		while(entries.hasMoreElements()){
+			var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+			if(!entry.isDirectory() || (entry.isDirectory() && entry.leafName.match(/^\./))) continue;
+			dir_arr.push(entry);
+		}
+		if(dir_arr.length>0){
+			dir_arr.sort(function(a, b) { return(parseInt(b.leafName) - parseInt(a.leafName)); });
+			return dir_arr[0].leafName;
+		}else{
+			return undefined;
+		}
+	},
+
+	getNewestCacheFormatDate : function(aURLString,aBaseDir){
+		var timeStamp = this.getNewestCacheTimeStamp(aURLString,aBaseDir);
+		if(!timeStamp) return undefined;
+		if(timeStamp.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/)){
+			return RegExp.$2+"/"+RegExp.$3+"/"+RegExp.$1+" "+RegExp.$4+":"+RegExp.$5+":"+RegExp.$6;
+		}else{
+			return undefined;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+// ææ°ã®Cacheãã©ã«ã
+/////////////////////////////////////////////////////////////////////
+	getNewestCacheDir : function(aURLString,aBaseDir){
+		if(!aURLString) return undefined;
+		var dir = this.getURLCacheDir(aURLString,aBaseDir);
+		if(!dir.exists()) return undefined;
+		var newestCacheTimeStamp = this.getNewestCacheTimeStamp(aURLString,aBaseDir);
+		if(newestCacheTimeStamp){
+			dir.append(newestCacheTimeStamp);
+			return dir;
+		}else{
+			return undefined;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+// æå®ããæ¥æã®çŽåã®ã¿ã€ã ã¹ã¿ã³ã
+// Time stamp just before the specified date and time
+/////////////////////////////////////////////////////////////////////
+	getApproximateCacheTimeStamp : function(aURLString,aTimeStamp){
+		if(!aURLString || !aTimeStamp) return undefined;
+		if(aTimeStamp.match(/^(\d{2})\/(\d{2})\/(\d{4})\s+(\d{2}):(\d{2}):(\d{2})$/)) aTimeStamp = RegExp.$3+RegExp.$1+RegExp.$2+RegExp.$4+RegExp.$5+RegExp.$6;
+		var dir = this.getURLCacheDir(aURLString);
+		if(!dir.exists()) return undefined;
+		var minDir=dir.clone();
+		if(aTimeStamp){
+			minDir.append(aTimeStamp);
+			if(minDir.exists()) return minDir;
+			minDir = undefined;
+		}
+		var min = -1;
+		var entries = dir.directoryEntries;
+		while(entries.hasMoreElements()){
+			var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+			if(!entry.isDirectory() || (entry.isDirectory() && entry.leafName.match(/^\./))) continue;
+			if(parseInt(aTimeStamp) < parseInt(entry.leafName)) continue;
+			if(min<0 || (parseInt(aTimeStamp)- parseInt(entry.leafName))<min){
+				min = parseInt(aTimeStamp)- parseInt(entry.leafName);
+				minDir = entry.clone();
+				if(min == 0) break;
+			}
+		}
+		if(minDir){
+			return minDir.leafName;
+		}else{
+			return undefined;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+// æå®ããæ¥æã®çŽåã®Cacheãã©ã«ã
+/////////////////////////////////////////////////////////////////////
+	getApproximateCacheDir : function(aURLString,aTimeStamp){
+		if(!aURLString) return undefined;
+		var dir = this.getURLCacheDir(aURLString);
+		if(!dir.exists()) return undefined;
+		var approximateCacheTimeStamp = this.getApproximateCacheTimeStamp(aURLString,aTimeStamp);
+		if(approximateCacheTimeStamp){
+			dir.append(approximateCacheTimeStamp);
+			return dir;
+		}else{
+			return undefined;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+// ä¿å­ããã®Cacheã®æ
+å ±ãååŸ
+/////////////////////////////////////////////////////////////////////
+	getSaveCacheInfo : function(aURLString){
+		var aFile = this.Common.convertURLToFile(aURLString);
+		if(!aFile || !aFile.exists()) return undefined;
+		return this._getSaveCacheInfo((aFile.isDirectory() ? aFile : aFile.parent));
+	},
+	getSaveCacheInfoFile : function(aURLString){
+		var aFile = this.Common.convertURLToFile(aURLString);
+		if(!aFile || !aFile.exists()) return undefined;
+		return this._getSaveCacheInfoFile((aFile.isDirectory() ? aFile : aFile.parent));
+	},
+	_getSaveCacheInfoFile : function(aInfoDir){
+		if(!aInfoDir) return undefined;
+		var infoFile = aInfoDir.clone();
+		infoFile.append(".info");
+		while(!infoFile.exists()){
+			try{if(!aInfoDir.parent) return undefined;}catch(e){return undefined;}
+			aInfoDir = aInfoDir.parent.clone();
+			infoFile = aInfoDir.clone();
+			infoFile.append(".info");
+		}
+		return infoFile.clone();
+	},
+	_getSaveCacheInfo : function(aInfoDir){
+		if(!aInfoDir) return undefined;
+		var infoFile = this._getSaveCacheInfoFile(aInfoDir);
+		if(!infoFile) return undefined;
+		var info_str = this.readFile(infoFile);
+		if(!info_str) return undefined;
+		var info = {};
+		var info_arr = info_str.split("\n");
+		for(var i=0;i<info_arr.length;i++){
+			var arr = info_arr[i].split("\t");
+			info[arr[0]] = arr[1];
+		}
+		return info;
+	},
+
+	_getSaveCacheUrlInfo : function(aInfoDir){
+		if(!aInfoDir) return undefined;
+		var infoFile = aInfoDir.clone();
+		infoFile.append(".urlinfo");
+		var info_str = this.readFile(infoFile);
+		if(!info_str) return undefined;
+		return info_str;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	init : function(){
+		this.gBrowser.addEventListener("pageshow", this.pageshow, false);
+		this.gBrowser.tabContainer.addEventListener("TabSelect", this.tabselect, false);
+		bitsMenuTree.POPUP.addEventListener("popupshowing",this.popupshowing_menutree, false);
+		this.Common.addPrefListener(bitsAutocacheObserver);
+		if(this._connectDB()){
+			this._insertInitDB();
+		}
+		var menu = this.CACHEMENU;
+		if(menu){
+			menu.setAttribute("hidden","true");
+			var display = nsPreferences.getBoolPref("wiredmarker.autocache.topmenu.display", false);
+			if(display){
+				var use = nsPreferences.copyUnicharPref("wiredmarker.autocache.use", "valid");
+				if(use == "valid"){
+					menu.removeAttribute("hidden");
+				}else if(use == "disabled" && nsPreferences.getBoolPref("wiredmarker.autocache.manually.exec",false)){
+					menu.removeAttribute("hidden");
+				}else if(use != "valid" && use != "disabled"){
+					use = "valid";
+					nsPreferences.setUnicharPref("wiredmarker.autocache.use", use);
+				}
+			}
+		}
+		var info = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
+		this._app_version = parseInt(info.version);
+		this._pref.view = {
+			disp : nsPreferences.getBoolPref("wiredmarker.autocache.view.disp", false),
+		};
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(){
+		this.gBrowser.removeEventListener("pageshow", this.pageshow, false);
+		this.gBrowser.tabContainer.removeEventListener("TabSelect", this.tabselect, false);
+		bitsMenuTree.POPUP.removeEventListener("popupshowing",this.popupshowing_menutree, false);
+		this.Common.removePrefListener(bitsAutocacheObserver);
+		this._disconnectDB();
+		nsPreferences.setBoolPref("wiredmarker.autocache.view.disp", this._pref.view.disp);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	load : function(aEvent){
+		this.SPLITTER.setAttribute("hidden","true");
+		if(this.bitsItemView && this.bitsItemView.isChecked){
+			this.bitsItemView.POPUP.addEventListener("popupshowing",this.popupshowing, false);
+		}else{
+			this.mcTreeHandler.POPUP.addEventListener("popupshowing",this.popupshowing, false);
+			this.mcTreeHandler.POPUP_OBJECT.addEventListener("popupshowing",this.popupshowing, false);
+		}
+		var btn = this.BUTTON;
+		if(btn){
+			var use = nsPreferences.copyUnicharPref("wiredmarker.autocache.use", "valid");
+			if(use == "switching"){
+				btn.removeAttribute("hidden");
+			}else if(use == "disabled" && nsPreferences.getBoolPref("wiredmarker.autocache.manually.exec",false)){
+				btn.removeAttribute("hidden");
+			}
+		}
+		var btn = this.TOGGLE_BUTTON;
+		if(btn){
+			var use = nsPreferences.copyUnicharPref("wiredmarker.autocache.use", "valid");
+			if(use == "valid"){
+				btn.removeAttribute("hidden");
+			}else if(use == "disabled" && nsPreferences.getBoolPref("wiredmarker.autocache.manually.exec",false)){
+				btn.removeAttribute("hidden");
+			}
+			if(this._pref.view.disp) btn.setAttribute("checked","true");
+			if(!btn.hasAttribute("hidden") && btn.hasAttribute("checked")) this.SPLITTER.removeAttribute("hidden");
+		}
+		this.toggleCacheView();
+		if(!this.TREE.hasAttribute("hidden")) this.rebuild();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	unload : function(aEvent){
+		if(this.bitsItemView && this.bitsItemView.isChecked){
+			this.bitsItemView.POPUP.removeEventListener("popupshowing",this.popupshowing, false);
+		}else if(this.mcTreeHandler){
+			this.mcTreeHandler.POPUP.removeEventListener("popupshowing",this.popupshowing, false);
+			this.mcTreeHandler.POPUP_OBJECT.removeEventListener("popupshowing",this.popupshowing, false);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+// ã­ã£ãã·ã¥ãã¡ã€ã«ãéãããšãã®åŠçãè¡ã
+/////////////////////////////////////////////////////////////////////
+	pageshow : function(aEvent){
+		bitsAutocacheService._pageshow(aEvent);
+	},
+
+	_pageshow : function(aEvent){
+		var btn = this.BUTTON;
+		if(btn) btn.removeAttribute("disabled");
+		var urlString = this.Common.getURLStringFromDocument(aEvent.target);
+		if(!this.isCacheURL(urlString)){
+			try{
+				var aURL = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURL);
+				aURL.spec = urlString;
+			}catch(ex){
+				this._dump("bitsAutocacheService._pageshow():"+ ex);
+				aURL = undefined;
+			}
+			if(aURL && aURL.scheme == "file"){
+				var fileHandler = this.Common.IO.getProtocolHandler(aURL.scheme).QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+				var file = fileHandler.getFileFromURLSpec(urlString);
+				var dd = new Date;
+				dd.setTime(file.lastModifiedTime);
+				var y = dd.getFullYear();
+				var m = dd.getMonth() + 1; if(m < 10) m = "0" + m;
+				var d = dd.getDate();      if(d < 10) d = "0" + d;
+				var h = dd.getHours();     if(h < 10) h = "0" + h;
+				var i = dd.getMinutes();   if(i < 10) i = "0" + i;
+				var s = dd.getSeconds();   if(s < 10) s = "0" + s;
+				this._url2timestamp[urlString] = y.toString() + m.toString() + d.toString() + h.toString() + i.toString() + s.toString();
+			}else{
+				this._url2timestamp[urlString] = this.Common.getTimeStamp();
+			}
+			this.disabledButton(aEvent.target);
+			try{
+				var row = this._cacheList2URL[urlString];
+				if(row != undefined){
+					this.TREE.currentIndex = row;
+					if(!this.TREE.view.selection.isSelected(row)) this.TREE.view.selection.select(row);
+					this.TREE.treeBoxObject.ensureRowIsVisible(row);
+				}
+			}catch(e){}
+		}else{
+			try{
+				var doc = aEvent.target;
+				if(doc.location.toString() == this.gBrowser.contentDocument.location.toString()){
+					var info = this.getSaveCacheInfo(urlString);
+					var timestamp = this.getURLTimeStampFormatDate(urlString);
+					var cached_msg = "Cached from " + info.URL;
+					if(timestamp) cached_msg += " on " + timestamp;
+					doc.title = "["+ cached_msg + "] : " + doc.title;
+				}
+			}catch(e){alert(e);}
+		}
+		if(btn) btn.setAttribute("disabled","true");
+
+		var info = this.getSaveCacheInfo(urlString);
+		var rtn = bitsMarkingCollection.marking(aEvent.target,(info?info.URL:undefined));
+		if(this._isOpenCache && (typeof this._isOpenCache == "string" && this._isOpenCache == urlString)){
+			this._isOpenCache = undefined;
+			var markerid;
+			var oid;
+			var style;
+			var dbtype;
+			if(this._openobject){
+				oid = this._openobject.oid;
+				style = this._openobject.fid_style;
+				dbtype = this._openobject.dbtype;
+				markerid = bitsMarker.id_key + this._openobject.dbtype + this._openobject.oid;
+				this._openobject = null;
+			}else if(this.bitsItemView && this.bitsItemView.isChecked){
+				var object = this.bitsItemView.object;
+				if(object){
+					oid = object.oid;
+					style = object.fid_style;
+					dbtype = object.dbtype;
+					markerid = bitsMarker.id_key + object.dbtype + object.oid;
+				}
+			}else if(this.mcTreeHandler){
+				var curIdx = this.mcTreeHandler.TREE.currentIndex;
+				var curRes = null;
+				if(curIdx>=0 && !this.mcTreeHandler.TREE.view.isContainer(curIdx)) curRes = this.mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+				if(curRes){
+					oid = this.DataSource.getProperty(curRes,"id");
+					style = this.DataSource.getProperty(curRes,"style");
+					dbtype = this.DataSource.getProperty(curRes,"dbtype");
+					markerid = bitsMarker.id_key + dbtype + oid;
+				}
+			}
+			if(markerid){ if(!this.Common.doTopElement(markerid,style,oid,dbtype)) this.Common.doTopElementIMG(oid,dbtype); }
+		}
+		if(this.TREE && this.TREE.view && info && info.URL && this._cacheList2URL && this._cacheList2URL[info.URL] != undefined){
+			this.TREE.currentIndex = this._cacheList2URL[info.URL];
+			if(!this.TREE.view.selection.isSelected(this.TREE.currentIndex)) this.TREE.view.selection.select(this.TREE.currentIndex);
+			this.TREE.treeBoxObject.ensureRowIsVisible(this.TREE.currentIndex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	tabselect : function(aEvent){
+		bitsAutocacheService._tabselect(aEvent);
+	},
+
+	_tabselect : function(aEvent){
+		this.disabledButton(this.gBrowser.selectedBrowser.contentDocument);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	popupshowingMainContextmenu : function(aEvent){
+		if(aEvent.target.id != "bitsCacheContextmenuPopup") return;
+		this._explicitOriginalTarget = aEvent.explicitOriginalTarget;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	popupshowingMainmenu : function(aEvent){
+		if(!aEvent.target.nodeName || aEvent.target.nodeName != "menupopup") return;
+		aEvent.stopPropagation();
+		if(aEvent.target.id == "bitsCacheMenuPopup"){
+			var urlsdb = this._selectUrlDB();
+			if(!urlsdb){
+				var menuitem = document.createElement("menuitem");
+				menuitem.setAttribute("label",this.STRING.getString("MSG_CACHEPAGE_NONE"));
+				menuitem.setAttribute("disabled","true");
+				aEvent.target.appendChild(menuitem);
+				return;
+			}
+			var urlcnt;
+			var histcnt;
+			for(urlcnt=0;urlcnt<urlsdb.length;urlcnt++){
+				var histsdb = this._selectHistoryDB({uid_url:urlsdb[urlcnt].uid_url});
+				if(!histsdb) continue;
+				histcnt = 0;
+				urlsdb[urlcnt] = histsdb[histcnt];
+			}
+			if(urlsdb.length>0) urlsdb.sort(function(a, b) { return(parseInt(b.hid_date) - parseInt(a.hid_date)); });
+			var topmenu_number = nsPreferences.getIntPref("wiredmarker.autocache.topmenu.number", 0);
+			if(topmenu_number) urlsdb.length = topmenu_number;
+			for(urlcnt=0;urlcnt<urlsdb.length;urlcnt++){
+				var menu = document.createElement("menu");
+				menu.setAttribute("label",urlsdb[urlcnt].hid_title);
+				var icon = this.Database.getFavicon(urlsdb[urlcnt].uid_url);
+				if(!icon) icon = "chrome://markingcollection/skin/defaultFavicon.png";
+				if(icon){
+					menu.setAttribute("class","menu-iconic");
+					menu.setAttribute("image",icon);
+				}
+				menu.setAttribute("contextmenu","bitsCacheContextmenuPopup");
+				menu.setAttribute("doc_url",urlsdb[urlcnt].uid_url);
+				var menupopup = document.createElement("menupopup");
+				menupopup.setAttribute("doc_url",urlsdb[urlcnt].uid_url);
+				menu.appendChild(menupopup);
+				aEvent.target.appendChild(menu);
+			}
+		}else if(aEvent.target.hasAttribute("file_url") && aEvent.target.hasAttribute("doc_url")){  //ãã®åŠçã¯äœ¿çšããªã
+			var dir = this.Common.convertURLToFile(aEvent.target.getAttribute("file_url"));
+			var doc_url = aEvent.target.getAttribute("doc_url");
+			var temp_arr = [];
+			var temp_entries = dir.directoryEntries;
+			while(temp_entries.hasMoreElements()){
+				var temp_entry = temp_entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+				if(!temp_entry.isDirectory() || (temp_entry.isDirectory() && temp_entry.leafName.match(/^\./))) continue;
+				temp_arr.push(temp_entry);
+			}
+			if(temp_arr.length>0) temp_arr.sort(function(a, b) { return(parseInt(b.leafName) - parseInt(a.leafName)); });
+			var itemcnt;
+			for(itemcnt=0;itemcnt<temp_arr.length;itemcnt++){
+				var objs = null;
+				var menu = document.createElement("menu");
+				if(temp_arr[itemcnt].leafName.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/)){
+					var item_label = RegExp.$1+"/"+RegExp.$2+"/"+RegExp.$3+" "+RegExp.$4+":"+RegExp.$5+":"+RegExp.$6;
+					var item_date = RegExp.$2+"/"+RegExp.$3+"/"+RegExp.$1+" "+RegExp.$4+":"+RegExp.$5+":"+RegExp.$6;
+					if(doc_url){
+						objs = this.Database.getObject({doc_url : doc_url, oid_date : item_date});
+						item_label += " (" + (objs?objs.length:0) + ")";
+					}
+					menu.setAttribute("label",item_label);
+				}else{
+					menu.setAttribute("label",temp_arr[itemcnt].leafName);
+				}
+				menu.setAttribute("class","menu-iconic");
+				menu.setAttribute("image","chrome://markingcollection/skin/defaultFavicon.png");
+				var menupopup = document.createElement("menupopup");
+				menupopup.setAttribute("oid_date",temp_arr[itemcnt].leafName);
+				var info = this._getSaveCacheInfo(temp_arr[itemcnt]);
+				if(info && info.URL) menupopup.setAttribute("doc_url",info.URL);
+				menu.appendChild(menupopup);
+				var contextmenu = document.getElementById("bitsCacheMenuPopupMenupopup");
+				if(contextmenu && contextmenu.hasChildNodes()){
+					var childNode = contextmenu.firstChild;
+					while(childNode){
+						menupopup.appendChild(childNode.cloneNode(true));
+						childNode = childNode.nextSibling;
+					}
+				}
+				if(objs){
+					var menuseparator = document.createElement("menuseparator");
+					menupopup.appendChild(menuseparator);
+					var objcnt;
+					for(objcnt=0;objcnt<objs.length;objcnt++){
+						var menuitem = document.createElement("menuitem");
+						bitsMenuTree._setMenuitemObjectAttribute(menuitem,objs[objcnt]);
+						menuitem.addEventListener("command",this.commandTreeContextmenu,false);
+						menupopup.appendChild(menuitem);
+					}
+				}
+				aEvent.target.appendChild(menu);
+			}
+		}else if(aEvent.target.hasAttribute("doc_url") && !aEvent.target.hasAttribute("oid_date")){
+			var doc_url = aEvent.target.getAttribute("doc_url");
+			var histsdb = this._selectHistoryDB({uid_url:doc_url});
+			if(!histsdb){
+				aEvent.target.setAttribute("hidden","true");
+				return;
+			}
+			var histcnt;
+			for(histcnt=0;histcnt<histsdb.length;histcnt++){
+				var objs = null;
+				var menu = document.createElement("menu");
+				if(histsdb[histcnt].hid_date.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/)){
+					var item_label = RegExp.$1+"/"+RegExp.$2+"/"+RegExp.$3+" "+RegExp.$4+":"+RegExp.$5+":"+RegExp.$6;
+					var item_date = RegExp.$2+"/"+RegExp.$3+"/"+RegExp.$1+" "+RegExp.$4+":"+RegExp.$5+":"+RegExp.$6;
+					if(doc_url){
+						objs = this.Database.getObject({doc_url : doc_url, oid_date : item_date});
+						item_label += " (" + (objs?objs.length:0) + ")";
+					}
+					menu.setAttribute("label",item_label);
+				}else{
+					menu.setAttribute("label",histsdb[histcnt].hid_date);
+				}
+				menu.setAttribute("class","menu-iconic");
+				menu.setAttribute("image","chrome://markingcollection/skin/defaultFavicon.png");
+				menu.setAttribute("doc_url",histsdb[histcnt].uid_url);
+				menu.setAttribute("oid_date",histsdb[histcnt].hid_date);
+				var menupopup = document.createElement("menupopup");
+				menupopup.setAttribute("doc_url",histsdb[histcnt].uid_url);
+				menupopup.setAttribute("oid_date",histsdb[histcnt].hid_date);
+				menu.appendChild(menupopup);
+				var contextmenu = document.getElementById("bitsCacheMenuPopupMenupopup");
+				if(contextmenu && contextmenu.hasChildNodes()){
+					var childNode = contextmenu.firstChild;
+					while(childNode){
+						menupopup.appendChild(childNode.cloneNode(true));
+						childNode = childNode.nextSibling;
+					}
+				}
+				if(objs){
+					var menuseparator = document.createElement("menuseparator");
+					menupopup.appendChild(menuseparator);
+					var objcnt;
+					for(objcnt=0;objcnt<objs.length;objcnt++){
+						var menuitem = document.createElement("menuitem");
+						bitsMenuTree._setMenuitemObjectAttribute(menuitem,objs[objcnt]);
+						menuitem.addEventListener("command",this.commandTreeContextmenu,false);
+						menupopup.appendChild(menuitem);
+					}
+				}
+				aEvent.target.appendChild(menu);
+			}
+		}else{
+		}
+
+	},
+
+/////////////////////////////////////////////////////////////////////
+	popuphidingMainmenu : function(aEvent){
+		if(!aEvent.target.nodeName || aEvent.target.nodeName != "menupopup") return;
+		aEvent.stopPropagation();
+		if(aEvent.target.id == "bitsCacheMenuPopup" || (!aEvent.target.hasAttribute("oid_date") && aEvent.target.hasAttribute("doc_url"))){
+			while(aEvent.target.hasChildNodes()){
+				aEvent.target.removeChild(aEvent.target.lastChild);
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	popupshowingTreeContextmenu : function(aEvent){
+		if(!aEvent.target.nodeName || aEvent.target.nodeName != "popup") return;
+		if(!this._cacheList || this.TREE.currentIndex<0 || this._cacheList.length<this.TREE.currentIndex || !this._cacheList[this.TREE.currentIndex]) return;
+		var menuitem = this.CONTEXTMENU_OPENALL;
+		var sellist = this.getSelection();
+		if(sellist && sellist.length>1){
+			if(menuitem) menuitem.setAttribute("hidden","true");
+			return;
+		}else{
+			if(menuitem) menuitem.removeAttribute("hidden");
+		}
+		var cacheinfo = this._cacheList[this.TREE.currentIndex];
+		var doc_url = cacheinfo.URL;
+		var temp_arr = this._selectHistoryDB({uid_url:doc_url});
+		var itemcnt;
+		for(itemcnt=0;itemcnt<temp_arr.length;itemcnt++){
+			var objs = null;
+			var menu = document.createElement("menu");
+			if(temp_arr[itemcnt].hid_date.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/)){
+				var item_label = RegExp.$1+"/"+RegExp.$2+"/"+RegExp.$3+" "+RegExp.$4+":"+RegExp.$5+":"+RegExp.$6;
+				var item_date = RegExp.$2+"/"+RegExp.$3+"/"+RegExp.$1+" "+RegExp.$4+":"+RegExp.$5+":"+RegExp.$6;
+				if(doc_url){
+					objs = this.Database.getObject({doc_url : doc_url, oid_date : item_date});
+					item_label += " (" + (objs?objs.length:0) + ")";
+				}
+				menu.setAttribute("label",item_label);
+			}else{
+				menu.setAttribute("label",temp_arr[itemcnt].hid_date);
+			}
+			menu.setAttribute("class","menu-iconic");
+			menu.setAttribute("image","chrome://markingcollection/skin/defaultFavicon.png");
+			var menupopup = document.createElement("menupopup");
+			menupopup.setAttribute("oid_date",temp_arr[itemcnt].hid_date);
+			menupopup.setAttribute("doc_url",doc_url);
+			menu.appendChild(menupopup);
+			var contextmenu = aEvent.target.ownerDocument.getElementById("bitsAutocacheTreeItemContextmenu");
+			if(contextmenu && contextmenu.hasChildNodes()){
+				var childNode = contextmenu.firstChild;
+				while(childNode){
+					menupopup.appendChild(childNode.cloneNode(true));
+					childNode = childNode.nextSibling;
+				}
+			}
+			if(objs){
+				var menuseparator = document.createElement("menuseparator");
+				menupopup.appendChild(menuseparator);
+				var objcnt;
+				for(objcnt=0;objcnt<objs.length;objcnt++){
+					var menuitem = document.createElement("menuitem");
+					bitsMenuTree._setMenuitemObjectAttribute(menuitem,objs[objcnt]);
+					menuitem.removeAttribute("contextmenu");
+					menuitem.addEventListener("command",this.commandTreeContextmenu,false);
+					menupopup.appendChild(menuitem);
+				}
+			}
+			aEvent.target.appendChild(menu);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	popuphidingTreeContextmenu : function(aEvent){
+		if(!aEvent.target.nodeName || aEvent.target.nodeName != "popup") return;
+		while(aEvent.target.hasChildNodes()){
+			if(aEvent.target.lastChild.nodeName == "menuseparator") break;
+			aEvent.target.removeChild(aEvent.target.lastChild);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	commandTreeContextmenu : function(aEvent){
+		bitsAutocacheService._commandTreeContextmenu(aEvent);
+	},
+
+	_commandTreeContextmenu : function(aEvent){
+		this.openCache(aEvent, aEvent.shiftKey);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	commandMainmenu : function(aEvent){
+		aEvent.stopPropagation();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	popupshowing_menutree : function(aEvent){
+		bitsAutocacheService._popupshowing_menutree(aEvent);
+	},
+	_popupshowing_menutree : function(aEvent){
+		this.OPEN_MENUTREE.setAttribute("hidden","true");
+		var autocache_use = nsPreferences.copyUnicharPref("wiredmarker.autocache.use","valid");
+		if(autocache_use == "disabled") return;
+		this.OPEN_MENUTREE.removeAttribute("hidden");
+
+		if(!bitsMenuTree._explicitOriginalTarget){
+			this.OPEN_MENUTREE.setAttribute("disabled","true");
+			return;
+		}
+		var target = bitsMenuTree._explicitOriginalTarget;
+		var dir = this.getURLCacheDirFromTimeStamp(target.getAttribute("doc_url"),target.getAttribute("oid_date"));
+		if(!dir || !dir.exists()){
+			var histsdb = this._selectHistoryDB({uid_url:target.getAttribute("doc_url"),hid_date:target.getAttribute("oid_date")});
+			if(histsdb) dir = this.Common.convertURLToFile(histsdb[0].hid_path);
+		}
+		if(!dir || !dir.exists()){
+			this.OPEN_MENUTREE.setAttribute("disabled","true");
+		}else{
+			this.OPEN_MENUTREE.removeAttribute("disabled");
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	popupshowing : function(aEvent){
+		bitsAutocacheService._popupshowing(aEvent);
+	},
+	_popupshowing : function(aEvent){
+		var doc_url;
+		var oid_date;
+		this.OPEN1.setAttribute("hidden","true");
+		this.OPEN2.setAttribute("hidden","true");
+		this.OPEN3.setAttribute("hidden","true");
+		var autocache_use = nsPreferences.copyUnicharPref("wiredmarker.autocache.use","valid");
+		if(autocache_use == "disabled") return;
+		if(this.bitsItemView && this.bitsItemView.isChecked){
+			this.OPEN2.removeAttribute("hidden");
+			var object = this.bitsItemView.object;
+			if(object){
+				doc_url = object.doc_url;
+				oid_date = object.oid_date;
+			}
+		}else{
+			this.OPEN3.removeAttribute("hidden");
+			var curRes = null;
+			var curIdx = this.mcTreeHandler.TREE.currentIndex;
+			if(curIdx>=0 && !this.mcTreeHandler.TREE.view.isContainer(curIdx)){
+				this.OPEN1.removeAttribute("hidden");
+				curRes = this.mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+			}
+			if(curRes){
+				doc_url = this.DataSource.getProperty(curRes,"uri");
+				oid_date = this.DataSource.getProperty(curRes,"date");
+			}
+		}
+		var dir;
+		if(doc_url && oid_date){
+			dir = this.getURLCacheDirFromTimeStamp(doc_url,oid_date);
+			if(!dir || !dir.exists()){
+				var histsdb = this._selectHistoryDB({uid_url:doc_url,hid_date:oid_date});
+				if(histsdb) dir = this.Common.convertURLToFile(histsdb[0].hid_path);
+			}
+		}
+		if(!dir || !dir.exists()){
+			this.OPEN1.setAttribute("disabled","true");
+			this.OPEN2.setAttribute("disabled","true");
+			this.OPEN3.setAttribute("disabled","true");
+		}else{
+			this.OPEN1.removeAttribute("disabled");
+			this.OPEN2.removeAttribute("disabled");
+			this.OPEN3.removeAttribute("disabled");
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	openCache : function(aEvent, aTabbed){
+		this._openobject = null;
+		var dir;
+		var doc_url;
+		var oid_date;
+		var oid;
+		var pfid;
+		var dbtype;
+		var style;
+		var source;
+		if(aEvent.target.id == "bitsItemTreePopupCacheOpen" || aEvent.target.id == "bitsItemTreePopupCacheOpenNewtab"){
+			var object = this.bitsItemView.object;
+			if(object){
+				doc_url = object.doc_url;
+				oid_date = object.oid_date;
+				oid = object.oid;
+				pfid = object.pfid;
+				dbtype = object.dbtype;
+			}
+		}else if(
+			aEvent.target.id == "mcPopupCacheOpen" ||
+			aEvent.target.id == "mcPopupCacheOpenNewtab" ||
+			aEvent.target.id == "mcPopupObjectCacheOpen" ||
+			aEvent.target.id == "mcPopupObjectCacheOpenNewtab"
+		){
+			var curIdx = this.mcTreeHandler.TREE.currentIndex;
+			var curRes = null;
+			if(curIdx>=0 && !this.mcTreeHandler.TREE.view.isContainer(curIdx)) curRes = this.mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+			if(curRes){
+				doc_url = this.DataSource.getProperty(curRes,"uri");
+				oid_date = this.DataSource.getProperty(curRes,"date");
+
+				oid = this.DataSource.getProperty(curRes,"id");
+				pfid = this.DataSource.getProperty(curRes,"pfid");
+				dbtype = this.DataSource.getProperty(curRes,"dbtype");
+			}
+		}else if(aEvent.target.id == "bitsMenuTreeObjectContextmenuCacheOpen" || aEvent.target.id == "bitsMenuTreeObjectContextmenuCacheOpenNewtab"){
+			var target = bitsMenuTree._explicitOriginalTarget;
+			if(target){
+				doc_url = target.getAttribute("doc_url");
+				oid_date = target.getAttribute("oid_date");
+				this._openobject = this.Database.newObject(undefined,target.getAttribute("dbtype"));
+				if(this._openobject){
+					var key;
+					for(key in this._openobject){
+						this._openobject[key] = target.getAttribute(key);
+					}
+					this._openobject.fid_style = target.getAttribute("fid_style");
+					this._openobject.dbtype = target.getAttribute("dbtype");
+
+					oid = this._openobject.oid;
+					pfid = this._openobject.pfid;
+					dbtype = this._openobject.dbtype;
+				}
+			}
+		}else if(
+			aEvent.target.id == "bitsCacheMenuPopupCacheOpen" || 
+			aEvent.target.id == "bitsCacheMenuPopupCacheOpenNewtab" ||
+			aEvent.target.id == "bitsAutocacheTreeContextmenuOpen" || 
+			aEvent.target.id == "bitsAutocacheTreeContextmenuNewtab"
+		){
+			var target = aEvent.target.parentNode;
+			if(target){
+				doc_url = target.getAttribute("doc_url");
+				oid_date = target.getAttribute("oid_date");
+				this._openobject = this.Database.newObject(undefined,target.getAttribute("dbtype"));
+				if(this._openobject){
+					var key;
+					for(key in this._openobject){
+						this._openobject[key] = target.getAttribute(key);
+					}
+					this._openobject.fid_style = target.getAttribute("fid_style");
+					this._openobject.dbtype = target.getAttribute("dbtype");
+
+					oid = this._openobject.oid;
+					pfid = this._openobject.pfid;
+					dbtype = this._openobject.dbtype;
+				}
+			}
+		}else{
+			var target = aEvent.target;
+			if(target){
+				doc_url = target.getAttribute("doc_url");
+				oid_date = target.getAttribute("oid_date");
+				this._openobject = this.Database.newObject(undefined,target.getAttribute("dbtype"));
+				if(this._openobject){
+					var key;
+					for(key in this._openobject){
+						this._openobject[key] = target.getAttribute(key);
+					}
+					this._openobject.fid_style = target.getAttribute("fid_style");
+					this._openobject.dbtype = target.getAttribute("dbtype");
+					if(this.mcTreeViewModeService) this.mcTreeViewModeService.selectTreeObject(this._openobject.oid,this._openobject.dbtype,this._openobject.pfid);
+					oid = this._openobject.oid;
+					pfid = this._openobject.pfid;
+					dbtype = this._openobject.dbtype;
+				}
+			}
+		}
+		if(doc_url && oid_date){
+			dir = this.getURLCacheDirFromTimeStamp(doc_url,oid_date);
+			if(!dir || !dir.exists()){
+				if(oid_date && oid_date.match(/^(\d{2})\/(\d{2})\/(\d{4})\s+(\d{2}):(\d{2}):(\d{2})$/)) oid_date = RegExp.$3 + RegExp.$1 + RegExp.$2 + RegExp.$4 + RegExp.$5 + RegExp.$6;
+				var histsdb = this._selectHistoryDB({uid_url:doc_url,hid_date:oid_date});
+				if(histsdb) dir = this.Common.convertURLToFile(histsdb[0].hid_path);
+			}
+		}
+		if(!dir || !dir.exists()) return;
+		var doc = this.gBrowser.contentDocument;
+		var cur_uri = this.Common.getURLStringFromDocument(this.gBrowser.contentDocument);
+		var res_uri = this.Common.convertFilePathToURL(dir.path);
+		var loadFlag = false;
+		if(aTabbed) loadFlag = aTabbed;
+		if(!aTabbed){
+			if(this.gBrowser.browsers.length == 1 && res_uri != "" && cur_uri.indexOf(res_uri)<0){
+				loadFlag = true;
+			}else if(cur_uri == res_uri){
+				loadFlag = false;
+			}else{
+				loadFlag = true;
+				var i;
+				for(i=0;i<this.gBrowser.browsers.length;i++){
+					var doc = this.gBrowser.browsers[i].contentDocument;
+					var cur_uri = this.Common.getURLStringFromDocument(doc);
+					if(cur_uri.indexOf(res_uri)>=0){
+						loadFlag = false;
+						this.gBrowser.tabContainer.selectedIndex = i;
+						break;
+					}
+				}
+			}
+			aTabbed = aEvent.shiftKey;
+		}
+		var info = this._getSaveCacheInfo(dir);
+		if(loadFlag){
+			if(info && info.INDEX){
+				var indexFile = dir.clone();
+				indexFile.append(info.INDEX);
+				if(indexFile.exists()){
+					var indexURLString = this.Common.convertFilePathToURL(indexFile.path);
+					if(indexURLString){
+						this._isOpenCache = indexURLString;
+						var tab = this.Common.loadURL(indexURLString,aTabbed);
+						if(tab && oid!=undefined && pfid!=undefined && dbtype!=undefined){
+							try{
+								var object = this.Database.getObject({oid:oid,pfid:pfid}, dbtype)[0];
+								if(object){
+									oid = object.oid;
+									pfid = object.pfid;
+									dbtype = object.dbtype;
+									style = object.fid_style;
+									if(!object.oid_type.match(/^image\/(.+)$/)) source = bitsMarker.id_key+object.dbtype+object.oid;
+									tab.setAttribute("Wired-Marker:oid",oid);
+									tab.setAttribute("Wired-Marker:pfid",pfid);
+									tab.setAttribute("Wired-Marker:dbtype",dbtype);
+									tab.setAttribute("Wired-Marker:style",style);
+									if(source) tab.setAttribute("Wired-Marker:source",source);
+								}
+							}catch(e){}
+						}
+
+					}
+				}
+			}
+		}else{
+			//ããŒã«ãŒãžã¹ã¯ã­ãŒã«
+			var markerid;
+			var oid;
+			var style;
+			var dbtype;
+			if(this._openobject){
+				oid = this._openobject.oid;
+				style = this._openobject.fid_style;
+				dbtype = this._openobject.dbtype;
+				markerid = bitsMarker.id_key + this._openobject.dbtype + this._openobject.oid;
+				this._openobject = null;
+			}else if(this.bitsItemView && this.bitsItemView.isChecked){
+				var object = this.bitsItemView.object;
+				if(object){
+					oid = object.oid;
+					style = object.fid_style;
+					dbtype = object.dbtype;
+					markerid = bitsMarker.id_key + object.dbtype + object.oid;
+				}
+			}else if(this.mcTreeHandler){
+				var curIdx = this.mcTreeHandler.TREE.currentIndex;
+				var curRes = null;
+				if(curIdx>=0 && !this.mcTreeHandler.TREE.view.isContainer(curIdx)) curRes = this.mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+				if(curRes){
+					oid = this.DataSource.getProperty(curRes,"id");
+					style = this.DataSource.getProperty(curRes,"style");
+					dbtype = this.DataSource.getProperty(curRes,"dbtype");
+					markerid = bitsMarker.id_key + dbtype + oid;
+				}
+			}
+			if(markerid){ if(!this.Common.doTopElement(markerid,style,oid,dbtype)) this.Common.doTopElementIMG(oid,dbtype); }
+			if(this.TREE && this.TREE.view && info && info.URL && this._cacheList2URL && this._cacheList2URL[info.URL] != undefined){
+				this.TREE.currentIndex = this._cacheList2URL[info.URL];
+				if(!this.TREE.view.selection.isSelected(this.TREE.currentIndex)) this.TREE.view.selection.select(this.TREE.currentIndex);
+				this.TREE.treeBoxObject.ensureRowIsVisible(this.TREE.currentIndex);
+			}
+		}
+		aEvent.stopPropagation();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	openCacheAll : function(aEvent, aTabbed){
+		var doc_url;
+		if(aEvent.target.id == "bitsCacheContextmenuMenuitemCacheOpenAll"){
+			var target = this._explicitOriginalTarget;
+			if(target) doc_url = target.getAttribute("doc_url");
+		}else if(aEvent.target.id == this.idCONTEXTMENU_OPENALL){
+			if(!this._cacheList || this.TREE.currentIndex<0 || this._cacheList.length<this.TREE.currentIndex || !this._cacheList[this.TREE.currentIndex]) return;
+			var cacheinfo = this._cacheList[this.TREE.currentIndex];
+			if(cacheinfo && cacheinfo.URL) doc_url = cacheinfo.URL;
+		}
+		if(!doc_url) return;
+		var dir_arr = [];
+		var histdbs = this._selectHistoryDB({uid_url : doc_url});
+		if(histdbs){
+			var i;
+			for(i=0;i<histdbs.length;i++){
+				var dir = this.Common.convertURLToFile(histdbs[i].hid_path);
+				if(dir.exists()) dir_arr.push(dir.clone());
+			}
+		}
+		var i;
+		for(i=0;i<dir_arr.length;i++){
+			var dir = dir_arr[i].clone();
+			var info = this._getSaveCacheInfo(dir);
+			if(info && info.INDEX){
+				var indexFile = dir.clone();
+				indexFile.append(info.INDEX);
+				if(indexFile.exists()){
+					var indexURLString = this.Common.convertFilePathToURL(indexFile.path);
+					if(indexURLString) this.Common.loadURL(indexURLString,true);
+				}
+			}
+		}
+		aEvent.stopPropagation();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	pastCache : function(aEvent){
+		var dir;
+		if(aEvent.target.id == "bitsItemTreePopupCachePast"){
+			var object = this.bitsItemView.object;
+			if(object) dir = this.getURLCacheDir(object.doc_url);
+		}else if(aEvent.target.id == "mcPopupCachePast"){
+			var curIdx = this.mcTreeHandler.TREE.currentIndex;
+			var curRes = null;
+			if(curIdx>=0 && !this.mcTreeHandler.TREE.view.isContainer(curIdx)) curRes = this.mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+			if(curRes) dir = this.getURLCacheDir(this.DataSource.getProperty(curRes,"uri"));
+		}else if(aEvent.target.id == "bitsMenuTreeObjectContextmenuCachePast"){
+			var target = bitsMenuTree._explicitOriginalTarget;
+			if(target) dir = this.getURLCacheDir(target.getAttribute("doc_url"));
+		}
+		if(!dir || !dir.exists()) return;
+		var dir_arr = [];
+		var entries = dir.directoryEntries;
+		while(entries.hasMoreElements()){
+			var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+			if(!entry.isDirectory() || (entry.isDirectory() && entry.leafName.match(/^\./))) continue;
+			dir_arr.push(entry.clone());
+		}
+		if(dir_arr.length>0) dir_arr.sort(function(a, b) { return(parseInt(b.leafName) - parseInt(a.leafName)); });
+		var result = {
+			accept : false,
+			list   : dir_arr,
+			dir    : dir,
+		};
+		window.openDialog("chrome://markingcollection/content/autocacheDialog.xul", "", "chrome,centerscreen,modal", result);
+		if(result.accept){
+			if(result.acceptdir){
+				var dir = result.acceptdir.clone();
+				if(!dir || !dir.exists()) return;
+				var info = this._getSaveCacheInfo(dir);
+				if(info && info.INDEX){
+					var indexFile = dir.clone();
+					indexFile.append(info.INDEX);
+					if(indexFile.exists()){
+						var indexURLString = this.Common.convertFilePathToURL(indexFile.path);
+						if(indexURLString){
+							this.Common.loadURL(indexURLString,true);
+							this._isOpenCache = indexURLString;
+						}
+					}
+				}
+			}
+		}
+		this.disabledButton();
+		aEvent.stopPropagation();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	removeCache : function(aEvent){
+		try{
+			var doc_url;
+			var oid_date;
+			if(
+				aEvent.target.id == "bitsCacheMenuPopupCacheRemove" ||
+				aEvent.target.id == "bitsAutocacheTreeContextmenuRemove"
+			){
+				var target = aEvent.target.parentNode;
+				if(!target || !target.hasAttribute("doc_url") || !target.hasAttribute("oid_date")) return;
+				if(target) dir = this.getURLCacheDirFromTimeStamp(target.getAttribute("doc_url"),target.getAttribute("oid_date"));
+				doc_url = target.getAttribute("doc_url");
+				oid_date = target.getAttribute("oid_date");
+			}
+			if(!doc_url || !oid_date) return;
+			var self = this;
+			setTimeout(function(){
+				try{
+					if(!self.Common.confirm( self.STRING.getString("CONFIRM_DELETE") )) return;
+					var histsdb = self._selectHistoryDB({uid_url:doc_url,hid_date:oid_date});
+					if(!histsdb) return;
+					var j;
+					for(j=0;j<histsdb.length;j++){
+						if(!self._deleteHistoryDB({uid:histsdb[j].uid,hid:histsdb[j].hid})) continue;
+						var dir = self.Common.convertURLToFile(histsdb[j].hid_path);
+						if(!dir || !dir.exists()) continue;
+						var parent = dir.parent.clone();
+						try{ dir.remove(true); }catch(e){}
+						while(!self.Common.hasDirChilds(parent)){
+							var n_parent = parent.parent.clone();
+							try{ parent.remove(true); }catch(e){break;}
+							parent = n_parent;
+						}
+					}
+					histsdb = self._selectHistoryDB({uid_url:doc_url});
+					if(!histsdb) self._deleteUrlDB({uid_url:doc_url});
+					self.refresh();
+				}catch(e){self._dump("bitsAutocacheService.removeCacheAll():"+ e);}
+			},0);
+		}catch(e){self._dump("bitsAutocacheService.removeCacheAll():"+ e);}
+		aEvent.stopPropagation();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	removeCacheAll : function(aEvent){
+		try{
+			var doc_urls = [];
+			if(aEvent.target.id == "bitsCacheContextmenuMenuitemCacheRemoveAll"){
+				var target = this._explicitOriginalTarget;
+				if(target){
+					var doc_url = target.getAttribute("doc_url");
+					if(doc_url) doc_urls.push(doc_url);
+				}
+			}else if(aEvent.target.id == "bitsAutocacheTreeContextmenuCacheRemoveAll"){
+				if(!this._cacheList || this.TREE.currentIndex<0 || this._cacheList.length<this.TREE.currentIndex || !this._cacheList[this.TREE.currentIndex]) return;
+				var sellist = this.getSelection();
+				var i;
+				for(i=0;i<sellist.length;i++){
+					var cacheinfo = this._cacheList[sellist[i]];
+					if(cacheinfo && cacheinfo.URL) doc_urls.push(cacheinfo.URL);
+				}
+			}
+			if(doc_urls.length==0) return;
+			var self = this;
+			setTimeout(function(){
+				try{
+					if(!self.Common.confirm( self.STRING.getString("CONFIRM_DELETE") )) return;
+					self._removeCacheAll(doc_urls);
+				}catch(e){self._dump("bitsAutocacheService.removeCacheAll():"+ e);}
+			},0);
+			aEvent.stopPropagation();
+		}catch(e){
+			this._dump("bitsAutocacheService.removeCacheAll():"+ e);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_removeCacheAll : function(aURLs){
+		var self = this;
+		if(!aURLs || aURLs.length == 0){
+			self.refresh();
+			return;
+		}
+		var doc_url = aURLs.shift();
+		var i,j;
+		var histsdb = self._selectHistoryDB({uid_url:doc_url});
+		if(histsdb){
+			for(j=0;j<histsdb.length;j++){
+				var dir = self.Common.convertURLToFile(histsdb[j].hid_path);
+				if(!dir || !dir.exists()) continue;
+				var parent = dir.parent.clone();
+				try{ dir.remove(true); }catch(e){}
+				while(!self.Common.hasDirChilds(parent)){
+					var n_parent = parent.parent.clone();
+					try{ parent.remove(true); }catch(e){break;}
+					parent = n_parent;
+				}
+			}
+			var rtn = self._deleteUrlDB({uid_url:doc_url});
+		}
+		setTimeout(function(){ self._removeCacheAll(aURLs); },0);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	disabledButton : function(aDoc){
+		var self = this;
+		var btn = self.BUTTON;
+		if(!btn || btn.hasAttribute("hidden")) return;
+		if(!aDoc) aDoc = self.gBrowser.contentDocument;
+		if(self._disabledTimer) clearTimeout(self._disabledTimer);
+		self._disabledTimer = setTimeout(function(){
+			btn.setAttribute("disabled","true");
+			var urlString = self.Common.getURLStringFromDocument(aDoc);
+			if(!self.isCacheURL(urlString)){
+				var dir = self.getNewestCacheTimeStamp(urlString);
+				if(!dir) btn.removeAttribute("disabled");
+			}
+		},500);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	manuallyCache : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	toggleCacheView : function(aEvent){
+		if(this.SPLITTER) this.SPLITTER.setAttribute("hidden","true");
+		if(this.VBOX) this.VBOX.setAttribute("hidden","true");
+		var btn = this.TOGGLE_BUTTON;
+		if(!btn || btn.hasAttribute("hidden")) return;
+		var self = this;
+		setTimeout(function(){
+			self._pref.view.disp = btn.hasAttribute("checked");
+			if(!self._pref.view.disp) return;
+			if(self.SPLITTER) self.SPLITTER.removeAttribute("hidden");
+			if(self.VBOX) self.VBOX.removeAttribute("hidden");
+		},0);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createCache : function(aURLString, aForced, aRebuild){
+		if(aForced == undefined) aForced = false;
+		if(aRebuild == undefined) aRebuild = true;
+		var use = nsPreferences.copyUnicharPref("wiredmarker.autocache.use", "valid");
+		if(use == "disabled" && !aForced) return;
+		if(aURLString){
+			var urlString = this.Common.getURLStringFromDocument(this.gBrowser.contentDocument);
+			if(aURLString != urlString) return;
+		}else{
+			aURLString = this.Common.getURLStringFromDocument(this.gBrowser.contentDocument);
+		}
+		var timeStamp = this.getURLTimeStamp(aURLString);
+		var dir = this.getURLCacheDirFromTimeStamp(aURLString,timeStamp);
+		if(!aForced && dir && dir.exists()) return false;
+		var self = this;
+		setTimeout(function(){
+			var cache = new bitsAutocacheDocument();
+			cache.exec(aForced);
+			cache.done();
+			cache = undefined;
+			self.disabledButton();
+			if(aRebuild) self.refresh(true);
+		},100);
+	},
+
+/////////////////////////////////////////////////////////////////////
+// TREE è¡šç€ºå¶åŸ¡é¢é£
+/////////////////////////////////////////////////////////////////////
+	get rowCount(){
+		return (this._cacheList?this._cacheList.length:0);
+	},
+	getCellText : function(row,column){
+		if(column.id == this.idTREE_ITITLE){
+			return this._cacheList[row].TITLE;
+		}else if(column.id == this.idTREE_IURL){
+			return this._cacheList[row].URL;
+		}else if(column.id == this.idTREE_IDATE){
+			if(!this._cacheList) return null;
+			if(this._cacheList[row].DATE.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/)){
+				return RegExp.$1+"/"+RegExp.$2+"/"+RegExp.$3+" "+RegExp.$4+":"+RegExp.$5+":"+RegExp.$6;
+			}else{
+				return this._cacheList[row].DATE;
+			}
+		}else if(column.id == this.idTREE_ICACHE){
+			return this._cacheList[row].CACHE_NUM;
+		}else if(column.id == this.idTREE_IMARKER){
+			return this._cacheList[row].MARKER_NUM;
+		}else if(column.id == this.idTREE_ICACHESIZE){
+			return this.Common.formatFileSize(this._cacheList[row].CACHE_SIZE);
+		}else{
+			return null;
+		}
+	},
+	setTree: function(treebox){ this.treebox = treebox; },
+	isContainer: function(row){ return false; },
+	isSeparator: function(row){ return false; },
+	isSorted: function(){ return true; },
+	getLevel: function(row){ return 0; },
+	getImageSrc: function(row,column){
+		var icon;
+		if(column.id != this.idTREE_IFAVICON) return icon;
+		if(!this._cacheList) return icon;
+		if(!this._cacheList[row]) return icon;
+		var info = this._cacheList[row];
+		var icon = null;
+		if(info && info.URL) icon = this.Database.getFavicon(info.URL);
+		if(!icon) icon = "chrome://markingcollection/skin/defaultFavicon.png";
+		return icon;
+	},
+	getRowProperties: function(row,prop){},
+	getCellProperties: function(row, column, prop) {
+		if(column.id == this.idTREE_IFAVICON){
+			var aserv=Components.classes["@mozilla.org/atom-service;1"].getService(Components.interfaces.nsIAtomService);
+			prop.AppendElement(aserv.getAtom("ItemView"));
+			if(this._cacheList[row]) prop.AppendElement(aserv.getAtom("ItemViewImage"));
+		}
+	},
+	getColumnProperties: function(column, element, prop) {},
+	cycleHeader : function(col){},
+	setCellText : function(row,column,text){},
+  getParentIndex: function(idx) { return -1; },
+	canDrop : function(index, orient){ return false; },
+	drop : function(row, orient){},
+	selectRowFromURL : function(aURLString){
+		var rtn = false;
+		try{
+			if(!aURLString || !this.TREE || !this.TREE.view) return rtn;
+			aURLString = this.convertCacheURLToOriginalURL(aURLString);
+			var row = this._cacheList2URL[aURLString];
+			if(row != undefined){
+				this.TREE.currentIndex = row;
+				if(!this.TREE.view.selection.isSelected(this.TREE.currentIndex)) this.TREE.view.selection.select(this.TREE.currentIndex);
+				this.TREE.focus();
+				this.TREE.treeBoxObject.ensureRowIsVisible(this.TREE.currentIndex);
+				rtn = true;
+			}
+		}catch(e){
+			rtn = false;
+			bitsAutocacheService._dump("bitsAutocacheDocument.selectRowFromURL():"+e);
+		}
+		return rtn;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	refresh : function(aForced,aTimeout){
+		if(!this._refreshFlag) return;
+		var self = this;
+		if(self._refreshTimer) clearTimeout(self._refreshTimer);
+		self._refreshTimer = setTimeout(function(){ self._refresh(); },(aForced?0: (aTimeout!=undefined?aTimeout:250) ));
+	},
+	_refresh : function(){
+		if(!this.TREE) return;
+		var idx = this.TREE.currentIndex;
+		var rows = this.getSelection();
+		this.rebuild();
+		try{this.TREE.currentIndex=idx;}catch(e){}
+		if(!this._cacheList) return;
+		try{
+			var i;
+			for(i=0;i<rows.length;i++){
+				if(!this.TREE.view.selection.isSelected(rows[i])) this.TREE.view.selection.select(rows[i]);
+			}
+		}catch(e){}
+		this.TREE.blur();
+		this.TREE.focus();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	rebuild : function(){
+		if(!this.TREE) return;
+		try{this.TREE.currentIndex = -1;}catch(e){}
+		try{this.TREE.view.selection.clearSelection();}catch(e){}
+		if(this._cacheList){
+			this._cacheList.length = 0;
+			this._cacheList = undefined;
+			this._cacheList2URL = undefined;
+		}
+		this.TREE.removeAttribute("flex");
+		try{
+			var urlsdb = this._selectUrlDB();
+			if(urlsdb){
+				var i;
+				var j;
+				for(i=0;i<urlsdb.length;i++){
+					var histsdb = this._selectHistoryDB({uid_url : urlsdb[i].uid_url});
+					if(histsdb){
+						var info = {
+							URL        : urlsdb[i].uid_url,
+							TITLE      : histsdb[0].hid_title,
+							INDEX      : histsdb[0].hid_file,
+							PATH       : histsdb[0].hid_path,
+							DATE       : histsdb[0].hid_date,
+							CACHE_NUM  : histsdb.length,
+							CACHE_SIZE : 0,
+							MARKER_NUM : 0
+						};
+						if(urlsdb[i].uid_url){
+							var objcnt;
+							for(objcnt=0;objcnt<histsdb.length;objcnt++){
+								if(histsdb[objcnt].hid_date.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/)){
+									var item_date = RegExp.$2+"/"+RegExp.$3+"/"+RegExp.$1+" "+RegExp.$4+":"+RegExp.$5+":"+RegExp.$6;
+									var objs = this.Database.getObject({doc_url : urlsdb[i].uid_url, oid_date : item_date});
+									if(objs) info.MARKER_NUM += objs.length;
+								}
+								info.CACHE_SIZE += parseInt(histsdb[objcnt].hid_filesize);
+							}
+						}
+						if(!this._cacheList) this._cacheList = [];
+						this._cacheList.push(info);
+					}
+				}
+			}
+		}catch(e){
+			this._dump("bitsAutocacheService.rebuild():"+e);
+			this._cacheList = undefined;
+			this._cacheList2URL = undefined;
+		}
+		if(this._cacheList){
+			if(this.VSB.checked && this.VSM.value != ""){
+				var regexp = new RegExp(this.VSM.value,"img");
+				this._cacheList = this._cacheList.filter(
+					function(element, index, array) {
+						return regexp.test(element.TITLE) || regexp.test(element.URL);
+					}
+				);
+			}
+			var self = this;
+			this._cacheList.sort(
+				function(a,b){
+					var direction = "";
+					if(
+						self.TREE_IFAVICON.hasAttribute("sortDirection") ||
+						self.TREE_IURL.hasAttribute("sortDirection")
+					){
+						if(self.TREE_IFAVICON.hasAttribute("sortDirection")){
+							direction = self.TREE_IFAVICON.getAttribute("sortDirection");
+						}else if(self.TREE_IURL.hasAttribute("sortDirection")){
+							direction = self.TREE_IURL.getAttribute("sortDirection");
+						}
+						if(direction == "ascending"){
+							if(a.URL < b.URL) return -1;
+							if(a.URL > b.URL) return 1;
+						}else if(direction == "descending"){
+							if(a.URL < b.URL) return 1;
+							if(a.URL > b.URL) return -1;
+						}
+					}else if(self.TREE_ITITLE.hasAttribute("sortDirection")){
+						direction = self.TREE_ITITLE.getAttribute("sortDirection");
+						if(direction == "ascending"){
+							if(a.TITLE < b.TITLE) return -1;
+							if(a.TITLE > b.TITLE) return 1;
+						}else if(direction == "descending"){
+							if(a.TITLE < b.TITLE) return 1;
+							if(a.TITLE > b.TITLE) return -1;
+						}
+					}else if(self.TREE_IDATE.hasAttribute("sortDirection")){
+						direction = self.TREE_IDATE.getAttribute("sortDirection");
+						if(direction == "ascending"){
+							if(parseInt(a.DATE) < parseInt(b.DATE)) return -1;
+							if(parseInt(a.DATE) > parseInt(b.DATE)) return 1;
+						}else if(direction == "descending"){
+							if(parseInt(a.DATE) < parseInt(b.DATE)) return 1;
+							if(parseInt(a.DATE) > parseInt(b.DATE)) return -1;
+						}
+					}else if(self.TREE_ICACHE.hasAttribute("sortDirection")){
+						direction = self.TREE_ICACHE.getAttribute("sortDirection");
+						if(direction == "ascending"){
+							if(parseInt(a.CACHE_NUM) < parseInt(b.CACHE_NUM)) return -1;
+							if(parseInt(a.CACHE_NUM) > parseInt(b.CACHE_NUM)) return 1;
+						}else if(direction == "descending"){
+							if(parseInt(a.CACHE_NUM) < parseInt(b.CACHE_NUM)) return 1;
+							if(parseInt(a.CACHE_NUM) > parseInt(b.CACHE_NUM)) return -1;
+						}
+					}else if(self.TREE_IMARKER.hasAttribute("sortDirection")){
+						direction = self.TREE_IMARKER.getAttribute("sortDirection");
+						if(direction == "ascending"){
+							if(parseInt(a.MARKER_NUM) < parseInt(b.MARKER_NUM)) return -1;
+							if(parseInt(a.MARKER_NUM) > parseInt(b.MARKER_NUM)) return 1;
+						}else if(direction == "descending"){
+							if(parseInt(a.MARKER_NUM) < parseInt(b.MARKER_NUM)) return 1;
+							if(parseInt(a.MARKER_NUM) > parseInt(b.MARKER_NUM)) return -1;
+						}
+					}else if(self.TREE_ICACHESIZE.hasAttribute("sortDirection")){
+						direction = self.TREE_ICACHESIZE.getAttribute("sortDirection");
+						if(direction == "ascending"){
+							if(parseInt(a.CACHE_SIZE) < parseInt(b.CACHE_SIZE)) return -1;
+							if(parseInt(a.CACHE_SIZE) > parseInt(b.CACHE_SIZE)) return 1;
+						}else if(direction == "descending"){
+							if(parseInt(a.CACHE_SIZE) < parseInt(b.CACHE_SIZE)) return 1;
+							if(parseInt(a.CACHE_SIZE) > parseInt(b.CACHE_SIZE)) return -1;
+						}
+					}else{
+						if(parseInt(a.DATE) < parseInt(b.DATE)) return 1;
+						if(parseInt(a.DATE) > parseInt(b.DATE)) return -1;
+					}
+					return 0;
+				}
+			);
+			this.TREE.setAttribute("flex","1");
+			if(!this._cacheList2URL) this._cacheList2URL = {};
+			var i;
+			for(i=0;i<this._cacheList.length;i++){
+				if(!this._cacheList[i].URL) continue;
+				this._cacheList2URL[this._cacheList[i].URL] = i;
+			}
+		}
+		this.TREE.setAttribute("hidden",true);
+		if(this.TREE.hasAttribute("flex")){
+			var self = this;
+			setTimeout(function(){
+				if(!self.TREE) return;
+				self.TREE.view = self;
+				self.TREE.removeAttribute("hidden");
+				self.VSB.removeAttribute("disabled");
+				if(self.VSB.hasAttribute("checked")) self.VSM.removeAttribute("disabled");
+			},0);
+		}else{
+			this.VSB.setAttribute("disabled",true);
+			this.VSM.setAttribute("disabled",true);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getSelection : function(){
+		if(!this.TREE || !this.TREE.view) return undefined;
+		var ret = [];
+		var rc;
+		var i;
+		for(rc=0;rc<this.TREE.view.selection.getRangeCount();rc++){
+			var start = {}, end = {};
+			this.TREE.view.selection.getRangeAt(rc, start, end);
+			for(i=start.value;i<= end.value;i++){
+				if(!this.TREE.view.selection.isSelected(i)) continue;
+				ret.push(i);
+			}
+		}
+		return ret;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onSearchButtonCommand : function(aEvent){
+		var self = this;
+		var checked = this.VSB.hasAttribute("checked");
+		if(checked){
+			this.VSM.removeAttribute("disabled");
+			setTimeout(function(){
+				self.VSM.focus();
+				self.refresh();
+			},0);
+		}else{
+			this.VSM.blur();
+			this.VSM.setAttribute("disabled","true");
+			setTimeout(function(){
+				self.refresh();
+			},0);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onSearchKeyPress : function(aEvent){
+		switch(aEvent.keyCode){
+			case aEvent.DOM_VK_RETURN :
+				this.refresh();
+				break;
+			default:
+				break;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+// TREE ã€ãã³ãé¢é£
+/////////////////////////////////////////////////////////////////////
+	onClick : function(aEvent){
+		if(aEvent.button != 0) return;
+		if(aEvent.altKey || aEvent.shiftKey || aEvent.ctrlKey) return;
+		if(aEvent.target.id){
+			if(aEvent.target.id != this.idTREE_IFAVICON)   this.TREE_IFAVICON.removeAttribute("sortDirection");
+			if(aEvent.target.id != this.idTREE_IURL)       this.TREE_IURL.removeAttribute("sortDirection");
+			if(aEvent.target.id != this.idTREE_ITITLE)     this.TREE_ITITLE.removeAttribute("sortDirection");
+			if(aEvent.target.id != this.idTREE_IDATE)      this.TREE_IDATE.removeAttribute("sortDirection");
+			if(aEvent.target.id != this.idTREE_ICACHE)     this.TREE_ICACHE.removeAttribute("sortDirection");
+			if(aEvent.target.id != this.idTREE_IMARKER)    this.TREE_IMARKER.removeAttribute("sortDirection");
+			if(aEvent.target.id != this.idTREE_ICACHESIZE) this.TREE_ICACHESIZE.removeAttribute("sortDirection");
+			if(!aEvent.target.hasAttribute("sortDirection")){
+				aEvent.target.setAttribute("sortDirection","ascending");
+			}else if(aEvent.target.getAttribute("sortDirection") == "ascending"){
+				aEvent.target.setAttribute("sortDirection","descending");
+			}else{
+				aEvent.target.removeAttribute("sortDirection");
+			}
+			this.refresh(true);
+			return;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onDblClick : function(aEvent){
+		if(aEvent.button != 0) return;
+		if(aEvent.altKey) return;
+		var row = {};
+		var col = {};
+		var obj = {};
+		this.TREE.treeBoxObject.getCellAt(aEvent.clientX, aEvent.clientY, row, col, obj);
+		if(row.value<0){
+			this.TREE.view.selection.clearSelection();
+			return;
+		}
+		this.open(aEvent);
+	},
+
+	open : function(aEvent){
+		if(this.bitsItemView && this.bitsItemView.isChecked){
+			this.bitsItemView.TREE.currentIndex = -1;
+			try{this.bitsItemView.TREE.view.selection.clearSelection();}catch(e){}
+		}else if(this.mcTreeHandler){
+			var curIdx = this.mcTreeHandler.TREE.currentIndex;
+			if(curIdx>=0 && !this.mcTreeHandler.TREE.view.isContainer(curIdx)){
+				this.mcTreeHandler.TREE.currentIndex = -1;
+				try{this.mcTreeHandler.TREE.view.selection.clearSelection();}catch(e){}
+			}
+		}
+
+		try{
+			var cacheinfo = this._cacheList[this.TREE.currentIndex];
+			var dir = this.getURLCacheDirFromTimeStamp(cacheinfo.URL,cacheinfo.DATE);
+			if(!dir || !dir.exists()){
+				var histsdb = this._selectHistoryDB({uid_url:cacheinfo.URL,hid_date:cacheinfo.DATE});
+				if(histsdb) dir = this.Common.convertURLToFile(histsdb[0].hid_path);
+			}
+			if(!dir || !dir.exists()) return;
+			var doc = this.gBrowser.contentDocument;
+			var cur_uri = this.Common.getURLStringFromDocument(this.gBrowser.contentDocument);
+			var res_uri = this.Common.convertFilePathToURL(dir.parent.path);
+			var aTabbed = false;
+			var loadFlag = false;
+			if(aTabbed) loadFlag = aTabbed;
+			if(!aTabbed){
+				if(this.gBrowser.browsers.length == 1 && res_uri != "" && cur_uri.indexOf(res_uri)<0){
+					loadFlag = true;
+				}else if(cur_uri == res_uri){
+					loadFlag = false;
+				}else{
+					loadFlag = true;
+					var i;
+					for(i=0;i<this.gBrowser.browsers.length;i++){
+						var doc = this.gBrowser.browsers[i].contentDocument;
+						var cur_uri = this.Common.getURLStringFromDocument(doc);
+						if(cur_uri.indexOf(res_uri)>=0){
+							if(cur_uri == res_uri) loadFlag = false;
+							this.gBrowser.tabContainer.selectedIndex = i;
+							break;
+						}
+					}
+				}
+				aTabbed = aEvent.shiftKey | aEvent.ctrlKey;
+			}
+			if(loadFlag){
+				if(cacheinfo && cacheinfo.INDEX){
+					var indexFile = dir.clone();
+					indexFile.append(cacheinfo.INDEX);
+					if(indexFile.exists()){
+						var indexURLString = this.Common.convertFilePathToURL(indexFile.path);
+						if(indexURLString){
+							this.Common.loadURL(indexURLString,aTabbed);
+							this._isOpenCache = indexURLString;
+						}
+					}
+				}
+			}
+			aEvent.stopPropagation();
+		}catch(e){
+			this._dump("bitsAutocacheService.onDblClick():"+e);
+		}
+	},
+
+	remove : function(aEvent){
+		var sellist = this.getSelection();
+		var self = this;
+		setTimeout(function(){
+			if(!self.Common.confirm( self.STRING.getString("CONFIRM_DELETE") )) return;
+			if(sellist){
+				var i,j;
+				for(i=0;i<sellist.length;i++){
+					var basedir = null;
+					var cacheinfo = self._cacheList[sellist[i]];
+					if(!cacheinfo || !cacheinfo.URL) continue;
+					var histddb = self._selectHistoryDB({uid_url:cacheinfo.URL});
+					if(histddb){
+						for(j=0;j<histddb.length;j++){
+							var histdir = self.Common.convertURLToFile(histddb[j].hid_path);
+							if(!histdir || !histdir.exists()) continue;
+							try{ histdir.remove(true); }catch(e){}
+							var parent = histdir.parent.clone();
+							while(!self.Common.hasDirChilds(parent)){
+								var n_parent = parent.parent.clone();
+								try{ parent.remove(true); }catch(e){break;}
+								parent = n_parent;
+							}
+						}
+					}
+					self._deleteUrlDB({uid_url:cacheinfo.URL});
+				}
+			}
+			self.refresh();
+		},0);
+		aEvent.stopPropagation();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onKeyPress : function(aEvent){
+		switch(aEvent.keyCode){
+			case aEvent.DOM_VK_RETURN :
+				aEvent.preventDefault();
+				this.open(aEvent);
+				break;
+			case aEvent.DOM_VK_DELETE :
+				if(!(aEvent.ctrlKey || aEvent.shiftKey)){
+					aEvent.preventDefault();
+					this.remove(aEvent);
+				}
+				break;
+			default:
+				break;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onKeyDown : function(aEvent){
+		switch(aEvent.keyCode){
+			case aEvent.DOM_VK_A :
+				if(aEvent.ctrlKey){
+					aEvent.preventDefault();
+					this.TREE.view.selection.selectAll();
+				}
+				break;
+			default:
+				break;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+// 1 ãã€ãã«å¯ŸããŠ 2 ã€ã® 16 é²æ°ã³ãŒããè¿ãã
+/////////////////////////////////////////////////////////////////////
+	_toHexString : function(charCode){
+		return("0" + charCode.toString(16)).slice(-2);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_string2CryptoHash : function(aString){
+		if(aString == undefined || aString == "") return undefined;
+		try{
+			var str = aString;
+			var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
+			converter.charset = "UTF-8";
+			var result = {};
+			var data = converter.convertToByteArray(str, result);
+			var ch = Components.classes["@mozilla.org/security/hash;1"].createInstance(Components.interfaces.nsICryptoHash);
+			ch.init(ch.MD5);
+			ch.update(data, data.length);
+			var hash = ch.finish(false);
+			var s = "";
+			var i;
+			for(i in hash){
+				if(typeof hash[i] == "function") continue;
+				s += this._toHexString(hash.charCodeAt(i));
+			}
+			var top = s.substr(0,2);
+			var regexp = new RegExp(top+"$","mg");
+			while(s.match(regexp)) s = s.replace(regexp,"");
+			return s;
+		}catch(ex){
+			return undefined;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	readFile : function(aFile){
+		if(!aFile || !aFile.exists()) return undefined;
+		try {
+			var istream = Components.classes['@mozilla.org/network/file-input-stream;1'].createInstance(Components.interfaces.nsIFileInputStream);
+			istream.init(aFile, 1, 0, false);
+			var sstream = Components.classes['@mozilla.org/scriptableinputstream;1'].createInstance(Components.interfaces.nsIScriptableInputStream);
+			sstream.init(istream);
+			var content = sstream.read(sstream.available());
+			sstream.close();
+			istream.close();
+			if(content.indexOf("%09")>=0){
+				content = unescape(content);
+			}else{
+				content = this.Common.convertToUnicode(content,"UTF-8");
+			}
+			return content;
+		}catch(ex){
+			this._dump("bitsAutocacheService ERROR: readFile():" + ex);
+			return undefined;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	writeFile : function(aFile, aContent){
+		if(aFile.exists()) aFile.remove(false);
+		try {
+			aFile.create(aFile.NORMAL_FILE_TYPE, 0666);
+			var content = this.Common.convertFormUnicode(aContent,"UTF-8");
+			var ostream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
+			ostream.init(aFile, 2, 0x200, false);
+			ostream.write(content, content.length);
+			ostream.close();
+		}catch(ex){
+			this._dump("bitsAutocacheService ERROR: Failed to write file: " + aFile.path + "["+ ex + "]");
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+// Databaseé¢é£
+/////////////////////////////////////////////////////////////////////
+	_getFileDB : function(){
+		var dbFile = this.Common.getExtensionDir().clone();
+		dbFile.append(this._dbName);
+		return dbFile;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_connectDB : function(){
+		var dbFile = this._getFileDB();
+		if(!this._dbConn && dbFile) this._dbConn = this.Common.STORAGE.openDatabase(dbFile);
+		this._createTableDB();
+		return (this._dbConn?true:false);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_disconnectDB : function(aVacuum){
+		var dbFile = this._dbConn.databaseFile.clone();
+		this._backupDB(dbFile);
+
+		if(aVacuum == undefined) aVacuum = false;
+		try{ if(aVacuum) this._vacuumDB(); }catch(ex){};
+		this._dbConn = undefined;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_vacuumDB : function(){
+		try{
+			this._dbConn.executeSimpleSQL("VACUUM");
+		}catch(ex){
+			this._dump("bitsAutocacheService.vacuumDB():"+ex);
+		};
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_backupDB : function(aFile){
+		try{
+			var bDir = bitsObjectMng.Common.getExtensionDir();
+			bDir.append("backup");
+			var aBackupFile = bDir.clone();
+			aBackupFile.append(aFile.leafName+".1");
+			if(aBackupFile.exists() && aFile.exists()){
+				if(aBackupFile.lastModifiedTime == aFile.lastModifiedTime) return;
+			}
+			for(var i=4;i>0;i--){
+				var aFile1 = bDir.clone();
+				aFile1.append(aFile.leafName+"."+i);
+				if(!aFile1.exists()) continue;
+				var aFile2 = bDir.clone();
+				aFile2.append(aFile.leafName+"."+(i+1));
+				if(aFile2.exists()) aFile2.remove(true);
+				aFile1.moveTo(aFile2.parent ,aFile2.leafName);
+			}
+			if(aBackupFile.exists()) aBackupFile.remove(true);
+			aFile.copyTo(aBackupFile.parent ,aBackupFile.leafName);
+		}catch(e){}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_createTableDB : function(){
+		var ourTransaction = false;
+		try{
+			var createTable = !this._dbConn.tableExists("om_url");
+			if(!createTable) createTable = !this._dbConn.tableExists("om_history");
+			if(!createTable) createTable = !this._dbConn.indexExists("om_url_idx_url");
+			if(!createTable) createTable = !this._dbConn.indexExists("om_history_idx_file");
+			if(!createTable) createTable = !this._dbConn.indexExists("om_history_idx_path");
+			if(!createTable) createTable = !this._dbConn.indexExists("om_history_idx_date");
+			if(createTable){
+				if(this._dbConn.transactionInProgress){
+					ourTransaction = true;
+					this._dbConn.beginTransactionAs(this._dbConn.TRANSACTION_DEFERRED);
+				}
+				if(!this._dbConn.tableExists("om_url")){
+					this._dbConn.executeSimpleSQL(
+						"CREATE TABLE om_url (" +
+						"  uid       INTEGER," +
+						"  uid_url   TEXT NOT NULL," +
+						"PRIMARY KEY (uid)"+
+						")"
+					);
+				}
+				if(!this._dbConn.tableExists("om_history")){
+					this._dbConn.executeSimpleSQL(
+						"CREATE TABLE om_history (" +
+						"  uid          INTEGER," +
+						"  hid          INTEGER," +
+						"  hid_file     TEXT NOT NULL," +
+						"  hid_path     TEXT NOT NULL," +
+						"  hid_title    TEXT," +
+						"  hid_date     TEXT NOT NULL," +
+						"  hid_filesize INTEGER," +
+						"PRIMARY KEY (uid,hid)"+
+						")"
+					);
+				}
+				try{if(!this._dbConn.indexExists("om_url_idx_url"))      this._dbConn.executeSimpleSQL("CREATE INDEX om_url_idx_url      ON om_url(uid_url);");     }catch(ex){}
+				try{if(!this._dbConn.indexExists("om_history_idx_file")) this._dbConn.executeSimpleSQL("CREATE INDEX om_history_idx_file ON om_history(hid_file);");}catch(ex){}
+				try{if(!this._dbConn.indexExists("om_history_idx_path")) this._dbConn.executeSimpleSQL("CREATE INDEX om_history_idx_path ON om_history(hid_path);");}catch(ex){}
+				try{if(!this._dbConn.indexExists("om_history_idx_date")) this._dbConn.executeSimpleSQL("CREATE INDEX om_history_idx_date ON om_history(hid_date);");}catch(ex){}
+			}
+		}
+		finally {
+			if(this._dbConn.lastError) this._dump("bitsAutocacheService._createTableDB():"+this._dbConn.lastErrorString+" ("+this._dbConn.lastError+")");
+			if(ourTransaction){
+				this._dbConn.rollbackTransaction();
+				ourTransaction = false;
+			}
+		}
+		if(ourTransaction) this._dbConn.commitTransaction();
+		if(createTable){
+			if(!this._dbConn.tableExists("om_url")) return false;
+			if(!this._dbConn.tableExists("om_history")) return false;
+			if(!this._dbConn.indexExists("om_url_idx_url")) return false;
+			return true;
+		}else{
+			return false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_setStatementValueDB : function(aStatement,aIndex,aValue,aType) {
+		try{
+			if(aType == undefined) aType = aStatement.VALUE_TYPE_TEXT;
+			if(aValue == undefined){
+				aStatement.bindNullParameter(aIndex);
+			}else{
+				switch(aType){
+					case aStatement.VALUE_TYPE_INTEGER :
+					case aStatement.VALUE_TYPE_FLOAT :
+					case aStatement.VALUE_TYPE_TEXT :
+						aStatement.bindUTF8StringParameter(aIndex,aValue);
+						break;
+					case aStatement.VALUE_TYPE_BLOB :
+						aStatement.bindBlobParameter(aIndex,aValue,aValue.length);
+						break;
+					default :
+						break;
+				}
+			}
+		}catch(e){
+			bitsObjectMng._dump("bitsAutocacheService._setStatementValueDB():"+e);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_selectDB : function(aSql,aPara){
+		var ourTransaction = false;
+		if(this._dbConn.transactionInProgress){
+			ourTransaction = true;
+			this._dbConn.beginTransactionAs(this._dbConn.TRANSACTION_DEFERRED);
+		}
+		var i;
+		try{
+			var statement = this._dbConn.createStatement(aSql);
+			if(aPara){
+				var i;
+				for(i=0;i<aPara.length;i++){
+					this._setStatementValueDB(statement,i,aPara[i]);
+				}
+			}
+			var k=statement.columnCount;
+			var columnNames = [];
+			for(i=0;i<k;i++){
+				columnNames.push(statement.getColumnName(i));
+			}
+		}catch(ex){
+			this._dump("bitsAutocacheService._selectDB(1):"+ex);
+			this._dump("bitsAutocacheService._selectDB():aSql="+aSql);
+			return null;
+		}
+		var dataset = [];
+		try{
+			while(statement.executeStep()){
+				var row = {};
+				var utf8String;
+				for(i=0;i<k;i++){
+					utf8String = statement.getUTF8String(i);
+					row[columnNames[i]] = utf8String ? utf8String : "";
+				}
+				dataset.push(row);
+			}
+			columnNames = undefined;
+		}finally {
+			if(this._dbConn.lastError > 0 && this._dbConn.lastError <= 100){
+				this._dump("bitsAutocacheService._selectDB(3):"+this._dbConn.lastErrorString+" ("+this._dbConn.lastError+")\n\n"+aSql);
+			}
+			if(this._dbConn.lastError && this._dbConn.lastError != 101){
+				this._dump("bitsAutocacheService._selectDB(2):"+this._dbConn.lastErrorString+" ("+this._dbConn.lastError+")\n\n"+aSql);
+				dataset = null;
+			}
+			if(ourTransaction && this._dbConn.lastError && this._dbConn.lastError != 101){
+				this._dbConn.rollbackTransaction();
+				ourTransaction = false;
+			}
+			statement.reset();
+		}
+		if(ourTransaction) this._dbConn.commitTransaction();
+		return dataset;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_cmdDB : function(aSql,aPara){
+		var rtn = true;
+		var ourTransaction = false;
+		if(this._dbConn.transactionInProgress){
+			ourTransaction = true;
+			this._dbConn.beginTransactionAs(this._dbConn.TRANSACTION_DEFERRED);
+		}
+		try{
+			var statement = this._dbConn.createStatement(aSql);
+			if(aPara){
+				var i;
+				for(i=0;i<aPara.length;i++){
+					this._setStatementValueDB(statement,i,aPara[i]);
+				}
+			}
+		}catch(ex){
+			this._dump("bitsAutocacheService._cmdDB():"+ex);
+			this._dump("bitsAutocacheService._cmdDB():aSql="+aSql);
+			return false;
+		}
+		try{
+			statement.execute();
+		}finally {
+			if(this._dbConn.lastError){
+				this._dump("bitsAutocacheService._cmdDB():"+this._dbConn.lastErrorString+" ("+this._dbConn.lastError+")");
+				this._dump("bitsAutocacheService._cmdDB():aSql="+aSql);
+				rtn = false;
+			}
+			if(ourTransaction && this._dbConn.lastError){
+				this._dbConn.rollbackTransaction();
+				ourTransaction = false;
+			}
+			statement.reset();
+		}
+		if(ourTransaction) this._dbConn.commitTransaction();
+		return rtn;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_uidExistsDB : function(aUID){
+		var fSql = 'select count(uid) as uid_num from om_url where uid=?1';
+		var fRtn = this._selectDB(fSql,[aUID]);
+		return ((fRtn && fRtn[0].uid_num>0)?true:false);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_urlExistsDB : function(aURL){
+		var fSql = 'select count(uid_url) as uid_num from om_url where uid_url=?1';
+		var fRtn = this._selectDB(fSql,[aURL]);
+		return ((fRtn && fRtn[0].uid_num>0)?true:false);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_hidExistsDB : function(aHID){
+		var fSql = 'select count(hid) as hid_num from om_history where hid=?1';
+		var fRtn = this._selectDB(fSql,[aHID]);
+		return ((fRtn && fRtn[0].hid_num>0)?true:false);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_uidIdentifyDB : function(aUID){
+		var i = 0;
+		while(this._uidExistsDB(aUID) && i < 100){
+			aUID = this.Common.getTimeStamp(--i);
+		}
+		return aUID;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_hidIdentifyDB : function(aHID){
+		var i = 0;
+		while(this._hidExistsDB(aHID) && i < 100){
+			aHID = this.Common.getTimeStamp(--i);
+		}
+		return aHID;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_insertInitDB : function(){
+		var basedir = this.cachedir.clone();
+		if(!basedir.exists() || !basedir.directoryEntries) return;
+		var dir_arr = [];
+		var entries = basedir.directoryEntries;
+		while(entries.hasMoreElements()){
+			var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+			if(!entry.isDirectory() || (entry.isDirectory() && entry.leafName.match(/^\./))) continue;
+			if(entry.leafName.match(/^[0-9]{4}$/)) continue; //å€ææžã¿ã®ãã£ã¬ã¯ããªã¯ãã¹
+			dir_arr.push(entry);
+		}
+		setTimeout(function(){ bitsAutocacheService._insertInitDB_exec(dir_arr); },100);
+	},
+
+	_insertInitDB_exec : function(aDirArray){
+		if(!aDirArray || aDirArray.length == 0){
+			this.refresh();
+			return;
+		}
+		var entry = aDirArray.shift();
+		var temp_arr = [];
+		var temp_entries = entry.directoryEntries;
+		while(temp_entries.hasMoreElements()){
+			var temp_entry = temp_entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+			if(!temp_entry.isDirectory() || (temp_entry.isDirectory() && temp_entry.leafName.match(/^\./))) continue;
+			temp_arr.push(temp_entry);
+		}
+		if(temp_arr.length>0){
+			temp_arr.sort(function(a, b) { return(parseInt(a.leafName) - parseInt(b.leafName)); });
+			var i;
+			var info;
+			for(i=0;i<temp_arr.length;i++){
+				info = this._getSaveCacheInfo(temp_arr[i].clone());
+				if(!info || !info.URL){
+					info = undefined;
+					continue;
+				}
+				info.DIR = entry.clone();
+				info.DATE = temp_arr[0].leafName;
+				break;
+			}
+			if(info && info.URL){
+				info.URL = info.URL.replace(/^\s*/mg,"").replace(/\s*$/mg,"");
+				var urldbs = this._selectUrlDB({uid_url : info.URL});
+				if(!urldbs){
+					this._insertUrlDB({
+						uid       : info.DATE,
+						uid_url   : info.URL,
+					});
+					urldbs = this._selectUrlDB({uid_url : info.URL});
+				}
+				if(urldbs){
+					var urldb = urldbs[0];
+					for(i=0;i<temp_arr.length;i++){
+						var temp_info = this._getSaveCacheInfo(temp_arr[i].clone());
+						if(!temp_info || !temp_info.URL){
+							temp_info = undefined;
+							continue;
+						}
+						temp_info.DIR = entry.clone();
+						temp_info.DATE = temp_arr[i].leafName;
+						var rtn = this._insertHistoryDB({
+							uid          : urldb.uid,
+							hid          : temp_info.DATE,
+							hid_file     : temp_info.INDEX,
+							hid_path     : this.Common.convertFilePathToURL(temp_arr[i].path),
+							hid_title    : temp_info.TITLE,
+							hid_date     : temp_info.DATE,
+							hid_filesize : this.Common.getFilesize(temp_arr[i]),
+						});
+					}
+				}
+				var histdbs = this._selectHistoryDB({
+					uid_url : info.URL
+				});
+				if(histdbs){
+					for(i=0;i<histdbs.length;i++){
+						var dir = this.getURLCacheDir(histdbs[i].uid_url);
+						if(!dir || !dir.exists()) continue;
+						var approximateCacheTimeStamp = this.getApproximateCacheTimeStamp(histdbs[i].uid_url,histdbs[i].hid_date);
+						if(approximateCacheTimeStamp){
+							dir.append(approximateCacheTimeStamp);
+							if(!dir || !dir.exists()) continue;
+						}else{
+							continue;
+						}
+						var newDir = this.getURLCacheDirFromTimeStamp(histdbs[i].uid_url,histdbs[i].hid_date);
+						this._updateHistoryDB({
+							uid      : histdbs[i].uid,
+							hid      : histdbs[i].hid,
+							hid_path : this.Common.convertFilePathToURL(newDir.path),
+						});
+						if(newDir.exists()){
+							dir.remove(true);
+							continue;
+						}
+						if(!newDir.parent.exists()) newDir.parent.create(newDir.DIRECTORY_TYPE, 0777);
+						dir.moveTo(newDir.parent,newDir.leafName);
+					}
+				}
+				var dir = this.getURLCacheDir(info.URL);
+				if(dir && dir.exists()){
+					var histnum = 0;
+					var temp_entries = dir.directoryEntries;
+					while(temp_entries.hasMoreElements()){
+						var temp_entry = temp_entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+						if(!temp_entry.isDirectory() || (temp_entry.isDirectory() && temp_entry.leafName.match(/^\./))) continue;
+						histnum++;
+					}
+					if(histnum == 0) dir.remove(true);
+				}
+			}
+		}
+		temp_arr = undefined;
+		setTimeout(function(){ bitsAutocacheService._insertInitDB_exec(aDirArray); },100);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_insertUrlDB : function(aUrlObject){
+		try{
+			if(!aUrlObject) return false;
+			if(!aUrlObject.uid_url) return false;
+			var rtn = true;
+			if(aUrlObject.uid == undefined){
+				aUrlObject.uid = this._uidIdentifyDB(this.Common.getTimeStamp());
+			}else{
+				if(this._uidExistsDB(aUrlObject.uid)) return false;
+			}
+			if(this._urlExistsDB(aUrlObject.uid_url)) return false;
+			var columns = [];
+			var values = [];
+			var para = [];
+			var index=0;
+			var key;
+			for(key in aUrlObject){
+				if(!aUrlObject[key] || aUrlObject[key] == "") continue;
+				columns.push(key);
+				values.push('?'+(++index));
+				para.push(aUrlObject[key]);
+			}
+			if(columns.length == 0) rtn = false;
+			if(rtn){
+				var aSql = "insert into om_url ("+ columns.join(",") +") values ("+ values.join(",") +")";
+				rtn = this._cmdDB(aSql,para);
+				if(!rtn) this._dump("bitsAutocacheService._insertUrlDB():aSql="+aSql);
+			}
+		}catch(ex){
+			this._dump("bitsAutocacheService._insertUrlDB():"+ex);
+		}
+		return rtn;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_selectUrlDB : function(aUrlObject){
+		try{
+			var para = [];
+			var where = [];
+			var key;
+			var index=0;
+			if(aUrlObject){
+				for(key in aUrlObject){
+					where.push("om_url."+key+"=?"+(++index));
+					para.push(aUrlObject[key]);
+				}
+			}
+			var oSql = 'select' +
+								' om_url.uid' +
+								',om_url.uid_url' +
+								' from om_url';
+			if(where.length>0) oSql += " where " + where.join(" and ");
+			var oFld = this._selectDB(oSql,para);
+			if(oFld && oFld.length>0)
+				return oFld;
+			else
+				return null;
+		}catch(ex){
+			this._dump("bitsAutocacheService._selectUrlDB():"+ex);
+			return null;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_updateUrlDB : function(aUrlObject){
+		if(!aUrlObject) return false;
+		if(!aUrlObject.uid && !aUrlObject.uid_url) return false;
+		try{
+			var rtn = true;
+			var om_link = {};
+			var values = [];
+			var para = [];
+			var index=0;
+			var key;
+			for(key in aUrlObject){
+				if(aUrlObject[key] == undefined || key == "uid" || key == "uid_url") continue;
+				values.push(key+'=?'+(++index));
+				para.push(aUrlObject[key]);
+			}
+			if(rtn && values.length>0){
+				var aSql = 'update om_url set '+ values.join(",");
+				var where = [];
+				if(aUrlObject.uid){
+					where.push("uid=?"+(++index));
+					para.push(aUrlObject.uid);
+				}
+				if(aUrlObject.uid_url){
+					where.push("uid_url=?"+(++index));
+					para.push(aUrlObject.uid_url);
+				}
+				if(where.length>0) aSql += " where " + where.join(" and ");
+				rtn = this._cmdDB(aSql,para);
+			}
+			return rtn;
+		}catch(ex){
+			this._dump("bitsAutocacheService._updateUrlDB():"+ex);
+			return false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_deleteUrlDB : function(aUrlObject){
+		if(!aUrlObject) return false;
+		if(!aUrlObject.uid && !aUrlObject.uid_url) return false;
+		if(!aUrlObject.uid){
+			var urldbs = this._selectUrlDB(aUrlObject);
+			if(urldbs) aUrlObject.uid = urldbs[0].uid;
+		}
+		if(!aUrlObject.uid) return false;
+		if(!this._deleteHistoryDB({uid:aUrlObject.uid})) return false;
+		try{
+			var para = [];
+			var where = [];
+			var key;
+			var index=0;
+			if(aUrlObject){
+				for(key in aUrlObject){
+					where.push("om_url."+key+"=?"+(++index));
+					para.push(aUrlObject[key]);
+				}
+			}
+			var oSql = 'delete from om_url';
+			if(where.length>0) oSql += " where " + where.join(" and ");
+			return this._cmdDB(oSql,para);
+		}catch(ex){
+			this._dump("bitsAutocacheService._deleteUrlDB():"+ex);
+			return false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_insertHistoryDB : function(aHistObject){
+		try{
+			if(!aHistObject) return false;
+			if(aHistObject.uid == undefined) return false;
+			if(!this._uidExistsDB(aHistObject.uid)) return false;
+			if(aHistObject.hid == undefined){
+				aHistObject.hid = this._hidIdentifyDB(this.Common.getTimeStamp());
+			}else{
+				if(this._hidExistsDB(aHistObject.hid)) return false;
+			}
+			var columns = [];
+			var values = [];
+			var para = [];
+			var index=0;
+			var key;
+			for(key in aHistObject){
+				if(!aHistObject[key] || aHistObject[key] == "") continue;
+				columns.push(key);
+				values.push('?'+(++index));
+				para.push(aHistObject[key]);
+			}
+			var rtn = (columns.length == 0)?false:true;
+			if(rtn){
+				var aSql = "insert into om_history ("+ columns.join(",") +") values ("+ values.join(",") +")";
+				rtn = this._cmdDB(aSql,para);
+				if(!rtn) this._dump("bitsAutocacheService._insertHistoryDB():aSql="+aSql);
+			}
+		}catch(ex){
+			this._dump("bitsAutocacheService._insertHistoryDB():"+ex);
+			rtn = false;
+		}
+		return rtn;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_selectHistoryDB : function(aHistObject){
+		try{
+			var para = [];
+			var where = [];
+			var key;
+			var index=0;
+			if(aHistObject){
+				if(aHistObject.hid_date && aHistObject.hid_date.match(/^(\d{2})\/(\d{2})\/(\d{4})\s+(\d{2}):(\d{2}):(\d{2})$/)) aHistObject.hid_date = RegExp.$3 + RegExp.$1 + RegExp.$2 + RegExp.$4 + RegExp.$5 + RegExp.$6;
+				for(key in aHistObject){
+					if(key == "uid_url"){
+						where.push("om_url."+key+"=?"+(++index));
+					}else{
+						where.push("om_history."+key+"=?"+(++index));
+					}
+					para.push(aHistObject[key]);
+				}
+			}
+			var oSql = 'select' +
+				' om_url.uid' +
+				',om_url.uid_url' +
+				',om_history.hid' +
+				',om_history.hid_file' +
+				',om_history.hid_path' +
+				',om_history.hid_title' +
+				',om_history.hid_date' +
+				',om_history.hid_filesize' +
+				' from om_history' +
+				' LEFT JOIN om_url ON om_url.uid = om_history.uid';
+			if(where.length>0) oSql += " where " + where.join(" and ");
+			oSql += ' order by om_history.hid_date desc';
+			var oFld = this._selectDB(oSql,para);
+			if(oFld && oFld.length>0)
+				return oFld;
+			else
+				return null;
+		}catch(ex){
+			this._dump("bitsAutocacheService._selectHistoryDB():"+ex);
+			return null;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_updateHistoryDB : function(aHistObject){
+		if(!aHistObject) return false;
+		if(!aHistObject.uid && !aHistObject.hid) return false;
+		try{
+			var rtn = true;
+			var values = [];
+			var para = [];
+			var index=0;
+			var key;
+			for(key in aHistObject){
+				if(aHistObject[key] == undefined || key == "uid" || key == "uid_url" || key == "hid") continue;
+				values.push(key+'=?'+(++index));
+				para.push(aHistObject[key]);
+			}
+			if(rtn && values.length>0){
+				var aSql = 'update om_history set '+ values.join(",");
+				var where = [];
+				if(aHistObject.uid){
+					where.push("uid=?"+(++index));
+					para.push(aHistObject.uid);
+				}
+				if(aHistObject.hid){
+					where.push("hid=?"+(++index));
+					para.push(aHistObject.hid);
+				}
+				if(where.length>0) aSql += " where " + where.join(" and ");
+				rtn = this._cmdDB(aSql,para);
+			}
+			return rtn;
+		}catch(ex){
+			this._dump("bitsAutocacheService._updateUrlDB():"+ex);
+			return false;
+		}
+	},
+/////////////////////////////////////////////////////////////////////
+	_deleteHistoryDB : function(aHistObject){
+		if(!aHistObject) return false;
+		if(!aHistObject.uid && !aHistObject.hid) return false;
+		try{
+			var para = [];
+			var where = [];
+			var key;
+			var index=0;
+			if(aHistObject){
+				for(key in aHistObject){
+					where.push("om_history."+key+"=?"+(++index));
+					para.push(aHistObject[key]);
+				}
+			}
+			var oSql = 'delete from om_history';
+			if(where.length>0) oSql += " where " + where.join(" and ");
+			return this._cmdDB(oSql,para);
+		}catch(ex){
+			this._dump("bitsAutocacheService._deleteHistoryDB():"+ex);
+			return false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+};
+
+/////////////////////////////////////////////////////////////////////
+function bitsAutocacheDocument(aAutocacheDir) {
+	this.document = null;
+	this._name = "";
+	this.dataDirName = null;
+	this.AutocacheDir = null;
+	if(aAutocacheDir) this.AutocacheDir = aAutocacheDir;
+	this._id = null;
+	this._treeRes = null;
+	this._url2autocache = [];
+	this.oid = null;
+	this.oldURL2newURL = [];
+	this.scrollhref = "";
+	this.scrollWin = [];
+	this.AutocacheURL = [];
+	this.item = this.Common.newItem(this.DataSource.identify(this.Common.getTimeStamp()));
+	this.file2URL = [];
+	this.httpTask = [];
+	this.linkURLs = [];
+	this.frameList = [];
+	this.frameNumber = 0;
+	this.fileNumber = 0;
+	this.httpTask[this.item.id] = 0;
+	this.basedir = bitsAutocacheService.cachedir;
+	if(!this.basedir.exists()) this.basedir.create(this.basedir.DIRECTORY_TYPE, 0777);
+};
+
+bitsAutocacheDocument.prototype = {
+	get SAVEMODE_FILEONLY()     { return 0x00 },
+	get SAVEMODE_COMPLETE_DOM() { return 0x01 },
+	get SAVEMODE_COMPLETE_TEXT(){ return 0x02 },
+
+	get STRING() { return document.getElementById("bitsAutocacheString"); },
+
+	get DataSource() { return bitsObjectMng.DataSource; },
+	get Common()     { return bitsObjectMng.Common;     },
+	get XPath()      { return bitsObjectMng.XPath;      },
+	get Database()   { return bitsObjectMng.Database;   },
+	get gBrowser()   { return bitsObjectMng.getBrowser();},
+
+	get name() {
+		return this._name;
+	},
+	set name(aName) {
+		if(aName && aName != ""){
+			this.dataDirName = aName + "_files";
+		}else{
+			this.dataDirName = null;
+		}
+		return this._name = aName;
+	},
+
+	get id() {
+		return this._id;
+	},
+	set id(aID) {
+		return this._id = aID;
+	},
+
+	get treeRes() { return this._treeRes; },
+	set treeRes(aRes) { return this._treeRes = aRes; },
+
+	get autocache() {
+		var autocache = bitsMarkingCollection.getExtensionDir();
+		if(!autocache.exists()) autocache.create(autocache.DIRECTORY_TYPE, 0777);
+		autocache.append("autocache");
+		if(!autocache.exists()) autocache.create(autocache.DIRECTORY_TYPE, 0777);
+		return autocache;
+	},
+
+	get defaultdir() {
+		return this.basedir.clone();
+	},
+
+	Autocachedir : function(aClass) {
+		if(this.AutocacheDir) return this.AutocacheDir.clone();
+		var dir;
+		if(bitsAutocacheService.prefs.data.default || !bitsAutocacheService.prefs.data.localfile){
+			dir = aClass.defaultdir;
+		}else{
+			dir = bitsAutocacheService.prefs.data.localfile.clone();
+		}
+		if(aClass.id){
+			dir.append(aClass.id);
+			if(!dir.exists()) try{ dir.create(dir.DIRECTORY_TYPE, 0777); }catch(ex){ alert("bitsAutocacheDocument.Autocachedir()"+ex);return undefined; }
+		}
+		return dir.clone();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(){},
+
+/////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////
+	markingDocument : function(aDocument){
+		try{
+			var doc_url = this.Common.getURLStringFromDocument(aDocument);
+			if(this.AutocacheURL[doc_url] == undefined) return;
+			var dir_arr = [];
+			var entries = this.AutocacheURL[doc_url].dir.directoryEntries;
+			while(entries.hasMoreElements()){
+				var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+				if(!entry.isDirectory() || (entry.isDirectory() && entry.leafName.match(/^\./))) continue;
+				dir_arr.push(entry);
+			}
+			if(dir_arr.length == 0) return;
+			dir_arr.sort(function(a,b){ return b.lastModifiedTime - a.lastModifiedTime; });
+			while(dir_arr.length>0){
+				var dir = dir_arr.shift();
+				var url_file = dir.clone();
+				url_file.append(".urlinfo");
+				if(!url_file.exists()) continue;
+				var oldURL2newURL = [];
+				var newURL2oldURL = [];
+				var url = this.readFile(url_file);
+				var url_arr = url.split("\n");
+				var urlcnt;
+				for(urlcnt=0;urlcnt<url_arr.length;urlcnt++){
+					var temp_arr = url_arr[urlcnt].split("\t");
+					oldURL2newURL[temp_arr[0]] = temp_arr[1];
+					newURL2oldURL[temp_arr[1]] = temp_arr[0];
+				}
+				if(oldURL2newURL[doc_url] == undefined) continue;
+				var rtnObj = this.Database.getAllObjectFormURL(oldURL2newURL[doc_url],undefined,undefined,"text");
+				if(!rtnObj) continue;
+				var cnt;
+				for(cnt=0;cnt<rtnObj.length;cnt++){
+					var rObj = rtnObj[cnt];
+					if(newURL2oldURL[rObj.con_url] == undefined) continue;
+					var con_url = newURL2oldURL[rObj.con_url];
+					var rtnContent = bitsMarker.xPathMarker(aDocument, {start:rObj.bgn_dom,end:rObj.end_dom,context:rObj.oid_txt,con_url:con_url}, { id:rObj.oid, dbtype:rObj.dbtype, pfid:rObj.pfid, style:rObj.fid_style });
+				}
+			}
+		}catch(ex){
+			throw new Error("bitsAutocacheDocument.markingDocument():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	exec : function(aForced){
+		var self = this;
+		return self._exec(self, aForced);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_exec : function(aClass, aForced){
+		if(!aForced) aForced = false;
+		try{
+			var doc = bitsAutocacheService.gBrowser.contentDocument;
+			var urlString = bitsAutocacheService.Common.getURLStringFromDocument(doc);
+			if(bitsAutocacheService.isCacheURL(urlString)) return false;
+			var timeStamp = bitsAutocacheService.getURLTimeStamp(urlString);
+			var dir = bitsAutocacheService.getURLCacheDirFromTimeStamp(urlString,timeStamp);
+			if(!aForced && dir && dir.exists()) return false;
+			if(!dir.exists()) dir.create(dir.DIRECTORY_TYPE, 0777);
+			setTimeout(function(){
+				try{
+					aClass.frameList = aClass.flattenFrames(aClass, doc.defaultView);
+					if(aClass.frameList){
+						var marker_arr = [];
+						var cnt;
+						for(cnt=0;cnt<aClass.frameList.length;cnt++){
+							var xPathSPAN = bitsAutocacheService.XPath.evaluate('//*[starts-with(@id,"'+bitsMarker.id_key+'")]', aClass.frameList[cnt].document);
+							if(xPathSPAN){
+								var keyreg = new RegExp("^"+bitsMarker.id_key);
+								var xpathcnt;
+								for(xpathcnt=0;xpathcnt<xPathSPAN.snapshotLength;xpathcnt++){
+									var node = xPathSPAN.snapshotItem(xpathcnt);
+									var id_attr = node.getAttribute("id");
+									if(!id_attr.match(keyreg)) continue;
+									marker_arr.push(id_attr);
+									node = undefined;
+								}
+								xPathSPAN = undefined;
+							}
+						}
+						for(cnt=0;cnt<marker_arr.length;cnt++){
+							bitsMarker.unmarkerWindow(marker_arr[cnt]);
+						}
+						marker_arr.length = 0;
+						marker_arr = undefined;
+					}
+				}catch(e){
+					aClass._dump("bitsAutocacheDocument._exec():"+e);
+				}
+				aClass._createDocCache(aClass, doc, dir, false);
+				var rtn = bitsMarkingCollection.marking(doc);
+			},0);
+			return true;
+		}catch(ex){
+			throw new Error("bitsAutocacheDocument._exec():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_createDocCache : function(aClass, aDocument, aCacheDir, aLoadURL){
+		var newFile;
+		if(aLoadURL == undefined) aLoadURL = false;
+		var fileKey = null;
+		var fileName = bitsAutocacheService.Common.getFileName(aDocument.location.href);
+		var splitFileName = bitsAutocacheService.Common.splitFileName(fileName);
+		if(!splitFileName[0] || splitFileName[0] == ""){
+			fileKey = "index";
+		}else{
+			fileKey = splitFileName[0];
+		}
+		if(fileKey.length>8) fileKey = fileKey.substr(0,8);
+		fileKey = aClass.validateFileName(fileKey);
+		try{
+			if(aDocument.location){
+				newFile = aClass.cacheDocumentInternal(aClass, aDocument, fileKey, aCacheDir);
+				if(newFile){
+					var urlString = bitsAutocacheService.Common.getURLStringFromDocument(aDocument);
+					var info_file = aCacheDir.clone();
+					info_file.append(".info");
+					if(!info_file.exists()){
+						var info = "URL\t"   + urlString + "\n";
+						info += "INDEX\t" + newFile.leafName + "\n";
+						info += "TITLE\t" + aDocument.title + "\n";
+						bitsAutocacheService.writeFile(info_file,info);
+					}
+					var url_file = aCacheDir.clone();
+					url_file.append(".urlinfo");
+					if(url_file.exists()) url_file.remove(true);
+					var url = "";
+					var urlkey;
+					var baseURL = bitsAutocacheService.Common.convertFilePathToURL(aCacheDir.path);
+					var resolveURL;
+					for(urlkey in aClass.oldURL2newURL){
+						if(typeof aClass.oldURL2newURL[urlkey] == "function") continue;
+						resolveURL = new String(aClass.oldURL2newURL[urlkey]);
+						if(resolveURL.indexOf(baseURL)==0) resolveURL = resolveURL.substring(baseURL.length);
+						url += urlkey + "\t" + resolveURL + "\n";
+					}
+					if(url != "") bitsAutocacheService.writeFile(url_file,url);
+					var timeStamp = aCacheDir.leafName;
+					var urlsdb = bitsAutocacheService._selectUrlDB({uid_url:urlString});
+					if(!urlsdb){
+						bitsAutocacheService._insertUrlDB({uid:timeStamp,uid_url:urlString});
+						urlsdb = bitsAutocacheService._selectUrlDB({uid_url:urlString});
+					}
+					if(urlsdb){
+						var rtn = bitsAutocacheService._insertHistoryDB({
+							uid          : urlsdb[0].uid,
+							hid          : timeStamp,
+							hid_file     : newFile.leafName,
+							hid_path     : this.Common.convertFilePathToURL(aCacheDir.path),
+							hid_title    : aDocument.title?aDocument.title:urlString,
+							hid_date     : timeStamp,
+							hid_filesize : this.Common.getFilesize(aCacheDir),
+						});
+					}
+				}
+			}
+		}catch(ex){
+			throw new Error("bitsAutocacheDocument._createDocCache():"+ex);
+		}
+		return newFile;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	scroll : function(aClass, aEvent){
+		if(aClass.scrollhref == "") return;
+		if(aEvent.target.location.href != aClass.scrollhref) return;
+		if(aClass.httpTask[aClass.item.id] > 0) return;
+		aClass.scrollhref = "";
+		bitsAutocacheService.gBrowser.removeEventListener("pageshow", function(aEvent){ aClass.scroll(aClass, aEvent); }, false);
+		var frameList = aClass.flattenFrames(aClass, aEvent.target.defaultView);
+		var i,j;
+		for(i=0;i<aClass.scrollWin.length;i++){
+			var val = aClass.scrollWin[i];
+			if(val.scrollLeft == 0 && val.scrollTop == 0 && val.scrollBLeft == 0 && val.scrollBTop == 0) continue;
+			for(j=0;j<frameList.length;j++){
+				if(val.href != frameList[j].document.location.href) continue;
+				if(val.scrollLeft != 0  || val.scrollTop != 0)  frameList[j].scrollTo(val.scrollLeft,val.scrollTop);
+				if(val.scrollBLeft != 0 || val.scrollBTop != 0) frameList[j].scrollTo(val.scrollBLeft,val.scrollBTop);
+			}
+		}
+		aClass.scrollWin.length = 0;
+		aClass.scrollWin = [];
+	},
+
+/////////////////////////////////////////////////////////////////////
+	flattenFrames : function(aClass, aWindow){
+		if(!aWindow) return [];
+		var ret = [aWindow];
+		var i;
+		for(i=0;i < aWindow.frames.length;i++){
+			ret = ret.concat(aClass.flattenFrames(aClass, aWindow.frames[i]));
+		}
+		return ret;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	validateFileName : function(aFileName){
+		var re = /[\/]+/g;
+		if(navigator.appVersion.indexOf("Windows") != -1){
+			re = /[\\\/\|]+/g;
+			aFileName = aFileName.replace(/[\"]+/g, "'");
+			aFileName = aFileName.replace(/[\*\:\?]+/g, " ");
+			aFileName = aFileName.replace(/[\<]+/g, "(");
+			aFileName = aFileName.replace(/[\>]+/g, ")");
+			aFileName = aFileName.replace(/[\"\?!~`]+/g, "");
+			aFileName = aFileName.replace(/[\*\&]+/g, "+");
+			aFileName = aFileName.replace(/[\\\/\|\:;]+/g, "-");
+			aFileName = aFileName.replace(/[\<]+/g, "(");
+			aFileName = aFileName.replace(/[\>]+/g, ")");
+			aFileName = aFileName.replace(/[\s]+/g, "_");
+			aFileName = aFileName.replace(/[%]+/g, "@");
+		}else if(navigator.appVersion.indexOf("Macintosh") != -1)
+			re = /[\:\/]+/g;
+		return aFileName.replace(re, "_");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	cacheDocumentInternal : function(aClass, aDocument, aFileKey, aCacheDir){
+		if(!aDocument) return undefined;
+		if(!aFileKey) return undefined;
+		if(!aCacheDir) return undefined;
+		if(!aDocument.location) return undefined;
+		aClass.document = aDocument;
+		aClass.name = aFileKey;
+		aClass.AutocacheDir = aCacheDir.clone();
+		aClass.frameList = aClass.flattenFrames(aClass, aDocument.defaultView);
+		aClass.frameListHash = {};
+		for(var cnt=0;cnt<aClass.frameList.length;cnt++){
+			var url = aClass.frameList[cnt].document.location.href;
+			aClass.frameListHash[url] = aClass.frameList[cnt];
+		}
+		var dataDir = aClass.AutocacheDir.clone();
+		if(aClass.dataDirName) dataDir.append(aClass.dataDirName);
+		if(!aDocument.body || !aDocument.contentType || !aDocument.contentType.match(/html|xml/i)){
+			var captureType = (aDocument.contentType && aDocument.contentType.substring(0,5) == "image") ? "image" : "file";
+			if(aClass.frameNumber == 0 ) aClass.item.type = captureType;
+			var newLeafName = aClass.cacheFileInternal(aClass, aDocument.location.href, aFileKey, captureType);
+			return newLeafName;
+		}
+		aClass.refURLObj = bitsAutocacheService.Common.convertURLToObject(aDocument.location.href);
+		var tmpNodeList = [];
+		tmpNodeList.unshift(aDocument.body.cloneNode(true));
+		var rootNode = aDocument.getElementsByTagName("html")[0].cloneNode(false);
+		try{
+			var headNode = aDocument.getElementsByTagName("head")[0].cloneNode(true);
+			rootNode.appendChild(headNode);
+			rootNode.appendChild(aDocument.createTextNode("\n"));
+		}catch(ex){}
+		rootNode.appendChild(tmpNodeList[0]);
+		rootNode.appendChild(aDocument.createTextNode("\n"));
+		var n;
+		for(n=0;n<tmpNodeList.length-1;n++){
+			tmpNodeList[n].appendChild(aDocument.createTextNode("\n"));
+			tmpNodeList[n].appendChild(tmpNodeList[n+1]);
+			tmpNodeList[n].appendChild(aDocument.createTextNode("\n"));
+		}
+		aClass.processDOMRecursively(aClass, rootNode);
+		var cssFileKey = bitsAutocacheService.Common.getTimeStamp();
+		cssFileKey = "sp_" + cssFileKey.substr(-5,5);
+		if(cssFileKey.length>8) cssFileKey = cssFileKey.substr(0,8);
+		var myCSS = "";
+		var myStyleSheets = aDocument.styleSheets;
+		var i;
+		for(i=0;i<myStyleSheets.length;i++){
+			myCSS += aClass.processCSSRecursively(aClass, myStyleSheets[i]);
+		}
+		if(myCSS){
+			var newLinkNode = aDocument.createElement("link");
+			newLinkNode.setAttribute("media", "all");
+			newLinkNode.setAttribute("href", (aClass.dataDirName ? aClass.dataDirName + "/" : "") + cssFileKey + ".css");
+			newLinkNode.setAttribute("type", "text/css");
+			newLinkNode.setAttribute("rel", "stylesheet");
+			rootNode.firstChild.appendChild(aDocument.createTextNode("\n"));
+			rootNode.firstChild.appendChild(newLinkNode);
+			rootNode.firstChild.appendChild(aDocument.createTextNode("\n"));
+			myCSS = myCSS.replace(/\*\|/g, "");
+			if(aClass.dataDirName){
+				var regexp = new RegExp(aClass.dataDirName+"/","img");
+				if(regexp) myCSS = myCSS.replace(regexp, "");
+			}
+		}
+		var myHTML;
+		myHTML = aClass.surroundByTags(rootNode, rootNode.innerHTML);
+		myHTML = aClass.doctypeToString(aDocument.doctype) + myHTML;
+		myHTML = myHTML.replace(/\x00/g, " ");
+		var characterSet = aDocument.characterSet;
+		var myHTMLFile = aCacheDir.clone();
+		myHTMLFile.append(aFileKey + ".html");
+		if(!myHTMLFile.exists()) bitsAutocacheService.Common.writeFile(myHTMLFile, myHTML, characterSet);
+		if(myCSS){
+			if(!dataDir.exists()) dataDir.create(dataDir.DIRECTORY_TYPE, 0777);
+			if(!dataDir.exists()){
+				alert(dataDir.path);
+				return undefined;
+			}
+			var myCSSFile = dataDir.clone();
+			myCSSFile.append(cssFileKey + ".css");
+			if(!myCSSFile.exists()) bitsAutocacheService.Common.writeFile(myCSSFile, myCSS, characterSet);
+			if(!myCSSFile.exists()) alert(myCSSFile.path);
+		}
+		aClass.oldURL2newURL[aDocument.location.href] = bitsAutocacheService.Common.convertFilePathToURL(myHTMLFile.path);
+		return myHTMLFile;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	cacheFileInternal : function(aClass, aFileURL, aFileKey, aCaptureType){
+		if(!aFileKey) aFileKey = "file" + Math.random().toString();
+		if(!aClass.refURLObj ) aClass.refURLObj = bitsAutocacheService.Common.convertURLToObject(aFileURL);
+		if(aClass.frameNumber == 0){
+			aClass.item.icon  = "chrome://markingcollection/skin/defaultFavicon.png";
+			aClass.item.type  = aCaptureType;
+			aClass.item.chars = "";
+		}
+		var newFileName = aClass.download(aClass, aFileURL);
+		var myHTML;
+		if(aCaptureType == "image"){
+			myHTML = '<html><body><img src="' + newFileName + '"></body></html>';
+		} else {
+			myHTML = '<html><head><meta http-equiv="refresh" content="0;URL=./' + newFileName + '"></head><body></body></html>';
+		}
+		var myHTMLFile = aClass.Autocachedir(aClass).clone();
+		myHTMLFile.append(aFileKey + ".html");
+		if(!myHTMLFile.exists()) bitsAutocacheService.Common.writeFile(myHTMLFile, myHTML, "UTF-8");
+
+		return myHTMLFile;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	surroundByTags : function(aNode, aContent){
+		var tag = "<" + aNode.nodeName.toLowerCase();
+		var i;
+		for(i=0;i<aNode.attributes.length;i++){
+			tag += ' ' + aNode.attributes[i].name + '="' + aNode.attributes[i].value + '"';
+		}
+		tag += ">\n";
+		return tag + aContent + "</" + aNode.nodeName.toLowerCase() + ">\n";
+	},
+
+/////////////////////////////////////////////////////////////////////
+	doctypeToString : function(aDoctype){
+		if(!aDoctype) return "";
+		var ret = "<!DOCTYPE " + aDoctype.name;
+		if(aDoctype.publicId) ret += ' PUBLIC "' + aDoctype.publicId + '"';
+		if(aDoctype.systemId) ret += ' "'        + aDoctype.systemId + '"';
+		ret += ">\n";
+		return ret;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	processDOMRecursively : function(aClass, rootNode){
+		var curNode;
+		for(curNode=rootNode.firstChild;curNode != null;curNode = curNode.nextSibling){
+			if(curNode.nodeName == "#text" || curNode.nodeName == "#comment") continue;
+			curNode = aClass.inspectNode(aClass, curNode);
+			aClass.processDOMRecursively(aClass, curNode);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	inspectNode : function(aClass, aNode){
+		switch(aNode.nodeName.toLowerCase()){
+			case "img" : 
+			case "embed" : 
+				if(aNode.hasAttribute("onclick")) aNode = aClass.normalizeJSLink(aClass, aNode, "onclick");
+				var aFileName = aClass.download(aClass, aNode.src);
+				if(aFileName) aNode.setAttribute("src", aFileName);
+				break;
+			case "object" : 
+				var aFileName = aClass.download(aClass, aNode.data);
+				if (aFileName) aNode.setAttribute("data", aFileName);
+				break;
+			case "body" : 
+				var aFileName = aClass.download(aClass, aNode.background);
+				if (aFileName) aNode.setAttribute("background", aFileName);
+				break;
+			case "table" : 
+			case "tr" : 
+			case "th" : 
+			case "td" : 
+				var aFileName = aClass.download(aClass, aNode.getAttribute("background"));
+				if (aFileName) aNode.setAttribute("background", aFileName);
+				break;
+			case "input" : 
+				if(aNode.type.toLowerCase() == "image"){
+					var aFileName = aClass.download(aClass, aNode.src);
+					if(aFileName) aNode.setAttribute("src", aFileName);
+				}
+				break;
+			case "link" : 
+				if(aNode.rel.toLowerCase() == "stylesheet" && aNode.href.indexOf("chrome") != 0){
+					return aClass.removeNodeFromParent(aNode);
+				}else if(aNode.rel.toLowerCase() == "shortcut icon" || aNode.rel.toLowerCase() == "icon"){
+					var aFileName = aClass.download(aClass, aNode.href);
+					if(aFileName) aNode.setAttribute("href", aFileName);
+					if(aClass.frameNumber == 0 && !aClass.favicon) aClass.favicon = aFileName;
+				}else{
+					aNode.setAttribute("href", aNode.href);
+				}
+				break;
+			case "base" : 
+				aNode.removeAttribute("href");
+				if(!aNode.hasAttribute("target")) return aClass.removeNodeFromParent(aNode);
+				break;
+			case "style" : 
+				return aClass.removeNodeFromParent(aNode);
+				break;
+			case "script" : 
+			case "noscript" : 
+				return aClass.removeNodeFromParent(aNode);
+				break;
+			case "a" : 
+				if(aNode.hasAttribute("href")){
+					var href = aNode.getAttribute("href");
+					if(href.match(/http:\/\/ad\.doubleclick\.net\//)){
+						aNode.removeAttribute("href");
+						aNode.innerHTML = "";
+						break;
+					}
+				}
+			case "area" : 
+				if(aNode.hasAttribute("onclick")) aNode = aClass.normalizeJSLink(aClass, aNode, "onclick");
+				if(!aNode.hasAttribute("href")) return aNode;
+				if(aNode.target == "_blank") aNode.setAttribute("target", "_top");
+				if(aNode.href.match(/^javascript:/i) ) aNode = aClass.normalizeJSLink(aClass, aNode, "href");
+				if(aNode.getAttribute("href").charAt(0) == "#") return aNode;
+				var ext = bitsAutocacheService.Common.splitFileName(bitsAutocacheService.Common.getFileName(aNode.href))[1].toLowerCase();
+				var flag = false;
+				switch(ext){
+					case "jpg" : case "jpeg" : case "png" : case "gif" : case "tiff" : flag = true; break;
+					case "mp3" : case "wav"  : case "ram" : case "rm"  : case "wma"  : flag = true; break;
+					case "mpg" : case "mpeg" : case "avi" : case "mov" : case "wmv"  : flag = true; break;
+					case "zip" : case "lzh"  : case "rar" : case "jar" : case "xpi"  : flag = true; break;
+					default : aClass.linkURLs.push(aNode.href);
+				}
+				if(!flag && aNode.href.indexOf("file://") == 0 && !aNode.href.match(/\.html(?:#.*)?$/)) flag = true;
+				if(flag){
+					var aFileName = aClass.download(aClass, aNode.href);
+					if(aFileName) aNode.setAttribute("href", aFileName);
+				}else{
+					aNode.setAttribute("href", aNode.href);
+				}
+				break;
+			case "form" : 
+				aNode.setAttribute("action", bitsAutocacheService.Common.resolveURL(aClass.refURLObj.spec, aNode.action));
+				break;
+			case "meta" : 
+				break;
+			case "frame"  : 
+			case "iframe" : 
+				var tmpRefURL = aClass.refURLObj;
+				aClass.frameNumber++
+				try{
+					var src = aNode.src;
+					var contentDocument;
+					if(!contentDocument) contentDocument = aClass.frameList[aClass.frameNumber].document;
+					if(!contentDocument){
+						aNode.removeAttribute("src");
+						break;
+					}
+					if(contentDocument.location.href.match(/http:\/\/ad\.doubleclick\.net\//)){
+						aNode.removeAttribute("src");
+						break;
+					}
+					var fileName = bitsAutocacheService.Common.getFileName(contentDocument.location.href);
+					var splitFileName = bitsAutocacheService.Common.splitFileName(fileName);
+					if(!splitFileName[0] || splitFileName[0] == "") splitFileName[0] = "index";
+					splitFileName[0] = aClass.validateFileName(splitFileName[0]);
+					var dataDir = aClass.AutocacheDir.clone();
+					if(aClass.dataDirName) dataDir.append(aClass.dataDirName);
+					if(!dataDir.exists()) dataDir.create(dataDir.DIRECTORY_TYPE, 0777);
+					var newClass = new bitsAutocacheDocument(dataDir);
+					newClass.id = null;
+					var framedoc = contentDocument;
+					var aCacheDir = dataDir.clone();
+					splitFileName[0] = (splitFileName[0].length>8 ? splitFileName[0].substr(0,8) : splitFileName[0]);
+					var newFile = newClass.cacheDocumentInternal(newClass, framedoc, splitFileName[0], aCacheDir);
+					if(newFile) aNode.setAttribute("src", (aClass.dataDirName ? aClass.dataDirName + "/" : "") + newFile.leafName);
+					var key;
+					for(key in newClass.oldURL2newURL){
+						if(typeof newClass.oldURL2newURL[key] == "function") continue;
+						aClass.oldURL2newURL[key] = newClass.oldURL2newURL[key];
+					}
+					newClass.done();
+					newClass = undefined;
+				}catch(ex){
+					aClass._dump("WiredMarker ERROR: Failed to get document in a frame.\n\n" + ex);
+				}
+				aClass.refURLObj = tmpRefURL;
+				break;
+			case "xmp" : 
+				var pre = aNode.ownerDocument.createElement("pre");
+				pre.appendChild(aNode.firstChild);
+				aNode.parentNode.replaceChild(pre, aNode);
+				break;
+		}
+		if(aNode.style && aNode.style.cssText){
+			var newCSStext = aClass.inspectCSSText(aClass, aNode.style.cssText, aClass.refURLObj.spec);
+			if(newCSStext) aNode.setAttribute("style", newCSStext);
+		}
+		return aNode;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	removeNodeFromParent : function(aNode){
+		var newNode = aNode.ownerDocument.createTextNode("");
+		aNode.parentNode.replaceChild(newNode, aNode);
+		aNode = newNode;
+		return aNode;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	processCSSRecursively : function(aClass, aCSS){
+		var content = "";
+		if(!aCSS) return "";
+		if(aCSS.disabled) return "";
+		var medium = aCSS.media.mediaText;
+		if(medium != "" && medium.indexOf("screen") < 0 && medium.indexOf("all") < 0) return "";
+		if(aCSS.href && aCSS.href.indexOf("chrome") == 0) return "";
+		var flag = false;
+		var i;
+		for(i=0;i<aCSS.cssRules.length;i++){
+			if(aCSS.cssRules[i].type == 1 || aCSS.cssRules[i].type == 4){
+				if(!flag){
+					content += "\n/* ::::: " + aCSS.href + " ::::: */\n\n";
+					flag = true;
+				}
+				content += aClass.inspectCSSText(aClass, aCSS.cssRules[i].cssText, (aCSS.href?aCSS.href: bitsAutocacheService.Common.getURLStringFromDocument(aClass.document) )) + "\n";
+			}else if(aCSS.cssRules[i].type == 3){
+				content += aClass.processCSSRecursively(aClass, aCSS.cssRules[i].styleSheet);
+			}
+		}
+		return content;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	inspectCSSText : function(aClass, aCSStext, aCSShref){
+		if(!aCSStext) return "";
+		var re = new RegExp(/ url\(([^\'\)\s]+)\)/);
+		var i = 0;
+		while(aCSStext.match(re)){
+			if(++i > 10) break;
+			var relURL = RegExp.$1;
+			relURL = relURL.replace(/^\s*/g,"").replace(/\s*$/g,"").replace(/^(['"])(.+)\1$/,"$2");
+			var imgURL  = bitsAutocacheService.Common.resolveURL(aCSShref, relURL);
+			var imgFile = aClass.download(aClass, imgURL);
+			aCSStext = aCSStext.replace(re, " url('" + imgFile + "')");
+		}
+		aCSStext = aCSStext.replace(/([^\{\}])(\r|\n)/g, "$1\\A");
+		re = new RegExp(/ content: \"(.*?)\"; /);
+		if(aCSStext.match(re)){
+			var innerQuote = RegExp.$1;
+			innerQuote = innerQuote.replace(/\"/g, '\\"');
+			innerQuote = innerQuote.replace(/\\\" attr\(([^\)]+)\) \\\"/g, '" attr($1) "');
+			aCSStext = aCSStext.replace(re, ' content: "' + innerQuote + '"; ');
+		}
+		if(aCSStext.match(/ (quotes|voice-family): \"/)) return "";
+		if(aCSStext.indexOf(" background: ") >= 0){
+			aCSStext = aCSStext.replace(/ -moz-background-[^:]+: -moz-[^;]+;/g, "");
+			aCSStext = aCSStext.replace(/ scroll 0(?:pt|px|%);/g, ";");
+		}
+		if(aCSStext.indexOf(" background-position: 0") >= 0) aCSStext = aCSStext.replace(/ background-position: 0(?:pt|px|%);/, " background-position: 0 0;");
+		return aCSStext;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	download : function(aClass, aURLSpec){
+		if(!aURLSpec) return "";
+		if(aURLSpec.indexOf("://") < 0) aURLSpec = bitsAutocacheService.Common.resolveURL(aClass.refURLObj.spec, aURLSpec);
+		try{
+			var aURL = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURL);
+			aURL.spec = aURLSpec;
+		}catch(ex){
+			return "";
+		}
+		var newFileName = aURL.fileName.toLowerCase();
+		if(!newFileName) newFileName = "untitled";
+		newFileName = bitsAutocacheService.Common.validateFileName(newFileName);
+		var ret = bitsAutocacheService.Common.splitFileName(newFileName);
+		if(ret.length == 2 && ret[0].length>8){
+			ret[0] = aClass.fileNumber++;
+			newFileName = ret.join(".");
+		}
+		if(aClass.file2URL[newFileName] == undefined){
+		}
+		else if(aClass.file2URL[newFileName] != aURLSpec){
+			var seq = 1;
+			var fileLR = bitsAutocacheService.Common.splitFileName(newFileName);
+			if ( !fileLR[1] ) fileLR[1] = "dat";
+			newFileName = fileLR[0] + "_" + aClass.leftZeroPad3(seq) + "." + fileLR[1];
+			while(aClass.file2URL[newFileName] != undefined){
+				if(aClass.file2URL[newFileName] == aURLSpec){
+					return (aClass.dataDirName ? aClass.dataDirName + "/" : "") + newFileName;
+				}
+				newFileName = fileLR[0] + "_" + aClass.leftZeroPad3(++seq) + "." + fileLR[1];
+			}
+		}
+		else{
+			return (aClass.dataDirName ? aClass.dataDirName + "/" : "") + newFileName;
+		}
+		if(aURL.schemeIs("http") || aURL.schemeIs("https") || aURL.schemeIs("ftp")){
+			var targetFile = aClass.AutocacheDir.clone();
+			if(aClass.dataDirName) targetFile.append(aClass.dataDirName);
+			if(!targetFile.exists()) targetFile.create(targetFile.DIRECTORY_TYPE, 0777);
+			targetFile.append(newFileName);
+			if(!targetFile.exists()){
+				aClass.httpTask[aClass.item.id]++;
+				try{
+					var WBP = Components.classes['@mozilla.org/embedding/browser/nsWebBrowserPersist;1'].createInstance(Components.interfaces.nsIWebBrowserPersist);
+					WBP.persistFlags |= WBP.PERSIST_FLAGS_FROM_CACHE;
+                                        
+                                        /* TODO: Not enough arguments exception issue needs to be addressed */
+                                        /* See: https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIWebBrowserPersist */
+                                        /* See even: https://bugzilla.mozilla.org/show_bug.cgi?id=820522 */
+                                        
+                                        /* Dirty fix, might need to get replaced by a clean fix in case privacy information leak issues arise. */
+                                        var privacyContext = null;
+                                        
+					WBP.saveURI(aURL, null, aClass.refURLObj, null, null, targetFile, privacyContext);
+					var progressListener = {
+						onLocationChange : function(webProgress, request, location){},
+						onProgressChange : function(webProgress, request, curSelfProgress, maxSelfProgress, curTotalProgress, maxTotalProgress){},
+						onSecurityChange : function(webProgress, request, state){},
+						onStateChange    : function(webProgress, request, stateFlags, status){
+							if((WBP.currentState & WBP.PERSIST_STATE_FINISHED)){
+								if(targetFile && targetFile.exists()){
+									aClass.httpTask[aClass.item.id]--;
+									var infoFile = bitsAutocacheService._getSaveCacheInfoFile(targetFile.parent);
+									if(infoFile){
+										var info = bitsAutocacheService._getSaveCacheInfo(infoFile.parent);
+										if(info && info.URL){
+											var histsdb = bitsAutocacheService._selectHistoryDB({uid_url:info.URL,hid_date:infoFile.parent.leafName});
+											if(histsdb){
+												histsdb[0].hid_filesize = targetFile.fileSize + parseInt(histsdb[0].hid_filesize);
+												bitsAutocacheService._updateHistoryDB({
+													uid          : histsdb[0].uid,
+													hid          : histsdb[0].hid,
+													hid_filesize : histsdb[0].hid_filesize,
+												});
+											}
+										}
+									}
+									if(aClass.httpTask[aClass.item.id]<=0){
+										bitsAutocacheService.refresh(false,1000);
+									}else{
+									}
+								}else if(status != 0){
+								}
+							}
+						},
+						onStatusChange   : function(webProgress, request, status, message){},
+					};
+					WBP.progressListener = progressListener;
+					aClass.file2URL[newFileName] = aURLSpec;
+					aClass.oldURL2newURL[aURLSpec] = bitsAutocacheService.Common.convertFilePathToURL(targetFile.path);
+					return (aClass.dataDirName ? aClass.dataDirName + "/" : "") + newFileName;
+				}
+				catch(ex) {
+					dump("*** SCRAPPARTY_PERSIST_FAILURE: " + aURLSpec + "\n" + ex + "\n");
+					aClass.httpTask[aClass.item.id]--;
+					return "";
+				}
+			}else{
+				aClass.oldURL2newURL[aURLSpec] = bitsAutocacheService.Common.convertFilePathToURL(targetFile.path);
+				return (aClass.dataDirName ? aClass.dataDirName + "/" : "") + newFileName;
+			}
+		}
+		else if(aURL.schemeIs("file")){
+			var targetDir = aClass.AutocacheDir.clone();
+			if(aClass.dataDirName) targetDir.append(aClass.dataDirName);
+			if(!targetDir.exists()) targetDir.create(targetDir.DIRECTORY_TYPE, 0777);
+			var targetFile = targetDir.clone();
+			targetFile.append(newFileName);
+			if(!targetFile.exists()){
+				try {
+					var orgFile = bitsAutocacheService.Common.convertURLToFile(aURLSpec);
+					if(orgFile && orgFile.exists()){
+						if(!orgFile.isFile()) return "";
+						orgFile.copyTo(targetDir, newFileName);
+						aClass.file2URL[newFileName] = aURLSpec;
+						aClass.oldURL2newURL[aURLSpec] = bitsAutocacheService.Common.convertFilePathToURL(targetFile.path);
+						return (aClass.dataDirName ? aClass.dataDirName + "/" : "") + newFileName;
+					}else{
+						return "";
+					}
+				}
+				catch(ex) {
+					aClass._dump("*** WIRED-MARKER_DOWNLOAD_FAILURE: " + aURLSpec + "\n" + ex + "\n");
+					return "";
+				}
+			}else{
+				aClass.oldURL2newURL[aURLSpec] = bitsAutocacheService.Common.convertFilePathToURL(targetFile.path);
+				return (aClass.dataDirName ? aClass.dataDirName + "/" : "") + newFileName;
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	leftZeroPad3 : function(num){
+		if(num<10){return "00"+num;}else if(num<100){return "0"+num;}else{return num;}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	normalizeJSLink : function(aClass, aNode, aAttr){
+		var val = aNode.getAttribute(aAttr);
+		if(!val.match(/\(\'([^\']+)\'/)) return aNode;
+		val = RegExp.$1;
+		if(val.indexOf("/") == -1 && val.indexOf(".") == -1) return aNode;
+		val = bitsAutocacheService.Common.resolveURL(aClass.refURLObj.spec, val);
+		if(aNode.nodeName.toLowerCase() == "img"){
+			if(aNode.parentNode.nodeName.toLowerCase() == "a"){
+				aNode.parentNode.setAttribute("href", val);
+				aNode.removeAttribute("onclick");
+			}else{
+				val = "window.open('" + val + "');";
+				aNode.setAttribute(aAttr, val);
+			}
+		}
+		else{
+			if(aNode.hasAttribute("href") && aNode.getAttribute("href").indexOf("http://") != 0){
+				aNode.setAttribute("href", val);
+				aNode.removeAttribute("onclick");
+			}
+		}
+		return aNode;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/autocacheDialog.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/autocacheDialog.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/autocacheDialog.js	(revision 5703)
@@ -0,0 +1,131 @@
+var autocacheDialog = {
+
+/////////////////////////////////////////////////////////////////////
+	get STRING()     { return document.getElementById("autocacheDialogString"); },
+	get DataSource() { return window.opener.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.opener.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.opener.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.opener.top.bitsObjectMng.Database;   },
+	get gBrowser()   { return window.opener.top.bitsObjectMng.getBrowser();},
+	get bitsAutocacheService() { return window.opener.top.bitsAutocacheService;},
+
+	get DIALOG() { return document.getElementById("autocacheDialog"); },
+	get LIST()   { return document.getElementById("autocacheListbox"); },
+	get REMOVE() { return document.getElementById("autocacheDialogRemove"); },
+
+/////////////////////////////////////////////////////////////////////
+	init : function(){
+		if(autocacheDialog._init) return;
+
+		try {
+			this.info = window.arguments[0];
+		}catch(ex){
+		}
+
+		this.makeList();
+
+		try{
+			this._init = true;
+		}catch(ex){
+			this.Common.alert("autocacheDialog.init():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(event){
+		if(this._init){
+			this._init = false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	select : function(aEvent){
+		this.DIALOG.setAttribute("buttondisabledaccept","true");
+		this.REMOVE.setAttribute("disabled","true");
+
+		if(this.LIST.selectedCount==1) this.DIALOG.removeAttribute("buttondisabledaccept");
+		if(this.LIST.selectedCount>0) this.REMOVE.removeAttribute("disabled");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	remove : function(aEvent){
+		if(this.LIST.selectedItems.length<=0) return;
+		if(Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS != "Darwin"){
+			if(!this.Common.confirm( this.STRING.getString("CONFIRM_DELETE") )) return;
+		}
+
+		var i;
+		for(i=0;i<this.LIST.selectedItems.length;i++){
+			if(!this.info.list[this.LIST.selectedItems[i].value].exists()) continue;
+			this.info.list[this.LIST.selectedItems[i].value].remove(true);
+		}
+		this.makeList();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	makeList : function(){
+		while(this.LIST.getRowCount()>0){
+			this.LIST.removeItemAt(0);
+		}
+		try{
+			var dir_arr = [];
+			var entries = this.info.dir.directoryEntries;
+			while(entries.hasMoreElements()){
+				var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+				if(!entry.isDirectory() || (entry.isDirectory() && entry.leafName.match(/^\./))) continue;
+				dir_arr.push(entry.clone());
+			}
+			if(dir_arr.length>0) dir_arr.sort(function(a, b) { return(parseInt(b.leafName) - parseInt(a.leafName)); });
+
+			var i;
+			for(i=0;i<dir_arr.length;i++){
+				var label = dir_arr[i].leafName;
+				if(label && label.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/)) label = RegExp.$1+"/"+RegExp.$2+"/"+RegExp.$3+" "+RegExp.$4+":"+RegExp.$5+":"+RegExp.$6;
+				var item = this.LIST.appendItem(label,i);
+				if(!item) continue;
+				var info = window.opener.top.bitsAutocacheService._getSaveCacheInfo(dir_arr[i]);
+				if(info && info.INDEX){
+					var indexFile = dir_arr[i].clone();
+					indexFile.append(info.INDEX);
+					if(indexFile.exists()){
+						var listcell = document.createElement("listcell");
+						if(listcell){
+							listcell.setAttribute("label",this.formatFileSize(indexFile.fileSize));
+							item.appendChild(listcell);
+						}
+					}
+				}
+			}
+			this.info.list = dir_arr.concat([]);
+		}catch(e){this._dump(e);}
+		this.select();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	accept : function(aEvent){
+		window.arguments[0].accept = true;
+		try{ window.arguments[0].acceptdir = this.info.list[this.LIST.selectedIndex].clone(); }catch(e){}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	cancel : function(aEvent){
+		window.arguments[0].accept = false;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	formatFileSize : function(aBytes){
+		if(aBytes > 1000 * 1000){
+			return this.divideBy100( Math.round( aBytes / 1024 / 1024 * 100 ) ) + " MB";
+		}else if( aBytes == 0 ){
+			return "0 KB";
+		}else{
+			var kbytes = Math.round( aBytes / 1024 );
+			return (kbytes == 0 ? 1 : kbytes) + " KB";
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		if(nsPreferences.getBoolPref("wiredmarker.debug", false)) window.dump(aString+"\n");
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/autocacheDialog.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/autocacheDialog.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/autocacheDialog.xul	(revision 5703)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<dialog
+	id="autocacheDialog"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml"
+	title="&markingcollection.autocache.list;"
+	buttons="accept,cancel"
+	buttonlabelaccept="&markingcollection.autocache.list.open;"
+	buttonlabelcancel="&markingcollection.autocache.list.close;"
+	defaultButton="accept"
+	buttondisabledaccept="true"
+	onload="autocacheDialog.init();"
+	ondialogaccept="autocacheDialog.accept();"
+	ondialogcancel="autocacheDialog.cancel();">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/autocacheDialog.js"/>
+	<stringbundleset id="autocacheDialogStringBundles">
+		<stringbundle id="autocacheDialogString" src="chrome://markingcollection/locale/markingcollection.properties" />
+	</stringbundleset>
+	<hbox>
+		<toolbarbutton id="autocacheDialogRemove" label="&markingcollection.autocache.remove;" image="chrome://markingcollection/skin/menu_remove.png" disabled="true" oncommand="autocacheDialog.remove(event);"/>
+	</hbox>
+	<listbox id="autocacheListbox" seltype="multiple" onselect="autocacheDialog.select(event);">
+		<listhead>
+			<listheader label="&markingcollection.autocache.timestamp;"/>
+			<listheader label="&markingcollection.autocache.filesize;"/>
+		</listhead>
+		<listcols>
+			<listcol flex="1"/>
+			<listcol/>
+		</listcols>
+	</listbox>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/autocacheDialogOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/autocacheDialogOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/autocacheDialogOverlay.xul	(revision 5703)
@@ -0,0 +1,270 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+	id="autocacheDialogOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _autocacheDialogOverlayInit(aEvent){
+
+			var manually_exec = nsPreferences.getBoolPref("wiredmarker.autocache.manually.exec", false);
+			document.getElementById("bitsSelectDisplayAutocacheManually").checked = manually_exec;
+			document.getElementById("bitsSelectDisplayAutocacheManually").setAttribute("disabled","true");
+
+
+			var manually_confirm = nsPreferences.getBoolPref("wiredmarker.autocache.manually.confirm", true);
+			document.getElementById("bitsSelectDisplayAutocacheManuallyConfirm").checked = manually_confirm;
+			document.getElementById("bitsSelectDisplayAutocacheManuallyConfirm").setAttribute("disabled","true");
+
+
+			document.getElementById("bitsSelectDisplayAutocacheMarkingDisabled").removeAttribute("disabled");
+			document.getElementById("bitsSelectDisplayAutocacheMarkingConfirm").removeAttribute("disabled");
+			document.getElementById("bitsSelectDisplayAutocacheMarkingValid").removeAttribute("disabled");
+
+			document.getElementById("bitsAutocacheSaveFolderCheckbox").setAttribute("disabled","true");
+			document.getElementById("bitsAutocacheSaveFolderTextbox").setAttribute("disabled","true");
+			document.getElementById("bitsAutocacheSaveFolderUserTextbox").setAttribute("disabled","true");
+			document.getElementById("bitsAutocacheSaveFolderUserButton").setAttribute("disabled","true");
+
+			document.getElementById("bitsAutocacheTopmenuDisplay").setAttribute("disabled","true");
+			document.getElementById("bitsAutocacheTopmenuDisplayNumber").setAttribute("disabled","true");
+
+			var autocache_use = nsPreferences.copyUnicharPref("wiredmarker.autocache.use","valid");
+			switch(autocache_use){
+				case "switching":
+					document.getElementById("bitsSelectDisplayAutocacheDisabled").removeAttribute("selected");
+					document.getElementById("bitsSelectDisplayAutocacheSwitching").setAttribute("selected","true");
+					document.getElementById("bitsSelectDisplayAutocacheValid").removeAttribute("selected");
+
+					document.getElementById("bitsSelectDisplayAutocacheManuallyConfirm").removeAttribute("disabled");
+					break;
+				case "valid":
+					document.getElementById("bitsSelectDisplayAutocacheDisabled").removeAttribute("selected");
+					document.getElementById("bitsSelectDisplayAutocacheSwitching").removeAttribute("selected");
+					document.getElementById("bitsSelectDisplayAutocacheValid").setAttribute("selected","true");
+					document.getElementById("bitsSelectDisplayAutocacheMarking").removeAttribute("disabled");
+					break;
+				default:
+					document.getElementById("bitsSelectDisplayAutocacheDisabled").setAttribute("selected","true");
+					document.getElementById("bitsSelectDisplayAutocacheSwitching").removeAttribute("selected");
+					document.getElementById("bitsSelectDisplayAutocacheValid").removeAttribute("selected");
+
+
+					document.getElementById("bitsSelectDisplayAutocacheManually").removeAttribute("disabled");
+					if(manually_exec){
+						document.getElementById("bitsSelectDisplayAutocacheManuallyConfirm").removeAttribute("disabled");
+					}else{
+						document.getElementById("bitsSelectDisplayAutocacheManuallyConfirm").setAttribute("disabled","true");
+						document.getElementById("bitsSelectDisplayAutocacheMarkingDisabled").setAttribute("disabled","true");
+						document.getElementById("bitsSelectDisplayAutocacheMarkingConfirm").setAttribute("disabled","true");
+						document.getElementById("bitsSelectDisplayAutocacheMarkingValid").setAttribute("disabled","true");
+					}
+					break;
+			}
+			var autocache_marking = nsPreferences.copyUnicharPref("wiredmarker.autocache.marking","confirm");
+			switch(autocache_marking){
+				case "confirm":
+					document.getElementById("bitsSelectDisplayAutocacheMarkingDisabled").removeAttribute("selected");
+					document.getElementById("bitsSelectDisplayAutocacheMarkingConfirm").setAttribute("selected","true");
+					document.getElementById("bitsSelectDisplayAutocacheMarkingValid").removeAttribute("selected");
+					break;
+				case "valid":
+					document.getElementById("bitsSelectDisplayAutocacheMarkingDisabled").removeAttribute("selected");
+					document.getElementById("bitsSelectDisplayAutocacheMarkingConfirm").removeAttribute("selected");
+					document.getElementById("bitsSelectDisplayAutocacheMarkingValid").setAttribute("selected","true");
+					break;
+				default:
+					document.getElementById("bitsSelectDisplayAutocacheMarkingDisabled").setAttribute("selected","true");
+					document.getElementById("bitsSelectDisplayAutocacheMarkingConfirm").removeAttribute("selected");
+					document.getElementById("bitsSelectDisplayAutocacheMarkingValid").removeAttribute("selected");
+					break;
+			}
+
+
+			if(autocache_use != "disabled"){
+				document.getElementById("bitsAutocacheSaveFolderCheckbox").removeAttribute("disabled");
+				var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
+				var browserWindow = wm.getMostRecentWindow("navigator:browser");
+				if(browserWindow && browserWindow.bitsAutocacheService){
+					document.getElementById("bitsAutocacheSaveFolderTextbox").value = browserWindow.bitsAutocacheService.default_cachedir.path;
+				}
+
+				var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
+				try{
+					var save_folder = prefs.getComplexValue("wiredmarker.autocache.save.folder", Components.interfaces.nsILocalFile);
+					document.getElementById("bitsAutocacheSaveFolderUserTextbox").value = save_folder.path;
+				}catch(e){
+					nsPreferences.setBoolPref("wiredmarker.autocache.save.default", true);
+				}
+
+				var save_default = nsPreferences.getBoolPref("wiredmarker.autocache.save.default", true);
+				document.getElementById("bitsAutocacheSaveFolderCheckbox").checked = save_default;
+				if(save_default){
+					document.getElementById("bitsAutocacheSaveFolderTextbox").removeAttribute("disabled");
+				}else{
+					document.getElementById("bitsAutocacheSaveFolderUserTextbox").removeAttribute("disabled");
+					document.getElementById("bitsAutocacheSaveFolderUserButton").removeAttribute("disabled");
+				}
+			}
+
+			if(autocache_use != "disabled"){
+				document.getElementById("bitsAutocacheTopmenuDisplay").removeAttribute("disabled");
+				var topmenu_display = nsPreferences.getBoolPref("wiredmarker.autocache.topmenu.display", false);
+				document.getElementById("bitsAutocacheTopmenuDisplay").checked = topmenu_display;
+				if(topmenu_display) document.getElementById("bitsAutocacheTopmenuDisplayNumber").removeAttribute("disabled");
+
+				var topmenu_number = nsPreferences.getIntPref("wiredmarker.autocache.topmenu.number", 0);
+				var elem = document.getElementById("bitsAutocacheTopmenuDisplayNumber");
+				elem.valueNumber = topmenu_number;
+				elem.value = topmenu_number;
+			}
+			window.sizeToContent();
+		}
+		function _autocacheDialogOverlayDone(aEvent){
+
+		}
+		function _SelectAutocacheCommand(aEvent){
+			nsPreferences.setUnicharPref("wiredmarker.autocache.use", aEvent.target.value);
+			_autocacheDialogOverlayInit();
+		}
+		function _CheckAutocacheManuallyCommand(aEvent){
+			nsPreferences.setBoolPref("wiredmarker.autocache.manually.exec", aEvent.target.checked);
+			_autocacheDialogOverlayInit();
+		}
+		function _CheckAutocacheManuallyConfirmCommand(aEvent){
+			nsPreferences.setBoolPref("wiredmarker.autocache.manually.confirm", aEvent.target.checked);
+		}
+		function _SelectAutocacheMarkingCommand(aEvent){
+			nsPreferences.setUnicharPref("wiredmarker.autocache.marking", aEvent.target.value);
+		}
+
+		function _GetAutocacheSaveFolder(){
+			var picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
+			var result = null;
+			try{
+				picker.init(window, "Selected Save Folder", picker.modeGetFolder);
+				var showResult = picker.show();
+				if(showResult == picker.returnOK) result = picker.file;
+			}catch(e){
+				result = null;
+				alert(e);
+			}
+			return result;
+		}
+
+		function _CommandAutocacheSaveFolder(aEvent){
+			var folder = _GetAutocacheSaveFolder();
+			var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
+			if(folder){
+				prefs.setComplexValue("wiredmarker.autocache.save.folder", Components.interfaces.nsILocalFile, folder);
+			}else{
+				try{
+					var save_folder = prefs.getComplexValue("wiredmarker.autocache.save.folder", Components.interfaces.nsILocalFile);
+				}catch(e){
+					nsPreferences.setBoolPref("wiredmarker.autocache.save.default", true);
+					try{prefs.clearUserPref("wiredmarker.autocache.save.folder");}catch(e){}
+				}
+			}
+			_autocacheDialogOverlayInit();
+		}
+
+		function _CheckAutocacheSaveFolder(aEvent){
+			nsPreferences.setBoolPref("wiredmarker.autocache.save.default", aEvent.target.checked);
+			if(!aEvent.target.checked){
+				try{
+					var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
+					var save_folder = prefs.getComplexValue("wiredmarker.autocache.save.folder", Components.interfaces.nsILocalFile);
+				}catch(e){
+					save_folder = undefined;
+				}
+				if(!save_folder){
+					_CommandAutocacheSaveFolder();
+				}else{
+					_autocacheDialogOverlayInit();
+				}
+			}else{
+				_autocacheDialogOverlayInit();
+			}
+		}
+
+		function _CheckAutocacheDisplay(aEvent){
+			nsPreferences.setBoolPref("wiredmarker.autocache.topmenu.display", aEvent.target.checked);
+			_autocacheDialogOverlayInit();
+		}
+
+		function _InputAutocacheDisplayNumber(aEvent){
+			if(parseInt(aEvent.target.value)>50) aEvent.target.value = 50;
+			if(parseInt(aEvent.target.value)<0) aEvent.target.value = 0;
+			nsPreferences.setIntPref("wiredmarker.autocache.topmenu.number", aEvent.target.value);
+			_autocacheDialogOverlayInit();
+		}
+
+		function _dump(aString){
+			var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
+			var browserWindow = wm.getMostRecentWindow("navigator:browser");
+			if(browserWindow && browserWindow.bitsMarkingCollection) browserWindow.bitsMarkingCollection._dump(aString);
+		}
+
+		window.addEventListener("load", _autocacheDialogOverlayInit, false);
+		window.addEventListener("unload", _autocacheDialogOverlayDone, false);
+	]]>
+	</script>
+	<tabbox id="mcSettingTabbox">
+		<tabs id="mcSettingTabs">
+			<tab id="mcProjectTab" label="&markingcollection.autocache.tab;" image="chrome://markingcollection/skin/autocache.png"/>
+		</tabs>
+		<tabpanels id="mcSettingTabPanels">
+			<tabpanel id="mcAutocacheTabPanel" orient="vertical" flex="1">
+				<hbox align="center">
+					<groupbox>
+						<caption label="&markingcollection.autocache.caption;" style="background-color:#fff;"/>
+						<hbox>
+							<radiogroup id="" orient="horizontal" oncommand="_SelectAutocacheCommand(event)">
+								<radio id="bitsSelectDisplayAutocacheValid"     value="valid"     label="&markingcollection.autocache.valid;"/>
+								<radio id="bitsSelectDisplayAutocacheDisabled"  value="disabled"  label="&markingcollection.autocache.disabled;"/>
+								<radio id="bitsSelectDisplayAutocacheSwitching" value="switching" label="&markingcollection.autocache.switching;" hidden="true"/>
+							</radiogroup>
+							<checkbox id="bitsSelectDisplayAutocacheManually" label="&markingcollection.autocache.manually.caption;" oncommand="_CheckAutocacheManuallyCommand(event)" disabled="true" hidden="true"/>
+							<checkbox id="bitsSelectDisplayAutocacheManuallyConfirm" label="&markingcollection.autocache.manually.confirm;" oncommand="_CheckAutocacheManuallyConfirmCommand(event)" disabled="true" hidden="true"/>
+						</hbox>
+					</groupbox>
+					<groupbox id="bitsSelectDisplayAutocacheMarking">
+						<caption label="&markingcollection.autocache.marking;" style="background-color:#fff;"/>
+						<radiogroup id="" orient="horizontal" oncommand="_SelectAutocacheMarkingCommand(event)">
+							<radio id="bitsSelectDisplayAutocacheMarkingDisabled" value="disabled" label="&markingcollection.autocache.marking.disabled;"/>
+							<radio id="bitsSelectDisplayAutocacheMarkingConfirm"  value="confirm"  label="&markingcollection.autocache.marking.confirm;"/>
+							<radio id="bitsSelectDisplayAutocacheMarkingValid"    value="valid"    label="&markingcollection.autocache.marking.valid;"/>
+						</radiogroup>
+					</groupbox>
+				</hbox>
+				<groupbox id="bitsAutocacheSaveFolder">
+					<caption label="&markingcollection.autocache.save.folder;" style="background-color:#fff;"/>
+					<hbox align="center">
+						<checkbox id="bitsAutocacheSaveFolderCheckbox" label="&markingcollection.autocache.save.default;:" oncommand="_CheckAutocacheSaveFolder(event);"/>
+						<textbox id="bitsAutocacheSaveFolderTextbox" flex="1" readonly="true"/>
+					</hbox>
+					<hbox align="center">
+						<label control="bitsAutocacheSaveFolderUserTextbox" value="&markingcollection.autocache.save.user;:"/>
+						<textbox id="bitsAutocacheSaveFolderUserTextbox" flex="1" readonly="true"/>
+						<button id="bitsAutocacheSaveFolderUserButton" label="&markingcollection.autocache.save.folder;" oncommand="_CommandAutocacheSaveFolder(event);"/>
+					</hbox>
+				</groupbox>
+				<hbox>
+				<groupbox id="bitsAutocacheTopmenu">
+					<caption label="&markingcollection.autocache.topmenu.caption;" style="background-color:#fff;"/>
+					<hbox align="center">
+						<checkbox id="bitsAutocacheTopmenuDisplay" label="&markingcollection.autocache.topmenu.display;" oncommand="_CheckAutocacheDisplay(event)"/>
+						<label control="bitsAutocacheSaveFolderUserTextbox" value="&markingcollection.autocache.topmenu.number;:"/>
+						<textbox id="bitsAutocacheTopmenuDisplayNumber" type="number" wraparound="true" min="0" max="50" size="2" maxlength="2" onchange="_InputAutocacheDisplayNumber(event)"/>
+					</hbox>
+					<hbox align="center">
+						<description style="color:#ff0000;padding-left:1em;">&markingcollection.autocache.topmenu.attention;</description>
+					</hbox>
+				</groupbox>
+				</hbox>
+			</tabpanel>
+		</tabpanels>
+	</tabbox>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/autocacheOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/autocacheOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/autocacheOverlay.xul	(revision 5703)
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+	id="autocacheOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://markingcollection/content/autocache.js"/>
+	<menubar id="main-menubar">
+		<menu id="bitsExtensionsMainMenu">
+			<menupopup id="bitsExtensionsMenuPopup">
+				<menu
+						id="bitsCacheMenu"
+						label="&markingcollection.autocache.cache;"
+						class="menu-iconic"
+						image="chrome://markingcollection/skin/autocache.png"
+						oncommand="window.top.bitsAutocacheService.commandMainmenu(event);"
+						insertbefore="bitsFavoriteFolderMenu"
+						hidden="true"
+				>
+					<menupopup
+							id="bitsCacheMenuPopup"
+							onpopupshowing="window.top.bitsAutocacheService.popupshowingMainmenu(event);"
+							onpopuphiding="window.top.bitsAutocacheService.popuphidingMainmenu(event);"
+					/>
+				</menu>
+				<menuseparator observes="bitsCacheMenu" insertbefore="bitsFavoriteFolderMenu"/>
+			</menupopup>
+		</menu>
+	</menubar>
+	<popupset id="mainPopupSet">
+		<menupopup id="bitsMenuTreeObjectContextmenu">
+			<menu id="bitsMenuTreeObjectContextmenuCache" class="menu-iconic" label="&markingcollection.autocache.cache;" image="chrome://markingcollection/skin/autocache.png" insertafter="bitsMenuTreeObjectOpenNewTabMenuitem">
+				<menupopup>
+					<menuitem
+						id="bitsMenuTreeObjectContextmenuCacheOpen"
+						label="&markingcollection.autocache.open;"
+						oncommand="window.top.bitsAutocacheService.openCache(event);"/>
+					<menuitem
+						id="bitsMenuTreeObjectContextmenuCacheOpenNewtab"
+						label="&markingcollection.autocache.open.newtab;"
+						oncommand="window.top.bitsAutocacheService.openCache(event,true);"/>
+					
+					<menuseparator observes="bitsMenuTreeObjectContextmenuCachePast"/>
+					<menuitem
+						id="bitsMenuTreeObjectContextmenuCachePast"
+						label="&markingcollection.autocache.past;..."
+						oncommand="window.top.bitsAutocacheService.pastCache(event);" hidden="true"/>
+				</menupopup>
+			</menu>
+			<menuseparator observes="bitsMenuTreeObjectContextmenuCache" insertafter="bitsMenuTreeObjectOpenNewTabMenuitem"/>
+		</menupopup>
+		<menupopup id="bitsCacheMenuPopup">
+			<menu id="bitsCacheMenuPopupMenu" class="menu-iconic" label="&markingcollection.autocache.cache;" image="chrome://markingcollection/skin/autocache.png">
+				<menupopup id="bitsCacheMenuPopupMenupopup">
+					<menuitem
+						id="bitsCacheMenuPopupCacheOpen"
+						label="&markingcollection.autocache.open;"
+						oncommand="window.top.bitsAutocacheService.openCache(event);"/>
+					<menuitem
+						id="bitsCacheMenuPopupCacheOpenNewtab"
+						label="&markingcollection.autocache.open.newtab;"
+						oncommand="window.top.bitsAutocacheService.openCache(event,true);"/>
+					<menuseparator/>
+					<menuitem
+						id="bitsCacheMenuPopupCacheRemove"
+						label="&markingcollection.autocache.remove;"
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/menu_remove.png"
+						oncommand="window.top.bitsAutocacheService.removeCache(event);"/>
+				</menupopup>
+			</menu>
+		</menupopup>
+		<menupopup
+			id="bitsCacheContextmenuPopup"
+			onpopupshowing="window.top.bitsAutocacheService.popupshowingMainContextmenu(event);">
+			<menuitem
+				id="bitsCacheContextmenuMenuitemCacheOpenAll"
+				label="&markingcollection.autocache.open.all;"
+				oncommand="window.top.bitsAutocacheService.openCacheAll(event);"/>
+			<menuseparator/>
+			<menuitem
+				id="bitsCacheContextmenuMenuitemCacheRemoveAll"
+				label="&markingcollection.autocache.remove.all;"
+				class="menuitem-iconic"
+				image="chrome://markingcollection/skin/menu_remove.png"
+				oncommand="window.top.bitsAutocacheService.removeCacheAll(event);"/>
+		</menupopup>
+	</popupset>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/autocacheSidebarOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/autocacheSidebarOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/autocacheSidebarOverlay.xul	(revision 5703)
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/autocache.css" type="text/css"?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+    id="autocacheSidebarOverlay"
+    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+    xmlns:html="http://www.w3.org/1999/xhtml">
+    <script type="application/x-javascript">
+	<![CDATA[
+		function _autocacheMainInit(aEvent){
+			window.top.bitsAutocacheService.load(aEvent);
+		}
+		function _autocacheMainDone(aEvent){
+			window.top.bitsAutocacheService.unload(aEvent);
+		}
+		window.addEventListener("load", _autocacheMainInit, false);
+		window.addEventListener("unload", _autocacheMainDone, false);
+	]]>
+    </script>
+    <box id="bitsSidebarBox">
+        <vbox id="bitsSidebarVBox">
+            <toolbox id="mcToolbox">
+                <toolbar id="mcToolbar">
+                    <hbox id="mcToolbarAddonHBox">
+                        <toolbarbutton
+                            id="mcToolbarAutocacheButton"
+                            tooltiptext="&markingcollection.autocache.tooltiptext;"
+                            oncommand="window.top.bitsAutocacheService.manuallyCache(event);"
+                            hidden="true"/>
+                        <toolbarbutton
+                            id="mcToolbarAutocacheView"
+                            tooltiptext="&markingcollection.autocache.view.tooltiptext;"
+                            image="chrome://markingcollection/skin/autocache_list.png"
+                            type="checkbox"
+                            autoCheck="true"
+                            oncommand="window.top.bitsAutocacheService.toggleCacheView(event);"
+                            hidden="true"/>
+                    </hbox>
+                </toolbar>
+            </toolbox>
+        </vbox>
+    </box>
+    <splitter id="bitsBrowserAutocacheSplitter" class="chromeclass-extrachrome" hidden="true"/>
+    <vbox id="bitsBrowserAutocacheVBox" flex="1" hidden="true" persist="height" style="height:300px;">
+        <toolbox id="bitsAutocacheToolbox" class="plain" style="overflow:hidden;min-width:10em;width:18em;">
+            <toolbar id="bitsAutocacheToolbar" class="plain">
+                <toolbarbutton
+                    id="bitsAutocacheSearchButton"
+                    class="search-go-button"
+                    tooltiptext="&markingcollection.autocache.view;"
+                    type="checkbox"
+                    autoCheck="true"
+                    oncommand="window.top.bitsAutocacheService.onSearchButtonCommand(event)"/>
+                <textbox
+                    id="bitsAutocacheSearchTextbox"
+                    editable="true"
+                    flex="1"
+                    disabled="true"
+                    style="font-size:0.9em;-moz-appearance: none !important;border: none;"
+                    onkeypress="window.top.bitsAutocacheService.onSearchKeyPress(event)"/>
+                <spacer flex="1" />
+                <toolbarbutton class="tabs-closebutton" oncommand="{var elem = document.getElementById('mcToolbarAutocacheView');if(elem){ elem.checked = false;window.top.bitsAutocacheService.toggleCacheView(event);}}" />
+            </toolbar>
+        </toolbox>
+        <tree
+            id="bitsAutocacheTree"
+            contextmenu="bitsAutocacheTreeContextmenu"
+            tooltip="mcPopupTooltip"
+            onclick="window.top.bitsAutocacheService.onClick(event);"
+            ondblclick="window.top.bitsAutocacheService.onDblClick(event);"
+            onkeypress="window.top.bitsAutocacheService.onKeyPress(event);"
+            onkeydown="window.top.bitsAutocacheService.onKeyDown(event);"
+            seltype="multiple"
+            class="plain"
+            flex="1">
+            <treecols>
+                <treecol id="bitsAutocacheIFavicon"   label="Favicon" crop="none" flex="1" class="treecol-image" src="chrome://markingcollection/skin/defaultFavicon.png" persist="hidden,width" style="min-width:19px;"/>
+                <splitter class="tree-splitter"/>
+                <treecol id="bitsAutocacheIUrl"       label="URL" crop="none" flex="30" hidden="true" persist="hidden,width"/>
+                <splitter class="tree-splitter"/>
+                <treecol id="bitsAutocacheITitle"     label="Title" crop="none" flex="30" persist="hidden,width"/>
+                <splitter class="tree-splitter"/>
+                <treecol id="bitsAutocacheIDate"      label="Date" flex="10" persist="hidden,width"/>
+                <splitter class="tree-splitter"/>
+                <treecol id="bitsAutocacheICache"     label="#Cache" flex="1" class="treecol-image" src="chrome://markingcollection/skin/autocache.png" persist="hidden,width"/>
+                <splitter class="tree-splitter"/>
+                <treecol id="bitsAutocacheIMarker"    label="#Marker" flex="1" class="treecol-image" src="chrome://markingcollection/skin/icon_16.png" persist="hidden,width"/>
+                <splitter class="tree-splitter"/>
+                <treecol id="bitsAutocacheICacheSize" label="#CacheSize" flex="7" class="treecol-image" src="chrome://markingcollection/skin/autocache_save.png" persist="hidden,width"/>
+            </treecols>
+            <treechildren/>
+        </tree>
+    </vbox>
+    <popupset id="mcPopupSet">
+        <menupopup id="mcPopup">
+            <menu id="mcPopupCache" class="menu-iconic" label="&markingcollection.autocache.cache;" image="chrome://markingcollection/skin/autocache.png" insertafter="mcPopupOpenNewTab" hidden="true">
+                <menupopup>
+                    <menuitem
+                        id="mcPopupCacheOpen"
+                        label="&markingcollection.autocache.open;"
+                        observes="mcPopupOpenSeparator"
+                        oncommand="window.top.bitsAutocacheService.openCache(event);"/>
+                    <menuitem
+                        id="mcPopupCacheOpenNewtab"
+                        label="&markingcollection.autocache.open.newtab;"
+                        observes="mcPopupOpenSeparator"
+                        oncommand="window.top.bitsAutocacheService.openCache(event,true);"/>
+                    <menuseparator observes="mcPopupCachePast"/>
+                    <menuitem
+                        id="mcPopupCachePast"
+                        label="&markingcollection.autocache.past;..."
+                        oncommand="window.top.bitsAutocacheService.pastCache(event);" hidden="true"/>
+                </menupopup>
+            </menu>
+            <menuseparator observes="mcPopupCache" insertafter="mcPopupOpenNewTab"/>
+        </menupopup>
+        <menupopup id="bitsItemTreePopup">
+            <menuseparator id="bitsItemTreePopupCacheMenuseparator" observes="bitsItemTreePopupCache" insertafter="bitsItemTreePopupOpenMenuseparator"/>
+            <menu id="bitsItemTreePopupCache" class="menu-iconic" label="&markingcollection.autocache.cache;" image="chrome://markingcollection/skin/autocache.png" insertafter="bitsItemTreePopupOpenMenuseparator" hidden="true">
+                <menupopup>
+                    <menuitem
+                        id="bitsItemTreePopupCacheOpenRemote"
+                        label="&markingcollection.autocache.open.remote;"
+                        oncommand="window.top.annotationProxy.openRemoteCache(event, false);"/>
+                    <menuitem
+                        id="bitsItemTreePopupCacheOpenRemoteNewTab"
+                        label="&markingcollection.autocache.open.remotenewtab;"
+                        oncommand="window.top.annotationProxy.openRemoteCache(event, true);"/>
+                    <menuitem
+                        id="bitsItemTreePopupCacheOpen"
+                        label="&markingcollection.autocache.open;"
+                        oncommand="window.top.bitsAutocacheService.openCache(event);"/>
+                    <menuitem
+                        id="bitsItemTreePopupCacheOpenNewtab"
+                        label="&markingcollection.autocache.open.newtab;"
+                        oncommand="window.top.bitsAutocacheService.openCache(event,true);"/>
+                    <menuseparator observes="bitsItemTreePopupCachePast"/>
+                    <menuitem
+                        id="bitsItemTreePopupCachePast"
+                        label="&markingcollection.autocache.past;..."
+                        oncommand="window.top.bitsAutocacheService.pastCache(event);" hidden="true"/>
+                </menupopup>
+            </menu>
+        </menupopup>
+        
+        <menupopup
+            id="bitsAutocacheTreeContextmenu"
+            onpopupshowing="window.top.bitsAutocacheService.popupshowingTreeContextmenu(event);"
+            onpopuphiding="window.top.bitsAutocacheService.popuphidingTreeContextmenu(event);">
+            <menuitem
+                id="bitsAutocacheTreeContextmenuCacheOpenAll"
+                label="&markingcollection.autocache.open.all;"
+                oncommand="window.top.bitsAutocacheService.openCacheAll(event);"/>
+            <menuseparator observes="bitsAutocacheTreeContextmenuCacheOpenAll"/>
+            <menuitem
+                id="bitsAutocacheTreeContextmenuCacheRemoveAll"
+                label="&markingcollection.autocache.remove.all;"
+                class="menuitem-iconic"
+                image="chrome://markingcollection/skin/menu_remove.png"
+                oncommand="window.top.bitsAutocacheService.removeCacheAll(event);"/>
+            <menuseparator observes="bitsAutocacheTreeContextmenuCacheOpenAll"/>
+        </menupopup>
+        <menupopup
+            id="bitsAutocacheTreeItemContextmenu"
+            onpopupshowing="window.top.bitsAutocacheService.popupshowingTreeContextmenu(event);"
+            onpopuphiding="window.top.bitsAutocacheService.popuphidingTreeContextmenu(event);">
+            <menuitem
+                id="bitsAutocacheTreeContextmenuOpen"
+                label="&markingcollection.autocache.open;"
+                oncommand="window.top.bitsAutocacheService.openCache(event);"/>
+            <menuitem
+                id="bitsAutocacheTreeContextmenuNewtab"
+                label="&markingcollection.autocache.open.newtab;"
+                oncommand="window.top.bitsAutocacheService.openCache(event,true);"/>
+            <menuseparator/>
+            <menuitem
+                id="bitsAutocacheTreeContextmenuRemove"
+                label="&markingcollection.autocache.remove;"
+                class="menuitem-iconic"
+                image="chrome://markingcollection/skin/menu_remove.png"
+                oncommand="window.top.bitsAutocacheService.removeCache(event);"/>
+        </menupopup>
+    </popupset>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/capture.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/capture.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/capture.js	(revision 5703)
@@ -0,0 +1,324 @@
+var mcCapture = {
+
+	get POPUP()    { return document.getElementById("mcPopup"); },
+
+	get gBrowser()   { return window.top.bitsObjectMng.getBrowser();},
+	get Common()     { return window.top.bitsObjectMng.Common;      },
+	get DataSource() { return window.top.bitsObjectMng.DataSource;  },
+	get Database() { return window.top.bitsObjectMng.Database;  },
+
+/////////////////////////////////////////////////////////////////////
+	init : function(){
+		if(mcCapture.POPUP) mcCapture.POPUP.addEventListener("popupshowing", mcCapture.onPopupShowing, false);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(){
+		if(mcCapture.POPUP) mcCapture.POPUP.removeEventListener("popupshowing", mcCapture.onPopupShowing, false);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onPopupShowing : function(aEvent){
+		if(aEvent.originalTarget.localName != "popup") return;
+		var res = mcTreeHandler.resource;
+		if(!res){ aEvent.preventDefault(); return; }
+		var hidden = mcCapture.DataSource.isContainer(res);
+		if(hidden){
+			var type = mcCapture.DataSource.getProperty(res,"type");
+			if(type != "folder") hidden = false;
+		}
+		try{ document.getElementById("mcPopupCaptureMenu").hidden = !hidden; }catch(ex){}
+		try{ document.getElementById("mcPopupCaptureMenuSimple").hidden = !hidden; }catch(ex){}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	commandCaptureAll : function(aEvent){
+		var win = this.gBrowser.contentWindow;
+		var pos = {x:0,y:0};
+		var size = {w:win.document.documentElement.clientWidth,h:win.document.documentElement.clientHeight};
+		if(win.document.body.clientHeight > win.document.documentElement.clientHeight) size = {w:win.document.body.clientWidth,h:win.document.body.clientHeight};
+		var div = win.document.getElementById("divMcCapture");
+		if(div) div.style.display = "none";
+		var url = this._capture(win,pos,size);
+		if(!url) return;
+		var style = "";
+		var div = win.document.getElementById("divMcCapture");
+		if(!div){
+			div = win.document.createElement("div");
+			div.setAttribute("id", "divMcCapture");
+			style += "position:absolute;left:0px;top:0px;width:"+ size.w +"px;height:"+ size.h +"px;"
+			div.setAttribute("style", style); 
+			win.document.body.appendChild(div);
+		}
+		div.style.display = "";
+		var divBG = win.document.getElementById("divMcCaptureBG");
+		if(!divBG){
+			divBG = win.document.createElement("div");
+			divBG.setAttribute("id", "divMcCaptureBG");
+			style = "";
+			style += "position:absolute;left:0px;top:0px;width:"+ size.w +"px;height:"+ size.h +"px;"
+			style += "background-color:#000000;"
+			style += "opacity:0.7;"
+			style += "z-index:1;"
+			divBG.setAttribute("style", style); 
+			div.appendChild(divBG);
+		}
+		var img = win.document.getElementById("imgMcCapture");
+		if(!img){
+			img = win.document.createElement("img");
+			img.setAttribute("id", "imgMcCapture");
+			div.appendChild(img);
+		}
+		img.src = url;
+		if(img.complete) {
+			this._showImage();
+		} else {
+			img.addEventListener("load", mcCapture._showImage, false);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_showImage : function(){
+		var win = mcCapture.gBrowser.contentWindow;
+		var img = win.document.getElementById("imgMcCapture");
+		if(!img) return;
+		img.removeEventListener("load", mcCapture._showImage, false);
+		const margin = 200;
+		var style = "";
+		style += "position:absolute;left:0px;top:0px;";
+		if(img.width>img.height){
+			style += "max-width:" + (win.document.body.clientWidth>margin?win.document.body.clientWidth-margin:win.document.body.clientWidth-20) +"px;";
+		}else{
+			style += "max-height:"+ (win.document.body.clientHeight>margin?win.document.body.clientHeight-margin:win.document.body.clientHeight-20) +"px;";
+		}
+		style += "z-index:2;"
+		img.setAttribute("style", style); 
+		img.style.left = parseInt((win.document.body.clientWidth-img.width)/2)+"px";
+		img.style.top  = parseInt((win.document.body.clientHeight-img.height)/2)+"px";
+		img.style.display = "";
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_capture : function(aWin,aPos,aSize){
+		var win = aWin;
+		var w = aSize.w;
+		var h = aSize.h;
+		var vbox = document.getElementById("captureMenuVBox");
+		vbox.setAttribute("hidden",false);
+		var canvas = document.getElementById("capturecanvas");
+		var canvasW = w;
+		var canvasH = h;
+		var xScroll = aPos.x;
+		var yScroll = aPos.y;
+		canvas.style.width = canvasW+"px";
+		canvas.style.height = canvasH+"px";
+		canvas.width = canvasW;
+		canvas.height = canvasH;
+		try{
+			var ctx = canvas.getContext("2d");
+			ctx.clearRect(0, 0, canvas.width, canvas.height);
+			ctx.save();
+			ctx.scale(1.0, 1.0);    // 1.0ãªãåå¯žå€§
+			ctx.drawWindow(win, xScroll, yScroll, w, h, "rgb(255,255,255)");
+			ctx.restore();
+		}catch(e){ this._dump('Capture Error: ' + e.message + '\n'); }
+		try{
+			var url = canvas.toDataURL("image/png");
+		}catch(e){
+			this.Common.alert("This feature requires Firefox 2.0.\n" + ex);
+			vbox.setAttribute("hidden",true);
+			return null;
+		}
+		vbox.setAttribute("hidden",true);
+		return url;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onKeyUp : function(aEvent){
+		switch ( aEvent.keyCode ){
+			case aEvent.DOM_VK_PRINTSCREEN :
+				if(mcTreeHandler.TREE.currentIndex<0) return;
+				if(!mcTreeHandler.TREE.view.isContainer(mcTreeHandler.TREE.currentIndex)) return;
+				mcCapture.commandCaptureFromClipboard(aEvent);
+				break;
+			case 115 :
+				mcCapture.commandCaptureFromClipboard(aEvent);
+				break;
+			default:
+				break;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	commandCaptureFromDocument : function(aEvent){
+		var win = this.gBrowser.contentWindow;
+		var doc = win.document;
+		var pos  = {x:0,y:0};
+		var size = {};
+		try{
+			pos.x = (doc.body.scrollLeft > doc.documentElement.scrollLeft)?doc.body.scrollLeft:doc.documentElement.scrollLeft;
+			pos.y = (doc.body.scrollTop > doc.documentElement.scrollTop)?doc.body.scrollTop:doc.documentElement.scrollTop;
+		}catch(e){}
+		try{
+			size.w = (doc.body.clientWidth > doc.documentElement.clientWidth)?doc.body.clientWidth:doc.documentElement.clientWidth;
+			size.h = (doc.body.clientHeight < doc.documentElement.clientHeight)?doc.body.clientHeight:doc.documentElement.clientHeight;
+		}catch(e){
+			try{
+				if(!doc.body && doc.width && doc.height){
+					size.w = doc.width;
+					size.h = doc.height;
+				}
+			}catch(e){return;}
+		}
+		var url = this._capture(win,pos,size);
+		if(!url) return;
+		mcCapture.openCaptureDialog(url);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	commandCaptureFromClipboard : function(aEvent){
+		var clip = Components.classes["@mozilla.org/widget/clipboard;1"].getService(Components.interfaces.nsIClipboard);
+		if(!clip) return false;
+		var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
+		if(!trans) return false;
+		trans.addDataFlavor("text/unicode");
+		trans.addDataFlavor("image/gif");
+		trans.addDataFlavor("image/jpeg");
+		trans.addDataFlavor("image/png");
+/*
+		trans.addDataFlavor("image/bmp");
+		trans.addDataFlavor("image/tiff");
+		trans.addDataFlavor("image/x-xbitmap");
+		trans.addDataFlavor("image/x-xpixmap");
+*/
+		clip.getData(trans, clip.kGlobalClipboard);
+		var str = new Object();
+		var str_len = new Object();
+		try{
+			var flavor = {};
+			trans.getAnyTransferData(flavor,str,str_len);
+		}catch(e){
+			try{
+				trans.getTransferData("text/unicode",str,str_len);
+			}catch(e){
+				this._dump("e=["+e+"]");
+				str = null;
+				str_len = null;
+			}
+		}
+		var url = null;
+		var pastetext = "";
+		if(str){
+			if(flavor.value && flavor.value.match(/^image\/(.+)/img)){
+				var ext = RegExp.$1;
+				var nsIInputStream = str.value.QueryInterface( Components.interfaces.nsIInputStream );
+				var bstream = Components.classes['@mozilla.org/binaryinputstream;1'].createInstance(Components.interfaces.nsIBinaryInputStream);
+				bstream.setInputStream(nsIInputStream);
+				var len = nsIInputStream.available();
+				var bytes = bstream.readByteArray(len);
+				bstream.close();
+				nsIInputStream.close();
+				var images = String.fromCharCode.apply(String, bytes);
+				var image_b64 = btoa(images); // base64 encoding
+				url = 'data:' + flavor.value +';base64,' + image_b64;
+				str = null;
+			}else{
+				if("nsISupportsWString" in Components.interfaces){
+					str = str.value.QueryInterface(Components.interfaces.nsISupportsWString);
+				}else if("nsISupportsString" in Components.interfaces){
+					str = str.value.QueryInterface(Components.interfaces.nsISupportsString);
+				}else{
+					str = null;
+				}
+			}
+		}
+		if(str) pastetext=str.data.substring(0,str_len.value / 2);
+		if(url){
+			mcCapture.openCaptureDialog(url,false);
+		}else{
+			this.Common.alert( mcMainService.STRING.getString("CAPTURE_CLIPBOARD_NO_IMAGE") );
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	openCaptureDialog : function(aUrlString,aLink){
+		if(aLink == undefined) aLink = true;
+		var result = {};
+		var width = (outerWidth-100);
+		var height = (outerHeight-100);
+		var img = new Image();
+		img.src = aUrlString;
+		img.onload = function(){
+			width = (width>img.width+41)?img.width+41:width;
+			height = (height>img.height+129)?img.height+129:height;
+			result.title = "Capture:"+mcCapture.Common.getTimeStamp();
+			result.document_link = aLink;
+			window.openDialog("chrome://markingcollection/content/captureDialog.xul", "", "chrome,centerscreen,modal,width="+ width +",height="+ height, aUrlString, result);
+			if(!result.accept) return;
+			if(result.url){
+				var parentID = "0";
+				var aRes = mcTreeHandler.resource;
+				var dbtype = mcCapture.DataSource.getProperty(aRes,"dbtype");
+				if(aRes.Value != mcCapture.DataSource.ABOUT_ROOT) parentID = mcCapture.DataSource.getProperty(aRes,"id");
+				var pfid_order = mcCapture.Database.getMaxOrderFormPID(parentID);
+				var regexp = new RegExp("^data:image/\\w+?;base64,");
+				if(typeof result.url == "string" && regexp.test(result.url)){
+					var rObj = mcCapture.Database.newObject(undefined,dbtype);
+					if(rObj){
+						rObj.pfid = parentID;
+						if(result.title && result.title != ""){
+							rObj.oid_title = result.title;
+						}else{
+							rObj.oid_title = "Capture:"+mcCapture.Common.getTimeStamp();
+						}
+						if(result.document_link && result.document_link==true){
+							rObj.doc_url = mcCapture.Common.getURLStringFromDocument(mcCapture.gBrowser.contentDocument);
+							rObj.doc_title = mcCapture.gBrowser.contentDocument.title?mcCapture.gBrowser.contentDocument.title:rObj.doc_url;
+							rObj.con_url = rObj.doc_url;
+						}else{
+							var blobFile = mcCapture.Database.getObjectBLOBFile(rObj.oid,dbtype);
+							var url = mcCapture.Common.convertFilePathToURL(blobFile.path);
+							rObj.doc_url = url;
+							rObj.con_url = url;
+							rObj.doc_title = rObj.oid_title;
+						}
+						rObj.oid_property = "";
+						rObj.oid_mode = "0";
+						rObj.oid_type = "image/png";
+						rObj.oid_date = mcCapture.Common.getFormatDate();
+						rObj.pfid_order = ++pfid_order;
+						var rtn = mcCapture.Database.addObject(rObj,dbtype);
+						if(rtn) mcCapture.Database.updateObjectBLOB(rObj.oid,result.url,dbtype);
+						if(rtn){
+							if(mcItemView.isChecked){
+								mcItemView.onTreeClick();
+							}else{
+								var newDCitem = mcCapture.Database.makeObjectToItem(rObj);
+//								var newDCitem = mcCapture.Common.newItem(mcCapture.DataSource.identify(rObj.oid));
+//								newDCitem.pfid = parentID;
+//								newDCitem.type = "item";
+//								newDCitem.title = rObj.oid_title;
+//								newDCitem.editmode = rObj.oid_mode;
+//								newDCitem.uri = rObj.doc_url;
+//								newDCitem.dbtype = dbtype;
+//								newDCitem.title = rObj.oid_title;
+								newDCitem.icon = "chrome://markingcollection/skin/image.png";
+								newRes = mcCapture.DataSource.addItem(newDCitem, aRes.Value, -1, dbtype);
+								mcCapture.DataSource.flush();
+								mcController.rebuildLocal();
+								newDCitem = undefined;
+							}
+						}
+						rObj = undefined;
+					}
+				}
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function (aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/captureDialog.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/captureDialog.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/captureDialog.js	(revision 5703)
@@ -0,0 +1,325 @@
+var mcCaptureDialog = {
+
+	get STRING()     { return document.getElementById("mcCaptureString"); },
+	get TITLE()      { return document.getElementById("mcCaptureTitle"); },
+	get LINK()       { return document.getElementById("mcCaptureLink"); },
+
+	get DataSource() { return window.opener.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.opener.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.opener.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.opener.top.bitsObjectMng.Database;   },
+	get XML()        { return window.opener.top.bitsObjectMng.XML;        },
+	get gBrowser()   { return window.opener.top.bitsObjectMng.getBrowser();},
+
+	rulstring : "",
+	id        : null,
+	item      : null,
+	resource  : null,
+	property  : "",
+	allselect : false,
+
+
+
+
+
+/////////////////////////////////////////////////////////////////////
+	init : function(){
+		try {
+			mcCaptureDialog.rulstring = window.arguments[0];
+		}catch(ex){
+			document.location.href.match(/\?url\=(.*)$/);
+			mcCaptureDialog.rulstring = RegExp.$1;
+		}
+		if(!mcCaptureDialog.rulstring) return;
+
+		try {
+			mcCaptureDialog.item = window.arguments[1];
+		}catch(ex){
+		}
+		
+		if(mcCaptureDialog.item){
+			if(mcCaptureDialog.item.title) mcCaptureDialog.TITLE.value = mcCaptureDialog.item.title;
+			if(mcCaptureDialog.item.document_link != undefined) mcCaptureDialog.LINK.setAttribute("checked",mcCaptureDialog.item.document_link);
+		}
+
+		var acceptButt = document.documentElement.getButton("accept");
+		var cancelButt = document.documentElement.getButton("cancel");
+		cancelButt.focus();
+		if(acceptButt) acceptButt.setAttribute("disabled",true);
+
+		var div = document.getElementById('cutdiv');
+		if(div){
+			div.style.width = (innerWidth-(8*2)-4) + "px";
+			div.style.height = (innerHeight-(acceptButt.boxObject.height+(8*10))) + "px";
+			div.style.maxWidth = (innerWidth-(8*2)-4) + "px";
+			div.style.maxHeight = (innerHeight-(acceptButt.boxObject.height+(8*10))) + "px";
+
+			var vertical_cursor = document.getElementById('vertical_cursor');
+			if(vertical_cursor){
+				vertical_cursor.style.height = div.offsetHeight + "px";
+				vertical_cursor.style.maxHeight = div.offsetHeight + "px";
+			}
+			var horizontal_cursor = document.getElementById('horizontal_cursor');
+			if(horizontal_cursor){
+				horizontal_cursor.style.width = div.offsetWidth + "px";
+				horizontal_cursor.style.maxWidth = div.offsetWidth + "px";
+			}
+
+			div.addEventListener("mousemove", mcCaptureDialog.onMousemove, false);
+			div.addEventListener("mouseout",  mcCaptureDialog.onMouseout, false);
+			div.addEventListener("mousedown", mcCaptureDialog.onMousedownR, false);
+			div.addEventListener("scroll", mcCaptureDialog.onMousemove, false);
+
+		}
+
+		var canvas = document.getElementById('cutcanvas');
+		if(canvas){
+			var img = new Image();   // æ°ãã Image ãªããžã§ã¯ããäœã
+			img.src = mcCaptureDialog.rulstring; // ãœãŒã¹ã®ãã¹ãèš­å®ãã
+			img.onload = function(){
+				// drawImage æãããã§å®è¡
+
+				canvas.style.width = img.width+"px";
+				canvas.style.height = img.height+"px";
+				canvas.width = img.width;
+				canvas.height = img.height;
+
+				var ctx = canvas.getContext("2d");
+				ctx.clearRect(0, 0, canvas.width, canvas.height);
+				ctx.save();
+				ctx.drawImage(img,0,0);
+
+				ctx.restore();
+
+				var basediv = document.getElementById('basediv');
+				basediv.style.width = img.width+"px";
+				basediv.style.height = img.height+"px";
+
+				mcCaptureDialog.cmdAllSelect();
+
+			}
+		}
+    window.sizeToContent();
+		if(div){
+			div.style.width = (innerWidth-(8*2)-4) + "px";
+			div.style.maxWidth = (innerWidth-(8*2)-4) + "px";
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	cmdAllSelect : function(aEvent){
+
+		var rubber_band = document.getElementById('rubber_band');
+		var canvas = document.getElementById('cutcanvas');
+		var acceptButt = document.documentElement.getButton("accept");
+		if(!rubber_band || !canvas) return;
+
+		rubber_band.style.left = "-1px";
+		rubber_band.style.top = "-1px";
+		rubber_band.style.width = (canvas.width-2) + "px";
+		rubber_band.style.height = (canvas.height-2) + "px";
+		rubber_band.style.display = "";
+
+		if(acceptButt) acceptButt.removeAttribute("disabled");
+		
+		mcCaptureDialog.allselect = true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onMousemove : function(aEvent){
+		var div = document.getElementById('cutdiv');
+		if(!div) return;
+
+		var vertical_cursor = document.getElementById('vertical_cursor');
+		if(vertical_cursor){
+			vertical_cursor.style.display = "";
+			vertical_cursor.style.left = (div.scrollLeft + (aEvent.pageX - div.offsetLeft)) + "px";
+			vertical_cursor.style.top  = div.scrollTop + "px";
+		}
+		var horizontal_cursor = document.getElementById('horizontal_cursor');
+		if(horizontal_cursor){
+			horizontal_cursor.style.display = "";
+			horizontal_cursor.style.top = (div.scrollTop + (aEvent.pageY - div.offsetTop)) + "px";
+			horizontal_cursor.style.left = div.scrollLeft + "px";
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onMouseout : function(aEvent){
+		var vertical_cursor = document.getElementById('vertical_cursor');
+		if(vertical_cursor){
+			vertical_cursor.style.display = "none";
+		}
+		var horizontal_cursor = document.getElementById('horizontal_cursor');
+		if(horizontal_cursor){
+			horizontal_cursor.style.display = "none";
+		}
+
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onMousedownR : function(aEvent){
+		mcCaptureDialog.allselect = false;
+
+		var rubber_band = document.getElementById('rubber_band');
+		if(!rubber_band) return;
+
+		var acceptButt = document.documentElement.getButton("accept");
+		if(acceptButt) acceptButt.setAttribute("disabled",true);
+
+		if(aEvent.which == 3){
+			rubber_band.style.display = "none";
+		}
+
+		if(aEvent.which != 1) return;
+
+		var div = document.getElementById('cutdiv');
+		if(!div) return;
+
+		mcCaptureDialog.rx = div.scrollLeft + (aEvent.pageX - div.offsetLeft);
+		mcCaptureDialog.ry = div.scrollTop + (aEvent.pageY - div.offsetTop);
+
+		rubber_band.style.left = mcCaptureDialog.rx + "px";
+		rubber_band.style.top = mcCaptureDialog.ry + "px";
+
+		rubber_band.style.width = "0px";
+		rubber_band.style.height = "0px";
+
+		rubber_band.style.display = "";
+
+		div.addEventListener("mousemove", mcCaptureDialog.onMousemoveR, false);
+		div.addEventListener("mouseup",   mcCaptureDialog.onMouseupR, false);
+
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onMousemoveR : function(aEvent){
+
+		var div = document.getElementById('cutdiv');
+		if(!div) return;
+
+
+		var rubber_band = document.getElementById('rubber_band');
+		if(!rubber_band) return;
+
+		var canvas = document.getElementById('cutcanvas');
+		if(!canvas) return;
+
+		var x = div.scrollLeft + (aEvent.pageX - div.offsetLeft);
+		var y = div.scrollTop + (aEvent.pageY - div.offsetTop);
+
+		if(x<=0 || x>=canvas.width ||
+			 y<=0 || y>=canvas.height
+		){
+			mcCaptureDialog.onMouseupR(aEvent);
+			return;
+		}
+
+		if(mcCaptureDialog.rx<x){
+			rubber_band.style.width = (x-mcCaptureDialog.rx-2) + "px";
+		}else{
+			rubber_band.style.left = x + "px";
+			rubber_band.style.width = (mcCaptureDialog.rx-x) + "px";
+		}
+
+		if(mcCaptureDialog.ry<y){
+			rubber_band.style.height = (y-mcCaptureDialog.ry-2) + "px";
+		}else{
+			rubber_band.style.top = y + "px";
+			rubber_band.style.height = (mcCaptureDialog.ry-y) + "px";
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onMouseupR : function(aEvent){
+		var div = document.getElementById('cutdiv');
+		if(!div) return;
+		div.removeEventListener("mousemove", mcCaptureDialog.onMousemoveR, false);
+		div.removeEventListener("mouseup",   mcCaptureDialog.onMouseupR, false);
+
+		var rubber_band = document.getElementById('rubber_band');
+		if(!rubber_band) return;
+
+
+		var win = window;
+		var canvas = document.getElementById("capturecanvas");
+
+		var canvasW = rubber_band.offsetWidth-2;
+		var canvasH = rubber_band.offsetHeight-2;
+		if(canvasW<=2 && canvasH<=2){
+			rubber_band.style.display = "none";
+			return;
+		}
+
+		// set the preview initially for top left
+		var xScroll = rubber_band.offsetLeft + div.offsetLeft+3 - div.scrollLeft;
+		var yScroll = rubber_band.offsetTop + div.offsetTop+3 - div.scrollTop;
+
+
+		var vertical_cursor = document.getElementById('vertical_cursor');
+		if(vertical_cursor) vertical_cursor.style.display = "none";
+		var horizontal_cursor = document.getElementById('horizontal_cursor');
+		if(horizontal_cursor) horizontal_cursor.style.display = "none";
+		rubber_band.style.display = "none";
+
+
+		canvas.style.width = canvasW+"px";
+		canvas.style.height = canvasH+"px";
+		canvas.width = canvasW;
+		canvas.height = canvasH;
+		try {
+			var ctx = canvas.getContext("2d");
+			ctx.clearRect(0, 0, canvas.width, canvas.height);
+			ctx.save();
+			ctx.scale(1.0, 1.0);    // 1.0ãªãåå¯žå€§
+			ctx.drawWindow(win, xScroll, yScroll, canvasW, canvasH, "rgb(255,255,255)");
+			ctx.restore();
+
+			var acceptButt = document.documentElement.getButton("accept");
+			if(acceptButt) acceptButt.removeAttribute("disabled");
+		}
+		catch(e) { dump('Capture Error: ' + e.message + '\n'); }
+
+		if(vertical_cursor) vertical_cursor.style.display = "";
+		if(horizontal_cursor) horizontal_cursor.style.display = "";
+		rubber_band.style.display = "";
+
+	},
+
+/////////////////////////////////////////////////////////////////////
+	accept : function(){
+		if(window.arguments[1]){
+			window.arguments[1].allselect = mcCaptureDialog.allselect;
+
+			var canvas = null;
+			if(mcCaptureDialog.allselect){
+				canvas = document.getElementById("cutcanvas");
+			}else{
+				canvas = document.getElementById("capturecanvas");
+			}
+			try {
+				window.arguments[1].url = canvas.toDataURL("image/png");
+			}catch(ex){
+				mcCapture._dump("This feature requires Firefox 2.0.\n" + ex);
+			}
+
+			window.arguments[1].title = mcCaptureDialog.TITLE.value;
+			window.arguments[1].document_link = mcCaptureDialog.LINK.checked;
+
+			window.arguments[1].accept = true;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	cancel : function(){
+		if(window.arguments[1]) window.arguments[1].accept = false;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		if(nsPreferences.getBoolPref("wiredmarker.debug", false)) window.dump(aString+"\n");
+	},
+};
+
+
+
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/captureDialog.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/captureDialog.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/captureDialog.xul	(revision 5703)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<dialog
+	id="mcCaptureDialog"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml"
+	title="&markingcollection.capture;"
+	buttons="accept,cancel"
+	onload="mcCaptureDialog.init();"
+	ondialogaccept="mcCaptureDialog.accept();"
+	ondialogcancel="mcCaptureDialog.cancel();">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/captureDialog.js" />
+	<stringbundleset id="mcStringBundles">
+		<stringbundle id="mcCaptureString" src="chrome://markingcollection/locale/markingcollection.properties" />
+	</stringbundleset>
+	<toolbox>
+		<toolbar id="mcCaptureToolbar">
+			<toolbarbutton label="&markingcollection.capture.all_select;" oncommand="mcCaptureDialog.cmdAllSelect(event);"/>
+		</toolbar>
+	</toolbox>
+	<html:div id="cutdiv" style="position:relative;left:0px;top:0px;max-width:600px;max-height:400px;overflow:scroll;border:2px solid gray !important;" >
+		<html:div id="basediv" style="position:absolute;left:0px;top:0px;width:600px;height:400px;overflow:hidden !important;">
+			<html:canvas id="cutcanvas"/>
+			<html:div id="vertical_cursor"   style="position:absolute;left:10px;top:0px; width:1px; height:100%;max-width:1px; max-height:100%; background-color:red; opacity:0.5 !important;"/>
+			<html:div id="horizontal_cursor" style="position:absolute;left:0px; top:10px;width:100%;height:1px; max-width:100%;max-height:1px;  background-color:red; opacity:0.5 !important;"/>
+			<html:div id="rubber_band" style="display:none;position:absolute;left:0px;top:0px;width:0px;height:0px; border:2px dotted red !important;"/>
+		</html:div>
+	</html:div>
+	<hbox flex="1">
+		<label value="&markingcollection.capture.title;"/>
+		<textbox id="mcCaptureTitle" flex="1"/>
+	</hbox>
+	<hbox>
+		<checkbox id="mcCaptureLink" checked="true" label="&markingcollection.capture.document_link;"/>
+	</hbox>
+	<vbox id="captureMenuVBox" hidden="true">
+		<scrollbox width="1" height="1">
+			<html:canvas id="capturecanvas"/>
+		</scrollbox>
+	</vbox>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/captureSidebarOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/captureSidebarOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/captureSidebarOverlay.xul	(revision 5703)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+	id="captureOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://global/content/nsJSSupportsUtils.js"/>
+	<script type="application/x-javascript" src="chrome://global/content/nsJSComponentManager.js"/>
+	<script type="application/x-javascript" src="chrome://markingcollection/content/capture.js"/>
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _captureMainInit(){
+			mcCapture.init();
+		}
+		function _captureMainDone(){
+			mcCapture.done();
+		}
+		window.addEventListener("load", _captureMainInit, false);
+		window.addEventListener("unload", _captureMainDone, false);
+	]]>
+	</script>
+	<splitter id="captureMenuSplitter" hidden="true" />
+	<vbox id="captureMenuVBox" hidden="true">
+		<scrollbox width="1" height="1">
+			<html:canvas id="capturecanvas"/>
+		</scrollbox>
+	</vbox>
+	<popupset id="mcPopupSet">
+		<menupopup id="mcPopup">
+			<menu id="mcPopupCaptureMenu" class="menu-iconic" label="&markingcollection.capture;" image="chrome://markingcollection/skin/capture.png" insertafter="mcPopupCreates">
+				<menupopup id="mcPopupCaptureMenuPopup">
+					<menuitem id="mcPopupCaptureView" class="menuitem-iconic" label="&markingcollection.capture.document;" image="chrome://markingcollection/skin/document.png" oncommand="mcCapture.commandCaptureFromDocument(event);" />
+					<menuitem id="mcPopupCaptureView" class="menuitem-iconic" label="&markingcollection.capture.clipboard;" image="chrome://markingcollection/skin/clipboard.png" oncommand="mcCapture.commandCaptureFromClipboard(event);" />
+				</menupopup>
+			</menu>
+		</menupopup>
+	</popupset>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/confirmAddTextDialog.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/confirmAddTextDialog.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/confirmAddTextDialog.js	(revision 5703)
@@ -0,0 +1,263 @@
+var wmConfirmAddTextDialog = {
+
+/////////////////////////////////////////////////////////////////////
+	get STRING()     { return document.getElementById("wmConfirmAddTextDialogString"); },
+	get DataSource() { return window.opener.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.opener.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.opener.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.opener.top.bitsObjectMng.Database;   },
+	get gBrowser()   { return window.opener.top.bitsObjectMng.getBrowser();},
+
+	get URL()      { return document.getElementById("wmUrl"); },
+	get TITLE()    { return document.getElementById("wmTitle"); },
+	get NOTE()     { return document.getElementById("wmNote"); },
+	get LPAGE()    { return document.getElementById("wmLogicalPage"); },
+	get PPAGE()    { return document.getElementById("wmPhysicalPage"); },
+	get PTITLE()   { return document.getElementById("wmPageTitle"); },
+	get TITLE_HBOX(){ return document.getElementById("wmTitleHBox"); },
+
+	info    : null,
+	_xmldoc : null,
+
+	get xmldoc(){ return this._xmldoc; },
+
+/////////////////////////////////////////////////////////////////////
+	init : function(){
+		if(wmConfirmAddTextDialog._init) return;
+
+		try {
+			this.info = window.arguments[0];
+		}catch(ex){
+		}
+
+		this.URL.value = this.info.con_url;
+		this.TITLE.value  = this.info.title;
+		this.PTITLE.value  = this.info.doc_title;
+
+		this.info.note = "";
+		if(this.info.property){
+			this._createXMLDoc(this.info.property);
+			if(this.xmldoc){
+				var note_elem = this.xmldoc.getElementsByTagName("NOTE")[0];
+				if(note_elem) this.info.note = note_elem.textContent.replace(/&/mg,"&amp;").replace(/</mg,"&lt;").replace(/>/mg,"&gt;").replace(/\"/mg,"&quot;");
+
+				var lpage_elem = this.xmldoc.getElementsByTagName("LOGICAL_PAGE")[0];
+				if(lpage_elem) this.info.logical_page = lpage_elem.textContent;
+
+				var ppage_elem = this.xmldoc.getElementsByTagName("PHYSICAL_PAGE")[0];
+				if(ppage_elem) this.info.physical_page = ppage_elem.textContent;
+			}
+		}
+		if(this.info.note != undefined) this.NOTE.value = this.info.note;
+		if(this.info.logical_page != undefined)  this.LPAGE.value = this.info.logical_page;
+		if(this.info.physical_page != undefined) this.PPAGE.value = this.info.physical_page;
+
+		try{this.URL.editor.transactionManager.clear();}catch(ex2){}
+		try{this.TITLE.editor.transactionManager.clear();}catch(ex2){}
+		try{this.NOTE.editor.transactionManager.clear();}catch(ex2){}
+		try{this.LPAGE.editor.transactionManager.clear();}catch(ex2){}
+		try{this.PPAGE.editor.transactionManager.clear();}catch(ex2){}
+		try{this.PTITLE.editor.transactionManager.clear();}catch(ex2){}
+
+		try{
+			this._init = true;
+		}catch(ex){
+			this.Common.alert("wmConfirmAddTextDialog.init():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(event){
+		if(this._init){
+			this._init = false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_createXMLDoc : function(aContent){
+		var parser = new DOMParser();
+		this._xmldoc = parser.parseFromString(aContent, "text/xml");
+		parser = undefined;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_xmlSerializer : function(){
+		var s = new XMLSerializer();
+		var aContent = s.serializeToString(this.xmldoc);
+		s = undefined;
+		return aContent;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	undoTitle : function(){
+		try{
+			while(this.TITLE.editor.transactionManager.numberOfUndoItems>0){
+				this.TITLE.editor.undo(1);
+				var title = this.TITLE.value;
+				title = title.replace(/\t/mg,"        ");
+				title = this.Common.exceptCode(title);
+				title = title.replace(/[\r\n]/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+				if(title != "") break;
+			}
+		}catch(ex2){_dump(ex2);}
+		window.focus();
+		var self = this;
+		setTimeout(function(){self.TITLE.focus();},100);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	inputTitle : function(aEvent){
+		var title = this.TITLE.value;
+		title = title.replace(/\t/g,"        ");
+		title = this.Common.exceptCode(title);
+		title = title.replace(/[\r\n]/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+		if(title == ""){
+			this.TITLE_HBOX.style.borderColor = 'red';
+		}else{
+			this.TITLE_HBOX.style.borderColor = 'transparent';
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	changeTitle : function(aEvent){
+		var title = this.TITLE.value;
+		title = title.replace(/\t/g,"        ");
+		title = this.Common.exceptCode(title);
+		title = title.replace(/[\r\n]/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+		if(title == ""){
+			aEvent.preventDefault();
+			aEvent.stopPropagation();
+			if(Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS != "Darwin"){
+				this.Common.alert(this.STRING.getString("ERROR_NOT_ENTER_TITLE"));
+				this.undoTitle();
+			}
+			var title = this.TITLE.value;
+			title = title.replace(/\t/g,"        ");
+			title = this.Common.exceptCode(title);
+			title = title.replace(/[\r\n]/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+			if(title == ""){
+				this.TITLE_HBOX.style.borderColor = 'red';
+			}else{
+				this.TITLE_HBOX.style.borderColor = 'transparent';
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	accept : function(aEvent){
+		window.arguments[0].accept = 1;
+		var newVals = {
+			title         : this.TITLE.value,
+			note          : this.Common.escapeComment(this.NOTE.value),
+			logical_page  : this.LPAGE.value,
+			physical_page : this.PPAGE.value,
+			doc_title     : this.PTITLE.value
+		};
+		newVals["title"] = newVals["title"].replace(/\t/g,"        ");
+		newVals["title"] = this.Common.exceptCode(newVals["title"]);
+		newVals["title"] = newVals["title"].replace(/\x0D\x0A|\x0D|\x0A/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+		if(newVals["title"] == "") return false;
+
+		newVals["note"] = newVals["note"].replace(/\t/mg,"        ");
+		newVals["note"] = newVals["note"].replace(/\x0D\x0A|\x0D|\x0A/g," __BR__ ");
+		newVals["note"] = this.Common.exceptCode(newVals["note"]);
+		newVals["note"] = newVals["note"].replace(/[\r\n]/mg, " ").replace(/ __BR__ /mg,"\n");
+
+		newVals["logical_page"] = newVals["logical_page"].replace(/\t/mg,"        ");
+		newVals["logical_page"] = this.Common.exceptCode(newVals["logical_page"]);
+		newVals["logical_page"] = newVals["logical_page"].replace(/\x0D\x0A|\x0D|\x0A/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+
+		newVals["physical_page"] = newVals["physical_page"].replace(/\t/mg,"        ");
+		newVals["physical_page"] = this.Common.exceptCode(newVals["physical_page"]);
+		newVals["physical_page"] = newVals["physical_page"].replace(/\x0D\x0A|\x0D|\x0A/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+
+		newVals["doc_title"] = newVals["doc_title"].replace(/\t/mg,"        ");
+		newVals["doc_title"] = this.Common.exceptCode(newVals["doc_title"]);
+		newVals["doc_title"] = newVals["doc_title"].replace(/\x0D\x0A|\x0D|\x0A/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+
+		var changed = false;
+		var props;
+		for(props in newVals){
+			if(this.info[props] == newVals[props]) continue;
+			this.info[props] = newVals[props];
+			changed = true;
+		}
+
+		if(changed){
+			if(this.info.title) this.info.title = this.info.title.replace(/[\r\n]/mg, " ");
+			if(this.info.doc_title) this.info.doc_title = this.info.doc_title.replace(/[\r\n]/mg, " ");
+			if(this.info.note || this.info.logical_page || this.info.physical_page){
+				if(this.info.property == "") this.info.property = "<PROPERTY/>";
+				this._createXMLDoc(this.info.property);
+				if(this.xmldoc){
+					if(this.info.note != undefined){
+						var note = this.xmldoc.getElementsByTagName("NOTE")[0];
+						if(this.info.note != "" && !note){
+							note = this.xmldoc.createElement("NOTE");
+							this.xmldoc.documentElement.appendChild(note);
+						}else if(this.info.note == "" && note){
+							note.parentNode.removeChild(note);
+							note = undefined;
+						}
+						if(note){
+							while(note.hasChildNodes()){ note.removeChild(note.lastChild); }
+							note.appendChild(this.xmldoc.createTextNode(this.info.note));
+						}
+					}
+					if(this.info.logical_page != undefined){
+						var extras_msg = this.xmldoc.getElementsByTagName("EXTENDED_MESSAGE")[0];
+						if(!extras_msg){
+							extras_msg = this.xmldoc.createElement("EXTENDED_MESSAGE");
+							this.xmldoc.documentElement.appendChild(extras_msg);
+						}
+						var lpage_elem = this.xmldoc.getElementsByTagName("LOGICAL_PAGE")[0];
+						if(this.info.logical_page != "" && !lpage_elem){
+							lpage_elem = this.xmldoc.createElement("LOGICAL_PAGE");
+							extras_msg.appendChild(lpage_elem);
+						}else if(this.info.logical_page == "" && lpage_elem){
+							lpage_elem.parentNode.removeChild(lpage_elem);
+							lpage_elem = undefined;
+						}
+						if(lpage_elem){
+							while(lpage_elem.hasChildNodes()){ lpage_elem.removeChild(lpage_elem.lastChild); }
+							lpage_elem.appendChild(this.xmldoc.createTextNode(this.info.logical_page));
+						}
+					}
+
+					if(this.info.physical_page != undefined){
+						var extras_msg = this.xmldoc.getElementsByTagName("EXTENDED_MESSAGE")[0];
+						if(!extras_msg){
+							extras_msg = this.xmldoc.createElement("EXTENDED_MESSAGE");
+							this.xmldoc.documentElement.appendChild(extras_msg);
+						}
+						var ppage_elem = this.xmldoc.getElementsByTagName("PHYSICAL_PAGE")[0];
+						if(this.info.physical_page != "" && !ppage_elem){
+							ppage_elem = this.xmldoc.createElement("PHYSICAL_PAGE");
+							extras_msg.appendChild(ppage_elem);
+						}else if(this.info.physical_page == "" && ppage_elem){
+							ppage_elem.parentNode.removeChild(ppage_elem);
+							ppage_elem = undefined;
+						}
+						if(ppage_elem){
+							while(ppage_elem.hasChildNodes()){ ppage_elem.removeChild(ppage_elem.lastChild); }
+							ppage_elem.appendChild(this.xmldoc.createTextNode(this.info.physical_page));
+						}
+					}
+
+					this.info.property = this._xmlSerializer();
+				}
+			}
+		}
+		return true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	cancel : function(aEvent){
+		window.arguments[0].accept = 0;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		if(nsPreferences.getBoolPref("wiredmarker.debug", false)) window.dump(aString+"\n");
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/confirmAddTextDialog.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/confirmAddTextDialog.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/confirmAddTextDialog.xul	(revision 5703)
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<!DOCTYPE dialog [
+<!ENTITY % pdfDTD   SYSTEM "chrome://markingcollection/locale/pdf.dtd" >
+%pdfDTD;
+<!ENTITY % markerDTD SYSTEM "chrome://markingcollection/locale/marker.dtd" >
+%markerDTD;
+]>
+
+<dialog
+	id="wmConfirmAddTextDialog"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml"
+	title="&pdf.addtext.dialog.title;"
+	buttons="accept,cancel"
+	defaultButton="accept"
+	onload="wmConfirmAddTextDialog.init();"
+	ondialogaccept="return wmConfirmAddTextDialog.accept();"
+	ondialogcancel="wmConfirmAddTextDialog.cancel();">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/confirmAddTextDialog.js" />
+	<stringbundleset id="wmStringBundles">
+		<stringbundle id="wmConfirmAddTextDialogString" src="chrome://markingcollection/locale/markingcollection.properties" />
+	</stringbundleset>
+	<description>&pdf.addtext.dialog.msg;</description>
+	<groupbox flex="1">
+		<caption label="&pdf.addtext.caption.url;"/>
+		<textbox id="wmUrl" style="plain" readonly="true" onfocus="this.select()"/>
+	</groupbox>
+	<groupbox flex="1">
+		<caption label="&pdf.addtext.caption.pagetitle;"/>
+		<textbox id="wmPageTitle" style="plain" onfocus="this.select()"/>
+	</groupbox>
+	<groupbox flex="1">
+		<caption label="&pdf.addtext.caption.title;"/>
+		<hbox id="wmTitleHBox" style="border:2px solid transparent;">
+			<textbox
+				id="wmTitle"
+				flex="1"
+				style="plain"
+				emptytext="&marker.initdata.dialog.emptytext.title;"
+				placeholder="&marker.initdata.dialog.emptytext.title;"
+				onfocus="this.select()"
+				oninput="wmConfirmAddTextDialog.inputTitle(event);"
+				onblur="wmConfirmAddTextDialog.inputTitle(event);"
+				onchange="wmConfirmAddTextDialog.changeTitle(event);"/>
+		</hbox>
+	</groupbox>
+	<groupbox flex="1">
+		<caption label="&pdf.addtext.caption.note;"/>
+		<textbox id="wmNote"  multiline="true"  style="plain" onfocus="this.select()"/>
+	</groupbox>
+	<groupbox flex="1">
+		<caption label="&pdf.addtext.caption.pageinfo;"/>
+		<hbox align="center">
+			<label value="Logical Page :" control="wmLogicalPage"/>
+			<textbox id="wmLogicalPage" size="1" style="plain" onfocus="this.select()"/>
+			<label value="Physical Page :" control="wmPhysicalPage"/>
+			<textbox id="wmPhysicalPage" size="1" style="plain" onfocus="this.select()"/>
+		</hbox>
+	</groupbox>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/confirmDialog.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/confirmDialog.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/confirmDialog.js	(revision 5703)
@@ -0,0 +1,90 @@
+var spmConfirmDialog = {
+
+/////////////////////////////////////////////////////////////////////
+	get STRING()     { return document.getElementById("spmConfirmDialogString"); },
+	get DataSource() { return window.opener.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.opener.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.opener.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.opener.top.bitsObjectMng.Database;   },
+	get gBrowser()   { return window.opener.top.bitsObjectMng.getBrowser();},
+
+	get S_TITLE()    { return document.getElementById("spmSrcTitle"); },
+	get S_NODE()     { return document.getElementById("spmSrcNote"); },
+	get D_TITLE()    { return document.getElementById("spmDstTitle"); },
+	get D_NODE()     { return document.getElementById("spmDstNote"); },
+	get SAMEPROCESS(){ return document.getElementById("spmConfirmSameProcessing"); },
+
+/////////////////////////////////////////////////////////////////////
+	init : function(){
+		if(spmConfirmDialog._init) return;
+
+		try {
+			this.info = window.arguments[0];
+		}catch(ex){
+		}
+
+		this.S_TITLE.value = this.info.src.title;
+		this.S_NODE.value  = this.info.src.note;
+		this.D_TITLE.value = this.info.dst.title;
+		this.D_NODE.value  = this.info.dst.note;
+
+		try{
+			this._init = true;
+		}catch(ex){
+			this.Common.alert("spmConfirmDialog.init():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(event){
+		if(this._init){
+			this._init = false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	commandCondition : function(aEvent){
+		this.prefs.conditionMerge = this.ConditionMarker.value;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	commandConfirm : function(aEvent){
+		this.prefs.confirmMerge = this.ConfirmMerge.checked;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getSameProcessing : function(){
+		return (this.SAMEPROCESS.getAttribute("checked")=="true"?true:false);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	merge : function(aEvent){
+		window.arguments[1].accept = 1;
+		window.arguments[1].sameprocessing = spmConfirmDialog.getSameProcessing();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	overwrite : function(aEvent){
+		window.arguments[1].accept = 2;
+		window.arguments[1].sameprocessing = spmConfirmDialog.getSameProcessing();
+		window.close();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	destruction : function(aEvent){
+		window.arguments[1].accept = 3;
+		window.arguments[1].sameprocessing = spmConfirmDialog.getSameProcessing();
+		window.close();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	cancel : function(aEvent){
+		window.arguments[1].accept = 0;
+		window.arguments[1].sameprocessing = spmConfirmDialog.getSameProcessing();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		if(nsPreferences.getBoolPref("wiredmarker.debug", false)) window.dump(aString+"\n");
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/confirmDialog.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/confirmDialog.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/confirmDialog.xul	(revision 5703)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/scrappartymerge.dtd">
+<dialog
+	id="spmConfirmDialog"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml"
+	title="&scrappartymerge.confirm.title;"
+	buttons="extra1,extra2,accept,cancel"
+	buttonlabelaccept="&scrappartymerge.mergemode.merge;"
+	buttonlabelextra1="&scrappartymerge.mergemode.overwrite;"
+	buttonlabelextra2="&scrappartymerge.mergemode.destruction;"
+	defaultButton="accept"
+	onload="spmConfirmDialog.init();"
+	ondialogaccept="spmConfirmDialog.merge();"
+	ondialogextra1="spmConfirmDialog.overwrite();"
+	ondialogextra2="spmConfirmDialog.destruction();"
+	ondialogcancel="spmConfirmDialog.cancel();">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/confirmDialog.js" />
+	<stringbundleset id="spmStringBundles">
+		<stringbundle id="spmConfirmDialogString" src="chrome://markingcollection/locale/scrappartymerge.properties" />
+	</stringbundleset>
+	<hbox>
+		<groupbox flex="1">
+			<caption label="&scrappartymerge.confirm.dropobject;"/>
+			<vbox flex="1">
+				<textbox id="spmSrcTitle" multiline="false" style="plain" readonly="true"/>
+				<textbox id="spmSrcNote"  multiline="true" style="plain" readonly="true"/>
+			</vbox>
+		</groupbox>
+		<groupbox flex="1">
+			<caption label="&scrappartymerge.confirm.mergeobject;"/>
+			<textbox id="spmDstTitle" multiline="false" flex="1" style="plain" readonly="true"/>
+			<textbox id="spmDstNote"  multiline="true" flex="99" style="plain" readonly="true"/>
+		</groupbox>
+	</hbox>
+	<hbox>
+		<checkbox id="spmConfirmSameProcessing" label="&scrappartymerge.confirm.same_processing;"/>
+		<spacer flex="1"/>
+		<button dlgtype="accept"/>
+		<button dlgtype="extra1"/>
+		<button dlgtype="extra2"/>
+		<button dlgtype="cancel"/>
+	</hbox>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/contents.rdf
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/contents.rdf	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/contents.rdf	(revision 5703)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
+	<RDF:Seq RDF:about="urn:mozilla:package:root">
+		<RDF:li RDF:resource="urn:mozilla:package:markingcollection"/>
+	</RDF:Seq>
+	<RDF:Seq RDF:about="urn:mozilla:overlays">
+		<RDF:li RDF:resource="chrome://browser/content/browser.xul"/>
+		<RDF:li RDF:resource="chrome://navigator/content/navigator.xul"/>
+	</RDF:Seq>
+	<RDF:Seq RDF:about="chrome://browser/content/browser.xul">
+		<RDF:li>chrome://markingcollection/content/overlay.xul</RDF:li>
+	</RDF:Seq>
+	<RDF:Seq about="chrome://navigator/content/navigator.xul">
+		<RDF:li>chrome://markingcollection/content/overlay.xul</RDF:li>
+	</RDF:Seq>
+	<RDF:Description RDF:about="urn:mozilla:package:markingcollection"
+		chrome:displayName="WiredMarker. ver1.5"
+		chrome:author="BITS(C)"
+		chrome:authorURL="mailto:support@bits.cc"
+		chrome:name="markingcollection"
+		chrome:extension="true"
+		chrome:description="Marking and Collection.">
+	</RDF:Description>
+</RDF:RDF>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/contextmenu.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/contextmenu.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/contextmenu.js	(revision 5703)
@@ -0,0 +1,807 @@
+// ã³ã³ãã­ã¹ãã¡ãã¥ãŒ
+var bitsContextMenu = {
+    dispMenu: true,
+    _localFolderRes: null,
+    _cssTitle: "bitsMarkingCollectionCSS",
+    _styleSheet: null,
+    get STRING() {
+        return document.getElementById("MarkingCollectionOverlayString");
+    },
+    get DataSource() {
+        return window.top.bitsObjectMng.DataSource;
+    },
+    get Common() {
+        return window.top.bitsObjectMng.Common;
+    },
+    get XPath() {
+        return window.top.bitsObjectMng.XPath;
+    },
+    get Database() {
+        return window.top.bitsObjectMng.Database;
+    },
+    get gBrowser() {
+        return window.top.bitsObjectMng.getBrowser();
+    },
+    get _contextMenu() {
+        return top.document.getElementById("MarkingCollectionContextMenu");
+    },
+    get _contextMenuRemarker() {
+        return top.document.getElementById("MarkingCollectionContextMenuItemMarkerRemarker");
+    },
+    get _contextMenuRemoveAll() {
+        return top.document.getElementById("MarkingCollectionContextMenuItemMarkerRemoveAll");
+    },
+    get _contextMenuRemove() {
+        return top.document.getElementById("MarkingCollectionContextMenuItemMarkerRemove");
+    },
+    get _contextMenuRemoveSep() {
+        return top.document.getElementById("MarkingCollectionContextMenuSeparatorMarkerRemove");
+    },
+    get _contextMenuProperty() {
+        return top.document.getElementById("MarkingCollectionContextMenuItemMarkerProperty");
+    },
+    get _contextMenuPropertySep() {
+        return top.document.getElementById("MarkingCollectionContextMenuSeparatorMarkerProperty");
+    },
+    get _contextMenuCopyToClipboard() {
+        return top.document.getElementById("MarkingCollectionContextMenuItemMarkerCopyToClipboard");
+    },
+    get _contextMenuCopyToClipboardSep() {
+        return top.document.getElementById("MarkingCollectionContextMenuSeparatorMarkerCopyToClipboard");
+    },
+    get _contextMenuUncategorized() {
+        return top.document.getElementById("MarkingCollectionContextMenuUncategorized");
+    },
+    get _contentAreaContextMenu() {
+        return top.document.getElementById("contentAreaContextMenu");
+    },
+    get _contextBookmarklink() {
+        return top.document.getElementById("context-bookmarklink");
+    },
+    get _contextMenuObject() {
+        if ("gContextMenu" in window && gContextMenu) {
+            return gContextMenu;
+        } else if ("gContextMenu" in window.top && window.top.gContextMenu) {
+            return window.top.gContextMenu;
+        } else {
+            return {
+                target: null,
+                onLink: false,
+                link: false,
+                onImage: false
+            }
+        }
+    },
+/////////////////////////////////////////////////////////////////////
+    init: function() {
+        bitsContextMenu.removeMenu();
+        bitsContextMenu._buildElement = [];
+        bitsContextMenu.popup_elem = null;
+        bitsContextMenu._contentAreaContextMenu.addEventListener("popupshowing", bitsContextMenu.popupshowing, false);
+        bitsContextMenu.initMarkerFolder();
+        bitsContextMenu.rebuildCSS();
+    },
+/////////////////////////////////////////////////////////////////////
+    done: function() {
+        this.removeMenu();
+        delete this._buildElement;
+        this._buildElement = null;
+        this._contentAreaContextMenu.removeEventListener("popupshowing", bitsContextMenu.popupshowing, false);
+    },
+/////////////////////////////////////////////////////////////////////
+    rebuildCSS: function() {
+        var styleSheet = null;
+        var i;
+        for (i = 0; i < document.styleSheets.length; i++) {
+            if (document.styleSheets[i].title != bitsContextMenu._cssTitle)
+                continue;
+            styleSheet = document.styleSheets[i];
+            break;
+        }
+        if (!styleSheet)
+            return;
+        var dbinfo = bitsMarkingCollection.dbinfo.getAllDBInfo();
+        if (dbinfo) {
+            for (i = 0; i < dbinfo.length; i++) {
+                var foldres = bitsContextMenu.Database.getAllFolder(dbinfo[i].database_dbtype);
+                if (foldres) {
+                    var j;
+                    for (j = 0; j < foldres.length; j++) {
+                        if (!foldres[j].fid_style || foldres[j].fid_style == "")
+                            continue;
+                        var selector = "#css_" + dbinfo[i].database_dbtype + "_" + foldres[j].fid;
+                        styleSheet.insertRule(selector + " { -moz-appearance: none !important; " + foldres[j].fid_style + " }", styleSheet.cssRules.length);
+                        styleSheet.insertRule(selector + '[_moz-menuactive="true"] { -moz-appearance: none !important; background-color: Highlight; color: HighlightText; }', styleSheet.cssRules.length);
+                    }
+                }
+            }
+        }
+    },
+/////////////////////////////////////////////////////////////////////
+    removeMenu: function() {
+        if (!this._buildElement || this._buildElement.length == 0)
+            return;
+        var i;
+        for (i = this._buildElement.length - 1; i >= 0; i--) {
+            this._buildElement[i].parentNode.removeChild(this._buildElement[i]);
+        }
+        delete this._buildElement;
+        this._buildElement = null;
+        this._buildElement = [];
+    },
+/////////////////////////////////////////////////////////////////////
+    createMarkerFolder: function(pTitle, pTarResName, pStyle, pIndex, pPID, pOrder) {
+        try {
+            if (!pPID)
+                pPID = 0;
+            var dbtype;
+            if (pTarResName) {
+                var aRes = this.Common.RDF.GetResource(pTarResName);
+                dbtype = this.DataSource.getProperty(aRes, "dbtype");
+            } else {
+                dbtype = this.Database._defaultMode;
+            }
+            var newID = this.DataSource.identify(this.Common.getTimeStamp());
+            var newFolder = this.Database.newFolder(newID);
+            newFolder.fid_title = pTitle;
+            newFolder.fid_style = pStyle;
+            newFolder.pfid = "" + pPID;
+            if (pOrder)
+                newFolder.pfid_order = "" + pOrder;
+            if (!this.Database.addFolder(newFolder, dbtype))
+                return null;
+            return newFolder.fid;
+        } catch (e) {
+            bitsContextMenu._dump("bitsContextMenu.createMarkerFolder():" + e);
+            return null;
+        }
+    },
+/////////////////////////////////////////////////////////////////////
+    initMarkerFolder: function() {
+        if (this.Database._fidCount() == 0) {
+            var folder_title = this.STRING.getString("MARKER_FOLDER");
+            var pfid = this.createMarkerFolder(folder_title, undefined, undefined, undefined, undefined, 1);
+            for (var i = 8; i > 0; i--) {
+                var idx = i;
+                var title = folder_title + idx;
+                var cssText = nsPreferences.copyUnicharPref("wiredmarker.marker.style." + idx, bitsMarker.PRESET_STYLES[idx]);
+                this.createMarkerFolder(title, undefined, cssText, idx, pfid, idx);
+            }
+        }
+    },
+/////////////////////////////////////////////////////////////////////
+    rebuild: function() {
+        this.removeMenu();
+        var doc = this._contentAreaContextMenu.ownerDocument;
+        var removePElem = null;
+        var removeElem = null;
+        var i;
+        var rootfolder = nsPreferences.copyUnicharPref("wiredmarker.rootfolder", window.top.bitsObjectMng.DataSource.ABOUT_ROOT);
+        var contResList = this.DataSource.flattenResources(this.Common.RDF.GetResource(rootfolder), 1, false);
+        for (i = 0; i < contResList.length; i++) {
+            if (contResList[i].Value == rootfolder)
+                continue;
+            var title = this.DataSource.getProperty(contResList[i], "title");
+            if (title == "")
+                continue;
+            var contItemList = this.DataSource.flattenResources(contResList[i], 1, false);
+            if (contItemList.length <= 1)
+                continue;
+            removeElem = null;
+            removePElem = null;
+            var elemMenu = top.document.createElement("menu");
+            var elemMenupopup = top.document.createElement("menupopup");
+            if (!elemMenu || !elemMenupopup)
+                continue;
+            elemMenu.setAttribute("label", title);
+            elemMenupopup.setAttribute("id", contResList[i].Value);
+            elemMenupopup.addEventListener("command", this.commandIndexContextMenu, false);
+            elemMenupopup.addEventListener("click", this.clickIndexContextMenu, false);
+            elemMenupopup.addEventListener("popuphidden", this.popuphiddenIndexContextMenu, false);
+            elemMenupopup.addEventListener("popupshowing", this.popupshowingIndexContextMenu, false);
+            elemMenu.appendChild(elemMenupopup);
+            this._contentAreaContextMenu.insertBefore(elemMenu, this._contextBookmarklink);
+            this._buildElement.push(elemMenu);
+            this._buildElement.push(elemMenupopup);
+        }
+        if (contResList.length > 0) {
+            var id = "DS_menuseparator";
+            removeElem = doc.getElementById(id);
+            if (removeElem)
+                removeElem.parentNode.removeChild(removeElem);
+            removeElem = null;
+            var elemMenuseparator = top.document.createElement("menuseparator");
+            elemMenuseparator.setAttribute("id", "MC_menuseparator");
+            this._contentAreaContextMenu.insertBefore(elemMenuseparator, this._contextBookmarklink);
+            this._buildElement.push(elemMenuseparator);
+        }
+    },
+/////////////////////////////////////////////////////////////////////
+    isDispContextmenu: function(aDoc) {
+        var nodesSnapshot = this.getMarkerNodes(aDoc);
+        var rtn = (nodesSnapshot && nodesSnapshot.snapshotLength > 0 ? true : false);
+        if (rtn)
+            return rtn;
+        var url = bitsContextMenu.Common.getURLStringFromDocument(aDoc);
+        var rtnObj = this.Database.getAllObjectFormContentURL(url);
+        return (rtnObj && rtnObj.length > 0) ? true : false;
+    },
+/////////////////////////////////////////////////////////////////////
+    getMarkerNodes: function(aDoc) {
+        return this.XPath.evaluate('//*[@id and @dbtype and @pfid]', aDoc);
+    },
+/////////////////////////////////////////////////////////////////////
+    popupshowing: function(event) {
+        var cm = bitsContextMenu._contextMenuObject;
+        bitsContextMenu.popup_elem = null;
+        var match_exp = new RegExp("^(" + bitsMarker.id_key + ".+)$", "mg");
+        var clickElem = cm.target;
+        while (clickElem && clickElem.id) {
+            if (clickElem.id.match(match_exp)) {
+                bitsContextMenu.popup_elem = clickElem;
+                break;
+            }
+            clickElem = clickElem.parentNode;
+        }
+        bitsContextMenu._contextMenu.setAttribute("hidden", "true");
+        bitsContextMenu._contextMenuProperty.setAttribute("hidden", "true");
+        bitsContextMenu._contextMenuPropertySep.setAttribute("hidden", "true");
+        bitsContextMenu._contextMenuRemarker.setAttribute("hidden", "true");
+        bitsContextMenu._contextMenuRemoveAll.setAttribute("hidden", "true");
+        bitsContextMenu._contextMenuRemove.setAttribute("hidden", "true");
+        bitsContextMenu._contextMenuRemoveSep.setAttribute("hidden", "true");
+        bitsContextMenu._contextMenuCopyToClipboard.setAttribute("hidden", "true");
+        bitsContextMenu._contextMenuCopyToClipboardSep.setAttribute("hidden", "true");
+        bitsContextMenu._contextMenuUncategorized.setAttribute("hidden", "true");
+
+        var tagoutput_contextmenu_disp = true;
+        var contextmenu_mode = nsPreferences.copyUnicharPref("wiredmarker.contextmenu.mode");
+        var contextmenu_type = nsPreferences.copyUnicharPref("wiredmarker.contextmenu.type", "");
+        if (contextmenu_mode == "legacy" && contextmenu_type == "simple") {
+            tagoutput_contextmenu_disp = false;
+        } else {
+            tagoutput_contextmenu_disp = bitsTagOutputService.isDispContextmenu(bitsContextMenu.gBrowser.contentDocument);
+        }
+
+        if (bitsContextMenu.isDispContextmenu(bitsContextMenu.gBrowser.contentDocument)) {
+            bitsContextMenu._contextMenu.removeAttribute("hidden");
+            bitsContextMenu._contextMenuRemoveAll.removeAttribute("hidden");
+            if (tagoutput_contextmenu_disp)
+                bitsContextMenu._contextMenuRemoveSep.removeAttribute("hidden");
+        }
+
+        var contentWindow = null;
+        var mcTreeHandler = null;
+        if (window.top.bitsMarkingCollection._contentWindow)
+            contentWindow = window.top.bitsMarkingCollection._contentWindow;
+        if (contentWindow && contentWindow.mcTreeHandler)
+            mcTreeHandler = contentWindow.mcTreeHandler;
+        if (tagoutput_contextmenu_disp || cm.isTextSelected || cm.onLink || cm.onImage || bitsContextMenu.popup_elem) {
+            bitsContextMenu._contextMenu.removeAttribute("hidden");
+            if (cm.isTextSelected || cm.onLink || cm.onImage) {
+                var menupopup = bitsContextMenu._contextMenu.firstChild;
+                if (bitsMarkingCollection._uncategorized.use)
+                    bitsContextMenu._contextMenuUncategorized.removeAttribute("hidden");
+            }
+            if (bitsContextMenu.popup_elem) {
+                bitsContextMenu._contextMenu.removeAttribute("hidden");
+                bitsContextMenu._contextMenuRemoveSep.removeAttribute("hidden");
+                if (mcTreeHandler) {
+                    bitsContextMenu._contextMenuProperty.removeAttribute("hidden");
+                    bitsContextMenu._contextMenuPropertySep.removeAttribute("hidden");
+                    bitsContextMenu._contextMenuCopyToClipboard.removeAttribute("hidden");
+                    bitsContextMenu._contextMenuCopyToClipboardSep.removeAttribute("hidden");
+                }
+                bitsContextMenu._contextMenuRemove.removeAttribute("hidden");
+                if (cm.isTextSelected) {
+                    bitsContextMenu._contextMenuRemarker.removeAttribute("hidden");
+                }
+                if (cm.isTextSelected || cm.onLink || cm.onImage) {
+                    bitsContextMenu._contextMenuRemoveSep.removeAttribute("hidden");
+                }
+            }
+        } else {
+        }
+    },
+/////////////////////////////////////////////////////////////////////
+    popuphidden: function(event) {
+    },
+/////////////////////////////////////////////////////////////////////
+    commandIndexContextMenu: function(event) {
+        if (bitsMarker && event.target == bitsContextMenu._contextMenuRemoveAll) {
+            if (!bitsContextMenu.Common.confirm(bitsContextMenu.STRING.getString("CONFIRM_DELETE_ALL")))
+                return;
+            var rtn = false;
+            var url = bitsContextMenu.Common.getURLStringFromDocument(bitsContextMenu.gBrowser.contentDocument);
+            var rtnObj = bitsMarkingCollection.Database.getAllObjectFormContentURL(url);
+            if (rtnObj && rtnObj.length) {
+                var contentWindow = null;
+                var bitsItemView = null;
+                var mcPropertyView = null;
+                if (window.top.bitsMarkingCollection._contentWindow)
+                    contentWindow = window.top.bitsMarkingCollection._contentWindow;
+                if (contentWindow && contentWindow.bitsItemView)
+                    bitsItemView = contentWindow.bitsItemView;
+                if (contentWindow && contentWindow.mcPropertyView)
+                    mcPropertyView = contentWindow.mcPropertyView;
+                for (var i = 0; i < rtnObj.length; i++) {
+                    var pfid = rtnObj[i].pfid;
+                    var dbtype = rtnObj[i].dbtype;
+                    var oid = rtnObj[i].oid;
+                    var res = bitsContextMenu.Common.RDF.GetResource(bitsContextMenu.DataSource.ABOUT_ITEM + oid);
+                    if (event && res)
+                        bitsScrapPartyAddonService.eventListener(event, 0, res);
+                    rtn |= bitsContextMenu.Database.removeObject({oid: oid, pfid: pfid}, dbtype, false);
+                    var node_id = bitsMarker.id_key + dbtype + oid;
+                    bitsMarker.unmarkerWindow(node_id);
+                    if (event && res)
+                        bitsScrapPartyAddonService.eventListener(event, 1, res);
+                    try {
+                        if (res && bitsItemView && !bitsItemView.isChecked)
+                            bitsContextMenu.DataSource.deleteItem(res);
+                    } catch (e) {
+                    }
+                }
+                if (rtn) {
+                    try {
+                        if (bitsItemView)
+                            bitsItemView.refresh();
+                        if (mcPropertyView)
+                            mcPropertyView.dispProperty();
+                    } catch (e) {
+                    }
+                }
+            }
+            return;
+        }
+
+        var win = bitsContextMenu.Common.getFocusedWindow();
+        var sel = win.getSelection();
+        var isSelected = false;
+        try {
+            isSelected = (sel.anchorNode === sel.focusNode && sel.anchorOffset == sel.focusOffset) ? false : true;
+        } catch (ex) {
+        }
+        var cm = bitsContextMenu._contextMenuObject;
+        var fid = event.target.getAttribute("fid");
+        var fid_style = event.target.getAttribute("_style");
+        var dbtype = event.target.getAttribute("dbtype");
+        if (fid != "" && dbtype != "") {
+            if (isSelected) {
+                var newResArr = bitsMarkingCollection.addSelectedText({fid: fid, fid_style: fid_style, dbtype: dbtype}, -1);
+                if (!newResArr)
+                    return;
+                var contentWindow = null;
+                var mcTreeHandler = null;
+                var mcController = null;
+                if (window.top.bitsMarkingCollection._contentWindow)
+                    contentWindow = window.top.bitsMarkingCollection._contentWindow;
+                if (contentWindow) {
+                    if (contentWindow.mcTreeHandler)
+                        mcTreeHandler = contentWindow.mcTreeHandler;
+                    if (contentWindow.mcController)
+                        mcController = contentWindow.mcController;
+                }
+                if (mcTreeHandler && mcController) {
+                    mcController.rebuildLocal();
+                    var XferData = {};
+                    XferData.data = "";
+                    XferData.flavour = {};
+                    XferData.flavour.contentType = "text/x-moz-url";
+                    var XferDataSet = {};
+                    XferDataSet.first = {};
+                    XferDataSet.first.first = XferData;
+                    var row = mcTreeHandler.TREE.builderView.getIndexOfResource(newResArr[0]);
+                    if (row < 0) {
+                        var folderRes = bitsContextMenu.DataSource.findParentResource(newResArr[0]);
+                        row = mcTreeHandler.TREE.builderView.getIndexOfResource(folderRes);
+                    }
+                    bitsScrapPartyAddonService.builderViewObserver.onDrop(row, 1, mcTreeHandler.TREE, XferDataSet, {isSelected: isSelected, resArr: newResArr});
+                }
+            } else if (cm && cm.target && (cm.onLink || cm.onImage)) {
+                var aXferString = "";
+                var aTarget = null;
+                var url = "";
+                var txtContext = "";
+                if (cm.onLink) {
+                    var elemA = cm.target;
+                    if (elemA.nodeName != "A") {
+                        while (elemA && elemA.nodeName != "A") {
+                            elemA = elemA.parentNode;
+                        }
+                    }
+                    if (!elemA)
+                        return;
+                    aTarget = elemA;
+                    url = elemA.href;
+                    var nodeWalker = elemA.ownerDocument.createTreeWalker(elemA, NodeFilter.SHOW_TEXT, null, false);
+                    for (var txtNode = nodeWalker.nextNode(); txtNode; txtNode = nodeWalker.nextNode()) {
+                        txtContext += txtNode.nodeValue.replace(/[\r\n\t]+/mg, "") + " ";
+                    }
+                    txtContext = txtContext.replace(/^\s+/mg, "").replace(/\s+$/mg, "").replace(/\s{2,}/mg, " ");
+                    if (txtContext == "")
+                        txtContext = url;
+                }
+                if (cm.onImage) {
+                    var elemIMG = null;
+                    if (cm.target.nodeName == "IMG")
+                        elemIMG = cm.target;
+                    if (elemIMG) {
+                        aTarget = elemIMG;
+                        if (!cm.onLink && elemIMG.src)
+                            url = elemIMG.src;
+                        if (!cm.onLink && elemIMG.alt)
+                            txtContext = elemIMG.alt;
+                    }
+                }
+                aXferString = url + "\n" + txtContext;
+                if (url.indexOf("http://") == 0 || url.indexOf("https://") == 0 || url.indexOf("file://") == 0) {
+                    bitsMarkingCollection.addURLText({fid: fid, fid_style: fid_style, dbtype: dbtype}, -1, undefined, aXferString, aTarget);
+                } else {
+                    this.Common.alert(bitsContextMenu.STRING.getString("ERROR_INVALID_URL") + "\n" + url);
+                }
+            }
+        } else if (bitsContextMenu.popup_elem && event.target == bitsContextMenu._contextMenuRemove) {
+            var match_exp = new RegExp("^" + bitsMarker.id_key + "\\D+(\\d+)$", "m");
+            if (bitsContextMenu.popup_elem.id.match(match_exp)) {
+                var dbtype = bitsContextMenu.popup_elem.getAttribute("dbtype");
+                match_exp = new RegExp("^" + bitsMarker.id_key + dbtype + "(\\d+)$", "m");
+                if (match_exp.test(bitsContextMenu.popup_elem.id)) {
+                    var id = RegExp.$1;
+                    var res = bitsContextMenu.Common.RDF.GetResource(bitsContextMenu.DataSource.ABOUT_ITEM + id);
+                    if (event)
+                        bitsScrapPartyAddonService.eventListener(event, 0, res);
+                    var pfid = bitsContextMenu.popup_elem.getAttribute("pfid");
+                    var dbtype = bitsContextMenu.popup_elem.getAttribute("dbtype");
+                    if (bitsContextMenu.Database.removeObject({oid: id, pfid: pfid}, dbtype, false)) {
+                        bitsMarker.unmarkerWindow(bitsContextMenu.popup_elem.id);
+                        if (event)
+                            bitsScrapPartyAddonService.eventListener(event, 1, res);
+                        var contentWindow = null;
+                        var bitsItemView = null;
+                        if (window.top.bitsMarkingCollection._contentWindow)
+                            contentWindow = window.top.bitsMarkingCollection._contentWindow;
+                        if (contentWindow && contentWindow.bitsItemView)
+                            bitsItemView = contentWindow.bitsItemView;
+                        try {
+                            if (res && !bitsItemView.isChecked)
+                                bitsContextMenu.DataSource.deleteItem(res);
+                        } catch (e) {
+                        }
+                        try {
+                            var viewmode = window.top.bitsMarkingCollection._contentWindow.mcTreeViewModeService.viewmode;
+                            bitsItemView.refresh();
+                            var mcPropertyView = null;
+                            if (contentWindow && contentWindow.mcPropertyView)
+                                mcPropertyView = contentWindow.mcPropertyView;
+                            if (mcPropertyView)
+                                mcPropertyView.dispProperty();
+                        } catch (e) {
+                        }
+                    }
+                }
+            }
+        } else if (bitsContextMenu.popup_elem && event.target == bitsContextMenu._contextMenuRemarker) {
+            var match_exp = new RegExp("^" + bitsMarker.id_key + "\\D+(\\d+)$", "m");
+            if (bitsContextMenu.popup_elem.id.match(match_exp)) {
+                bitsMarkingCollection.updateSelectedText(bitsContextMenu.popup_elem);
+            }
+        } else if (bitsContextMenu.popup_elem && event.target == bitsContextMenu._contextMenuProperty) {
+            var contentWindow = null;
+            var bitsItemView = null;
+            var mcTreeHandler = null;
+            var mcController = null;
+            if (window.top.bitsMarkingCollection._contentWindow)
+                contentWindow = window.top.bitsMarkingCollection._contentWindow;
+            if (contentWindow && contentWindow.bitsItemView)
+                bitsItemView = contentWindow.bitsItemView;
+            if (contentWindow && contentWindow.mcTreeHandler)
+                mcTreeHandler = contentWindow.mcTreeHandler;
+            if (contentWindow && contentWindow.mcController)
+                mcController = contentWindow.mcController;
+            if (bitsItemView && bitsItemView.isChecked) {
+                bitsItemView.property();
+            } else if (mcTreeHandler && mcController && mcTreeHandler.TREE.currentIndex >= 0) {
+                mcController.property(mcTreeHandler.TREE.builderView.getResourceAtIndex(mcTreeHandler.TREE.currentIndex));
+            }
+        } else if (bitsContextMenu.popup_elem && event.target == bitsContextMenu._contextMenuCopyToClipboard) {
+            try {
+                var match_exp = new RegExp("^" + bitsMarker.id_key + "\\D+(\\d+)$", "m");
+                if (bitsContextMenu.popup_elem.id.match(match_exp)) {
+                    var dbtype = bitsContextMenu.popup_elem.getAttribute("dbtype");
+                    match_exp = new RegExp("^" + bitsMarker.id_key + dbtype + "(\\d+)$", "m");
+                    if (match_exp.test(bitsContextMenu.popup_elem.id)) {
+                        var oid = RegExp.$1;
+                        bitsMetaCapture.copyToClipBoardByHyperanchor(oid, dbtype);
+                    }
+                }
+            } catch (e) {
+                alert(e);
+            }
+        }
+    },
+/////////////////////////////////////////////////////////////////////
+    clickIndexContextMenu: function(event) {
+    },
+/////////////////////////////////////////////////////////////////////
+    popuphiddenIndexContextMenu: function(event) {
+        if (!event.target.nodeName || event.target.nodeName != "menupopup")
+            return;
+        var elemMenupopup = event.target;
+        if (!elemMenupopup.hasChildNodes() || elemMenupopup.childNodes.length == 0)
+            return;
+        var match_exp = new RegExp("^(MarkingCollectionContextMenu.+)$", "mg");
+        var i;
+        for (i = elemMenupopup.childNodes.length - 1; i >= 0; i--) {
+            if (elemMenupopup.childNodes[i].id && elemMenupopup.childNodes[i].id != "" && elemMenupopup.childNodes[i].id.match(match_exp))
+                continue; /* ãã©ã«ããŒã¡ãã¥ãŒã®ã¿åé€ãã */
+            elemMenupopup.removeChild(elemMenupopup.childNodes[i]);
+        }
+    },
+/////////////////////////////////////////////////////////////////////
+    popupshowingIndexContextMenu_old: function(event) {
+        if (!event.target.nodeName || event.target.nodeName != "menupopup")
+            return;
+        var cm = bitsContextMenu._contextMenuObject;
+        if (cm && !(cm.isTextSelected || cm.onLink || cm.onImage))
+            return;
+        var elemMenupopup = event.target;
+        var j;
+        var aRes = null;
+        var rootfolder = elemMenupopup.id;
+        try {
+            aRes = bitsContextMenu.Common.RDF.GetResource(rootfolder);
+        } catch (ex) {
+            rootfolder = bitsMarkingCollection.localfolder.about;
+            if (nsPreferences.copyUnicharPref("wiredmarker.rootfolder", "") == "") {
+                var listContRes = bitsContextMenu.DataSource.flattenResources(bitsContextMenu.Common.RDF.GetResource(rootfolder), 1, false);
+                if (listContRes.length == 2)
+                    rootfolder = listContRes[1].Value;
+            } else {
+                var listContRes = bitsContextMenu.DataSource.flattenResources(bitsContextMenu.Common.RDF.GetResource(bitsContextMenu.DataSource.ABOUT_ROOT), 1, false);
+                if (listContRes.length == 2)
+                    rootfolder = listContRes[1].Value;
+            }
+            aRes = bitsContextMenu.Common.RDF.GetResource(rootfolder);
+        }
+        if (!aRes) {
+            this.Common.alert(elemMenupopup.id);
+            return;
+        }
+        var title = bitsContextMenu.DataSource.getProperty(aRes, "title");
+        var style = bitsContextMenu.DataSource.getProperty(aRes, "style");
+        if (rootfolder != bitsMarkingCollection.localfolder.about) {
+            var elemMenuitem = top.document.createElement("menuitem");
+            if (elemMenuitem) {
+                var isContainerOpen = false;
+                elemMenuitem.setAttribute("id", aRes.Value);
+                elemMenuitem.setAttribute("label", title);
+                elemMenuitem.setAttribute("style", style);
+                if (isContainerOpen) {
+                    elemMenuitem.setAttribute("image", "chrome://markingcollection/skin/folder-open.png");
+                } else {
+                    elemMenuitem.setAttribute("image", "chrome://markingcollection/skin/folder-close.png");
+                }
+                elemMenuitem.setAttribute("class", "menuitem-iconic");
+                elemMenupopup.appendChild(elemMenuitem);
+                var elemMenuseparator = top.document.createElement("menuseparator");
+                if (elemMenuseparator) {
+                    elemMenuseparator.setAttribute("id", bitsContextMenu.DataSource.ABOUT_ITEM + "_sep_" + aRes.Value);
+                    elemMenupopup.appendChild(elemMenuseparator);
+                }
+            }
+        }
+        var contItemList = bitsContextMenu.DataSource.flattenResources(aRes, 1, false);
+        var title = bitsContextMenu.DataSource.getProperty(aRes, "title");
+        if (contItemList.length > 1) {
+            for (j = 0; j < contItemList.length; j++) {
+                if (contItemList[j].Value == rootfolder)
+                    continue;
+                var title = bitsContextMenu.DataSource.getProperty(contItemList[j], "title");
+                if (title == "")
+                    continue;
+                var style = bitsContextMenu.DataSource.getProperty(contItemList[j], "style");
+                var contItemSubList = bitsContextMenu.DataSource.flattenResources(contItemList[j], 1, false);
+                if (contItemSubList.length > 1) {
+                    var elemMenuSub = top.document.createElement("menu");
+                    var elemMenuSubpopup = top.document.createElement("menupopup");
+                    if (!elemMenuSub || !elemMenuSubpopup)
+                        continue;
+                    elemMenuSub.setAttribute("label", title);
+                    elemMenuSub.setAttribute("class", "menu-iconic");
+                    var isContainerOpen = false;
+                    if (isContainerOpen) {
+                        elemMenuSub.setAttribute("image", "chrome://markingcollection/skin/folder-open.png");
+                    } else {
+                        elemMenuSub.setAttribute("image", "chrome://markingcollection/skin/folder-close.png");
+                    }
+                    elemMenuSubpopup.setAttribute("id", contItemList[j].Value);
+                    elemMenuSub.appendChild(elemMenuSubpopup);
+                    elemMenupopup.appendChild(elemMenuSub);
+                } else {
+                    var elemMenuitem = top.document.createElement("menuitem");
+                    if (!elemMenuitem)
+                        continue;
+                    var isContainerOpen = false;
+                    elemMenuitem.setAttribute("id", contItemList[j].Value);
+                    elemMenuitem.setAttribute("label", title);
+                    elemMenuitem.setAttribute("style", style);
+                    if (isContainerOpen) {
+                        elemMenuitem.setAttribute("image", "chrome://markingcollection/skin/folder-open.png");
+                    } else {
+                        elemMenuitem.setAttribute("image", "chrome://markingcollection/skin/folder-close.png");
+                    }
+                    elemMenuitem.setAttribute("class", "menuitem-iconic");
+
+                    elemMenupopup.appendChild(elemMenuitem);
+                }
+            }
+        }
+    },
+/////////////////////////////////////////////////////////////////////
+    popupshowingIndexContextMenu: function(event) {
+        if (!event.target.nodeName || event.target.nodeName != "menupopup")
+            return;
+        if (event.target.id && event.target.id != "MarkingCollectionContextMenupopup")
+            return;
+        var cm = bitsContextMenu._contextMenuObject;
+        if (cm && !(cm.isTextSelected || cm.onLink || cm.onImage))
+            return;
+        var elemMenupopup = event.target;
+        var j;
+        var aRes = null;
+        var rootfolder = elemMenupopup.id;
+        var root_fid = elemMenupopup.getAttribute("fid");
+        var root_dbtype = elemMenupopup.getAttribute("dbtype");
+        if (root_fid == "" && root_dbtype == "") {
+            root_fid = nsPreferences.copyUnicharPref("wiredmarker.rootfolder", "");
+            root_dbtype = nsPreferences.copyUnicharPref("wiredmarker.rootfolder_dbtype", "");
+        }
+        if (root_fid == "" && root_dbtype == "") {
+            var dbinfo = window.top.bitsMarkingCollection.dbinfo.getAllDBInfo();
+            if (dbinfo) {
+                var d_dbinfo = [];
+                var i;
+                for (i = 0; i < dbinfo.length; i++) {
+                    if (!dbinfo[i].db_contextmenu)
+                        continue;
+                    d_dbinfo.push(dbinfo[i]);
+                }
+                for (i = 0; i < d_dbinfo.length; i++) {
+                    var foldres = bitsContextMenu.Database.getFolderFormPID("0", d_dbinfo[i].database_dbtype);
+                    this._popupshowingIndexContextMenu(elemMenupopup, foldres);
+                    if (i < d_dbinfo.length - 1) {
+                        var elemMenuseparator = top.document.createElement("menuseparator");
+                        if (elemMenuseparator)
+                            elemMenupopup.appendChild(elemMenuseparator);
+                    }
+                }
+                return;
+            }
+        }
+        var parser = new DOMParser();
+        var foldres = bitsContextMenu.Database.getFolderFormPID(root_fid, root_dbtype);
+        var foldre = bitsContextMenu.Database.getFolderFormID(root_fid, root_dbtype);
+        if (foldre) {
+            var elemMenuitem = top.document.createElement("menuitem");
+            if (elemMenuitem) {
+                elemMenuitem.setAttribute("fid", foldre[0].fid);
+                elemMenuitem.setAttribute("dbtype", foldre[0].dbtype);
+                elemMenuitem.setAttribute("label", foldre[0].fid_title);
+                elemMenuitem.setAttribute("id", "css_" + foldre[0].dbtype + "_" + foldre[0].fid);
+                elemMenuitem.setAttribute("_style", foldre[0].fid_style);
+                elemMenuitem.setAttribute("class", "menuitem-iconic");
+                var acceltext = bitsShortcutService.getAcceltext(foldre[0].fid, foldre[0].dbtype);
+                if (acceltext)
+                    elemMenuitem.setAttribute("acceltext", acceltext);
+                if (foldre[0].fid_property) {
+                    var xmldoc = parser.parseFromString(foldre[0].fid_property, "text/xml");
+                    if (xmldoc && xmldoc.documentElement.nodeName == "parsererror")
+                        xmldoc = undefined;
+                    if (xmldoc) {
+                        var elems = xmldoc.getElementsByTagName("ICON");
+                        if (elems && elems.length > 0)
+                            elemMenuitem.setAttribute("image", elems[0].textContent);
+                        elems = undefined;
+                        xmldoc = undefined;
+                    }
+                }
+                if (!elemMenuitem.hasAttribute("image"))
+                    elemMenuitem.setAttribute("image", "chrome://markingcollection/skin/folder-close.png");
+                elemMenupopup.appendChild(elemMenuitem);
+                if (foldres && foldres.length > 0) {
+                    var elemMenuseparator = top.document.createElement("menuseparator");
+                    if (elemMenuseparator) {
+                        elemMenupopup.appendChild(elemMenuseparator);
+                    }
+                }
+            }
+        }
+        parser = undefined;
+        this._popupshowingIndexContextMenu(elemMenupopup, foldres);
+    },
+/////////////////////////////////////////////////////////////////////
+    _popupshowingIndexContextMenu: function(elemMenupopup, foldres) {
+        if (foldres && foldres.length > 0) {
+            var parser = new DOMParser();
+            foldres.sort(function(a, b) {
+                return parseFloat(a.pfid_order) - parseFloat(b.pfid_order);
+            });
+            var j;
+            for (j = 0; j < foldres.length; j++) {
+                var title = foldres[j].fid_title;
+                if (title == "")
+                    continue;
+                var style = foldres[j].fid_style;
+                var contItemSubList = bitsContextMenu.Database.getFolderFormPID(foldres[j].fid, foldres[j].dbtype);
+                if (contItemSubList && contItemSubList.length > 0) {
+                    var elemMenuSub = top.document.createElement("menu");
+                    var elemMenuSubpopup = top.document.createElement("menupopup");
+                    if (!elemMenuSub || !elemMenuSubpopup)
+                        continue;
+                    elemMenuSub.setAttribute("label", foldres[j].fid_title);
+                    elemMenuSub.setAttribute("id", "css_" + foldres[j].dbtype + "_" + foldres[j].fid);
+                    elemMenuSub.setAttribute("_style", foldres[j].fid_style);
+                    elemMenuSub.setAttribute("class", "menu-iconic");
+                    if (foldres[j].fid_property) {
+                        var xmldoc = parser.parseFromString(foldres[j].fid_property, "text/xml");
+                        if (xmldoc && xmldoc.documentElement.nodeName == "parsererror")
+                            xmldoc = undefined;
+                        if (xmldoc) {
+                            var elems = xmldoc.getElementsByTagName("ICON");
+                            if (elems && elems.length > 0)
+                                elemMenuSub.setAttribute("image", elems[0].textContent);
+                            elems = undefined;
+                            xmldoc = undefined;
+                        }
+                    }
+                    if (!elemMenuSub.hasAttribute("image"))
+                        elemMenuSub.setAttribute("image", "chrome://markingcollection/skin/folder-close.png");
+                    elemMenuSubpopup.setAttribute("fid", foldres[j].fid);
+                    elemMenuSubpopup.setAttribute("dbtype", foldres[j].dbtype);
+                    elemMenuSub.appendChild(elemMenuSubpopup);
+                    elemMenupopup.appendChild(elemMenuSub);
+                } else {
+                    var elemMenuitem = top.document.createElement("menuitem");
+                    if (!elemMenuitem)
+                        continue;
+                    elemMenuitem.setAttribute("fid", foldres[j].fid);
+                    elemMenuitem.setAttribute("dbtype", foldres[j].dbtype);
+                    elemMenuitem.setAttribute("label", foldres[j].fid_title);
+                    elemMenuitem.setAttribute("id", "css_" + foldres[j].dbtype + "_" + foldres[j].fid);
+                    elemMenuitem.setAttribute("_style", foldres[j].fid_style);
+                    elemMenuitem.setAttribute("class", "menuitem-iconic");
+                    var acceltext = bitsShortcutService.getAcceltext(foldres[j].fid, foldres[j].dbtype);
+                    if (acceltext)
+                        elemMenuitem.setAttribute("acceltext", acceltext);
+                    if (foldres[j].fid_property) {
+                        var xmldoc = parser.parseFromString(foldres[j].fid_property, "text/xml");
+                        if (xmldoc && xmldoc.documentElement.nodeName == "parsererror")
+                            xmldoc = undefined;
+                        if (xmldoc) {
+                            var elems = xmldoc.getElementsByTagName("ICON");
+                            if (elems && elems.length > 0)
+                                elemMenuitem.setAttribute("image", elems[0].textContent);
+                            elems = undefined;
+                            xmldoc = undefined;
+                        }
+                    }
+                    if (!elemMenuitem.hasAttribute("image"))
+                        elemMenuitem.setAttribute("image", "chrome://markingcollection/skin/folder-close.png");
+                    elemMenupopup.appendChild(elemMenuitem);
+                }
+            }
+            parser = undefined;
+        }
+    },
+/////////////////////////////////////////////////////////////////////
+// äžå¿äºææ§ã®çºã«å®çŸ©ããŠãã
+/////////////////////////////////////////////////////////////////////
+    copyToClipBoardByHyperanchor: function(aOID, aDBType) {
+        window.top.bitsMetaCapture.copyToClipBoard(aOID, aDBType, "copy");
+    },
+/////////////////////////////////////////////////////////////////////
+    _dump: function(aString) {
+        window.top.bitsMarkingCollection._dump(aString);
+    },
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/databaseDialog.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/databaseDialog.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/databaseDialog.js	(revision 5703)
@@ -0,0 +1,863 @@
+var mcDatabaseDialog = {
+
+	_xmlfile : null,
+	_xmldoc  : null,
+	_dbdir   : null,
+	_app_version : 2,
+
+/////////////////////////////////////////////////////////////////////
+// ãã­ããã£
+/////////////////////////////////////////////////////////////////////
+	get BrowserWindow() { return Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow("navigator:browser"); },
+	get Common()     { return mcDatabaseDialog.BrowserWindow.bitsObjectMng.Common;     },
+	get XPath()      { return mcDatabaseDialog.BrowserWindow.bitsObjectMng.XPath;      },
+	get Database()   { return mcDatabaseDialog.BrowserWindow.bitsObjectMng.Database;   },
+		
+	/*
+	get DataSource() { return window.opener.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.opener.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.opener.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.opener.top.bitsObjectMng.Database;   },
+	get XML()        { return window.opener.top.bitsObjectMng.XML;        },
+	get gBrowser()   { return window.opener.top.bitsObjectMng.getBrowser();},
+	*/
+
+	get STRING()     { return document.getElementById("mcSettingString"); },
+
+	get TREE()       { return document.getElementById("mcDatabaseTree"); },
+	get MENU_ADD()   { return document.getElementById("mcDatabaseAdd"); },
+	get MENU_SET()   { return document.getElementById("mcDatabaseSet"); },
+	get MENU_DEL()   { return document.getElementById("mcDatabaseDel"); },
+	get MENU_DIS()   { return document.getElementById("mcDatabaseDis"); },
+	get CHK_UNUSED() { return document.getElementById("mcDatabaseStartupAllDBUnused"); },
+
+	get PANEL()      { return document.getElementById("mcDatabaseTabPanel"); },
+
+	get alldbunused(){ return nsPreferences.getBoolPref("wiredmarker.startup.alldbunused", false); },
+	set alldbunused(aVal){
+		var val = (aVal?true:false);
+		nsPreferences.setBoolPref("wiredmarker.startup.alldbunused", val);
+	},
+
+/////////////////////////////////////////////////////////////////////
+// ã¡ãœãã
+/////////////////////////////////////////////////////////////////////
+	init : function(aEvent){
+		try{
+			var xmlfile = mcDatabaseDialog.Common.getExtensionDir().clone();
+			xmlfile.append("db.xml");
+			if(xmlfile.exists()){
+				this._xmlfile = xmlfile;
+				function _loadXMLDocument(pUri){
+					if(pUri == undefined) return undefined;
+					//var xmlDocument = window.opener.top.bitsMarkingCollection.loadXMLDocument(pUri);
+					var xmlDocument = mcDatabaseDialog.BrowserWindow.bitsMarkingCollection.loadXMLDocument(pUri);
+					
+					return xmlDocument;
+				}
+				function _createXMLDocument(aXMLFile){
+					if(!aXMLFile) return undefined;
+					try{
+						return _loadXMLDocument(mcDatabaseDialog.Common.IO.newFileURI(aXMLFile).spec);
+					}catch(ex){
+						mcDatabaseDialog._dump("mcDatabaseDialog._createXMLDocument():"+ ex);
+						return undefined;
+					}
+				}
+				this._xmldoc = _createXMLDocument(xmlfile);
+			}
+			var info = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
+			this._app_version = parseFloat(info.version);
+		}catch(e){}
+		if(!this._xmldoc) return;
+		this.CHK_UNUSED.checked = this.alldbunused;
+		this.rebuild();
+		this.TREE.addEventListener("click", this.onClick, false);
+		this.TREE.addEventListener("dblclick", this.onDblClick, false);
+		this.PANEL.addEventListener("command", this.eventListener, false);
+		if(this._app_version<3.1){
+			this.TREE.addEventListener("draggesture", mcDatabaseDialog.onOldDraggesture, false);
+			this.TREE.addEventListener("dragover", mcDatabaseDialog.onOldDragover, false);
+			this.TREE.addEventListener("dragdrop", mcDatabaseDialog.onOldDragdrop, false);
+			this.TREE.addEventListener("dragexit", mcDatabaseDialog.onOldDragexit, false);
+		}else{
+			this.TREE.addEventListener("dragstart", mcDatabaseDialog.onDragEvents, false);
+			this.TREE.addEventListener("drag", mcDatabaseDialog.onDragEvents, false);
+			this.TREE.addEventListener("dragend", mcDatabaseDialog.onDragEvents, false);
+			this.TREE.addEventListener("dragenter", mcDatabaseDialog.onDropEvents, false);
+			this.TREE.addEventListener("dragover", mcDatabaseDialog.onDropEvents, false);
+			this.TREE.addEventListener("dragleave", mcDatabaseDialog.onDropEvents, false);
+			this.TREE.addEventListener("drop", mcDatabaseDialog.onDropEvents, false);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(aEvent){
+		if(this._app_version<3.1){
+			this.TREE.removeEventListener("draggesture", mcDatabaseDialog.onOldDraggesture, false);
+			this.TREE.removeEventListener("dragover", mcDatabaseDialog.onOldDragover, false);
+			this.TREE.removeEventListener("dragdrop", mcDatabaseDialog.onOldDragdrop, false);
+			this.TREE.removeEventListener("dragexit", mcDatabaseDialog.onOldDragexit, false);
+		}else{
+			this.TREE.removeEventListener("dragstart", mcDatabaseDialog.onDragEvents, false);
+			this.TREE.removeEventListener("drag", mcDatabaseDialog.onDragEvents, false);
+			this.TREE.removeEventListener("dragend", mcDatabaseDialog.onDragEvents, false);
+
+			this.TREE.removeEventListener("dragenter", mcDatabaseDialog.onDropEvents, false);
+			this.TREE.removeEventListener("dragover", mcDatabaseDialog.onDropEvents, false);
+			this.TREE.removeEventListener("dragleave", mcDatabaseDialog.onDropEvents, false);
+			this.TREE.removeEventListener("drop", mcDatabaseDialog.onDropEvents, false);
+		}
+		this._xmldoc = undefined;
+		this._xmlfile = undefined;
+	},
+
+/////////////////////////////////////////////////////////////////////
+// TREE è¡šç€ºå¶åŸ¡é¢é£
+/////////////////////////////////////////////////////////////////////
+	get rowCount(){
+		var count = 0;
+		var xPathResult = this.XPath.evaluate('/DATABASES[1]/DATABASE[@hidden="false"]', this._xmldoc);
+		if(xPathResult) count = xPathResult.snapshotLength;
+		xPathResult = undefined;
+		return count;
+	},
+	getCellText : function(row,column){
+		var celltext = "";
+		var dbNode = this.getNodeFromXML(row);
+		var dataNode = dbNode.getElementsByTagName(column.id)[0];
+		if(dataNode) celltext = dataNode.textContent;
+		if(column.id == "DATABASE_DEFAULT") celltext = "";
+		if(column.id == "DATABASE_STATUS"){
+			var disabled = dbNode.getAttribute("disabled");
+			if(!disabled || disabled == "false"){
+				celltext = this.STRING.getString("MSG_DATABASE_USE");
+			}
+		}
+		return celltext;
+	},
+	setTree: function(treebox){ this.treebox = treebox; },
+	isContainer: function(row){ return false; },
+	isSeparator: function(row){ return false; },
+	isSorted: function(){ return false; },
+	getLevel: function(row){ return 0; },
+	getImageSrc: function(row,column){
+		if(column.id == "DATABASE_DEFAULT"){
+			var dbNode = this.getNodeFromXML(row);
+			var db_default = dbNode.getAttribute("db_default");
+			return db_default == "true" ? "chrome://markingcollection/skin/radio-check.gif" : null;
+		}else if(column.id == "DATABASE_TITLE"){
+			var dbNode = this.getNodeFromXML(row);
+			var dataNode = dbNode.getElementsByTagName("DATABASE_ICON")[0];
+			return dataNode?dataNode.textContent:null;
+		}else{
+			return null;
+		}
+	},
+	getRowProperties: function(row,props){},
+	getCellProperties: function(row, column, prop) {
+		if(column.id == "DATABASE_TITLE"){
+			var aserv=Components.classes["@mozilla.org/atom-service;1"].getService(Components.interfaces.nsIAtomService);
+//			prop.Clear();
+			prop.AppendElement(aserv.getAtom("Name"));
+		}
+	},
+	getColumnProperties: function(column, element, prop) {},
+	cycleHeader : function(col){},
+	setCellText : function(row,column,text){},
+	canDrop : function(row, orient){return true;},
+  getParentIndex: function(idx) { return -1; },
+	drop : function(row, orient){
+//		mcDatabaseDialog._dump("drop():row=["+row+"]:orient=["+orient+"]");
+		mcDatabaseDialog._drop(row, orient);
+	},
+	_drop : function(row, orient){
+		if(orient>0) row++;
+		if(row>=this.rowCount) row = this.rowCount-1;
+		var dropnode = this.getNodeFromXML(row);
+		if(!dropnode) return;
+		var dragnode = this.getNodeFromXML();
+		if(!dragnode) return;
+		if(dropnode == dragnode) return;
+		if(row==this.rowCount-1 && orient>0){
+			dropnode.parentNode.appendChild(dragnode);
+			this.TREE.currentIndex = row;
+		}else{
+			dropnode.parentNode.insertBefore(dragnode,dropnode);
+			this.TREE.currentIndex = row;
+		}
+		if(!this.TREE.view.selection.isSelected(this.TREE.currentIndex)) this.TREE.view.selection.select(this.TREE.currentIndex);
+		this.saveXML();
+		this.rebuild();
+	},
+
+	dragDropObserver :{
+		onDragStart : function(event, transferData, action){
+//			mcDatabaseDialog._dump("dragDropObserver.onDragStart()");
+
+			try{
+				var id = mcDatabaseDialog.getIdFromXML();
+				transferData.data = new TransferData();
+				transferData.data.addDataForFlavour("moz/rdfitem", id);
+			}catch(ex){
+				mcDatabaseDialog._dump("dragDropObserver.onDragStart():"+ex);
+			}
+
+
+		},
+		getSupportedFlavours : function(){
+//			mcDatabaseDialog._dump("dragDropObserver.getSupportedFlavours()");
+			var flavours = new FlavourSet();
+			flavours.appendFlavour("moz/rdfitem");
+//			flavours.appendFlavour("text/x-moz-url");
+//			flavours.appendFlavour("text/html");
+//			flavours.appendFlavour("text/xml");
+//			flavours.appendFlavour("application/x-moz-url");
+//			flavours.appendFlavour("application/x-moz-file","nsIFile");
+//			flavours.appendFlavour("text/unicode");
+			return flavours;
+		},
+		onDragOver : function(event, flavour, session){
+//			mcDatabaseDialog._dump("dragDropObserver.onDragOver():flavour=["+flavour.contentType+"]");
+			return;
+			var row = {};
+			var col = {};
+			var obj = {};
+			mcTreeHandler.TREE.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, obj);
+
+
+			var aRow = row.value;
+			if(aRow == undefined) return;
+			if(aRow < 0) return;
+			return;
+
+
+			if(!mcTreeHandler.TREE.view.isContainer(aRow)) return;
+			var isContainerOpen = mcTreeHandler.TREE.view.isContainerOpen(aRow);
+			if(isContainerOpen) return;
+			mcTreeDNDHandler.folderAutoOpenRow = aRow;
+		},
+		onDragExit : function(event, session){
+//			mcDatabaseDialog._dump("dragDropObserver.onDragExit()");
+			return;
+			mcTreeDNDHandler.folderAutoOpenRow = -1;
+			_dump("dragDropObserver.onDragExit()");
+		},
+		onDrop     : function(event, transferData, session){
+//			mcDatabaseDialog._dump("dragDropObserver.onDrop()");
+		},
+	},
+
+/////////////////////////////////////////////////////////////////////
+// Drag & Drop Old Callback functions
+/////////////////////////////////////////////////////////////////////
+	onOldDraggesture: function(aEvent){
+		nsDragAndDrop.startDrag(aEvent,mcDatabaseDialog.dragDropObserver);
+		aEvent.stopPropagation();
+	},
+	onOldDragover: function(aEvent){
+		nsDragAndDrop.dragOver(aEvent,mcDatabaseDialog.dragDropObserver);
+		aEvent.stopPropagation();
+	},
+	onOldDragdrop: function(aEvent){
+		nsDragAndDrop.drop(aEvent,mcDatabaseDialog.dragDropObserver);
+		aEvent.stopPropagation();
+	},
+	onOldDragexit: function(aEvent){
+		nsDragAndDrop.dragExit(aEvent,mcDatabaseDialog.dragDropObserver);
+		aEvent.stopPropagation();
+	},
+
+/////////////////////////////////////////////////////////////////////
+// Drag & Drop New Callback functions
+/////////////////////////////////////////////////////////////////////
+	onDragEvents: function(aEvent){
+		switch (aEvent.type) {
+			case "dragstart":
+				try{
+					var id = mcDatabaseDialog.getIdFromXML();
+					var transferData = aEvent.dataTransfer;
+					transferData.setData("moz/rdfitem", id);
+				}catch(ex){
+					mcDatabaseDialog._dump("mcDatabaseDialog.onDragEvents().dragstart:"+ex);
+				}
+				break;
+			case "drag":
+			break;
+			case "dragend":
+			break;
+		}
+	},
+
+	onDropEvents: function(aEvent){
+		switch (aEvent.type) {
+			case "dragenter":
+			case "dragover":
+				aEvent.preventDefault();
+				break;
+			case "drop":
+				aEvent.preventDefault();
+				break;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+// TREE ã€ãã³ãé¢é£
+/////////////////////////////////////////////////////////////////////
+	onClick: function(aEvent){
+		if(aEvent && aEvent.button != 0){
+			aEvent.stopPropagation();
+			return;
+		}
+		mcDatabaseDialog._onClick(aEvent);
+	},
+	_onClick: function(aEvent){
+//		this._dump("_onClick():this.TREE.view.selection.count="+this.TREE.view.selection.count);
+//		this._dump("_onClick():this.TREE.currentIndex="+this.TREE.currentIndex);
+
+		var disabled = (this.TREE.view.selection.count<=0 || this.TREE.currentIndex < 0 || this.TREE.currentIndex >= this.TREE.view.rowCount) ? 3 : 0;
+		if(!disabled){
+			var id = this.getIdFromXML();
+			if(id && id == "local") disabled |= 2;
+//			var db_default = this.getDefaultFromXML();
+//			if(db_default) disabled |= 2;
+		}
+		this.disabledMenu(disabled);
+	},
+
+	onDblClick: function(aEvent){
+		if(aEvent && aEvent.button != 0){
+			aEvent.stopPropagation();
+			return;
+		}
+		mcDatabaseDialog._onDblClick(aEvent);
+	},
+	_onDblClick: function(aEvent){
+		if(this.MENU_DIS.disabled) return;
+		this._onCommandDis(aEvent);
+	},
+
+/////////////////////////////////////////////////////////////////////
+// MENU ã€ãã³ãé¢é£
+/////////////////////////////////////////////////////////////////////
+	eventListener : function(aEvent){
+//mcDatabaseDialog._dump("onCommand():aEvent="+aEvent.type);
+//mcDatabaseDialog._dump("onCommand():aEvent="+aEvent.target.id);
+		switch(aEvent.type){
+			case "command" :
+				mcDatabaseDialog.onCommand(aEvent);
+				break;
+			default :
+				break;
+		}
+	},
+
+	onCommand : function(aEvent){
+		if(aEvent.target && aEvent.target.id){
+			switch(aEvent.target.id){
+				case "mcDatabaseAdd":
+					this._onCommandAdd(aEvent);
+					break;
+				case "mcDatabaseSet":
+					this._onCommandSet(aEvent);
+					break;
+				case "mcDatabaseDel":
+					this._onCommandDel(aEvent);
+					break;
+				case "mcDatabaseDis":
+					this._onCommandDis(aEvent);
+					break;
+				case "mcDatabaseStartupAllDBUnused":
+					this._onCommandStartupAllDBUnused(aEvent);
+					break;
+				default:
+					break;
+			}
+		}
+	},
+	_onCommandAdd : function(aEvent){
+//		this._dump("_onCommandAdd():this.TREE.view.selection.count="+this.TREE.view.selection.count);
+//		this._dump("_onCommandAdd():this.TREE.currentIndex="+this.TREE.currentIndex);
+
+		if(!this._dbdir) this._dbdir = this._xmlfile.parent.clone();
+
+		var dbfile = null;
+		var appname = this.STRING.getString("APP_TITLE").toLowerCase();
+		var filename = "";
+		var cnt;
+		for(cnt=0;;cnt++){
+			dbfile = this._dbdir.clone();
+			filename = appname;
+			if(cnt) filename += "(" + cnt + ")";
+			dbfile.append(filename + ".sqlite");
+			if(!dbfile.exists()) break;
+		}
+		var dbfileURL = this.getNewDataFile(filename);
+		if(!dbfileURL) return;
+		_dump('_onCommandAdd');
+//		this._dump("_onCommandAdd():dbfileURL="+dbfileURL.spec);
+//		this._dump("_onCommandAdd():dbfileURL="+dbfileURL);
+
+		setTimeout(function(){ mcDatabaseDialog.checkUseDataFile(dbfileURL); },0);
+
+	},
+
+	_onCommandSet : function(aEvent){
+//		this._dump("_onCommandSet():this.TREE.view.selection.count="+this.TREE.view.selection.count);
+//		this._dump("_onCommandSet():this.TREE.currentIndex="+this.TREE.currentIndex);
+		this.openSetting();
+	},
+
+	_onCommandDel : function(aEvent){
+
+		var disabled = this.MENU_DEL.getAttribute("disabled");
+		if(disabled == "true") return;
+
+//		this._dump("_onCommandDel():this.TREE.view.selection.count="+this.TREE.view.selection.count);
+//		this._dump("_onCommandDel():this.TREE.currentIndex="+this.TREE.currentIndex);
+
+		var dbNode = this.getNodeFromXML();
+
+		var dbtype = null;
+		try{ dbtype = dbNode.getElementsByTagName("DATABASE_DBTYPE")[0].textContent; }catch(ex){}
+		if(dbtype){
+			this.Database.done(dbtype);
+		}
+
+//		if(dbNode.nextSibling.nodeName == "#text")     dbNode.parentNode.removeChild(dbNode.nextSibling);
+//		if(dbNode.previousSibling.nodeName == "#text") dbNode.parentNode.removeChild(dbNode.previousSibling);
+//		dbNode.parentNode.removeChild(dbNode);
+
+		dbNode.setAttribute("disabled",true);
+		dbNode.setAttribute("hidden",true);
+		dbNode.setAttribute("db_contextmenu",false);
+
+		this.saveXML();
+
+		this.rebuild();
+		if(this.TREE.currentIndex >= this.TREE.view.rowCount){
+			this.TREE.currentIndex = (this.TREE.view.rowCount>0?this.TREE.view.rowCount-1:-1);
+			if(this.TREE.currentIndex<0){
+				this.TREE.view.selection.clearSelection();
+			}else{
+				this.TREE.view.selection.select(this.TREE.currentIndex);
+			}
+		}
+		this._onClick();
+	},
+
+	_onCommandDis : function(aEvent){
+//		this._dump("_onCommandDis():this.TREE.view.selection.count="+this.TREE.view.selection.count);
+//		this._dump("_onCommandDis():this.TREE.currentIndex="+this.TREE.currentIndex);
+
+		var dbNode = this.getNodeFromXML();
+		var disabled = dbNode.getAttribute("disabled");
+		if(!disabled || disabled == "false"){
+			dbNode.setAttribute("disabled",true);
+			dbNode.setAttribute("db_contextmenu",false);
+		}else{
+			dbNode.removeAttribute("disabled");
+			dbNode.setAttribute("db_contextmenu",true);
+		}
+
+		this.saveXML();
+
+		this.rebuild();
+	},
+
+	_onCommandStartupAllDBUnused : function(aEvent){
+		this.alldbunused = this.CHK_UNUSED.checked;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	rebuild : function(){
+		this.TREE.view = mcDatabaseDialog;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getRootNodeFromXML : function(){
+		var xPathResult = this.XPath.evaluate('/DATABASES[1]', this._xmldoc);
+		if(!xPathResult) return undefined;
+		return xPathResult.snapshotItem(0);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getNodeFromXML : function(aRow){
+		if(aRow == undefined) aRow = this.TREE.currentIndex;
+		var xPathResult = this.XPath.evaluate('/DATABASES[1]/DATABASE[@hidden="false"]', this._xmldoc);
+		if(xPathResult && xPathResult.snapshotLength>0){
+			return xPathResult.snapshotItem(aRow);
+		}else{
+			return undefined;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getIdFromXML : function(){
+		var dbNode = this.getNodeFromXML();
+		return dbNode.getAttribute("id");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getDefaultFromXML : function(){
+		var dbNode = this.getNodeFromXML();
+		return dbNode.getAttribute("db_default")=="true"?true:false;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	disabledMenu : function(aDisabled){
+		if(aDisabled & 1){
+			this.MENU_SET.setAttribute("disabled", true);
+			this.MENU_DIS.setAttribute("disabled", true);
+		}else{
+			this.MENU_SET.removeAttribute("disabled");
+			this.MENU_DIS.removeAttribute("disabled");
+		}
+
+		if(aDisabled & 2){
+			this.MENU_DEL.setAttribute("disabled", true);
+		}else{
+			this.MENU_DEL.removeAttribute("disabled");
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getNewDataFile : function (aTitle){
+		var result = null;
+		var picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
+		var pickerMode;
+		
+		var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
+		var check = {value: false};
+		var flags = prompts.BUTTON_TITLE_YES * prompts.BUTTON_POS_0 + prompts.BUTTON_TITLE_IS_STRING  * prompts.BUTTON_POS_1 + prompts.BUTTON_TITLE_NO * prompts.BUTTON_POS_2;
+		var button = prompts.confirmEx(window, this.STRING.getString("MSG_ADD_DATAFILE"), this.STRING.getString("CONFIRM_NEW_DATAFILE"), flags, "Button 0", this.STRING.getString("MSG_EXISTING_DATABASE"), "Button 2", null, check);
+		if(button == 0){
+			pickerMode = picker.modeSave;
+		}else if(button == 1){
+			pickerMode = picker.modeOpen;
+		}else{
+			return;
+		}
+		try{
+			picker.init(window, "Selected File", pickerMode);
+			if(aTitle && pickerMode != picker.modeOpen) picker.defaultString  = aTitle + ".sqlite";
+			picker.defaultExtension = ".sqlite";
+			picker.displayDirectory = (this._dbdir?this._dbdir:this._xmlfile.parent);
+			picker.appendFilter(this.STRING.getString("MSG_DATAFILE") + " (*.sqlite)","*.sqlite");
+			picker.appendFilter("All Files (*.*)","*.sqlite");
+			var showResult = picker.show();
+			if(showResult == picker.returnOK){
+				result = picker.fileURL;
+			}else if(showResult == picker.returnReplace){
+				if(picker.file.exists()) picker.file.remove(false);
+				result = picker.fileURL;
+			}
+		}catch(e){
+			result = null;
+			this.Common.alert(e);
+		}
+		if(result && !result.file){
+			result = result.QueryInterface(Components.interfaces.nsIURL);
+			result = result.QueryInterface(Components.interfaces.nsIFileURL);
+		}
+		return result;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	checkUseDataFile : function (aURL){
+		_dump("checkUseDataFile:START");
+		try{
+		if(!aURL) return;
+		var msg  = this.STRING.getString("MSG_DATAFILE") +  "[" + this.Common.splitFileName(aURL.file.leafName)[0] + "]\n\n";
+		msg += this.STRING.getString("ERROR_ADD_DATAFILE_3");
+
+		var xPathResult = this.XPath.evaluate('/DATABASES[1]/DATABASE[@hidden="false"]/DATABASE_FILE', this._xmldoc);
+		if(xPathResult){
+			_dump("checkUseDataFile:1");
+			var ncnt;
+			for(ncnt=0;ncnt<xPathResult.snapshotLength;ncnt++){
+				var node = xPathResult.snapshotItem(ncnt);
+				if(!node || node.textContent != aURL.spec) continue;
+
+				var nameNode = node.parentNode.getElementsByTagName("DATABASE_TITLE")[0];
+				if(nameNode){
+					msg  = this.STRING.getString("MSG_DATAFILE") +  "[" + this.Common.splitFileName(aURL.file.leafName)[0] + "]\n";
+					msg += this.STRING.getString("MSG_USE_TITLE") +  "[" + nameNode.textContent + "]\n\n";
+					msg += this.STRING.getString("ERROR_ADD_DATAFILE_3");
+				}
+
+				aURL = undefined;
+				break;
+			}
+		}
+		if(!aURL){
+			_dump("checkUseDataFile:2");
+			var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
+			var check = {value: false};
+			var flags = prompts.BUTTON_TITLE_YES * prompts.BUTTON_POS_0 + prompts.BUTTON_TITLE_NO  * prompts.BUTTON_POS_1;
+			var button = prompts.confirmEx(window, this.STRING.getString("MSG_ADD_DATAFILE"), msg, flags, "Button 0", "Button 1", "Button 2", null, check);
+			if(button == 0) setTimeout(function(){ mcDatabaseDialog._onCommandAdd(); },0);
+		}else{
+			_dump("checkUseDataFile:3");
+			var timeStamp = this.Common.getTimeStamp();
+			var newNode = true;
+			var xPathResult = this.XPath.evaluate('/DATABASES[1]/DATABASE[@hidden="true"]/DATABASE_FILE', this._xmldoc);
+			if(xPathResult){
+				var ncnt;
+				for(ncnt=0;ncnt<xPathResult.snapshotLength;ncnt++){
+					var node = xPathResult.snapshotItem(ncnt);
+					if(node && node.textContent == aURL.spec) break;
+				}
+				if(ncnt<xPathResult.snapshotLength){
+					var lastNode = null;
+					var xPathResultT = this.XPath.evaluate('/DATABASES[1]/DATABASE[@hidden="false"]', this._xmldoc);
+					if(xPathResultT && xPathResultT.snapshotLength>0) lastNode = xPathResultT.snapshotItem(xPathResultT.snapshotLength-1);
+
+					var node = xPathResult.snapshotItem(ncnt);
+					var cloneNode = node.parentNode.cloneNode(true);
+					node.parentNode.parentNode.removeChild(node.parentNode);
+
+					cloneNode.setAttribute("disabled","true");
+					cloneNode.setAttribute("hidden","false");
+					cloneNode.setAttribute("db_order",timeStamp);
+
+					if(lastNode){
+						var nextSibling = lastNode.nextSibling;
+						while(nextSibling && nextSibling.nodeType != 1){
+							nextSibling = nextSibling.nextSibling;
+						}
+						if(nextSibling){
+							lastNode.parentNode.insertBefore(cloneNode,nextSibling);
+						}else{
+							lastNode.parentNode.appendChild(cloneNode);
+						}
+					}
+					newNode = false;
+				}
+			}
+			if(newNode){
+				_dump("checkUseDataFile:4");
+				var dbid = "local"+timeStamp;
+				var rootNode = this.getRootNodeFromXML();
+
+				var dbNode = this._xmldoc.createElement("DATABASE");
+				dbNode.setAttribute("id",dbid);
+				dbNode.setAttribute("disabled","true");
+				dbNode.setAttribute("hidden","false");
+				dbNode.setAttribute("db_order",timeStamp);
+				rootNode.appendChild(dbNode)
+
+				textNode = this._xmldoc.createTextNode("\n");
+				rootNode.appendChild(textNode);
+
+				var dbinfo = {
+					title   : this.Common.splitFileName(aURL.file.leafName)[0],
+					dbtype  : dbid,
+					file    : aURL.spec,
+					icon    : "chrome://markingcollection/skin/database.png",
+					comment : null,
+				};
+
+				textNode = this._xmldoc.createTextNode("\n    ");
+				dbNode.appendChild(textNode);
+
+				var childNode = this._xmldoc.createElement("DATABASE_TITLE");
+				textNode = this._xmldoc.createTextNode(dbinfo.title);
+				childNode.appendChild(textNode);
+				dbNode.appendChild(childNode);
+
+				textNode = this._xmldoc.createTextNode("\n    ");
+				dbNode.appendChild(textNode);
+
+				childNode = this._xmldoc.createElement("DATABASE_DBTYPE");
+				textNode = this._xmldoc.createTextNode(dbinfo.dbtype);
+				childNode.appendChild(textNode);
+				dbNode.appendChild(childNode);
+
+				textNode = this._xmldoc.createTextNode("\n    ");
+				dbNode.appendChild(textNode);
+
+				childNode = this._xmldoc.createElement("DATABASE_FILE");
+				textNode = this._xmldoc.createTextNode(dbinfo.file);
+				childNode.appendChild(textNode);
+				dbNode.appendChild(childNode);
+
+				textNode = this._xmldoc.createTextNode("\n    ");
+				dbNode.appendChild(textNode);
+
+				childNode = this._xmldoc.createElement("DATABASE_ICON");
+				textNode = this._xmldoc.createTextNode(dbinfo.icon);
+				childNode.appendChild(textNode);
+				dbNode.appendChild(childNode);
+
+				textNode = this._xmldoc.createTextNode("\n  ");
+				dbNode.appendChild(textNode);
+			}
+			this.rebuild();
+			this.TREE.view.selection.select(this.TREE.view.rowCount-1);
+			this._onClick();
+			this._dbdir = aURL.file.parent.clone();
+			setTimeout(function(){ mcDatabaseDialog.openSetting(dbinfo); },0);
+		}
+		}catch(e){
+			alert(e);	
+		}
+		_dump("checkUseDataFile:END");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	openSetting : function (aDbinfo){
+		
+		try{
+		
+		var result = {};
+		var newInfo = (aDbinfo?true:false);
+		if(!aDbinfo){
+			aDbinfo = {
+				title   : null,
+				dbtype  : null,
+				file    : null,
+				icon    : null,
+				comment : null,
+			};
+			var dbNode = this.getNodeFromXML();
+			try{ aDbinfo.title   = dbNode.getElementsByTagName("DATABASE_TITLE")[0].textContent; }catch(ex){this.Common.alert(ex)}
+			try{ aDbinfo.dbtype  = dbNode.getElementsByTagName("DATABASE_DBTYPE")[0].textContent; }catch(ex){}
+			try{ aDbinfo.file    = dbNode.getElementsByTagName("DATABASE_FILE")[0].textContent; }catch(ex){}
+			try{ aDbinfo.icon    = dbNode.getElementsByTagName("DATABASE_ICON")[0].textContent; }catch(ex){}
+			try{ aDbinfo.comment = dbNode.getElementsByTagName("DATABASE_COMMENT")[0].textContent; }catch(ex){}
+			try{ aDbinfo.use     = (dbNode.getAttribute("disabled")=="true"?false:true); }catch(ex){}
+			try{ aDbinfo.contextmenu = (dbNode.getAttribute("db_contextmenu")=="true"?true:false); }catch(ex){}
+			try{ aDbinfo.default     = (dbNode.getAttribute("db_default")=="true"?true:false); }catch(ex){}
+		}
+		if(aDbinfo){
+			var key;
+			for(key in aDbinfo){
+				result[key] = aDbinfo[key];
+			}
+		}
+		result.accept = false;
+		window.openDialog("chrome://markingcollection/content/databasePropDialog.xul", "", "chrome,centerscreen,modal", result);
+		if(result.accept){
+			var dbNode = this.getNodeFromXML();
+			var key;
+			for(key in result){
+				if(aDbinfo[key] == result[key]) continue;
+				if(key == "accept") continue;
+				if(key == "default" && result[key]){
+					var xPathResult = this.XPath.evaluate('/DATABASES[1]/DATABASE', this._xmldoc);
+					if(xPathResult){
+						var ncnt;
+						for(ncnt=0;ncnt<xPathResult.snapshotLength;ncnt++){
+							var node = xPathResult.snapshotItem(ncnt);
+							if(!node) continue;
+							node.removeAttribute("db_default");
+						}
+					}
+					var xPathResult = this.XPath.evaluate('/DATABASES[1]/DATABASE/DATABASE_ICON', this._xmldoc);
+					if(xPathResult){
+						var ncnt;
+						for(ncnt=0;ncnt<xPathResult.snapshotLength;ncnt++){
+							var node = xPathResult.snapshotItem(ncnt);
+							if(!node) continue;
+							node.textContent = "chrome://markingcollection/skin/database.png";
+						}
+					}
+					dbNode.setAttribute("db_default",result[key]);
+					try{ dbNode.getElementsByTagName("DATABASE_ICON")[0].textContent = "chrome://markingcollection/skin/localfolder.png"; }catch(ex){}
+					if(result[key]){
+						result.use = true;
+						dbNode.removeAttribute("disabled");
+					}
+					continue;
+				}
+				if(key == "contextmenu"){
+					dbNode.setAttribute("db_contextmenu",result[key]);
+					continue;
+				}
+				if(key == "use"){
+					if(result[key]){
+						dbNode.removeAttribute("disabled");
+					}else{
+						dbNode.setAttribute("disabled",true);
+					}
+					continue;
+				}
+
+				var tag = "DATABASE_" + key.toUpperCase();
+				var node = dbNode.getElementsByTagName(tag)[0];
+				if(result[key] && !node){
+
+					var textNode = this._xmldoc.createTextNode("  ");
+					dbNode.appendChild(textNode);
+
+					node = this._xmldoc.createElement(tag);
+					textNode = this._xmldoc.createTextNode(result[key]);
+					node.appendChild(textNode);
+					dbNode.appendChild(node);
+
+					textNode = this._xmldoc.createTextNode("\n  ");
+					dbNode.appendChild(textNode);
+
+				}
+				if(!result[key] && node){
+					if(node.nextSibling .nodeName == "#text")    node.parentNode.removeChild(node.nextSibling );
+					if(node.previousSibling.nodeName == "#text") node.parentNode.removeChild(node.previousSibling);
+					node.parentNode.removeChild(node);
+				}
+				if(result[key] && node){
+					var textNode = this._xmldoc.createTextNode(result[key]);
+					node.replaceChild(textNode,node.firstChild);
+				}
+			}
+			this.saveXML();
+		}else{
+			if(newInfo) this._onCommandDel();
+		}
+
+		this.rebuild();
+		this._onClick();
+		
+		}catch(e){
+			alert(e);
+		}
+
+	},
+
+/////////////////////////////////////////////////////////////////////
+	saveXML : function(){
+		var xPathResult = this.XPath.evaluate('/DATABASES[1]/DATABASE', this._xmldoc);
+		if(xPathResult){
+			var ncnt;
+			var db_order=0;
+			for(ncnt=0;ncnt<xPathResult.snapshotLength;ncnt++){
+				var node = xPathResult.snapshotItem(ncnt);
+				if(!node) continue;
+				node.setAttribute("db_order",++db_order);
+				while(node.previousSibling && node.previousSibling.nodeName == "#text"){
+					node.previousSibling.parentNode.removeChild(node.previousSibling);
+				}
+				while(node.nextSibling && node.nextSibling.nodeName == "#text"){
+					node.nextSibling.parentNode.removeChild(node.nextSibling);
+				}
+				var textNode = this._xmldoc.createTextNode("\n  ");
+				node.parentNode.insertBefore(textNode,node);
+
+				textNode = this._xmldoc.createTextNode("\n");
+				if(node.nextSibling){
+					node.parentNode.insertBefore(textNode,node.nextSibling);
+				}else{
+					node.parentNode.appendChild(textNode);
+				}
+			}
+		}
+		var s = new XMLSerializer();
+		var xml = s.serializeToString(this._xmldoc);
+		this.Common.writeFile(this._xmlfile, xml+"\n", "UTF-8");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		if(nsPreferences.getBoolPref("wiredmarker.debug", false)) window.dump(mcDatabaseDialog.Common.convertFormUnicode(aString,"Shift_jis")+"\n");
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/databaseDialogOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/databaseDialogOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/databaseDialogOverlay.xul	(revision 5703)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+	id="databaseDialogOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://global/content/nsJSSupportsUtils.js"/>
+	<script type="application/x-javascript" src="chrome://global/content/nsJSComponentManager.js"/>
+	<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
+	<script type="application/x-javascript" src="chrome://markingcollection/content/databaseDialog.js"/>
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _databaseMainInit(aEvent){
+			setTimeout(function(){ mcDatabaseDialog.init(aEvent); },0);
+		}
+		function _databaseMainDone(aEvent){
+			mcDatabaseDialog.done(aEvent);
+		}
+		window.addEventListener("load", _databaseMainInit, false);
+		window.addEventListener("unload", _databaseMainDone, false);
+	]]>
+	</script>
+	<tabbox id="mcSettingTabbox">
+		<tabs id="mcSettingTabs">
+			<tab id="mcDatabaseTab" label="&markingcollection.database;" image="chrome://markingcollection/skin/database.png"/>
+		</tabs>
+		<tabpanels id="mcSettingTabPanels">
+			<tabpanel id="mcDatabaseTabPanel" orient="vertical" flex="1">
+				<hbox>
+					<toolbarbutton id="mcDatabaseAdd" label="&markingcollection.database.add;..." image="chrome://markingcollection/skin/menu_create.png" accesskey="a"/>
+					<toolbarbutton id="mcDatabaseSet" label="&markingcollection.database.set;..." image="chrome://markingcollection/skin/menu_property.png" accesskey="s" disabled="true"/>
+					<toolbarbutton id="mcDatabaseDel" label="&markingcollection.database.del;" image="chrome://markingcollection/skin/menu_remove.png" accesskey="m" disabled="true"/>
+					<toolbarbutton id="mcDatabaseDis" label="&markingcollection.database.dis;" image="chrome://markingcollection/skin/checkbox_on.png" accesskey="d" disabled="true"/>
+				</hbox>
+				<tree id="mcDatabaseTree" seltype="single" flex="1">
+					<treecols>
+						<treecol id="DATABASE_TITLE" label="&markingcollection.database.name;" flex="6"/><splitter class="tree-splitter"/>
+						<treecol id="DATABASE_COMMENT" label="&markingcollection.database.comment;" flex="8"/><splitter class="tree-splitter"/>
+						<treecol id="DATABASE_STATUS" label="&markingcollection.database.status;" flex="4"/>
+					</treecols>
+					<treechildren />
+				</tree>
+				<checkbox id="mcDatabaseStartupAllDBUnused" label="&markingcollection.database.startupalldbunused;"/>
+			</tabpanel>
+		</tabpanels>
+	</tabbox>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/databasePropDialog.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/databasePropDialog.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/databasePropDialog.js	(revision 5703)
@@ -0,0 +1,172 @@
+var mcDatabasePropService = {
+
+	get STRING()      { return document.getElementById("mcDBPropString"); },
+	get TITLE()       { return document.getElementById("mcDBPropTitleTextbox"); },
+	get COMMENT()     { return document.getElementById("mcDBPropCommentTextbox"); },
+	get USE()         { return document.getElementById("mcDBPropUseCheckbox"); },
+	get CONTEXTMENU() { return document.getElementById("mcDBPropContextmenuCheckbox"); },
+	get DEFAULT()     { return document.getElementById("mcDBPropDefaultCheckbox"); },
+	get ACCEPTBTN()   { return document.getElementById("mcDBPropWindow").getButton("accept"); },
+	get DB_PATH()     { return document.getElementById("mcDBPropDBPath"); },
+	get DB_DATE()     { return document.getElementById("mcDBPropDBDate"); },
+	get DB_SIZE()     { return document.getElementById("mcDBPropDBSize"); },
+	get DB_GROUP()    { return document.getElementById("mcDBPropDatabaseGroup"); },
+
+	get IO()         { return Components.classes['@mozilla.org/network/io-service;1'].getService(Components.interfaces.nsIIOService); },
+
+	item     : null,
+	dbFile   : null,
+
+	init : function(){
+		try {
+			this.item = window.arguments[0];
+		}catch(ex){}
+		if(!this.item) return;
+
+		if(this.item.title) this.TITLE.value = this.item.title;
+		try{this.TITLE.editor.transactionManager.clear();}catch(ex2){}
+		if(this.item.comment) this.COMMENT.value = this.item.comment;
+		try{this.COMMENT.editor.transactionManager.clear();}catch(ex2){}
+
+		if(this.item.use != undefined) this.USE.checked = this.item.use;
+		if(this.item.contextmenu != undefined) this.CONTEXTMENU.checked = this.item.contextmenu;
+		if(this.item.default != undefined) this.DEFAULT.checked = this.item.default;
+		this.DEFAULT.disabled = this.DEFAULT.checked;
+
+		this.dbFile = null;
+		this.dispDBFileInfo();
+
+		document.title = this.TITLE.value;
+	},
+
+	done : function(){
+	},
+
+	commandDefault : function(e){
+		if(this.DEFAULT.checked){
+			this.USE.checked = this.DEFAULT.checked;
+		}else if(!this.item.default && !this.item.use){
+			this.USE.checked = this.DEFAULT.checked;
+		}
+	},
+
+	commandUse : function(e){
+		this.CONTEXTMENU.checked = this.USE.checked;
+	},
+
+	accept : function(){
+		var changed = false;
+		var newVals = {
+			title       : this.TITLE.value   != "" ? this.TITLE.value   : null,
+			comment     : this.COMMENT.value != "" ? this.COMMENT.value : null,
+			use         : this.USE.checked,
+			contextmenu : this.CONTEXTMENU.checked,
+			default     : this.DEFAULT.checked,
+		};
+		if(newVals["title"]){
+			newVals["title"] = newVals["title"].replace(/\t/mg,"        ");
+			newVals["title"] = newVals["title"].replace(/[\cA\cB\cC\cD\cE\cF\cG\cH\cI\cJ\cK\cL\cM\cN\cO\cP\cQ\cR\cS\cT\cU\cV\cW\cX\cY\cZ\c[\c\\\c]\c^\c_]/mg," ");
+			newVals["title"] = newVals["title"].replace(/[\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f]/mg," ");
+			newVals["title"] = newVals["title"].replace(/[\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f]/mg," ");
+			newVals["title"] = newVals["title"].replace(/[\x7f]/mg," ");
+		}else{
+//			window.acceptDialog();
+//			return;
+		}
+		if(newVals["comment"]){
+			newVals["comment"] = newVals["comment"].replace(/\t/mg,"        ");
+			newVals["comment"] = newVals["comment"].replace(/[\r\n]/mg," __BR__ ");
+			newVals["comment"] = newVals["comment"].replace(/[\cA\cB\cC\cD\cE\cF\cG\cH\cI\cJ\cK\cL\cM\cN\cO\cP\cQ\cR\cS\cT\cU\cV\cW\cX\cY\cZ\c[\c\\\c]\c^\c_]/mg," ");
+			newVals["comment"] = newVals["comment"].replace(/[\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f]/mg," ");
+			newVals["comment"] = newVals["comment"].replace(/[\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f]/mg," ");
+			newVals["comment"] = newVals["comment"].replace(/[\x7f]/mg," ");
+			newVals["comment"] = newVals["comment"].replace(/ __BR__ /mg,"\n");
+		}
+		var props;
+		for(props in newVals){
+
+_dump(props+"=["+this.item[props]+"]["+newVals[props]+"]");
+
+			if(this.item[props] == newVals[props]) continue;
+			this.item[props] = newVals[props];
+			changed = true;
+		}
+		if(window.arguments[0]) window.arguments[0].accept = true;
+		return true;
+	},
+
+	cancel : function(){
+		if(window.arguments[0]) window.arguments[0].accept = false;
+	},
+
+	dialogaccept : function(){
+		try{this.TITLE.editor.transactionManager.undoTransaction();}catch(ex2){this.Common.alert(ex2)}
+		this.TITLE.focus();
+		return false;
+	},
+
+	input : function(){
+		if(this.TITLE.value == ""){
+			this.ACCEPTBTN.setAttribute("disabled","true");
+		}else{
+			this.ACCEPTBTN.removeAttribute("disabled");
+		}
+	},
+
+	dispDBFileInfo : function(){
+		if(this.item.file){
+			var aURI = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURI);
+			aURI.spec = this.item.file;
+			if(aURI.schemeIs("file")){
+				try {
+					var fileHandler = this.IO.getProtocolHandler("file").QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+					this.dbFile = fileHandler.getFileFromURLSpec(this.item.file);
+				}catch(ex){
+					_dump("init():ex="+ex);
+					this.dbFile = null;
+				}
+			}
+		}
+
+_dump("dispDBFileInfo():this.dbFile="+this.dbFile);
+		if(this.dbFile && this.dbFile.exists()){
+			this.DB_GROUP.removeAttribute("hidden");
+			this.DB_PATH.value = this.dbFile.path;
+			this.DB_DATE.value = (new Date(this.dbFile.lastModifiedTime)).toLocaleString();
+			this.DB_SIZE.value = this.formatFileSize(this.dbFile.fileSize);
+		}else{
+			this.DB_GROUP.hidden = true;
+			this.DB_PATH.value = "";
+			this.DB_DATE.value = "";
+			this.DB_SIZE.value = "";
+		}
+_dump("dispDBFileInfo():DB_DATE="+this.DB_DATE.value);
+	},
+
+	formatFileSize : function(aBytes){
+		if(aBytes > 1000 * 1000){
+			return this.divideBy100( Math.round( aBytes / 1024 / 1024 * 100 ) ) + " MB";
+		}else if( aBytes == 0 ){
+			return "0 KB";
+		}else{
+			var kbytes = Math.round( aBytes / 1024 );
+			return (kbytes == 0 ? 1 : kbytes) + " KB";
+		}
+	},
+
+	divideBy100 : function(aInt){
+		if(aInt % 100 == 0){
+			return aInt / 100 + ".00";
+		}else if(aInt % 10 == 0){
+			return aInt / 100 + "0";
+		}else{
+			return aInt / 100;
+		}
+	},
+};
+
+
+function _dump(aString){
+	if(nsPreferences.getBoolPref("wiredmarker.debug", false)) window.dump(aString+"\n");
+}
+
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/databasePropDialog.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/databasePropDialog.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/databasePropDialog.xul	(revision 5703)
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/setting.css" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/property.css" type="text/css" ?>
+<?xul-overlay href="chrome://markingcollection/content/databaseDialogOverlay.xul"?>
+<!DOCTYPE prefwindow SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<dialog
+	id="mcDBPropWindow"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	title="&markingcollection.tools.settings; - &markingcollection.app.title;"
+	buttons="accept,cancel"
+	onload="mcDatabasePropService.init();"
+	onunload="mcDatabasePropService.done();"
+	ondialogaccept="return mcDatabasePropService.accept();"
+	ondialogcancel="return mcDatabasePropService.cancel();"
+>
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/databasePropDialog.js" />
+	<stringbundleset>
+		<stringbundle id="mcDBPropString" src="chrome://markingcollection/locale/markingcollection.properties" />
+	</stringbundleset>
+	<groupbox flex="1">
+		<caption label="&markingcollection.prop.general;"/>
+		<grid>
+			<columns>
+				<column/>
+				<column flex="1"/>
+			</columns>
+			<rows>
+				<row>
+					<label value="&markingcollection.database.name;" control="mcDBPropTitleTextbox"/>
+					<textbox id="mcDBPropTitleTextbox" oninput="mcDatabasePropService.input();"/>
+				</row>
+				<row>
+					<label value="&markingcollection.database.comment;" control="mcDBPropCommentTextbox"/>
+					<textbox id="mcDBPropCommentTextbox" multiline="true" rows="5"/>
+				</row>
+			</rows>
+		</grid>
+		<checkbox id="mcDBPropUseCheckbox" label="&markingcollection.database.use;" oncommand="mcDatabasePropService.commandUse(event);"/>
+		<checkbox id="mcDBPropContextmenuCheckbox" label="&markingcollection.database.contextmenu;"/>
+		<checkbox id="mcDBPropDefaultCheckbox" label="&markingcollection.database.default;" oncommand="mcDatabasePropService.commandDefault(event);" hidden="true"/>
+	</groupbox>
+	<groupbox id="mcDBPropDatabaseGroup" flex="1">
+		<caption label="&markingcollection.database;" />
+		<grid flex="1">
+			<columns>
+				<column />
+				<column flex="1" />
+			</columns>
+			<rows>
+				<row align="center">
+					<label value="path:" />
+					<textbox id="mcDBPropDBPath" readonly="true" />
+				</row>
+				<row align="center">
+					<label value="date:" />
+					<textbox id="mcDBPropDBDate" readonly="true" />
+				</row>
+				<row id="mcDBPropSizeRow" align="center">
+					<label value="size:" />
+					<textbox id="mcDBPropDBSize" readonly="true" />
+				</row>
+			</rows>
+		</grid>
+	</groupbox>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/generalDialogOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/generalDialogOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/generalDialogOverlay.xul	(revision 5703)
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+	id="generalDialogOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _generalDialogOverlayInit(aEvent){
+			var selectimportimage = nsPreferences.copyUnicharPref("wiredmarker.selectimportimage","none");
+			switch(selectimportimage){
+				case "alt":
+					document.getElementById("bitsSelectImportImageNone").removeAttribute("selected");
+					document.getElementById("bitsSelectImportImageAlt").setAttribute("selected","true");
+					document.getElementById("bitsSelectImportImageAltAndSubstitution").removeAttribute("selected");
+					document.getElementById("bitsSelectImportImageSubstitution").removeAttribute("selected");
+					document.getElementById("bitsSelectImportImageSubstitutionAndAlt").removeAttribute("selected");
+					break;
+				case "alt_substitution":
+					document.getElementById("bitsSelectImportImageNone").removeAttribute("selected");
+					document.getElementById("bitsSelectImportImageAlt").removeAttribute("selected");
+					document.getElementById("bitsSelectImportImageAltAndSubstitution").setAttribute("selected","true");
+					document.getElementById("bitsSelectImportImageSubstitution").removeAttribute("selected");
+					document.getElementById("bitsSelectImportImageSubstitutionAndAlt").removeAttribute("selected");
+					document.getElementById("bitsSubstitutionConfirm").removeAttribute("disabled");
+					break;
+				case "substitution":
+					document.getElementById("bitsSelectImportImageNone").removeAttribute("selected");
+					document.getElementById("bitsSelectImportImageAlt").removeAttribute("selected");
+					document.getElementById("bitsSelectImportImageAltAndSubstitution").removeAttribute("selected");
+					document.getElementById("bitsSelectImportImageSubstitution").setAttribute("selected","true");
+					document.getElementById("bitsSelectImportImageSubstitutionAndAlt").removeAttribute("selected");
+					document.getElementById("bitsSubstitutionConfirm").removeAttribute("disabled");
+					break;
+				case "substitution_alt":
+					document.getElementById("bitsSelectImportImageNone").removeAttribute("selected");
+					document.getElementById("bitsSelectImportImageAlt").removeAttribute("selected");
+					document.getElementById("bitsSelectImportImageAltAndSubstitution").removeAttribute("selected");
+					document.getElementById("bitsSelectImportImageSubstitution").removeAttribute("selected");
+					document.getElementById("bitsSelectImportImageSubstitutionAndAlt").setAttribute("selected","true");
+					document.getElementById("bitsSubstitutionConfirm").removeAttribute("disabled");
+					break;
+				default:
+					document.getElementById("bitsSelectImportImageNone").setAttribute("selected","true");
+					document.getElementById("bitsSelectImportImageAlt").removeAttribute("selected");
+					document.getElementById("bitsSelectImportImageAltAndSubstitution").removeAttribute("selected");
+					document.getElementById("bitsSelectImportImageSubstitution").removeAttribute("selected");
+					document.getElementById("bitsSelectImportImageSubstitutionAndAlt").removeAttribute("selected");
+					break;
+			}
+
+			var confirm = nsPreferences.getBoolPref("wiredmarker.substitution.confirm", true);
+			document.getElementById("bitsSubstitutionConfirm").setAttribute("checked",confirm);
+		}
+		function _generalDialogOverlayDone(aEvent){
+
+		}
+		function _SelectImportImageCommand(aEvent){
+			nsPreferences.setUnicharPref("wiredmarker.selectimportimage", aEvent.target.value);
+			if(aEvent.target.value == "substitution" || aEvent.target.value == "substitution_alt" || aEvent.target.value == "alt_substitution"){
+				document.getElementById("bitsSubstitutionConfirm").removeAttribute("disabled");
+			}else{
+				document.getElementById("bitsSubstitutionConfirm").setAttribute("disabled","true");
+			}
+		}
+		function _SubstitutionConfirmCommand(aEvent){
+			nsPreferences.setBoolPref("wiredmarker.substitution.confirm", aEvent.target.checked);
+		}
+		window.addEventListener("load", _generalDialogOverlayInit, false);
+		window.addEventListener("unload", _generalDialogOverlayDone, false);
+	]]>
+	</script>
+	<tabbox id="mcSettingTabbox">
+		<tabpanels id="mcSettingTabPanels">
+			<tabbox id="mcMenuTabbox">
+				<tabs id="mcMenuTabs">
+					<tab id="mcGeneralTab" label="&markingcollection.setting.imagecapture;" image="chrome://markingcollection/skin/image.png"/>
+				</tabs>
+				<tabpanels id="mcMenuTabPanels">
+					<tabpanel id="mcGeneralTabPanel" orient="vertical" flex="1">
+						<groupbox flex="1">
+							<caption label="&markingcollection.selectimportimage;" style="background-color:#fff;"/>
+							<radiogroup id="" oncommand="_SelectImportImageCommand(event)">
+								<radio id="bitsSelectImportImageNone"               value="none"             label="&markingcollection.selectimportimage.none;"/>
+								<radio id="bitsSelectImportImageAlt"                value="alt"              label="&markingcollection.selectimportimage.alt;"/>
+								<radio id="bitsSelectImportImageAltAndSubstitution" value="alt_substitution" label="&markingcollection.selectimportimage.alt_substitution;"/>
+								<radio id="bitsSelectImportImageSubstitution"       value="substitution"     label="&markingcollection.selectimportimage.substitution;"/>
+								<radio id="bitsSelectImportImageSubstitutionAndAlt" value="substitution_alt" label="&markingcollection.selectimportimage.substitution_alt;"/>
+							</radiogroup>
+							<checkbox id="bitsSubstitutionConfirm" label="&markingcollection.substitutiontree.confirm;" checked="true" disabled="true" style="padding-left:1em;"  oncommand="_SubstitutionConfirmCommand(event)"/>
+							<groupbox flex="1" id="bitsSubstitutionTreeGroupBox">
+								<caption label="&markingcollection.substitutiontree.table;" style="background-color:#fff;"/>
+							</groupbox>
+						</groupbox>
+						<groupbox id="mcMetaCaptureTabGroupBox"/>
+					</tabpanel>
+				</tabpanels>
+			</tabbox>
+		</tabpanels>
+	</tabbox>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/html2xhtml.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/html2xhtml.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/html2xhtml.js	(revision 5703)
@@ -0,0 +1,75 @@
+var bitsHTML2XHTMLService = {
+	init : function(){},
+	getXHTML : function(aNode, aLang, aEncoding, aNeedNl, aInsidePre){
+		var i,j;
+		var xhtml = '';
+		var childNodes = aNode.childNodes;
+		var childLength = childNodes.length;
+		var localName;
+		var node;
+		var attributes;
+		var attributesLength;
+		var attrName;
+		var attrValue;
+		var pageMode = true;
+		for(i=0;i<childLength;i++){
+			node = childNodes[i];
+			switch(node.nodeType){
+				case Node.ELEMENT_NODE :
+					localName = node.localName.toLowerCase();
+					if(localName == '') break;
+					if(localName == 'meta' && String(node.name).toLowerCase() == 'generator') break;
+					if(!aNeedNl && localName == 'body') pageMode = false;
+					if(localName == 'html'){
+						xhtml = '<?xml version="1.0"';
+						if(aEncoding) xhtml += ' encoding="'+aEncoding+'"';
+						xhtml += '?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n';
+					}
+					xhtml += '<'+localName;
+					attributes = node.attributes;
+					attributesLength = attributes.length;
+					for(j=0;j<attributesLength;j++){
+						attrName = attributes[j].localName.toLowerCase();
+						attrValue = null;
+						switch(attrName){
+							case "style" : attrValue = node.style.cssText; break;
+							case "class" : attrValue = node.className; break;
+							case "http-equiv": attrValue = node.httpEquiv; break;
+							case "noshade": case "checked": case "selected": case "multiple": case "nowrap": case "disabled": attrValue = 'true'; break;
+							default: try{ attrValue = node.getAttribute(attrName); }catch(e){ attrValue = null; }
+						}
+						if(aLang && (attrName == 'lang' || attrName == 'xml:lang')) attrValue = aLang;
+						if(attrValue != null && (!(localName == 'li' && attrName == 'value'))) xhtml += ' '+attrName+'="'+ String(attrValue).replace(/\&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\"/g, "&quot;") +'"';
+					}
+					if(localName == 'img' && !node.hasAttribute('alt')) xhtml += ' alt=""';
+					if(localName == 'html'){
+						if(aLang){
+							if(!node.hasAttribute('lang')) xhtml += ' lang="'+aLang+'"';
+							if(!node.hasAttribute('xml:lang')) xhtml += ' xml:lang="'+aLang+'"';
+						}
+						if(!node.hasAttribute('xmlns')) xhtml += ' xmlns="http://www.w3.org/1999/xhtml"';
+					}
+					if(node.hasChildNodes()){
+						xhtml += '>';
+						xhtml += this.getXHTML(node, aLang, aEncoding, true, (aInsidePre||localName=='pre')?true:false);
+						xhtml += '</'+localName+'>';
+					}else{
+						xhtml += ' />';
+					}
+					break;
+				case Node.TEXT_NODE :
+					var textContent = node.textContent;
+					if(!aInsidePre){
+						textContent = String(textContent).replace(/^\s*/g, "").replace(/\s*$/g, "").replace(/\n{2,}/g, "\n").replace(/\&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\u00A0/g, "&nbsp;");
+						if(textContent == '\n') textContent = '';
+					}
+					xhtml += textContent;
+					break;
+				default:
+					break;
+			}
+		}
+		if(!aNeedNl && !pageMode) xhtml = xhtml.replace(/<\/?head>[\n]*/gi, "").replace(/<head \/>[\n]*/gi, "").replace(/<\/?body>[\n]*/gi, "");
+		return xhtml;
+	}
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/hyperanchor.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/hyperanchor.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/hyperanchor.js	(revision 5703)
@@ -0,0 +1,1743 @@
+var bitsHyperAnchorDummy_urlBarListener = {
+	QueryInterface : function(aIID){
+		if(aIID.equals(Components.interfaces.nsIWebProgressListener) || aIID.equals(Components.interfaces.nsISupportsWeakReference) || aIID.equals(Components.interfaces.nsISupports)) return this;
+		throw Components.results.NS_NOINTERFACE;
+	},
+	onLocationChange : function(webProgress, aRequest, aURI){
+		if(!webProgress.isLoadingDocument) bitsHyperAnchorDummy.processNewURL(aURI,webProgress.DOMWindow.document);
+	},
+	onStateChange : function(webProgress, request, stateFlags, status){
+		var aURI = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURI);
+		aURI.spec = webProgress.DOMWindow.document.location.toString();
+		if(!webProgress.isLoadingDocument) bitsHyperAnchorDummy.processNewURL(aURI,webProgress.DOMWindow.document);
+
+	},
+	onProgressChange : function(){},
+	onStatusChange : function(){},
+	onSecurityChange : function(){},
+	onLinkIconAvailable : function(){}
+};
+
+var bitsHyperAnchorDummy = {
+/////////////////////////////////////////////////////////////////////
+	_anchor_title   : "hyperanchor",
+	_anchor_version : "1.3",
+	_id       : "bits_hyperanchor",
+	_init     : false,
+	_APP_ID   : "{7c70a669-5a3f-4390-a507-670639880928}",
+	_timer    : null,
+	_select   : false,
+	_anchorNode : null,
+	_anchorNode_style : null,
+	_hyperanchor_title : null,
+	_hyperanchor_version : null,
+
+	_iconopentimer : null,
+	_iconclosetimer : null,
+	_icondisp  : false,
+	_iconnode  : {},
+	_wndowLinkIcon : null,
+	_wndowLinkIconW : 800,
+	_wndowLinkIconH : 300,
+
+	get STRING(){ return document.getElementById("bitsHyperAnchorDummyString"); },
+
+/////////////////////////////////////////////////////////////////////
+	get _contextMenuObject(){
+		if("gContextMenu" in window && gContextMenu){
+			return gContextMenu;
+		}else if("gContextMenu" in window.top && window.top.gContextMenu){
+			return window.top.gContextMenu;
+		}else{
+			return {
+				target  : null,
+				onLink  : false,
+				link    : false,
+				onImage : false
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	get nodePositionInRange(){
+		return {
+			SINGLE : 0,
+			START  : 1,
+			MIDDLE : 2,
+			END    : 3
+		};
+	},
+
+/////////////////////////////////////////////////////////////////////
+	gBrowser : function(){
+		return gBrowser;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	init : function(aEvent){
+		if(this._init) return;
+		try{
+			var info = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
+			var app_version = parseInt(info.version);
+			this.gBrowser().addEventListener("pageshow",  bitsHyperAnchorDummy.load,   false);
+			this.gBrowser().addEventListener("pagehide",  bitsHyperAnchorDummy.unload, false);
+			this.gBrowser().tabContainer.addEventListener("TabSelect", bitsHyperAnchorDummy.select, false);
+			if(app_version<4) this.gBrowser().addProgressListener(bitsHyperAnchorDummy_urlBarListener, Components.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
+			else this.gBrowser().addProgressListener(bitsHyperAnchorDummy_urlBarListener);
+			setTimeout(function(){ bitsHyperAnchorDummy._load(bitsHyperAnchorDummy.gBrowser().contentDocument);},0);
+			this._init = true;
+		}catch(ex){
+			alert("bitsHyperAnchorDummy.init():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(aEvent){
+		if(this._init){
+			this.gBrowser().removeEventListener("pageshow",  bitsHyperAnchorDummy.load,   false);
+			this.gBrowser().removeEventListener("pagehide",  bitsHyperAnchorDummy.unload, false);
+			this.gBrowser().tabContainer.removeEventListener("TabSelect", bitsHyperAnchorDummy.select, false);
+			this.gBrowser().removeProgressListener(bitsHyperAnchorDummy_urlBarListener);
+			if(this._wndowLinkIcon && !this._wndowLinkIcon.closed) this._wndowLinkIcon.close();
+		}
+		if(this._timer) clearTimeout(this._timer);
+		this._timer = null;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	processNewURL: function(aURI,aDoc){
+		bitsHyperAnchorDummy._removeMarker();
+		if(bitsHyperAnchorDummy._timer) clearTimeout(bitsHyperAnchorDummy._timer);
+		bitsHyperAnchorDummy._timer = setTimeout(function(){bitsHyperAnchorDummy._load(aDoc);},0);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	load : function(aEvent){
+		if(bitsHyperAnchorDummy._timer) clearTimeout(bitsHyperAnchorDummy._timer);
+		bitsHyperAnchorDummy._timer = setTimeout(function(){ bitsHyperAnchorDummy._removeMarker(); bitsHyperAnchorDummy._load(aEvent.target); },0);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_load : function(aDoc){
+		if(this._timer){
+			clearTimeout(this._timer);
+			this._timer = null;
+		}
+		var doc = aDoc;
+		if(!doc.location) return;
+		this._hyperanchor_title = null;
+		this._hyperanchor_version = null;
+		var hyperanchor = null;
+		var bgnNode = null;
+		var endNode = null;
+		var bgnContents = null;
+		var endContents = null;
+		var style   = null;
+		var target = {};
+		var hash = this.getLocationHash(doc.location.href);
+		var hashReg = new RegExp("#"+this._anchor_title+"([0-9\.]*):(.+)$");
+		if(hash && hash.match(hashReg)){
+			this._hyperanchor_version = RegExp.$1;
+			hyperanchor = RegExp.$2;
+			var anchor = this.xmlDecode(hyperanchor);
+			if(anchor.match(/[\:\&]*vr=([^\&]+)?/)){
+				this._hyperanchor_version = unescape(RegExp.$1);
+				if(anchor.match(/[\:\&]*bx=([^\&]+)?/)) bgnNode     = this.xmlEncode(unescape(RegExp.$1));
+				if(anchor.match(/[\:\&]*bi=([^\&]+)?/)) bgnNode    += "(" + unescape(RegExp.$1) + ")";
+				if(anchor.match(/[\:\&]*bt=([^\&]+)?/)) bgnNode    += "(" + unescape(RegExp.$1) + ")";
+				if(anchor.match(/[\:\&]*bc=([^\&]+)?/)) bgnContents = RegExp.$1;
+				if(anchor.match(/[\:\&]*ex=([^\&]+)?/)) endNode     = this.xmlEncode(unescape(RegExp.$1));
+				if(anchor.match(/[\:\&]*ei=([^\&]+)?/)) endNode    += "(" + unescape(RegExp.$1) + ")";
+				if(anchor.match(/[\:\&]*et=([^\&]+)?/)) endNode    += "(" + unescape(RegExp.$1) + ")";
+				if(anchor.match(/[\:\&]*ec=([^\&]+)?/)) endContents = RegExp.$1;
+				if(anchor.match(/[\:\&]*st=([^\&]+)?/)) style       = unescape(RegExp.$1);
+
+			// Ver 1.2, 1.3
+			}else if(hyperanchor.match(/^(.+\([0-9]+\)\([0-9]+\)\([\s\S]*\))&(.+\([0-9]+\)\([0-9]+\)\([\s\S]*\))&(.+)$/)){
+				bgnNode = unescape(RegExp.$1);
+				endNode = unescape(RegExp.$2);
+				style   = unescape(RegExp.$3);
+			}else if(hyperanchor.match(/^(.+\([0-9]+\)\([0-9]+\)\([\s\S]*\))&(.+\([0-9]+\)\([0-9]+\)\([\s\S]*\))$/)){
+				bgnNode = unescape(RegExp.$1);
+				endNode = unescape(RegExp.$2);
+			}else if(hyperanchor.match(/^(.+\([0-9]+\)\([0-9]+\)\([\s\S]*\))&&(.+)$/)){
+				bgnNode = unescape(RegExp.$1);
+				style   = unescape(RegExp.$2);
+			}else if(hyperanchor.match(/^(.+\([0-9]+\)\([0-9]+\)\([\s\S]*\))$/)){
+				bgnNode = unescape(RegExp.$1);
+
+			// Ver 1.0, 1.1
+			}else if(hyperanchor.match(/^(.+\([0-9]+\)\([0-9]+\))&(.+\([0-9]+\)\([0-9]+\))&(.+)$/)){
+				bgnNode = unescape(RegExp.$1);
+				endNode = unescape(RegExp.$2);
+				style   = unescape(RegExp.$3);
+			}else if(hyperanchor.match(/^(.+\([0-9]+\)\([0-9]+\))&(.+\([0-9]+\)\([0-9]+\))$/)){
+				bgnNode = unescape(RegExp.$1);
+				endNode = unescape(RegExp.$2);
+			}else if(hyperanchor.match(/^(.+\([0-9]+\)\([0-9]+\))&&(.+)$/)){
+				bgnNode = unescape(RegExp.$1);
+				style   = unescape(RegExp.$2);
+			}else if(hyperanchor.match(/^(.+\([0-9]+\)\([0-9]+\))$/)){
+				bgnNode = unescape(RegExp.$1);
+			}
+		}
+		if(bgnNode){
+			bgnNode = this.xmlDecode(bgnNode);
+			// Ver 1.2, 1.3
+			if(bgnNode.match(/(.+)\(([0-9]+)\)\(([0-9]+)\)\(([\s\S]*)\)/m)){
+				target.startPath   = RegExp.$1;
+				target.startOffset = RegExp.$2;
+				target.startType   = RegExp.$3;
+				target.startContents   = RegExp.$4;
+			// Ver 1.0, 1.1
+			}else if(bgnNode.match(/(.+)\(([0-9]+)\)\(([0-9]+)\)/)){
+				target.startPath   = RegExp.$1;
+				target.startOffset = RegExp.$2;
+				target.startType   = RegExp.$3;
+			}
+			target.startNode = this.XPath.getCurrentNodeFromXPath(doc,target.startPath,target.startOffset,target.startType);
+			if(!target.startNode || !target.startNode.node){
+				return null;
+			}
+		}
+		if(endNode){
+			endNode = this.xmlDecode(endNode);
+			// Ver 1.2, 1.3
+			if(endNode.match(/(.+)\(([0-9]+)\)\(([0-9]+)\)\(([\s\S]*)\)/)){
+				target.endPath   = RegExp.$1;
+				target.endOffset = RegExp.$2;
+				target.endType   = RegExp.$3;
+				target.endContents   = RegExp.$4;
+			// Ver 1.0, 1.1
+			}else if(endNode.match(/(.+)\(([0-9]+)\)\(([0-9]+)\)/)){
+				target.endPath   = RegExp.$1;
+				target.endOffset = RegExp.$2;
+				target.endType   = RegExp.$3;
+			}
+			target.endNode = this.XPath.getCurrentNodeFromXPath(doc,target.endPath,target.endOffset,target.endType);
+		}
+		if(style){
+			style = this.xmlDecode(style);
+			target.style = style;
+		}else{
+			target.style = "outline:1px dotted invert;outline-offset:0;background-color:#ff9;";
+		}
+		if(target.startNode && target.startNode.node){
+			var node = target.startNode.node;
+			if(node.nodeType == 3){
+				if(target.endNode){
+					if(this.checkMarkupedText(doc, target)){
+						var mdoc = target.startNode.node.ownerDocument;
+						var startXPath = this.XPath.getOffsetFromParentNode(target.startNode.node,target.startNode.offset);
+						var endXPath = this.XPath.getOffsetFromParentNode(target.endNode.node,target.endNode.offset);
+						bgnNode = startXPath.xpath + "(" + startXPath.offset + ")(" + startXPath.type + ")";
+						endNode = endXPath.xpath + "(" + endXPath.offset + ")(" + endXPath.type + ")";
+						this.xPathMarker(mdoc,{start : bgnNode, end : endNode}, { id : this._id, style : target.style });
+						var xPathResult = this.XPath.evaluate('//*[@id="'+ this._id +'"]', mdoc);
+						node = null;
+						if(xPathResult.snapshotLength>0) node = xPathResult.snapshotItem(0);
+					}
+				}else{
+					node = target.startNode.node.parentNode;
+					var range = doc.createRange();
+					try{
+						range.setStart(target.startNode.node, target.startNode.offset);
+						range.setEnd(target.startNode.node, target.startNode.offset);
+					}catch(ex2){
+						this._dump("bitsHyperAnchorDummy._load():["+range.toString()+"]::"+ex2);
+						return;
+					}
+					var startContainer = range.startContainer;
+					var ownerDoc = startContainer.ownerDocument;
+					node = ownerDoc.createElement("span");
+					node.id = this._id;
+					node.setAttribute("style",target.style);
+					var docfrag = range.extractContents();
+					node.appendChild(docfrag);
+					range.insertNode(node);
+				}
+			}else if((target.startType.length > 0) &&  (target.startType == 3) && (node.nodeType == 1)){
+			
+			}else if(node.nodeType == 1){
+				if(this.checkMarkupedAttribute(node, target)){
+					this._anchorNode = node;
+					this._anchorNode_style = this._anchorNode.style.cssText;
+					this._anchorNode.setAttribute("style",target.style);
+				}
+			}
+			var offsetY = this.getPageOffsetTop(node);
+			var win = doc.defaultView;
+			win.scroll( win.pageXOffset, offsetY-10);
+		}
+		this._hyperanchor_version = null;
+		if(doc.body){
+			var hyperanchor_icon = nsPreferences.copyUnicharPref("wiredmarker.hyperanchor.icon_display","icon_display_left_popup");
+			if(!hyperanchor_icon || hyperanchor_icon == "icon_none") return;
+			var sURL = this._getURLStringFromDocument(doc);
+			if(sURL == "") return;
+			var icon_url = this.Common.getChromeImageURI(this.Common.convertURLToObject("chrome://markingcollection/skin/hyperanchor.png"));
+			var links = doc.links;
+			if(links){
+				if(!this._iconnode[sURL]){
+					if(hyperanchor_icon == "icon_display_left_popup" || hyperanchor_icon == "icon_display_right_popup"){
+						var i;
+						for(i=0;i<links.length;i++){
+							if(!this._isShowLinkIcon(links[i])) continue;
+							links[i].addEventListener("mouseover", bitsHyperAnchorDummy.mouseover, false);
+							links[i].addEventListener("mouseout",  bitsHyperAnchorDummy.mouseout, false);
+						}
+					}else if(hyperanchor_icon == "icon_display_left" || hyperanchor_icon == "icon_display_right"){
+						var i;
+						for(i=0;i<links.length;i++){
+							if(!this._isShowLinkIcon(links[i])) continue;
+							var span = doc.createElement("span");
+							span.style.paddingLeft='16px';
+							span.style.lineHeight='16px';
+							span.style.backgroundImage='url(' + icon_url + ')';
+							span.style.backgroundRepeat='no-repeat';
+							span.style.backgroundColor='#eee';
+							span.style.cursor='pointer';
+							span.style.border='1px solid gray';
+							span.style.zIndex='65535';
+							span.addEventListener("click",  bitsHyperAnchorDummy.clickLinkIcon, false);
+							span.setAttribute("href",links[i].href);
+							span.setAttribute("id",this._id+"_icon_"+i);
+							if(hyperanchor_icon == "icon_display_left"){
+								span.style.marginRight='4px';
+								links[i].parentNode.insertBefore(span,links[i]);
+							}else if(hyperanchor_icon == "icon_display_right"){
+								span.style.marginLeft='4px';
+								if(links[i].nextSibling){
+									links[i].parentNode.insertBefore(span,links[i].nextSibling);
+								}else{
+									links[i].parentNode.appendChild(span);
+								}
+							}
+						}
+					}
+					this._iconnode[sURL] = doc.createElement("div");
+					this._iconnode[sURL].style.position='absolute';
+					this._iconnode[sURL].style.left='0px';
+					this._iconnode[sURL].style.top='0px';
+					this._iconnode[sURL].style.width='16px';
+					this._iconnode[sURL].style.height='16px';
+					this._iconnode[sURL].style.backgroundImage='url(' + icon_url + ')';
+					this._iconnode[sURL].style.backgroundRepeat='no-repeat';
+					this._iconnode[sURL].style.backgroundColor='#eee';
+					this._iconnode[sURL].style.cursor='pointer';
+					this._iconnode[sURL].style.border='1px solid gray';
+					this._iconnode[sURL].style.zIndex='65535';
+					this._iconnode[sURL].style.display='none';
+					this._iconnode[sURL].addEventListener("mouseover", bitsHyperAnchorDummy.mouseoverLinkIcon, false);
+					this._iconnode[sURL].addEventListener("mouseout",  bitsHyperAnchorDummy.mouseout, false);
+					this._iconnode[sURL].addEventListener("click",  bitsHyperAnchorDummy.clickLinkIcon, false);
+				}
+			}
+		}
+	},
+
+
+/////////////////////////////////////////////////////////////////////
+	getLocationHash : function(URL){
+		var hash = "";
+		var RE = new RegExp("(#" + this._anchor_title + "[^#]+)#?");
+		if(URL.match(RE)) hash = RegExp.$1;
+		return decodeURIComponent(hash);
+	},
+
+
+/////////////////////////////////////////////////////////////////////
+	checkMarkupedText : function(doc, target){
+try{
+		if( target.startContents == null || target.startContents.length <= 0 && target.endContents == null || target.endContents.length <= 0) return true;
+		if(!target.startNode.node || !target.endNode.node) return false;
+		if (target.startNode.node.nodeType == 3 && target.endNode.node.nodeType == 3){
+			var preSearchFlag = true;
+			var startNodeValue = this.XPath.trimWhiteSpaceNodeIE(target.startNode.node.nodeValue,true);
+			var endNodeValue   = this.XPath.trimWhiteSpaceNodeIE(target.endNode.node.nodeValue,true);
+			if(target.startNode.offset == -1) {target.startNode.offset = 0; preSearchFlag = false;}
+			if(target.endNode.offset == -1) {target.endNode.offset = endNodeValue.length; preSearchFlag = false;}
+			if(preSearchFlag && startNodeValue.length >= (target.startNode.offset + target.startContents.length) && endNodeValue.length >= target.endNode.offset)
+			{
+				var contentsFounded = true;
+				var contents = target.startContents.replace(/[ ]+/mg,"");
+				var refStr = startNodeValue.substr(target.startNode.offset);
+				refStr = refStr.replace(/[ \t\n\r]+/mg,"").substring(0,contents.length);
+				if(refStr != contents) contentsFounded = false;
+				var contents = target.endContents.replace(/[ ]+/mg,"");
+				var refStr = endNodeValue.substr(0,target.endNode.offset);
+				refStr = refStr.split("").reverse().join("");
+				refStr = refStr.replace(/[ \t\n\r]+/mg,"").substring(0,contents.length);
+				if(refStr != contents.split("").reverse().join("")) contentsFounded = false;
+				if(contentsFounded)  return true;
+			}
+  	}
+		var rootNode = doc.body;
+		var nodeAry = new Array();
+		var startNodeInfo = new Array();
+		startNodeInfo["node"] = target.startNode.node;
+		startNodeInfo["nodeIdx"] = -1;
+		var endNodeInfo = new Array();
+		endNodeInfo["node"] = target.endNode.node;
+		endNodeInfo["nodeIdx"] = -1;
+		this.getNodeAry(rootNode, nodeAry, startNodeInfo, endNodeInfo);
+		var mappingMargin = bitsMarker.alignment;
+		var startCharInfoAry = new Array();
+		var startStartCharIdx = this.getCharInfoAry(startCharInfoAry, "start", nodeAry, startNodeInfo["nodeIdx"], target.startNode.offset, mappingMargin, target.startContents);
+		var startCharInfo = this.searchMarkupedChar("start", startCharInfoAry, target.startContents, startStartCharIdx);
+		var endCharInfoAry = new Array();
+		var endStartCharIdx = this.getCharInfoAry(endCharInfoAry, "end", nodeAry, endNodeInfo["nodeIdx"], target.endNode.offset, mappingMargin, target.endContents);
+		var endCharInfo = this.searchMarkupedChar("end", endCharInfoAry, target.endContents, endStartCharIdx, startCharInfo);
+		if(startCharInfo && endCharInfo){
+			target.startNode.node = startCharInfo["node"];
+			target.startNode.offset = startCharInfo["offset"];
+			target.endNode.node = endCharInfo["node"];
+			target.endNode.offset = endCharInfo["offset"];
+		}else{
+			return false;
+		}
+		return true;
+}catch(e){
+	alert(e);
+}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getNodeAry : function(node, nodeAry, startNodeInfo, endNodeInfo){
+try{
+	if(!node) return;
+	if(node.hasChildNodes()){
+		var tname = node.tagName;
+		if(tname){
+			tname = tname.toLowerCase();
+			if(tname == "script"){
+				return;
+			}else if(tname == "style"){
+				return;
+			}else if(tname == "head"){
+				return;
+			}else{
+				var children = node.childNodes;
+				for(var i=0;i<children.length;i++){
+					this.getNodeAry(children[i], nodeAry, startNodeInfo, endNodeInfo);
+				}
+			}
+		}else{
+			var children = node.childNodes;
+			for(var i=0;i<children.length;i++){
+				this.getNodeAry(children[i], nodeAry, startNodeInfo, endNodeInfo);
+			}
+		}
+	}else{
+		nodeAry.push(node);
+		if(node == startNodeInfo["node"]) startNodeInfo["nodeIdx"] = nodeAry.length - 1;
+		if(node == endNodeInfo["node"]) endNodeInfo["nodeIdx"] = nodeAry.length - 1;
+	}
+	
+}catch(e){
+	alert("catch : " + e);
+}
+	},
+	
+
+/////////////////////////////////////////////////////////////////////
+	getCharInfoAry : function(charInfoAry, mode, nodeAry, targetIdx, offset, margin, contents){
+try{
+	var charInfoAryBack = new Array();
+	var strLen = 0;
+	var isEnd = false;
+	var tmpOffset = offset;
+	for(var i=targetIdx;i<nodeAry.length;i++){
+		var node = nodeAry[i];
+		if(node.nodeType != node.TEXT_NODE) continue;
+		if(node.parentNode && node.parentNode.nodeName == "SCRIPT") continue;
+		var nodeValue = node.nodeValue;
+		if(i != targetIdx) tmpOffset = 0;
+		for(var charIdx=tmpOffset;charIdx<=nodeValue.length;charIdx++){
+			if(mode == "start"){
+				if(strLen >= (margin + contents.length)){
+					isEnd = true;
+					break;
+				}
+			}else{
+				if(strLen >= margin){
+					isEnd = true;
+					break;
+				}
+			}
+			var charInfo = new Array();
+			charInfo["node"] = node;
+			charInfo["nodeIdx"] = i;
+			charInfo["offset"] = charIdx;
+			if(charIdx >= nodeValue.Length){
+				charInfo["char"] = "";
+			}else{
+				charInfo["char"] = nodeValue.charAt(charIdx);
+			}
+			charInfoAryBack.push(charInfo);
+			if(charInfo["char"].replace(/[ \t\n\r]+/mg,"").length > 0) strLen++;
+		}
+		if(isEnd) break;
+		tmpOffset = 0;
+	}
+	var charInfoAryForward = new Array();
+	strLen = 0;
+	isEnd = false;
+	tmpOffset = offset;
+	for(var i=targetIdx;i>=0;i--){
+		var node = nodeAry[i];
+		if(node.nodeType != node.TEXT_NODE) continue;
+		if(node.parentNode && node.parentNode.nodeName == "SCRIPT") continue;
+		var nodeValue = node.nodeValue;
+		if(i != targetIdx) tmpOffset = nodeValue.length - 1;
+		for(var charIdx=tmpOffset;charIdx>=0;charIdx--){
+			if(mode == "start"){
+				if(strLen>margin){
+					isEnd = true;
+					break;
+				}
+			}else{
+				if(strLen>(contents.length + margin + 1)){
+					isEnd = true;
+					break;
+				}
+			}
+			var charInfo = new Array();
+			charInfo["node"] = node;
+			charInfo["nodeIdx"] = i;
+			charInfo["offset"] = charIdx;
+			if(charIdx >= nodeValue.Length){
+				charInfo["char"] = "";
+			}else{
+				charInfo["char"] = nodeValue.charAt(charIdx);
+			}
+			charInfoAryForward.unshift(charInfo);
+			if(charInfo["char"].replace(/[ \t\n\r]+/mg,"").length > 0) strLen++;
+		}
+		if(isEnd) break;
+	}
+	charInfoAryForward.pop();
+	for(var i=0;i<charInfoAryForward.length;i++){
+		charInfoAry.push(charInfoAryForward[i]);
+	}
+	for(var i=0;i<charInfoAryBack.length;i++){
+		charInfoAry.push(charInfoAryBack[i]);
+	}
+	if(mode == "start"){
+		return charInfoAryForward.length;
+	}else{
+		charInfoAry.reverse();
+		return charInfoAryBack.length;
+	}
+}catch(e){
+	alert(e);
+}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	searchMarkupedChar : function(mode, charInfoAry, contents, searchStartIdx, startCharInfo){
+try{
+	contents = contents.replace(/[ ]+/mg,"");
+	if(mode == "end"){
+		var tmp = "";
+		for(var i=(contents.length-1);i>=0;i--){
+			tmp += contents.charAt(i);
+		}
+		contents = tmp;
+	}
+	var back = charInfoAry.length - searchStartIdx - contents.length;
+	var cnt  = (searchStartIdx > back) ? searchStartIdx : back;
+	for(var i=0;i<=cnt;i++){
+		for(var j=0;j<2;j++){
+			if((i == 0) && (j == 0)) continue;
+			var k = (j == 0) ? searchStartIdx - i : searchStartIdx + i;
+			if((k < 0) || (k > (charInfoAry.length - contents.length + 1))) continue;
+			if(startCharInfo){
+				if(charInfoAry[k]["nodeIdx"] < startCharInfo["nodeIdx"]){
+					continue;
+				}else if(charInfoAry[k]["nodeIdx"] == startCharInfo["nodeIdx"]){
+					if(charInfoAry[k]["offset"] < startCharInfo["offset"]){
+						continue;
+					}
+				}
+			}
+			var c = charInfoAry[k]["char"].replace(/[\t\n\r]+/mg,"");
+			if(c == null || c.length <= 0) continue;
+			var charInfoStr = "";
+			var len = 0;
+			var aryIdx = 0;
+			for(aryIdx=0;len<contents.length;aryIdx++){
+				if(k + aryIdx > charInfoAry.length - 1) break;
+				var tmpC = charInfoAry[k + aryIdx]["char"].replace(/[\t\n\r ]+/mg,"");
+				if(tmpC.length <= 0) continue;
+				charInfoStr += tmpC;
+				len++;
+			}
+			if(charInfoStr == contents){
+				if(mode == "start"){
+					return charInfoAry[k];
+				}else{
+					if((k - 1) < 0){
+						var charInfo_ = charInfoAry[k];
+						charInfo_["offset"]++;
+						return charInfo_;
+					}else{
+						return charInfoAry[k - 1];
+					}
+				}
+			}
+		}
+	}
+	return false;
+}catch(e){
+	alert(e);
+}
+
+	},
+
+/////////////////////////////////////////////////////////////////////
+	checkMarkupedAttribute : function(elem, target){
+try{
+		if(elem.tagName != "A" && elem.tagName != "IMG") return true;
+		if(target.startContents == null || target.startContents.length <= 0) return true;
+		var attr = elem.getAttribute("id", 0);
+		var attrMap = target.startContents.split(':');
+		if(attrMap.length < 2) return false;
+		var attrName = attrMap[0];
+		var attrValue = attrMap[1];
+		for(var i=2;i<attrMap.length;i++){
+			attrValue += ":" + attrMap[i];
+		}
+		var elemAttrValue = elem.getAttribute(attrName, 0);
+		if(elemAttrValue == null || elemAttrValue.length <= 0) return false;
+		var elemAttrValueSplited = elemAttrValue.split('#')[0];
+		if(elemAttrValueSplited != attrValue) return false;
+		return true;
+}catch(e){
+	alert(e);
+}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	unmarkerWindow : function(marker_id){
+		bitsHyperAnchorDummy.unmarkerWindow2(this.Common.getFocusedWindow(),marker_id);
+	},
+	
+/////////////////////////////////////////////////////////////////////
+	unmarkerWindow2 : function(win, marker_id){
+		var result = false;
+		if(win != null){
+			var doc = win.document;
+			if(win.frames != null){
+				var i;
+				for(i=0;i<win.frames.length;i++){
+					bitsHyperAnchorDummy.unmarkerWindow2(win.frames[i],marker_id);
+				}
+			}
+			if(!result){
+				var marker = doc.getElementById(marker_id);
+				while(marker != null){
+					var parent = marker.parentNode;
+					var children = marker.childNodes;
+					var index;
+					for(index=children.length-1;index>=0;index--){
+						parent.insertBefore(children[0],marker);
+					}
+					parent.removeChild(marker);
+					parent.normalize();
+					result = true;
+					marker = doc.getElementById(marker_id)
+				}
+			}
+		}
+		return result;
+	},
+
+	
+/////////////////////////////////////////////////////////////////////
+	_removeMarker : function(){
+		bitsHyperAnchorDummy.unmarkerWindow(bitsHyperAnchorDummy._id);
+		if(bitsHyperAnchorDummy._anchorNode) bitsHyperAnchorDummy._anchorNode.setAttribute("style",bitsHyperAnchorDummy._anchorNode_style);
+		bitsHyperAnchorDummy._anchorNode = null;
+		bitsHyperAnchorDummy._anchorNode_style = null;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	unload : function(aEvent){
+		if(bitsHyperAnchorDummy._timer) clearTimeout(bitsHyperAnchorDummy._timer);
+		bitsHyperAnchorDummy._timer = null;
+		if(bitsHyperAnchorDummy._iconopentimer) clearTimeout(bitsHyperAnchorDummy._iconopentimer);
+		bitsHyperAnchorDummy._iconopentimer = null;
+		if(bitsHyperAnchorDummy._iconclosetimer) clearTimeout(bitsHyperAnchorDummy._iconclosetimer);
+		bitsHyperAnchorDummy._iconclosetimer = null;
+		var doc = aEvent.target;
+		if(doc.body){
+			var sURL = bitsHyperAnchorDummy._getURLStringFromDocument(doc);
+			if(sURL == "") return;
+			if(bitsHyperAnchorDummy._iconnode[sURL]){
+				try{if(this._iconnode[sURL].parentNode) this._iconnode[sURL].parentNode.removeChild(bitsHyperAnchorDummy._iconnode[sURL]);}catch(e){}
+				delete bitsHyperAnchorDummy._iconnode[sURL];
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	select : function(aEvent){
+		if(bitsHyperAnchorDummy._timer){
+			clearTimeout(bitsHyperAnchorDummy._timer);
+			bitsHyperAnchorDummy._timer = null;
+		}
+		if(bitsHyperAnchorDummy._iconopentimer) clearTimeout(bitsHyperAnchorDummy._iconopentimer);
+		bitsHyperAnchorDummy._iconopentimer = null;
+		if(bitsHyperAnchorDummy._iconclosetimer) clearTimeout(bitsHyperAnchorDummy._iconclosetimer);
+		bitsHyperAnchorDummy._iconclosetimer = null;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getElementStyle : function(elem){
+		var style = {};
+		if(elem){
+			var resource_exp = new RegExp("^resource:");
+			var rules = Components.classes["@mozilla.org/inspector/dom-utils;1"].getService(Components.interfaces["inIDOMUtils"]).getCSSStyleRules(elem);
+			var i;
+			var j;
+			var propertyName;
+			var priority;
+			var value;
+			for(i=0;i<rules.Count();i++) {
+				var rule = rules.GetElementAt(i);
+				if(rule instanceof CSSStyleRule && (!rule.parentStyleSheet.href || !resource_exp.test(rule.parentStyleSheet.href))){
+					for(j=0;j<rule.style.length;j++){
+						propertyName = rule.style.item(j);
+						if(propertyName == '') continue;
+						priority = rule.style.getPropertyPriority(propertyName);
+						value = rule.style.getPropertyValue(propertyName);
+						if(!style[propertyName] || !style[propertyName].priority){
+							style[propertyName] = {};
+							style[propertyName].value = value;
+							style[propertyName].priority = priority;
+						}
+					}
+				}
+			}
+			if(elem.style){
+				for(j=0;j<elem.style.length;j++){
+					propertyName = elem.style.item(j);
+					if(propertyName == '') continue;
+					priority = elem.style.getPropertyPriority(propertyName);
+					value = elem.style.getPropertyValue(propertyName);
+					if(!style[propertyName] || !style[propertyName].priority){
+						style[propertyName] = {};
+						style[propertyName].value = value;
+						style[propertyName].priority = priority;
+					}
+				}
+			}
+		}
+		return style;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getPageOffsetTop : function(elem){
+		if(!elem) return 0;
+		var top = elem.offsetTop;
+		var tempElem;
+		var offsetHeight;
+		var scrollHeight;
+		var style;
+		var scrollTop;
+		while(elem && elem.offsetParent != null){
+			if(elem && elem.parentNode && elem.offsetParent != elem.parentNode){
+				tempElem = elem;
+				while(tempElem && tempElem.parentNode && elem.offsetParent != tempElem.parentNode){
+					offsetHeight = tempElem.parentNode.offsetHeight;
+					scrollHeight = tempElem.parentNode.scrollHeight;
+					if(offsetHeight != scrollHeight){
+						style = this.getElementStyle(tempElem.parentNode);
+						if(!style['height']) offsetHeight = scrollHeight;
+					}
+					if(offsetHeight != scrollHeight){
+						scrollTop = elem.offsetTop - tempElem.parentNode.offsetTop;
+						if(scrollTop>15) scrollTop -= 15;
+						if(scrollTop>0){
+							tempElem.parentNode.scrollTop = scrollTop;
+							if(tempElem.parentNode.scrollTop>0) top = tempElem.parentNode.offsetTop;
+						}
+						elem = tempElem.parentNode;
+						break;
+					}
+					tempElem = tempElem.parentNode;
+				}
+			}
+			if(elem.offsetParent.offsetHeight != elem.offsetParent.scrollHeight) elem.offsetParent.scrollTop = top - (top>15?15:0);
+			elem = elem.offsetParent;
+			if(elem) top += elem.offsetTop;
+		}
+		return top;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	xmlDecode : function(aString){
+		return aString.replace(/&nbsp;/mg," ").replace(/&amp;/mg,"&").replace(/&lt;/mg,"<").replace(/&gt;/mg,">").replace(/&quot;/mg,"\"");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	xmlEncode : function(aString){
+		return aString.replace(/&/mg,"&amp;").replace(/</mg,"&lt;").replace(/>/mg,"&gt;").replace(/\"/mg,"&quot;");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_getAnchorURL : function(){
+		var url = null;
+		var hyperanchor = null;
+		var i;
+		var hcnt = 0;
+		try{
+			for(i=0;i<arguments.length;i++){
+				var target = arguments[i];
+				if(target.node == undefined || target.offset == undefined) continue;
+				if(!hyperanchor){
+					url = this.Common.getURLStringFromDocument(target.node.ownerDocument);
+					hyperanchor = this._anchor_title + this._anchor_version + ":";
+				}
+				var xPath = this.XPath.getOffsetFromParentNode(target.node,target.offset);
+				var contents = "";
+				if(target.contents){
+					contents = target.contents;
+					contents = this.xmlDecode(contents);
+					contents = contents.replace(/[\r\n\t ]+/mg,"");
+					contents = this.trim(contents);
+					contents = this._getContentsPrefix(target.prefix, target.node, contents);
+					contents = this.xmlEncode(contents);
+				}
+				if(hcnt>0) hyperanchor += "&";
+				hyperanchor += this.xmlEncode(xPath.xpath) + "("+xPath.offset+")("+xPath.type+")"+"("+contents+")";
+				hcnt++;
+			}
+			if(hcnt>0){
+				for(i=0;i<arguments.length;i++){
+					var target = arguments[i];
+					if(target.style == undefined || target.style == '') continue;
+					target.style = target.style.replace(/:\s+rgb\(([0-9]+),\s+([0-9]+),\s+([0-9]+)\)/mg,":rgb($1,$2,$3)").replace(/;\s+/mg,";");
+					hyperanchor += "&" + this.xmlEncode(target.style);
+					break;
+				}
+			}
+		}catch(ex){
+			hyperanchor = null;
+			this._dump("bitsHyperAnchorDummy._getAnchorURL():"+ex);
+		}
+		return url + "#" + encodeURIComponent(hyperanchor);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_getContentsPrefix : function(aPrefix, aNode, aContents){
+		if(this._isTextNode(aNode)){
+			var subLen = aContents.length < 3 ? aContents.length : 3;
+			if(aPrefix == "b"){
+				return aContents.substring(0, subLen);
+			
+			}else if(aPrefix == "e"){
+				return aContents.substring(aContents.length - subLen);
+			}
+		}else{
+			var tagName = aNode.tagName.toUpperCase();
+			if(tagName == "IMG"){
+				var strSrc = aNode.getAttribute("src");
+				if(strSrc.indexOf("#") > 0) strSrc = strSrc.split("#", 1)[0];
+				return "src:" + strSrc;
+			
+			}else if(tagName == "A"){
+				var strHref = aNode.getAttribute("href");
+				if(strHref.indexOf("#") > 0) strHref = strHref.split("#", 1)[0];
+				return "href:" + strHref;
+			}
+		}
+		return "";
+	},
+
+
+/////////////////////////////////////////////////////////////////////
+	resetEmptyNode : function(doc,range){
+		if(range.startContainer.nodeType == range.startContainer.TEXT_NODE && range.endContainer.nodeType == range.endContainer.TEXT_NODE){
+			if(range.startContainer.nodeValue.replace(/[\r\n\t]+/mg,"").length == 0){
+				function _acceptNode(aNode){
+					if(aNode.nodeType == aNode.TEXT_NODE && (/^[\t\n\r ]+$/.test(aNode.nodeValue))) return NodeFilter.FILTER_REJECT;
+					return NodeFilter.FILTER_ACCEPT;
+				};
+				var nodeWalker = doc.createTreeWalker(doc,NodeFilter.SHOW_TEXT,_acceptNode,false);
+				nodeWalker.currentNode = range.startContainer;
+				var startContainer = nodeWalker.nextNode();
+				var endContainer = range.endContainer;
+				var endOffset = range.endOffset;
+				range = doc.createRange();
+				try{
+					range.setStart(startContainer, 0);
+					range.setEnd(endContainer, endOffset);
+				}catch(ex2){
+					this._dump("bitsHyperAnchorDummy.addBookmark():"+ex2);
+					return null;
+				}
+			}
+		}
+		return range;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	xPathMarker : function(aDoc, aXPath, aAttributes){
+		try{
+			var rtnNode = [];
+			var doc = aDoc;
+			if(!aDoc || !aXPath || !aXPath.start || !aXPath.end) return null;
+			aXPath.start.match(/(.+)\(([0-9]+)\)\(([0-9]+)\)/);
+			aXPath.startPath   = RegExp.$1;
+			aXPath.startOffset = RegExp.$2;
+			aXPath.startType   = RegExp.$3;
+			aXPath.end.match(/(.+)\(([0-9]+)\)\(([0-9]+)\)/);
+			aXPath.endPath   = RegExp.$1;
+			aXPath.endOffset = RegExp.$2;
+			aXPath.endType   = RegExp.$3;
+			var startNode = null;
+			var endNode = null;
+			if(aXPath.con_url && this.Common.getURLStringFromDocument(doc) != aXPath.con_url){
+				var win = doc.defaultView;
+				doc = null;
+				if(win.frames != null){
+					var i;
+					for(var i=0;i<win.frames.length;i++){
+						if(this.Common.getURLStringFromDocument(win.frames[i].document) == aXPath.con_url){
+							doc = win.frames[i].document;
+							break;
+						}
+					}
+				}
+			}
+			if(!doc) return null;
+			startNode = this.XPath.getCurrentNodeFromXPath(doc,aXPath.startPath,aXPath.startOffset,aXPath.startType);
+			if(!startNode || !startNode.node) return null;
+			endNode = this.XPath.getCurrentNodeFromXPath(doc,aXPath.endPath,aXPath.endOffset,aXPath.endType);
+			if(!endNode || !endNode.node) return null;
+			var range = doc.createRange();
+			try{
+				range.setStart(startNode.node, startNode.offset);
+				range.setEnd(endNode.node, endNode.offset);
+			}catch(ex2){
+				this._dump("bitsHyperAnchorDummy.xPathMarker():"+aAttributes.id+"=["+range.toString()+"]::"+ex2);
+				return null;
+			}
+			rtnNode.push({id : aAttributes.id, text : range.toString()});
+			var aWindow = doc.defaultView;
+			var startC     = range.startContainer;
+			var endC       = range.endContainer;
+			var sOffset    = range.startOffset;
+			var eOffset    = range.endOffset;
+			var sameNode   = (startC == endC);
+			var sameOffset = (sOffset == eOffset);
+			if(sameNode && sameOffset){
+				var newNode = this._createSpanNode(aWindow,aAttributes,this.nodePositionInRange.SINGLE);
+				this._wrapTextNodeWithSpan(doc,startC,newNode);
+				return rtnNode;
+			}
+			var createNode = false;
+			function _acceptNode(aNode){
+				if(aNode.nodeType != aNode.TEXT_NODE && aNode.nodeType != aNode.ELEMENT_NODE) return NodeFilter.FILTER_REJECT;
+				return NodeFilter.FILTER_ACCEPT;
+			};
+			if(!sameNode || !this._isTextNode(startC)){
+				var endNode;
+				if(endC.nodeType == endC.ELEMENT_NODE && endC.childNodes.length > range.endOffset){
+					endNode = endC.childNodes[range.endOffset];
+				}else{
+					endNode = endC;
+				}
+				var nodeWalker = doc.createTreeWalker(range.commonAncestorContainer,NodeFilter.SHOW_ALL,_acceptNode,false);
+				nodeWalker.currentNode = startC; 
+				for(var txtNode=nodeWalker.nextNode();txtNode && txtNode != endNode;txtNode = nodeWalker.nextNode()){
+					if(txtNode.nodeType == txtNode.ELEMENT_NODE) continue;
+					var xContext = txtNode.nodeValue.replace(/[\r\n\t]+/mg,"");
+					if(xContext.length == 0) continue;
+					if(!createNode){
+						xContext = txtNode.nodeValue.replace(/[ ]+/mg,"");
+						if(xContext.length == 0) continue;
+					}
+					if(
+						txtNode.parentNode.nodeName == "SCRIPT" ||
+						txtNode.parentNode.nodeName == "TABLE" ||
+						txtNode.parentNode.nodeName == "THEAD" ||
+						txtNode.parentNode.nodeName == "TBODY" ||
+						txtNode.parentNode.nodeName == "TFOOT" ||
+						txtNode.parentNode.nodeName == "TR"
+					) continue;
+					if(endC.compareDocumentPosition(txtNode) == endC.DOCUMENT_POSITION_FOLLOWING) continue;
+					var newNode = this._createSpanNode(aWindow,aAttributes,this.nodePositionInRange.MIDDLE);
+					nodeWalker.currentNode = this._wrapTextNodeWithSpan(doc,txtNode,newNode);
+					createNode = true;
+				}
+			}
+			if(endC.parentNode.nodeName != "SCRIPT"){
+				if(this._isTextNode(endC)) endC.splitText(eOffset);
+				if(!sameNode && endC.nodeValue){
+					var xContext = endC.nodeValue.replace(/[\r\n\t ]+/mg,"");
+					if(xContext.length > 0){
+						var newNode = this._createSpanNode(aWindow,aAttributes,this.nodePositionInRange.END);
+						this._wrapTextNodeWithSpan(doc,endC,newNode);
+						createNode = true;
+					}
+				}
+			}
+			if(this._isTextNode(startC) && startC.parentNode.nodeName != "SCRIPT"){ 
+				var secondHalf = startC.splitText(sOffset);
+				var xContext = secondHalf.nodeValue.replace(/[\r\n\t ]+/mg,"");
+				if(xContext.length > 0){
+					if(sameNode){
+						var newNode = this._createSpanNode(aWindow,aAttributes,this.nodePositionInRange.SINGLE);
+						this._wrapTextNodeWithSpan(doc,secondHalf,newNode);
+						createNode = true;
+					}else{
+						var newNode = this._createSpanNode(aWindow,aAttributes,this.nodePositionInRange.START);
+						this._wrapTextNodeWithSpan(doc,secondHalf,newNode);
+						createNode = true;
+					}
+				}
+			} 
+			if(!createNode && sameNode) this._markerRange(range,aAttributes);
+			range.collapse(true);
+			if(aAttributes.id){
+				var xPathResult = this.XPath.evaluate('//*[@id="'+aAttributes.id+'"]', doc);
+				for(var k=0;k<xPathResult.snapshotLength;k++){
+					var node = xPathResult.snapshotItem(k);
+					if(xPathResult.snapshotLength>1){
+						if(k==0){
+							node.style.borderRight = "";
+						}else if(k==(xPathResult.snapshotLength-1)){
+							node.style.borderLeft = "";
+						}else{
+							node.style.borderLeft = "";
+							node.style.borderRight = "";
+						}
+					}
+				}
+			}
+			return rtnNode;
+		}catch(ex){
+			this._dump("bitsHyperAnchorDummy.xPathMarker():"+ex);
+			return null;
+		}
+	},
+
+
+/////////////////////////////////////////////////////////////////////
+	_isTextNode : function(aNode){ 
+		return aNode.nodeType == aNode.TEXT_NODE;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_createSpanNode : function(aWindow,aAttributes,aNodePosInRange){
+		var newNode = aWindow.document.createElement("span");
+		for(var attr in aAttributes){
+			newNode.setAttribute(attr,aAttributes[attr]);
+		}
+		return newNode;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_wrapTextNodeWithSpan : function(aDoc,aTextNode,aSpanNode){
+		var clonedTextNode = aTextNode.cloneNode(false);
+		var nodeParent     = aTextNode.parentNode;
+		aSpanNode.appendChild(clonedTextNode);
+		nodeParent.replaceChild(aSpanNode,aTextNode);
+		return clonedTextNode;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_markerRange : function (range,aAttributes){
+		try{
+			var startContainer = range.startContainer;
+			var ownerDoc = startContainer.ownerDocument;
+			var spanNode = ownerDoc.createElement("span");
+			var attr;
+			for(attr in aAttributes){
+				spanNode.setAttribute(attr,aAttributes[attr]);
+			}
+			var docfrag = range.extractContents();
+			spanNode.appendChild(docfrag);
+			range.insertNode(spanNode);
+			return spanNode;
+		}catch(ex){
+			this._dump("bitsHyperAnchorDummy._markerRange():"+ex);
+			return null;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	mouseout : function(aEvent){
+		bitsHyperAnchorDummy._mouseout(aEvent);
+	},
+
+	_mouseout : function(aEvent){
+		if(this._iconopentimer) clearTimeout(this._iconopentimer);
+		this._iconopentimer = null;
+		var node = aEvent.currentTarget;
+		if(this._iconclosetimer) clearTimeout(this._iconclosetimer);
+		this._iconclosetimer = setTimeout(function(){bitsHyperAnchorDummy._hideLinkIcon(node);},500);
+	},
+
+	mouseover : function(aEvent){
+		bitsHyperAnchorDummy._mouseover(aEvent);
+	},
+
+	_mouseover : function(aEvent){
+		if(aEvent.currentTarget.nodeName != "A") return;
+		var node = aEvent.currentTarget;
+		if(this._iconopentimer) clearTimeout(this._iconopentimer);
+		this._iconopentimer = setTimeout(function(){bitsHyperAnchorDummy._showLinkIcon(node);},500);
+	},
+
+	mouseoverLinkIcon : function(aEvent){
+		bitsHyperAnchorDummy._mouseoverLinkIcon(aEvent);
+	},
+
+	_mouseoverLinkIcon : function(aEvent){
+		if(this._iconopentimer) clearTimeout(this._iconopentimer);
+		this._iconopentimer = null;
+		if(this._iconclosetimer) clearTimeout(this._iconclosetimer);
+		this._iconclosetimer = null;
+	},
+
+	_hideLinkIcon : function(aNode){
+		if(this._iconclosetimer) clearTimeout(this._iconclosetimer);
+		var sURL = this._getURLStringFromDocument(aNode.ownerDocument);
+		if(this._iconnode[sURL]){
+			this._iconnode[sURL].style.display = 'none';
+			if(this._iconnode[sURL].parentNode) this._iconnode[sURL].parentNode.removeChild(this._iconnode[sURL]);
+		}
+	},
+
+	_isShowLinkIcon : function(aNode){
+		try{
+			var href = decodeURIComponent(aNode.href);
+			var hrefReg = new RegExp("#"+this._anchor_title+"([0-9\.]*):(.+)$");
+			if(href && href.match(hrefReg)){
+				return true;
+			}else{
+				return false;
+			}
+			return true;
+		}catch(e){
+			return false;
+		}
+	},
+	
+	_showLinkIcon : function(aNode){
+		if(this._iconopentimer) clearTimeout(this._iconopentimer);
+		if(!this._isShowLinkIcon(aNode)) return;
+		var doc = aNode.ownerDocument;
+		var sURL = this._getURLStringFromDocument(doc);
+		if(sURL == "") return;
+		var hyperanchor_icon = nsPreferences.copyUnicharPref("wiredmarker.hyperanchor.icon_display","icon_display_left_popup");
+		if(!hyperanchor_icon || hyperanchor_icon == "icon_none") return;
+		if(hyperanchor_icon == "icon_display_right_popup"){
+			var span =doc.createElement("span");
+			if(aNode.nextSibling){
+				aNode.parentNode.insertBefore(span,aNode.nextSibling);
+			}else{
+				aNode.parentNode.appendChild(span);
+			}
+			var offset = this._getPageOffset(span);
+			aNode.parentNode.removeChild(span);
+			aNode.parentNode.normalize();
+			if(this._iconnode[sURL] && offset.top>0 && offset.left>0){
+				if(!this._iconnode[sURL].parentNode) aNode.ownerDocument.body.appendChild(this._iconnode[sURL]);
+				this._iconnode[sURL].style.top = (offset.top>10?offset.top-10:0) + 'px';
+				this._iconnode[sURL].style.left = (offset.left+4) + 'px';
+				this._iconnode[sURL].style.display = '';
+				this._iconnode[sURL].setAttribute("href",aNode.href);
+			}
+		}else if(hyperanchor_icon == "icon_display_left_popup"){
+			var offset = this._getPageOffset(aNode);
+			if(this._iconnode[sURL] && offset.top>0 && offset.left>0){
+				if(!this._iconnode[sURL].parentNode) aNode.ownerDocument.body.appendChild(this._iconnode[sURL]);
+				this._iconnode[sURL].style.top = (offset.top>0?offset.top:0) + 'px';
+				this._iconnode[sURL].style.left = (offset.left-20>0?offset.left-20:0) + 'px';
+				this._iconnode[sURL].style.display = '';
+				this._iconnode[sURL].setAttribute("href",aNode.href);
+			}
+		}
+	},
+
+	clickLinkIcon : function(aEvent){
+		bitsHyperAnchorDummy._clickLinkIcon(aEvent);
+	},
+
+	_clickLinkIcon : function(aEvent){
+		var node = aEvent.currentTarget;
+		var href = node.getAttribute("href");
+		var sw = screen.availWidth  -  screen.availLeft;
+		var sh = screen.availHeight -  screen.availTop;
+		var screenX = aEvent.screenX;
+		var screenY = aEvent.screenY;
+		if(screenX+this._wndowLinkIconW>sw) screenX = sw-this._wndowLinkIconW;
+		if(screenY+this._wndowLinkIconH>sh) screenY = sh-this._wndowLinkIconH;
+		if(this._wndowLinkIcon && !this._wndowLinkIcon.closed){
+			try{this._wndowLinkIcon.removeEventListener("pageshow",  bitsHyperAnchorDummy.load, false);}catch(ex){}
+			this._wndowLinkIcon.close();
+		}
+		this._wndowLinkIcon = window.open(href, "_wndowLinkIcon" , "chrome,resizable=yes,scrollbars=yes,outerHeight="+this._wndowLinkIconH+",outerWidth="+this._wndowLinkIconW+",screenX="+screenX+",screenY="+screenY);
+		this._wndowLinkIcon.addEventListener("pageshow",  bitsHyperAnchorDummy.load, false);
+		bitsHyperAnchorDummy._mouseout(aEvent);
+	},
+
+	_getPageOffset : function(elem){
+		if(!elem) return 0;
+		var top = elem.offsetTop;
+		var left = elem.offsetLeft;
+		while(elem.offsetParent != null){
+			if(elem.parentNode.offsetHeight != elem.parentNode.scrollHeight){
+				elem.parentNode.scrollTop = elem.offsetTop - elem.parentNode.offsetTop;
+				elem = elem.parentNode;
+				top = elem.offsetTop;
+				left = elem.offsetLeft;
+			}
+			elem = elem.offsetParent;
+			top += elem.offsetTop;
+			left += elem.offsetLeft;
+		}
+		return {top:top,left:left};
+	},
+
+	_getURLStringFromDocument : function(aDocument){
+		if(!aDocument || !aDocument.location) return "";
+		var location = aDocument.location;
+		try{
+			return location.protocol + "//" + location.host +location.pathname + location.search;
+		}catch(ex){
+			return location.href;
+		}
+	},
+
+	trim : function(argValue){
+		return argValue.replace(/^[ ã]*/gim, "").replace(/[ ã]*$/gim, "");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	Common : {
+
+		get RDF()     { return Components.classes['@mozilla.org/rdf/rdf-service;1'].getService(Components.interfaces.nsIRDFService); },
+		get RDFC()    { return Components.classes['@mozilla.org/rdf/container;1'].getService(Components.interfaces.nsIRDFContainer); },
+		get RDFCU()   { return Components.classes['@mozilla.org/rdf/container-utils;1'].getService(Components.interfaces.nsIRDFContainerUtils); },
+		get DIR()     { return Components.classes['@mozilla.org/file/directory_service;1'].getService(Components.interfaces.nsIProperties); },
+		get IO()      { return Components.classes['@mozilla.org/network/io-service;1'].getService(Components.interfaces.nsIIOService); },
+		get UNICODE(){ return Components.classes['@mozilla.org/intl/scriptableunicodeconverter'].getService(Components.interfaces.nsIScriptableUnicodeConverter); },
+		get WINDOW()  { return Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(Components.interfaces.nsIWindowMediator); },
+		get PROMPT()  { return Components.classes['@mozilla.org/embedcomp/prompt-service;1'].getService(Components.interfaces.nsIPromptService); },
+		get PREF()    { return Components.classes['@mozilla.org/preferences;1'].getService(Components.interfaces.nsIPrefBranch); },
+		get JSSSL()   { return Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader); },
+		get ENV()     { return Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment); },
+		get FAVICON(){ return Components.classes["@mozilla.org/browser/favicon-service;1"].getService(Components.interfaces.nsIFaviconService); },
+		get MIME()    { return Components.classes["@mozilla.org/mime;1"].getService(Components.interfaces.nsIMIMEService); },
+
+/////////////////////////////////////////////////////////////////////
+		getTimeStamp : function(advance){
+			var dd = new Date;
+			if(advance) dd.setTime(dd.getTime() + 100000 * advance);
+			var y = dd.getFullYear();
+			var m = dd.getMonth() + 1; if(m < 10) m = "0" + m;
+			var d = dd.getDate();      if(d < 10) d = "0" + d;
+			var h = dd.getHours();     if(h < 10) h = "0" + h;
+			var i = dd.getMinutes();   if(i < 10) i = "0" + i;
+			var s = dd.getSeconds();   if(s < 10) s = "0" + s;
+			return y.toString() + m.toString() + d.toString() + h.toString() + i.toString() + s.toString();
+		},
+
+/////////////////////////////////////////////////////////////////////
+		convertURLToObject : function(aURLString){
+			var aURL = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURI);
+			aURL.spec = aURLString;
+			return aURL;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		convertFormUnicode : function(aString, aCharset){
+			if(!aString) return "";
+			try{
+				this.UNICODE.charset = aCharset;
+				aString = this.UNICODE.ConvertFromUnicode(aString);
+			}catch(ex){}
+			return aString;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getURLStringFromDocument : function(aDocument){
+			if(!aDocument) return "";
+			var location = aDocument.location;
+			try{
+				return location.protocol + "//" + location.host +location.pathname + location.search;
+			}catch(ex){
+				return location.href;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getChromeImageURI : function(aURI){
+			try{
+				const IOService = Components.classes['@mozilla.org/network/io-service;1'].getService(Components.interfaces.nsIIOService);
+				var channel = IOService.newChannelFromURI(aURI);
+				var stream  = channel.open();
+				var bstream = Components.classes['@mozilla.org/binaryinputstream;1'].createInstance(Components.interfaces.nsIBinaryInputStream);
+				bstream.setInputStream(stream);
+				var len = stream.available();
+				var bytes = bstream.readByteArray(len);
+				bstream.close();
+				stream.close();
+				var mime = this.MIME.getTypeFromURI(aURI);
+				var images = String.fromCharCode.apply(String, bytes);
+				var image_b64 = btoa(images);
+				var dataUri = 'data:' + mime +';base64,' + image_b64;
+				return dataUri;
+			}catch(e){
+				bitsObjectMng._dump("bitsHyperAnchorDummy.Common.getChromeImageURI():"+e);
+			}
+		  return null;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getFocusedWindow : function(){
+			var win = document.commandDispatcher.focusedWindow;
+			if(!win || win == window || win instanceof Components.interfaces.nsIDOMChromeWindow) win = window._content;
+			return win;
+		},
+	},
+
+/////////////////////////////////////////////////////////////////////
+	XPath : {
+		xpe : new XPathEvaluator(),
+
+		_acceptNode : function(aNode){
+			if(aNode.nodeType == aNode.TEXT_NODE && (/^[\t\n\r ]+$/.test(aNode.nodeValue))) return NodeFilter.FILTER_REJECT;
+			return NodeFilter.FILTER_ACCEPT;
+		},
+		
+/////////////////////////////////////////////////////////////////////
+		getOffsetFromParentNode : function(aNode,aOffset){
+			var xPathNode = aNode;
+			var xPathText = "";
+			var tmpOffset = aOffset;
+			var filter = null;
+			if(bitsHyperAnchorDummy._hyperanchor_version != '') filter = this._acceptNode;
+			if(this._isTextNode(xPathNode)) xPathNode = xPathNode.parentNode;
+			while(xPathNode && xPathNode.id && xPathNode.id.indexOf("bits_") == 0) xPathNode = xPathNode.parentNode;
+			while(xPathNode){
+				xPathText = this.createXPath(xPathNode);
+				if(xPathText.indexOf("bits_") < 0) break;
+				xPathNode = xPathNode.parentNode;
+			}
+			while(xPathText.match(/^(.*)?\/([A-Z]+)\[(\d+)\]$/)){
+				var rpath = RegExp.$1;
+				var rnode = RegExp.$2;
+				var rcnt = RegExp.$3;
+				for(;rcnt>0;rcnt--){
+					var rnode_xpath = this.evaluate(rpath+'/'+rnode+'['+rcnt+']',xPathNode.ownerDocument);
+					if(rnode_xpath){
+						for(r2cnt=0;r2cnt<rnode_xpath.snapshotLength;r2cnt++){
+							var r2node = rnode_xpath.snapshotItem(r2cnt);
+							if(r2node && r2node.id && r2node.id.indexOf("bits_") == 0){
+								xPathNode = r2node.parentNode;
+								rpath = this.createXPath(xPathNode);
+								rcnt = 0;
+								break;
+							}
+						}
+					}
+				}
+				xPathText = rpath;
+			}
+			if(xPathNode){
+				xPathText = this.createXPath(xPathNode);
+				if(this._isTextNode(aNode)){
+					var nodeWalker = xPathNode.ownerDocument.createTreeWalker(xPathNode,NodeFilter.SHOW_ALL,filter,false);
+					var txtNode=nodeWalker.nextNode();
+					if(bitsHyperAnchorDummy._hyperanchor_version == null && txtNode.nodeValue == null && aNode.nodeValue.match(/^[\t\n\r ]+$/)){
+							tmpOffset = 0;
+					}else{
+						if(txtNode){
+							var nodeCnt = 0;
+							var brFlag = false;
+							var textareaFlag = false;
+							for(;txtNode && txtNode != aNode; txtNode = nodeWalker.nextNode()){
+								if(txtNode.nodeType == txtNode.ELEMENT_NODE){
+									if(txtNode.nodeName == "BR"){
+										brFlag = true;
+									}else if(brFlag){
+										brFlag = false;
+									}
+									if(txtNode.nodeName == "TEXTAREA"){
+										textareaFlag = true;
+									}else if(textareaFlag){
+										textareaFlag = false;
+									}
+									continue;
+								}
+								if(txtNode.nodeType != txtNode.TEXT_NODE) continue;
+								if(textareaFlag){
+									textareaFlag = false;
+									continue;
+								}
+								var nodeValue;
+								if(bitsHyperAnchorDummy._hyperanchor_version == null){
+										var ignorFlag = (nodeCnt==0 || brFlag) ? true : false;
+										nodeValue = this.trimWhiteSpaceNodeIE(txtNode.nodeValue,ignorFlag);
+								}else{
+								 if(bitsHyperAnchorDummy._hyperanchor_version == ''){
+									nodeValue = txtNode.nodeValue;
+									}else{
+										if(parseFloat(bitsHyperAnchorDummy._hyperanchor_version)>=1.1){
+											var ignorFlag = (nodeCnt==0 || brFlag) ? true : false;
+											nodeValue = this.trimWhiteSpaceNodeIE(txtNode.nodeValue,ignorFlag);
+										}else{
+											nodeValue = this.trimWhiteSpaceNodeV1_0(txtNode.nodeValue);
+										}
+									}
+								}
+								tmpOffset += nodeValue.length;
+								nodeCnt++;
+								if(brFlag) brFlag = false;
+							}
+							if(txtNode == aNode && aOffset > 0){
+								var xContext = "";
+								var range = xPathNode.ownerDocument.createRange();
+								try{
+									range.setStart(txtNode, 0);
+									range.setEnd(txtNode, aOffset);
+								}catch(ex2){
+									range = null;
+								}
+								if(range) xContext = range.toString();
+								if(bitsHyperAnchorDummy._hyperanchor_version == null){
+									var ignorFlag = (nodeCnt==0 || brFlag) ? true : false;
+									xContext = this.trimWhiteSpaceNodeIE(xContext,ignorFlag);
+								}else{
+									if(bitsHyperAnchorDummy._hyperanchor_version == ''){
+									}else{
+										if(parseFloat(bitsHyperAnchorDummy._hyperanchor_version)>=1.1){
+											var ignorFlag = (nodeCnt==0 || brFlag) ? true : false;
+											xContext = this.trimWhiteSpaceNodeIE(xContext,ignorFlag);
+										}else{
+											xContext = this.trimWhiteSpaceNodeV1_0(xContext);
+										}
+									}
+								}
+								if(aOffset>xContext.length) tmpOffset -= (aOffset-xContext.length);
+							}
+							if(tmpOffset<0) tmpOffset = 0;
+						}else{
+							tmpOffset = 0;
+						}
+					}
+					
+				}else{
+					var nodeWalker = xPathNode.ownerDocument.createTreeWalker(aNode,NodeFilter.SHOW_TEXT,null,false);
+					var aTxtNode=nodeWalker.nextNode();
+					if(aTxtNode){
+						var nodeWalker = xPathNode.ownerDocument.createTreeWalker(xPathNode,NodeFilter.SHOW_TEXT,filter,false);
+						var txtNode=nodeWalker.nextNode();
+						var nodeValue;
+						if(txtNode){
+							for(;txtNode && txtNode != aTxtNode;txtNode = nodeWalker.nextNode()){
+								if(bitsHyperAnchorDummy._hyperanchor_version == null){
+									var ignorFlag = (nodeCnt==0 || brFlag) ? true : false;
+									nodeValue = this.trimWhiteSpaceNodeIE(txtNode.nodeValue,ignorFlag);
+								}else{
+									if(bitsHyperAnchorDummy._hyperanchor_version == ''){
+										nodeValue = txtNode.nodeValue;
+									}else{
+										if(parseFloat(bitsHyperAnchorDummy._hyperanchor_version)>=1.1){
+											var ignorFlag = (nodeCnt==0 || brFlag) ? true : false;
+											nodeValue = this.trimWhiteSpaceNodeIE(txtNode.nodeValue,ignorFlag);
+										}else{
+											nodeValue = this.trimWhiteSpaceNodeV1_0(txtNode.nodeValue);
+										}
+									}
+								}
+								tmpOffset += nodeValue.length;
+							}
+							if(txtNode == aNode){
+								var xContext;
+								if(bitsHyperAnchorDummy._hyperanchor_version == null){
+									var ignorFlag = (nodeCnt==0 || brFlag) ? true : false;
+									xContext = this.trimWhiteSpaceNodeIE(txtNode.nodeValue,ignorFlag);
+								}else{
+									if(bitsHyperAnchorDummy._hyperanchor_version == ''){
+										xContext = txtNode.nodeValue;
+									}else{
+										if(parseFloat(bitsHyperAnchorDummy._hyperanchor_version)>=1.1){
+											var ignorFlag = (nodeCnt==0 || brFlag) ? true : false;
+											xContext = this.trimWhiteSpaceNodeIE(txtNode.nodeValue,ignorFlag);
+										}else{
+											xContext = this.trimWhiteSpaceNodeV1_0(txtNode.nodeValue);
+										}
+									}
+								}
+								if(nodeValue.length>xContext.length) tmpOffset -= (nodeValue.length-xContext.length);
+							}
+							if(tmpOffset<0) tmpOffset = 0;
+						}else{
+							tmpOffset = 0;
+						}
+					}
+				}
+			}
+			return {
+				node   : xPathNode,
+				xpath  : xPathText,
+				offset : tmpOffset,
+				type   : aNode.nodeType,
+			};
+		},
+		
+/////////////////////////////////////////////////////////////////////
+		getCurrentNodeFromXPath : function(aDoc,aXPath,aOffset,aType){
+			try{
+				var rtnNode = null;
+				var tmpOffset = aOffset;
+				var realOffset = -1;
+				var filter = null;
+				if(bitsHyperAnchorDummy._hyperanchor_version != '') filter = this._acceptNode;
+				try{var evaluateNode = this.evaluate(aXPath,aDoc).snapshotItem(0);}catch(ex2){}
+				if(evaluateNode && aType == 3){
+					var nodeWalker = aDoc.createTreeWalker(evaluateNode,NodeFilter.SHOW_ALL,filter,false);
+					var txtNode=nodeWalker.nextNode();
+					if(txtNode){
+						var nodeCnt=0;
+						var brFlag = false;
+						var textareaFlag = false;
+						var lstNode = null;
+						for(;txtNode;txtNode = nodeWalker.nextNode()){
+							if(txtNode.nodeType == txtNode.ELEMENT_NODE){
+								if(txtNode.nodeName == "BR"){
+									brFlag = true;
+								}else if(brFlag){
+									brFlag = false;
+								}
+								if(txtNode.nodeName == "TEXTAREA"){
+									textareaFlag = true;
+								}else if(textareaFlag){
+									textareaFlag = false;
+								}
+								continue;
+							}
+							if(txtNode.nodeType != txtNode.TEXT_NODE) continue;
+							if(textareaFlag){
+								textareaFlag = false;
+								continue;
+							}
+							var nodeValue;
+							if(bitsHyperAnchorDummy._hyperanchor_version == ''){
+								nodeValue = txtNode.nodeValue;
+							}else{
+								if(parseFloat(bitsHyperAnchorDummy._hyperanchor_version)>=1.1){
+									var ignorFlag = (nodeCnt==0 || brFlag) ? true : false;
+									nodeValue = this.trimWhiteSpaceNodeIE(txtNode.nodeValue,ignorFlag);
+								}else{
+									nodeValue = this.trimWhiteSpaceNodeV1_0(txtNode.nodeValue);
+								}
+							}
+							
+							if(tmpOffset - nodeValue.length<0 || (tmpOffset>0 && (tmpOffset - nodeValue.length)==0)){
+								rtnNode = txtNode;
+								break;
+							}
+							tmpOffset -= nodeValue.length;
+							lstNode = txtNode;
+							nodeWalker.currentNode = txtNode;
+							nodeCnt++;
+							if(brFlag) brFlag = false;
+						}
+						
+						if(rtnNode == null){
+							rtnNode = lstNode;
+						}else{
+							if(bitsHyperAnchorDummy._hyperanchor_version == ''){
+								realOffset = tmpOffset;
+							}else{
+								if(parseFloat(bitsHyperAnchorDummy._hyperanchor_version)>=1.1){
+									var ignorFlag = (nodeCnt==0 || brFlag) ? true : false;
+									realOffset = this.calcRealOffsetIE(rtnNode.nodeValue,tmpOffset,ignorFlag);
+								}else{
+									realOffset = this.calcRealOffsetV1_0(rtnNode.nodeValue,tmpOffset);
+								}
+							}
+						}
+						
+					}else{
+						rtnNode = evaluateNode;
+					}
+				}else{
+					rtnNode = evaluateNode;
+				}
+				return { node: rtnNode, offset : realOffset};
+			}catch(ex){
+				bitsObjectMng._dump("getCurrentNodeFromXPath():"+ex);
+				return undefined;
+			}
+		},
+		
+/////////////////////////////////////////////////////////////////////
+		trimWhiteSpaceNodeIE : function(nodeValue,flag){
+			if(flag){
+				nodeValue = nodeValue.replace(/^[\n\r\t ]+/mg,"").replace(/[\n\r\t ]+/mg," ");
+			}else{
+				nodeValue = nodeValue.replace(/[\n\r\t ]+/mg," ");
+			}
+			return nodeValue;
+		},
+		
+/////////////////////////////////////////////////////////////////////
+		calcRealOffsetIE : function(nodeValue,aOffset,flag){
+			var realOffset = 0;
+			if(flag && nodeValue.match(/^([\n\r\t ]+)/)){
+				var spText = RegExp.$1;
+				nodeValue = RegExp.rightContext;
+				realOffset += spText.length;
+			}
+			var i= 0;
+			while(i < aOffset && nodeValue.length > 0){
+				if(nodeValue.match(/^([\n\r\t ]+)/)){
+					var spText = RegExp.$1;
+					nodeValue = RegExp.rightContext;
+					realOffset += spText.length;
+					i += 1;
+				}else if(nodeValue.match(/^([^ \t\n\r])/)){
+					nodeValue = RegExp.rightContext;
+					realOffset += 1;
+					i += 1;
+				}
+			}
+			return realOffset;
+		},
+		
+/////////////////////////////////////////////////////////////////////
+		trimWhiteSpaceNodeV1_0 : function(nodeValue){
+			return nodeValue.replace(/^[\n\r\t ]+/mg,"").replace(/[\n\r\t ]+/mg," ");
+		},
+		
+/////////////////////////////////////////////////////////////////////
+		calcRealOffsetV1_0 : function(nodeValue,aOffset){
+			var realOffset = 0;
+			if(nodeValue.match(/^([\n\r\t ]+)/)){
+				var spText = RegExp.$1;
+				nodeValue = RegExp.rightContext;
+				realOffset += spText.length;
+			}
+			var i= 0;
+			while(i < aOffset && nodeValue.length > 0){
+				if(nodeValue.match(/^([\n\r\t ]+)/)){
+					var spText = RegExp.$1;
+					nodeValue = RegExp.rightContext;
+					realOffset += spText.length;
+					i += 1;
+				}else if(nodeValue.match(/^([^ \t\n\r])/)){
+					nodeValue = RegExp.rightContext;
+					realOffset += 1;
+					i += 1;
+				}
+			}
+			return realOffset;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		_isTextNode : function(aNode){ 
+			return aNode.nodeType == aNode.TEXT_NODE;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getDocument : function(aNode){
+			return (aNode.ownerDocument == null ? aNode : aNode.ownerDocument);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getDocumentElement : function(aNode){
+			return (aNode.ownerDocument == null ? aNode.documentElement : aNode.ownerDocument.documentElement);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		evaluate : function(aExpr, aNode){
+			return this.getDocument(aNode).evaluate(aExpr, aNode, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		isPMC : function(aNode){
+			if(!aNode || !aNode.ownerDocument) return false;
+			if(aNode.ownerDocument.URL.match(/^http:\/\/www\.pubmedcentral\.nih\.gov\//)) return true;
+			if(aNode.ownerDocument.URL.match(/^http:\/\/www\.ncbi\.nlm\.nih\.gov\/pmc\//)) return true;
+			return false;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		isUseNodeId : function(aNode){
+			if(!aNode.id || aNode.id.match(/^bits_/)) return false;
+			var id_check = this.isPMC(aNode);
+			if(id_check && aNode.id.match(/^[A-Za-z_]+\d+[a-z]*$/)) return false;
+			var id_nodes = this.evaluate('//*[@id="'+aNode.id+'"]', aNode);
+			if(id_nodes.snapshotLength>1) return false;
+			return true;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		createXPath : function(aNode){
+			var nodeName = aNode.localName.toLowerCase();
+			if(this.isUseNodeId(aNode)) return '//'+nodeName+'[@id="'+aNode.id+'"]';
+			var path = [];
+			var node = aNode;
+			var i;
+			var j;
+			var tarNode;
+			var tarNodeName;
+			var ancestorNodes = []
+			var nodes = this.evaluate('ancestor-or-self::*', node);
+			var len = nodes.snapshotLength;
+			for(i=0;i<len;i++){ ancestorNodes.push(nodes.snapshotItem(i)); }
+			for(i=ancestorNodes.length-1;i>=0;i--){
+				tarNode = ancestorNodes[i];
+				if(tarNode.id && this.isUseNodeId(tarNode)) break;
+				nodes = this.evaluate('preceding-sibling::*[@id]', tarNode);
+				tarNode = null;
+				len = nodes.snapshotLength;
+				for(j=len-1;j>=0;j--){
+					tarNode = nodes.snapshotItem(j);
+					if(this.isUseNodeId(tarNode)) break;
+					tarNode = null;
+				}
+				if(tarNode) break;
+			}
+			if(tarNode){
+				tarNodeName = '//'+tarNode.localName.toLowerCase()+'[@id="'+tarNode.id+'"]';
+			}else{
+				tarNode = this.getDocumentElement(node);
+				tarNodeName = '/'+tarNode.localName.toLowerCase()+'[1]';
+			}
+			while(tarNode.parentNode != node.parentNode){
+				nodes = this.evaluate('preceding-sibling::'+nodeName, node);
+				path.unshift(nodeName+'['+(nodes.snapshotLength+1)+']');
+				node = node.parentNode;
+				nodeName = node.localName.toLowerCase();
+			}
+			if(tarNode != node){
+				var axis = 'following-sibling::';
+				nodes = this.evaluate(axis+nodeName, tarNode);
+				len = nodes.snapshotLength;
+				for(i=0;i<len&&nodes.snapshotItem(i)!=node;i++){}
+				path.unshift(axis+nodeName+'['+(i+1)+']');
+			}
+			path.unshift(tarNodeName);
+			return path.join('/');
+		},
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+
+	},
+	
+/////////////////////////////////////////////////////////////////////
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/hyperanchorDialogOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/hyperanchorDialogOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/hyperanchorDialogOverlay.xul	(revision 5703)
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+	id="hyperanchorDialogOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _hyperanchorInit(aEvent){
+			var hyperanchor = nsPreferences.copyUnicharPref("wiredmarker.hyperanchor.icon_display");
+			switch(hyperanchor){
+				case "icon_display_left":
+					document.getElementById("mcHyperAnchorIconLeftRadio").setAttribute("selected","true");
+					document.getElementById("mcHyperAnchorIconRightRadio").removeAttribute("selected");
+					document.getElementById("mcHyperAnchorIconLeftPopupRadio").removeAttribute("selected");
+					document.getElementById("mcHyperAnchorIconRightPopupRadio").removeAttribute("selected");
+					document.getElementById("mcHyperAnchorIconNoneRadio").removeAttribute("selected");
+					break;
+				case "icon_display_right":
+					document.getElementById("mcHyperAnchorIconLeftRadio").removeAttribute("selected");
+					document.getElementById("mcHyperAnchorIconRightRadio").setAttribute("selected","true");
+					document.getElementById("mcHyperAnchorIconLeftPopupRadio").removeAttribute("selected");
+					document.getElementById("mcHyperAnchorIconRightPopupRadio").removeAttribute("selected");
+					document.getElementById("mcHyperAnchorIconNoneRadio").removeAttribute("selected");
+					break;
+				case "icon_display_left_popup":
+					document.getElementById("mcHyperAnchorIconLeftRadio").removeAttribute("selected");
+					document.getElementById("mcHyperAnchorIconRightRadio").removeAttribute("selected");
+					document.getElementById("mcHyperAnchorIconLeftPopupRadio").setAttribute("selected","true");
+					document.getElementById("mcHyperAnchorIconRightPopupRadio").removeAttribute("selected");
+					document.getElementById("mcHyperAnchorIconNoneRadio").removeAttribute("selected");
+					break;
+				case "icon_display_right_popup":
+					document.getElementById("mcHyperAnchorIconLeftRadio").removeAttribute("selected");
+					document.getElementById("mcHyperAnchorIconRightRadio").removeAttribute("selected");
+					document.getElementById("mcHyperAnchorIconLeftPopupRadio").removeAttribute("selected");
+					document.getElementById("mcHyperAnchorIconRightPopupRadio").setAttribute("selected","true");
+					document.getElementById("mcHyperAnchorIconNoneRadio").removeAttribute("selected");
+					break;
+				case "icon_none":
+					document.getElementById("mcHyperAnchorIconLeftRadio").removeAttribute("selected");
+					document.getElementById("mcHyperAnchorIconRightRadio").removeAttribute("selected");
+					document.getElementById("mcHyperAnchorIconLeftPopupRadio").removeAttribute("selected");
+					document.getElementById("mcHyperAnchorIconRightPopupRadio").removeAttribute("selected");
+					document.getElementById("mcHyperAnchorIconNoneRadio").setAttribute("selected","true");
+					break;
+				default:
+					document.getElementById("mcHyperAnchorIconLeftRadio").removeAttribute("selected");
+					document.getElementById("mcHyperAnchorIconRightRadio").removeAttribute("selected");
+					document.getElementById("mcHyperAnchorIconLeftPopupRadio").setAttribute("selected","true");
+					document.getElementById("mcHyperAnchorIconRightPopupRadio").removeAttribute("selected");
+					document.getElementById("mcHyperAnchorIconNoneRadio").removeAttribute("selected");
+					nsPreferences.setUnicharPref("wiredmarker.hyperanchor.icon_display", "icon_display_left_popup");
+					break;
+			}
+
+			var alignment = nsPreferences.getIntPref("wiredmarker.hyperanchor.alignment");
+			document.getElementById("mcHyperAnchorAlignmentTextbox").value = alignment;
+		}
+
+		function _hyperanchorCommand(aEvent){
+			nsPreferences.setUnicharPref("wiredmarker.hyperanchor.icon_display", aEvent.target.value);
+		}
+
+		function _hyperanchorChange(aEvent){
+			nsPreferences.setIntPref("wiredmarker.hyperanchor.alignment", aEvent.target.value);
+		}
+
+		window.addEventListener("load", _hyperanchorInit, false);
+	]]>
+	</script>
+	<tabbox id="mcSettingTabbox">
+		<tabs id="mcSettingTabs">
+			<tab id="mcHyperAnchorTab" label=" HYPER-ANCHOR" image="chrome://markingcollection/skin/hyperanchor.png"/>
+		</tabs>
+		<tabpanels id="mcSettingTabPanels">
+			<tabpanel id="mcHyperAnchorTabPanel" orient="vertical" flex="1">
+				<groupbox>
+					<caption label="&markingcollection.hyperanchor.alignment_caption;" style="background-color:#fff;"/>
+					<hbox align="center">
+						<label value="&markingcollection.hyperanchor.alignment_length;:"/>
+						<textbox id="mcHyperAnchorAlignmentTextbox" max="100" maxlength="3" min="0" size="1" type="number" wraparound="false" onchange="_hyperanchorChange(event);"/>
+					</hbox>
+					<description style="-moz-appearance: none;color:#ff0000;">&markingcollection.hyperanchor.alignment_attention;</description>
+				</groupbox>
+				<groupbox>
+					<caption label="&markingcollection.hyperanchor.icon_caption;" style="background-color:#fff;"/>
+					<radiogroup  id="mcHyperAnchorRadiogroup" oncommand="_hyperanchorCommand(event);">
+						<radio id="mcHyperAnchorIconLeftRadio" label="&markingcollection.hyperanchor.icon_display_left;" value="icon_display_left"/>
+						<radio id="mcHyperAnchorIconRightRadio" label="&markingcollection.hyperanchor.icon_display_right;" value="icon_display_right"/>
+						<radio id="mcHyperAnchorIconLeftPopupRadio" label="&markingcollection.hyperanchor.icon_display_left_popup;" value="icon_display_left_popup"/>
+						<radio id="mcHyperAnchorIconRightPopupRadio" label="&markingcollection.hyperanchor.icon_display_right_popup;" value="icon_display_right_popup"/>
+						<radio id="mcHyperAnchorIconNoneRadio" label="&markingcollection.hyperanchor.icon_none;" value="icon_none"/>
+					</radiogroup>
+				</groupbox>
+				<description style="-moz-appearance: none;color:#ff0000;">&markingcollection.hyperanchor.icon_attention;</description>
+			</tabpanel>
+		</tabpanels>
+	</tabbox>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/hyperanchorSidebarOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/hyperanchorSidebarOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/hyperanchorSidebarOverlay.xul	(revision 5703)
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/autocache.css" type="text/css"?>
+<!DOCTYPE overlay [
+<!ENTITY % markingcollectionDTD SYSTEM "chrome://markingcollection/locale/markingcollection.dtd" >
+%markingcollectionDTD;
+<!ENTITY % metaDTD SYSTEM "chrome://markingcollection/locale/meta.dtd" >
+%metaDTD;
+]>
+<overlay
+	id="autocacheSidebarOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript">
+	<![CDATA[
+	]]>
+	</script>
+	<popupset id="mcPopupSet">
+		<menupopup id="mcPopup">
+			<menuitem
+				id="mcPopupHyperAnchorCopyFormatSetting"
+				label="&meta.menuitem.hyperanchor.copyformatsetting;..."
+				class="menuitem-iconic"
+				image="chrome://markingcollection/skin/marker_copy.png"
+				oncommand="mcController.copy('setting');"
+				insertafter="mcPopupOpenSeparator" />
+			<menuitem
+				id="mcPopupHyperAnchorCopyFormatToClipboard"
+				label="&meta.menuitem.hyperanchor.copyformat_to_clipboard;"
+				class="menuitem-iconic"
+				image="chrome://markingcollection/skin/marker_copy.png"
+				oncommand="mcController.copy('format');"
+				insertafter="mcPopupOpenSeparator" />
+			<menu
+				id="mcPopupHyperAnchorCopyToClipboard"
+				label="&markingcollection.hyperanchor.sidebar_copy_to_clipboard;"
+				class="menu-iconic"
+				image="chrome://markingcollection/skin/marker_copy.png"
+				insertafter="mcPopupOpenSeparator">
+				<menupopup>
+					<menuitem
+						label="&meta.menuitem.hyperanchor.copy_to_clipboard;"
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/marker_copy.png"
+						oncommand="mcController.copy('copy');"/>
+					<menuitem
+						label="&meta.menuitem.hyperanchor.copytitle_to_clipboard;"
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/marker_copytext.png"
+						oncommand="mcController.copy('title');"/>
+					<menuitem
+						label="&meta.menuitem.hyperanchor.copynote_to_clipboard;"
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/marker_copytext.png"
+						oncommand="mcController.copy('note');"/>
+					<menuitem
+						label="&meta.menuitem.hyperanchor.copymeta_to_clipboard;"
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/marker_copytext.png"
+						oncommand="mcController.copy('pagetitle');"/>
+				</menupopup>
+			</menu>
+<!--			<menuseparator id="mcPopupHyperAnchorCopyToClipboardMenuseparator" observes="mcPopupHyperAnchorCopyToClipboard" insertafter="mcPopupOpenSeparator"/>-->
+		</menupopup>
+		<menupopup id="bitsItemTreePopup">
+			<menuseparator id="bitsItemTreePopupHyperAnchorCopyToClipboardMenuseparator" observes="bitsItemTreePopupHyperAnchorCopyMenu" insertafter="bitsItemTreePopupOpenMenuseparator"/>
+			<menuitem
+				id="bitsItemTreePopupHyperAnchorCopyFormatSetting"
+				label="&meta.menuitem.hyperanchor.copyformatsetting;..."
+				class="menuitem-iconic"
+				image="chrome://markingcollection/skin/marker_copy.png"
+				insertafter="bitsItemTreePopupOpenMenuseparator"/>
+			<menuitem
+				id="bitsItemTreePopupHyperAnchorCopyFormatToClipboard"
+				label="&meta.menuitem.hyperanchor.copyformat_to_clipboard;"
+				class="menuitem-iconic"
+				image="chrome://markingcollection/skin/marker_copy.png"
+				insertafter="bitsItemTreePopupOpenMenuseparator"/>
+			<menu
+				id="bitsItemTreePopupHyperAnchorCopyMenu"
+				label="&markingcollection.hyperanchor.sidebar_copy_to_clipboard;"
+				class="menu-iconic"
+				image="chrome://markingcollection/skin/marker_copy.png"
+				insertafter="bitsItemTreePopupOpenMenuseparator">
+				<menupopup>
+					<menuitem
+						id="bitsItemTreePopupHyperAnchorCopyToClipboard"
+						label="&meta.menuitem.hyperanchor.copy_to_clipboard;"
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/marker_copy.png"/>
+					<menuitem
+						id="bitsItemTreePopupHyperAnchorCopyTitleToClipboard"
+						label="&meta.menuitem.hyperanchor.copytitle_to_clipboard;"
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/marker_copytext.png"/>
+					<menuitem
+						id="bitsItemTreePopupHyperAnchorCopyNoteToClipboard"
+						label="&meta.menuitem.hyperanchor.copynote_to_clipboard;"
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/marker_copytext.png"/>
+					<menuitem
+						id="bitsItemTreePopupHyperAnchorCopyMetaToClipboard"
+						label="&meta.menuitem.hyperanchor.copymeta_to_clipboard;"
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/marker_copytext.png"/>
+				</menupopup>
+			</menu>
+		</menupopup>
+	</popupset>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/imagetooltip.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/imagetooltip.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/imagetooltip.js	(revision 5703)
@@ -0,0 +1,163 @@
+var bitsImageTooltip = {
+	tooltipRow : -1,
+	tooltipTimer : null,
+
+	get TOOLTIP() { return window.top.document.getElementById("MarkingCollectionImageTooltip"); },
+	get CANVAS()  { return window.top.document.getElementById("MarkingCollectionImageTooltipCanvas"); },
+	get SIDEBAR() { return window.top.document.getElementById("sidebar"); },
+
+	get Database(){ return window.top.bitsObjectMng.Database; },
+
+	init : function(){},
+
+	done : function(){},
+
+	onMousedown : function(aEvent){
+		bitsImageTooltip.hidePopup();
+	},
+
+	onMouseout : function(aEvent){
+		bitsImageTooltip.hidePopup();
+	},
+
+	hidePopup : function(){
+		if(bitsImageTooltip.tooltipTimer) clearTimeout(bitsImageTooltip.tooltipTimer);
+		bitsImageTooltip.tooltipTimer = null;
+		bitsImageTooltip.TOOLTIP.hidePopup();
+		bitsImageTooltip.tooltipRow = -1;
+	},
+
+	onMousemove : function(aEvent,aParam){
+		bitsImageTooltip.hidePopup();
+		if(aParam.tree && (aParam.row == undefined || bitsImageTooltip.tooltipRow == aParam.row.value) )return;
+		bitsImageTooltip.tooltipTimer = setTimeout(
+			function(){
+				bitsImageTooltip._onMousemove(aParam);
+			},500)
+	},
+
+	_onMousemove : function(aParam){
+		try {
+			if(aParam.tree){
+				var curIdx = aParam.row.value;
+				bitsImageTooltip.tooltipRow = curIdx;
+				if(aParam.tree.view.isContainer(curIdx)){
+					bitsImageTooltip.TOOLTIP.hidePopup();
+					return;
+				}
+			}
+			if(!aParam.obj){
+				bitsImageTooltip.TOOLTIP.hidePopup();
+				return;
+			}
+			if(aParam.obj.oid_type.match(/^image\/(.+)$/)){
+				var itemX = {};
+				var itemY = {};
+				var width = {};
+				var height = {};
+				var screenX = 0;
+				var screenY = 0;
+				if(aParam.tree){
+					aParam.tree.treeBoxObject.getCoordsForCellItem(aParam.row.value,aParam.col.value,aParam.childElt.value,itemX,itemY,width,height);
+					screenX = aParam.tree.treeBoxObject.screenX;
+					screenY = aParam.tree.treeBoxObject.screenY;
+				}else if(aParam.menuitem){
+					itemX.value = aParam.menuitem.boxObject.x;
+					itemY.value = aParam.menuitem.boxObject.y;
+					width.value = aParam.menuitem.boxObject.width;
+					height.value = aParam.menuitem.boxObject.height;
+					screenX = aParam.menuitem.boxObject.screenX;
+					screenY = aParam.menuitem.boxObject.screenY;
+				}
+				var blob = bitsImageTooltip.Database.getObjectBLOB(aParam.obj.oid,aParam.obj.dbtype);
+				if(blob && blob.length>0 && blob[0].length>0){
+					var images = String.fromCharCode.apply(String, blob[0]);
+					var image_b64 = btoa(images); // base64 encoding
+					image_b64 = 'data:' + aParam.obj.oid_type + ';base64,' + image_b64;
+					var img = new Image();
+					img.src = image_b64;
+					img.onload = function(){
+						if(bitsImageTooltip.updatePreview(img)){
+							var x=0;
+							var y=0;
+							if(aParam.tree){
+								x = screenX + itemX.value - parseInt((top.outerWidth-top.innerWidth)/2);
+								y = screenY + itemY.value;
+								if(aParam.tree && aParam.tree.id == "bitsItemTree"){
+									x += width.value;
+									y += height.value+4;
+								}
+							}else if(aParam.menuitem){
+								x = screenX + parseInt(width.value/3);
+								y = screenY;
+							}
+							if(bitsImageTooltip.tooltipTimer) clearTimeout(bitsImageTooltip.tooltipTimer);
+							bitsImageTooltip.showPreview(x,y,aParam);
+						}else{
+							bitsImageTooltip.hidePopup();
+						}
+						img = undefined;
+					}
+				}else{
+					bitsImageTooltip.TOOLTIP.hidePopup();
+				}
+			}else{
+				bitsImageTooltip.TOOLTIP.hidePopup();
+			}
+		}catch(ex){
+			window.top.bitsObjectMng._dump('bitsImageTooltip.onMousemove():' + ex);
+			bitsImageTooltip.TOOLTIP.hidePopup();
+		}
+	},
+
+	updatePreview: function(aImage){
+		var canvas = bitsImageTooltip.CANVAS;
+		var tooltip = bitsImageTooltip.TOOLTIP;
+		var canvasW = aImage.width;
+		var canvasH = aImage.height;
+		canvas.style.width = canvasW+"px";
+		canvas.style.height = canvasH+"px";
+		canvas.width = canvasW;
+		canvas.height = canvasH;
+
+		var width = canvasW;
+		var height = canvasH;
+		var tWIDTH = 480;
+		if(canvasW > tWIDTH){
+			width = tWIDTH-14;
+			height = parseInt((canvasH*width)/canvasW);
+			canvas.style.width = width+"px";
+			canvas.style.height = height+"px";
+			canvas.width = width;
+			canvas.height = height;
+		}
+		try{
+			if(!canvas.getContext) return false;
+			var ctx = canvas.getContext("2d");
+			ctx.clearRect(0, 0, canvasW, canvasH);
+			ctx.save();
+			ctx.scale(width/canvasW, height/canvasH);
+			ctx.drawImage(aImage,0,0);
+			ctx.restore();
+		}
+		catch(ex){
+			window.top.bitsObjectMng._dump('bitsImageTooltip.updatePreview():' + ex);
+			return false;
+		}
+		return true;
+  },
+
+	showPreview: function(x, y, aParam){
+		if(this.tooltipTimer) clearTimeout(this.tooltipTimer);
+		this.tooltipTimer = null;
+		if(this.TOOLTIP.openPopupAtScreen){
+			this.TOOLTIP.openPopupAtScreen(x, y, false);
+		}else{
+			if(aParam.tree){
+				this.TOOLTIP.showPopup(this.SIDEBAR, x, y, "tooltip");
+			}else if(aParam.menuitem){
+			}
+		}
+  },
+
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/importtag.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/importtag.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/importtag.js	(revision 5703)
@@ -0,0 +1,308 @@
+// æå®ã¿ã°åèŸŒ
+var bitsImportTagService = {
+	_progressWindow : null,
+
+	get STRING()     { return document.getElementById("MarkingCollectionOverlayString"); },
+	get DataSource() { return window.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.top.bitsObjectMng.Database;   },
+	get gBrowser()   { return window.top.bitsObjectMng.getBrowser();},
+
+	get SIDEBAR() { return window.top.document.getElementById("sidebar"); },
+	get SIDEBAR_DOC() {try{return this.SIDEBAR.contentDocument;}catch(e){return undefined;}},
+	get SIDEBAR_WIN() {try{return this.SIDEBAR.contentWindow;}catch(e){return undefined;}},
+	get mcTreeHandler() {try{return this.SIDEBAR_WIN.mcTreeHandler;}catch(e){return undefined;}},
+	get mcPropertyView() {try{return this.SIDEBAR_WIN.mcPropertyView;}catch(e){return undefined;}},
+	get bitsItemView() {try{return this.SIDEBAR_WIN.bitsItemView;}catch(e){return undefined;}},
+	get mcItemView() {try{return this.SIDEBAR_WIN.mcItemView;}catch(e){return undefined;}},
+
+/////////////////////////////////////////////////////////////////////
+	init : function(){
+
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(){
+
+	},
+
+/////////////////////////////////////////////////////////////////////
+	dispList : function(aEvent){
+		try{
+			var bitsItemView = null;
+			var mcTreeHandler = null;
+			var mcPropertyView = null;
+			var mcItemView = null;
+
+			if(this.bitsItemView) bitsItemView = this.bitsItemView;
+			if(this.mcTreeHandler) mcTreeHandler = this.mcTreeHandler;
+			if(this.mcPropertyView) mcPropertyView = this.mcPropertyView;
+			if(this.mcItemView) mcItemView = this.mcItemView;
+			if(!mcTreeHandler) return;
+			var aRes = mcTreeHandler.resource;
+			if(!aRes) return;
+
+			var tags = this._analyzeDocument();
+			var result = {accept : false};
+			window.openDialog("chrome://markingcollection/content/importtagDialog.xul", "", "chrome,centerscreen,modal", tags, result);
+			if(result.accept){
+
+				var fid = this.DataSource.getProperty(aRes, "id");
+				var fid_style = this.DataSource.getProperty(aRes, "style");
+				var dbtype = this.DataSource.getProperty(aRes, "dbtype");
+				var param = {
+					fid       : fid,
+					fid_style : fid_style,
+					dbtype    : dbtype
+				};
+
+				if(!this._progressWindow){
+					var x = screen.width;
+					var y = screen.height;
+					this._progressWindow = window.openDialog(
+																						"chrome://markingcollection/content/progress.xul",
+																						"myProgress", "chrome,centerscreen,alwaysRaised,dependent=yes,left="+x+",top="+y, 
+																						{status: this.STRING.getString("MSG_IMPORT_TAG") + "..."});
+				}
+
+				if(this._progressWindow && !this._progressWindow.closed){
+					if(result.tags.length>0){
+						if(this._progressWindow.setStatus){
+							var num = 0;
+							var i;
+							for(i=0;i<result.tags.length;i++){
+								num += (tags[result.type][result.tags[i]]?tags[result.type][result.tags[i]].length:0);
+							}
+							this._progressWindow.setStatus(this.STRING.getString("MSG_IMPORT_TAG") + "... [ "+ num + " ]");
+						}
+						this._progressWindow.focus();
+						var self = this;
+						setTimeout(function(){ self._execImport(tags,param,result); },100);
+					}else{
+						if(this._progressWindow && !this._progressWindow.closed) this._progressWindow.close();
+						this._progressWindow = null;
+					}
+				}
+			}
+		}catch(e){
+			this._dump("bitsImportTagService.dispList():"+e);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_execImport : function(tags,param,result,arr,options){
+		try{
+			if((!result.tags || result.tags.length == 0) && arr == undefined){
+				if(this._progressWindow && !this._progressWindow.closed) this._progressWindow.close();
+				this._progressWindow = null;
+				return;
+			}
+			if(arr == undefined){
+				var tag = result.tags.shift();
+				arr = tags[result.type][tag];
+			}
+			if(arr && arr.length>0){
+				if(this._progressWindow && !this._progressWindow.closed && this._progressWindow.setStatus){
+					var num = 0;
+					for(var i=0;i<result.tags.length;i++){
+						num += (tags[result.type][result.tags[i]]?tags[result.type][result.tags[i]].length:0);
+					}
+					num += arr.length;
+					this._progressWindow.setStatus(this.STRING.getString("MSG_IMPORT_TAG") + "... [ "+ num + " ]");
+				}
+				for(var i=0;i<10;i++){
+					var node = arr.shift();
+					var doc = node.ownerDocument;
+					var win = doc.defaultView;
+					if(node.nodeName.toUpperCase() == "IMG" && result.img_opt == "image"){
+						var aXferString = node.src + "\n" + node.alt;
+						bitsMarkingCollection.addURLText(param,-1,undefined, aXferString, node, (result.tags.length==0 && arr.length==0 ? true : false),false);
+					}else{
+						var selection = win.getSelection();
+						if(selection){
+							selection.removeAllRanges();
+							var range = doc.createRange();
+							range.selectNodeContents(node);
+							selection.addRange(range);
+							bitsMarkingCollection.addSelectedText(param,-1,undefined,(result.tags.length==0 && arr.length==0 ? true : false),false);
+						}
+					}
+					if(arr.length == 0){
+						arr = undefined;
+						break;
+					}
+				}
+			}
+			var self = this;
+			setTimeout(function(){ self._execImport(tags,param,result,arr,options); },100);
+		}catch(e){
+			this._dump("bitsImportTagService._execImport():"+e);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_getDocument : function(aWin){
+		var docs = [];
+		if(!aWin) return docs;
+		if(aWin.frames != null){
+			var i;
+			for(i=0;i<aWin.frames.length;i++){
+				docs = docs.concat(this._getDocument(aWin.frames[i]));
+			}
+		}
+		if(aWin.document) docs.push(aWin.document);
+		return docs;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_analyzeDocument : function(){
+		var regexp = new RegExp("^"+bitsMarker.id_key);
+		var tags = {
+			html   : {},
+			nohtml : {},
+		};
+		var htmlTags = this._getHtmlTags();
+		var DOCS = this._getDocument(this.gBrowser.contentWindow);
+		var i,j;
+		for(i=0;i<DOCS.length;i++){
+			if(!DOCS[i].body) continue;
+			var nodeWalker = DOCS[i].createTreeWalker(DOCS[i].body,NodeFilter.SHOW_ELEMENT,null,false);
+			var node;
+			for(node=nodeWalker.nextNode();node;node = nodeWalker.nextNode()){
+				j=0;
+				var elms = [node];
+
+				if(elms[j].nodeName.toUpperCase() == "SCRIPT"){
+					continue;
+				}else if(elms[j].nodeName.toUpperCase() == "SPAN"){
+					if(elms[j].hasAttribute("id") && regexp.test(elms[j].id)) continue; //Markerãé€å€
+				}else if(elms[j].nodeName.toUpperCase() == "IMG"){
+					if(!elms[j].hasAttribute("src")) continue;
+				}else if(elms[j].nodeName.toUpperCase() == "A"){
+					if(!elms[j].hasChildNodes()) continue;
+					if(!elms[j].hasAttribute("href")) continue;
+				}else{
+					if(!elms[j].hasChildNodes()) continue;
+					var textContent = elms[j].textContent.replace(/^\s*/mg,"").replace(/\s*$/mg,"");
+					if(textContent.length == 0) continue;
+				}
+				if(htmlTags[elms[j].nodeName.toUpperCase()] != undefined){
+					if(htmlTags[elms[j].nodeName.toUpperCase()]){
+						if(tags.html[elms[j].nodeName.toLowerCase()] == undefined) tags.html[elms[j].nodeName.toLowerCase()] = [];
+						tags.html[elms[j].nodeName.toLowerCase()].push(elms[j]);
+					}
+				}else{
+					if(tags.nohtml[elms[j].nodeName.toLowerCase()] == undefined) tags.nohtml[elms[j].nodeName.toLowerCase()] = [];
+					tags.nohtml[elms[j].nodeName.toLowerCase()].push(elms[j]);
+				}
+			}
+		}
+		return tags;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_getHtmlTags : function(){
+		var htmlTags = {
+				"A" : 1,
+				"ABBR" : 0,
+				"ACRONYM" : 0,
+				"ADDRESS" : 0,
+				"APPLET" : 0,
+				"AREA" : 0,
+				"B" : 0,
+				"BASE" : 0,
+				"BASEFONT" : 0,
+				"BDO" : 0,
+				"BIG" : 0,
+				"BLOCKQUOT" : 0, 
+				"BLOCKQUOTE" : 0, 
+				"BODY" : 0,
+				"BR" : 0,
+				"BUTTON" : 0,
+				"CAPTION" : 0,
+				"CENTER" : 0,
+				"CITE" : 0,
+				"CODE" : 0,
+				"COL" : 0,
+				"COLGROUP" : 0,
+				"DD" : 0,
+				"DEL" : 0,
+				"DFN" : 0,
+				"DIR" : 0,
+				"DIV" : 0,
+				"DL" : 0,
+				"DT" : 0,
+				"EM" : 0,
+				"FIELDSET" : 0,
+				"FONT" : 0,
+				"FORM" : 0,
+				"FRAME" : 0,
+				"FRAMESET" : 0,
+				"H1" : 0,
+				"H2" : 0,
+				"H3" : 0,
+				"H4" : 0,
+				"H5" : 0,
+				"H6" : 0,
+				"HEAD" : 0,
+				"HR" : 0,
+				"HTML" : 0,
+				"I" : 0,
+				"IFRAME" : 0,
+				"IMG" : 1,
+				"INPUT" : 0,
+				"INS" : 0,
+				"ISINDEX" : 0,
+				"KBD" : 0,
+				"LABEL" : 0,
+				"LEGEND" : 0,
+				"LI" : 0,
+				"LINK" : 0,
+				"MAP" : 0,
+				"MENU" : 0,
+				"META" : 0,
+				"NOBR" : 0,
+				"NOFRAMES" : 0,
+				"NOSCRIPT" : 0,
+				"OBJECT" : 0,
+				"OL" : 0,
+				"OPTGROUP" : 0,
+				"OPTION" : 0,
+				"P" : 0,
+				"PARAM" : 0,
+				"PRE" : 0,
+				"Q" : 0,
+				"S" : 0,
+				"SAMP" : 0,
+				"SCRIPT" : 0,
+				"SELECT" : 0,
+				"SMALL" : 0,
+				"SPAN" : 0,
+				"STRIKE" : 0,
+				"STRONG" : 0,
+				"STYLE" : 0,
+				"SUB" : 0,
+				"SUP" : 0,
+				"TABLE" : 0,
+				"TBODY" : 0,
+				"TD" : 0,
+				"TEXTAREA" : 0,
+				"TFOOT" : 0,
+				"TH" : 0,
+				"THEAD" : 0,
+				"TITLE" : 0,
+				"TR" : 0,
+				"TT" : 0,
+				"U" : 0,
+				"UL" : 0,
+				"VAR" : 0,
+		};
+		return htmlTags;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/importtagDialog.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/importtagDialog.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/importtagDialog.js	(revision 5703)
@@ -0,0 +1,152 @@
+var mcImportTagService = {
+
+	get STRING()     { return document.getElementById("mcImportTagString"); },
+	get HLIST()      { return document.getElementById("mcImportTagHtmlListbox"); },
+	get NLIST()      { return document.getElementById("mcImportTagNohtmlListbox"); },
+	get IRADIO()     { return document.getElementById("mcImportTagRadiogroup"); },
+	get HRADIO()     { return document.getElementById("mcImportTagRadioH"); },
+	get NRADIO()     { return document.getElementById("mcImportTagRadioN"); },
+	get IMG_RADIO()  { return document.getElementById("mcImportTagImgOptionsRadiogroup"); },
+	get IMG_RADIO_I(){ return document.getElementById("mcImportTagImgOptionsRadioImage"); },
+	get IMG_RADIO_S(){ return document.getElementById("mcImportTagImgOptionsRadioString"); },
+
+	get DataSource() { return window.opener.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.opener.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.opener.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.opener.top.bitsObjectMng.Database;   },
+	get XML()        { return window.opener.top.bitsObjectMng.XML;        },
+	get gBrowser()   { return window.opener.top.bitsObjectMng.getBrowser();},
+
+	id       : null,
+	item     : null,
+	resource : null,
+	property : "",
+	_xmldoc : null,
+
+
+
+
+
+
+	init : function(){
+		var tags;
+		if(window.arguments[0]) tags = window.arguments[0];
+		if(!tags) return;
+
+		var html = [];
+		var nohtml = [];
+		for(var tag in tags.html){
+			html.push(tag);
+		}
+		html.sort();
+		for(var tag in tags.nohtml){
+			nohtml.push(tag);
+		}
+		nohtml.sort();
+		var i;
+		for(i=0;i<html.length;i++){
+			var label;
+			if(html[i].toUpperCase() == "IMG"){
+				label = "<"+html[i]+"/>";
+			}else{
+				label = "<"+html[i]+">...</"+html[i]+">";
+			}
+			this.HLIST.appendItem( label, html[i] );
+		}
+		if(html.length>0 && this.HLIST.selectedCount<=0){
+			this.HLIST.selectedIndex = 0;
+			this.HLIST.focus();
+		}
+		if(html.length == 0) this.HRADIO.setAttribute("disabled","true");
+
+		for(i=0;i<nohtml.length;i++){
+			var label = "<"+nohtml[i]+">...</"+nohtml[i]+">";
+			this.NLIST.appendItem( label, nohtml[i] );
+		}
+		if(nohtml.length > 0 && this.NLIST.selectedCount<=0) this.NLIST.selectedIndex = 0;
+		if(nohtml.length == 0){
+			this.NRADIO.setAttribute("disabled","true");
+			this.NLIST.setAttribute("rows","1");
+		}
+
+//this.NRADIO.removeAttribute("selected");
+//this.HRADIO.setAttribute("selected","true");
+
+
+	},
+
+	command : function(aEvent){
+		if(this.HRADIO.selected){
+			this.HLIST.removeAttribute("disabled");
+			this.HLIST.focus();
+			if(this.HLIST.selectedCount<=0) this.HLIST.selectedIndex = 0;
+			this.NLIST.setAttribute("disabled","true");
+		}else{
+			this.NLIST.removeAttribute("disabled");
+			this.NLIST.focus();
+			if(this.NLIST.selectedCount<=0) this.NLIST.selectedIndex = 0;
+			this.HLIST.setAttribute("disabled","true");
+		}
+	},
+
+	select : function(aEvent){
+		try{
+			if(this.HRADIO.selected) return;
+			var list = this.HLIST.selectedItems;
+			var i;
+			for(i=0;i<list.length;i++){
+				if(list[i].value != "img") continue;
+				break;
+			}
+			if(i<list.length){
+				this.IMG_RADIO.removeAttribute("disabled");
+				this.IMG_RADIO.disabled=false;
+			}else{
+				this.IMG_RADIO.setAttribute("disabled","true");
+				this.IMG_RADIO.disabled=true;
+			}
+		}catch(e){
+			_dump(e);
+		}
+	},
+
+	accept : function(){
+		try{
+			if(window.arguments[1]){
+				window.arguments[1].accept = true;
+				window.arguments[1].type = (this.HRADIO.selected?"html":"nohtml");
+				var list;
+				if(this.HRADIO.selected){
+					list = this.HLIST.selectedItems;
+				}else{
+					list = this.NLIST.selectedItems;
+				}
+				if(list){
+					var tags = [];
+					var i;
+					for(i=0;i<list.length;i++){
+						tags.push(list[i].value);
+						if(list[i].value != "img") continue;
+						if(this.IMG_RADIO_I){
+							window.arguments[1].img_opt = (this.IMG_RADIO_I.selected?"image":"string");
+						}else{
+							window.arguments[1].img_opt = "image";
+						}
+					}
+					window.arguments[1].tags = tags;
+				}
+			}
+		}catch(e){
+			this._dump("mcImportTagService.accept():"+e);
+		}
+	},
+
+	cancel : function(){
+		if(window.arguments[1]) window.arguments[1].accept = false;
+	},
+
+	_dump : function(aString){
+		window.opener.top.bitsMarkingCollection._dump(aString);
+	},
+
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/importtagDialog.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/importtagDialog.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/importtagDialog.xul	(revision 5703)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/property.css" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/setting.css" type="text/css" ?>
+<!DOCTYPE wizard [
+<!ENTITY % overlayDTD   SYSTEM "chrome://markingcollection/locale/markingcollection.dtd" >
+%overlayDTD;
+<!ENTITY % markerCustomDTD SYSTEM "chrome://markingcollection/locale/markerCustom.dtd" >
+%markerCustomDTD;
+]>
+<dialog
+	id="mcImportTagDialog"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	title="&markingcollection.importTagAll;"
+	buttons="accept,cancel"
+	onload="mcImportTagService.init();"
+	ondialogaccept="mcImportTagService.accept();"
+	ondialogcancel="mcImportTagService.cancel();">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/importtagDialog.js" />
+	<stringbundleset id="mcStringBundles">
+		<stringbundle id="mcImportTagString" src="chrome://markingcollection/locale/markingcollection.properties" />
+	</stringbundleset>
+	<radiogroup id="mcImportTagRadiogroup">
+		<hbox>
+			<radio id="mcImportTagRadioH" label="HTML Tag" value="html" selected="true" align="start" oncommand="mcImportTagService.command(event);"/>
+			<listbox id="mcImportTagHtmlListbox" flex="1" rows="3" onselect="mcImportTagService.select(event);"/>
+		</hbox>
+		<hbox>
+			<radio id="mcImportTagRadioN" label="Other Tag" value="nohtml" align="start" oncommand="mcImportTagService.command(event);"/>
+			<listbox id="mcImportTagNohtmlListbox" flex="1" rows="3" disabled="true"/>
+		</hbox>
+	</radiogroup>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/infoDialog.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/infoDialog.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/infoDialog.xul	(revision 5703)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<dialog
+    id="infoDialog"
+    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+    xmlns:html="http://www.w3.org/1999/xhtml"
+    title="Info from annotator backend"
+    buttons="accept"
+    defaultButton="false"
+    onload="infoDialogLoad()">
+    <script type="application/x-javascript">
+            <![CDATA[       
+                function infoDialogLoad() {
+                    //set info
+                    document.getElementById("info").value = window.arguments[0].info;  
+                    
+                    if(window.arguments[0].title){
+                        document.title = window.arguments[0].title;
+                    }                 
+                }
+                
+            ]]>
+    </script>
+    <textbox  id="info" width="350" height="400" style="background-color: transparent;" flex="1"
+        multiline="true" readonly="true"
+        onoverflow="this.height = this.inputField.scrollHeight;" />
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/itemview.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/itemview.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/itemview.js	(revision 5703)
@@ -0,0 +1,1592 @@
+var bitsItemView = {
+	_init : false,
+	_pref : {},
+	_app_version : 2,
+	_canDrop : false,
+	_refreshFlag : true,
+	_getImageFromURL : {},
+
+	_refresh_timer : null,
+
+	modAlt   : false,
+	modShift : false,
+	modCtrl  : false,
+	modMeta  : false,
+
+	get POS_DEFAULT()     { return this.POS_TREE_BOTTOM; },
+	get POS_TREE_BOTTOM() { return "tree_bottom"; },
+	get POS_TREE_RIGHT()  { return "tree_right"; },
+
+	get BUTTON() {
+		try{
+			return window.top.bitsMarkingCollection._contentWindow.document.getElementById("mcToolbarItemTreeButton");
+		}catch(e){ return undefined; }
+	},
+	get APPCONT()  { return document.getElementById("appcontent"); },
+	get idTREE()   { return "bitsItemTree"; },
+	get TREE()     { return document.getElementById(this.idTREE); },
+	get SPLITTER() { return document.getElementById("bitsBrowserLeftSplitter"); },
+	get TNBOX()    { return document.getElementById("bitsItemTNBox"); },
+	get VBOX()     { return document.getElementById("bitsBrowserLeftVBox"); },
+
+	get VTTB()     { return document.getElementById("bitsItemViewTypeToolbarbutton"); },
+	get VTLM()     { return document.getElementById("bitsItemViewTypeLargeMenuitem"); },
+	get VTMM()     { return document.getElementById("bitsItemViewTypeMiddleMenuitem"); },
+	get VTSM()     { return document.getElementById("bitsItemViewTypeSmallMenuitem"); },
+	get VSB()      { return document.getElementById("bitsItemViewSearchButton"); },
+	get VSM()      { return document.getElementById("bitsItemViewSearchMenu"); },
+
+	get idTREE_IFAVICON()  { return "bitsItemTreeIFavicon"; },
+	get idTREE_IURL()      { return "bitsItemTreeIUrl"; },
+	get idTREE_IDOCTITLE() { return "bitsItemTreeIDocTitle"; },
+	get idTREE_ITITLE()    { return "bitsItemTreeITitle"; },
+	get idTREE_IDATE()     { return "bitsItemTreeIDate"; },
+	get idTREE_INOTE()     { return "bitsItemTreeINote"; },
+	get idTREE_IFOLDER()   { return "bitsItemTreeIFolder"; },
+	get idTREE_IFOLDERSTYLE(){ return "bitsItemTreeIFolderStyle"; },
+	get TREE_IFAVICON()    { return document.getElementById(this.idTREE_IFAVICON); },
+	get TREE_IURL()        { return document.getElementById(this.idTREE_IURL); },
+	get TREE_IDOCTITLE()   { return document.getElementById(this.idTREE_IDOCTITLE); },
+	get TREE_ITITLE()      { return document.getElementById(this.idTREE_ITITLE); },
+	get TREE_IDATE()       { return document.getElementById(this.idTREE_IDATE); },
+	get TREE_INOTE()       { return document.getElementById(this.idTREE_INOTE); },
+	get TREE_IFOLDER()     { return document.getElementById(this.idTREE_IFOLDER); },
+	get TREE_IFOLDERSTYLE(){ return document.getElementById(this.idTREE_IFOLDERSTYLE); },
+
+	get idPOPUP_OPEN()    { return "bitsItemTreePopupOpen"; },
+	get idPOPUP_OPENN()   { return "bitsItemTreePopupOpenNewTab"; },
+	get idPOPUP_REMOVE()  { return "bitsItemTreePopupRemove"; },
+	get idPOPUP_PROPERTY(){ return "bitsItemTreePopupProperty"; },
+
+	get idPOPUP_COPY()        { return "bitsItemTreePopupHyperAnchorCopyToClipboard"; },
+	get idPOPUP_COPYTITLE()   { return "bitsItemTreePopupHyperAnchorCopyTitleToClipboard"; },
+	get idPOPUP_COPYNOTE()    { return "bitsItemTreePopupHyperAnchorCopyNoteToClipboard"; },
+	get idPOPUP_COPYMETA()    { return "bitsItemTreePopupHyperAnchorCopyMetaToClipboard"; },
+	get idPOPUP_COPYFORMAT()  { return "bitsItemTreePopupHyperAnchorCopyFormatToClipboard"; },
+	get idPOPUP_COPYSETTING() { return "bitsItemTreePopupHyperAnchorCopyFormatSetting"; },
+
+	get POPUP()         { return document.getElementById("bitsItemTreePopup"); },
+	get POPUP_OPEN()    { return document.getElementById(this.idPOPUP_OPEN); },
+	get POPUP_OPENN()   { return document.getElementById(this.idPOPUP_OPENN); },
+	get POPUP_REMOVE()  { return document.getElementById(this.idPOPUP_REMOVE); },
+	get POPUP_PROPERTY(){ return document.getElementById(this.idPOPUP_PROPERTY); },
+
+	get SIDEBAR_BOX()   { return document.getElementById("bitsSidebarBox"); },
+
+	get SIDEBAR()     { return window.top.document.getElementById("sidebar"); },
+	get SIDEBAR_DOC() {try{return this.SIDEBAR.contentDocument;}catch(e){return undefined;}},
+
+	get idBUTTON_LISTSTYLE()    { return "mcToolbarListStyleButton"; },
+	get idITEM_LISTSTYLE_RL()   { return "mcToolbarListStyleRLItem"; },
+	get idITEM_LISTSTYLE_TB()   { return "mcToolbarListStyleTBItem"; },
+	get idITEM_LISTSTYLE_NONE() { return "mcToolbarListStyleNoneItem"; },
+	get BUTTON_LISTSTYLE()    {try{return this.SIDEBAR_DOC.getElementById(this.idBUTTON_LISTSTYLE);}catch(e){return undefined;}},
+	get ITEM_LISTSTYLE_RL()   {try{return this.SIDEBAR_DOC.getElementById(this.idITEM_LISTSTYLE_RL);}catch(e){return undefined;}},
+	get ITEM_LISTSTYLE_TB()   {try{return this.SIDEBAR_DOC.getElementById(this.idITEM_LISTSTYLE_TB);}catch(e){return undefined;}},
+	get ITEM_LISTSTYLE_NONE() {try{return this.SIDEBAR_DOC.getElementById(this.idITEM_LISTSTYLE_NONE);}catch(e){return undefined;}},
+
+
+	get BROADCASTER() { return window.top.document.getElementById("viewMarkingCollection"); },
+
+	get STRING()     { return window.top.document.getElementById("MarkingCollectionOverlayString"); },
+	get DataSource() { return window.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.top.bitsObjectMng.Database;   },
+	get XML()        { return window.top.bitsObjectMng.XML;   },
+	get gBrowser()   { return window.top.bitsObjectMng.getBrowser();},
+
+	get isChecked() {
+		return this._pref.disp;
+	},
+
+	get position() {
+		return this._pref.position;
+	},
+
+	set position(aPos) {
+		this._pref.position = aPos;
+		if(this._pref.position == this.POS_TREE_RIGHT){
+			this.SIDEBAR_BOX.setAttribute("orient","horizontal");
+			this.SPLITTER.setAttribute("orient","horizontal");
+			this.VBOX.setAttribute("persist","width");
+			try{this.BUTTON_LISTSTYLE.setAttribute("image",this.ITEM_LISTSTYLE_RL.getAttribute("image"));}catch(e){}
+		}else if(this._pref.position == this.POS_TREE_BOTTOM){
+			this.SIDEBAR_BOX.setAttribute("orient","vertical");
+			this.SPLITTER.setAttribute("orient","vertical");
+			this.VBOX.setAttribute("persist","height");
+			try{this.BUTTON_LISTSTYLE.setAttribute("image",this.ITEM_LISTSTYLE_TB.getAttribute("image"));}catch(e){}
+		}else{
+			try{this.BUTTON_LISTSTYLE.setAttribute("image",this.ITEM_LISTSTYLE_NONE.getAttribute("image"));}catch(e){}
+		}
+	},
+
+	get confirmDelete() {
+		return this._pref.confirmDelete;
+	},
+
+	get object() {
+		return (this.TREE.currentIndex>=0 ? this.getRowObject(this.TREE.currentIndex) : undefined);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	init : function(aEvent){
+		if(!this._init){
+			var disp = nsPreferences.getBoolPref("wiredmarker.itemview.disp");
+			if(disp == undefined) nsPreferences.setBoolPref("wiredmarker.itemview.disp",true);
+			if(this.APPCONT){
+				this.APPCONT.parentNode.insertBefore(this.VBOX,this.APPCONT)
+				this.APPCONT.parentNode.insertBefore(this.SPLITTER,this.APPCONT)
+			}
+			this._pref = {
+				disp          : nsPreferences.getBoolPref("wiredmarker.itemview.disp", false),
+				position      : nsPreferences.copyUnicharPref("wiredmarker.itemview.position", this.POS_DEFAULT),
+				confirmDelete : nsPreferences.getBoolPref("wiredmarker.confirmDelete", true),
+			};
+			this.position = this._pref.position;
+			if(!this._pref.disp) try{this.BUTTON_LISTSTYLE.setAttribute("image",this.ITEM_LISTSTYLE_NONE.getAttribute("image"));}catch(e){}
+			this.gBrowser.addEventListener("mousedown", this.onBrowserMousedown, false);
+			var info = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
+			this._app_version = parseFloat(info.version);
+			this.VTTB.setAttribute("disabled","true");
+			if(this._app_version<3.1){
+				this.TREE.addEventListener("draggesture", bitsItemView.onOldDraggesture, false);
+				this.TREE.addEventListener("dragover", bitsItemView.onOldDragover, false);
+				this.TREE.addEventListener("dragdrop", bitsItemView.onOldDragdrop, false);
+				this.TREE.addEventListener("dragexit", bitsItemView.onOldDragexit, false);
+			}else{
+				this.TREE.addEventListener("dragstart", bitsItemView.onDragEvents, false);
+				this.TREE.addEventListener("drag", bitsItemView.onDragEvents, false);
+				this.TREE.addEventListener("dragend", bitsItemView.onDragEvents, false);
+
+				this.TREE.addEventListener("dragenter", bitsItemView.onDropEvents, false);
+				this.TREE.addEventListener("dragover", bitsItemView.onDropEvents, false);
+				this.TREE.addEventListener("dragleave", bitsItemView.onDropEvents, false);
+				this.TREE.addEventListener("drop", bitsItemView.onDropEvents, false);
+			}
+			this._init = true;
+		}
+		if(this.BUTTON) this.BUTTON.setAttribute("checked",this._pref.disp);
+		var sidebar = window.top.document.getElementById("sidebar");
+		if(sidebar && this.position == this.POS_TREE_RIGHT) sidebar.setAttribute("style","min-width:14em; width:18em;");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	disp : function(aEvent){
+		this.treeDispChange();
+		this.rebuild();
+		this.SPLITTER.setAttribute("hidden",!this._pref.disp);
+		this.VBOX.setAttribute("hidden",!this._pref.disp);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(aEvent){
+		this.SPLITTER.setAttribute("hidden",true);
+		this.VBOX.setAttribute("hidden",true);
+		try{this.TREE.treeBoxObject.clearStyleAndImageCaches();}catch(e){};
+		this.gBrowser.removeEventListener("mousedown", this.onBrowserMousedown, false);
+		if(this._app_version<3.1){
+			this.TREE.removeEventListener("draggesture", bitsItemView.onOldDraggesture, false);
+			this.TREE.removeEventListener("dragover", bitsItemView.onOldDragover, false);
+			this.TREE.removeEventListener("dragdrop", bitsItemView.onOldDragdrop, false);
+			this.TREE.removeEventListener("dragexit", bitsItemView.onOldDragexit, false);
+		}else{
+			this.TREE.removeEventListener("dragstart", bitsItemView.onDragEvents, false);
+			this.TREE.removeEventListener("drag", bitsItemView.onDragEvents, false);
+			this.TREE.removeEventListener("dragend", bitsItemView.onDragEvents, false);
+			this.TREE.removeEventListener("dragenter", bitsItemView.onDropEvents, false);
+			this.TREE.removeEventListener("dragover", bitsItemView.onDropEvents, false);
+			this.TREE.removeEventListener("dragleave", bitsItemView.onDropEvents, false);
+			this.TREE.removeEventListener("drop", bitsItemView.onDropEvents, false);
+		}
+		var sidebar = window.top.document.getElementById("sidebar");
+		if(sidebar && this.position == this.POS_TREE_RIGHT) sidebar.setAttribute("style","min-width:14em; width:18em; max-width:36em;");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	treeDispChange : function(){
+		try{var mcTreeRule = window.top.bitsMarkingCollection._contentWindow.document.getElementById("mcTreeRule");}catch(e){}
+		if(!mcTreeRule) return;
+		if(this._pref.disp){
+			mcTreeRule.setAttribute("iscontainer", true);
+		}else{
+			mcTreeRule.removeAttribute("iscontainer");
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onChangeListStyle : function(aEvent){
+		var reboot = false;
+		if(aEvent.target.id == this.idITEM_LISTSTYLE_RL){
+			if(!this._pref.disp || this.position != this.POS_TREE_RIGHT){
+				nsPreferences.setBoolPref("wiredmarker.itemview.disp", true);
+				nsPreferences.setUnicharPref("wiredmarker.itemview.position", this.POS_TREE_RIGHT);
+				reboot = true;
+			}
+		}else if(aEvent.target.id == this.idITEM_LISTSTYLE_TB){
+			if(!this._pref.disp || this.position != this.POS_TREE_BOTTOM){
+				nsPreferences.setBoolPref("wiredmarker.itemview.disp", true);
+				nsPreferences.setUnicharPref("wiredmarker.itemview.position", this.POS_TREE_BOTTOM);
+				reboot = true;
+			}
+		}else if(aEvent.target.id == this.idITEM_LISTSTYLE_NONE){
+			if(this._pref.disp){
+				nsPreferences.setBoolPref("wiredmarker.itemview.disp", false);
+				nsPreferences.setUnicharPref("wiredmarker.itemview.position", this.POS_TREE_BOTTOM);
+				reboot = true;
+			}
+		}
+		if(reboot){
+			if(this.Common.confirm(this.STRING.getString("CONFIRM_SETTING_CHANGE_RESTART_APP"))){
+				window.top.bitsMarkingCollection.reboot();
+				return;
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onViewTypePopupCommand : function(aEvent){
+		var xmldoc = null;
+		var iconsize = null;
+		var viewtype = "small";
+		var viewtype_C = "small";
+		if(this._info){
+			var viewmode = this._info.viewmode;
+			var fid = this._info.fid;
+			var dbtype = this._info.dbtype;
+			if(fid && this.dbtype){
+				var folders = this.Database.getFolderFormID(fid, dbtype);
+				if(folders && folders.length>0 && folders[0].fid_property){
+					var parser = new DOMParser();
+					xmldoc = parser.parseFromString(folders[0].fid_property, "text/xml");
+					parser = undefined;
+					iconsize = xmldoc.getElementsByTagName("ICON_SIZE")[0];
+					if(iconsize) viewtype = iconsize.textContent
+				}
+			}
+		}
+		switch(aEvent.target.id){
+			case "bitsItemViewTypeLargeMenuitem":
+				viewtype_C = "large";
+				break;
+			case "bitsItemViewTypeMiddleMenuitem":
+				viewtype_C = "middle";
+				break;
+			case "bitsItemViewTypeSmallMenuitem":
+				viewtype_C = "small";
+				break;
+		}
+		if(viewtype != viewtype_C){
+			if(!xmldoc){
+				var parser = new DOMParser();
+				xmldoc = parser.parseFromString("<PROPERTY/>", "text/xml");
+				parser = undefined;
+			}
+			if(iconsize){
+				while(iconsize.hasChildNodes()){ iconsize.removeChild(iconsize.lastChild); }
+			}else{
+				iconsize = xmldoc.createElement("ICON_SIZE");
+				xmldoc.documentElement.appendChild(iconsize);
+			}
+			iconsize.appendChild(xmldoc.createTextNode(viewtype_C));
+			var s = new XMLSerializer();
+			folders[0].fid_property = s.serializeToString(xmldoc);
+			s = undefined;
+			var dbtype = folders[0].dbtype;
+			delete folders[0].dbtype;
+			var changed = this.Database.updateFolder(folders[0],dbtype);
+			this.refresh();
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onSearchButtonCommand : function(aEvent){
+		var checked = this.VSB.getAttribute("checked");
+		if(!checked || checked == "false"){
+			this.VSB.setAttribute("checked","true");
+			this.VSM.removeAttribute("disabled");
+			setTimeout(function(){
+				bitsItemView.VSM.focus();
+				bitsItemView.refresh();
+			},0);
+		}else{
+			this.VSB.removeAttribute("checked");
+			this.VSM.blur();
+			this.VSM.setAttribute("disabled","true");
+			setTimeout(function(){
+					bitsItemView.refresh();
+				},0);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onButtonClick : function(aEvent){
+		this._pref.disp = this.isChecked;
+		if(!this._pref.disp){
+			this._pref.disp = true;
+		}else{
+			this._pref.disp = false;
+		}
+		if(this.BUTTON) this.BUTTON.setAttribute("checked",this._pref.disp);
+		this.SPLITTER.setAttribute("hidden",!this._pref.disp);
+		this.VBOX.setAttribute("hidden",!this._pref.disp);
+		this.treeDispChange();
+		window.top.bitsMarkingCollection._contentWindow.mcTreeRdfRebuildItem.init();
+		window.top.bitsMarkingCollection._contentWindow.mcTreeHandler.TREE.builder.rebuild();
+		this.onTreeClick();
+		aEvent.stopPropagation();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onTreeClick : function(aInfo){
+		if(!this._pref.disp) return;
+		if(this._app_version<=2){
+			this.VTTB.setAttribute("disabled","true");
+		}else if(aInfo){
+			this.VTTB.removeAttribute("disabled");
+		}
+		if(bitsSearchAcross.getIndex() == mcTreeHandler.TREE.currentIndex){
+			this.TREE_IFOLDER.hidden = false;
+			this.TREE_IFOLDERSTYLE.hidden = false;
+		}else{
+			this.TREE_IFOLDER.hidden = true;
+			this.TREE_IFOLDERSTYLE.hidden = true;
+		}
+		this._info = aInfo;
+		this.rebuild(aInfo);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onTreeDateClick : function(aInfo){
+		if(!this._pref.disp) return;
+		if(this._app_version<=2){
+			this.VTTB.setAttribute("disabled","true");
+		}else if(aInfo){
+			this.VTTB.removeAttribute("disabled");
+		}
+		this._info = aInfo;
+		this.rebuild(aInfo);
+	},
+
+
+/////////////////////////////////////////////////////////////////////
+// TREE è¡šç€ºå¶åŸ¡é¢é£
+/////////////////////////////////////////////////////////////////////
+	get rowCount(){
+		return (this.itemObjects?this.itemObjects.length:0);
+	},
+	getRowObject : function(row){
+		return (row>=0 && this.itemObjects && this.itemObjects.length>row ? this.itemObjects[row] : undefined);
+	},
+	getCellText : function(row,column){
+		if(!this.itemObjects || !this.itemObjects[row]) return null;
+		if(column.id == this.idTREE_ITITLE){
+			return this.itemObjects[row].oid_title;
+		}else if(column.id == this.idTREE_IURL){
+			return this.itemObjects[row].doc_url;
+		}else if(column.id == this.idTREE_IDOCTITLE){
+			return this.itemObjects[row].doc_title;
+		}else if(column.id == this.idTREE_IDATE){
+			if(!this.itemObjects) return null;
+			if(this.itemObjects[row].oid_date.match(/^(\d{2}\/\d{2})\/(\d{4})\s+(\d{2}:\d{2}:\d{2})$/)){
+				return RegExp.$2 + "/" + RegExp.$1 + " "  + RegExp.$3;
+			}else{
+				return this.itemObjects[row].oid_date;
+			}
+		}else if(column.id == this.idTREE_INOTE){
+			if(this.itemObjects[row].oid_note == undefined && this.itemObjects[row].oid_property && this.itemObjects[row].oid_property != ""){
+				var domParser = new DOMParser();
+				var xmldoc = domParser.parseFromString(this.itemObjects[row].oid_property, "text/xml");
+				if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+				if(xmldoc){
+					var xmlnode = xmldoc.getElementsByTagName("NOTE")[0];
+					if(xmlnode) this.itemObjects[row].oid_note = xmlnode.textContent;
+				}
+				if(this.itemObjects[row].oid_note == undefined) this.itemObjects[row].oid_note = "";
+				if(this.itemObjects[row].oid_note != ""){
+					var oid_note = this.itemObjects[row].oid_note;
+					oid_note = oid_note.replace(/[\r\n]+/mg, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+					this.itemObjects[row].oid_note = oid_note;
+				}
+			}
+			return this.itemObjects[row].oid_note;
+		}else if(column.id == this.idTREE_IFOLDER){
+			if(this.itemObjects[row].pfid == "0" && this.itemObjects[row].dbtype == window.top.bitsMarkingCollection._uncategorized.dbtype){
+				return window.top.bitsMarkingCollection._uncategorized.title;
+			}else{
+				return this.itemObjects[row].fid_title;
+			}
+		}else{
+			return null;
+		}
+	},
+	setTree: function(treebox){ this.treebox = treebox; },
+	isContainer: function(row){ return false; },
+	isSeparator: function(row){ return false; },
+	isSorted: function(){ return true; },
+	getLevel: function(row){ return 0; },
+	getImageSrc: function(row,column){
+		var icon;
+		if(!this.itemObjects) return icon;
+		if(!this.itemObjects[row]) return icon;
+		if(column.id != this.idTREE_IFAVICON) return icon;
+		var aObject = this.itemObjects[row];
+		if(aObject.oid_type.match(/^image\/(.+)$/)){
+			if(this._app_version>2){
+				var blobFile = this.Database.getObjectBLOBFile(aObject.oid,(aObject.dbtype?aObject.dbtype:this.dbtype));
+				if(blobFile.exists()){
+					if(blobFile.fileSize>0){
+						var url = this.Common.convertFilePathToURL(blobFile.path);
+						if(url) icon = url;
+					}else if(aObject.oid_txt && this._getImageFromURL[aObject.oid_txt] == undefined){
+						var self = this;
+						this._getImageFromURL[aObject.oid_txt] = setTimeout(function(){
+							if(self.Common.getImageFromURL(aObject.oid_txt, blobFile)){
+								var box = self.TREE.boxObject;
+								box.invalidateCell(row,column);
+							}
+						},100);
+					}
+				}
+			}
+		}else if(aObject.oid_type == "url"){
+			icon = this.Database.getFavicon(aObject.oid_txt,aObject.dbtype);
+			if(!icon) icon = this.Database.getFavicon(aObject.doc_url,aObject.dbtype);
+		}else{
+			var xmldoc;
+			if(xmldoc){
+				var xmlnode = xmldoc.getElementsByTagName("ICON")[0];
+				if(xmlnode) icon = xmlnode.textContent;
+			}else{
+				if(aObject.oid_property.match(/^.*<ICON>(.+?)<\/ICON>.*$/m)){
+					icon = RegExp.$1;
+				}
+			}
+			if(icon && icon != ""){
+				var url = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURL);
+				url.spec = icon;
+				if(url.scheme == "file"){
+					var file = bitsObjectMng.Common.convertURLToFile(icon)
+					if(!file.exists()) icon = undefined;
+				}else if(url.scheme == "chrome"){
+					var val = this.Database.existsIcon(url);
+					if(!val) icon = undefined;
+				}
+			}
+		}
+		if(!icon) icon = this.Database.getFavicon(aObject.doc_url,aObject.dbtype);
+		if(!icon){
+			if(aObject.oid_type.match(/^image\//)){
+				icon = "chrome://markingcollection/skin/image.png";
+			}else{
+				icon = "chrome://markingcollection/skin/defaultFavicon.png";
+			}
+		}
+		return icon;
+	},
+	getRowProperties: function(row,prop){},
+	getCellProperties: function(row, column, prop) {
+		if(column.id == this.idTREE_IFAVICON){
+			var aserv=Components.classes["@mozilla.org/atom-service;1"].getService(Components.interfaces.nsIAtomService);
+			prop.AppendElement(aserv.getAtom("ItemView"));
+			if(this.itemObjects && this.itemObjects[row]){
+				var aObject = this.itemObjects[row];
+				prop.AppendElement(aserv.getAtom("ItemViewImage"));
+			}
+		}else if(column.id == this.idTREE_IFOLDER){
+			var aserv=Components.classes["@mozilla.org/atom-service;1"].getService(Components.interfaces.nsIAtomService);
+			prop.AppendElement(aserv.getAtom("ItemView"));
+			prop.AppendElement(aserv.getAtom("ItemViewImage"));
+			prop.AppendElement(aserv.getAtom("folder"));
+		}else if(column.id == this.idTREE_IFOLDERSTYLE){
+			if(this.itemObjects && this.itemObjects[row]){
+				var aserv=Components.classes["@mozilla.org/atom-service;1"].getService(Components.interfaces.nsIAtomService);
+				prop.AppendElement(aserv.getAtom('css_'+this.itemObjects[row].dbtype+'_'+this.itemObjects[row].pfid));
+			}
+		}
+	},
+	getColumnProperties: function(column, element, prop) {},
+	cycleHeader : function(col){},
+	isEditable : function(row,column){
+		return column.editable;
+	},
+	setCellText : function(row,column,text){
+		if(column.id == this.idTREE_INOTE){
+			text = text.replace(/\t/g,"        ");
+			text = this.Common.exceptCode(text);
+			text = text.replace(/[\r\n]+/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+			if(this.itemObjects[row].oid_note == text) return;
+			if(this.itemObjects[row].oid_property == undefined || this.itemObjects[row].oid_property == "") this.itemObjects[row].oid_property == "<PROPERTY/>";
+			var domParser = new DOMParser();
+			var xmldoc = domParser.parseFromString(this.itemObjects[row].oid_property, "text/xml");
+			if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+			if(xmldoc){
+				var xmlnode = xmldoc.getElementsByTagName("NOTE")[0];
+				if(!xmlnode){
+					xmlnode = xmldoc.createElement("NOTE");
+					xmldoc.documentElement.appendChild(xmlnode);
+				}
+				while(xmlnode.hasChildNodes()){ xmlnode.removeChild(xmlnode.lastChild); }
+				if(text != ""){
+					xmlnode.appendChild(xmldoc.createTextNode(text));
+				}else{
+					xmlnode.parentNode.removeChild(xmlnode);
+				}
+				var s = new XMLSerializer();
+				this.itemObjects[row].oid_property = s.serializeToString(xmldoc);
+				s = undefined;
+				var itemObject = {};
+				for(var key in this.itemObjects[row]){
+					itemObject[key] = this.itemObjects[row][key];
+				}
+				delete itemObject.oid_note;
+				delete itemObject.fid_style;
+				delete itemObject.fid_title;
+				delete itemObject.folder_order;
+				delete itemObject.dbtype;
+				if(this.Database.updateObject(itemObject,this.dbtype)) this.itemObjects[row].oid_note = text;
+				xmldoc = undefined;
+			}
+			domParser = undefined;
+		}
+	},
+	setCellValue : function(row,column,text){},
+  getParentIndex: function(idx) { return -1; },
+	canDrop : function(index, orient){
+		return this._canDrop;
+	},
+	onDrop : function(row, orient){},
+	drop : function(row, orient){
+		if(!this._info) return;
+		if(!this._canDrop) return;
+		try{
+			var XferDataSet  = nsTransferable.get(mcTreeDNDHandler.dragDropObserver.getSupportedFlavours(),nsDragAndDrop.getDragData,true);
+			var XferData     = XferDataSet.first.first;
+			var doraggedData = XferData.data;
+			var XferDataType = XferData.flavour.contentType;
+		}catch(ex){}
+		if(XferDataType == "application/x-moz-file" && XferData){
+			if(XferData.data instanceof Components.interfaces.nsIFile){
+				var urlString = this.Common.convertFilePathToURL(XferData.data.path);
+				this.capture(urlString, row, orient);
+			}
+		}else if(XferDataType == "wired-marker/object" && XferData){
+		}else if(XferData && XferData.data){
+			if(
+				bitsItemView.originalTarget &&
+				bitsItemView.originalTarget.nodeName == "IMG" &&
+				bitsItemView.originalTarget.hasAttribute('oid') &&
+				bitsItemView.originalTarget.hasAttribute('dbtype') &&
+				bitsItemView.originalTarget.hasAttribute('pfid')){
+				var oid = bitsItemView.originalTarget.getAttribute('oid');
+				var dbtype = bitsItemView.originalTarget.getAttribute('dbtype');
+				var pfid = bitsItemView.originalTarget.getAttribute('pfid');
+				var dstRes = mcTreeHandler.resource;
+				if(dstRes){
+					var dst_fid = mcTreeDNDHandler.DataSource.getProperty(dstRes,"id");
+					var dst_dbtype = mcTreeDNDHandler.DataSource.getProperty(dstRes,"dbtype");
+					if(dst_fid == pfid && dst_dbtype == dbtype) return;
+					var srcObjects = bitsItemView.Database.getObject({oid:oid}, dbtype);
+					var mergeRtn = window.top.bitsTreeListService.mergeObject({fid:dst_fid,dbtype:dst_dbtype},srcObjects[0]);
+					if(mergeRtn) return;
+					var rtnObj = null;
+					if(dbtype == window.top.bitsMarkingCollection._uncategorized.dbtype || mcTreeDNDHandler.modShift){
+						rtnObj = window.top.bitsTreeListService.moveObject({fid:dst_fid,dbtype:dst_dbtype},srcObjects[0],true);
+					}else{
+						rtnObj = window.top.bitsTreeListService.copyObject({fid:dst_fid,dbtype:dst_dbtype},srcObjects[0]);
+					}
+					setTimeout(function(){
+						var viewmode = mcTreeViewModeService.viewmode;
+						mcItemView._bitsItemView.onTreeClick({viewmode:viewmode,fid:dst_fid,dbtype:dst_dbtype,res:dstRes});
+						window.top.bitsTreeListService.reload(bitsItemView.originalTarget.ownerDocument);
+						bitsItemView.originalTarget = null;
+					},0);
+				}
+			}else{
+				this.capture(XferData.data, row, orient);
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+// Drag & Drop Old Callback functions
+/////////////////////////////////////////////////////////////////////
+	onOldDraggesture: function(aEvent){
+		bitsItemView.getModifiers(aEvent);
+		nsDragAndDrop.startDrag(aEvent,bitsItemView.dragDropObserver);
+		aEvent.stopPropagation();
+	},
+	onOldDragover: function(aEvent){
+		nsDragAndDrop.dragOver(aEvent,bitsItemView.dragDropObserver);
+		aEvent.stopPropagation();
+	},
+	onOldDragdrop: function(aEvent){
+		nsDragAndDrop.drop(aEvent,bitsItemView.dragDropObserver);
+		aEvent.stopPropagation();
+	},
+	onOldDragexit: function(aEvent){
+		nsDragAndDrop.dragExit(aEvent,bitsItemView.dragDropObserver);
+		aEvent.stopPropagation();
+	},
+
+/////////////////////////////////////////////////////////////////////
+// Drag & Drop New Callback functions
+/////////////////////////////////////////////////////////////////////
+	onDragEvents: function(aEvent){
+		switch(aEvent.type){
+			case "dragstart":
+				bitsItemView.onDragStart(aEvent);
+				break;
+			case "drag":
+			break;
+			case "dragend":
+			break;
+		}
+	},
+
+	onDragStart : function(aEvent){
+		try{
+			if(aEvent.originalTarget.localName != "treechildren") return;
+			bitsItemView.getModifiers(aEvent);
+			var idxList = bitsItemView.getSelection();
+			if(idxList.length>0){
+				var transferData = aEvent.dataTransfer;
+				var rc = [];
+				var i;
+				for(i=0;i<idxList.length;i++){
+					var oid = bitsItemView.itemObjects[idxList[i]].oid;
+					var dbtype = bitsItemView.itemObjects[idxList[i]].dbtype;
+					rc.push(oid+"\t"+dbtype);
+				}
+				if(rc.length>0){
+					var data = rc.join("\n");
+					transferData.setData("wired-marker/object", data);
+				}
+			}
+		}catch(ex){
+			bitsItemView._dump("bitsItemView.onDragStart():"+ex);
+		}
+	},
+
+	onDropEvents: function(aEvent){
+		switch(aEvent.type){
+			case "dragenter":
+			case "dragover":
+				aEvent.preventDefault();
+				break;
+			case "drop":
+				aEvent.preventDefault();
+				var data = null;
+				var supportedTypes = ["text/x-moz-url", "text/url-list", "text/plain", "application/x-moz-file"];
+				var types = aEvent.dataTransfer.types;
+				types = supportedTypes.filter(function(value){ return types.contains(value);});
+				if(types.length){
+					data = aEvent.dataTransfer.getData(types[0]);
+					if(!data) data = aEvent.dataTransfer.mozGetDataAt(types[0],0);
+				}
+				if(data){
+					if(types[0] == "application/x-moz-file" && data instanceof Components.interfaces.nsIFile){
+						var urlString = bitsItemView.Common.convertFilePathToURL(data.path);
+						bitsItemView.capture(urlString);
+					}else{
+						if(
+							bitsItemView.originalTarget &&
+							bitsItemView.originalTarget.nodeName == "IMG" &&
+							bitsItemView.originalTarget.hasAttribute('oid') &&
+							bitsItemView.originalTarget.hasAttribute('dbtype') &&
+							bitsItemView.originalTarget.hasAttribute('pfid')){
+							var oid = bitsItemView.originalTarget.getAttribute('oid');
+							var dbtype = bitsItemView.originalTarget.getAttribute('dbtype');
+							var pfid = bitsItemView.originalTarget.getAttribute('pfid');
+							var dstRes = mcTreeHandler.resource;
+							if(dstRes){
+								var dst_fid = mcTreeDNDHandler.DataSource.getProperty(dstRes,"id");
+								var dst_dbtype = mcTreeDNDHandler.DataSource.getProperty(dstRes,"dbtype");
+								if(dst_fid == pfid && dst_dbtype == dbtype) return;
+								var srcObjects = bitsItemView.Database.getObject({oid:oid}, dbtype);
+								var mergeRtn = window.top.bitsTreeListService.mergeObject({fid:dst_fid,dbtype:dst_dbtype},srcObjects[0]);
+								if(mergeRtn) return;
+								var rtnObj = null;
+								if(dbtype == window.top.bitsMarkingCollection._uncategorized.dbtype || mcTreeDNDHandler.modShift){
+									rtnObj = window.top.bitsTreeListService.moveObject({fid:dst_fid,dbtype:dst_dbtype},srcObjects[0],true);
+								}else{
+									rtnObj = window.top.bitsTreeListService.copyObject({fid:dst_fid,dbtype:dst_dbtype},srcObjects[0]);
+								}
+								setTimeout(function(){
+									var viewmode = mcTreeViewModeService.viewmode;
+									mcItemView._bitsItemView.onTreeClick({viewmode:viewmode,fid:dst_fid,dbtype:dst_dbtype,res:dstRes});
+									window.top.bitsTreeListService.reload(bitsItemView.originalTarget.ownerDocument);
+									bitsItemView.originalTarget = null;
+								},0);
+							}
+						}else{
+							bitsItemView.capture(data);
+						}
+					}
+				}
+				break;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onBrowserMousedown : function(aEvent){
+		try{ bitsItemView.rangeParent = aEvent.rangeParent; }catch(ex){}
+		try{ bitsItemView.originalTarget = aEvent.originalTarget; }catch(ex){}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	capture : function(aXferString, aRow, aOrient){
+		var aXferStringArr = aXferString.split("\n");
+		var url = aXferStringArr[0];
+		var url_title = aXferStringArr[1];
+		if(!url_title || url == url_title) url_title = "";
+		if(!this._info) return;
+		var fid;
+		var dbtype;
+		var fid_style;
+		if(!this._info.res){
+			return;
+		}else{
+			fid = this.DataSource.getProperty(this._info.res, "id");
+			dbtype = this.DataSource.getProperty(this._info.res, "dbtype");
+			fid_style = this.DataSource.getProperty(this._info.res, "style");
+		}
+		var win = this.Common.getFocusedWindow();
+		var sel = win.getSelection();
+		var isSelected = false;
+		try{
+			isSelected = ( sel.anchorNode === sel.focusNode && sel.anchorOffset == sel.focusOffset ) ? false : true;
+			if(isSelected && aXferStringArr.length != 1) isSelected = false;
+			if(isSelected && win.document.contentType == "application/pdf") isSelected = false;
+		}catch(e){}
+		var newResArr;
+		if(isSelected){
+			newResArr =  window.top.bitsMarkingCollection.addSelectedText({fid:fid,fid_style:fid_style,dbtype:dbtype},aOrient,aRow);
+		}else{
+			if(url.indexOf("http://")  == 0 ||
+				 url.indexOf("https://") == 0 ||
+				 url.indexOf("ftp://")   == 0 ||
+				 url.indexOf("file://")  == 0){
+				if(this.originalTarget){
+					//æ¢ã«Targetãèš­å®ãããŠããå Žåãã«ã¬ã³ãã®ãã­ã¥ã¡ã³ãã®ãã®ãããã§ãã¯
+					if(this.originalTarget.ownerDocument != this.gBrowser.contentDocument){
+						var win = this.gBrowser.contentWindow;
+						if(win.frames != null){
+							var i;
+							for(i=0;i<win.frames.length;i++){
+								if(this.originalTarget.ownerDocument == win.frames[i].document) break;
+							}
+							if(i>=win.frames.length) this.originalTarget=null;
+						}else{
+							this.originalTarget=null;
+						}
+					}
+				}
+				var tmpOriginalTarget = this.originalTarget;
+				while(tmpOriginalTarget && (tmpOriginalTarget.nodeName != "A" && tmpOriginalTarget.nodeName != "IMG")){
+					tmpOriginalTarget = tmpOriginalTarget.parentNode;
+				}
+				if(tmpOriginalTarget) this.originalTarget = tmpOriginalTarget;
+				newResArr = window.top.bitsMarkingCollection.addURLText({fid:fid,fid_style:fid_style,dbtype:dbtype},aOrient, aRow, aXferString, this.originalTarget);
+			}else{
+				isSelected = false;
+				try{
+					isSelected = ( sel.anchorNode === sel.focusNode && sel.anchorOffset == sel.focusOffset ) ? false : true;
+					if(isSelected && win.document.contentType == "application/pdf") isSelected = false;
+				}catch(ex){}
+				if(isSelected){
+					newResArr =  window.top.bitsMarkingCollection.addSelectedText({fid:fid,fid_style:fid_style,dbtype:dbtype},aOrient,aRow);
+				}else{
+					setTimeout(function(){
+						var rtn = window.top.bitsMarkingCollection.addPDFText({fid:fid,fid_style:fid_style,dbtype:dbtype},aOrient, aRow, aXferString);
+						if(!rtn) window.top.bitsMarkingCollection.Common.alert(mcMainService.STRING.getString("ERROR_INVALID_URL") + "\n" + aXferStringArr);
+					},0);
+				}
+			}
+		}
+		return {isSelected : isSelected, resArr : newResArr};
+	},
+
+/////////////////////////////////////////////////////////////////////
+	refresh : function(){
+		if(this._refresh_timer) clearTimeout(this._refresh_timer);
+		this._refresh_timer = setTimeout(function(){ bitsItemView._refresh(); },100);
+	},
+	_refresh : function(){
+		if(!this._refreshFlag) return;
+		var idx = this.TREE.currentIndex;
+		var rows = this.getSelection();
+		this.rebuild(this._info);
+		try{this.TREE.currentIndex=idx;}catch(e){}
+		if(!this.itemObjects) return;
+		try{
+			var i;
+			for(i=0;i<rows.length;i++){
+				if(!this.TREE.view.selection.isSelected(rows[i])) this.TREE.view.selection.select(rows[i]);
+			}
+			if(this.itemObjects[idx]){
+				var objs = this.Database.getObject({oid:this.itemObjects[idx].oid}, this.itemObjects[idx].dbtype);
+				if(objs && objs.length>0) mcPropertyView.dispProperty(objs[0]);
+			}
+		}catch(e){}
+		window.top.bitsAutocacheService.refresh();
+	},
+
+	rebuild : function(aInfo){
+		try{this.TREE.currentIndex = -1;}catch(e){}
+		try{this.TREE.view.selection.clearSelection();}catch(e){}
+		if(this.itemObjects){
+			this.itemObjects.length = 0;
+			this.itemObjects = undefined;
+		}
+		this.TREE.removeAttribute("flex");
+		var folderFilterHash = {};
+		var tmpFolderFilter = nsPreferences.copyUnicharPref("wiredmarker.filter.folder","");
+		var tmpFolderFilterArr = tmpFolderFilter.split("\t");
+		var i;
+		for(i=0;i<tmpFolderFilterArr.length;i++){
+			if(!tmpFolderFilterArr[i].match(/^(\d+):(\d+):(.+)$/)) continue;
+			var filter_fid = RegExp.$1;
+			var filter_casesensitive = RegExp.$2;
+			var filter_keyword = RegExp.$3;
+			folderFilterHash[filter_fid] = new RegExp(filter_keyword,(filter_casesensitive==1)?"mg":"img");
+		}
+		tmpFolderFilterArr = undefined;
+		tmpFolderFilter = undefined;
+		if(aInfo){
+			var viewmode = aInfo.viewmode;
+			var fid = (aInfo.fid?parseInt(aInfo.fid):undefined);
+			this.dbtype = aInfo.dbtype;
+			var viewtype = "small";
+			if(fid != undefined && !isNaN(fid)){
+				var info = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
+				if(parseInt(info.version)>2){
+					var folders = this.Database.getFolderFormID(fid, this.dbtype);
+					if(folders && folders.length>0 && folders[0].fid_property){
+						var parser = new DOMParser();
+						var xmldoc = parser.parseFromString(folders[0].fid_property, "text/xml");
+						parser = undefined;
+						var iconsize = xmldoc.getElementsByTagName("ICON_SIZE")[0];
+						if(iconsize) viewtype = iconsize.textContent
+					}
+				}
+			}
+			this.TREE.treeBoxObject.clearStyleAndImageCaches();
+			if(viewtype == "large"){
+				this.TREE_IFAVICON.setAttribute("style","min-width:77px;max-width:77px;");
+				this.TREE.setAttribute("class","plain bitsItemTree-largeicon");
+				this.VTTB.setAttribute("label","Large ");
+				this.VTMM.removeAttribute("checked");
+				this.VTSM.removeAttribute("checked");
+				this.VTLM.setAttribute("checked","true");
+			}else if(viewtype == "middle"){
+				this.TREE_IFAVICON.setAttribute("style","min-width:43px;max-width:43px;");
+				this.TREE.setAttribute("class","plain bitsItemTree-middleicon");
+				this.VTTB.setAttribute("label","Middle ");
+				this.VTLM.removeAttribute("checked");
+				this.VTSM.removeAttribute("checked");
+				this.VTMM.setAttribute("checked","true");
+			}else{
+				this.TREE_IFAVICON.setAttribute("style","min-width:25px;max-width:25px;");
+				this.TREE.setAttribute("class","plain");
+				this.VTTB.setAttribute("label","Small ");
+				this.VTLM.removeAttribute("checked");
+				this.VTMM.removeAttribute("checked");
+				this.VTSM.setAttribute("checked","true");
+			}
+			if(fid != undefined && !isNaN(fid)){
+				if(viewmode == "all"){
+					this.itemObjects = this.Database.getObject({pfid:fid}, this.dbtype);
+				}else{
+					var doc_url = window.top.bitsAutocacheService.convertCacheURLToOriginalURL(this.Common.getURLStringFromDocument(this.gBrowser.contentDocument));
+					this.itemObjects = this.Database.getObject({pfid:fid,doc_url:doc_url}, this.dbtype);
+				}
+			}else if(isNaN(fid) && aInfo.fid == bitsSearchAcross.id){
+				fid = aInfo.fid;
+				var findRegExp = new RegExp(bitsSearchAcross.value,"img");
+				if(viewmode == "all"){
+					this.itemObjects = this.Database.findObject(findRegExp);
+				}else{
+					var doc_url = window.top.bitsAutocacheService.convertCacheURLToOriginalURL(this.Common.getURLStringFromDocument(this.gBrowser.contentDocument));
+					this.itemObjects = this.Database.findObject(findRegExp,undefined,{doc_url:doc_url});
+				}
+			}else if(aInfo.where){
+				var param = {};
+				for(var i=0;i<aInfo.where.length;i++){
+					param[aInfo.where[i].key] = aInfo.where[i].val;
+				}
+				if(viewmode != "all") param.doc_url = window.top.bitsAutocacheService.convertCacheURLToOriginalURL(this.Common.getURLStringFromDocument(this.gBrowser.contentDocument));
+				this.itemObjects = this.Database.getObject(param, this.dbtype);
+			}
+			this.TREE.setAttribute("flex","1");
+			if(this.itemObjects && folderFilterHash[fid]){
+				this.itemObjects = this.itemObjects.filter(
+					function(element, index, array) {
+						return folderFilterHash[fid].test(element.oid_title);
+					}
+				);
+			}
+			if(this.itemObjects && this.VSB.checked && this.VSM.value != ""){
+				if(this.TREE_INOTE.hidden){
+					this.itemObjects = this.itemObjects.filter(
+						function(element, index, array) {
+							return (new RegExp(bitsItemView.VSM.value,"img")).test(element.oid_title);
+						}
+					);
+				}else{
+					var domParser = new DOMParser();
+					this.itemObjects = this.itemObjects.filter(
+						function(element, index, array) {
+							if(element.oid_note == undefined && element.oid_property && element.oid_property != ""){
+								var xmldoc = domParser.parseFromString(element.oid_property, "text/xml");
+								if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+								if(xmldoc){
+									var xmlnode = xmldoc.getElementsByTagName("NOTE")[0];
+									if(xmlnode) element.oid_note = xmlnode.textContent;
+								}
+								if(element.oid_note == undefined) element.oid_note = "";
+								if(element.oid_note != ""){
+									var oid_note = element.oid_note;
+									oid_note = oid_note.replace(/[\r\n]+/mg, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+									element.oid_note = oid_note;
+								}
+							}
+							var value = bitsItemView.VSM.value;
+							return (new RegExp(value,"img")).test(element.oid_title) || (new RegExp(value,"img")).test(element.oid_note);
+						}
+					);
+					domParser = undefined;
+				}
+			}
+			if(this.itemObjects){
+				var self = this;
+				this.itemObjects.sort(
+					function(a,b){
+						var direction = "";
+						if(bitsTreeDate.isChecked){
+							var a_date = Date.parse(a.oid_date);
+							var b_date = Date.parse(b.oid_date);
+							if(a_date < b_date) return -1;
+							if(a_date > b_date) return 1;
+							var a_order = (a.folder_order?parseInt(a.folder_order):0);
+							var b_order = (b.folder_order?parseInt(b.folder_order):0);
+							if(a_order < b_order) return -1;
+							if(a_order > b_order) return 1;
+							return 0;
+						}else if(
+							self.TREE_IFAVICON.hasAttribute("sortDirection") ||
+							self.TREE_IURL.hasAttribute("sortDirection")
+						){
+							if(self.TREE_IFAVICON.hasAttribute("sortDirection")){
+								direction = self.TREE_IFAVICON.getAttribute("sortDirection");
+							}else if(self.TREE_IURL.hasAttribute("sortDirection")){
+								direction = self.TREE_IURL.getAttribute("sortDirection");
+							}
+							if(direction == "ascending"){
+								if(a.doc_url < b.doc_url) return -1;
+								if(a.doc_url > b.doc_url) return 1;
+							}else if(direction == "descending"){
+								if(a.doc_url < b.doc_url) return 1;
+								if(a.doc_url > b.doc_url) return -1;
+							}
+						}else if(self.TREE_IDOCTITLE.hasAttribute("sortDirection")){
+							direction = self.TREE_IDOCTITLE.getAttribute("sortDirection");
+							if(direction == "ascending"){
+								if(a.doc_title < b.doc_title) return -1;
+								if(a.doc_title > b.doc_title) return 1;
+							}else if(direction == "descending"){
+								if(a.doc_title < b.doc_title) return 1;
+								if(a.doc_title > b.doc_title) return -1;
+							}
+						}else if(self.TREE_ITITLE.hasAttribute("sortDirection")){
+							direction = self.TREE_ITITLE.getAttribute("sortDirection");
+							if(direction == "ascending"){
+								if(a.oid_title < b.oid_title) return -1;
+								if(a.oid_title > b.oid_title) return 1;
+							}else if(direction == "descending"){
+								if(a.oid_title < b.oid_title) return 1;
+								if(a.oid_title > b.oid_title) return -1;
+							}
+						}else if(self.TREE_IDATE.hasAttribute("sortDirection")){
+							direction = self.TREE_IDATE.getAttribute("sortDirection");
+							var a_date = Date.parse(a.oid_date);
+							var b_date = Date.parse(b.oid_date);
+							if(direction == "ascending"){
+								if(a_date < b_date) return -1;
+								if(a_date > b_date) return 1;
+							}else if(direction == "descending"){
+								if(a_date < b_date) return 1;
+								if(a_date > b_date) return -1;
+							}
+						}
+						return 0;
+					}
+				);
+			}
+		}else if(this._info){
+			var viewmode = this._info.viewmode;
+			var fid = (this._info.fid?parseInt(this._info.fid):undefined);
+			if(fid && this._info.dbtype){
+				this.TREE.setAttribute("flex","1");
+			}
+		}
+		if(this.TREE.hasAttribute("flex")){
+			var self = this;
+			self.TREE.view = self;
+			self.TREE.removeAttribute("hidden");
+			if(this._app_version>2) self.VTTB.removeAttribute("disabled");
+			self.VSB.removeAttribute("disabled");
+			if(self.VSB.hasAttribute("checked")) self.VSM.removeAttribute("disabled");
+		}else{
+			this.VTTB.setAttribute("disabled",true);
+			this.VSB.setAttribute("disabled",true);
+			this.VSM.setAttribute("disabled",true);
+			this.TREE.setAttribute("hidden",true);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+// TREE ã€ãã³ãé¢é£
+/////////////////////////////////////////////////////////////////////
+	onMousedown : function(aEvent){
+		mcTreeImageTooltip.onMousedown(aEvent);
+		if(aEvent.button == 2){ //å³ã¯ãªãã¯
+			var row = {};
+			var col = {};
+			var obj = {};
+			this.TREE.treeBoxObject.getCellAt(aEvent.clientX, aEvent.clientY, row, col, obj);
+			if(row.value>=0){
+				this.POPUP.removeAttribute("hidden");
+			}else{
+				this.POPUP.setAttribute("hidden","true");
+			}
+			return;
+		}
+	},
+
+	onMousemove : function(aEvent){
+		var param = {
+			tree : bitsItemView.TREE
+		};
+		try {
+			var row = {};
+			var col = {};
+			var childElt = {};
+			param.tree.treeBoxObject.getCellAt(aEvent.clientX, aEvent.clientY, row, col, childElt);
+			if(row.value == undefined || col.value == undefined){
+			}else{
+				param.row = row;
+				param.col = col;
+				param.childElt = childElt;
+				if(mcTreeImageTooltip.tooltipRow != row.value){
+					if(row.value>=0) param.obj = bitsItemView.itemObjects[row.value];
+				}
+			}
+		}catch(e){}
+		mcTreeImageTooltip.onMousemove(aEvent,param);
+	},
+
+	onMouseout : function(aEvent){
+		mcTreeImageTooltip.onMouseout(aEvent);
+	},
+
+	onClick : function(aEvent){
+		if(aEvent.button != 0) return;
+		if(aEvent.altKey || aEvent.shiftKey || aEvent.ctrlKey) return;
+		if(aEvent.target.id){
+			if(aEvent.target.id == this.idTREE) return;
+			if(aEvent.target.id != this.idTREE_IFAVICON)  this.TREE_IFAVICON.removeAttribute("sortDirection");
+			if(aEvent.target.id != this.idTREE_IURL)      this.TREE_IURL.removeAttribute("sortDirection");
+			if(aEvent.target.id != this.idTREE_IDOCTITLE) this.TREE_IDOCTITLE.removeAttribute("sortDirection");
+			if(aEvent.target.id != this.idTREE_ITITLE)    this.TREE_ITITLE.removeAttribute("sortDirection");
+			if(aEvent.target.id != this.idTREE_IDATE)     this.TREE_IDATE.removeAttribute("sortDirection");
+			if(aEvent.target.id != this.idTREE_INOTE)     this.TREE_INOTE.removeAttribute("sortDirection");
+			if(!aEvent.target.hasAttribute("sortDirection")){
+				aEvent.target.setAttribute("sortDirection","ascending");
+			}else if(aEvent.target.getAttribute("sortDirection") == "ascending"){
+				aEvent.target.setAttribute("sortDirection","descending");
+			}else{
+				aEvent.target.removeAttribute("sortDirection");
+			}
+			this.refresh();
+			return;
+		}
+		var row = {};
+		var col = {};
+		var obj = {};
+		this.TREE.treeBoxObject.getCellAt(aEvent.clientX, aEvent.clientY, row, col, obj);
+//		try{ if(col.value.id == this.idTREE_INOTE) return; }catch(e){}
+		if(row.value<0){
+			this.TREE.view.selection.clearSelection();
+			return;
+		}
+		if(this.itemObjects && this.itemObjects[row.value]){
+			var objs = this.Database.getObject({oid:this.itemObjects[row.value].oid}, this.itemObjects[row.value].dbtype);
+			if(objs && objs.length>0) mcPropertyView.dispProperty(objs[0]);
+		}
+		//ããŸããªã
+		this.TREE.blur();
+		this.TREE.focus();
+		return;
+		this.open();
+	},
+
+	onDblClick : function(aEvent){
+		if(aEvent.button != 0) return;
+		if(aEvent.altKey || aEvent.shiftKey || aEvent.ctrlKey) return;
+		if(aEvent.target.id == this.idTREE_ITITLE){
+			return;
+		}else if(aEvent.target.id == this.idTREE_IDATE){
+			return;
+		}
+		var row = {};
+		var col = {};
+		var obj = {};
+		this.TREE.treeBoxObject.getCellAt(aEvent.clientX, aEvent.clientY, row, col, obj);
+		try{ if(col.value.id == this.idTREE_INOTE) return; }catch(e){}
+		if(row.value<0){
+			this.TREE.view.selection.clearSelection();
+			return;
+		}
+		this.open();
+	},
+
+	onKeyPress : function(aEvent){
+		switch(aEvent.keyCode){
+			case aEvent.DOM_VK_RETURN :
+				aEvent.preventDefault();
+				this.open(aEvent.ctrlKey);
+				break;
+			case aEvent.DOM_VK_DELETE :
+				if(!(aEvent.ctrlKey || aEvent.shiftKey)){
+					aEvent.preventDefault();
+					this.remove(aEvent);
+				}
+				break;
+			case aEvent.DOM_VK_F2 :
+				aEvent.preventDefault();
+				this.property();
+				break;
+			default:
+				break;
+		}
+	},
+
+	onKeyDown : function(aEvent){
+		switch(aEvent.keyCode){
+			case aEvent.DOM_VK_A :
+				if(aEvent.ctrlKey){
+					aEvent.preventDefault();
+					this.TREE.view.selection.selectAll();
+				}
+				break;
+			default:
+				break;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+// TREE é¢é£
+/////////////////////////////////////////////////////////////////////
+	copy : function(aMode){
+		if(this.TREE.currentIndex<0) return;
+		var row = this.TREE.currentIndex;
+		if(!this.itemObjects[row]) return;
+		var aObject = this.itemObjects[row];
+		if(!aMode) aMode = 'copy';
+		window.top.bitsMetaCapture.copyToClipBoard(aObject.oid,aObject.dbtype,aMode);
+	},
+
+	open : function(tabbed){
+		if(this.TREE.currentIndex<0) return;
+		var row = this.TREE.currentIndex;
+		if(!this.itemObjects[row]) return;
+		var aObject = this.itemObjects[row];
+		this.Common.loadFromObject(aObject,tabbed);
+	},
+
+	confirmRemovingFor : function(){
+		try{
+			if(this.confirmDelete){
+				return this.Common.confirm( this.STRING.getString("CONFIRM_DELETE") );
+			}
+			return true;
+		}catch(e){
+			return false;
+		}
+	},
+
+	setSelection : function(aOID,aDBTYPE){
+		try{this.TREE.view.selection.clearSelection();}catch(e){}
+		if(!this.itemObjects) return;
+		try{
+			var row;
+			for(row=0;row<this.itemObjects.length;row++){
+				if(this.itemObjects[row].oid != aOID || this.itemObjects[row].dbtype != aDBTYPE) continue;
+				this.TREE.currentIndex = row;
+				if(this.TREE.view && !this.TREE.view.selection.isSelected(this.TREE.currentIndex)) this.TREE.view.selection.select(this.TREE.currentIndex);
+				this.TREE.treeBoxObject.ensureRowIsVisible(this.TREE.currentIndex);
+				this.TREE.focus();
+				mcPropertyView.dispProperty(this.itemObjects[row]);
+				break;
+			}
+		}catch(e){
+			this._dump("bitsItemView.setSelection():"+e);
+		}
+	},
+
+	getSelection : function(){
+		if(!this.TREE || !this.TREE.view) return undefined;
+		var ret = [];
+		var rc;
+		var i;
+		for(rc=0;rc<this.TREE.view.selection.getRangeCount();rc++){
+			var start = {}, end = {};
+			this.TREE.view.selection.getRangeAt(rc, start, end);
+			for(i=start.value;i<= end.value;i++){
+				if(!this.TREE.view.selection.isSelected(i)) continue;
+				ret.push(i);
+			}
+		}
+		return ret;
+	},
+
+	validateMultipleSelection : function(aIdxList){
+		if(aIdxList.length != this.TREE.view.selection.count){
+			this.Common.alert(this.STRING.getString("ERROR_MULTIPLE_SELECTION"));
+			return false;
+		}
+		return true;
+	},
+
+	mergeObject : function(aFolder){
+		if(this.TREE.view.selection.count == 0) return false;
+		var idxList = this.getSelection();
+		if(this.validateMultipleSelection(idxList) == false) return false;
+		window.top.bitsScrapPartyMergeService._isCancel = false;
+		window.top.bitsScrapPartyMergeService._isSameprocessing = false;
+		window.top.bitsScrapPartyMergeService._isMergeMode = 0;
+		window.top.bitsScrapPartyMergeService._isConfirm = false;
+		var mergeRtn = 0;
+		var i;
+		var mergeFlag = false;
+		for(i=0;i<idxList.length;i++){
+			var row = idxList[i];
+			if(!this.itemObjects[row]) continue;
+			var aObject = this.itemObjects[row];
+			var dstObjects = this.Database.getObject({pfid:aFolder.fid,oid_title:aObject.oid_title}, aFolder.dbtype);
+			if(!dstObjects || dstObjects.length == 0) continue;
+			mergeFlag = true;
+			break;
+		}
+		if(!mergeFlag) return mergeRtn;
+		for(i=0;i<idxList.length;i++){
+			var row = idxList[i];
+			if(!this.itemObjects[row]) continue;
+			var aObject = this.itemObjects[row];
+			mergeRtn |= window.top.bitsScrapPartyMergeService._merge(aObject,aFolder);
+			if(window.top.bitsScrapPartyMergeService.cancel) return -1;
+		}
+		return mergeRtn;
+	},
+
+	copyObject : function(aFolder){
+		if(this.TREE.view.selection.count == 0) return false;
+		var idxList = this.getSelection();
+		if(this.validateMultipleSelection(idxList) == false) return false;
+		var pfid = aFolder.fid;
+		var pdbtype = aFolder.dbtype;
+		var pfid_order = this.Database.getMaxOrderFormPID(aFolder.fid,aFolder.dbtype);
+		var exists = false;
+		var i;
+		for(i=0;i<idxList.length;i++){
+			var row = idxList[i];
+			if(!this.itemObjects[row]) continue;
+			var aObject = this.itemObjects[row];
+			var rtn = this.Database.existsObject({oid:aObject.oid,pfid:aFolder.fid},aFolder.dbtype);
+			if(rtn){
+				exists = rtn;
+				continue;
+			}
+			if(aObject.dbtype == aFolder.dbtype){
+				rtn = this.Database.addLink({oid:aObject.oid,pfid:aFolder.fid,pfid_order:++pfid_order},aFolder.dbtype);
+			}else{
+				var objs = this.Database.getObjectWithProperty({oid:aObject.oid,pfid:aObject.pfid},aObject.dbtype);
+				var blobs =this.Database.getObjectBLOB(aObject.oid,aObject.dbtype);
+				if(objs && objs.length>0) aObject = objs[0];
+				var addObj = this.Database.newObject(aObject.oid,aFolder.dbtype);
+				var key;
+				for(key in aObject){
+					if(key == "oid") continue;
+					addObj[key] = aObject[key];
+				}
+				addObj.pfid = aFolder.fid;
+				delete addObj.dbtype;
+				delete addObj.fid_style;
+				rtn = this.Database.addObject(addObj,aFolder.dbtype);
+				if(rtn){
+					if(blobs && blobs.length>0){
+						this.Database.updateObjectBLOB(addObj.oid,blobs[0],aFolder.dbtype);
+					}
+				}
+			}
+		}
+		if(exists){
+			this.Common.alert(mcMainService.STRING.getString("ALERT_COPYOBJECT_EXISTS"));
+		}
+		return true;
+	},
+
+	moveObject : function(aFolder,aModShift){
+		try{
+			if(aModShift == undefined) aModShift = false;
+			if(this.TREE.view.selection.count == 0) return false;
+			var idxList = this.getSelection();
+			if(this.validateMultipleSelection(idxList) == false) return false;
+			var update = false;
+			var i;
+			for(i=0;i<idxList.length;i++){
+				var row = idxList[i];
+				if(!this.itemObjects[row]) continue;
+				var aObject = this.itemObjects[row];
+				if(update == false && aObject.dbtype == aFolder.dbtype && this.Database.existsObject({oid:aObject.oid,pfid:aFolder.fid},aFolder.dbtype)){
+					if(this.Common.confirm(this.STRING.getString("CONFIRM_COPYOBJECT_OVERWRITE"))){
+						update = true;
+					}else{
+						return false;
+					}
+				}
+				if(update && aObject.dbtype == aFolder.dbtype && this.Database.existsObject({oid:aObject.oid,pfid:aFolder.fid},aFolder.dbtype)){
+					rtn = this.Database.removeLink({oid:aObject.oid,pfid:aFolder.fid},aFolder.dbtype);
+				}
+			}
+			var rtn;
+			for(i=0;i<idxList.length;i++){
+				var row = idxList[i];
+				if(!this.itemObjects[row]) continue;
+				rtn = this._moveObject(aFolder,this.itemObjects[row],aModShift);
+			}
+			this.refresh();
+			return true;
+		}catch(e){
+			this._dump("bitsItemView.moveObject():"+e);
+			return false;
+		}
+	},
+
+	_moveObject : function(aFolder,aObject,aModShift){
+		var rtn;
+		var pfid_order = this.Database.getMaxOrderFormPID(aFolder.fid,aFolder.dbtype);
+		var old_source = bitsMarker.id_key+aObject.dbtype+aObject.oid;
+		var new_source = bitsMarker.id_key;
+		if(aObject.dbtype == aFolder.dbtype){
+			rtn = this.Database.updateObject({oid:aObject.oid,pfid:aFolder.fid,pfid_old:aObject.pfid,pfid_order:++pfid_order},aFolder.dbtype);
+			new_source += aFolder.dbtype+aObject.oid;
+		}else{
+			var objs = this.Database.getObjectWithProperty({oid:aObject.oid,pfid:aObject.pfid},aObject.dbtype);
+			var blobs =this.Database.getObjectBLOB(aObject.oid,aObject.dbtype);
+			if(objs && objs.length>0) aObject = objs[0];
+			var addObj = this.Database.newObject(aObject.oid,aFolder.dbtype);
+			var key;
+			for(key in aObject){
+				if(key == "oid") continue;
+				addObj[key] = aObject[key];
+			}
+			addObj.pfid = aFolder.fid;
+			addObj.pfid_order = ++pfid_order;
+			delete addObj.dbtype;
+			delete addObj.fid_style;
+			rtn = this.Database.addObject(addObj,aFolder.dbtype);
+			if(rtn && blobs && blobs.length>0) this.Database.updateObjectBLOB(addObj.oid,blobs[0],aFolder.dbtype);
+			if(rtn && aModShift) rtn = this.Database.removeObject(aObject,aObject.dbtype);
+			new_source += aFolder.dbtype+addObj.oid;
+		}
+		var i;
+		for(i=0;i<this.gBrowser.browsers.length;i++){
+			var contentDocument = this.gBrowser.browsers[i].contentDocument;
+			var contentWindow = this.gBrowser.browsers[i].contentWindow;
+			var DOC = [];
+			if(contentWindow.frames){
+				var wincnt;
+				for(wincnt=0;wincnt<contentWindow.frames.length;wincnt++){
+					DOC.push(contentWindow.frames[wincnt].document);
+				}
+			}
+			DOC.push(contentDocument);
+			var j;
+			for(j=0;j<DOC.length;j++){
+				var doc = DOC[j];
+				var xPathResult = this.XPath.evaluate('//*[@id="'+old_source+'"]', doc);
+				var k;
+				for(k=xPathResult.snapshotLength-1;k>=0;k--){
+					var node = xPathResult.snapshotItem(k);
+					node.setAttribute("pfid", aFolder.fid);
+					node.setAttribute("style",aFolder.fid_style);
+					node.setAttribute("dbtype",aFolder.dbtype);
+					node.setAttribute("id",new_source);
+				}
+			}
+			DOC = undefined;
+		}
+		return rtn;
+	},
+
+	remove : function(aEvent){
+		if(this.TREE.view.selection.count == 0) return false;
+		if(!this.confirmRemovingFor()) return false;
+		if(aEvent) window.top.bitsScrapPartyAddonService.eventListener(aEvent, 0);
+		var idxList = this.getSelection();
+		if(this.validateMultipleSelection(idxList) == false) return false;
+		var i;
+		for(i=0;i<idxList.length;i++){
+			var row = idxList[i];
+			if(!this.itemObjects[row]) continue;
+			var aObject = this.itemObjects[row];
+			var match_exp = new RegExp("^"+bitsMarker.id_key+".+$","m");
+			var source;
+			if(!aObject.oid_type.match(/^image\/(.+)$/)) source = bitsMarker.id_key+aObject.dbtype+aObject.oid;
+			if(source) bitsMarker.unmarkerWindow(source);
+			var id = aObject.oid;
+			var dbtype = aObject.dbtype;
+			var pfid = aObject.pfid;
+			this.Database.removeObject({oid:id,pfid:pfid},dbtype,false);
+		}
+		this.refresh();
+		mcPropertyView.dispProperty();
+		if(aEvent) window.top.bitsScrapPartyAddonService.eventListener(aEvent, 1);
+		return true;
+	},
+
+	pageshow : function(aDoc){
+
+	},
+
+	property : function(){
+		if(this.TREE.currentIndex<0) return;
+		var row = this.TREE.currentIndex;
+		if(!this.itemObjects[row]) return;
+		var aObject = this.itemObjects[row];
+		var id = aObject.oid;
+		var style = aObject.fid_style;
+		var dbtype = aObject.dbtype;
+		var result = {
+			id       : aObject.oid,
+			title    : aObject.oid_title,
+			property : aObject.oid_property,
+			style    : aObject.fid_style,
+			dbtype   : aObject.dbtype,
+		};
+		window.openDialog("chrome://markingcollection/content/property.xul", "", "chrome,centerscreen,modal", id, result);
+		if(result.accept) this.refresh();
+		return result.accept;
+	},
+
+////////////////////////////////////////////////////////////////////
+// TREE ãã©ãã°ã€ãã³ãé¢é£
+/////////////////////////////////////////////////////////////////////
+	getModifiers : function(aEvent){
+		this.modAlt   = aEvent.altKey;
+		this.modShift = aEvent.shiftKey;
+		this.modCtrl  = aEvent.ctrlKey;
+		this.modMeta  = aEvent.metaKey;
+	},
+
+	dragDropObserver : {
+		onDragStart : function(event, transferData, action){
+			try{
+				if(event.originalTarget.localName != "treechildren") return;
+				var idxList = bitsItemView.getSelection();
+				if(idxList.length>0){
+					transferData.data = new TransferData();
+					var rc = [];
+					var i;
+					for(i=0;i<idxList.length;i++){
+						var oid = bitsItemView.itemObjects[idxList[i]].oid;
+						var dbtype = bitsItemView.itemObjects[idxList[i]].dbtype;
+						rc.push(oid+"\t"+dbtype);
+					}
+					if(rc.length>0){
+						var data = rc.join("\n");
+						transferData.data.addDataForFlavour("wired-marker/object", data);
+					}
+				}
+			}catch(ex){
+				bitsItemView._dump("dragDropObserver.onDragStart():"+ex);
+			}
+		},
+		getSupportedFlavours : function(){
+			bitsItemView._canDrop = false;
+			var flavours = new FlavourSet();
+			flavours.appendFlavour("text/x-moz-url");
+			flavours.appendFlavour("text/html");
+			flavours.appendFlavour("text/xml");
+			flavours.appendFlavour("application/x-moz-url");
+			flavours.appendFlavour("application/x-moz-file","nsIFile");
+			flavours.appendFlavour("text/unicode");
+			return flavours;
+		},
+		onDragOver : function(event, flavour, session){},
+		onDragExit : function(event, session){},
+		onDrop     : function(event, transferData, session){
+			bitsItemView._canDrop = true;
+		},
+	},
+
+/////////////////////////////////////////////////////////////////////
+// Popup ã€ãã³ãé¢é£
+/////////////////////////////////////////////////////////////////////
+	onPopupShowing : function(aEvent){},
+
+	onPopupHiding : function(aEvent){},
+
+	onPopupCommand : function(aEvent){
+		switch(aEvent.target.id){
+			case this.idPOPUP_OPEN:
+				this.open();
+				break;
+			case this.idPOPUP_OPENN:
+				this.open(true);
+				break;
+			case this.idPOPUP_REMOVE:
+				this.remove(aEvent);
+				break;
+			case this.idPOPUP_PROPERTY:
+				this.property();
+				break;
+			case this.idPOPUP_COPY:
+				this.copy();
+				break;
+			case this.idPOPUP_COPYTITLE:
+				this.copy('title');
+				break;
+			case this.idPOPUP_COPYNOTE:
+				this.copy('note');
+				break;
+			case this.idPOPUP_COPYMETA:
+				this.copy('pagetitle');
+				break;
+			case this.idPOPUP_COPYFORMAT:
+				this.copy('format');
+				break;
+			case this.idPOPUP_COPYSETTING:
+				this.copy('setting');
+				break;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onSearchKeyPress : function(aEvent){
+		switch ( aEvent.keyCode ){
+			case aEvent.DOM_VK_RETURN : 
+				this.refresh();
+				break;
+			default:
+				break;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/itemviewSidebarOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/itemviewSidebarOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/itemviewSidebarOverlay.xul	(revision 5703)
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://browser/skin/searchbar.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/content/places/places.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://markingcollection/skin/sidebar.css" type="text/css"?>
+<?xml-stylesheet href="chrome://markingcollection/skin/overlay.css" type="text/css"?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+	id="itemviewOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://global/content/nsJSSupportsUtils.js"/>
+	<script type="application/x-javascript" src="chrome://global/content/nsJSComponentManager.js"/>
+	<script type="application/x-javascript" src="chrome://markingcollection/content/treefavoritefolder.js"/>
+	<script type="application/x-javascript" src="chrome://markingcollection/content/itemview.js"/>
+	<script type="application/x-javascript">
+	<![CDATA[
+	]]>
+	</script>
+	<box id="bitsSidebarBox">
+		<vbox id="bitsSidebarVBox">
+			<toolbox id="mcToolbox">
+				<toolbar id="mcToolbar">
+					<toolbarbutton
+						id="mcToolbarListStyleButton"
+						type="menu"
+						class="menu-iconic"
+						image="chrome://markingcollection/skin/liststyle_rl.png"
+						insertbefore="mcToolbarCreateFolderButton"
+						tooltiptext="&markingcollection.display.style;"
+						align="end" pack="end"
+						oncommand="bitsItemView.onChangeListStyle(event)"
+					>
+						<menupopup id="mcToolbarListStyleMenuPopup">
+							<menuitem id="mcToolbarListStyleRLItem"   label="&markingcollection.display.itemview.lr;"   class="menuitem-iconic" image="chrome://markingcollection/skin/liststyle_rl.png"/>
+							<menuitem id="mcToolbarListStyleTBItem"   label="&markingcollection.display.itemview.tb;"   class="menuitem-iconic" image="chrome://markingcollection/skin/liststyle_tb.png"/>
+							<menuitem id="mcToolbarListStyleNoneItem" label="&markingcollection.display.itemview.none;" class="menuitem-iconic" image="chrome://markingcollection/skin/liststyle_none.png"/>
+						</menupopup>
+					</toolbarbutton>
+					<toolbarbutton
+							insertafter="mcToolbarMenuButton"
+							id="mcToolbarFavoriteFolderButton"
+							type="menu"
+							tooltiptext="&markingcollection.favorite;"
+							class="menu-iconic"
+							image="chrome://markingcollection/skin/folder-star.png"
+							align="center" pack="end"
+							oncommand="mcTreeFavoriteFolder.onClick(event);">
+						<menupopup
+							id="mcToolbarFavoriteFolderPopup"
+							onpopupshowing="mcTreeFavoriteFolder.onPopupShowing(event,this);"
+							onpopuphiding="mcTreeFavoriteFolder.onPopupHiding(event,this);">
+							<menuitem
+								id="bitsFavoriteFolderSelectMenuitem"
+								label="&markingcollection.favorite.select_folder_add;"
+								class="menuitem-iconic bookmark-item"
+								image="chrome://markingcollection/skin/menu_create.png"/>
+							<menuseparator id="bitsFavoriteFolderSelectSeparator"/>
+							<menuitem
+								id="bitsFavoriteFolderAllMenuitem"
+								label="&markingcollection.defaultFolder;"
+								class="menuitem-iconic"
+								image="chrome://markingcollection/skin/folder.png"/>
+							<menuseparator id="bitsFavoriteFolderAllMenuseparator"/>
+						</menupopup>
+					</toolbarbutton>
+				</toolbar>
+			</toolbox>
+		</vbox>
+		<splitter id="bitsBrowserLeftSplitter" class="chromeclass-extrachrome" hidden="true"/>
+		<vbox id="bitsBrowserLeftVBox" hidden="true" persist="height" flex="1">
+			<toolbox id="bitsItemViewToolbox" class="plain" style="overflow:hidden;min-width:10em;width:18em;">
+				<toolbar id="bitsItemViewToolbar" class="plain">
+					<toolbarbutton id="bitsItemViewTypeToolbarbutton" type="menu" label="Size ">
+						<menupopup id="bitsItemViewTypePopup" oncommand="bitsItemView.onViewTypePopupCommand(event)">
+							<menuitem id="bitsItemViewTypeLargeMenuitem" label="Large" type="radio"/>
+							<menuitem id="bitsItemViewTypeMiddleMenuitem" label="Middle" type="radio"/>
+							<menuitem id="bitsItemViewTypeSmallMenuitem" label="Small" type="radio"/>
+						</menupopup>
+					</toolbarbutton>
+					<toolbarbutton id="bitsItemViewSearchButton" class="search-go-button" tooltiptext="&markingcollection.itemview;" oncommand="bitsItemView.onSearchButtonCommand(event)"/>
+					<textbox id="bitsItemViewSearchMenu" editable="true" flex="1" disabled="true" style="font-size:0.9em;margin-left:0px;" onkeypress="bitsItemView.onSearchKeyPress(event)"/>
+					<spacer flex="1" />
+				</toolbar>
+			</toolbox>
+			<tree
+				id="bitsItemTree"
+				contextmenu="bitsItemTreePopup"
+				tooltip="mcPopupTooltip"
+				onmousedown="bitsItemView.onMousedown(event);"
+				onmousemove="bitsItemView.onMousemove(event);"
+				onmouseout="bitsItemView.onMouseout(event);"
+				onclick="bitsItemView.onClick(event);"
+				ondblclick="bitsItemView.onDblClick(event);"
+				onkeypress="bitsItemView.onKeyPress(event);"
+				onkeydown="bitsItemView.onKeyDown(event);"
+				seltype="multiple"
+				editable="true"
+				class="plain"
+				flex="1">
+				<treecols>
+					<treecol id="bitsItemTreeIFolder" label="Folder" flex="17" ignoreincolumnpicker="true" persist="width"/>
+					<treecol id="bitsItemTreeIFolderStyle" label="" ignoreincolumnpicker="true" style="min-width:16px;min-width:16px;"/>
+					<splitter class="tree-splitter"/>
+					<treecol id="bitsItemTreeIFavicon" label="Favicon" crop="none" flex="1" class="treecol-image" src="chrome://markingcollection/skin/defaultFavicon.png" persist="hidden,width" style="min-width:19px;"/>
+					<splitter class="tree-splitter"/>
+					<treecol id="bitsItemTreeIUrl" label="URL" flex="18" hidden="true" persist="hidden,width"/>
+					<splitter class="tree-splitter"/>
+					<treecol id="bitsItemTreeIDocTitle" label="Document Title" flex="18" hidden="true" persist="hidden,width"/>
+					<splitter class="tree-splitter"/>
+					<treecol id="bitsItemTreeITitle" label="Title" flex="18" persist="hidden,width"/>
+					<splitter class="tree-splitter"/>
+					<!-- <treecol id="bitsItemTreeINote" label="Note" flex="18" editable="true" hidden="true" persist="hidden,width"/> -->
+                                        <treecol id="bitsItemTreeINote" label="Annotation" flex="18" editable="true" hidden="true" persist="hidden,width"/>
+					<splitter class="tree-splitter"/>
+					<treecol id="bitsItemTreeIDate"  label="Date" flex="7" persist="hidden,width"/>
+				</treecols>
+				<treechildren/>
+			</tree>
+		</vbox>
+	</box>
+	<popupset id="mcPopupSet">
+		<menupopup
+			id="bitsItemTreePopup"
+			onpopupshowing="bitsItemView.onPopupShowing(event);"
+			onpopuphiding="bitsItemView.onPopupHiding(event);"
+			oncommand="bitsItemView.onPopupCommand(event);">
+			<menuitem
+				id="bitsItemTreePopupOpen"
+				label="&markingcollection.open;"
+				default="true"/>
+			<menuitem
+				id="bitsItemTreePopupOpenNewTab"
+				label="&markingcollection.open.newtab;"/>
+			<menuseparator id="bitsItemTreePopupOpenMenuseparator" observes="bitsItemTreePopupOpen"/>
+			<menuitem
+				id="bitsItemTreePopupRemove"
+				class="menuitem-iconic"
+				label="&markingcollection.remove;"
+				image="chrome://markingcollection/skin/menu_remove.png"/>
+			<menuseparator observes="bitsItemTreePopupRemove"/>
+			<menuitem
+				id="bitsItemTreePopupProperty"
+				class="menuitem-iconic"
+				label="&markingcollection.property;"
+				image="chrome://markingcollection/skin/menu_property.png"/>
+		</menupopup>
+		<menupopup id="mcPopupFavorite" onpopupshowing="mcTreeFavoriteFolder.onPopupFShowing(event);">
+			<menuitem class="menuitem-iconic" label="&markingcollection.remove;" image="chrome://markingcollection/skin/menu_remove.png" oncommand="mcTreeFavoriteFolder.removeFavoriteFolder(event);"/>
+			<menuseparator hidden="true"/>
+			<menuitem class="menuitem-iconic" label="&markingcollection.property;" image="chrome://markingcollection/skin/menu_property.png" disabled="true" hidden="true"/>
+		</menupopup>
+	</popupset>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/listview.xsl
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/listview.xsl	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/listview.xsl	(revision 5703)
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="html" version="4.01" encoding="UTF-8" indent="yes" />
+  <xsl:template match="/">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="LIST">
+    <html>
+      <head>
+        <title><xsl:value-of select="@title" /></title>
+        <script type="text/javascript">
+        <![CDATA[
+          function twisty(elem){
+            var cur_twisty = (elem.src.indexOf("fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII")>=0)?true:false;
+            var childid = elem.getAttribute("childid").split(",");
+            for(var i=0;i<childid.length;i++){
+              var child_elem = document.getElementById(childid[i]);
+              if(!child_elem) continue;
+              child_elem.style.display = cur_twisty?'none':'';
+            }
+            elem.src = cur_twisty ?
+                       "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAChSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAMcGU//z5E4wZGRnhbBgACCAWGOPbt28M6Gx2dnYwDRBAYEX//v1jEBISgiuCsf/+/QumAQIIrOjr168MV69eBQtoa2vD2SBxEAAIIBaY8V++fIGbBGPDrAUIILCiHz9+MIiLi4MFHjx4AFcMEgcBgAACKZpdW/MITzAxzAYIMADnOV3STeCBBwAAAABJRU5ErkJggg==":
+                       "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAACNSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAscCU//z5E8MIdnZ2MA0QQHBF3759w6kIIIDAiv79+8cgJCSEoejv379gGiCAwIq+fv3KcPXqVQxFIHEQAAggFphVX758wVAEcwJAAIEV/fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII=";
+          }
+          function load(aEvent){
+            return;
+            var regexp_png = new RegExp("^data:image/\\w+;base64,");
+            var nodeWalker = document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,false);
+            for(var txtNode=nodeWalker.nextNode();txtNode;txtNode = nodeWalker.nextNode()){
+              if(txtNode.parentNode.nodeName == "TEXTAREA") continue;
+              try{
+                if(txtNode.nodeValue.match(/^(data:image\/\w+;base64,).*/img)){ txtNode.nodeValue = RegExp.$1; }
+              }catch(e){
+                if(regexp_png.test(txtNode.nodeValue)){ txtNode.nodeValue = "data:image/png;base64,"; }
+              }
+              txtNode.nodeValue = txtNode.nodeValue.replace(/([\/&\?])([^\/&\?])/mg,"$1 $2");
+            }
+          }
+        ]]>
+        </script>
+      </head>
+      <body style="margin: 1em;" onload="load(event)">
+        <xsl:apply-templates/>
+      </body>
+    </html>
+  </xsl:template>
+
+  <xsl:template match="FOLDER">
+    <xsl:choose>
+      <xsl:when test="position() = 2">
+        <div>
+          <xsl:attribute name="id">
+            <xsl:value-of select="ID" />
+          </xsl:attribute>
+          <table style="padding:0px;border:1px solid #fc6;" width="100%">
+            <thead>
+              <tr style="background-color:#ffe6b2;"><td colspan="6" style="font-family:arial;font-size:0.9em;font-weight:bold;">
+                <label><xsl:value-of select="FID_TITLE" /></label>
+              </td></tr>
+              <tr style="background-color:#fff7e5;">
+                <td style="font-family:arial;font-size:0.9em;font-weight:bold;border-top:1px solid #fc6;border-right:1px solid #ffe6b2;"><br/></td>
+                <td style="font-family:arial;font-size:0.9em;font-weight:bold;border-top:1px solid #fc6;border-right:1px solid #ffe6b2;">TITLE</td>
+                <td style="font-family:arial;font-size:0.9em;font-weight:bold;border-top:1px solid #fc6;border-right:1px solid #ffe6b2;">NOTE</td>
+                <td style="font-family:arial;font-size:0.9em;font-weight:bold;border-top:1px solid #fc6;border-right:0px solid #ffe6b2;">DATE</td>
+              </tr>
+            </thead>
+            <tbody>
+              <xsl:apply-templates />
+            </tbody>
+          </table>
+        </div>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="FOLDER/FID_TITLE" />
+  <xsl:template match="FOLDER/FID_NOTE" />
+  <xsl:template match="FOLDER/FID_STYLE" />
+  <xsl:template match="FOLDER/ID" />
+  <xsl:template match="FOLDER/CHILDID" />
+
+
+
+  <xsl:template match="OBJECT">
+    <tr>
+      <td nowrap="true" width="5%" align="center" valign="top" style="font-family:arial;font-size:0.7em;border-top:1px solid #fc6;border-right:1px solid #ffe6b2;">
+        <a target="_blank">
+          <xsl:choose>
+            <xsl:when test="HYPER_ANCHOR!=''">
+              <xsl:attribute name="href"><xsl:value-of select="HYPER_ANCHOR" /></xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:attribute name="href"><xsl:value-of select="DOC_URL" /></xsl:attribute>
+            </xsl:otherwise>
+          </xsl:choose>
+          <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAdElEQVR42nXQgQ0AEQwF0Jrpm4mZmEln6rXBoeeaiODlK4F8JRG6VNgXKE2gc0k4UXZwJgJMbcMdpuaugiaqB32hFLwbE1W20ZMP6FGuoxNtozIWtEPWBAADWWQM9kDOMRxXzyQp1kaH63s2eH7JBdJfbfAB7M5JYzCbw3sAAAAASUVORK5CYII=" border="0" style="margin-top:6px;"/>
+        </a>
+      </td>
+      <td width="45%" valign="top" style="font-family:arial;font-size:0.9em;border-top:1px solid #fc6;border-right:1px solid #ffe6b2;">
+        <div style="width:100%;height:100%;min-height:1em;max-height:10em;overflow:auto;" edit="true" dbcolumn="title">
+          <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
+          <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
+          <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
+          <xsl:value-of select="OID_TITLE" />
+        </div>
+      </td>
+      <td width="45%" valign="top" style="font-family:arial;font-size:0.9em;margin-left:1em;border-top:1px solid #fc6;border-right:1px solid #ffe6b2;">
+        <div style="width:100%;height:100%;min-height:1em;max-height:10em;overflow:auto;" edit="true" dbcolumn="note">
+          <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
+          <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
+          <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
+          <xsl:value-of select="OID_NOTE" />
+        </div>
+      </td>
+      <td width="5%" align="right" valign="top" style="font-family:arial;font-size:0.7em;border-top:1px solid #fc6;border-right:0px solid #ffe6b2;">
+        <label><xsl:value-of select="OID_DATE" /></label>
+      </td>
+    </tr>
+  </xsl:template>
+
+</xsl:stylesheet>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/listview_drag.xsl
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/listview_drag.xsl	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/listview_drag.xsl	(revision 5703)
@@ -0,0 +1,263 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="html" version="4.01" encoding="UTF-8" indent="yes" />
+  <xsl:template match="/">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="LIST">
+    <html>
+      <head>
+        <meta name="fid"><xsl:attribute name="content"><xsl:value-of select="@fid"/></xsl:attribute></meta>
+        <meta name="dbtype"><xsl:attribute name="content"><xsl:value-of select="@dbtype"/></xsl:attribute></meta>
+        <meta name="xslpath"><xsl:attribute name="content"><xsl:value-of select="@xslpath"/></xsl:attribute></meta>
+        <meta name="_fileid"><xsl:attribute name="content"><xsl:value-of select="@_fileid"/></xsl:attribute></meta>
+        <title><xsl:value-of select="@title" /></title>
+        <style type="text/css">
+        tr.col_title {
+          background-color:#fff7e5;
+        }
+        tr.col_title td {
+          font-family  : arial;
+          font-size    : 0.9em;
+          font-weight  : bold;
+          border-top   : 1px solid #fc6;
+          border-right : 1px solid #ffe6b2;
+        }
+        td.link {
+          font-family  : arial;
+          font-size    : 0.7em;
+          border-top   : 1px solid #fc6;
+          border-right : 1px solid #ffe6b2;
+        }
+        td.favicon {
+          font-family  : arial;
+          font-size    : 0.7em;
+          border-top   : 1px solid #fc6;
+          border-right : 1px solid #ffe6b2;
+        }
+        td.favicon img{
+          margin-top : 4px;
+          max-width  : 32px;
+          max-height : 32px;
+          border     : 1px solid #f0f0f0;
+          cursor     : pointer;
+        }
+        td.class {
+          font-family  : arial;
+          font-size    : 0.7em;
+          border-top   : 1px solid #fc6;
+          border-right : 1px solid #ffe6b2;
+        }
+        td.class div{
+          margin : 0px 1px;
+          border : 2px solid transparent;
+          float  : left;
+          cursor : pointer;
+          -moz-border-radius: 3px 3px 3px 3px;
+        }
+        td.class div:hover{
+          border : 2px solid #f90;
+        }
+        td.class div span{
+          padding : 0px 2px;
+          -moz-border-radius: 3px 3px 3px 3px;
+        }
+        td.title {
+          font-family  : arial;
+          font-size    : 0.9em;
+          border-top   : 1px solid #fc6;
+          border-right : 1px solid #ffe6b2;
+        }
+        td.title div{
+          width      : 100%;
+          height     : 100%;
+          min-height : 1em;
+          max-height : 10em;
+          overflow   : auto;
+        }
+        td.note {
+          font-family:arial;font-size:0.9em;margin-left:1em;border-top:1px solid #fc6;border-right:1px solid #ffe6b2;
+        }
+        td.note div{
+          width:100%;height:100%;min-height:1em;max-height:10em;overflow:auto;
+        }
+        td.date {
+          font-family:arial;font-size:0.7em;border-top:1px solid #fc6;border-right:0px solid #ffe6b2;
+        }
+        </style>
+        <script type="text/javascript">
+        <![CDATA[
+          function twisty(elem){
+            var cur_twisty = (elem.src.indexOf("fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII")>=0)?true:false;
+            var childid = elem.getAttribute("childid").split(",");
+            for(var i=0;i<childid.length;i++){
+              var child_elem = document.getElementById(childid[i]);
+              if(!child_elem) continue;
+              child_elem.style.display = cur_twisty?'none':'';
+            }
+            elem.src = cur_twisty ?
+                       "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAChSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAMcGU//z5E4wZGRnhbBgACCAWGOPbt28M6Gx2dnYwDRBAYEX//v1jEBISgiuCsf/+/QumAQIIrOjr168MV69eBQtoa2vD2SBxEAAIIBaY8V++fIGbBGPDrAUIILCiHz9+MIiLi4MFHjx4AFcMEgcBgAACKZpdW/MITzAxzAYIMADnOV3STeCBBwAAAABJRU5ErkJggg==":
+                       "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAACNSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAscCU//z5E8MIdnZ2MA0QQHBF3759w6kIIIDAiv79+8cgJCSEoejv379gGiCAwIq+fv3KcPXqVQxFIHEQAAggFphVX758wVAEcwJAAIEV/fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII=";
+          }
+          function load(aEvent){
+            return;
+            var regexp_png = new RegExp("^data:image/\\w+;base64,");
+            var nodeWalker = document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,false);
+            for(var txtNode=nodeWalker.nextNode();txtNode;txtNode = nodeWalker.nextNode()){
+              if(txtNode.parentNode.nodeName == "TEXTAREA") continue;
+              try{
+                if(txtNode.nodeValue.match(/^(data:image\/\w+;base64,).*/img)){ txtNode.nodeValue = RegExp.$1; }
+              }catch(e){
+                if(regexp_png.test(txtNode.nodeValue)){ txtNode.nodeValue = "data:image/png;base64,"; }
+              }
+              txtNode.nodeValue = txtNode.nodeValue.replace(/([\/&\?])([^\/&\?])/mg,"$1 $2");
+            }
+          }
+        ]]>
+        </script>
+      </head>
+      <body style="margin: 1em;" onload="load(event);" oncontextmenu="return false;">
+        <xsl:apply-templates/>
+      </body>
+    </html>
+  </xsl:template>
+
+  <xsl:template match="FOLDER">
+    <xsl:choose>
+      <xsl:when test="position() = 2">
+        <div>
+          <xsl:attribute name="id">
+            <xsl:value-of select="ID" />
+          </xsl:attribute>
+          <table style="padding:0px;border:1px solid #fc6;" width="100%">
+            <thead>
+              <tr style="background-color:#ffe6b2;"><td colspan="6" style="font-family:arial;font-size:0.9em;font-weight:bold;">
+                <label><xsl:value-of select="FID_TITLE" /></label>
+              </td></tr>
+              <tr class="col_title">
+<!--                <td><br/></td>-->
+                <td><br/></td>
+                <td>Class</td>
+                <td>TITLE</td>
+                <td>NOTE</td>
+                <td>DATE</td>
+              </tr>
+            </thead>
+            <tbody>
+              <xsl:apply-templates />
+            </tbody>
+          </table>
+        </div>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="FOLDER/FID_TITLE" />
+  <xsl:template match="FOLDER/FID_NOTE" />
+  <xsl:template match="FOLDER/FID_STYLE" />
+  <xsl:template match="FOLDER/ID" />
+  <xsl:template match="FOLDER/CHILDID" />
+
+
+
+  <xsl:template match="OBJECT">
+    <tr>
+<!--
+      <td nowrap="true" width="1%" align="center" valign="top" class="link">
+        <a target="_blank">
+          <xsl:choose>
+            <xsl:when test="HYPER_ANCHOR!=''">
+              <xsl:attribute name="href"><xsl:value-of select="HYPER_ANCHOR" /></xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:attribute name="href"><xsl:value-of select="DOC_URL" /></xsl:attribute>
+            </xsl:otherwise>
+          </xsl:choose>
+          <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAdElEQVR42nXQgQ0AEQwF0Jrpm4mZmEln6rXBoeeaiODlK4F8JRG6VNgXKE2gc0k4UXZwJgJMbcMdpuaugiaqB32hFLwbE1W20ZMP6FGuoxNtozIWtEPWBAADWWQM9kDOMRxXzyQp1kaH63s2eH7JBdJfbfAB7M5JYzCbw3sAAAAASUVORK5CYII=" border="0" style="margin-top:6px;"/>
+        </a>
+      </td>
+-->
+      <td nowrap="true" width="1%" align="center" valign="top" class="favicon">
+        <a target="_blank">
+          <xsl:choose>
+            <xsl:when test="HYPER_ANCHOR!=''">
+              <xsl:attribute name="href"><xsl:value-of select="HYPER_ANCHOR" /></xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:attribute name="href"><xsl:value-of select="DOC_URL" /></xsl:attribute>
+            </xsl:otherwise>
+          </xsl:choose>
+        <img>
+          <xsl:choose>
+            <xsl:when test="FAVICON!=''">
+              <xsl:attribute name="src"><xsl:value-of select="FAVICON" /></xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:attribute name="src">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAD4SURBVDjLxZMxTsRAFEOdaAU1ogs0XCDKkTgKdBwFcZooJRINK+UGNJtvm2I20WQzEcUWWBppUvj971hT2cY1qnGlDgAwjqMlYT4kQXJz77quKgIkoWma3Sm20ff9/gYkMYNK5rquERF/Ay6NuUji9eNo0hCBCOLt+anaAC6N87ckPNzdQDJI42uM7Qa5ubRBhBJAxjRxDZiz7im1kcyiEeE1YBiGYoV5tRECleKcckDbtku/L+/ffry/XbLOKyu/C2AeIVcEVllFL1MlQEqgIMqA00SQh+JU8QyxEaKLgCmEz+MPQgApkDj/g9Q/bViCgQoAqn9/jb8mSSzHKz3sXAAAAABJRU5ErkJggg==</xsl:attribute>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
+          <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
+          <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
+        </img>
+        </a>
+      </td>
+      <td nowrap="true" width="3%" align="center" valign="top" class="class" style="">
+        <xsl:apply-templates />
+      </td>
+      <td width="45%" valign="top" class="title">
+        <div style="" edit="true" dbcolumn="title">
+          <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
+          <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
+          <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
+          <xsl:value-of select="OID_TITLE" />
+        </div>
+      </td>
+      <td width="45%" valign="top" class="note">
+        <div style="" edit="true" dbcolumn="note">
+          <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
+          <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
+          <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
+          <xsl:value-of select="OID_NOTE" />
+        </div>
+      </td>
+      <td width="5%" align="right" valign="top" class="date">
+        <label><xsl:value-of select="OID_DATE" /></label>
+      </td>
+    </tr>
+  </xsl:template>
+
+  <xsl:template match="OBJECT/FOLDER_INFOS/FOLDER_INFO">
+    <div class="class">
+      <xsl:attribute name="fid"><xsl:value-of select="@fid" /></xsl:attribute>
+      <xsl:attribute name="dbtype"><xsl:value-of select="@dbtype" /></xsl:attribute>
+      <xsl:attribute name="oid"><xsl:value-of select="@oid" /></xsl:attribute>
+      <span class="class">
+        <xsl:attribute name="style"><xsl:value-of select="@fid_style" /></xsl:attribute>
+        <xsl:attribute name="fid"><xsl:value-of select="@fid" /></xsl:attribute>
+        <xsl:attribute name="dbtype"><xsl:value-of select="@dbtype" /></xsl:attribute>
+        <xsl:attribute name="oid"><xsl:value-of select="@oid" /></xsl:attribute>
+        <xsl:value-of select="@fid_title" />
+      </span>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="OBJECT/OID_TITLE" />
+  <xsl:template match="OBJECT/ID" />
+  <xsl:template match="OBJECT/OID_PROPERTY_NOTE" />
+  <xsl:template match="OBJECT/OID_NOTE" />
+  <xsl:template match="OBJECT/OID_TXT" />
+  <xsl:template match="OBJECT/OID_STRUCTURE" />
+  <xsl:template match="OBJECT/DOC_URL" />
+  <xsl:template match="OBJECT/CON_URL" />
+  <xsl:template match="OBJECT/BGN_DOM" />
+  <xsl:template match="OBJECT/END_DOM" />
+  <xsl:template match="OBJECT/OID_DATE" />
+  <xsl:template match="OBJECT/HYPER_ANCHOR" />
+  <xsl:template match="OBJECT/DBTYPE" />
+  <xsl:template match="OBJECT/OID" />
+  <xsl:template match="OBJECT/PFID" />
+  <xsl:template match="OBJECT/OID_IMG" />
+  <xsl:template match="OBJECT/FAVICON" />
+
+</xsl:stylesheet>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/loginDialog.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/loginDialog.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/loginDialog.xul	(revision 5703)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<dialog
+    id="tagoutputDialog"
+    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+    xmlns:html="http://www.w3.org/1999/xhtml"
+    title="Login"
+    buttons="cancel"
+    defaultButton="false"
+    onload="loginLoad()">
+    <script type="application/x-javascript">
+            <![CDATA[       
+                function loginLoad() {
+                    //navigate to login page from the params
+                    document.getElementById("loginIframe").setAttribute("src", window.arguments[0].backend+"/api/authentication/login");                   
+                }
+               
+                window.addEventListener("load",Listen,false);
+                
+                function Listen(){
+                    var frame = document.getElementById("loginIframe");
+                    frame.addEventListener("DOMContentLoaded", DomLoadedEventHandler, true);                                             
+                }
+ 
+                function DomLoadedEventHandler() {
+                    var frame = document.getElementById("loginIframe");
+                    //alert("Current url: "+frame.contentDocument.location.href);
+                    //alert("target url: "+window.arguments[0].backend+'/api');
+                    if(frame.contentDocument.location.href == window.arguments[0].backend+'/api'){
+                        var p = window.arguments[0];
+                        p.callback(); 
+                        window.close();
+                    }
+                }
+                
+                window.addEventListener("unload", function(){
+                        var p = window.arguments[0];
+                        p.callback();
+
+                }, false)
+                
+            ]]>
+    </script>
+    <iframe id="loginIframe" height="500" width="650" type="content" src="" flex="2" />
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/marker.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/marker.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/marker.js	(revision 5703)
@@ -0,0 +1,472 @@
+var bitsMarker = {
+    markerWindow_count: 0,
+/////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////
+    get id_key() {
+        return "bits_marker_";
+    },
+    get XHTMLNS() {
+        return 'http://www.w3.org/1999/xhtml';
+    },
+    get nodePositionInRange() {
+        return {
+            SINGLE: 0,
+            START: 1,
+            MIDDLE: 2,
+            END: 3
+        };
+    },
+    get DEFAULT_ALIGMENT() {
+        return 3;
+    },
+    get alignment() {
+        return nsPreferences.getIntPref("wiredmarker.hyperanchor.alignment", this.DEFAULT_ALIGMENT);
+    },
+    set alignment(aVal) {
+        nsPreferences.setIntPref("wiredmarker.hyperanchor.alignment", aVal);
+    },
+    get STRING() {
+        return window.top.document.getElementById("MarkingCollectionOverlayString");
+    },
+    get PRESET_STYLES()
+    {
+        return [
+            // [0] no styles
+            "",
+            window.top.bitsMarkingCollection.STRING.getString("MARKER_CUSTOM_1"),
+            window.top.bitsMarkingCollection.STRING.getString("MARKER_CUSTOM_2"),
+            window.top.bitsMarkingCollection.STRING.getString("MARKER_CUSTOM_3"),
+            window.top.bitsMarkingCollection.STRING.getString("MARKER_CUSTOM_4"),
+            window.top.bitsMarkingCollection.STRING.getString("MARKER_CUSTOM_5"),
+            window.top.bitsMarkingCollection.STRING.getString("MARKER_CUSTOM_6"),
+            window.top.bitsMarkingCollection.STRING.getString("MARKER_CUSTOM_7"),
+            window.top.bitsMarkingCollection.STRING.getString("MARKER_CUSTOM_8"),
+        ];
+    },
+    get Common() {
+        return window.top.bitsObjectMng.Common;
+    },
+    get XPath() {
+        return window.top.bitsObjectMng.XPath;
+    },
+    get gBrowser() {
+        return window.top.bitsObjectMng.getBrowser();
+    },
+/////////////////////////////////////////////////////////////////////
+    init: function() {
+        var alignment = nsPreferences.getIntPref("wiredmarker.hyperanchor.alignment");
+        if (alignment == undefined)
+            nsPreferences.setIntPref("wiredmarker.hyperanchor.alignment", this.DEFAULT_ALIGMENT);
+    },
+/////////////////////////////////////////////////////////////////////
+    done: function() {
+    },
+/////////////////////////////////////////////////////////////////////
+    updateMarkerWindowCount: function(doc) {
+        var body = doc.body;
+        if (!body)
+            return;
+        var search_exp = new RegExp("^" + bitsMarker.id_key + "(\\d+)$", "mg");
+        var count = -1;
+        var elms = body.getElementsByTagName("span");
+        for (var i = 0; i < elms.length; i++) {
+            var elm = elms[i];
+            if (elm.id.search(search_exp) < 0)
+                continue;
+            var val = parseInt(RegExp.$1);
+            if (count < val)
+                count = val;
+        }
+        this.markerWindow_count = count;
+    },
+/////////////////////////////////////////////////////////////////////
+    unmarkerWindow: function(marker_id) {
+        var i;
+        for (i = 0; i < this.gBrowser.browsers.length; i++) {
+            bitsMarker.unmarkerWindow2(this.gBrowser.browsers[i].contentWindow, marker_id);
+        }
+    },
+    unmarkerWindow2: function(win, marker_id) {
+        var result = false;
+        if (win != null) {
+            var doc = win.document;
+            if (win.frames != null) {
+                var i;
+                for (i = 0; i < win.frames.length; i++) {
+                    bitsMarker.unmarkerWindow2(win.frames[i], marker_id);
+                }
+            }
+            if (!result) {
+                var marker = doc.getElementById(marker_id);
+                while (marker != null) {
+                    var parent = marker.parentNode;
+                    var children = marker.childNodes;
+                    var index;
+                    for (index = children.length - 1; index >= 0; index--) {
+                        parent.insertBefore(children[0], marker);
+                    }
+                    parent.removeChild(marker);
+                    parent.normalize();
+                    result = true;
+                    marker = doc.getElementById(marker_id)
+                }
+            }
+        }
+        return result;
+    },
+/////////////////////////////////////////////////////////////////////
+    markerRange: function(range, aAttributes) {
+        try {
+            var startContainer = range.startContainer;
+            var ownerDoc = startContainer.ownerDocument;
+            var spanNode = ownerDoc.createElement("span");
+            var attr;
+            for (attr in aAttributes) {
+                spanNode.setAttribute(attr, aAttributes[attr]);
+            }
+            var docfrag = range.extractContents();
+            spanNode.appendChild(docfrag);
+            range.insertNode(spanNode);
+            return spanNode;
+        } catch (ex) {
+            this._dump("bitsMarker.markerRange():" + ex);
+            return null;
+        }
+    },
+/////////////////////////////////////////////////////////////////////
+    getTextNode: function(aNode) {
+        var rtn_txt = "";
+        if (aNode.nodeName == "SELECT")
+            return rtn_txt;
+        if (aNode.style && aNode.style.display == 'none')
+            return rtn_txt;
+        if (aNode.childNodes.length) {
+            var elements = aNode.childNodes;
+            for (var j = 0; j < elements.length; j++) {
+                if (aNode.nodeName == "TR" && j > 0)
+                    rtn_txt += "\t";
+                rtn_txt += addSelectionNode(elements[j]);
+            }
+        }
+        if (aNode.nodeName.search(/^P|H1|H2|H3|H4|H5|H6|UL|OL|DIR|MENU|PRE|DL|DIV|CENTER|NOSCRIPT|NOFRAMES|BLOCKQUOTE|FORM|ISINDEX|HR|TABLE|TR|FIELDSET|ADDRESS|MULTICOL|BR$/img) == 0)
+            rtn_txt = "\n" + rtn_txt + "\n";
+        if (aNode.nodeValue && !(aNode.parentNode && aNode.parentNode.nodeName == "SCRIPT") && aNode.nodeName != "#comment") {
+            var txt = aNode.nodeValue;
+            txt = txt.replace(/[\r\n]+/img, "\n");
+            txt = txt.replace(/\n+/img, " ");
+            rtn_txt += txt;
+        }
+        if (aNode.nodeName == "IMG") {
+            var src = aNode.src;
+            aNode.setAttribute("src", src);
+        }
+        return rtn_txt;
+    },
+/////////////////////////////////////////////////////////////////////
+    decorateElement: function(aElement, aCssText) {
+        aElement.setAttribute("style", aCssText);
+        aElement.setAttribute("tooltiptext", aCssText);
+    },
+/////////////////////////////////////////////////////////////////////
+    _getFindRange: function() {
+        var findRange = Components.classes["@mozilla.org/embedcomp/rangefind;1"].createInstance();
+        if (!findRange || !(findRange instanceof Components.interfaces.nsIFind))
+            return undefined;
+        findRange.caseSensitive = true;
+        findRange.findBackwards = false;
+        return findRange;
+    },
+/////////////////////////////////////////////////////////////////////
+    xPathMarker: function(aDoc, aXPath, aAttributes) {
+        try {
+            var rtnNode = [];
+            var doc = aDoc;
+            if (!aDoc || !aXPath || !aXPath.start || !aXPath.end)
+                return null;
+            aXPath.start.match(/(.+)\(([0-9]+)\)\(([0-9]+)\)/);
+            aXPath.startPath = RegExp.$1;
+            aXPath.startOffset = RegExp.$2;
+            aXPath.startType = RegExp.$3;
+            aXPath.end.match(/(.+)\(([0-9]+)\)\(([0-9]+)\)/);
+            aXPath.endPath = RegExp.$1;
+            aXPath.endOffset = RegExp.$2;
+            aXPath.endType = RegExp.$3;
+            var startNode = null;
+            var endNode = null;
+            if (this.Common.getURLStringFromDocument(doc) != aXPath.con_url) {
+                var win = doc.defaultView;
+                doc = null;
+                if (win.frames != null) {
+                    var i;
+                    for (var i = 0; i < win.frames.length; i++) {
+                        if (this.Common.getURLStringFromDocument(win.frames[i].document) == aXPath.con_url) {
+                            doc = win.frames[i].document;
+                            break;
+                        }
+                    }
+                }
+            }
+            if (!doc)
+                return null;
+            startNode = this.XPath.getCurrentNodeFromXPath(doc, aXPath.startPath, aXPath.startOffset, aXPath.startType);
+            if (!startNode || !startNode.node)
+                return null;
+            endNode = this.XPath.getCurrentNodeFromXPath(doc, aXPath.endPath, aXPath.endOffset, aXPath.endType);
+            if (!endNode || !endNode.node)
+                return null;
+            //annotationProxy.log('aAttributes.id: ' + aAttributes.id);
+            if (!aAttributes || !aAttributes.id) {
+                this.updateMarkerWindowCount(doc);
+                this.markerWindow_count++;
+                if (!aAttributes)
+                    aAttributes = {};
+                aAttributes.id = bitsMarker.id_key + this.markerWindow_count;
+            } else if (aAttributes.id && aAttributes.dbtype) {
+                aAttributes.id = bitsMarker.id_key + aAttributes.dbtype + aAttributes.id;
+            } else if (aAttributes.id) {
+                aAttributes.id = bitsMarker.id_key + aAttributes.id;
+            }
+            var range = doc.createRange();
+            try {
+                //annotationProxy.log('aAttributes.id startNode.node: ' + startNode.node);
+                //annotationProxy.log('aAttributes.id endNode.node: ' + endNode.node);
+                //annotationProxy.log('aAttributes.id startNode.offset: ' + endNode.offset);
+                //annotationProxy.log('aAttributes.id endNode.offset: ' + endNode.offset);
+                range.setStart(startNode.node, startNode.offset);
+                range.setEnd(endNode.node, endNode.offset);
+            } catch (ex2) {
+                //annotationProxy.log('FAIL FOR: aAttributes.id: ' + aAttributes.id);
+                this._dump("bitsMarker.xPathMarker():" + aAttributes.id + "=[" + range.toString() + "]::" + ex2);
+                return null;
+            }
+            var xContext = aXPath.context.replace(/\s+$/mg, "").replace(/^\s+/mg, "");
+            var rContext = this.Common.exceptCode(range.toString().replace(/\s+$/mg, "").replace(/^\s+/mg, ""));
+            if (xContext != "" && xContext != rContext && (this._isTextNode(range.startContainer) || this._isTextNode(range.endContainer))) {
+                var alignment = this.alignment;
+                if (alignment == 0)
+                    return null;
+                var textPArray = [];
+                var textNArray = [];
+                var textContent;
+                var textCnt;
+                var nodeWalker = doc.createTreeWalker(
+                        doc.body,
+                        NodeFilter.SHOW_TEXT,
+                        {
+                            acceptNode: function(aNode) {
+                                if (aNode.nodeType == aNode.TEXT_NODE && !(/[^\t\n\r ]/.test(aNode.nodeValue)))
+                                    return NodeFilter.FILTER_REJECT;
+                                return NodeFilter.FILTER_ACCEPT;
+                            }
+                        },
+                false);
+                nodeWalker.currentNode = range.startContainer;
+                var textContentP = nodeWalker.currentNode.textContent;
+                for (textCnt = 0; textCnt < nodeWalker.currentNode.textContent.length; textCnt++) {
+                    textPArray.unshift({
+                        node: nodeWalker.currentNode,
+                        pos: textCnt
+                    });
+                }
+                if (textContentP.lastIndexOf(xContext) < 0 && textContentP.length < alignment) {
+                    while (nodeWalker.previousNode()) {
+                        textContentP = nodeWalker.currentNode.textContent + textContentP;
+                        for (textCnt = 0; textCnt < nodeWalker.currentNode.textContent.length; textCnt++) {
+                            textPArray.unshift({
+                                node: nodeWalker.currentNode,
+                                pos: textCnt
+                            });
+                        }
+                        if (textContentP.lastIndexOf(xContext) >= 0)
+                            break;
+                        if (textContentP.length > alignment)
+                            break;
+                    }
+                }
+                var indexP = textContentP.lastIndexOf(xContext);
+                var lengthP = 0;
+                if (indexP >= 0)
+                    lengthP = textContentP.length;
+                nodeWalker.currentNode = range.startContainer;
+                var textContentN = nodeWalker.currentNode.textContent;
+                for (textCnt = 0; textCnt < nodeWalker.currentNode.textContent.length; textCnt++) {
+                    textNArray.push({
+                        node: nodeWalker.currentNode,
+                        pos: textCnt
+                    });
+                }
+                if (textContentN.indexOf(xContext) < 0 && textContentN.length < alignment) {
+                    while (nodeWalker.nextNode()) {
+                        textContentN += nodeWalker.currentNode.textContent;
+                        for (textCnt = 0; textCnt < nodeWalker.currentNode.textContent.length; textCnt++) {
+                            textNArray.push({
+                                node: nodeWalker.currentNode,
+                                pos: textCnt
+                            });
+                        }
+                        if (textContentN.indexOf(xContext) >= 0)
+                            break;
+                        if (textContentN.length > alignment)
+                            break;
+                    }
+                }
+                var indexN = textContentN.indexOf(xContext);
+                var findRange = this._getFindRange();
+                var docRange = doc.createRange();
+                docRange.selectNode(doc.body);
+                var startRange = docRange.cloneRange();
+                var stopRange = docRange.cloneRange();
+                stopRange.collapse(false);
+                startRange.collapse(false);
+                if (indexP >= 0 && (lengthP - indexP) <= alignment && indexN >= 0 && indexN <= alignment) {
+                    if ((lengthP - indexP) <= indexN) {
+                        startRange.setStart(textPArray[indexP].node, indexP);
+                        startRange.setEnd(textPArray[indexP].node, indexP);
+                    } else {
+                        startRange.setStart(textNArray[indexN].node, textNArray[indexN].pos);
+                        startRange.setEnd(textNArray[indexN].node, textNArray[indexN].pos);
+                    }
+                } else if (indexP >= 0 && (lengthP - indexP) <= alignment) {
+                    startRange.setStart(textPArray[indexP].node, indexP);
+                    startRange.setEnd(textPArray[indexP].node, indexP);
+                } else if (indexN >= 0 && indexN <= alignment) {
+                    startRange.setStart(textNArray[indexN].node, textNArray[indexN].pos);
+                    startRange.setEnd(textNArray[indexN].node, textNArray[indexN].pos);
+                } else {
+                    return null;
+                }
+                var result = findRange.Find(xContext, docRange, startRange, stopRange);
+                if (!result)
+                    return null;
+                range = result.cloneRange();
+            }
+            rtnNode.push({id: aAttributes.id, text: range.toString()});
+            if (doc.getElementById(aAttributes.id))
+                return rtnNode;
+            var aWindow = doc.defaultView;
+            var startC = range.startContainer;
+            var endC = range.endContainer;
+            var sOffset = range.startOffset;
+            var eOffset = range.endOffset;
+            var sameNode = (startC == endC);
+            var sameOffset = (sOffset == eOffset);
+            if (sameNode && sameOffset) {
+                this._wrapTextNodeWithSpan(doc, startC, this._createSpanNode(aWindow, aAttributes, this.nodePositionInRange.SINGLE));
+                return rtnNode;
+            }
+            var createNode = false;
+            function _acceptNode(aNode) {
+                if (aNode.nodeType != aNode.TEXT_NODE && aNode.nodeType != aNode.ELEMENT_NODE)
+                    return NodeFilter.FILTER_REJECT;
+                return NodeFilter.FILTER_ACCEPT;
+            }
+            ;
+            if (!sameNode || !this._isTextNode(startC)) {
+                var endNode;
+                if (endC.nodeType == endC.ELEMENT_NODE && endC.childNodes.length > range.endOffset) {
+                    endNode = endC.childNodes[range.endOffset];
+                } else {
+                    endNode = endC;
+                }
+                var nodeWalker = doc.createTreeWalker(range.commonAncestorContainer, NodeFilter.SHOW_ALL, _acceptNode, false);
+                nodeWalker.currentNode = startC;
+                for (var txtNode = nodeWalker.nextNode(); txtNode && txtNode != endNode; txtNode = nodeWalker.nextNode()) {
+                    if (txtNode.nodeType == txtNode.ELEMENT_NODE)
+                        continue;
+                    var xContext = txtNode.nodeValue.replace(/[\r\n\t]+/mg, "");
+                    if (xContext.length == 0)
+                        continue;
+                    if (!createNode) {
+                        xContext = txtNode.nodeValue.replace(/\s+/mg, "");
+                        if (xContext.length == 0)
+                            continue;
+                    }
+                    if (
+                            txtNode.parentNode.nodeName == "SCRIPT" ||
+                            txtNode.parentNode.nodeName == "TABLE" ||
+                            txtNode.parentNode.nodeName == "THEAD" ||
+                            txtNode.parentNode.nodeName == "TBODY" ||
+                            txtNode.parentNode.nodeName == "TFOOT" ||
+                            txtNode.parentNode.nodeName == "TR"
+                            )
+                        continue;
+                    if (endC.compareDocumentPosition(txtNode) == endC.DOCUMENT_POSITION_FOLLOWING)
+                        continue;
+                    nodeWalker.currentNode = this._wrapTextNodeWithSpan(doc, txtNode, this._createSpanNode(aWindow, aAttributes, this.nodePositionInRange.MIDDLE));
+                    createNode = true;
+                }
+            }
+            if (endC.parentNode.nodeName != "SCRIPT") {
+                if (this._isTextNode(endC))
+                    endC.splitText(eOffset);
+                if (!sameNode && endC.nodeValue) {
+                    var xContext = endC.nodeValue.replace(/[\r\n\t\s]+/mg, "");
+                    if (xContext.length > 0) {
+                        this._wrapTextNodeWithSpan(doc, endC, this._createSpanNode(aWindow, aAttributes, this.nodePositionInRange.END));
+                        createNode = true;
+                    }
+                }
+            }
+            if (this._isTextNode(startC) && startC.parentNode.nodeName != "SCRIPT") {
+                var secondHalf = startC.splitText(sOffset);
+                var xContext = secondHalf.nodeValue.replace(/[\r\n\t\s]+/mg, "");
+                if (xContext.length > 0) {
+                    if (sameNode) {
+                        this._wrapTextNodeWithSpan(doc, secondHalf, this._createSpanNode(aWindow, aAttributes, this.nodePositionInRange.SINGLE));
+                        createNode = true;
+                    } else {
+                        this._wrapTextNodeWithSpan(doc, secondHalf, this._createSpanNode(aWindow, aAttributes, this.nodePositionInRange.START));
+                        createNode = true;
+                    }
+                }
+            }
+            if (!createNode && sameNode)
+                this.markerRange(range, aAttributes);
+            range.collapse(true);
+            if (aAttributes.id) {
+                var xPathResult = this.XPath.evaluate('//*[@id="' + aAttributes.id + '"]', doc);
+                for (var k = 0; k < xPathResult.snapshotLength; k++) {
+                    var node = xPathResult.snapshotItem(k);
+                    if (xPathResult.snapshotLength > 1) {
+                        if (k == 0) {
+                            node.style.borderRight = "";
+                        } else if (k == (xPathResult.snapshotLength - 1)) {
+                            node.style.borderLeft = "";
+                        } else {
+                            node.style.borderLeft = "";
+                            node.style.borderRight = "";
+                        }
+                    }
+                }
+            }
+            return rtnNode;
+        } catch (ex) {
+            this._dump("bitsMarker.xPathMarker():" + ex);
+            return null;
+        }
+    },
+/////////////////////////////////////////////////////////////////////
+    _isTextNode: function(aNode) {
+        return aNode.nodeType == aNode.TEXT_NODE;
+    },
+/////////////////////////////////////////////////////////////////////
+    _createSpanNode: function(aWindow, aAttributes, aNodePosInRange) {
+        var newNode = aWindow.document.createElement("span");
+        for (var attr in aAttributes) {
+            newNode.setAttribute(attr, aAttributes[attr]);
+        }
+        return newNode;
+    },
+/////////////////////////////////////////////////////////////////////
+    _wrapTextNodeWithSpan: function(aDoc, aTextNode, aSpanNode) {
+        var clonedTextNode = aTextNode.cloneNode(false);
+        var nodeParent = aTextNode.parentNode;
+        aSpanNode.appendChild(clonedTextNode);
+        nodeParent.replaceChild(aSpanNode, aTextNode);
+        return clonedTextNode;
+    },
+/////////////////////////////////////////////////////////////////////
+    _dump: function(aString) {
+        window.top.bitsMarkingCollection._dump(aString);
+    },
+}
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markerCustom.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markerCustom.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markerCustom.js	(revision 5703)
@@ -0,0 +1,103 @@
+var markerCustomizer = {
+
+	get PREVIEW() { return document.getElementById("markerCustomPreview"); },
+
+	index : 8,
+	presetIndex : 0,
+
+	init : function(){
+		document.documentElement.buttons = "accept,cancel";
+		if(!window.arguments || !((window.arguments[0] >= 1 && window.arguments[0] <= markerCustomizer.index) || window.arguments[0] == -1)){
+			this.Common.alert(window.arguments[0]);
+			window.close(); return;
+		}
+		this.index = window.arguments[0];
+		var cssText = "";
+		if(window.arguments[1] && window.arguments[1].style && window.arguments[1].style != ""){
+			cssText = window.arguments[1].style;
+		}else{
+			cssText = nsPreferences.copyUnicharPref("wiredmarker.marker.style." + this.index, bitsMarker.PRESET_STYLES[this.index]);
+		}
+		this.parseFromString(cssText);
+	},
+
+	done : function(){
+		if(window.arguments[1]){
+			window.arguments[1].accept = true;
+			window.arguments[1].style = this.PREVIEW.style.cssText;
+		}
+	},
+
+	update : function(){
+		this.PREVIEW.setAttribute("style", this.parseToString());
+	},
+
+	broadcast : function(){
+		var ret = [
+			document.getElementById("markerBackgroundEnabled").checked,
+			document.getElementById("markerTextEnabled").checked,
+			document.getElementById("markerBorderEnabled").checked
+		];
+		document.getElementById("markerBroadcast0").setAttribute("disabled", !ret[0]);
+		document.getElementById("markerBroadcast1").setAttribute("disabled", !ret[1]);
+		document.getElementById("markerBroadcast2").setAttribute("disabled", !ret[2]);
+		return ret;
+	},
+
+	parseFromString : function(cssText){
+		this.PREVIEW.setAttribute("style", cssText);
+		document.getElementById("markerTextBold").checked          = this.PREVIEW.style.fontWeight == "bold";
+		document.getElementById("markerTextItalic").checked        = this.PREVIEW.style.fontStyle == "italic";
+		document.getElementById("markerTextStrike").checked        = this.PREVIEW.style.textDecoration == "line-through";
+		document.getElementById("markerBackgroundEnabled").checked = this.PREVIEW.style.backgroundColor;
+		document.getElementById("markerTextEnabled").checked       = this.PREVIEW.style.color;
+		document.getElementById("markerBorderEnabled").checked     = this.PREVIEW.style.borderBottom;
+		var bcList = this.broadcast();
+		if(bcList[0]) document.getElementById("markerBackgroundColor").color = this.PREVIEW.style.backgroundColor;
+		if(bcList[1]) document.getElementById("markerTextColor").color       = this.PREVIEW.style.color;
+		if(bcList[2]){
+			document.getElementById("markerBorderColor").color = this.PREVIEW.style.borderBottomColor;
+			document.getElementById("markerBorderType").selectedIndex = this.PREVIEW.style.borderTop ? 0 : 1;
+			var elem = document.getElementsByAttribute("value", this.PREVIEW.style.borderBottomStyle);
+			document.getElementById("markerBorderStyle").selectedIndex = elem.length > 0 ? elem[0].getAttribute("index") : 0;
+			elem = document.getElementsByAttribute("value", this.PREVIEW.style.borderBottomWidth);
+			document.getElementById("markerBorderWidth").selectedIndex = elem.length > 0 ? elem[0].getAttribute("index") : 0;
+		}
+	},
+
+	parseToString : function(){
+		var bcList = this.broadcast();
+		var cssRules = [];
+		if(document.getElementById("markerTextEnabled").checked){
+			if(document.getElementById("markerTextBold").checked)   cssRules.push("font-weight:bold");
+			if(document.getElementById("markerTextItalic").checked) cssRules.push("font-style:italic");
+			if(document.getElementById("markerTextStrike").checked) cssRules.push("text-decoration:line-through");
+		}
+		if(bcList[0]){
+			var backgroundColor = document.getElementById("markerBackgroundColor").color || "none";
+			if(backgroundColor != "none") cssRules.push("background-color:" + backgroundColor);
+		}
+		if(bcList[1]){
+			var textColor = document.getElementById("markerTextColor").color || "none";
+			if(textColor != "none") cssRules.push("color:" + textColor);
+		}
+		if(bcList[2]){
+			var borderType  = document.getElementById("markerBorderType").selectedItem.value == "box" ? "border" : "border-bottom";
+			var borderStyle = document.getElementById("markerBorderStyle").selectedItem.value;
+			var borderWidth = document.getElementById("markerBorderWidth").selectedItem.value;
+			var borderColor = document.getElementById("markerBorderColor").color || "none";
+			if(borderColor != "none") cssRules.push(borderType + ":" + [borderWidth,borderStyle,borderColor].join(" "));
+		}
+		return cssRules.join(";");
+	},
+
+	rotatePreset : function(){
+		if(++this.presetIndex > 8) this.presetIndex = 0;
+		var presetButton = document.getElementById("markerCustomizeDialog").getButton("extra2");
+		presetButton.label = presetButton.label.replace(/\s\d\/8$/, " " + this.presetIndex + "/8");
+		this.parseFromString(bitsMarker.PRESET_STYLES[this.presetIndex]);
+	},
+
+};
+
+
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markerCustom.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markerCustom.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markerCustom.xul	(revision 5703)
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/setting.css" type="text/css" ?>
+<!DOCTYPE wizard [
+<!ENTITY % overlayDTD   SYSTEM "chrome://markingcollection/locale/markingcollection.dtd" >
+%overlayDTD;
+<!ENTITY % markerCustomDTD SYSTEM "chrome://markingcollection/locale/markerCustom.dtd" >
+%markerCustomDTD;
+]>
+<dialog
+	id="markerCustomizeDialog"
+	title="&markingcollection.button.customize; - &markingcollection.marker;"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	buttonlabelextra2="&markingcollection.markerCustom.preset; 0/8"
+	onload="markerCustomizer.init();"
+	ondialogaccept="markerCustomizer.done();"
+	ondialogextra2="markerCustomizer.rotatePreset();"
+	oncommand="markerCustomizer.update();">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/common.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/markerCustom.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/marker.js" />
+	<broadcasterset>
+		<broadcaster id="markerBroadcast0" disabled="true" />
+		<broadcaster id="markerBroadcast1" disabled="true" />
+		<broadcaster id="markerBroadcast2" disabled="true" />
+	</broadcasterset>
+	<hbox flex="1">
+		<groupbox flex="1" orient="vertical">
+			<caption label="&markingcollection.markerCustom.background;" />
+			<hbox>
+				<checkbox id="markerBackgroundEnabled" label="&markingcollection.markerCustom.color;"  />
+				<colorpicker id="markerBackgroundColor" type="button" onchange="markerCustomizer.update();" observes="markerBroadcast0" />
+			</hbox>
+		</groupbox>
+		<groupbox flex="1">
+			<caption label="&markingcollection.markerCustom.text;" />
+			<hbox>
+				<checkbox id="markerTextEnabled" label="&markingcollection.markerCustom.color;" />
+				<colorpicker id="markerTextColor" type="button" onchange="markerCustomizer.update();" observes="markerBroadcast1" />
+				<checkbox id ="markerTextBold"   label="&markingcollection.markerCustom.bold;"   observes="markerBroadcast1" />
+				<checkbox id ="markerTextItalic" label="&markingcollection.markerCustom.italic;" observes="markerBroadcast1" />
+				<checkbox id ="markerTextStrike" label="&markingcollection.markerCustom.line;"   observes="markerBroadcast1" />
+			</hbox>
+		</groupbox>
+	</hbox>
+	<groupbox flex="1">
+		<caption label="&markingcollection.markerCustom.border;" />
+		<hbox>
+			<checkbox id="markerBorderEnabled" label="&markingcollection.markerCustom.color;" />
+			<colorpicker id="markerBorderColor" type="button" onchange="markerCustomizer.update();" observes="markerBroadcast2" />
+		</hbox>
+		<hbox align="center">
+			<label value="&markingcollection.markerCustom.type;:" />
+			<menulist id="markerBorderType" observes="markerBroadcast2">
+				<menupopup>
+					<menuitem label="&markingcollection.markerCustom.box;" value="box" />
+					<menuitem label="&markingcollection.markerCustom.underline;" value="underline" />
+				</menupopup>
+			</menulist>
+			<label value="&markingcollection.markerCustom.style;:" />
+			<menulist id="markerBorderStyle" observes="markerBroadcast2">
+				<menupopup>
+					<menuitem value="solid"  label="&markingcollection.markerCustom.solid;"  index="0" />
+					<menuitem value="dotted" label="&markingcollection.markerCustom.dotted;" index="1" />
+					<menuitem value="dashed" label="&markingcollection.markerCustom.dashed;" index="2" />
+					<menuitem value="double" label="&markingcollection.markerCustom.double;" index="3" />
+					<menuitem value="groove" label="&markingcollection.markerCustom.groove;" index="4" />
+					<menuitem value="ridge"  label="&markingcollection.markerCustom.ridge;"  index="5" />
+					<menuitem value="inset"  label="&markingcollection.markerCustom.inset;"  index="6" />
+					<menuitem value="outset" label="&markingcollection.markerCustom.outset;" index="7" />
+				</menupopup>
+			</menulist>
+			<label value="&markingcollection.markerCustom.width;:" />
+			<menulist id="markerBorderWidth" observes="markerBroadcast2">
+				<menupopup>
+					<menuitem value="thin"   label="&markingcollection.markerCustom.thin;"   index="0" />
+					<menuitem value="medium" label="&markingcollection.markerCustom.medium;" index="1" />
+					<menuitem value="thick"  label="&markingcollection.markerCustom.thick;"  index="2" />
+				</menupopup>
+			</menulist>
+		</hbox>
+	</groupbox>
+	<vbox style="background:white;padding:16px;border:1px solid ThreeDShadow;text-align:center;" align="center">
+		<label id="markerCustomPreview" value="Firefox, rediscover the web" />
+	</vbox>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markerInitDataDialog.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markerInitDataDialog.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markerInitDataDialog.xul	(revision 5703)
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<!DOCTYPE dialog [
+<!ENTITY % markingcollectionDTD SYSTEM "chrome://markingcollection/locale/markingcollection.dtd" >
+%markingcollectionDTD;
+<!ENTITY % markerDTD SYSTEM "chrome://markingcollection/locale/marker.dtd" >
+%markerDTD;
+]>
+<dialog
+	id="bitsMarkerInitDataDialog"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	title="&marker.initdata.dialog.title;"
+	buttons=","
+	width="600"
+	height="200"
+	ondialogaccept="return _bitsMarkerInitDataDialogAccept(event);"
+	>
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript">
+	<![CDATA[
+		function getTopWindow(){
+			return Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow("navigator:browser");
+		}
+		function getSTRING(){
+			return getTopWindow().document.getElementById("MarkingCollectionOverlayString");
+		}
+		function getCommon(){
+			return getTopWindow().bitsObjectMng.Common;
+		}
+		function _bitsMarkerInitDataDialogOK(aEvent){
+			document.getElementById("bitsMarkerInitDataDialog").acceptDialog();
+		}
+		function _bitsMarkerInitDataDialogCancel(aEvent){
+			document.getElementById("bitsMarkerInitDataDialog").cancelDialog();
+		}
+		function _bitsMarkerInitDataDialogInit(aEvent){
+			var title = window.arguments[0].title;
+			title = title.replace(/^\s+/g,"").replace(/\s+$/g,"");
+			var TEXT = document.getElementById("bitsMarkerInitDataTitleText");
+			TEXT.value = title;
+			try{TEXT.editor.transactionManager.clear();}catch(e){}
+
+			var NOTE = document.getElementById("bitsMarkerInitDataNoteText");
+			NOTE.value = window.arguments[0].note;
+			try{NOTE.editor.transactionManager.clear();}catch(e){}
+
+			var edit = nsPreferences.getBoolPref("wiredmarker.marker.initdata.edit", true);
+			document.getElementById("bitsMarkerInitEditCheckbox").checked = edit;
+			window.sizeToContent();
+			if(title != ""){
+				document.getElementById("bitsMarkerInitDataOKButton").focus();
+			}else{
+				document.getElementById("bitsMarkerInitDataOKButton").disabled = true;
+			}
+		}
+		function _bitsMarkerInitDataDialogDone(aEvent){}
+		function _bitsMarkerInitDataDialogAccept(aEvent){
+			var title = document.getElementById("bitsMarkerInitDataTitleText").value;
+			title = title.replace(/^\s+/g,"").replace(/\s+$/g,"");
+			if(title == ""){
+				setTimeout(function(){ document.getElementById("bitsMarkerInitDataTitleText").focus();},250);
+				return false;
+			}
+			var edit = document.getElementById("bitsMarkerInitEditCheckbox").checked;
+			nsPreferences.setBoolPref("wiredmarker.marker.initdata.edit", edit);
+
+			window.arguments[0].accept = true;
+			window.arguments[0].title = document.getElementById("bitsMarkerInitDataTitleText").value;
+			window.arguments[0].note = document.getElementById("bitsMarkerInitDataNoteText").value;
+
+			return true;
+		}
+		function _bitsMarkerInitDataTitleTextInput(aEvent){
+			var TEXT = document.getElementById("bitsMarkerInitDataTitleText");
+			var title = TEXT.value;
+			title = title.replace(/^\s+/g,"").replace(/\s+$/g,"");
+			if(title != ""){
+				document.getElementById("bitsMarkerInitDataOKButton").disabled = false;
+				document.getElementById("bitsMarkerInitDataTitleHBox").style.borderColor = 'transparent';
+			}else{
+				document.getElementById("bitsMarkerInitDataOKButton").disabled = true;
+				document.getElementById("bitsMarkerInitDataTitleHBox").style.borderColor = 'red';
+			}
+		}
+		function _bitsMarkerInitDataTitleTextChange(aEvent){
+			var title = document.getElementById("bitsMarkerInitDataTitleText").value;
+			title = title.replace(/\t/mg,"        ");
+			title = getCommon().exceptCode(title);
+			title = title.replace(/\x0D\x0A|\x0D|\x0A/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+			if(Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS != "Darwin"){
+				if(title == ""){
+					getCommon().alert(getSTRING().getString("ERROR_NOT_ENTER_TITLE"));
+//					undoTitle();
+					aEvent.preventDefault();
+					aEvent.stopPropagation();
+				}else{
+					if(document.getElementById("bitsMarkerInitDataTitleText").value != title) document.getElementById("bitsMarkerInitDataTitleText").value = title;
+				}
+			}else{
+				if(document.getElementById("bitsMarkerInitDataTitleText").value != title) document.getElementById("bitsMarkerInitDataTitleText").value = title;
+			}
+		}
+		function _bitsMarkerInitDataNoteTextChange(aEvent){
+			var note = document.getElementById("bitsMarkerInitDataNoteText").value;
+			note = note.replace(/\t/g,"        ");
+			note = note.replace(/\x0D\x0A|\x0D|\x0A/g," __BR__ ");
+			note = getCommon().exceptCode(note);
+			note = note.replace(/ __BR__ /g,"\n");
+			if(document.getElementById("bitsMarkerInitDataNoteText").value != note) document.getElementById("bitsMarkerInitDataNoteText").value = note;
+		}
+		function undoTitle(){
+			var TITLE = document.getElementById("bitsMarkerInitDataTitleText");
+			try{
+				while(TITLE.editor.transactionManager.numberOfUndoItems>0){
+					TITLE.editor.undo(1);
+					var title = TITLE.value;
+					title = title.replace(/\t/mg,"        ");
+					title = getCommon().exceptCode(title);
+					title = title.replace(/[\r\n]/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+					if(title != "") break;
+				}
+			}catch(e){}
+			window.focus();
+			setTimeout(function(){TITLE.focus();},100);
+		}
+		window.addEventListener("load", _bitsMarkerInitDataDialogInit, false);
+		window.addEventListener("unload", _bitsMarkerInitDataDialogDone, false);
+//		window.addEventListener("dialogaccept", _bitsMarkerInitDataDialogAccept, false);
+	]]>
+	</script>
+	<grid flex="1">
+		<columns>
+			<column/>
+			<column flex="1"/>
+		</columns>
+		<rows>
+			<row align="center">
+				<hbox flex="1" pack="end">
+					<label value="&marker.initdata.dialog.label.title; :" control="bitsMarkerInitDataTitleText"/>
+				</hbox>
+				<hbox id="bitsMarkerInitDataTitleHBox" flex="1" style="border:2px solid transparent;">
+					<textbox
+						id="bitsMarkerInitDataTitleText"
+						flex="1"
+						emptytext="&marker.initdata.dialog.emptytext.title;"
+						placeholder="&marker.initdata.dialog.emptytext.title;"
+						newlines="replacewithspaces"
+						onfocus="this.select()"
+						onkeypress="_bitsMarkerInitDataTitleTextInput(event);"
+						onkeydown="_bitsMarkerInitDataTitleTextInput(event);"
+						oninput="_bitsMarkerInitDataTitleTextInput(event);"
+						onblur="_bitsMarkerInitDataTitleTextInput(event);"
+						onchange="_bitsMarkerInitDataTitleTextChange(event);"/>
+				</hbox>
+			</row>
+			<row align="stretch" flex="1">
+				<hbox flex="1" pack="end">
+					<label value="&marker.initdata.dialog.label.note; :" control="bitsMarkerInitDataNoteText"/>
+				</hbox>
+				<hbox id="bitsMarkerInitDataNoteHBox" flex="1" style="border:2px solid transparent;">
+					<textbox
+						id="bitsMarkerInitDataNoteText"
+						multiline="true"
+						rows="5"
+						flex="1"
+						wrap="on"
+						onfocus="this.select()"
+						onchange="_bitsMarkerInitDataNoteTextChange(event);"/>
+				</hbox>
+			</row>
+			<row align="center">
+				<hbox flex="1"/>
+				<hbox flex="1">
+					<hbox flex="1" pack="start">
+						<checkbox id="bitsMarkerInitEditCheckbox" label="&marker.initdata.overlay.checkbox.edit;"/>
+					</hbox>
+					<hbox flex="1" pack="end">
+						<button label="OK" oncommand="_bitsMarkerInitDataDialogOK(event);" id="bitsMarkerInitDataOKButton"/>
+						<button label="Cancel" oncommand="_bitsMarkerInitDataDialogCancel(event);"/>
+					</hbox>
+				</hbox>
+			</row>
+		</rows>
+	</grid>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markerInitDataDialogOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markerInitDataDialogOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markerInitDataDialogOverlay.xul	(revision 5703)
@@ -0,0 +1,258 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE overlay [
+<!ENTITY % markingcollectionDTD SYSTEM "chrome://markingcollection/locale/markingcollection.dtd" >
+%markingcollectionDTD;
+<!ENTITY % metaDTD SYSTEM "chrome://markingcollection/locale/marker.dtd" >
+%metaDTD;
+]>
+<overlay
+	id="markerDialogOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript">
+	<![CDATA[
+	var def_title_mode;
+	var def_note_mode;
+	function _markerDialogOverlayInit(aEvent){
+		var title_mode = nsPreferences.copyUnicharPref("wiredmarker.marker.initdata.title","WM_TITLE");
+		var note_mode = nsPreferences.copyUnicharPref("wiredmarker.marker.initdata.note","WM_TEXT");
+		var title_format = nsPreferences.copyUnicharPref("wiredmarker.marker.initdata.title_format");
+		var note_format = nsPreferences.copyUnicharPref("wiredmarker.marker.initdata.note_format");
+		var edit = nsPreferences.getBoolPref("wiredmarker.marker.initdata.edit", true);
+		document.getElementById("mcMarkerEditCheckbox").checked = edit;
+		document.getElementById("mcMarkerTitleFormatText").disabled = true;
+		document.getElementById("mcMarkerNoteFormatText").disabled = true;
+		switch(title_mode){
+			case "WM_TITLE":
+				document.getElementById("mcMarkerTitleRadiogroup").selectedItem = document.getElementById("mcMarkerTitleTitle");
+				break;
+			case "WM_DATE":
+				document.getElementById("mcMarkerTitleRadiogroup").selectedItem = document.getElementById("mcMarkerTitleDate");
+				break;
+			case "WM_FORMAT":
+				document.getElementById("mcMarkerTitleRadiogroup").selectedItem = document.getElementById("mcMarkerTitleFormat");
+				document.getElementById("mcMarkerTitleFormatText").disabled = false;
+				break;
+		}
+		if(title_format) document.getElementById("mcMarkerTitleFormatText").value = title_format;
+		switch(note_mode){
+			case "WM_TEXT":
+				document.getElementById("mcMarkerNoteRadiogroup").selectedItem = document.getElementById("mcMarkerNoteText");
+				break;
+			case "WM_TITLE":
+				document.getElementById("mcMarkerNoteRadiogroup").selectedItem = document.getElementById("mcMarkerNoteTitle");
+				break;
+			case "WM_DATE":
+				document.getElementById("mcMarkerNoteRadiogroup").selectedItem = document.getElementById("mcMarkerNoteDate");
+				break;
+			case "WM_FORMAT":
+				document.getElementById("mcMarkerNoteRadiogroup").selectedItem = document.getElementById("mcMarkerNoteFormat");
+				document.getElementById("mcMarkerNoteFormatText").disabled = false;
+				break;
+		}
+		if(note_format) document.getElementById("mcMarkerNoteFormatText").value = note_format;
+		var uncategorized = nsPreferences.getBoolPref("wiredmarker.uncategorized.use", true);
+		document.getElementById("mcUncategorizedConfirm").checked = uncategorized;
+		var disptooltip = nsPreferences.getBoolPref("wiredmarker.marker.mouseover.disptooltip", true);
+		document.getElementById("mcObjectTooltipConfirm").checked = disptooltip;
+
+		def_title_mode = title_mode;
+		def_note_mode = note_mode;
+	}
+
+	function _markerDialogOverlayDone(aEvent){
+		var value = document.getElementById("mcMarkerTitleFormatText").value;
+		value = value.replace(/^\s+/g,"").replace(/\s+$/g,"");
+		if(value == "") nsPreferences.setUnicharPref("wiredmarker.marker.initdata.title", def_title_mode);
+
+		var value = document.getElementById("mcMarkerNoteFormatText").value;
+		value = value.replace(/^\s+/g,"").replace(/\s+$/g,"");
+		if(value == "") nsPreferences.setUnicharPref("wiredmarker.marker.initdata.note", def_note_mode);
+	}
+
+	function _markerDialogOverlayTitleCommand(aEvent){
+		if(aEvent.target.id=="mcMarkerTitleFormat"){
+			document.getElementById("mcMarkerTitleFormatText").disabled = false;
+			document.getElementById("mcMarkerTitleFormatText").focus();
+		}else{
+			document.getElementById("mcMarkerTitleFormatText").disabled = true;
+			def_title_mode = aEvent.target.value;
+		}
+		nsPreferences.setUnicharPref("wiredmarker.marker.initdata.title", aEvent.target.value);
+	}
+
+	function _markerDialogOverlayNoteCommand(aEvent){
+		if(aEvent.target.id=="mcMarkerNoteFormat"){
+			document.getElementById("mcMarkerNoteFormatText").disabled = false;
+			document.getElementById("mcMarkerNoteFormatText").focus();
+		}else{
+			document.getElementById("mcMarkerNoteFormatText").disabled = true;
+			def_note_mode = aEvent.target.value;
+		}
+		nsPreferences.setUnicharPref("wiredmarker.marker.initdata.note", aEvent.target.value);
+	}
+
+	function _markerDialogOverlayTitleInput(aEvent){
+		nsPreferences.setUnicharPref("wiredmarker.marker.initdata.title_format", aEvent.target.value);
+	}
+
+	function _markerDialogOverlayNoteInput(aEvent){
+		nsPreferences.setUnicharPref("wiredmarker.marker.initdata.note_format", aEvent.target.value);
+	}
+
+	function _markerDialogOverlayEdit(aEvent){
+		nsPreferences.setBoolPref("wiredmarker.marker.initdata.edit", aEvent.target.checked);
+	}
+
+	function _uncategorizedConfirmCommand(aEvent){
+		nsPreferences.setBoolPref("wiredmarker.uncategorized.use", aEvent.target.checked);
+	}
+
+	function _objecttooltipConfirmCommand(aEvent){
+		nsPreferences.setBoolPref("wiredmarker.marker.mouseover.disptooltip", aEvent.target.checked);
+	}
+
+	window.addEventListener("load", _markerDialogOverlayInit, false);
+	window.addEventListener("unload", _markerDialogOverlayDone, false);
+	]]>
+	</script>
+	<tabbox id="mcSettingTabbox">
+		<tabpanels id="mcSettingTabPanels">
+			<tabbox id="mcMenuTabbox">
+				<tabs id="mcMenuTabs">
+					<tab id="mcMarkerTab" label="&markingcollection.setting.marker;" image="chrome://markingcollection/skin/automarker.png"/>
+				</tabs>
+				<tabpanels id="mcMenuTabPanels">
+					<tabpanel id="mcMarkerTabPanel" orient="vertical" flex="1">
+						<groupbox id="mcMarkerTabGroupBox">
+							<caption label="&marker.initdata.overlay.groupbox.caption;" style="background-color:#fff;"/>
+							<hbox>
+								<groupbox id="mcMarkerTitleGroupBox" flex="1">
+									<caption label="&marker.initdata.overlay.title.groupbox.caption;" style="background-color:#fff;"/>
+									<radiogroup id="mcMarkerTitleRadiogroup" oncommand="_markerDialogOverlayTitleCommand(event);">
+										<grid>
+											<columns>
+												<column />
+												<column flex="1"/>
+											</columns>
+											<rows>
+												<row align="center">
+													<radio id="mcMarkerTitleText" label="&marker.initdata.overlay.radio.label.text;" value="WM_TEXT" selected="true"/>
+													<textbox size="5" readonly="true" onfocus="this.select()" value="WM_TEXT"/>
+												</row>
+												<row align="center">
+													<radio id="mcMarkerTitleTitle" label="&marker.initdata.overlay.radio.label.title;" value="WM_TITLE"/>
+													<textbox size="5" readonly="true" onfocus="this.select()" value="WM_TITLE"/>
+												</row>
+												<row align="center">
+													<radio id="mcMarkerTitleDate" label="&marker.initdata.overlay.radio.label.date;" value="WM_DATE"/>
+													<textbox size="5" readonly="true" onfocus="this.select()" value="WM_DATE"/>
+												</row>
+											</rows>
+										</grid>
+										<vbox>
+											<radio id="mcMarkerTitleFormat" label="&marker.initdata.overlay.radio.label.format;" value="WM_FORMAT"/>
+											<textbox id="mcMarkerTitleFormatText" flex="1" onfocus="this.select()" disabled="true" style="margin-left:2em;" onchange="_markerDialogOverlayTitleInput(event);"/>
+										</vbox>
+									</radiogroup>
+								</groupbox>
+								<groupbox id="mcMarkerNoteGroupBox" flex="1">
+									<caption label="&marker.initdata.overlay.note.groupbox.caption;" style="background-color:#fff;"/>
+									<radiogroup id="mcMarkerNoteRadiogroup" oncommand="_markerDialogOverlayNoteCommand(event);">
+										<grid>
+											<columns>
+												<column />
+												<column flex="1"/>
+											</columns>
+											<rows>
+												<row align="center">
+													<radio id="mcMarkerNoteText" label="&marker.initdata.overlay.radio.label.text;" value="WM_TEXT"/>
+													<textbox size="5" readonly="true" onfocus="this.select()" value="WM_TEXT"/>
+												</row>
+												<row align="center">
+													<radio id="mcMarkerNoteTitle" label="&marker.initdata.overlay.radio.label.title;" value="WM_TITLE"/>
+													<textbox size="5" readonly="true" onfocus="this.select()" value="WM_TITLE"/>
+												</row>
+												<row align="center">
+													<radio id="mcMarkerNoteDate" label="&marker.initdata.overlay.radio.label.date;" value="WM_DATE"/>
+													<textbox size="5" readonly="true" onfocus="this.select()" value="WM_DATE"/>
+												</row>
+												<vbox>
+													<radio id="mcMarkerNoteFormat" label="&marker.initdata.overlay.radio.label.format;" value="WM_FORMAT"/>
+													<textbox id="mcMarkerNoteFormatText" flex="1" onfocus="this.select()" disabled="true" multiline="true" rows="2" style="margin-left:2em;" onchange="_markerDialogOverlayNoteInput(event);"/>
+												</vbox>
+												<row align="center">
+													<radio id="mcMarkerNoteNone" label="&marker.initdata.overlay.radio.label.none;" value="" selected="true"/>
+												</row>
+											</rows>
+										</grid>
+									</radiogroup>
+								</groupbox>
+							</hbox>
+							<checkbox id="mcMarkerEditCheckbox" label="&marker.initdata.overlay.checkbox.edit;" oncommand="_markerDialogOverlayEdit(event);"/>
+							<checkbox id="mcMarkerSubstitution" label="ããã©ã«ããªã" oncommand="" hidden="true"/>
+						</groupbox>
+						<hbox flex="1">
+							<vbox>
+								<groupbox id="mcUncategorizedGroupBox">
+									<caption label="&markingcollection.setting.uncategorized;" style="background-color:#fff;"/>
+									<checkbox id="mcUncategorizedConfirm" label="&markingcollection.setting.uncategorized.use;" oncommand="_uncategorizedConfirmCommand(event)"/>
+								</groupbox>
+							</vbox>
+							<vbox>
+								<groupbox id="mcObjectTooltipGroupBox">
+									<caption label="&markingcollection.setting.marker.mouseover;" style="background-color:#fff;"/>
+									<checkbox id="mcObjectTooltipConfirm" label="&markingcollection.setting.marker.mouseover.disptooltip;" oncommand="_objecttooltipConfirmCommand(event)"/>
+								</groupbox>
+							</vbox>
+							<groupbox id="mcProtocolTabGroupBox" flex="1" hidden="true">
+								<caption label="&markingcollection.setting.protocol;" style="background-color:#fff;"/>
+								<hbox flex="1">
+									<tree
+										id="bitsProtocolTree"
+										tooltip="mcPopupTooltip"
+										flex="1"
+										hidecolumnpicker="true"
+										seltype="single"
+										class="tree"
+										onclick="bitsProtocolTreeOverlay.onClick(event);"
+										ondblclick="bitsProtocolTreeOverlay.onDblClick(event);"
+									>
+										<treecols id="bitsProtocolTreeCols">
+											<treecol
+												id="bitsProtocolTreeSrcCol"
+												flex="1"
+												label="&markingcollection.setting.protocol;"/>
+										</treecols>
+										<treechildren/>
+									</tree>
+									<vbox>
+										<toolbarbutton
+											id="bitsProtocolTreeAdd"
+											label="&markingcollection.substitutiontree.add;"
+											image="chrome://markingcollection/skin/menu_create.png"
+											oncommand="bitsProtocolTreeOverlay.onAdd(event);"/>
+										<toolbarbutton
+											id="bitsProtocolTreeEdit"
+											label="&markingcollection.substitutiontree.edit;"
+											image="chrome://markingcollection/skin/menu_property.png"
+											disabled="true"
+											oncommand="bitsProtocolTreeOverlay.onEdit(event);"/>
+										<toolbarbutton
+											id="bitsProtocolTreeDel"
+											label="&markingcollection.substitutiontree.del;"
+											image="chrome://markingcollection/skin/menu_remove.png"
+											disabled="true"
+											oncommand="bitsProtocolTreeOverlay.onDel(event);"/>
+									</vbox>
+								</hbox>
+							</groupbox>
+							<vbox flex="1"/>
+						</hbox>
+					</tabpanel>
+				</tabpanels>
+			</tabbox>
+		</tabpanels>
+	</tabbox>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markerRemap.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markerRemap.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markerRemap.js	(revision 5703)
@@ -0,0 +1,387 @@
+var bitsMarkerRemap = {
+	_object : null,
+	_resource : null,
+	_marker_exp : new RegExp("^"+bitsMarker.id_key+"\\D+\\d+$",""),
+
+	get STRING()     { return document.getElementById("bitsMarkerRemapString"); },
+	get DataSource() { return bitsObjectMng.DataSource; },
+	get Common()     { return bitsObjectMng.Common;     },
+	get XPath()      { return bitsObjectMng.XPath;      },
+	get Database()   { return bitsObjectMng.Database;   },
+	get gBrowser()   { return bitsObjectMng.getBrowser();},
+
+	get SIDEBAR() { return window.top.document.getElementById("sidebar"); },
+	get CONTENT() { return window.top.document.getElementById("content"); },
+
+	get SIDEBAR_DOC() {try{return this.SIDEBAR.contentDocument;}catch(e){return undefined;}},
+	get SIDEBAR_WIN() {try{return this.SIDEBAR.contentWindow;}catch(e){return undefined;}},
+	get mcTreeHandler() {try{return this.SIDEBAR_WIN.mcTreeHandler;}catch(e){return undefined;}},
+	get mcMainService() {try{return this.SIDEBAR_WIN.mcMainService;}catch(e){return undefined;}},
+	get mcController() {try{return this.SIDEBAR_WIN.mcController;}catch(e){return undefined;}},
+	get mcPropertyView() {try{return this.SIDEBAR_WIN.mcPropertyView;}catch(e){return undefined;}},
+	get mcTreeViewModeService() {try{return this.SIDEBAR_WIN.mcTreeViewModeService;}catch(e){return undefined;}},
+	get bitsItemView() {try{return this.SIDEBAR_WIN.bitsItemView;}catch(e){return undefined;}},
+
+	get TREE_POPUP(){try{return this.SIDEBAR_DOC.getElementById("mcPopup");}catch(e){return undefined;}},
+	get TREE_MENU(){try{return this.SIDEBAR_DOC.getElementById("mcPopupRemap");}catch(e){return undefined;}},
+
+	get TREEOBJ_POPUP(){try{return this.SIDEBAR_DOC.getElementById("mcPopupObject");}catch(e){return undefined;}},
+	get TREEOBJ_MENU(){try{return this.SIDEBAR_DOC.getElementById("mcPopupObjectRemap");}catch(e){return undefined;}},
+
+	get ITEMTREE_POPUP(){try{return this.SIDEBAR_DOC.getElementById("bitsItemTreePopup");}catch(e){return undefined;}},
+	get ITEMTREE_MENU(){try{return this.SIDEBAR_DOC.getElementById("bitsItemTreePopupRemap");}catch(e){return undefined;}},
+
+/////////////////////////////////////////////////////////////////////
+	load : function(aEvent){
+		try{this.TREE_POPUP.addEventListener("popupshowing",this.popupshowing_tree, false);}catch(e){}
+		try{this.TREEOBJ_POPUP.addEventListener("popupshowing",this.popupshowing_treeobj, false);}catch(e){}
+		try{this.ITEMTREE_POPUP.addEventListener("popupshowing",this.popupshowing_itemview, false);}catch(e){}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	unload : function(aEvent){
+		try{this.TREE_POPUP.removeEventListener("popupshowing",this.popupshowing_tree, false);}catch(e){}
+		try{this.TREEOBJ_POPUP.removeEventListener("popupshowing",this.popupshowing_treeobj, false);}catch(e){}
+		try{this.ITEMTREE_POPUP.removeEventListener("popupshowing",this.popupshowing_itemview, false);}catch(e){}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	popupshowing_tree : function(aEvent){
+		bitsMarkerRemap._popupshowing_tree(aEvent);
+	},
+	_popupshowing_tree : function(aEvent){
+		this._object = null;
+		this.TREE_MENU.hidden = true;
+		this._resource = this.mcTreeHandler.resource;
+		if(!this._resource) return;
+		if(this.DataSource.getProperty(this._resource, "type") != "item") return;
+		var object = this.getObjectFromResource(this._resource);
+		if(!object) return;
+		this.TREE_MENU.hidden = !this.isDispContextmenu(object);
+		if(!this.TREE_MENU.hidden){
+			this._object = object;
+			var parentRes = this.DataSource.findParentResource(this._resource);
+			this._object.fid_title = this.DataSource.getProperty(parentRes, "title");
+			this._object.fid_style = this.DataSource.getProperty(parentRes, "style");
+			this._object.pfid_order = this.DataSource.getProperty(this._resource, "pfid_order");
+			if(this._object.pfid_order == "") this._object.pfid_order = 0;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	popupshowing_treeobj : function(aEvent){
+		bitsMarkerRemap._popupshowing_treeobj(aEvent);
+	},
+	_popupshowing_treeobj : function(aEvent){
+		this._object = null;
+		this.TREEOBJ_MENU.hidden = true;
+		this._resource = this.mcTreeHandler.resource;
+		if(!this._resource) return;
+		if(this.DataSource.getProperty(this._resource, "type") != "item") return;
+		var object = this.getObjectFromResource(this._resource);
+		if(!object) return;
+		this.TREEOBJ_MENU.hidden = !this.isDispContextmenu(object);
+		if(!this.TREEOBJ_MENU.hidden){
+			this._object = object;
+			var parentRes = this.DataSource.findParentResource(this._resource);
+			this._object.fid_title = this.DataSource.getProperty(parentRes, "title");
+			this._object.fid_style = this.DataSource.getProperty(parentRes, "style");
+			this._object.pfid_order = this.DataSource.getProperty(this._resource, "pfid_order");
+			if(this._object.pfid_order == "") this._object.pfid_order = 0;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	popupshowing_itemview : function(aEvent){
+		bitsMarkerRemap._popupshowing_itemview(aEvent);
+	},
+	_popupshowing_itemview : function(aEvent){
+		this._object = null;
+		this._resource = null;
+		var parentRes = this.mcTreeHandler.resource;
+		this.ITEMTREE_MENU.hidden = true;
+		var object = this.bitsItemView.object;
+		if(!object) return;
+		this.ITEMTREE_MENU.hidden = !this.isDispContextmenu(object);
+		if(!this.ITEMTREE_MENU.hidden){
+			this._object = {};
+			for(var key in object){
+				this._object[key] = object[key];
+			}
+			if(this._object.dbtype == bitsMarkingCollection._uncategorized.dbtype && this._object.pfid == 0){
+				if(!this._object.fid_title) this._object.fid_title = bitsMarkingCollection._uncategorized.title;
+				if(!this._object.fid_style) this._object.fid_style = bitsMarkingCollection._uncategorized.style;
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getObjectFromResource : function(aRes){
+		var oid = this.DataSource.getProperty(aRes, "id");
+		var pfid = this.DataSource.getProperty(aRes, "pfid");
+		var dbtype = this.DataSource.getProperty(aRes, "dbtype");
+		var objects = this.Database.getObject({oid:oid,pfid:pfid}, dbtype);
+		if(!objects || objects.length == 0)
+			return null;
+		else
+			return objects[0];
+	},
+
+/////////////////////////////////////////////////////////////////////
+	isDispContextmenu : function(aObject){
+		if(aObject.oid_type != "text") return false;
+		var marker_id = bitsMarker.id_key+aObject.dbtype+aObject.oid;
+		var exists_doc = false;
+		var marker_num = 0;
+		for(var i=0;i<this.gBrowser.browsers.length;i++){
+			var contentDocument = this.gBrowser.browsers[i].contentDocument;
+			var cur_uri = this.Common.getURLStringFromDocument(contentDocument);
+			if(cur_uri.indexOf(aObject.con_url)==0){
+				exists_doc = !this.gBrowser.browsers[i].webProgress.isLoadingDocument;
+				var nodesSnapshot = this.XPath.evaluate('//*[@id="'+marker_id+'"]',contentDocument);
+				if(nodesSnapshot && nodesSnapshot.snapshotLength>0) marker_num += nodesSnapshot.snapshotLength;
+			}
+		}
+		return (exists_doc && marker_num==0)?true:false;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	reMap : function(aEvent){
+		if(!this._object) return;
+		var findtext = this._object.oid_txt;
+		var doc = this.gBrowser.contentDocument;
+		var sel = doc.defaultView.getSelection();
+		sel.removeAllRanges();
+		var findRange = this._getFindRange();
+		findRange.caseSensitive = true;
+		var docRange = doc.createRange();
+		docRange.selectNode(doc.body);
+		var startRange = docRange.cloneRange();
+		var stopRange = docRange.cloneRange();
+		startRange.collapse(true);
+		stopRange.collapse(false);
+		var ranges = [];
+		var result;
+		while((result = findRange.Find(findtext, docRange, startRange, stopRange))){
+			if(result.endContainer != null &&
+				 result.startContainer != null &&
+				 result.endContainer.nodeType == Node.TEXT_NODE &&
+				 result.startContainer.nodeType == Node.TEXT_NODE &&
+				 !this._isNodeInputNodeOrChildOf(result.startContainer) &&
+				 !this._isNodeInputNodeOrChildOf(result.endContainer)) {
+				if(!((result.startContainer.parentNode && this._marker_exp.test(result.startContainer.parentNode.id)) || (result.endContainer.parentNode && this._marker_exp.test(result.endContainer.parentNode.id)))){
+					var obj = {
+						startContainer : result.startContainer,
+						startOffset    : result.startOffset,
+						endContainer   : result.endContainer,
+						endOffset      : result.endOffset,
+						collapsed      : result.collapsed,
+						commonAncestorContainer : result.commonAncestorContainer
+					};
+					ranges.push(obj);
+					sel.addRange(result);
+				}
+			}
+			startRange = result;
+			startRange.collapse(false);
+		}
+
+		var map = false;
+		if(ranges.length==0){
+			this.Common.alert(this.STRING.getString("ALERT_FIND_RESULT")+"\n[ "+findtext+" ]");
+		}else if(ranges.length==1){
+			map = true;
+		}else{
+			map = this.Common.confirm(this.STRING.getString("CONFIRM_FIND_RESULTS")+" [ "+ranges.length+" ]");
+		}
+		if(map){
+			var style = this._object.fid_style;
+			var dbtype = this._object.dbtype;
+			var pfid_order = this._object.pfid_order;
+			var connect = this.Database._dbConn[dbtype];
+			connect.executeSimpleSQL('update om_link set pfid_order=pfid_order+'+ranges.length+' where pfid_order>'+pfid_order);
+			var aParName = null;
+			var curRelIdx = -1;
+			if(!this.bitsItemView || !this.bitsItemView.isChecked){
+				var f_pfid = undefined;
+				var rtnFolder = this.Database.getFolder({fid:this._object.pfid},dbtype);
+				if(rtnFolder && rtnFolder.length) f_pfid = rtnFolder[0].pfid;
+				rtnFolder = undefined;
+				aParName = this.DataSource.getID2About(this._object.pfid,f_pfid,dbtype);
+				curRelIdx = this.DataSource.getRelativeIndex(this.Common.RDF.GetResource(aParName), this._resource);
+			}
+			sel.removeAllRanges();
+			var parser = new DOMParser();
+			var xmlSerializer = new XMLSerializer();
+			for(var i=0;i<ranges.length;i++){
+				var range = doc.createRange();
+				range.setStart(ranges[i].startContainer, ranges[i].startOffset);
+				range.setEnd(ranges[i].endContainer, ranges[i].endOffset);
+				var startContainer = range.startContainer;
+				var startOffset = range.startOffset;
+				var endContainer = range.endContainer;
+				var endOffset = range.endOffset;
+				var stXPath = this.XPath.getOffsetFromParentNode(startContainer,startOffset);
+				var enXPath = this.XPath.getOffsetFromParentNode(endContainer,endOffset);
+				try{
+					var hyperAnchor =  bitsHyperAnchor._getAnchorURL({node:startContainer,offset:startOffset,style:style,prefix:"b",contents:range.toString()},{node:endContainer,offset:endOffset,prefix:"e",contents:range.toString()});
+				}catch(ex3){
+					try{
+						var hyperAnchor =  bitsHyperAnchorDummy._getAnchorURL({node:startContainer,offset:startOffset,style:style,prefix:"b",contents:range.toString()},{node:endContainer,offset:endOffset,prefix:"e",contents:range.toString()});
+					}catch(ex3){
+						hyperAnchor = null;
+					}
+				}
+				hyperAnchor = bitsAutocacheService.convertCacheURLToOriginalURL(hyperAnchor);
+				var rObj = this.Database.newObject();
+				for(var key in rObj){
+					if(key == "oid") continue;
+					if(this._object[key] != undefined) rObj[key] = this._object[key];
+				}
+				rObj.bgn_dom = stXPath.xpath + "("+stXPath.offset+")" + "("+stXPath.type+")";
+				rObj.end_dom = enXPath.xpath + "("+enXPath.offset+")" + "("+enXPath.type+")";
+				if(!rObj.oid_property || rObj.oid_property == "") rObj.oid_property = "<PROPERTY></PROPERTY>";
+				var xmldoc = parser.parseFromString(rObj.oid_property,"text/xml");
+				if(xmldoc){
+					if(xmldoc.documentElement){
+						if(hyperAnchor){
+							var xmlnode = xmldoc.getElementsByTagName("HYPER_ANCHOR")[0];
+							if(!xmlnode) xmlnode = xmldoc.createElement("HYPER_ANCHOR");
+							if(xmlnode){
+								while(xmlnode.hasChildNodes()){ xmlnode.removeChild(xmlnode.lastChild); }
+								xmlnode.appendChild(xmldoc.createTextNode(hyperAnchor));
+								xmldoc.documentElement.appendChild(xmlnode);
+							}
+						}else{
+							var xmlnode = xmldoc.getElementsByTagName("HYPER_ANCHOR")[0];
+							if(xmlnode) xmlnode.parentNode.removeChild(xmlnode);
+						}
+					}
+					rObj.oid_property = xmlSerializer.serializeToString(xmldoc);
+					xmldoc = undefined;
+				}
+				rObj.pfid_order = ++pfid_order;
+				var rtn = this.Database.addObject(rObj,dbtype);
+				if(!rtn) rObj = undefined;
+				if(!rObj) continue;
+				var con_doc = stXPath.node.ownerDocument;
+				var rtnContent = bitsMarker.xPathMarker(
+					con_doc,
+					{
+						start   : rObj.bgn_dom,
+						end     : rObj.end_dom,
+						context : this.Common.exceptCode(rObj.oid_txt.replace(/\s+$/mg,"").replace(/^\s+/mg,"")),
+						con_url : this.Common.getURLStringFromDocument(con_doc)
+					},
+					{
+						id     : rObj.oid,
+						dbtype : dbtype,
+						pfid   : rObj.pfid,
+						style  : style
+					}
+				);
+				if(rtnContent){
+					if(this.bitsItemView && this.bitsItemView.isChecked) continue;
+					this.DataSource.addItem(this.Database.makeObjectToItem(rObj), aParName, ++curRelIdx, dbtype);
+					this.mcTreeHandler.TREE.builder.rebuild();
+				}
+			}
+			parser = undefined;
+			xmlSerializer = undefined;
+			if(this.Database.removeObject(this._object,dbtype)){
+				if(this._resource){
+					this.DataSource.deleteItem(this._resource);
+					this.DataSource.flush();
+					this.mcTreeHandler.TREE.builder.rebuild();
+				}
+				var records = [];
+				var statement = connect.createStatement('select oid,pfid from om_link order by pfid_order');
+				var columnNames = [];
+				var i;
+				var k=statement.columnCount
+				var col_name;
+				for(i=0;i<k;i++){
+					columnNames.push(statement.getColumnName(i));
+				}
+				try{
+					while(statement.executeStep()){
+						var row = {};
+						for(i=0;i<k;i++){
+							if(statement.getIsNull(i)){
+								row[columnNames[i]] = null;
+							}else{
+								row[columnNames[i]] = statement.getUTF8String(i);
+							}
+						}
+						records.push(row);
+					}
+				}
+				finally {
+					statement.reset();
+					statement = undefined;
+				}
+				if(records.length>0){
+					var result = true;
+					connect.beginTransaction();
+					try{
+						var sql = 'update om_link set pfid_order=?1 where oid=?2 and pfid=?3';
+						var statement = connect.createStatement(sql);
+						for(i=0,k=records.length;i<k;i++){
+							var pfid_order = i+1;
+							this.Database._setStatementValue(statement,0,pfid_order);
+							this.Database._setStatementValue(statement,1,records[i].oid);
+							this.Database._setStatementValue(statement,2,records[i].pfid);
+							statement.execute();
+							statement.reset();
+						}
+						statement = undefined;
+					}catch(e){
+						this._dump(e);
+						result = false;
+					}finally {
+						if(connect.lastError){
+							this._dump(connect.lastErrorString+" ("+connect.lastError+")");
+							this._dump("sql="+sql);
+							result = false;
+						}
+					}
+					if(result){
+						connect.commitTransaction();
+					}else{
+						connect.rollbackTransaction();
+					}
+				}
+			}
+			this.Common.alert(this.STRING.getString("ALERT_MAP_RESULT"));
+		}
+		sel.removeAllRanges();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_getFindRange : function(){
+		var findRange = Components.classes["@mozilla.org/embedcomp/rangefind;1"].createInstance();
+		if(!findRange || !(findRange instanceof Components.interfaces.nsIFind)) return undefined;
+		findRange.caseSensitive = false;
+		findRange.findBackwards = false;
+		return findRange;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_isWordCharacter : function(ch){
+		if(ch == null ||  typeof ch != "string" || ch.length != 1) return false;
+		var code = ch.charCodeAt(0);
+		return code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 138 && code <= 142 || code >= 154 && code <= 159 || code >= 192 && code <= 255;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_isNodeInputNodeOrChildOf : function(node){
+		if(node.nodeName.toUpperCase() == "INPUT") return true;
+		if(node.parentNode != null) return this._isNodeInputNodeOrChildOf(node.parentNode);
+		return false;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+}
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markerRemapSidebarOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markerRemapSidebarOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markerRemapSidebarOverlay.xul	(revision 5703)
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://browser/skin/searchbar.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/content/places/places.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://markingcollection/skin/sidebar.css" type="text/css"?>
+<?xml-stylesheet href="chrome://markingcollection/skin/overlay.css" type="text/css"?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/remap.dtd">
+<overlay
+	id="treeprojectOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _markerremapMainInit(aEvent){
+			window.top.bitsMarkerRemap.load(aEvent);
+		}
+		function _markerremapMainDone(aEvent){
+			window.top.bitsMarkerRemap.unload(aEvent);
+		}
+		window.addEventListener("load", _markerremapMainInit, false);
+		window.addEventListener("unload", _markerremapMainDone, false);
+	]]>
+	</script>
+	<popupset id="mcPopupSet">
+
+		<menupopup id="mcPopup">
+			<menuitem
+				id="mcPopupRemap"
+				label="&remap.menuitem;"
+				class="menuitem-iconic"
+				image="chrome://markingcollection/skin/remap.png"
+				insertbefore="mcPopupOpen"
+				oncommand="window.top.bitsMarkerRemap.reMap(event)" />
+			<menuseparator
+				id="mcPopupRemapMenuseparator"
+				observes="mcPopupRemap"
+				insertbefore="mcPopupOpen"/>
+		</menupopup>
+
+		<menupopup id="mcPopupObject">
+			<menuitem
+				id="mcPopupObjectRemap"
+				label="&remap.menuitem;"
+				class="menuitem-iconic"
+				image="chrome://markingcollection/skin/remap.png"
+				insertbefore="mcPopupObjectOpen"
+				oncommand="window.top.bitsMarkerRemap.reMap(event)" />
+			<menuseparator
+				id="mcPopupObjectRemapMenuseparator"
+				observes="mcPopupObjectRemap"
+				insertbefore="mcPopupObjectOpen"/>
+		</menupopup>
+
+		<menupopup id="bitsItemTreePopup">
+			<menuitem
+				id="bitsItemTreePopupRemap"
+				label="&remap.menuitem;"
+				class="menuitem-iconic"
+				image="chrome://markingcollection/skin/remap.png"
+				insertbefore="bitsItemTreePopupOpen"
+				oncommand="window.top.bitsMarkerRemap.reMap(event)" />
+			<menuseparator
+				id="bitsItemTreePopupRemapMenuseparator"
+				observes="bitsItemTreePopupRemap"
+				insertbefore="bitsItemTreePopupOpen"/>
+		</menupopup>
+
+	</popupset>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markingcollection.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markingcollection.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/markingcollection.js	(revision 5703)
@@ -0,0 +1,2982 @@
+var bitsMarkingCollection = {
+/////////////////////////////////////////////////////////////////////
+	_location : null,
+	_init     : false,
+	_removefile : [],
+	// _homepage : "http://www.wired-marker.org/index.cgi",
+        _homepage : "http://dasish.eu/",
+	_version : "",
+	_contentWindow : null,
+	_markingtimer  : null,
+	_uncategorized : {	//æªåé¡ãã©ã«ãçšå®çŸ©
+		dbtype : "_uncategorized"
+	},
+	_app_version : 2,
+
+/////////////////////////////////////////////////////////////////////
+	get STRING()     { return document.getElementById("MarkingCollectionOverlayString"); },
+	get DEF_STRING() { return document.getElementById("bitsDefaultString"); },
+	get DataSource() { return bitsObjectMng.DataSource; },
+	get Common()     { return bitsObjectMng.Common;     },
+	get XPath()      { return bitsObjectMng.XPath;      },
+	get Database()   { return bitsObjectMng.Database;   },
+	get gBrowser()   { return bitsObjectMng.getBrowser();},
+
+	get BROWSER()       { return document.getElementById("MarkingCollectionBrowser"); },
+	get ProgressPanel() { return document.getElementById("MarkingCollectionProgressPanel"); },
+	get Progressmeter() { return document.getElementById("MarkingCollectionProgressmeter"); },
+
+	get BOOKMARKS_MENU_2() { return document.getElementById("bookmarks-menu"); }, /* Ver2.0 */
+	get BOOKMARKS_MENU_3() { return document.getElementById("bookmarksMenu"); },  /* Ver3.0 */
+
+	get BROADCASTER() { return document.getElementById("viewMarkingCollection"); },
+
+	localfolder : {
+		get id(){ return "0"; },
+		get about(){ return bitsObjectMng.DataSource.ABOUT_ITEM+"00000000000000"; },
+		get title(){ return bitsObjectMng.STRING.getString("LOCAL_FOLDER"); },
+	},
+
+	sharedfolder : {
+		_id : 0,
+		get id(){ return this._id; },
+		get title(){ return bitsObjectMng.STRING.getString("SHARED_FOLDER"); },
+
+		init : function(){
+			this._id = 1;
+		},
+		about : function(aID){
+			if(aID == undefined) return "";
+			aID = ""+aID;
+			while(aID.length<14) aID = "0"+aID;
+			return bitsObjectMng.DataSource.ABOUT_ITEM+aID;
+		},
+	},
+
+	dbinfo : {
+		_xmldoc : undefined,
+		_xmlfolder : undefined,
+
+		get dbFolder()   { return this._xmlfolder; },
+
+		init : function(aForced){
+			if(aForced == undefined) aForced = false;
+			var hasHidden = false;
+			var addon_info_arr = null;
+			var extensionDir = bitsMarkingCollection.Common.getExtensionDir().clone();
+			if(extensionDir){
+				this._xmlfolder = extensionDir;
+				var xmlfile = extensionDir.clone();
+				xmlfile.append("db.xml");
+				var defaultMode = bitsMarkingCollection.Database._defaultMode;
+				if(!xmlfile.exists()){
+					var db_order = 0;
+					db_order++;
+					var aContent = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
+					aContent += '<!DOCTYPE DATABASES>\n<DATABASES>\n';
+					aContent += '  <DATABASE id="' + defaultMode + '" disabled="false" hidden="false" db_default="true" db_contextmenu="true" db_order="' + db_order + '">\n';
+					aContent += '    <DATABASE_TITLE>'  + bitsMarkingCollection.localfolder.title + '</DATABASE_TITLE>\n';
+					aContent += '    <DATABASE_DBTYPE>' + defaultMode + '</DATABASE_DBTYPE>\n';
+					aContent += '    <DATABASE_FILE>'   + bitsMarkingCollection.Common.convertFilePathToURL(bitsMarkingCollection.Database._getConnectFile(defaultMode).path) + '</DATABASE_FILE>\n';
+					aContent += '    <DATABASE_ICON>chrome://markingcollection/skin/localfolder.png</DATABASE_ICON>\n';
+					aContent += '  </DATABASE>\n';
+					aContent += '</DATABASES>\n';
+					bitsMarkingCollection.Common.writeFile(xmlfile,aContent,"UTF-8");
+				}
+				if(xmlfile.exists()){
+					function _loadXMLDocument(pUri){
+						if(pUri == undefined) return undefined;
+						var xmlDocument = bitsMarkingCollection.loadXMLDocument(pUri);
+						if(xmlDocument){
+							return xmlDocument.documentElement;
+						}else{
+							return undefined;
+						}
+					}
+					function _createXMLDocument(aXMLFile){
+						if(!aXMLFile) return undefined;
+						try{
+							return _loadXMLDocument(bitsMarkingCollection.Common.IO.newFileURI(aXMLFile).spec);
+						}catch(ex){
+							bitsMarkingCollection._dump("bitsMarkingCollection._createXMLDocument():"+ ex);
+							return undefined;
+						}
+					}
+					this._xmldoc = _createXMLDocument(xmlfile);
+
+					if(this._xmldoc && bitsMarkingCollection._uncategorized.use){
+						var elem = bitsContextMenu._contextMenuUncategorized;
+						if(elem){
+							elem.setAttribute("fid","0");
+							elem.setAttribute("_style",bitsMarkingCollection._uncategorized.style);
+							elem.setAttribute("dbtype",bitsMarkingCollection._uncategorized.dbtype);
+						}
+						bitsMarkingCollection.Database.init(bitsMarkingCollection._uncategorized.dbtype,bitsMarkingCollection._uncategorized.file);
+					}
+					if(this._xmldoc){
+						var alldbunused = nsPreferences.getBoolPref("wiredmarker.startup.alldbunused", false);
+						var elemDBs = this._xmldoc.getElementsByTagName("DATABASE");
+						if(elemDBs && elemDBs.length>0){
+							var check_init = false;
+							var check_default = false;
+							var check_contextmenu = false;
+							var i,j;
+							for(i=0;i<elemDBs.length;i++){
+								var elemDB = elemDBs[i];
+								var id = elemDB.getAttribute("id");
+								if(!id) continue;
+
+								if(!elemDB.hasAttribute("hidden")){
+									hasHidden = true;
+									elemDB.setAttribute("hidden","false");
+								}
+
+								var elemDBTYPE = elemDB.getElementsByTagName("DATABASE_DBTYPE")[0];
+								var elemFILE = elemDB.getElementsByTagName("DATABASE_FILE")[0];
+								if(!elemDBTYPE || !elemFILE) continue;
+								if(elemDBTYPE.textContent == "" || elemFILE.textContent == "") continue;
+
+								var db_default = (elemDB.getAttribute("db_default")=="true"?true:false);
+								if(!aForced && !db_default && alldbunused) elemDB.setAttribute("disabled",true);
+								var db_contextmenu = (elemDB.getAttribute("db_contextmenu")=="true"?true:false);
+
+								check_default |= db_default;
+								check_contextmenu |= db_contextmenu;
+
+								var disabled = elemDB.getAttribute("disabled");
+								if(disabled == "true"){
+									bitsMarkingCollection.Database.done(elemDBTYPE.textContent);
+									continue;
+								}
+								bitsMarkingCollection.Database.init(elemDBTYPE.textContent,bitsMarkingCollection.Common.convertURLToFile(elemFILE.textContent));
+
+								check_init = true;
+								try{
+									var version = bitsMarkingCollection.Database.getVersion(elemDBTYPE.textContent);
+									if(parseFloat(version?version:0)<parseFloat(bitsMarkingCollection.Database.version)){
+										bitsMarkingCollection.Database.convert( elemDBTYPE.textContent );
+										aForced = false;
+										alldbunused = true;
+									}
+								}catch(ex){
+									bitsMarkingCollection._dump("bitsMarkingCollection.dbinfo.init():"+ ex);
+								}
+							}
+							if(!check_init || !check_default){
+								for(i=0;i<elemDBs.length;i++){
+									var elemDB = elemDBs[i];
+									var id = elemDB.getAttribute("id");
+									if(!id) continue;
+
+									var elemDBTYPE = elemDB.getElementsByTagName("DATABASE_DBTYPE")[0];
+									var elemFILE = elemDB.getElementsByTagName("DATABASE_FILE")[0];
+									if(!elemDBTYPE || !elemFILE) continue;
+									if(elemDBTYPE.textContent == "" || elemFILE.textContent == "") continue;
+									elemDB.removeAttribute("disabled");
+									if(!check_default) elemDB.setAttribute("db_default",true);
+									if(!check_contextmenu) elemDB.setAttribute("db_contextmenu",true);
+									if(check_init) break;
+									bitsMarkingCollection.Database.init(elemDBTYPE.textContent,bitsMarkingCollection.Common.convertURLToFile(elemFILE.textContent));
+									try{
+										var version = bitsMarkingCollection.Database.getVersion(elemDBTYPE.textContent);
+										if(parseFloat(version?version:0)<parseFloat(bitsMarkingCollection.Database.version)){
+											bitsMarkingCollection.Database.convert( elemDBTYPE.textContent );
+										}
+									}catch(ex){
+										bitsMarkingCollection._dump("bitsMarkingCollection.dbinfo.init():"+ ex);
+									}
+									aForced = false;
+									alldbunused = true;
+									break;
+								}
+							}
+						}
+
+						if(hasHidden || (!aForced && alldbunused)){
+							var s = new XMLSerializer();
+							var xml = s.serializeToString(this._xmldoc);
+							bitsMarkingCollection.Common.writeFile(xmlfile, xml+"\n","UTF-8");
+						}
+					}
+				}
+			}
+		},
+
+		getAddonInfo : function(aDBType){
+			if(aDBType == undefined) return undefined;
+			if(this._xmldoc == undefined) this.init();;
+			if(this._xmldoc == undefined) return undefined;
+			var rtn = undefined;
+			var elemDBs = this._xmldoc.getElementsByTagName("DATABASE");
+			if(elemDBs && elemDBs.length>0){
+				var i,j;
+				for(i=0;i<elemDBs.length;i++){
+					var elemDB = elemDBs[i];
+					var id = elemDB.getAttribute("id");
+					if(!id || id != aDBType) continue;
+					for(j=0;j<elemDB.childNodes.length;j++){
+						var elem = elemDB.childNodes[j];
+						if(!elem.nodeName.match(/^ADDON_(.+)$/)) continue;
+						if(rtn == undefined) rtn = {};
+						var key = RegExp.$1.toLowerCase();
+						rtn[key] = elem.textContent;
+					}
+				}
+			}
+			return rtn;
+		},
+
+		getAllDBInfo : function(){
+			if(this._xmldoc == undefined) this.init();;
+			if(this._xmldoc == undefined) return undefined;
+			var rtn = undefined;
+			var attr = undefined;
+			var use_addon_dbtype = [];
+			if(bitsScrapPartyAddonService && bitsScrapPartyAddonService.existsAddon()){
+				var addon_info_arr = bitsScrapPartyAddonService.getAddonInfo();
+				if(addon_info_arr && addon_info_arr.length > 0){
+					var i;
+					for(i=0;i<addon_info_arr.length;i++){
+						if(addon_info_arr[i].dbtype == undefined) continue;
+						use_addon_dbtype[addon_info_arr[i].dbtype.value] = addon_info_arr[i].id.value;
+					}
+				}
+			}
+			if(bitsMarkingCollection._uncategorized.use){
+				if(rtn == undefined) rtn = [];
+				if(attr == undefined) attr = {};
+				attr.db_order = "0";
+				attr.db_default = false;
+				attr.db_contextmenu = false;
+				attr.database_title = bitsMarkingCollection._uncategorized.title;
+				attr.database_dbtype = bitsMarkingCollection._uncategorized.dbtype;
+				attr.database_file = bitsMarkingCollection.Common.IO.newFileURI(bitsMarkingCollection._uncategorized.file).spec;
+				rtn.push(attr);
+				attr = undefined;
+			}
+			var elemDBs = this._xmldoc.getElementsByTagName("DATABASE");
+			if(elemDBs && elemDBs.length>0){
+				var i,j;
+				for(i=0;i<elemDBs.length;i++){
+					var elemDB = elemDBs[i];
+					var id = elemDB.getAttribute("id");
+					if(!id) continue;
+					var disabled = elemDB.getAttribute("disabled");
+					if(disabled == "true") continue;
+					var db_order = parseInt(elemDB.getAttribute("db_order"));
+					var db_default = (elemDB.getAttribute("db_default")=="true"?true:false);
+					var db_contextmenu = (elemDB.getAttribute("db_contextmenu")=="true"?true:false);
+					for(j=0;j<elemDB.childNodes.length;j++){
+						var elem = elemDB.childNodes[j];
+						if(elem.nodeType != elem.ELEMENT_NODE) continue;
+						if(rtn == undefined) rtn = [];
+						if(attr == undefined) attr = {};
+						var key = elem.nodeName.toLowerCase();
+						attr[key] = elem.textContent;
+					}
+					if(attr["addon_dbtype"] && use_addon_dbtype[attr["addon_dbtype"]] == undefined){
+						attr = undefined;
+					}
+					if(rtn != undefined && attr != undefined){
+						if(db_order != undefined) attr["db_order"] = db_order;
+						if(db_default != undefined) attr["db_default"] = db_default;
+						if(db_default != undefined) attr["db_contextmenu"] = db_contextmenu;
+						rtn.push(attr);
+						attr = undefined;
+					}
+				}
+			}
+			return rtn;
+		},
+	},
+
+	Observer : {
+		domain  : 'wiredmarker', //"objectmng.xxx"ãšããååã®èš­å®ãå€æŽãããå Žåå
+šãŠã§åŠçãè¡ã
+		observe : function(aSubject, aTopic, aPrefstring) {
+			try{
+				if (aTopic == 'nsPref:changed') {
+					switch (aPrefstring){
+						case "wiredmarker.menu.position":
+							bitsMarkingCollection.disMainMenu()
+							break;
+						case "wiredmarker.uncategorized.use":
+							bitsMarkingCollection._uncategorized.use = nsPreferences.getBoolPref("wiredmarker.uncategorized.use", true);
+							bitsMarkingCollection.dbinfo.init();
+							break;
+						case "wiredmarker.uncategorized.style":
+							bitsMarkingCollection._uncategorized.style = nsPreferences.copyUnicharPref("wiredmarker.uncategorized.style", bitsMarkingCollection.STRING.getString("UN_FOLDER_STYLE"));
+							break;
+						case "wiredmarker.uncategorized.title":
+							bitsMarkingCollection._uncategorized.title = nsPreferences.copyUnicharPref("wiredmarker.uncategorized.title", bitsMarkingCollection.STRING.getString("UN_FOLDER"));
+							break;
+						default:
+							break;
+					}
+				}
+			}catch(ex){
+				window.top.bitsObjectMng.Common.alert("mcDatabaseObserver:"+ex);
+			}
+		},
+	},
+
+/////////////////////////////////////////////////////////////////////
+	progressListener : {
+		QueryInterface : function(aIID){
+			if(aIID.equals(Components.interfaces.nsIWebProgressListener) || aIID.equals(Components.interfaces.nsISupportsWeakReference) || aIID.equals(Components.interfaces.nsISupports)) return this;
+			throw Components.results.NS_NOINTERFACE;
+		},
+		onLocationChange : function(webProgress, aRequest, aURI){
+			if(webProgress.isLoadingDocument) return;
+
+			
+                        bitsMarkingCollection.marking(webProgress.DOMWindow.document);
+			bitsObjectMng.Common.pageshow(webProgress.DOMWindow.document);
+                        
+                        
+		},
+		onStateChange : function(webProgress, request, stateFlags, status){
+			if(webProgress.isLoadingDocument) return;
+                        
+                        //TODO: not good palcement, realod occurs all the time!
+                        annotationProxy.getAnnotations(webProgress.DOMWindow.document.URL);//Get all annotations on a specific url
+                        
+			bitsMarkingCollection.marking(webProgress.DOMWindow.document);
+			bitsObjectMng.Common.pageshow(webProgress.DOMWindow.document);
+		},
+		onProgressChange : function(){},
+		onStatusChange : function(){},
+		onSecurityChange : function(){},
+		onLinkIconAvailable : function(){}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getProfDir : function(){
+		var dir = this.Common.DIR.get("ProfD", Components.interfaces.nsIFile);
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getTmpDir : function(){
+		var dir = this.Common.DIR.get("TmpD", Components.interfaces.nsIFile);
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getTempDir : function(){
+		try{
+			var file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("TmpD", Components.interfaces.nsIFile);
+			file.append(this.STRING.getString("APP_TITLE"));
+			file.createUnique(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0700);
+			return file;
+		}catch(ex){
+			throw new Error("bitsMarkingCollection.getTempDir():"+ex);
+		}
+		return null;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getExtInstDir : function(){
+		var dir = null;
+		var id = bitsMarkingCollection.STRING.getString("APP_ID");
+		try{
+			dir = Components.classes["@mozilla.org/extensions/manager;1"].getService(Components.interfaces.nsIExtensionManager).getInstallLocation(id).getItemLocation(id);
+		}catch(ex){
+			dir = bitsMarkingCollection.getProfDir();
+			if(dir){
+				dir.append("extensions");
+				dir.append(id);
+			}
+		}
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getExtensionDir : function(){
+		var dir;
+		try {
+			var isDefault = nsPreferences.getBoolPref("wiredmarker.data.default");
+			dir = nsPreferences.getLocalizedUnicharPref("wiredmarker.data.path", Components.interfaces.nsIPrefLocalizedString).data;
+			dir = this.Common.convertPathToFile(dir);
+		}catch(ex){
+			isDefault = true;
+		}
+		if(isDefault){
+			var profDir = this.getProfDir();
+			if(profDir){
+				var oldAppDir = profDir.clone();
+				oldAppDir.append("ScrapParty");
+				if(oldAppDir && oldAppDir.exists()) oldAppDir.moveTo(profDir, this.STRING.getString("APP_TITLE"));
+			}
+			if(profDir){
+				dir = profDir.clone();
+				if(dir) dir.append(this.STRING.getString("APP_TITLE"));
+			}
+		}
+		if(dir && !dir.exists()) dir.create(dir.DIRECTORY_TYPE, 0700);
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getContentDir : function(aID, aSuppressCreate){
+		var dir = this.getExtensionDir().clone();
+		dir.append("data");
+		if(!dir.exists()) dir.create(dir.DIRECTORY_TYPE, 0700);
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	disMainMenu : function(){
+		var disp = nsPreferences.getBoolPref("wiredmarker.menu.topmenu", true);
+		var position = nsPreferences.copyUnicharPref("wiredmarker.menu.position", null);
+		if(position == null){
+			position = this._app_version<4?"topmenu":"appmenu";
+			var isXp = false;
+			var res = window.navigator.oscpu.match(/Windows NT (.+)/);
+			if(res && res[1]<6) isXp = true;
+			if(this._app_version>=4 && isXp) position = "topmenu";
+			setTimeout(function(){nsPreferences.setUnicharPref("wiredmarker.menu.position", position);},0);
+			return;
+		}
+		if(position == "appmenu" &&
+			Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS != "WINNT"){
+			position = "topmenu";
+			setTimeout(function(){nsPreferences.setUnicharPref("wiredmarker.menu.position", position);},0);
+			return;
+		}
+		var menu_AppBits = window.top.document.getElementById("bitsExtensionsAppMenu");
+		var menu_MainBits = window.top.document.getElementById("bitsExtensionsMainMenu");
+		var menu_ToolsBits = window.top.document.getElementById("bitsExtensionsToolsMenu");
+		var menu_BookmarksBits = window.top.document.getElementById("bitsExtensionsBookmarksMenu");
+		var menuseparator_BookmarksBits = window.top.document.getElementById("bitsExtensionsBookmarksMenuseparator");
+		if(!menu_MainBits || !menu_ToolsBits || !menu_BookmarksBits) return;
+
+		var menu_child;
+		if(position != "appmenu" && menu_AppBits && menu_AppBits.hasChildNodes()){
+			menu_child = menu_AppBits.firstChild.cloneNode(true);
+		}else if(position != "topmenu" && menu_MainBits.hasChildNodes()){
+			menu_child = menu_MainBits.firstChild.cloneNode(true);
+		}else if(position != "tools" && menu_ToolsBits.hasChildNodes()){
+			menu_child = menu_ToolsBits.firstChild.cloneNode(true);
+		}else if(position != "bookmarks" && menu_BookmarksBits.hasChildNodes()){
+			menu_child = menu_BookmarksBits.firstChild.cloneNode(true);
+		}
+
+		if(menu_AppBits) menu_AppBits.setAttribute("hidden",true);
+		menu_MainBits.setAttribute("hidden",true);
+		menu_ToolsBits.setAttribute("hidden",true);
+		menu_BookmarksBits.setAttribute("hidden",true);
+		if(menuseparator_BookmarksBits) menuseparator_BookmarksBits.setAttribute("hidden","true");
+
+		switch(position){
+			case "bookmarks":
+				if(menu_child) menu_BookmarksBits.appendChild(menu_child);
+				menu_BookmarksBits.removeAttribute("hidden");
+				if(menuseparator_BookmarksBits) menuseparator_BookmarksBits.removeAttribute("hidden");
+				break;
+			case "tools":
+				if(menu_child) menu_ToolsBits.appendChild(menu_child);
+				menu_ToolsBits.removeAttribute("hidden");
+				break;
+			case "appmenu":
+				if(menu_AppBits){
+					if(menu_child) menu_AppBits.appendChild(menu_child);
+					menu_AppBits.removeAttribute("hidden");
+				}
+				break;
+			default:
+				if(menu_child) menu_MainBits.appendChild(menu_child);
+				menu_MainBits.removeAttribute("hidden");
+				break;
+		}
+
+		if(!menu_child) return;
+
+		if(position != "appmenu" && menu_AppBits && menu_AppBits.hasChildNodes()){
+			while(menu_AppBits.hasChildNodes()){
+				menu_AppBits.removeChild(menu_AppBits.lastChild);
+			}
+		}
+		if(position != "topmenu" && menu_MainBits.hasChildNodes()){
+			while(menu_MainBits.hasChildNodes()){
+				menu_MainBits.removeChild(menu_MainBits.lastChild);
+			}
+		}
+		if(position != "tools" && menu_ToolsBits.hasChildNodes()){
+			while(menu_ToolsBits.hasChildNodes()){
+				menu_ToolsBits.removeChild(menu_ToolsBits.lastChild);
+			}
+		}
+		if(position != "bookmarks" && menu_BookmarksBits.hasChildNodes()){
+			while(menu_BookmarksBits.hasChildNodes()){
+				menu_BookmarksBits.removeChild(menu_BookmarksBits.lastChild);
+			}
+		}
+
+	},
+
+/////////////////////////////////////////////////////////////////////
+	dispHP : function(addon){
+		var self = bitsMarkingCollection;
+		self._version = addon.version;
+		//æåã®ã€ã³ã¹ããŒã«åŸã«ããŒã ããŒãžãéã
+		var version = nsPreferences.copyUnicharPref("wiredmarker.version");
+		if(version == null || version != self._version){
+			if(parseFloat(version) <= parseFloat("3.1.09020400")){
+				var textplain_display = nsPreferences.copyUnicharPref("wiredmarker.textplain.display","usually");
+				if(textplain_display != "usually") nsPreferences.setUnicharPref("wiredmarker.textplain.display", "usually");
+			}
+			// self.Common.loadURL(self._homepage+"?version="+encodeURIComponent(self._version)+"&locale="+encodeURIComponent(self.DEF_STRING.getString("general.useragent.locale")),true);
+                        self.Common.loadURL(self._homepage,true);
+			nsPreferences.setUnicharPref("wiredmarker.version", self._version);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	init : function(aEvent){
+		if(bitsMarkingCollection._init) return;
+		try{
+			if(!bitsObjectMng){
+				setTimeout(function(){bitsMarkingCollection.init(aEvent)},1000);
+				return;
+			}
+		}catch(ex){
+			setTimeout(function(){bitsMarkingCollection.init(aEvent)},1000);
+			return;
+		}
+		try{
+			var info = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
+			this._app_version = parseInt(info.version);
+		}catch(e){}
+		try{
+			/* ver2.0 ãš ver3.0 ã§ã¯ããã¯ããŒã¯ã¡ãã¥ãŒã®IDãéãçºãåçã«ã¡ãã¥ãŒãçæ */
+			var insertafter = null;
+			var menuelem = this.BOOKMARKS_MENU_2;
+			if(menuelem){
+				var elem = document.getElementById("bookmarkAllCmd");
+				if(elem){
+					if(elem.nextSibling && elem.nextSibling.nextSibling) insertafter = elem.nextSibling.nextSibling;
+				}else{
+					menuelem = undefined;
+				}
+			}else{
+				menuelem = this.BOOKMARKS_MENU_3;
+				var elem = document.getElementById("organizeBookmarksSeparator");
+				if(elem){
+					insertafter = elem;
+				}else{
+					menuelem = undefined;
+				}
+			}
+			if(menuelem && menuelem.hasChildNodes()){
+				var childnode = menuelem.firstChild;
+				while(childnode){
+					if(childnode.nodeName.toLowerCase() == "menupopup") break;
+					childnode = menuelem.nextSibling;
+				}
+				if(childnode){
+					var doc = menuelem.ownerDocument;
+					var menu = doc.createElement("menu");
+					var menuseparator = doc.createElement("menuseparator");
+					if(menu && menuseparator){
+						menu.setAttribute("id","bitsExtensionsBookmarksMenu");
+						/* menu.setAttribute("class","menu-iconic");
+						menu.setAttribute("image","chrome://markingcollection/skin/icon_16.gif"); */
+						menu.setAttribute("hidden","true");
+						menu.setAttribute("label",this.STRING.getString("APP_DISP_TITLE"));
+						menu.setAttribute("accesskey","M");
+						menuseparator.setAttribute("id","bitsExtensionsBookmarksMenuseparator");
+						menuseparator.setAttribute("hidden","true");
+						if(insertafter && insertafter.nextSibling){
+							var nextSibling = insertafter.nextSibling;
+							childnode.insertBefore(menu,nextSibling);
+							childnode.insertBefore(menuseparator,nextSibling);
+						}else{
+							childnode.appendChild(menu);
+							childnode.appendChild(menuseparator);
+						}
+					}
+				}
+			}
+		}catch(ex){
+			this.Common.alert("bitsMarkingCollection.init():"+ex);
+		}
+		if(nsPreferences.getBoolPref("wiredmarker.debug", false)) this.showConsole();
+		try{
+			var em = Components.classes["@mozilla.org/extensions/manager;1"].getService(Components.interfaces.nsIExtensionManager);
+			this.dispHP(em.getItemForID(this.STRING.getString("APP_ID")));
+		}catch(ex){
+			Components.utils.import("resource://gre/modules/AddonManager.jsm");
+			AddonManager.getAddonByID(this.STRING.getString("APP_ID"), bitsMarkingCollection.dispHP);
+		}
+
+		//å€ãèš­å®ãåé€
+		var i;
+		var userPrefs = [
+			"scrapparty.menu.topmenu",
+			"objectmng.last_update",
+			"markingcollection.viewmode",
+			"markingcollection.rootfolder",
+			"markingcollection.rootfolder_dbtype",
+			"markingcollection.folderautoopen",
+			"markingcollection.filter.folder",
+			"markingcollection.folderstyleindex",
+			"markingcollection.filter.folder",
+			"markingcollection.filter.keyword",
+			"markingcollection.propertyview",
+			"markingcollection.multidocument",
+			"scrappartymerge.merge",
+			"scrappartymerge.conditionMerge",
+			"scrappartymerge.confirmMerge",
+			"scrapparty.startup.alldbunused",
+			"wiredmarker.autocache.manually.exec",
+			"wiredmarker.autocache.manually.confirm",
+		];
+		for(i=8;i>0;i--){
+			userPrefs.push("markingcollection.marker.style." + i);
+		}
+		for(i=0;i<userPrefs.length;i++){
+			try{
+				this.Common.PREF.clearUserPref(userPrefs[i]);
+			}catch(ex){}
+		}
+		this._uncategorized.use = nsPreferences.getBoolPref("wiredmarker.uncategorized.use", true);
+		this._uncategorized.style = nsPreferences.copyUnicharPref("wiredmarker.uncategorized.style", this.STRING.getString("UN_FOLDER_STYLE"));
+		this._uncategorized.title = nsPreferences.copyUnicharPref("wiredmarker.uncategorized.title", this.STRING.getString("UN_FOLDER"));
+		this._uncategorized.file = this.getExtensionDir().clone();
+		this._uncategorized.file.append(this._uncategorized.dbtype+".sqlite");
+		try{
+			//ã¡ãã¥ãŒè¡šç€ºäœçœ®ã®åŠç
+			this.disMainMenu();
+			try{
+				bitsObjectMng.getBrowser().addEventListener("pageshow", bitsMarkingCollection.load,   false);
+				bitsObjectMng.getBrowser().addEventListener("pagehide", bitsMarkingCollection.unload, false);
+				bitsObjectMng.getBrowser().addEventListener("select",   bitsMarkingCollection.select, false);
+			}catch(ex2){
+				this.Common.alert("bitsMarkingCollection.init(4):"+ex2);
+			}
+			if(this._app_version<4) bitsObjectMng.getBrowser().addProgressListener(bitsMarkingCollection.progressListener, Components.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
+			else bitsObjectMng.getBrowser().addProgressListener(bitsMarkingCollection.progressListener);
+			try{
+				bitsMarkingCollection.sharedfolder.init();
+			}catch(ex2){
+				this.Common.alert("bitsMarkingCollection.init(5):"+ex2);
+			}
+			bitsHTML2XHTMLService.init();
+			bitsMarkingCollection.dbinfo.init();
+			bitsMarker.init();
+			bitsContextMenu.init();
+			bitsMenuTree.init();
+			bitsTreeListService.init();
+			bitsTreeExportService.init();
+			bitsSubstitutionTree.init();
+			bitsTreeProjectService.init();
+			bitsAutocacheService.init();
+			bitsShortcutService.init();
+			bitsMetaCapture.init();
+			bitsPubmedCentralService.init();
+			bitsScrapPartyAddonService.init(aEvent);
+			// ãããŒHYPER-ANCHORåŠç
+			try{
+				if(!bitsHyperAnchor || bitsHyperAnchor.clickLinkIcon == undefined) bitsHyperAnchorDummy.init(aEvent);
+			}catch(ex2){
+				bitsHyperAnchorDummy.init(aEvent);
+			}
+			bitsMarkingCollection._init = true;
+			bitsMarkingCollection.Common.addPrefListener(bitsMarkingCollection.Observer);
+                        
+                        annotationProxy.getAnnotations('');//Get all annotations
+		}catch(ex){
+			this.Common.alert("bitsMarkingCollection.init():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(aEvent){
+		if(bitsMarkingCollection._init){
+			bitsObjectMng.getBrowser().removeProgressListener(bitsMarkingCollection.progressListener);
+			bitsObjectMng.getBrowser().removeEventListener("pageshow", bitsMarkingCollection.load,   false);
+			bitsObjectMng.getBrowser().removeEventListener("pagehide", bitsMarkingCollection.unload, false);
+			bitsObjectMng.getBrowser().removeEventListener("select",   bitsMarkingCollection.select, false);
+			bitsMarkingCollection.Common.removePrefListener(bitsMarkingCollection.Observer);
+			bitsSubstitutionTree.done();
+			bitsTreeExportService.done();
+			bitsTreeListService.done();
+			bitsMenuTree.done();
+			bitsContextMenu.done();
+			bitsAutocacheService.done();
+			bitsShortcutService.done();
+			bitsMetaCapture.done();
+			bitsPubmedCentralService.done();
+			bitsScrapPartyAddonService.done(aEvent);
+			try{
+				if(!bitsHyperAnchor || bitsHyperAnchor.clickLinkIcon == undefined) bitsHyperAnchorDummy.done(aEvent);
+			}catch(ex2){
+				bitsHyperAnchorDummy.done(aEvent);
+			}
+		}
+		for(var i=0;i<this._removefile.length;i++){
+			if(this._removefile[i].exists()) this._removefile[i].remove(true);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	load : function(event){
+		var aEvent = event;
+		bitsScrapPartyAddonService.eventListener(aEvent,0);
+		var rtn = bitsMarkingCollection.marking(aEvent.target);
+		bitsScrapPartyAddonService.eventListener(aEvent,1);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	marking : function(aDoc, aContentURLString){
+		var url;
+                
+		if(aContentURLString){
+			url = aContentURLString;
+		}else{
+			url = this.Common.getURLStringFromDocument(aDoc);
+		}
+                
+		if(url.indexOf("chrome:") >= 0 || url.indexOf("about:") >= 0) return;
+		if(bitsObjectMng.getBrowser().contentDocument.location == aDoc.location) bitsMarkingCollection._location = aDoc.location;
+//this._dump("marking():url=["+url+"]");
+                //alert('marking: '+url+' aDoc '+aDoc.location);
+		var rtnObj = bitsMarkingCollection.Database.getAllObjectFormContentURL(url);
+		if(rtnObj){
+			if(this._markingtimer) clearTimeout(this._markingtimer);
+			this._markingtimer = null;
+			this.endProgessmeter();
+			if(rtnObj.length>0) rtnObj.sort(function(a,b){return parseInt(a.oid)-parseInt(b.oid);});
+			if(rtnObj.length>=100){
+				this.initProgressmeter();
+				var self = this;
+				this._markingtimer = setTimeout(function(){ self.marking_proc(aDoc,rtnObj,0,aContentURLString); },0);
+			}else{
+				var cnt;
+this._dump("marking():rtnObj=["+rtnObj.length+"]");
+				for(cnt=0;cnt<rtnObj.length;cnt++){
+					var rObj = rtnObj[cnt];
+					if(rObj.oid_type.match(/^image\/(.+)$/)) continue;
+					if(!aDoc.defaultView) return;
+					var style;
+					if(rObj.pfid == "0" && rObj.dbtype == bitsMarkingCollection._uncategorized.dbtype){
+						style = bitsMarkingCollection._uncategorized.style;
+					}else{
+						style = rObj.fid_style;
+					}
+					var rtnContent = bitsMarker.xPathMarker(
+						aDoc,
+						{
+							start   : rObj.bgn_dom,
+							end     : rObj.end_dom,
+							context : rObj.oid_txt,
+							con_url : (aContentURLString ? this.Common.getURLStringFromDocument(aDoc) : rObj.con_url)
+						},
+						{
+							id     : rObj.oid,
+							dbtype : rObj.dbtype,
+							pfid   : rObj.pfid,
+							style  : style
+						}
+					);
+					if(rtnContent){
+						for(var key in rtnContent){
+							this._dump("marking():rtnContent["+key+"]=["+rtnContent[key]+"]");
+						}
+					}else{
+this._dump("marking():rtnContent=["+rtnContent+"]");
+					}
+				}
+			}
+		}
+		return true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	marking_proc : function(aDoc,aArr,aIndex,aContentURLString){
+		if(aIndex>=aArr.length || !this._markingtimer){
+			this.endProgessmeter();
+			return;
+		}
+		var endNum = aIndex+20;
+		for(;aIndex<aArr.length && aIndex<endNum;aIndex++){
+			var rObj = aArr[aIndex];
+			if(rObj.oid_type.match(/^image\/(.+)$/)) continue;
+			if(!aDoc.defaultView) return;
+			var style;
+			if(rObj.pfid == "0" && rObj.dbtype == bitsMarkingCollection._uncategorized.dbtype){
+				style = bitsMarkingCollection._uncategorized.style;
+			}else{
+				style = rObj.fid_style;
+			}
+			var rtnContent = bitsMarker.xPathMarker(
+					aDoc,
+					{
+						start   : rObj.bgn_dom,
+						end     : rObj.end_dom,
+						context : rObj.oid_txt,
+						con_url : (aContentURLString ? this.Common.getURLStringFromDocument(aDoc) : rObj.con_url)
+					},
+					{
+						id     : rObj.oid,
+						dbtype : rObj.dbtype,
+						pfid   : rObj.pfid,
+						style  : style
+					}
+				);
+		}
+		var self = this;
+		this._markingtimer = setTimeout(function(){ self.marking_proc(aDoc,aArr,aIndex,aContentURLString); },0);
+		this.execProgressmeter(parseInt((aIndex/aArr.length)*100));
+	},
+
+/////////////////////////////////////////////////////////////////////
+	unload : function(event){
+		bitsScrapPartyAddonService.eventListener(event,1);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	select : function(event){
+		bitsScrapPartyAddonService.eventListener(event,1);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	openPrefWindow : function(){
+		var self = this;
+		setTimeout(function(){
+			var lastModifiedTime = 0;
+			var xmlfile = self.Common.getExtensionDir().clone();
+			xmlfile.append("db.xml");
+			if(xmlfile.exists()) lastModifiedTime = xmlfile.lastModifiedTime;
+			var uncategorized_use = nsPreferences.getBoolPref("wiredmarker.uncategorized.use", true);
+			var result = {};
+			window.openDialog(
+				"chrome://markingcollection/content/settingDialog.xul", "AllMarker:Setting",
+				"chrome,titlebar,toolbar,centerscreen,modal",result
+			);
+			if(result.reboot){
+				if(self.Common.confirm(self.STRING.getString("CONFIRM_SETTING_CHANGE_RESTART_APP"))){
+					self.reboot();
+					return;
+				}
+			}
+			self.dbinfo.init(true);
+			bitsContextMenu.rebuildCSS();
+			//ãã¡ã€ã«ãæŽæ°ãããŠããã®ã§è¡šç€ºå
+å®¹ãæŽæ°ããã
+			if((xmlfile.exists() && lastModifiedTime != xmlfile.lastModifiedTime) || (uncategorized_use != nsPreferences.getBoolPref("wiredmarker.uncategorized.use", true))){
+				var contentWindow = null;
+				var mcTreeViewModeService = null;
+				var bitsTreeDate = null;
+				if(self._contentWindow) contentWindow = self._contentWindow;
+				if(contentWindow && contentWindow.mcTreeViewModeService) mcTreeViewModeService = contentWindow.mcTreeViewModeService;
+				if(contentWindow && contentWindow.bitsTreeDate) bitsTreeDate = contentWindow.bitsTreeDate;
+				if(mcTreeViewModeService) mcTreeViewModeService.rebuild();
+				if(bitsTreeDate) bitsTreeDate.refresh();
+			}
+			xmlfile = undefined;
+		},100); //onpopuphidingã€ãã³ããçºçãããŸã§100mså¿
+èŠïŒ
+	},
+
+/////////////////////////////////////////////////////////////////////
+	reboot : function(){
+		var os = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
+		var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"].createInstance(Components.interfaces.nsISupportsPRBool);
+		os.notifyObservers(cancelQuit, "quit-application-requested", "restart");
+		if (cancelQuit.data) return;
+		var nsIAppStartup = Components.interfaces.nsIAppStartup;
+		Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(nsIAppStartup).quit(nsIAppStartup.eRestart | nsIAppStartup.eAttemptQuit);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	reOrder : function(aParRes){
+		try{
+			var dbtype;
+			var pfid_order = 1;
+			var pfid = this.DataSource.getProperty(aParRes,"id");
+			var listContRes = this.DataSource.seqResources(aParRes);
+			var i;
+			for(i=0;i<listContRes.length;i++){
+				var dbitem = {};
+				dbitem.pfid = pfid;
+				dbitem.pfid_order = pfid_order;
+				if(this.DataSource.isContainer(listContRes[i])){
+					dbitem.fid = this.DataSource.getProperty(listContRes[i],"id");
+					dbtype = this.DataSource.getProperty(listContRes[i],"dbtype");
+					var changed = this.Database.updateFolder(dbitem,dbtype);
+				}else{
+					dbitem.oid = this.DataSource.getProperty(listContRes[i],"id");
+					dbtype = this.DataSource.getProperty(listContRes[i],"dbtype");
+					var changed = this.Database.updateObject(dbitem,dbtype);
+				}
+				pfid_order++;
+			}
+		}catch(ex){
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	addPDFText : function(aParName, aIdx, aRow, aXferString, aRebuild, aIsCacheConfirm){
+		var MIMEType = "application/pdf";
+		var PrimaryExtension = "pdf";
+		if(this.gBrowser.contentDocument.contentType != MIMEType) return undefined;
+		try{
+			if(aRebuild == undefined) aRebuild = true;
+			if(aIsCacheConfirm == undefined) aIsCacheConfirm = true;
+			var rtn = false;
+			var url = this.Common.getURLStringFromDocument(this.gBrowser.contentDocument);
+			var url_title = aXferString;
+			var comment_url = url;
+			var doc_url = url;
+			var con_url = url;
+			if(aIsCacheConfirm && !bitsAutocacheService.isMarking(doc_url)) return true;
+			var stXPath = null;
+			var enXPath = null;
+			var hyperAnchor = null;
+			var rtnNewRes = [];
+			var parentID  = 0;
+			var style = "";
+			var dbtype = "";
+			if(typeof aParName == "string"){
+				var aRes = this.Common.RDF.GetResource(aParName);
+				style = this.DataSource.getProperty(aRes,"style");
+				dbtype = this.DataSource.getProperty(aRes,"dbtype");
+				if(aParName != this.DataSource.ABOUT_ROOT) parentID = this.DataSource.getProperty(aRes,"id");
+			}else{
+				parentID = aParName.fid;
+				style = aParName.fid_style;
+				dbtype = aParName.dbtype;
+			}
+			var pfid_order = this.Database.getMaxOrderFormPID(parentID);
+			url_title = url_title.replace(/^\s+/mg,"").replace(/\s+$/mg,"");
+			var rObj = this.Database.newObject(undefined,dbtype);
+			if(rObj){
+				rObj.pfid = parentID;
+				rObj.doc_url = bitsAutocacheService.convertCacheURLToOriginalURL(doc_url);
+				rObj.doc_title = this.gBrowser.contentDocument.title?this.gBrowser.contentDocument.title:rObj.doc_url;
+				if(bitsAutocacheService.isCacheURL(doc_url)){
+					var info = bitsAutocacheService.getSaveCacheInfo(doc_url);
+					if(info && info.TITLE) rObj.doc_title = info.TITLE;
+				}
+				rObj.con_url = bitsAutocacheService.convertCacheURLToOriginalURL(con_url);
+				if(stXPath && enXPath){
+					rObj.bgn_dom = stXPath.xpath + "("+stXPath.offset+")" + "("+stXPath.type+")";
+					rObj.end_dom = enXPath.xpath + "("+enXPath.offset+")" + "("+enXPath.type+")";
+				}
+				rObj.oid_title = url_title;
+				if(rObj.oid_title == "") rObj.oid_title = decodeURIComponent(this.Common.getFileName(url));
+				if(rObj.oid_title == "") rObj.oid_title = decodeURIComponent(url);
+				rObj.oid_type = MIMEType;
+				rObj.oid_property = "";
+
+				var parser = new DOMParser();
+				var xmldoc = parser.parseFromString("<PROPERTY/>","text/xml");
+				if(xmldoc){
+					if(xmldoc.documentElement){
+						var icon = "";
+						try{
+							var pext = this.Common.MIME.getPrimaryExtension(MIMEType,PrimaryExtension)
+							icon = "d."+pext;
+						}catch(e){
+							icon = "d.pdf";
+						}
+						var xmlnode = xmldoc.createElement("ICON");
+						if(xmlnode){
+							xmlnode.appendChild(xmldoc.createTextNode("moz-icon://"+icon+"?size=16"));
+							xmldoc.documentElement.appendChild(xmlnode);
+						}
+						var s = new XMLSerializer();
+						rObj.oid_property = s.serializeToString(xmldoc);
+						s = undefined;
+					}
+				}
+				parser = undefined;
+				xmldoc = undefined;
+
+				rObj.oid_mode = "0";
+				rObj.oid_title = this.Common.exceptCode(aXferString.replace(/[\r\n\t]+/mg," ").replace(/\s{2,}/mg," "));
+				rObj.oid_txt = this.Common.exceptCode(aXferString.replace(/\s+$/mg,"").replace(/^\s+/mg,""));
+				rObj.oid_date = bitsAutocacheService.getURLTimeStampFormatDate(doc_url);
+				rObj.pfid_order = ++pfid_order;
+			}
+
+			if(rObj){
+				var rtnObj = bitsPubmedCentralService.getPubmedInfoSync(rObj);
+				rObj = this.setInitMarkerData(rtnObj?rtnObj:rObj,false);
+				var result = {
+					con_url   : rObj.con_url,
+					title     : rObj.oid_title,
+					property  : rObj.oid_property,
+					doc_title : rObj.doc_title
+				};
+				window.openDialog("chrome://markingcollection/content/confirmAddTextDialog.xul", "", "chrome,centerscreen,modal", result);
+				if(!result.accept) return true;
+				rObj.oid_title = result.title;
+				rObj.doc_title = result.doc_title;
+				rObj.oid_property = result.property;
+			}
+			if(rObj){
+				var rtn = this.Database.addObject(rObj,dbtype);
+				if(rtn){
+					rObj = this.Database.getObject({oid:rObj.oid,pfid:rObj.pfid},dbtype)[0];
+				}else{
+					rObj = undefined;
+				}
+			}
+			if(rObj){
+				bitsAutocacheService.createCache(rObj.doc_url,undefined,aRebuild);
+				var newDCitem = this.Database.makeObjectToItem(rObj);
+				if(url.indexOf("file://") == 0){
+					newDCitem.title = rObj.oid_title;
+				}else{
+					newDCitem.icon = this.Database.getFavicon(rObj.doc_url,dbtype);
+				}
+				var rtnContent = null;
+				if(rtnContent && rtnContent.length && rtnContent.length>0) newDCitem.source = rtnContent[0].id;
+				var newRes = null;
+ 				if(typeof aParName != "string"){
+					var f_pfid = undefined;
+					var rtnFolder = this.Database.getFolder({fid:parentID},dbtype);
+					if(rtnFolder && rtnFolder.length) f_pfid = rtnFolder[0].pfid;
+					rtnFolder = undefined;
+					aParName = bitsObjectMng.DataSource.getID2About(parentID,f_pfid,dbtype);
+				}
+				var contentWindow = null;
+				var mcTreeHandler = null;
+				var bitsItemView = null;
+				var bitsTreeDate = null;
+				if(this._contentWindow) contentWindow = this._contentWindow;
+				if(contentWindow && contentWindow.mcTreeHandler) mcTreeHandler = contentWindow.mcTreeHandler;
+				if(contentWindow && contentWindow.bitsItemView) bitsItemView = contentWindow.bitsItemView;
+				if(contentWindow && contentWindow.bitsTreeDate) bitsTreeDate = contentWindow.bitsTreeDate;
+				if(!bitsItemView || !bitsItemView.isChecked){
+					if(rtn) newRes = this.DataSource.addItem(newDCitem, aParName, aIdx, dbtype);
+					if(newRes){
+						this.DataSource.flush();
+						//è¿œå ããObjectã«ãã©ãŒã«ã¹ãç§»ã
+						var mcPropertyView = null;
+						if(contentWindow && contentWindow.mcPropertyView) mcPropertyView = contentWindow.mcPropertyView;
+						if(mcTreeHandler){
+							var folderautoopen = nsPreferences.getBoolPref("wiredmarker.folderautoopen", true);
+							if(!folderautoopen){
+								var parentRes = this.DataSource.findParentResource(newRes);
+								var parentIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(parentRes);
+								if(parentIdx>=0) folderautoopen = mcTreeHandler.TREE.view.isContainerOpen(parentIdx);
+							}
+							if(folderautoopen){
+								var resArr = [];
+								var parentRes = newRes;
+								do{
+									parentRes = this.DataSource.findParentResource(parentRes);
+									if(parentRes) resArr.push(parentRes);
+								}while(parentRes && parentRes.Value != this.DataSource.ABOUT_ROOT);
+								var i;
+								for(i=resArr.length-1;i>=0;i--){
+									var selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(resArr[i]);
+									if(selectIdx>=0 && !mcTreeHandler.TREE.view.isContainerOpen(selectIdx)) mcTreeHandler.TREE.view.toggleOpenState(selectIdx);
+								}
+								var selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(newRes);
+								if(selectIdx>=0){
+									mcTreeHandler.TREE.currentIndex = selectIdx;
+									if(!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex)) mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+									mcTreeHandler.TREE.focus();
+									mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(selectIdx);
+									if(mcPropertyView) mcPropertyView.dispProperty(mcTreeHandler.object);
+								}
+							}
+						}
+						rtnNewRes.push(newRes);
+					}
+				}else if(bitsItemView && bitsItemView.isChecked){
+					if(mcTreeHandler){
+						var resArr = [];
+						var parentRes = this.Common.RDF.GetResource(aParName);
+						do{
+							parentRes = this.DataSource.findParentResource(parentRes);
+							if(parentRes) resArr.push(parentRes);
+						}while(parentRes && parentRes.Value != this.DataSource.ABOUT_ROOT);
+						var i;
+						for(i=resArr.length-1;i>=0;i--){
+							var selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(resArr[i]);
+							if(selectIdx>=0 && !mcTreeHandler.TREE.view.isContainerOpen(selectIdx)) mcTreeHandler.TREE.view.toggleOpenState(selectIdx);
+						}
+						var selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(this.Common.RDF.GetResource(aParName));
+						if(selectIdx>=0){
+							mcTreeHandler.TREE.currentIndex = selectIdx;
+							if(!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex)) mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+							mcTreeHandler.TREE.focus();
+							mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(selectIdx);
+							if(mcPropertyView) mcPropertyView.dispProperty(mcTreeHandler.object);
+						}
+					}
+					try{
+						if(aRebuild && bitsItemView){
+							if(bitsTreeDate && bitsTreeDate.isChecked){
+								var param = {dbtype:dbtype};
+								for(var key in rObj){
+									param[key] = rObj[key];
+								}
+								bitsTreeDate.onSelectTab(param);
+							}else{
+								var aRes = this.Common.RDF.GetResource(aParName);
+								var viewmode = this._contentWindow.mcTreeViewModeService.viewmode;
+								var fid = this.DataSource.getProperty(aRes, "id");
+								var dbtype = this.DataSource.getProperty(aRes, "dbtype");
+								var oid = rObj.oid;
+								bitsItemView.onTreeClick({viewmode:viewmode,fid:fid,dbtype:dbtype,res:aRes});
+								bitsItemView.setSelection(oid,dbtype);
+								setTimeout(function(){ bitsItemView.setSelection(oid,dbtype); },500);
+							}
+						}
+					}catch(ex){ bitsMarkingCollection._dump("bitsMarkingCollection.addURLText():"+ex); }
+				}
+				var param = {
+					id      : rObj.oid,
+					dbtype  : dbtype,
+					rebuild : aRebuild,
+				};
+				if(bitsItemView && !bitsItemView.isChecked){
+					if(newRes) param.res = newRes;
+				}else if(bitsItemView){
+					param.res = this.Common.RDF.GetResource(aParName);
+				}
+				if(url.indexOf("http://") == 0 || url.indexOf("https://") == 0 || url.indexOf("ftp://") == 0){
+					this.getContentTypeFromURL(this.gBrowser.contentDocument, url, param);
+				}else if(url.indexOf("file://") == 0){
+					this._oID = rObj.oid;
+					this._dbtype = dbtype;
+					this.BROWSER.addEventListener("pageshow", bitsMarkingCollection.loadFile, true);
+					this.BROWSER.loadURI(url);
+				}
+				rObj = undefined;
+				newDCitem = undefined;
+				rtn = true;
+			}
+		}catch(ex){
+			bitsMarkingCollection._dump("bitsMarkingCollection.addPDFText():"+ex);
+		}
+		if(rtn)
+			return rtn;
+		else
+			return undefined;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	addURLText : function(aParName, aIdx, aRow, aXferString, aOriginalTarget, aRebuild, aIsCacheConfirm){
+		try{
+			if(aRebuild == undefined) aRebuild = true;
+			if(aIsCacheConfirm == undefined) aIsCacheConfirm = true;
+			var rtn = false;
+			var url = aXferString.split("\n")[0];
+			var url_title = aXferString.split("\n")[1];
+			if(!url_title || url == url_title) url_title = "";
+			var comment_url = url;
+			var doc_url = url;
+			var con_url = url;
+			var doc_url_hash = "";
+			if(aOriginalTarget){
+				doc_url = this.Common.getURLStringFromDocument(this.gBrowser.contentDocument);
+				doc_url_hash = this.Common.getURLHashStringFromDocument(this.gBrowser.contentDocument);
+				if(aIsCacheConfirm && !bitsAutocacheService.isMarking(doc_url)) return undefined;
+			}
+			var stXPath = null;
+			var enXPath = null;
+			var hyperAnchor = null;
+			var rtnNewRes = [];
+			var parentID  = 0;
+			var style = "";
+			var dbtype = "";
+			if(typeof aParName == "string"){
+				var aRes = this.Common.RDF.GetResource(aParName);
+				style = this.DataSource.getProperty(aRes,"style");
+				dbtype = this.DataSource.getProperty(aRes,"dbtype");
+				if(aParName != this.DataSource.ABOUT_ROOT) parentID = this.DataSource.getProperty(aRes,"id");
+			}else{
+				parentID = aParName.fid;
+				style = aParName.fid_style;
+				dbtype = aParName.dbtype;
+			}
+			var pfid_order = this.Database.getMaxOrderFormPID(parentID);
+			if(aOriginalTarget && (aOriginalTarget.nodeName == "IMG" || aOriginalTarget.nodeName == "A")){
+				if(aOriginalTarget.nodeName == "IMG"){
+					url = aOriginalTarget.src;
+					if(aOriginalTarget.alt) url_title = aOriginalTarget.alt;
+				}
+				var doc = aOriginalTarget.ownerDocument;
+				var range = doc.createRange();
+				if(aOriginalTarget.nodeName == "IMG"){
+					range.selectNodeContents(aOriginalTarget);
+				}else if(aOriginalTarget.nodeName == "A"){
+					range.selectNodeContents(aOriginalTarget);
+				}
+				stXPath = this.XPath.getOffsetFromParentNode(range.startContainer,range.startOffset);
+				enXPath = this.XPath.getOffsetFromParentNode(range.endContainer,range.endOffset);
+				con_url = this.Common.getURLStringFromDocument(doc);
+				var attribute = "";
+				if (aOriginalTarget.nodeName == "IMG") {
+					attribute = aOriginalTarget.getAttribute("src");
+				}else if (aOriginalTarget.nodeName == "A") {
+					attribute = aOriginalTarget.getAttribute("href");
+				}
+				try{
+					hyperAnchor = bitsHyperAnchor._getAnchorURL({node:range.startContainer,offset:range.startOffset,style:style,prefix:"b",contents:attribute},{node:range.endContainer,offset:range.endOffset,prefix:"e",contents:attribute});
+				}catch(ex3){
+					try{
+						hyperAnchor = bitsHyperAnchorDummy._getAnchorURL({node:range.startContainer,offset:range.startOffset,style:style,prefix:"b",contents:attribute},{node:range.endContainer,offset:range.endOffset,prefix:"e",contents:attribute});
+					}catch(ex3){
+						hyperAnchor = null;
+					}
+				}
+				hyperAnchor = bitsAutocacheService.convertCacheURLToOriginalURL(hyperAnchor);
+			}
+			url_title = url_title.replace(/^\s+/mg,"").replace(/\s+$/mg,"");
+			var rObj = this.Database.newObject(undefined,dbtype);
+			if(rObj){
+				rObj.pfid = parentID;
+				rObj.doc_url = bitsAutocacheService.convertCacheURLToOriginalURL(doc_url);
+				rObj.doc_title = this.gBrowser.contentDocument.title?this.gBrowser.contentDocument.title:rObj.doc_url;
+				if(bitsAutocacheService.isCacheURL(doc_url)){
+					var info = bitsAutocacheService.getSaveCacheInfo(doc_url);
+					if(info && info.TITLE) rObj.doc_title = info.TITLE;
+				}
+				rObj.con_url = bitsAutocacheService.convertCacheURLToOriginalURL(con_url);
+				if(stXPath && enXPath){
+					rObj.bgn_dom = stXPath.xpath + "("+stXPath.offset+")" + "("+stXPath.type+")";
+					rObj.end_dom = enXPath.xpath + "("+enXPath.offset+")" + "("+enXPath.type+")";
+				}
+				rObj.oid_title = url_title;
+				if(rObj.oid_title == "") rObj.oid_title = decodeURIComponent(this.Common.getFileName(url));
+				if(rObj.oid_title == "") rObj.oid_title = decodeURIComponent(url);
+				rObj.oid_property = "";
+				var frame_name;
+				var frame_id;
+				if(doc_url != con_url){
+					var win = this.gBrowser.contentWindow;
+					if(win.frames != null){
+						var i;
+						for(i=0;i<win.frames.length;i++){
+							if(bitsAutocacheService.convertCacheURLToOriginalURL(this.Common.getURLStringFromDocument(win.frames[i].document)) != con_url) continue;
+							frame_name = win.frames[i].name;
+							frame_id = win.frames[i].id;
+							break;
+						}
+					}
+				}
+				if(url != comment_url || hyperAnchor || frame_name || frame_id || doc_url_hash){
+					var parser = new DOMParser();
+					var xmldoc = parser.parseFromString("<PROPERTY></PROPERTY>","text/xml");
+					if(xmldoc){
+						if(xmldoc.documentElement){
+							if(url != comment_url){
+								var xmlnode = xmldoc.createElement("LINK");
+								if(xmlnode){
+									xmlnode.appendChild(xmldoc.createTextNode(comment_url));
+									xmldoc.documentElement.appendChild(xmlnode);
+								}
+							}
+							if(frame_name){
+								var xmlnode = xmldoc.createElement("FRAME_NAME");
+								if(xmlnode){
+									xmlnode.appendChild(xmldoc.createTextNode(frame_name));
+									xmldoc.documentElement.appendChild(xmlnode);
+								}
+							}
+							if(frame_id){
+								var xmlnode = xmldoc.createElement("FRAME_ID");
+								if(xmlnode){
+									xmlnode.appendChild(xmldoc.createTextNode(frame_id));
+									xmldoc.documentElement.appendChild(xmlnode);
+								}
+							}
+							if(hyperAnchor){
+								var xmlnode = xmldoc.createElement("HYPER_ANCHOR");
+								if(xmlnode){
+									xmlnode.appendChild(xmldoc.createTextNode(hyperAnchor));
+									xmldoc.documentElement.appendChild(xmlnode);
+								}
+							}
+							if(doc_url_hash){
+								var xmlnode = xmldoc.createElement("LOCATION_HASH");
+								if(xmlnode){
+									xmlnode.appendChild(xmldoc.createTextNode(doc_url_hash));
+									xmldoc.documentElement.appendChild(xmlnode);
+								}
+							}
+							var s = new XMLSerializer();
+							rObj.oid_property = s.serializeToString(xmldoc);
+							s = undefined;
+						}
+					}
+					parser = undefined;
+					xmldoc = undefined;
+				}
+				rObj.oid_mode = "0";
+				try{ rObj.oid_type = this.Common.MIME.getTypeFromURI(this.Common.convertURLToObject(url)); }catch(e){ rObj.oid_type=null; }
+				if(!rObj.oid_type) rObj.oid_type = "url";
+				rObj.oid_txt = bitsAutocacheService.convertCacheURLToOriginalURL(url);
+				rObj.oid_date = bitsAutocacheService.getURLTimeStampFormatDate(doc_url);
+				rObj.pfid_order = ++pfid_order;
+				if(aOriginalTarget && (aOriginalTarget.nodeName == "IMG" || aOriginalTarget.nodeName == "A")){
+					rObj.oid_property = bitsMetaCapture.capture(this.gBrowser.contentDocument,rObj.oid_property);
+				}
+				rObj = this.setInitMarkerData(rObj);
+			}
+			if(rObj){
+				var rtn = this.Database.addObject(rObj,dbtype);
+				if(rtn){
+					rObj = this.Database.getObject({oid:rObj.oid,pfid:rObj.pfid},dbtype)[0];
+				}else{
+					rObj = undefined;
+				}
+			}
+			if(rObj){
+				bitsAutocacheService.createCache(rObj.doc_url,undefined,aRebuild);
+				var newDCitem = this.Database.makeObjectToItem(rObj);
+				if(url.indexOf("file://") == 0){
+					newDCitem.title = rObj.oid_title;
+				}else{
+					newDCitem.icon = this.Database.getFavicon(rObj.doc_url,dbtype);
+				}
+				var rtnContent = null;
+				if(stXPath && enXPath && (aOriginalTarget && aOriginalTarget.nodeName != "IMG")){
+					rtnContent = bitsMarker.xPathMarker(
+						stXPath.node.ownerDocument,
+						{
+							start   : rObj.bgn_dom,
+							end     : rObj.end_dom,
+							context : rObj.oid_txt,
+							con_url : this.Common.getURLStringFromDocument(stXPath.node.ownerDocument)
+						},
+						{
+							id     : rObj.oid,
+							dbtype : dbtype,
+							style  : ""
+						}
+					);
+				}
+				if(rtnContent && rtnContent.length && rtnContent.length>0) newDCitem.source = rtnContent[0].id;
+				var newRes = null;
+
+ 				if(typeof aParName != "string"){
+					var f_pfid = undefined;
+					var rtnFolder = this.Database.getFolder({fid:parentID},dbtype);
+					if(rtnFolder && rtnFolder.length) f_pfid = rtnFolder[0].pfid;
+					rtnFolder = undefined;
+					aParName = this.DataSource.getID2About(parentID,f_pfid,dbtype);
+				}
+				var contentWindow = null;
+				var mcTreeHandler = null;
+				var bitsItemView = null;
+				var bitsTreeDate = null;
+				if(this._contentWindow) contentWindow = this._contentWindow;
+				if(contentWindow && contentWindow.mcTreeHandler) mcTreeHandler = contentWindow.mcTreeHandler;
+				if(contentWindow && contentWindow.bitsItemView) bitsItemView = contentWindow.bitsItemView;
+				if(contentWindow && contentWindow.bitsTreeDate) bitsTreeDate = contentWindow.bitsTreeDate;
+				if(!bitsItemView || !bitsItemView.isChecked){
+					if(rtn) newRes = this.DataSource.addItem(newDCitem, aParName, aIdx, dbtype);
+					if(newRes){
+						this.DataSource.flush();
+						//è¿œå ããObjectã«ãã©ãŒã«ã¹ãç§»ã
+						var mcPropertyView = null;
+						if(contentWindow && contentWindow.mcPropertyView) mcPropertyView = contentWindow.mcPropertyView;
+						if(mcTreeHandler){
+							var folderautoopen = nsPreferences.getBoolPref("wiredmarker.folderautoopen", true);
+							if(!folderautoopen){
+								var parentRes = this.DataSource.findParentResource(newRes);
+								var parentIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(parentRes);
+								if(parentIdx>=0) folderautoopen = mcTreeHandler.TREE.view.isContainerOpen(parentIdx);
+							}
+							if(folderautoopen){
+								var resArr = [];
+								var parentRes = newRes;
+								do{
+									parentRes = this.DataSource.findParentResource(parentRes);
+									if(parentRes) resArr.push(parentRes);
+								}while(parentRes && parentRes.Value != this.DataSource.ABOUT_ROOT);
+								var i;
+								for(i=resArr.length-1;i>=0;i--){
+									var selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(resArr[i]);
+									if(selectIdx>=0 && !mcTreeHandler.TREE.view.isContainerOpen(selectIdx)) mcTreeHandler.TREE.view.toggleOpenState(selectIdx);
+								}
+								var selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(newRes);
+								if(selectIdx>=0){
+									mcTreeHandler.TREE.currentIndex = selectIdx;
+									if(!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex)) mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+									mcTreeHandler.TREE.focus();
+									mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(selectIdx);
+									if(mcPropertyView) mcPropertyView.dispProperty(mcTreeHandler.object);
+								}
+							}
+						}
+						rtnNewRes.push(newRes);
+					}
+				}else if(bitsItemView && bitsItemView.isChecked){
+					if(mcTreeHandler){
+						var resArr = [];
+						var parentRes = this.Common.RDF.GetResource(aParName);
+						do{
+							parentRes = this.DataSource.findParentResource(parentRes);
+							if(parentRes) resArr.push(parentRes);
+						}while(parentRes && parentRes.Value != this.DataSource.ABOUT_ROOT);
+						var i;
+						for(i=resArr.length-1;i>=0;i--){
+							var selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(resArr[i]);
+							if(selectIdx>=0 && !mcTreeHandler.TREE.view.isContainerOpen(selectIdx)) mcTreeHandler.TREE.view.toggleOpenState(selectIdx);
+						}
+						var selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(this.Common.RDF.GetResource(aParName));
+						if(selectIdx>=0){
+							mcTreeHandler.TREE.currentIndex = selectIdx;
+							if(!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex)) mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+							mcTreeHandler.TREE.focus();
+							mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(selectIdx);
+							if(mcPropertyView) mcPropertyView.dispProperty(mcTreeHandler.object);
+						}
+					}
+					try{
+						if(aRebuild && bitsItemView){
+							if(bitsTreeDate && bitsTreeDate.isChecked){
+								var param = {dbtype:dbtype};
+								for(var key in rObj){
+									param[key] = rObj[key];
+								}
+								bitsTreeDate.onSelectTab(param);
+							}else{
+								var aRes = this.Common.RDF.GetResource(aParName);
+								var viewmode = this._contentWindow.mcTreeViewModeService.viewmode;
+								var fid = this.DataSource.getProperty(aRes, "id");
+								var dbtype = this.DataSource.getProperty(aRes, "dbtype");
+								var oid = rObj.oid;
+								bitsItemView.onTreeClick({viewmode:viewmode,fid:fid,dbtype:dbtype,res:aRes});
+								bitsItemView.setSelection(oid,dbtype);
+								setTimeout(function(){ bitsItemView.setSelection(oid,dbtype); },500);
+							}
+						}
+					}catch(ex){ bitsMarkingCollection._dump("bitsMarkingCollection.addURLText():"+ex); }
+				}
+				var param = {
+					id      : rObj.oid,
+					dbtype  : dbtype,
+					rebuild : aRebuild,
+				};
+				if(bitsItemView && !bitsItemView.isChecked){
+					if(newRes) param.res = newRes;
+				}else if(bitsItemView){
+					param.res = this.Common.RDF.GetResource(aParName);
+				}
+				if(aOriginalTarget && (url.indexOf("http://") == 0 || url.indexOf("https://") == 0 || url.indexOf("ftp://") == 0)){
+					this.getContentTypeFromURL(aOriginalTarget.ownerDocument, url, param);
+				}else if(url.indexOf("file://") == 0){
+					this._oID = rObj.oid;
+					this._dbtype = dbtype;
+					this.BROWSER.addEventListener("pageshow", bitsMarkingCollection.loadFile, true);
+					this.BROWSER.loadURI(url);
+				}
+				if(aOriginalTarget && aOriginalTarget.nodeName != "IMG" && aOriginalTarget.blur) aOriginalTarget.blur();
+				var tempObj = {dbtype : dbtype};
+				for(var key in rObj){
+					tempObj[key] = rObj[key];
+				}
+				bitsPubmedCentralService.getPubmedInfo(tempObj);
+				rObj = undefined;
+				newDCitem = undefined;
+				rtn = true;
+			}
+		}catch(ex){
+			bitsMarkingCollection._dump("bitsMarkingCollection.addURLText():"+ex);
+		}
+		if(rtnNewRes.length>0)
+			return rtnNewRes;
+		else
+			return undefined;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_makeURI : function(aURL, aOriginCharset, aBaseURI){
+		var ioService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
+		return ioService.newURI(aURL, aOriginCharset, aBaseURI);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_getImageProperties : function(aDoc, aUrlString){
+		if(!aDoc) return;
+		if(!aUrlString || aUrlString == "") return undefined;
+		var aSelf = this;
+		if(!aUrlString.match(/^[a-z]{3,5}:\/\//)){
+			var docURI = aSelf._makeURI(aDoc.location.href, aDoc.characterSet);
+			aUrlString = aSelf.Common.resolveURL(docURI.spec, aUrlString);
+		}
+		if(!aUrlString.match(/^[a-z]{3,5}:\/\//)){
+			return undefined;
+		}
+		var imgURI = aSelf._makeURI(aUrlString, aDoc.characterSet);
+		var contentType = null;
+		var contentDisposition = null;
+		try{
+			var imageCache = Components.classes["@mozilla.org/image/cache;1"].getService(Components.interfaces.imgICache);
+			var props = imageCache.findEntryProperties(imgURI);
+			if(props){
+				contentType = props.get("type", nsISupportsCString);
+				contentDisposition = props.get("content-disposition", nsISupportsCString);
+			}
+		}catch(e){}
+		return {
+			URI : imgURI,
+			contentType : contentType && contentType.type == contentType.TYPE_CSTRING ? contentType.data : null,
+			contentDisposition : contentDisposition && contentDisposition.type == contentDisposition.TYPE_CSTRING ? contentDisposition.data : null,
+		};
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getContentTypeFromURL : function(aDoc, aUrl, aParam, aAsync, aInfo){
+		if(aAsync == undefined) aAsync = true;
+		var uri = aUrl;
+		var xmlhttp = null;
+		var rtn = "";
+		if(aParam && aParam.rebuild == undefined) aParam.rebuild = true;
+		xmlhttp = new XMLHttpRequest();
+		if(xmlhttp){
+			if(aAsync){
+				xmlhttp.onreadystatechange = function (){
+					if(xmlhttp.readyState == 4){
+						if(xmlhttp.status == 200){
+							var imgProp = bitsMarkingCollection._getImageProperties(aDoc, aUrl)
+							var contentType = imgProp.contentType;
+							var id = aParam.id;
+							var dbtype = aParam.dbtype;
+							var type = "url";
+							var ext = "txt";
+							if(contentType){
+								if(contentType.match(/^image\/(\S+)/)){
+									type = "image";
+									ext = RegExp.$1;
+								}else if(contentType.match(/^text\/(\S+)/)){
+									ext = RegExp.$1;
+									ext = ext.replace(/[^A-Za-z0-9]+$/mg,"");
+								}
+							}
+							var bytes = [];
+							var filestream = xmlhttp.responseText;
+							var i;
+							for(i=0; i<filestream.length;i++){
+								bytes[i] = filestream.charCodeAt(i) & 0xff;
+							}
+							if(type == "image"){
+								bitsMarkingCollection.Database.updateObject({oid:id,oid_type:contentType},dbtype);
+								bitsMarkingCollection.Database.updateObjectBLOB(id,bytes,dbtype);
+								if(aParam.res){
+									var contentWindow = null;
+									var bitsItemView = null;
+									var bitsTreeDate = null;
+									if(bitsMarkingCollection._contentWindow) contentWindow = bitsMarkingCollection._contentWindow;
+									if(contentWindow && contentWindow.bitsItemView) bitsItemView = contentWindow.bitsItemView;
+									if(contentWindow && contentWindow.bitsTreeDate) bitsTreeDate = contentWindow.bitsTreeDate;
+									if(bitsItemView && !bitsItemView.isChecked){
+										bitsMarkingCollection.DataSource.flush();
+									}else{
+										if(bitsTreeDate && bitsTreeDate.isChecked){
+											var idx = bitsTreeDate.TREE.currentIndex;
+											var rows = bitsTreeDate.getSelection();
+											if(rows && rows.length && rows[0]<bitsTreeDate.rowCount){
+												var row = {value:rows[0]};
+												var mcTreeViewModeService = bitsMarkingCollection._contentWindow.mcTreeViewModeService;
+												var viewmode = mcTreeViewModeService.viewmode;
+												var param = {
+													viewmode : viewmode,
+													dbtype   : bitsTreeDate.itemObjects[row.value].dbtype,
+													where    : [],
+												};
+												if(bitsMarkingCollection._uncategorized.use){
+													param.res = bitsMarkingCollection.Common.RDF.GetResource(bitsMarkingCollection.DataSource.getID2About("0",undefined,bitsMarkingCollection._uncategorized.dbtype));
+												}
+												if(bitsTreeDate.itemObjects && bitsTreeDate.itemObjects[row.value]){
+													if(bitsTreeDate.itemObjects[row.value].date){
+														param.where.push({
+															key : "substr(om_object.oid_date,7,4)",
+															val : bitsTreeDate.itemObjects[row.value].date.year
+														});
+														if(bitsTreeDate.itemObjects[row.value].date.month){
+															param.where.push({
+																key : "substr(om_object.oid_date,1,2)",
+																val : bitsTreeDate.itemObjects[row.value].date.month
+															});
+															if(bitsTreeDate.itemObjects[row.value].date.day){
+																param.where.push({
+																	key : "substr(om_object.oid_date,4,2)",
+																	val : bitsTreeDate.itemObjects[row.value].date.day
+																});
+															}
+														}
+													}
+												}
+												bitsItemView.onTreeDateClick(param);
+											}else{
+												bitsItemView.onTreeDateClick();
+											}
+										}else{
+											try{
+												var mcTreeViewModeService = bitsMarkingCollection._contentWindow.mcTreeViewModeService;
+												var aRes = aParam.res;
+												var viewmode = mcTreeViewModeService.viewmode;
+												var fid = bitsMarkingCollection.DataSource.getProperty(aRes, "id");
+												var dbtype = bitsMarkingCollection.DataSource.getProperty(aRes, "dbtype");
+												if(aParam.rebuild && bitsItemView) bitsItemView.onTreeClick({viewmode:viewmode,fid:fid,dbtype:dbtype,res:aRes});
+											}catch(ex){}
+										}
+									}
+								}
+							}else{
+							}
+						}else{
+						}
+					}else{
+					}
+				};
+			}
+			xmlhttp.open("GET", uri , aAsync);
+			xmlhttp.overrideMimeType('text/plain; charset=x-user-defined');
+			xmlhttp.send(null);
+			if(!aAsync){
+				if(xmlhttp.status == 200){
+					var imgProp = this._getImageProperties(aDoc, aUrl)
+					aInfo.contentType = imgProp.contentType;
+					if(aInfo.contentType.match(/^image\/(\S+)/)){
+						var bytes = [];
+						var filestream = xmlhttp.responseText;
+						var i;
+						for(i=0; i<filestream.length;i++){
+							bytes[i] = filestream.charCodeAt(i) & 0xff;
+						}
+						aInfo.bytes = bytes;
+					}
+				}
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	loadFile : function(aEvent) {
+		var doc = bitsMarkingCollection.BROWSER.contentDocument;
+		var contentType = doc.contentType;
+		var type = "url";
+		if(contentType.match(/^image\/(\S+)/)) type = "image";
+		if(type == "image"){
+			try{
+				var istream = Components.classes['@mozilla.org/network/file-input-stream;1'].createInstance(Components.interfaces.nsIFileInputStream);
+				istream.init(bitsMarkingCollection.Common.convertURLToFile(bitsMarkingCollection.Common.getURLStringFromDocument(doc)), 1, 0, false);
+				var sstream = Components.classes['@mozilla.org/scriptableinputstream;1'].createInstance(Components.interfaces.nsIScriptableInputStream);
+				sstream.init(istream);
+				var bstream = Components.classes['@mozilla.org/binaryinputstream;1'].createInstance(Components.interfaces.nsIBinaryInputStream);
+				bstream.setInputStream(istream);
+				var len = sstream.available();
+				var bytes = bstream.readByteArray(len);
+				sstream.close();
+				istream.close();
+			}catch(ex){bitsMarkingCollection.Common.alert(ex);}
+			bitsMarkingCollection.Database.updateObject({oid:bitsMarkingCollection._oID,oid_type:contentType}, bitsMarkingCollection._dbtype);
+			bitsMarkingCollection.Database.updateObjectBLOB(bitsMarkingCollection._oID, bytes, bitsMarkingCollection._dbtype);
+		}
+		bitsMarkingCollection.BROWSER.removeEventListener("pageshow", bitsMarkingCollection.loadFile, true);
+		bitsMarkingCollection.BROWSER.loadURI("about:blank");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	addSelectedText : function(aParName, aIdx, aRow, aRebuild, aIsCacheConfirm){
+		if(aRebuild == undefined) aRebuild = true;
+		if(aIsCacheConfirm == undefined) aIsCacheConfirm = true;
+		var targetWindow = this.Common.getFocusedWindow();
+		var parentID  = 0;
+		var style = "";
+		var dbtype = "";
+		if(typeof aParName == "string"){
+			var aRes = this.Common.RDF.GetResource(aParName);
+			style = this.DataSource.getProperty(aRes,"style");
+			dbtype = this.DataSource.getProperty(aRes,"dbtype");
+			if(aParName != this.DataSource.ABOUT_ROOT) parentID = this.DataSource.getProperty(aRes,"id");
+		}else{
+			parentID = aParName.fid;
+			style = aParName.fid_style;
+			dbtype = aParName.dbtype;
+		}
+		var pfid_order = this.Database.getMaxOrderFormPID(parentID);
+		var selection = targetWindow.getSelection();
+		if(!selection) return undefined;
+		var selectText = selection.toString();
+		if(selectText == "") return undefined;
+		var doc_url = this.Common.getURLStringFromDocument(this.gBrowser.contentDocument);
+		if(aIsCacheConfirm && !bitsAutocacheService.isMarking(doc_url)) return undefined;
+		var doc_url_hash = this.Common.getURLHashStringFromDocument(this.gBrowser.contentDocument);
+		var selectimportimage = nsPreferences.copyUnicharPref("wiredmarker.selectimportimage","none");
+		var rtnNewRes = [];
+		var rtnNewObj = [];
+		var r;
+		var ranges = [];
+		for(r=selection.rangeCount-1;r>=0;r--){
+			var range   = selection.getRangeAt(r);
+			var obj = {
+				startContainer : range.startContainer,
+				startOffset    : range.startOffset,
+				endContainer   : range.endContainer,
+				endOffset      : range.endOffset,
+				collapsed      : range.collapsed,
+				commonAncestorContainer : range.commonAncestorContainer
+			};
+			ranges.unshift(obj);
+		}
+		for(r=ranges.length-1;r>=0;r--){
+			var context = "";
+			var contextArray = [];
+			var range = this.gBrowser.contentDocument.createRange();
+			range.setStart(ranges[r].startContainer, ranges[r].startOffset);
+			range.setEnd(ranges[r].endContainer, ranges[r].endOffset);
+			if(selectimportimage == "none"){
+				context = range.toString();
+				contextArray.push(range.toString());
+			}else{
+				var nodeWalker = this.gBrowser.contentDocument.createTreeWalker(range.cloneContents(),NodeFilter.SHOW_ALL,null,false);
+				var txtNode; 
+				for(txtNode=nodeWalker.nextNode();txtNode;txtNode = nodeWalker.nextNode()){
+					if(txtNode.nodeName == "#text"){
+						context += txtNode.nodeValue;
+						contextArray.push(txtNode.nodeValue);
+					}else if(txtNode.nodeName == "IMG"){
+						if(selectimportimage == "alt"){
+							contextArray.push(txtNode.alt);
+						}else{
+							contextArray.push(bitsSubstitutionTree.getSubstitutionText(txtNode));
+						}
+					}
+				}
+			}
+			var startContainer = range.startContainer;
+			var startOffset = range.startOffset;
+			var endContainer = range.endContainer;
+			var endOffset = range.endOffset;
+			try{
+				var imgElems = [];
+				var tableElems = [];
+				var contentDocument = startContainer.ownerDocument;
+				var nodeWalker = contentDocument.createTreeWalker(range.cloneContents(),NodeFilter.SHOW_ELEMENT,null,false);
+				var elemNode=nodeWalker.nextNode();
+				for(;elemNode;elemNode = nodeWalker.nextNode()){
+					if(elemNode.nodeName == "IMG"){
+						imgElems.push(elemNode);
+						continue;
+					}
+					if(elemNode.nodeName == "TABLE"){
+						var border = elemNode.getAttribute("border");
+						if(border == "" || border == "0") elemNode.setAttribute("border","1");
+						tableElems.push(elemNode);
+						continue;
+					}
+				}
+				var structure = "";
+				if(
+					range.commonAncestorContainer.nodeName == "TABLE" ||
+					range.commonAncestorContainer.nodeName == "THEAD" ||
+					range.commonAncestorContainer.nodeName == "TBODY" ||
+					range.commonAncestorContainer.nodeName == "TFOOT" ||
+					(tableElems && tableElems.length > 0)
+				){
+					var divNode = this.gBrowser.contentDocument.createElement("div");
+					if(divNode){
+						if(tableElems.length > 0){
+							divNode.appendChild(range.cloneContents());
+						}else{
+							var tableNode = range.commonAncestorContainer;
+							if(range.commonAncestorContainer.nodeName != "TABLE") tableNode = tableNode.parentNode;
+							var parentNode = tableNode.cloneNode(false);
+							parentNode.appendChild(range.cloneContents());
+							divNode.appendChild(parentNode);
+						}
+						var elemImg = divNode.getElementsByTagName("IMG");
+						if(elemImg && elemImg.length>0){
+							var imgcnt;
+							for(imgcnt=0;imgcnt<elemImg.length;imgcnt++){
+								if(!elemImg[imgcnt].src) continue;
+								elemImg[imgcnt].src = elemImg[imgcnt].src;
+								if(!(elemImg[imgcnt].src.match(/^http/) || elemImg[imgcnt].src.match(/^file/))) continue;
+								if(elemImg[imgcnt].src.indexOf("http://") == 0 || elemImg[imgcnt].src.indexOf("https://") == 0){
+									var aInfo = {};
+									if(!aInfo.contentType) this.getContentTypeFromURL(contentDocument, elemImg[imgcnt].src, undefined, false, aInfo);
+									if(!aInfo.contentType || !aInfo.contentType.match(/^image\/(\S+)/)) continue;
+									var images = String.fromCharCode.apply(String, aInfo.bytes);
+									var image_b64 = btoa(images); // base64 encoding
+									elemImg[imgcnt].src = 'data:' + aInfo.contentType + ';base64,' + image_b64;
+								}else if(elemImg[imgcnt].src.indexOf("file://") == 0){
+									try{
+										var file = bitsMarkingCollection.Common.convertURLToFile(elemImg[imgcnt].src);
+										var ext = "???";
+										var n;
+										if((n = file.path.lastIndexOf(".")) != -1){
+											ext = file.path.substring(n+1);
+											if(!ext.match(/^[A-Za-z0-9]+$/)) ext = "???";
+										}
+										var istream = Components.classes['@mozilla.org/network/file-input-stream;1'].createInstance(Components.interfaces.nsIFileInputStream);
+										istream.init(file, 1, 0, false);
+										var sstream = Components.classes['@mozilla.org/scriptableinputstream;1'].createInstance(Components.interfaces.nsIScriptableInputStream);
+										sstream.init(istream);
+										var bstream = Components.classes['@mozilla.org/binaryinputstream;1'].createInstance(Components.interfaces.nsIBinaryInputStream);
+										bstream.setInputStream(istream);
+										var len = sstream.available();
+										var bytes = bstream.readByteArray(len);
+										var images = String.fromCharCode.apply(String, bytes);
+										var image_b64 = btoa(images); // base64 encoding
+										elemImg[imgcnt].src = 'data:image/'+ext+';base64,' + image_b64;
+										sstream.close();
+										istream.close();
+									}catch(ex3){
+										bitsMarkingCollection._dump("bitsMarkingCollection.addSelectedText():"+ex3);
+									}
+								}
+							}
+						}
+						var removeTags = new Array("script","form","select","input","textarea");
+						for(var tagCnt=0;tagCnt<removeTags.length;tagCnt++){
+							var elems = divNode.getElementsByTagName(removeTags[tagCnt]);
+							if(elems && elems.length>0){
+								var scrcnt;
+								for(scrcnt=elems.length-1;scrcnt>=0;scrcnt--){
+									elems[scrcnt].parentNode.removeChild(elems[scrcnt]);
+								}
+							}
+						}
+						var styleHash = [];
+						var styleSheets = contentDocument.styleSheets;
+						if(styleSheets && styleSheets.length>0){
+							try{
+								var sheet_cnt;
+								var css_cnt;
+								var selector_cnt;
+								var selector_arr = [];
+								var selector;
+								var style_cnt;
+								var cssRules;
+								var cssRule;
+								for(sheet_cnt=0;sheet_cnt<styleSheets.length;sheet_cnt++){
+									if(styleSheets[sheet_cnt].disabled) continue;
+									cssRules = styleSheets[sheet_cnt].cssRules;
+									if(cssRules && cssRules.length>0){
+										for(css_cnt=0;css_cnt<cssRules.length;css_cnt++){
+											if(cssRules[css_cnt].type != cssRules[css_cnt].STYLE_RULE) continue;
+											cssRule = cssRules[css_cnt].style;
+											if(cssRule && cssRule.length>0){
+												selector_arr = cssRules[css_cnt].selectorText.split(",");
+												for(selector_cnt=0;selector_cnt<selector_arr.length;selector_cnt++){
+													selector = selector_arr[selector_cnt].replace(/^\s*/mg,"").replace(/\s*$/mg,"");
+													if(!styleHash[selector]) styleHash[selector] = "";
+													for(style_cnt=0;style_cnt<cssRule.length;style_cnt++){
+														styleHash[selector] += cssRule[style_cnt] + ":" + cssRule.getPropertyValue(cssRule[style_cnt]) + ";";
+													}
+												}
+											}
+										}
+									}
+								}
+							}catch(ex3){
+								bitsMarkingCollection._dump("bitsMarkingCollection.addSelectedText():"+ex3);
+							}
+							var elems = divNode.getElementsByTagName("*");
+							if(elems && elems.length>0){
+								var nodeClass;
+								var nodeID;
+								var nodeName;
+								var nodeStyle;
+								var elem_cnt;
+								for(elem_cnt=0;elem_cnt<elems.length;elem_cnt++){
+									nodeClass = elems[elem_cnt].getAttribute("class");
+									nodeID = elems[elem_cnt].getAttribute("id");
+									nodeStyle = elems[elem_cnt].getAttribute("style");
+									if(!nodeStyle) nodeStyle = "";
+									nodeName = elems[elem_cnt].nodeName.toLowerCase();
+									if(nodeClass && nodeClass != ""){
+										if(styleHash[nodeName+"."+nodeClass]){
+											nodeStyle += styleHash[nodeName+"."+nodeClass]+";";
+										}else if(styleHash["."+nodeClass]){
+											nodeStyle += styleHash["."+nodeClass]+";";
+										}
+									}
+									if(nodeID && nodeID != ""){
+										if(styleHash[nodeName+"#"+nodeID]){
+											nodeStyle += styleHash[nodeName+"#"+nodeID]+";";
+										}else if(styleHash["#"+nodeID]){
+											nodeStyle += styleHash["#"+nodeID]+";";
+										}
+									}
+									if((!nodeClass || nodeClass == "") && (!nodeID || nodeID == "")){
+										if(styleHash[nodeName]) nodeStyle += styleHash[nodeName]+";";
+									}
+									if(nodeName == "a"){
+										if(elems[elem_cnt].href) elems[elem_cnt].href = elems[elem_cnt].href;
+										if(styleHash["a:link"]) nodeStyle += styleHash[":link"]+";";
+										if(styleHash["a:visited"]) nodeStyle += styleHash[":visited"]+";";
+										if(styleHash["a:active"]) nodeStyle += styleHash[":active"]+";";
+										if(styleHash["a:hover"]) nodeStyle += styleHash[":hover"]+";";
+									}
+									if(nodeStyle != "") elems[elem_cnt].setAttribute("style",nodeStyle);
+								}
+							}
+						}
+						try{
+							structure = bitsHTML2XHTMLService.get_xhtml(divNode);
+							structure = structure.replace(/&nbsp;/mg," ").replace(/[\r\n]+/mg,"\n").replace(/\s+?\n/mg,"\n").replace(/\n+/mg,"");
+						}catch(ex3){
+							bitsMarkingCollection._dump("bitsMarkingCollection.addSelectedText():"+ex3);
+						}
+						parentNode = undefined;
+					}
+					divNode = undefined;
+				}
+				tableElems = undefined;
+			}catch(ex2){
+				bitsMarkingCollection._dump("bitsMarkingCollection.addSelectedText():"+ex2);
+			}
+			try{
+				if(startContainer.nodeType != startContainer.TEXT_NODE || endContainer.nodeType != endContainer.TEXT_NODE){
+					var docRange = range.cloneRange();
+					var startRange = range.cloneRange();
+					var stopRange = range.cloneRange();
+					startRange.collapse(true)
+					stopRange.collapse(false)
+					var findRange = bitsMarker._getFindRange();
+					var result = findRange.Find(range.toString().replace(/^\s*/g,"").replace(/\s*$/g,""), docRange, startRange, stopRange);
+					if(result){
+						range = result.cloneRange();
+						startContainer = range.startContainer;
+						startOffset = range.startOffset;
+						endContainer = range.endContainer;
+						endOffset = range.endOffset;
+					}
+				}
+				var stXPath = this.XPath.getOffsetFromParentNode(startContainer,startOffset);
+				var enXPath = this.XPath.getOffsetFromParentNode(endContainer,endOffset);
+				try{
+					var hyperAnchor =  bitsHyperAnchor._getAnchorURL({node:startContainer,offset:startOffset,style:style,prefix:"b",contents:range.toString()},{node:endContainer,offset:endOffset,prefix:"e",contents:range.toString()});
+				}catch(ex3){
+					try{
+						var hyperAnchor =  bitsHyperAnchorDummy._getAnchorURL({node:startContainer,offset:startOffset,style:style,prefix:"b",contents:range.toString()},{node:endContainer,offset:endOffset,prefix:"e",contents:range.toString()});
+					}catch(ex3){
+						hyperAnchor = null;
+					}
+				}
+				hyperAnchor = bitsAutocacheService.convertCacheURLToOriginalURL(hyperAnchor);
+				var con_url = this.Common.getURLStringFromDocument(stXPath.node.ownerDocument);
+				var rObj = this.Database.newObject();
+				if(rObj){
+					rObj.pfid = parentID;
+					rObj.doc_url = bitsAutocacheService.convertCacheURLToOriginalURL(doc_url);
+					rObj.con_url = bitsAutocacheService.convertCacheURLToOriginalURL(con_url);
+					rObj.doc_title = this.gBrowser.contentDocument.title?this.gBrowser.contentDocument.title:rObj.doc_url;
+					if(bitsAutocacheService.isCacheURL(doc_url)){
+						var info = bitsAutocacheService.getSaveCacheInfo(doc_url);
+						if(info && info.TITLE) rObj.doc_title = info.TITLE;
+					}
+					rObj.bgn_dom = stXPath.xpath + "("+stXPath.offset+")" + "("+stXPath.type+")";
+					rObj.end_dom = enXPath.xpath + "("+enXPath.offset+")" + "("+enXPath.type+")";
+
+					rObj.oid_title = contextArray.join("");
+					rObj.oid_title = this.Common.exceptCode(rObj.oid_title.replace(/[\r\n\t]+/mg," ").replace(/\s{2,}/mg," "));
+
+					rObj.oid_txt = contextArray.join("");
+					rObj.oid_txt = this.Common.exceptCode(rObj.oid_txt.replace(/\s+$/mg,"").replace(/^\s+/mg,""));
+
+					rObj.oid_date = bitsAutocacheService.getURLTimeStampFormatDate(doc_url);
+					rObj.pfid_order = ++pfid_order;
+					rObj.oid_mode = "0";
+					rObj.con_doc = stXPath.node.ownerDocument;
+					var frame_name;
+					var frame_id;
+					if(doc_url != con_url){
+						var win = this.gBrowser.contentWindow;
+						if(win.frames != null){
+							var i;
+this._dump("addSelectedText():win.frames.length=["+win.frames.length+"]");
+							for(i=0;i<win.frames.length;i++){
+this._dump("addSelectedText():win.frames["+i+"].document.URL=["+win.frames[i].document.URL+"]");
+								if(bitsAutocacheService.convertCacheURLToOriginalURL(this.Common.getURLStringFromDocument(win.frames[i].document)) != con_url) continue;
+								frame_name = win.frames[i].name;
+this._dump("addSelectedText():frame_name=["+frame_name+"]");
+								var nodes = bitsObjectMng.XPath.evaluate('//*[@name="'+win.frames[i].name+'"]',this.gBrowser.contentDocument);
+this._dump("addSelectedText():nodes=["+nodes+"]["+(nodes?nodes.snapshotLength:0)+"]");
+								if(nodes && nodes.snapshotLength == 1){
+									frame_id = nodes.snapshotItem(0).id;
+								}
+								break;
+							}
+						}
+					}
+this._dump("addSelectedText():frame_id=["+frame_id+"]");
+					var parser = new DOMParser();
+					var xmldoc = null;
+					if(!structure || structure == ""){
+						rObj.oid_type = "text";
+						if(hyperAnchor || frame_name || frame_id || doc_url_hash){
+							xmldoc = parser.parseFromString("<PROPERTY></PROPERTY>","text/xml");
+						}
+					}else{
+						rObj.oid_type = "structure";
+						xmldoc = parser.parseFromString("<PROPERTY><STRUCTURE>"+structure+"</STRUCTURE></PROPERTY>","text/xml");
+					}
+					if(xmldoc){
+						if(xmldoc.documentElement){
+							if(frame_name){
+								var xmlnode = xmldoc.createElement("FRAME_NAME");
+								if(xmlnode){
+									xmlnode.appendChild(xmldoc.createTextNode(frame_name));
+									xmldoc.documentElement.appendChild(xmlnode);
+								}
+							}
+							if(frame_id){
+								var xmlnode = xmldoc.createElement("FRAME_ID");
+								if(xmlnode){
+									xmlnode.appendChild(xmldoc.createTextNode(frame_id));
+									xmldoc.documentElement.appendChild(xmlnode);
+								}
+							}
+							if(hyperAnchor){
+								var xmlnode = xmldoc.createElement("HYPER_ANCHOR");
+								if(xmlnode){
+									xmlnode.appendChild(xmldoc.createTextNode(hyperAnchor));
+									xmldoc.documentElement.appendChild(xmlnode);
+								}
+							}
+							if(doc_url_hash){
+								var xmlnode = xmldoc.createElement("LOCATION_HASH");
+								if(xmlnode){
+									xmlnode.appendChild(xmldoc.createTextNode(doc_url_hash));
+									xmldoc.documentElement.appendChild(xmlnode);
+								}
+							}
+						}
+						var s = new XMLSerializer();
+						rObj.oid_property = s.serializeToString(xmldoc);
+						s = undefined;
+					}
+					parser = undefined;
+					rtnNewObj.unshift(rObj);
+				}
+			}catch(ex2){
+				bitsMarkingCollection._dump("bitsMarkingCollection.addSelectedText():"+ex2);
+			}
+		}
+
+		var objArr = [];
+		for(r=0;r<rtnNewObj.length;r++){
+			var rObj = this.Database.newObject();
+			for(var key in rtnNewObj[r]){
+				if(key == "oid") continue;
+				if(key == "con_doc") continue;
+				rObj[key] = rtnNewObj[r][key];
+			}
+			rObj = this.setInitMarkerData(rObj);
+			if(!rObj) return;
+			objArr.push(rObj);
+		}
+
+		bitsAutocacheService.createCache(undefined,undefined,aRebuild);
+
+		if(typeof aParName != "string"){
+			var f_pfid = undefined;
+			var rtnFolder = this.Database.getFolder({fid:parentID},dbtype);
+			if(rtnFolder && rtnFolder.length) f_pfid = rtnFolder[0].pfid;
+			rtnFolder = undefined;
+			aParName = this.DataSource.getID2About(parentID,f_pfid,dbtype);
+		}
+
+		var contentWindow = null;
+		var bitsItemView = null;
+		var mcTreeHandler = null;
+		var mcPropertyView = null;
+		var mcItemView = null;
+		var bitsTreeDate = null;
+		if(this._contentWindow){
+			if(this._contentWindow) contentWindow = this._contentWindow;
+			if(contentWindow && contentWindow.bitsItemView) bitsItemView = contentWindow.bitsItemView;
+			if(bitsItemView){
+				if(contentWindow && contentWindow.mcTreeHandler) mcTreeHandler = contentWindow.mcTreeHandler;
+				if(contentWindow && contentWindow.mcPropertyView) mcPropertyView = contentWindow.mcPropertyView;
+				if(contentWindow && contentWindow.mcItemView) mcItemView = contentWindow.mcItemView;
+				if(contentWindow && contentWindow.bitsTreeDate) bitsTreeDate = contentWindow.bitsTreeDate;
+			}
+		}
+
+		var pfid_order = this.Database.getMaxOrderFormPID(parentID);
+		for(r=0;r<objArr.length;r++){
+			var rObj = objArr[r];
+			rObj.oid_property = bitsMetaCapture.capture(this.gBrowser.contentDocument,rObj.oid_property);
+			rObj.pfid_order = ++pfid_order;
+			var rtn = this.Database.addObject(rObj,dbtype);
+			if(!rtn) rObj = undefined;
+			if(!rObj) continue;
+			rObj = this.Database.getObject({oid:rObj.oid,pfid:rObj.pfid},dbtype)[0];
+			if(!rObj) continue;
+			try{
+				var rtnContent = bitsMarker.xPathMarker(
+					rtnNewObj[r].con_doc,
+					{
+						start   : rObj.bgn_dom,
+						end     : rObj.end_dom,
+						context : this.Common.exceptCode(context.replace(/\s+$/mg,"").replace(/^\s+/mg,"")),
+						con_url : this.Common.getURLStringFromDocument(rtnNewObj[r].con_doc)
+					},
+					{
+						id     : rObj.oid,
+						dbtype : dbtype,
+						pfid   : rObj.pfid,
+						style  : style
+					}
+				);
+				if(rtnContent){
+					if(this._contentWindow){
+						if(bitsItemView){
+							if(bitsItemView.isChecked){
+								if(mcTreeHandler){
+									var resArr = [];
+									var parentRes = this.Common.RDF.GetResource(aParName);
+									do{
+										parentRes = this.DataSource.findParentResource(parentRes);
+										if(parentRes) resArr.push(parentRes);
+									}while(parentRes && parentRes.Value != this.DataSource.ABOUT_ROOT);
+									var i;
+									for(i=resArr.length-1;i>=0;i--){
+										var selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(resArr[i]);
+										if(selectIdx>=0 && !mcTreeHandler.TREE.view.isContainerOpen(selectIdx)) mcTreeHandler.TREE.view.toggleOpenState(selectIdx);
+									}
+									var selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(this.Common.RDF.GetResource(aParName));
+									if(selectIdx>=0){
+										mcTreeHandler.TREE.currentIndex = selectIdx;
+										if(!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex)) mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+										mcTreeHandler.TREE.focus();
+										mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(selectIdx);
+										if(mcPropertyView) mcPropertyView.dispProperty(mcTreeHandler.object);
+									}
+								}
+								if(!aRebuild) aRebuild = ((r==rtnNewObj.length-1)?true:false);
+								if(aRebuild && mcItemView){
+									if(bitsTreeDate && bitsTreeDate.isChecked){
+										var param = {dbtype:dbtype};
+										for(var key in rObj){
+											param[key] = rObj[key];
+										}
+										bitsTreeDate.onSelectTab(param);
+									}else{
+										mcItemView.onTreeClick();
+									}
+									var oid = rObj.oid;
+									mcItemView.setSelection(oid,dbtype);
+									setTimeout(function(){ mcItemView.setSelection(oid,dbtype); },500);
+								}
+							}else{
+								var newDCitem = this.Database.makeObjectToItem(rObj);
+								if(rtnContent.length && rtnContent.length>0){
+									newDCitem.source = rtnContent[0].id;
+								}else{
+									newDCitem.source = rtnContent.id;
+								}
+								var newRes = this.DataSource.addItem(newDCitem, aParName, aIdx, dbtype);
+								if(newRes){
+									this.DataSource.flush();
+									if(mcTreeHandler){
+										var folderautoopen = nsPreferences.getBoolPref("wiredmarker.folderautoopen", true);
+										if(!folderautoopen){
+											var parentRes = this.DataSource.findParentResource(newRes);
+											var parentIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(parentRes);
+											if(parentIdx>=0) folderautoopen = mcTreeHandler.TREE.view.isContainerOpen(parentIdx);
+										}
+										if(folderautoopen){
+											var resArr = [];
+											var parentRes = newRes;
+											do{
+												parentRes = this.DataSource.findParentResource(parentRes);
+												if(parentRes) resArr.push(parentRes);
+											}while(parentRes && parentRes.Value != this.DataSource.ABOUT_ROOT);
+											var i;
+											for(i=resArr.length-1;i>=0;i--){
+												var selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(resArr[i]);
+												if(selectIdx>=0 && !mcTreeHandler.TREE.view.isContainerOpen(selectIdx)) mcTreeHandler.TREE.view.toggleOpenState(selectIdx);
+											}
+											var selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(newRes);
+											if(selectIdx>=0){
+												mcTreeHandler.TREE.currentIndex = selectIdx;
+												if(!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex)) mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+												mcTreeHandler.TREE.focus();
+												mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(selectIdx);
+												if(mcPropertyView) mcPropertyView.dispProperty(mcTreeHandler.object);
+											}
+										}
+									}
+									rtnNewRes.push(newRes);
+								}
+								newDCitem = undefined;
+							}
+						}else{
+							try{
+								var aRes = this.Common.RDF.GetResource(aParName);
+								var viewmode = this._contentWindow.mcTreeViewModeService.viewmode;
+								var fid = this.DataSource.getProperty(aRes, "id");
+								var dbtype = this.DataSource.getProperty(aRes, "dbtype");
+								if(!aRebuild) aRebuild = ((r==rtnNewObj.length-1)?true:false);
+								if(aRebuild && bitsItemView) bitsItemView.onTreeClick({viewmode:viewmode,fid:fid,dbtype:dbtype,res:aRes});
+							}catch(ex){}
+						}
+					}
+					var tempObj = {dbtype : dbtype};
+					for(var key in rObj){
+						tempObj[key] = rObj[key];
+					}
+					bitsPubmedCentralService.getPubmedInfo(tempObj);
+				}else{
+					var rtn = this.Database.removeObject(rObj,dbtype);
+				}
+			}catch(ex2){
+				bitsMarkingCollection._dump("bitsMarkingCollection.addSelectedText():"+ex2);
+			}
+		}
+		selection.removeAllRanges();
+		if(rtnNewRes.length>0)
+			return rtnNewRes;
+		else
+			return undefined;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	updateSelectedText : function(aElem){
+		var dbtype = aElem.getAttribute("dbtype");
+		var pfid = aElem.getAttribute("pfid");
+		var style = aElem.style.cssText;
+		var oid = "";
+		var match_exp = new RegExp("^"+bitsMarker.id_key+"\\D+(\\d+)$","m");
+		if(aElem.id.match(match_exp)){
+			var match_dbtype = aElem.getAttribute("dbtype");
+			match_exp = new RegExp("^"+bitsMarker.id_key+match_dbtype+"(\\d+)$","m");
+			if(match_exp.test(aElem.id)) oid = RegExp.$1;
+		}
+		if(oid == "") return;
+		var targetWindow = this.Common.getFocusedWindow();
+		var contentWindow = null;
+		var mcTreeHandler = null;
+		var mcPropertyView = null;
+		var currentIndex = -1;
+		var aRes = null;
+		if(this._contentWindow) contentWindow = this._contentWindow;
+		if(contentWindow && contentWindow.mcTreeHandler) mcTreeHandler = contentWindow.mcTreeHandler;
+		if(contentWindow && contentWindow.mcPropertyView) mcPropertyView = contentWindow.mcPropertyView;
+		if(mcTreeHandler) currentIndex = mcTreeHandler.TREE.currentIndex;
+		if(currentIndex >= 0) aRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(currentIndex);
+		var selection = targetWindow.getSelection();
+		if(!selection) return false;
+		var selectText = selection.toString();
+		if(selectText == "") return false;
+		var xpath = [];
+		for(var r=0;r<selection.rangeCount;r++){
+			var range = selection.getRangeAt(r);
+			if(range.startContainer.nodeType != range.startContainer.TEXT_NODE || range.endContainer.nodeType != range.endContainer.TEXT_NODE){
+				var docRange = range.cloneRange();
+				var startRange = range.cloneRange();
+				var stopRange = range.cloneRange();
+				startRange.collapse(true)
+				stopRange.collapse(false)
+				var findRange = bitsMarker._getFindRange();
+				var result = findRange.Find(range.toString().replace(/^\s*/g,"").replace(/\s*$/g,""), docRange, startRange, stopRange);
+				if(result) range = result.cloneRange();
+			}
+			var context = this.Common.exceptCode(range.toString().replace(/\s+$/mg,"").replace(/^\s+/mg,""));
+			var stXPath = this.XPath.getOffsetFromParentNode(range.startContainer,range.startOffset);
+			var enXPath = this.XPath.getOffsetFromParentNode(range.endContainer,range.endOffset);
+			if(!stXPath || !enXPath) continue;
+			var bgn_dom = stXPath.xpath + "("+stXPath.offset+")" + "("+stXPath.type+")";
+			var end_dom = enXPath.xpath + "("+enXPath.offset+")" + "("+enXPath.type+")";
+			var con_url = this.Common.getURLStringFromDocument(stXPath.node.ownerDocument);
+			try{
+				var hyperAnchor = bitsHyperAnchor._getAnchorURL({node:range.startContainer,offset:range.startOffset,style:style,prefix:"b",contents:range.toString()},{node:range.endContainer,offset:range.endOffset,prefix:"e",contents:range.toString()});
+			}catch(ex3){
+				try{
+					var hyperAnchor = bitsHyperAnchorDummy._getAnchorURL({node:range.startContainer,offset:range.startOffset,style:style,prefix:"b",contents:range.toString()},{node:range.endContainer,offset:range.endOffset,prefix:"e",contents:range.toString()});
+				}catch(ex3){
+					hyperAnchor = null;
+					bitsMarkingCollection._dump("bitsMarkingCollection.updateSelectedText():ex3=["+ex3 +"]");
+				}
+			}
+			if(hyperAnchor) hyperAnchor = bitsAutocacheService.convertCacheURLToOriginalURL(hyperAnchor);
+			xpath.push({doc:stXPath.node.ownerDocument,context:context,bgn_dom:bgn_dom,end_dom:end_dom,con_url:con_url,hyperAnchor:hyperAnchor});
+			break; //æåã®éžæãã­ã¹ãã®ã¿æå¹
+		}
+		selection.removeAllRanges();
+		if(xpath.length == 0) return;
+
+		var rValue = this.Database.getObjectFormID(oid,dbtype);
+		if(!rValue) return;
+		rValue[0].oid_title = xpath[0].context;
+		rValue[0].oid_txt = xpath[0].context;
+		rValue[0] = this.setInitMarkerData(rValue[0]);
+		if(!rValue[0]) return;
+
+		bitsMarker.unmarkerWindow(aElem.id);
+		var rtn = false;
+		var r;
+		for(r=0;r<xpath.length;r++){
+			var rtnContent = bitsMarker.xPathMarker(
+				xpath[r].doc,
+				{
+					start   : xpath[r].bgn_dom,
+					end     : xpath[r].end_dom,
+					context : xpath[r].context,
+					con_url : xpath[r].con_url
+				},{
+					id     : oid,
+					dbtype : dbtype,
+					pfid   : pfid,
+					style  : style
+				});
+			if(!rtnContent) continue;
+			var oid_property = "";
+			if(rValue) oid_property = rValue[0].oid_property;
+			if(xpath[r].hyperAnchor){
+				var parser = new DOMParser();
+				try{ var xmldoc = parser.parseFromString(oid_property,"text/xml"); }catch(e){xmldoc = null; }
+				if(!xmldoc) xmldoc = parser.parseFromString("<PROPERTY/>","text/xml");
+				if(xmldoc){
+					if(xmldoc.documentElement && hyperAnchor){
+						var xmlnode = xmldoc.getElementsByTagName("HYPER_ANCHOR")[0];
+						if(xmlnode){
+							while(xmlnode.hasChildNodes()){
+								xmlnode.removeChild(xmlnode.lastChild);
+							}
+						}else{
+							xmlnode = xmldoc.createElement("HYPER_ANCHOR");
+							xmldoc.documentElement.appendChild(xmlnode);
+						}
+						xmlnode.appendChild(xmldoc.createTextNode(xpath[r].hyperAnchor));
+					}
+					var s = new XMLSerializer();
+					oid_property = s.serializeToString(xmldoc);
+					s = undefined;
+				}
+				parser = undefined;
+			}
+			rtn = this.Database.updateObject({
+				oid:oid,
+				oid_type     : "text",
+				oid_txt      : xpath[r].context,
+				bgn_dom      : xpath[r].bgn_dom,
+				end_dom      : xpath[r].end_dom,
+				con_url      : bitsAutocacheService.convertCacheURLToOriginalURL(xpath[r].con_url),
+				oid_property : oid_property
+			},dbtype);
+		}
+		if(currentIndex>=0){
+			mcTreeHandler.TREE.currentIndex = currentIndex;
+			if(!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex)) mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+			mcTreeHandler.TREE.focus();
+			mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(currentIndex);
+			if(mcPropertyView) mcPropertyView.dispProperty(mcTreeHandler.object);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	setInitMarkerData : function(aObject,aEdit){
+		if(aEdit == undefined) aEdit = true;
+		var initdata_edit = nsPreferences.getBoolPref("wiredmarker.marker.initdata.edit", true);
+		if(!aEdit) initdata_edit = false;
+		var title_mode = nsPreferences.copyUnicharPref("wiredmarker.marker.initdata.title","WM_TITLE");
+		var note_mode = nsPreferences.copyUnicharPref("wiredmarker.marker.initdata.note","WM_TEXT");
+		var title_format = nsPreferences.copyUnicharPref("wiredmarker.marker.initdata.title_format","");
+		var note_format = nsPreferences.copyUnicharPref("wiredmarker.marker.initdata.note_format","");
+		try{
+			aObject.doc_title = decodeURIComponent(aObject.doc_title);
+		}catch(e){
+			this._dump("setInitMarkerData():e="+e);
+			aObject.doc_title = aObject.doc_title;
+		}
+		var wm_text = aObject.oid_title;
+		switch(title_mode){
+			case "WM_TITLE":
+				aObject.oid_title = aObject.doc_title;
+				break;
+			case "WM_DATE":
+				aObject.oid_title = aObject.oid_date;
+				break;
+			case "WM_FORMAT":
+				if(title_format || initdata_edit){
+					aObject.oid_title = title_format.replace(/WM_TEXT/gi,wm_text).replace(/WM_TITLE/gi,aObject.doc_title).replace(/WM_DATE/gi,aObject.oid_date);
+				}
+				break;
+		}
+		var note = wm_text;
+		var parser = new DOMParser();
+		try{var xmldoc = parser.parseFromString(aObject.oid_property,"text/xml");}catch(e){xmldoc=null;}
+		if(xmldoc){
+			var xmlnode = xmldoc.getElementsByTagName("NOTE")[0];
+			if(xmlnode) note = xmlnode.textContent;
+		}
+		if(note_mode){
+			switch(note_mode){
+				case "WM_TEXT":
+					note = wm_text;
+					break;
+				case "WM_TITLE":
+					note = aObject.doc_title;
+					break;
+				case "WM_DATE":
+					note = aObject.oid_date;
+					break;
+				case "WM_FORMAT":
+					if(note_format || initdata_edit){
+						note = note_format.replace(/WM_TEXT/gi,wm_text).replace(/WM_TITLE/gi,aObject.doc_title).replace(/WM_DATE/gi,aObject.oid_date);
+					}
+					break;
+			}
+			if(note){
+				if(!xmldoc) xmldoc = parser.parseFromString("<PROPERTY/>","text/xml");
+				var xmlnode = xmldoc.getElementsByTagName("NOTE")[0]
+				if(!xmlnode){
+					xmlnode = xmldoc.createElement("NOTE");
+					xmldoc.documentElement.appendChild(xmlnode);
+				}else{
+					while(xmlnode.lastChild){ xmlnode.removeChild(xmlnode.lastChild); }
+				}
+				xmlnode.appendChild(xmldoc.createTextNode(note));
+				var s = new XMLSerializer();
+				aObject.oid_property = s.serializeToString(xmldoc);
+				s = undefined;
+			}
+		}else{
+			note = "";
+		}
+		if(initdata_edit){
+			var result = {};
+			result.accept = false;
+			result.title = aObject.oid_title;
+			result.note = note;
+			window.openDialog("chrome://markingcollection/content/markerInitDataDialog.xul", "", "chrome,centerscreen,modal,dialog,resizable=yes", result);
+			if(result.accept){
+				result.title = result.title.replace(/\t/mg,"        ");
+				result.title = this.Common.exceptCode(result.title);
+				result.title = result.title.replace(/\x0D\x0A|\x0D|\x0A/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+				result.note = result.note.replace(/\t/mg,"        ");
+				result.note = result.note.replace(/\x0D\x0A|\x0D|\x0A/g," __BR__ ");
+				result.note = this.Common.exceptCode(result.note);
+				result.note = result.note.replace(/[\r\n]/mg, " ").replace(/ __BR__ /mg,"\n");
+				aObject.oid_title = result.title;
+				var parser = new DOMParser();
+				try{var xmldoc = parser.parseFromString(aObject.oid_property,"text/xml");}catch(e){xmldoc=null;}
+				if(!xmldoc) xmldoc = parser.parseFromString("<PROPERTY/>","text/xml");
+				parser = undefined;
+				if(result.note){
+					var xmlnode = xmldoc.getElementsByTagName("NOTE")[0]
+					if(!xmlnode){
+						xmlnode = xmldoc.createElement("NOTE");
+						xmldoc.documentElement.appendChild(xmlnode);
+					}else{
+						while(xmlnode.lastChild){ xmlnode.removeChild(xmlnode.lastChild); }
+					}
+					xmlnode.appendChild(xmldoc.createTextNode(result.note));
+				}else{
+					var xmlnode = xmldoc.getElementsByTagName("NOTE")[0]
+					if(xmlnode) xmlnode.parentNode.removeChild(xmlnode);
+				}
+				var s = new XMLSerializer();
+				aObject.oid_property = s.serializeToString(xmldoc);
+				s = undefined;
+			}else{
+				return undefined;
+			}
+		}
+		parser = undefined;
+		return aObject;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getFolderFromPFID : function(aPFID){
+		if(!aPFID || aPFID == "0") return null;
+		var rtnFolder = bitsMarkingCollection.Database.getFolderFormID(aPFID,undefined,bitsMarkingCollection.Database._defaultMode);
+		if(!rtnFolder) return null;
+		var rtnArr = bitsMarkingCollection.getFolderFromPFID(rtnFolder[0].pfid);
+		if(rtnArr) rtnFolder = rtnFolder.concat(rtnArr);
+		return rtnFolder;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	checkFolderNameRepetition  : function(aDBType){
+		if(aDBType == undefined) return;
+		var rtnFolder = bitsMarkingCollection.Database.getAllFolder(aDBType);
+		if(rtnFolder && rtnFolder.length>1){
+			var folders_name = [];
+			var i;
+			for(i=0;i<rtnFolder.length;i++){
+				var chkid = rtnFolder[i].pfid.toString() + "\t" + rtnFolder[i].fid_title;
+				if(!folders_name[chkid]) folders_name[chkid] = [];
+				folders_name[chkid].push(rtnFolder[i].fid);
+			}
+			for(i=0;i<rtnFolder.length;i++){
+				var folder = rtnFolder[i];
+				var chkid = folder.pfid.toString() + "\t" + folder.fid_title;
+				if(folders_name[chkid] && folders_name[chkid].length>1){
+					var cnt;
+					var folders_name_arr = folders_name[chkid];
+					for(cnt=0;cnt<folders_name_arr.length;cnt++){
+						if(folders_name_arr[cnt] != folder.fid || cnt==0) continue;
+						var chkid = folder.pfid.toString() + "\t" + folder.fid_title + " (" + (cnt+1).toString() + ")";
+						while(folders_name[chkid]){
+							cnt++;
+							chkid = folder.pfid.toString() + "\t" + folder.fid_title + " (" + (cnt+1).toString() + ")";
+						}
+						folder.fid_title += " (" + (cnt+1).toString() + ")";
+						folders_name[chkid] = [];
+						folders_name[chkid].push(folder.fid);
+						if(folder.dbtype) delete folder.dbtype;
+						bitsMarkingCollection.Database.updateFolder(folder,aDBType);
+						break;
+					}
+				}
+			}
+		}
+		rtnFolder = undefined;
+		return;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	rebuildRdf : function(aFunc){
+		try{
+			var aFile = this.DataSource.file;
+			this.Database.initSeq();
+			var refRootfolder = nsPreferences.copyUnicharPref("wiredmarker.rootfolder","");
+			var rootFolder = undefined;
+			var rootFolder_dbtype = undefined;
+			if(!refRootfolder || refRootfolder.match(/^0+$/)){
+				rootFolder = undefined;
+			}else{
+				rootFolder = refRootfolder;
+				rootFolder_dbtype = nsPreferences.copyUnicharPref("wiredmarker.rootfolder_dbtype","");
+				if(!rootFolder_dbtype || rootFolder_dbtype == "") rootFolder_dbtype = this.Database._defaultMode;
+				//ã«ãŒããã©ã«ããå­åšããããã§ãã¯
+				if(!this.Database.isOpenDB(rootFolder_dbtype) || !this.Database._fidExists(rootFolder_dbtype, rootFolder)){
+					rootFolder = undefined;
+					rootFolder_dbtype = undefined;
+					nsPreferences.setUnicharPref("wiredmarker.rootfolder","");
+					nsPreferences.setUnicharPref("wiredmarker.rootfolder_dbtype","");
+				}
+			}
+			var tmpFolderFilter = nsPreferences.copyUnicharPref("wiredmarker.filter.folder","");
+			var tmpFolderFilterArr = tmpFolderFilter.split("\t");
+			var folderFilterHash = [];
+			var i;
+			for(i=0;i<tmpFolderFilterArr.length;i++){
+				if(!tmpFolderFilterArr[i].match(/^(\d+):(\d+):(.+)$/)) continue;
+				var filter_fid = RegExp.$1;
+				var filter_casesensitive = RegExp.$2;
+				var filter_keyword = RegExp.$3;
+				folderFilterHash[filter_fid] = new RegExp(filter_keyword,(filter_casesensitive==1)?"mg":"img");
+			}
+			tmpFolderFilterArr = undefined;
+			tmpFolderFilter = undefined;
+			var contentWindow = null;
+			var mcTreeSharedFolder = null;
+			var mcTreeViewModeService = null;
+			if(this._contentWindow) contentWindow = this._contentWindow;
+			if(contentWindow && contentWindow.mcTreeSharedFolder) mcTreeSharedFolder = contentWindow.mcTreeSharedFolder;
+			if(contentWindow && contentWindow.mcTreeViewModeService) mcTreeViewModeService = contentWindow.mcTreeViewModeService;
+//ãã©ã«ãåç§°éè€ãã§ãã¯
+			this.checkFolderNameRepetition(this.Database._defaultMode);
+			if(bitsScrapPartyAddonService && bitsScrapPartyAddonService.existsAddon()){
+				var extensionDir = bitsMarkingCollection.Common.getExtensionDir().clone();
+				if(extensionDir){
+					var dbtype_arr = bitsScrapPartyAddonService.getAddonDBType();
+					if(dbtype_arr && dbtype_arr.length > 0){
+						while(dbtype_arr.length > 0){
+							var addon_dbtype = dbtype_arr.shift();
+							var regexp = new RegExp("^("+ addon_dbtype +")(\\d*)\\.sqlite$", "m");
+							var entries = extensionDir.directoryEntries;
+							while(entries.hasMoreElements()){
+								var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+								if(entry.isFile() && entry.leafName.match(regexp)){
+									var dbtype = RegExp.$1;
+									var dbversion = RegExp.$2;
+									this.checkFolderNameRepetition(dbtype+dbversion);
+								}
+							}
+						}
+					}
+				}
+			}
+			var rtn = null;
+			var viewmode = "all";
+			if(mcTreeViewModeService) viewmode = mcTreeViewModeService.viewmode;
+
+/////////////////////////////////////////////////////////////////////
+			var rdf_hash = [];
+			var dbtype_arr = [];
+			if(viewmode == "single" || viewmode == "all"){
+				var dbinfo = this.dbinfo.getAllDBInfo();
+				if(dbinfo){
+					var i;
+					for(i=0;i<dbinfo.length;i++){
+						if(rdf_hash[""+dbinfo[i].database_dbtype]) continue;
+						dbtype_arr.push(dbinfo[i].database_dbtype);
+						rdf_hash[""+dbinfo[i].database_dbtype] = {};
+						rdf_hash[""+dbinfo[i].database_dbtype].title = dbinfo[i].database_title;
+						rdf_hash[""+dbinfo[i].database_dbtype].icon  = dbinfo[i].database_icon;
+					}
+				}
+				if(dbtype_arr.length>0){
+					var i;
+					var dbtype_cnt;
+					for(dbtype_cnt=0;dbtype_cnt<dbtype_arr.length;dbtype_cnt++){
+						var dbtype = dbtype_arr[dbtype_cnt];
+						if(rootFolder_dbtype && rootFolder_dbtype != dbtype) continue;
+						var rtnFolder = [];
+						var rtnObj = [];
+						var pfid2Folder = [];
+						var fid2Folder = [];
+						var pfid2Object = [];
+						var rtnArr = this.Database.getAllFolder(dbtype);
+						if(rtnArr) rtnFolder = rtnFolder.concat(rtnArr);
+						rtnArr = undefined;
+						if(rtnObj && rtnObj.length>0){
+							for(i=0;i<rtnObj.length;i++){
+								if(pfid2Object[rtnObj[i].pfid] == undefined) pfid2Object[rtnObj[i].pfid] = [];
+								if(folderFilterHash[rtnObj[i].pfid] && !rtnObj[i].oid_title.match(folderFilterHash[rtnObj[i].pfid])) continue;
+								pfid2Object[rtnObj[i].pfid].push(rtnObj[i]);
+							}
+							if(rtnFolder && rtnFolder.length>0){
+								var hash = [];
+								for(i=0;i<rtnObj.length;i++){
+									if(hash[rtnObj[i].pfid]) continue;
+									hash[rtnObj[i].pfid] = rtnObj[i].oid;
+									var rtnArr = bitsMarkingCollection.getFolderFromPFID(rtnObj[i].pfid);
+									if(rtnArr) rtnFolder = rtnFolder.concat(rtnArr);
+								}
+							}
+						}
+						if(rtnFolder && rtnFolder.length>0){
+							rtnFolder.sort(
+								function(a,b){
+									var len = parseFloat(a.pfid_order)-parseFloat(b.pfid_order);
+									return len;
+								}
+							);
+							for(i=0;i<rtnFolder.length;i++){
+								if(fid2Folder[rtnFolder[i].fid]) continue;
+								fid2Folder[rtnFolder[i].fid] = [];
+								fid2Folder[rtnFolder[i].fid].push(rtnFolder[i]);
+								if(folderFilterHash[rtnFolder[i].pfid] && !rtnFolder[i].fid_title.match(folderFilterHash[rtnFolder[i].pfid])) continue;
+								if(pfid2Folder[rtnFolder[i].pfid] == undefined) pfid2Folder[rtnFolder[i].pfid] = [];
+								pfid2Folder[rtnFolder[i].pfid].push(rtnFolder[i]);
+							}
+						}
+						rtnFolder = undefined;
+						if(rootFolder){
+							rdf_hash[""+rootFolder_dbtype].rdf = this.Database.makeRdf(rootFolder,true,false,pfid2Folder,fid2Folder,pfid2Object,undefined,rootFolder_dbtype);
+						}else{
+							rdf_hash[""+dbtype].rdf = this.Database.makeRdf(undefined,true,false,pfid2Folder,fid2Folder,pfid2Object,undefined,dbtype);
+						}
+						rtnFolder = undefined;
+						rtnObj = undefined;
+						pfid2Folder = undefined;
+						fid2Folder = undefined;
+						pfid2Object = undefined;
+					}
+				}
+			}
+/////////////////////////////////////////////////////////////////////
+
+			var rtnShared = null;
+			if((viewmode == "single" || viewmode == "all") && mcTreeSharedFolder && mcTreeSharedFolder.isChecked){
+				var rtnFolder = [];
+				var rtnObj = [];
+				var pfid2Folder = [];
+				var fid2Folder = [];
+				var pfid2Object = [];
+				var i;
+				var rtnFolder = bitsMarkingCollection.Database.getAllFolder(this.Database._sharedMode);
+				if(viewmode == "single"){
+					rtnObj = bitsMarkingCollection.Database.getObjectFormURL(this.Common.getURLStringFromDocument(this.gBrowser.contentDocument),this.Database._sharedMode);
+				}else if(viewmode == "all"){
+					rtnObj = bitsMarkingCollection.Database.getAllObject(this.Database._sharedMode);
+				}
+				if(rtnObj){
+					rtnObj.sort(
+						function(a,b){
+							var len = parseFloat(a.pfid_order)-parseFloat(b.pfid_order);
+							return len;
+						}
+					);
+					for(i=0;i<rtnObj.length;i++){
+						if(pfid2Object[rtnObj[i].pfid] == undefined) pfid2Object[rtnObj[i].pfid] = [];
+						if(folderFilterHash[rtnObj[i].pfid] && !rtnObj[i].oid_title.match(folderFilterHash[rtnObj[i].pfid])) continue;
+						pfid2Object[rtnObj[i].pfid].push(rtnObj[i]);
+					}
+					if(rtnFolder){
+						var hash = [];
+						for(i=0;i<rtnObj.length;i++){
+							if(hash[rtnObj[i].pfid]) continue;
+							hash[rtnObj[i].pfid] = rtnObj[i].oid;
+							var rtnArr = bitsMarkingCollection.getFolderFromPFID(rtnObj[i].pfid);
+							if(rtnArr) rtnFolder = rtnFolder.concat(rtnArr);
+						}
+					}
+				}
+				if(rtnFolder){
+					rtnFolder.sort(
+						function(a,b){
+							var len = parseFloat(a.pfid_order)-parseFloat(b.pfid_order);
+							return len;
+						}
+					);
+					for(i=0;i<rtnFolder.length;i++){
+						if(fid2Folder[rtnFolder[i].fid]) continue;
+						fid2Folder[rtnFolder[i].fid] = [];
+						fid2Folder[rtnFolder[i].fid].push(rtnFolder[i]);
+						if(folderFilterHash[rtnFolder[i].pfid] && !rtnFolder[i].fid_title.match(folderFilterHash[rtnFolder[i].pfid])) continue;
+						if(pfid2Folder[rtnFolder[i].pfid] == undefined) pfid2Folder[rtnFolder[i].pfid] = [];
+						pfid2Folder[rtnFolder[i].pfid].push(rtnFolder[i]);
+					}
+				}
+				rtnFolder = undefined;
+				rtnShared = this.Database.makeRdf(rootFolder,true,false,pfid2Folder,fid2Folder,pfid2Object,undefined,this.Database._sharedMode);
+			}
+
+			if(viewmode == "single" || viewmode == "all"){
+				var results = null;
+				if(rtn && rtn.list) results = rtn.list;
+				var out_txt = "";
+				var out_txt_utf8 = "";
+				out_txt += '<?xml version="1.0"?>\n';
+				out_txt += '<RDF:RDF xmlns:NS1="' + bitsObjectMng.NS_OBJECTMANAGEMENT + '"\n';
+				out_txt += '         xmlns:NC="http://home.netscape.com/NC-rdf#"\n';
+				out_txt += '         xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">\n';
+
+				if(rootFolder == undefined){
+					var shared_id = this.sharedfolder.id + dbtype_arr.length;
+					var shared_about = this.sharedfolder.about(shared_id);
+					out_txt += '  <RDF:Seq RDF:about="'+ bitsObjectMng.DataSource.ABOUT_ROOT +'">\n';
+					if(dbtype_arr.length>0){
+						var dbtype_cnt;
+						for(dbtype_cnt=0;dbtype_cnt<dbtype_arr.length;dbtype_cnt++){
+							var local_about = this.sharedfolder.about(dbtype_cnt);
+							out_txt += '    <RDF:li RDF:resource="'+ local_about +'"/>\n';
+						}
+					}
+					if(mcTreeSharedFolder && mcTreeSharedFolder.isChecked) out_txt += '    <RDF:li RDF:resource="'+ shared_about +'"/>\n';
+					out_txt += '  </RDF:Seq>\n';
+					if(dbtype_arr.length>0){
+						var dbtype_cnt;
+						for(dbtype_cnt=0;dbtype_cnt<dbtype_arr.length;dbtype_cnt++){
+							var dbtype = dbtype_arr[dbtype_cnt];
+							var local_id = dbtype_cnt;
+							var local_about = this.sharedfolder.about(local_id);
+							this.DataSource.setID2About("0",undefined,local_about,dbtype);
+							var resultsLocal = null;
+							if(rdf_hash[""+dbtype] && rdf_hash[""+dbtype].rdf && rdf_hash[""+dbtype].rdf.list) resultsLocal = rdf_hash[""+dbtype].rdf.list;
+							out_txt += '  <RDF:Seq RDF:about="'+ local_about +'">\n';
+							if(resultsLocal){
+								resultsLocal.sort(
+									function(a,b){
+										var len = parseFloat(a.pfid_order)-parseFloat(b.pfid_order);
+										return len;
+									}
+								);
+								var cnt;
+								for(cnt=0;cnt<resultsLocal.length;cnt++){
+									out_txt += '    <RDF:li RDF:resource="'+ resultsLocal[cnt].about +'"/>\n';
+								}
+							}
+							out_txt += '  </RDF:Seq>\n';
+							if(dbtype == this._uncategorized.dbtype){
+								out_txt += '  <RDF:Description RDF:about="' + local_about +'"';
+								out_txt += '\n                   NS1:id="0"';
+								out_txt += '\n                   NS1:title="'+rdf_hash[""+dbtype].title+'"';
+								out_txt += '\n                   NS1:type="'+dbtype+'"';
+								out_txt += '\n                   NS1:icon=""';
+								out_txt += '\n                   NS1:editmode="'+ (""+0x0004) +'"';
+								out_txt += '\n                   NS1:cssrule="css_'+dbtype+'_0"';
+								out_txt += '\n                   NS1:style="'+this._uncategorized.style+'"';
+								out_txt += '\n                   NS1:source=""';
+								out_txt += '\n                   NS1:addon_id=""';
+								out_txt += '\n                   NS1:pfid=""';
+								out_txt += '\n                   NS1:pfid_order=""';
+								out_txt += '\n                   NS1:uri=""';
+								out_txt += '\n                   NS1:comment=""';
+								out_txt += '\n                   NS1:chars=""';
+								out_txt += '\n                   NS1:shortcut=""';
+								out_txt += '\n                   NS1:contextmenu=""';
+								out_txt += '\n                   NS1:dbtype="'+dbtype+'"';
+								out_txt += '/>\n';
+							}else{
+								out_txt += '  <RDF:Description RDF:about="' + local_about +'"';
+								out_txt += '\n                   NS1:id="0"';
+								out_txt += '\n                   NS1:title="'+rdf_hash[""+dbtype].title+'"';
+								out_txt += '\n                   NS1:type="localfolder"';
+								out_txt += '\n                   NS1:icon="'+rdf_hash[""+dbtype].icon+'"';
+								out_txt += '\n                   NS1:editmode="'+ (""+0x1F03) +'"';
+								out_txt += '\n                   NS1:cssrule="css_'+dbtype+'_0"';
+								out_txt += '\n                   NS1:style=""';
+								out_txt += '\n                   NS1:source=""';
+								out_txt += '\n                   NS1:addon_id=""';
+								out_txt += '\n                   NS1:pfid=""';
+								out_txt += '\n                   NS1:pfid_order=""';
+								out_txt += '\n                   NS1:uri=""';
+								out_txt += '\n                   NS1:comment=""';
+								out_txt += '\n                   NS1:chars=""';
+								out_txt += '\n                   NS1:shortcut=""';
+								out_txt += '\n                   NS1:contextmenu=""';
+								out_txt += '\n                   NS1:dbtype="'+dbtype+'"';
+								out_txt += '/>\n';
+							}
+
+							if(resultsLocal) out_txt += this.Database._outputRDF(resultsLocal);
+							resultsLocal = undefined;
+						}
+					}
+
+					if(mcTreeSharedFolder && mcTreeSharedFolder.isChecked){
+						var resultsShared = null;
+						if(rtnShared && rtnShared.list) resultsShared = rtnShared.list;
+						out_txt += '  <RDF:Seq RDF:about="'+ shared_about +'">\n';
+						if(resultsShared){
+							resultsShared.sort(
+								function(a,b){
+									var len = parseFloat(a.pfid_order)-parseFloat(b.pfid_order);
+									return len;
+								}
+							);
+							var cnt;
+							for(cnt=0;cnt<resultsShared.length;cnt++){
+								out_txt += '    <RDF:li RDF:resource="'+ resultsShared[cnt].about +'"/>\n';
+							}
+						}
+						out_txt += '  </RDF:Seq>\n';
+						out_txt += '  <RDF:Description RDF:about="' + shared_about +'"';
+						out_txt += '\n                   NS1:id="0"';
+						out_txt += '\n                   NS1:title="'+this.sharedfolder.title+'"';
+						out_txt += '\n                   NS1:type="sharedfolder"';
+						out_txt += '\n                   NS1:icon="chrome://markingcollection/skin/sharedfolder.png"';
+						out_txt += '\n                   NS1:editmode="'+ (""+0x1003) +'"';
+						out_txt += '\n                   NS1:cssrule="css_'+this.Database._sharedMode+'_0"';
+						out_txt += '\n                   NS1:style=""';
+						out_txt += '\n                   NS1:source=""';
+						out_txt += '\n                   NS1:addon_id=""';
+						out_txt += '\n                   NS1:pfid=""';
+						out_txt += '\n                   NS1:pfid_order=""';
+						out_txt += '\n                   NS1:uri=""';
+						out_txt += '\n                   NS1:comment=""';
+						out_txt += '\n                   NS1:chars=""';
+						out_txt += '\n                   NS1:shortcut=""';
+						out_txt += '\n                   NS1:dbtype="'+this.Database._sharedMode+'"';
+						out_txt += '/>\n';
+						if(resultsShared) out_txt += this.Database._outputRDF(resultsShared);
+					}
+				}else{
+					if(dbtype_arr.length>0){
+						var dbtype_cnt;
+						for(dbtype_cnt=0;dbtype_cnt<dbtype_arr.length;dbtype_cnt++){
+							var dbtype = dbtype_arr[dbtype_cnt];
+							if(dbtype != rootFolder_dbtype) continue;
+							var local_id = dbtype_cnt;
+							var local_about = this.sharedfolder.about(local_id);
+							var resultsLocal = null;
+							if(rdf_hash[""+dbtype] && rdf_hash[""+dbtype].rdf && rdf_hash[""+dbtype].rdf.list) resultsLocal = rdf_hash[""+dbtype].rdf.list;
+							if(!resultsLocal) continue;
+							out_txt += '  <RDF:Seq RDF:about="'+ bitsObjectMng.DataSource.ABOUT_ROOT +'">\n';
+							if(resultsLocal){
+								resultsLocal.sort(
+									function(a,b){
+										var len = parseFloat(a.pfid_order)-parseFloat(b.pfid_order);
+										return len;
+									}
+								);
+								var cnt;
+								for(cnt=0;cnt<resultsLocal.length;cnt++){
+									out_txt += '    <RDF:li RDF:resource="'+ resultsLocal[cnt].about +'"/>\n';
+								}
+							}
+							out_txt += '  </RDF:Seq>\n';
+							out_txt += '  <RDF:Description RDF:about="' + local_about +'"';
+							out_txt += '\n                   NS1:id="0"';
+							out_txt += '\n                   NS1:title="'+rdf_hash[""+dbtype].title+'"';
+							out_txt += '\n                   NS1:type="localfolder"';
+							out_txt += '\n                   NS1:icon="'+rdf_hash[""+dbtype].icon+'"';
+							out_txt += '\n                   NS1:editmode="'+ (""+0x1F03) +'"';
+							out_txt += '\n                   NS1:cssrule="css'+dbtype+'_0"';
+							out_txt += '\n                   NS1:style=""';
+							out_txt += '\n                   NS1:source=""';
+							out_txt += '\n                   NS1:addon_id=""';
+							out_txt += '\n                   NS1:pfid=""';
+							out_txt += '\n                   NS1:pfid_order=""';
+							out_txt += '\n                   NS1:uri=""';
+							out_txt += '\n                   NS1:comment=""';
+							out_txt += '\n                   NS1:chars=""';
+							out_txt += '\n                   NS1:shortcut=""';
+							out_txt += '\n                   NS1:dbtype="'+dbtype+'"';
+							out_txt += '/>\n';
+							if(resultsLocal) out_txt += this.Database._outputRDF(resultsLocal);
+							resultsLocal = undefined;
+							break;
+						}
+					}
+				}
+				out_txt += '</RDF:RDF>\n';
+				this.Common.writeFile(aFile,out_txt,"UTF-8");
+			}
+		}catch(ex){
+			bitsMarkingCollection._dump("bitsMarkingCollection.rebuildRdf():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	loadXMLDocument : function(pUri){
+		try{
+			var aFile = this.Common.convertURLToFile(pUri);
+			var fileContents = this.Common.readFile(aFile);
+			var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
+			converter.charset = "UTF-8";
+			fileContents = converter.ConvertToUnicode(fileContents);
+
+			var domParser = new DOMParser();
+			var xmlDocument = domParser.parseFromString(fileContents, "text/xml");
+			domParser = undefined;
+			return xmlDocument;
+		}catch(ex2){
+			bitsMarkingCollection._dump("bitsMarkingCollection.loadXMLDocument("+pUri+"):"+ ex2);
+			return undefined;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	initProgressmeter : function(){
+		var prog = bitsMarkingCollection.ProgressPanel;
+		if(prog){
+			prog.removeAttribute("hidden");
+			prog = bitsMarkingCollection.Progressmeter;
+			if(prog) prog.setAttribute("value", "0");
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	execProgressmeter : function(aValue){
+		var prog = bitsMarkingCollection.Progressmeter;
+		if(prog) prog.value = aValue;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	endProgessmeter : function(){
+		var prog = bitsMarkingCollection.ProgressPanel;
+		if(prog) prog.setAttribute("hidden", true);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	showConsole : function () {
+		window.open("chrome://global/content/console.xul", "_blank", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		if(!nsPreferences.getBoolPref("wiredmarker.debug", false)) return;
+		var dumpString = new String(aString);
+		var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"]
+		                      .getService(Components.interfaces.nsIConsoleService);
+		aConsoleService.logStringMessage(dumpString);
+		window.dump(aString+"\n");
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/menuDialogOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/menuDialogOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/menuDialogOverlay.xul	(revision 5703)
@@ -0,0 +1,204 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+	id="menuDialogOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript">
+	<![CDATA[
+		var itemview = {};
+		function _menuMainInit(aEvent){
+			var disp = nsPreferences.getBoolPref("wiredmarker.menu.topmenu", true);
+			document.getElementById("mcMenuDispTopMenu").checked = disp;
+
+			var app_version = 0;
+			try{
+				var info = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
+				app_version = parseInt(info.version);
+			}catch(e){}
+			var def_position = app_version<4?"topmenu":"appmenu";
+			var isXp = false;
+			var res = window.navigator.oscpu.match(/Windows NT (.+)/);
+			if(res && res[1]<6) isXp = true;
+			if(app_version>=4 && isXp) def_position = "topmenu";
+			var position = nsPreferences.copyUnicharPref("wiredmarker.menu.position",def_position);
+			if(app_version<4){
+				document.getElementById("mcMenuDispMenuApp").setAttribute("hidden",true);
+				if(position=="appmenu"){
+					position=def_position;
+					nsPreferences.setUnicharPref("wiredmarker.menu.position", position);
+				}
+			}else{
+				document.getElementById("mcMenuDispMenuApp").removeAttribute("hidden");
+			}
+
+			if(Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS != "WINNT"){
+				document.getElementById("mcMenuDispMenuApp").setAttribute("hidden",true);
+				if(position == "appmenu"){
+					position = "topmenu";
+					nsPreferences.setUnicharPref("wiredmarker.menu.position", position);
+				}
+			}
+			
+			switch(position){
+				case "bookmarks":
+					document.getElementById("mcMenuDispMenuApp").removeAttribute("selected");
+					document.getElementById("mcMenuDispMenuTop").removeAttribute("selected");
+					document.getElementById("mcMenuDispMenuBookmarks").setAttribute("selected","true");
+					document.getElementById("mcMenuDispMenuTools").removeAttribute("selected");
+					break;
+				case "tools":
+					document.getElementById("mcMenuDispMenuApp").removeAttribute("selected");
+					document.getElementById("mcMenuDispMenuTop").removeAttribute("selected");
+					document.getElementById("mcMenuDispMenuBookmarks").removeAttribute("selected");
+					document.getElementById("mcMenuDispMenuTools").setAttribute("selected","true");
+					break;
+				case "appmenu":
+					document.getElementById("mcMenuDispMenuApp").setAttribute("selected","true");
+					document.getElementById("mcMenuDispMenuTop").removeAttribute("selected");
+					document.getElementById("mcMenuDispMenuBookmarks").removeAttribute("selected");
+					document.getElementById("mcMenuDispMenuTools").removeAttribute("selected");
+					break;
+				default:
+					document.getElementById("mcMenuDispMenuApp").removeAttribute("selected");
+					document.getElementById("mcMenuDispMenuTop").setAttribute("selected","true");
+					document.getElementById("mcMenuDispMenuBookmarks").removeAttribute("selected");
+					document.getElementById("mcMenuDispMenuTools").removeAttribute("selected");
+					break;
+			}
+
+			var concordance = nsPreferences.copyUnicharPref("wiredmarker.concordance","");
+			switch(concordance){
+				case "display":
+					document.getElementById("mcMenuConcordanceSidebar").removeAttribute("selected");
+					document.getElementById("mcMenuConcordanceDisplay").setAttribute("selected","true");
+					document.getElementById("mcMenuConcordanceNone").removeAttribute("selected");
+					break;
+				case "none":
+					document.getElementById("mcMenuConcordanceSidebar").removeAttribute("selected");
+					document.getElementById("mcMenuConcordanceDisplay").removeAttribute("selected");
+					document.getElementById("mcMenuConcordanceNone").setAttribute("selected","true");
+					break;
+				default:
+					document.getElementById("mcMenuConcordanceSidebar").setAttribute("selected","true");
+					document.getElementById("mcMenuConcordanceDisplay").removeAttribute("selected");
+					document.getElementById("mcMenuConcordanceNone").removeAttribute("selected");
+					break;
+			}
+
+			var contentWindow = window.opener.bitsMarkingCollection._contentWindow;
+			var bitsItemView = null;
+			if(contentWindow && contentWindow.bitsItemView) bitsItemView = contentWindow.bitsItemView;
+
+			if(bitsItemView){
+				itemview.isChecked = bitsItemView.isChecked;
+				itemview.position = bitsItemView.position;
+			}else{
+				itemview.isChecked = nsPreferences.getBoolPref("wiredmarker.itemview.disp", false);
+				itemview.position = nsPreferences.copyUnicharPref("wiredmarker.itemview.position");
+			}
+			if(itemview.isChecked){
+				if(itemview.position == "tree_right"){
+					document.getElementById("mcMenuItemViewLR").setAttribute("selected","true");
+					document.getElementById("mcMenuItemViewTB").removeAttribute("selected");
+					document.getElementById("mcMenuItemViewNONE").removeAttribute("selected");
+				}else{
+					document.getElementById("mcMenuItemViewLR").removeAttribute("selected");
+					document.getElementById("mcMenuItemViewTB").setAttribute("selected","true");
+					document.getElementById("mcMenuItemViewNONE").removeAttribute("selected");
+				}
+			}else{
+				document.getElementById("mcMenuItemViewLR").removeAttribute("selected");
+				document.getElementById("mcMenuItemViewTB").removeAttribute("selected");
+				document.getElementById("mcMenuItemViewNONE").setAttribute("selected","true");
+			}
+		}
+
+		function _menuCommand(aEvent){
+			nsPreferences.setUnicharPref("wiredmarker.menu.position", aEvent.target.value);
+		}
+
+		function _concordanceCommand(aEvent){
+			nsPreferences.setUnicharPref("wiredmarker.concordance", aEvent.target.value);
+		}
+
+		function _itemviewCommand(aEvent){
+			var val = document.getElementById("mcMenuItemView").value;
+			if(val == "ItemView_LR"){
+				nsPreferences.setBoolPref("wiredmarker.itemview.disp", true);
+				nsPreferences.setUnicharPref("wiredmarker.itemview.position", "tree_right");
+			}else if(val == "ItemView_TB"){
+				nsPreferences.setBoolPref("wiredmarker.itemview.disp", true);
+				nsPreferences.setUnicharPref("wiredmarker.itemview.position", "tree_bottom");
+			}else if(val == "ItemView_NONE"){
+				nsPreferences.setBoolPref("wiredmarker.itemview.disp", false);
+			}
+			try{
+				if(mcSettingService){
+					if(itemview.isChecked == nsPreferences.getBoolPref("wiredmarker.itemview.disp") &&
+						 itemview.position  == nsPreferences.copyUnicharPref("wiredmarker.itemview.position")){
+						mcSettingService.rebootFlag = false;
+					}else{
+						mcSettingService.rebootFlag = true;
+					}
+				}
+			}catch(e){}
+		}
+
+		function _menuSetPos(aEvent){
+		}
+
+		window.addEventListener("load", _menuMainInit, false);
+	]]>
+	</script>
+	<tabbox id="mcSettingTabbox">
+		<tabs id="mcSettingTabs">
+			<tab id="mcMenuTab" label="&markingcollection.general;" image="chrome://markingcollection/skin/icon_option.gif"/>
+		</tabs>
+		<tabpanels id="mcSettingTabPanels">
+			<tabbox id="mcMenuTabbox">
+				<tabs id="mcMenuTabs">
+					<tab label="&markingcollection.setting.view;" image="chrome://markingcollection/skin/view.png"/>
+				</tabs>
+				<tabpanels id="mcMenuTabPanels">
+					<tabpanel id="mcMenuTabPanel" orient="vertical" flex="1">
+						<groupbox>
+							<caption label="&markingcollection.menu.caption;" style="background-color:#fff;"/>
+							<checkbox id="mcMenuDispTopMenu" label="&markingcollection.menu.disptopmenu;" oncommand="_menuCommand(event)" hidden="true"/>
+							<radiogroup oncommand="_menuCommand(event);" orient="horizontal">
+								<radio id="mcMenuDispMenuApp"       label="&markingcollection.menu.appmenu;"   value="appmenu"/>
+								<radio id="mcMenuDispMenuTop"       label="&markingcollection.menu.topmenu;"   value="topmenu"/>
+								<radio id="mcMenuDispMenuBookmarks" label="&markingcollection.menu.bookmarks;" value="bookmarks"/>
+								<radio id="mcMenuDispMenuTools"     label="&markingcollection.menu.tools;"     value="tools"/>
+							</radiogroup>
+						</groupbox>
+						<groupbox>
+							<caption label="&markingcollection.concordance;" style="background-color:#fff;"/>
+							<radiogroup  id="mcMenuConcordance" oncommand="_concordanceCommand(event);" orient="horizontal">
+								<radio id="mcMenuConcordanceSidebar" label="&markingcollection.concordance.sidebar;" value=""/>
+								<radio id="mcMenuConcordanceDisplay" label="&markingcollection.concordance.display;" value="display"/>
+								<radio id="mcMenuConcordanceNone"    label="&markingcollection.concordance.none;"    value="none"/>
+							</radiogroup>
+						</groupbox>
+						<hbox id="mcMenuTabPanelRow3" flex="1" align="start">
+							<groupbox id="mcMenuItemViewGroup" flex="1">
+								<caption label="&markingcollection.display.style;" style="background-color:#fff;"/>
+								<label value="&markingcollection.display.itemview;"/>
+								<radiogroup id="mcMenuItemView" oncommand="_itemviewCommand(event)" style="padding-left:1em;">
+									<radio id="mcMenuItemViewLR"   value="ItemView_LR"   label="&markingcollection.display.itemview.lr;"/>
+									<radio id="mcMenuItemViewTB"   value="ItemView_TB"   label="&markingcollection.display.itemview.tb;"/>
+									<radio id="mcMenuItemViewNONE" value="ItemView_NONE" label="&markingcollection.display.itemview.none;"/>
+								</radiogroup>
+							</groupbox>
+							<groupbox id="mcMenuContextmenuGroup" flex="1">
+								<caption label="&markingcollection.contextmenu.type;" style="background-color:#fff;"/>
+								<vbox id="mcMenuContextmenuVBox"/>
+							</groupbox>
+						</hbox>
+					</tabpanel>
+				</tabpanels>
+			</tabbox>
+		</tabpanels>
+	</tabbox>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/menufavoritefolder.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/menufavoritefolder.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/menufavoritefolder.js	(revision 5703)
@@ -0,0 +1,320 @@
+var bitsFavoriteFolder = {
+	_xmlfile : null,
+	_xmldoc  : null,
+
+	get idMENU()        { return "bitsFavoriteFolderMenu"; },
+	get idMENU_ALL()    { return "bitsFavoriteFolderAllMenuitem"; },
+	get idMENU_SELECT(){ return "bitsFavoriteFolderSelectMenuitem"; },
+
+	get idCMENU()       { return "bitsFavoriteFolderContextmenu"; },
+
+	get MENU()          { return document.getElementById(this.idMENU); },
+	get MENU_ALL()      { return document.getElementById(this.idMENU_ALL); },
+
+	get CMENU()         { return document.getElementById(this.idCMENU); },
+
+	get TITLE()         { return window.top.document.getElementById("sidebar-title"); },
+
+	get STRING()     { return window.top.document.getElementById("MarkingCollectionOverlayString"); },
+	get DataSource(){ return window.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.top.bitsObjectMng.Database;   },
+	get gBrowser()   { return window.top.bitsObjectMng.getBrowser();},
+
+	get xmldoc()     { return this._xmldoc; },
+	get xmlurl()     { return (this._xmlfile?this.Common.convertFilePathToURL(this._xmlfile.path):""); },
+
+	get confirmDelete(){ return true; },
+
+	baseURL  : "",
+	shouldRebuild : false,
+
+	init : function(){
+		var extensionDir = this.Common.getExtensionDir().clone();
+		if(extensionDir){
+			this._xmlfile = extensionDir.clone();
+			this._xmlfile.append("favoritefolder.xml");
+			if(!this._xmlfile.exists()){
+				var aContent = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
+				aContent += '<!DOCTYPE folders>\n<folders/>\n';
+				this.Common.writeFile(this._xmlfile,aContent,"UTF-8");
+			}
+			function _loadXMLDocument(pUri){
+				if(pUri == undefined) return undefined;
+				var xmlDocument = window.top.bitsMarkingCollection.loadXMLDocument(pUri);
+				if(xmlDocument){
+					return xmlDocument;
+				}else{
+					return undefined;
+				}
+			}
+			function _createXMLDocument(aXMLFile){
+				if(!aXMLFile) return undefined;
+				try{
+					return _loadXMLDocument(bitsFavoriteFolder.Common.IO.newFileURI(aXMLFile).spec);
+				}catch(ex){
+					bitsFavoriteFolder._dump("bitsFavoriteFolder._createXMLDocument():"+ ex);
+					return undefined;
+				}
+			}
+			this._xmldoc = _createXMLDocument(this._xmlfile);
+		}
+		this.MENU.setAttribute("datasources",this.xmlurl);
+
+	},
+
+	done : function(){},
+
+	rebuild : function(){},
+
+	xmlflash : function(){
+		var s = new XMLSerializer();
+		var xml = s.serializeToString(this.xmldoc);
+		this.Common.writeFile(this._xmlfile, xml+"\n","UTF-8");
+
+		this.MENU.removeAttribute("datasources");
+		setTimeout(function(){bitsFavoriteFolder.MENU.setAttribute("datasources",bitsFavoriteFolder.xmlurl);},0);
+
+		var contentWindow;
+		var mcTreeFavoriteFolder;
+		if(bitsMarkingCollection._contentWindow) contentWindow = bitsMarkingCollection._contentWindow;
+		if(contentWindow && contentWindow.mcTreeFavoriteFolder) mcTreeFavoriteFolder = contentWindow.mcTreeFavoriteFolder;
+
+		if(mcTreeFavoriteFolder){
+			mcTreeFavoriteFolder.MENU.removeAttribute("datasources");
+			setTimeout(function(){mcTreeFavoriteFolder.MENU.setAttribute("datasources",bitsFavoriteFolder.xmlurl);},0);
+		}
+	},
+
+	AddFavoriteFolder : function(aFolder){
+		var results = this.XPath.evaluateArray('//folder[@fid="'+aFolder.fid+'" and @dbtype="'+aFolder.dbtype+'"]',this.xmldoc);
+		if(results.length){
+			if(!this.Common.confirm(this.STRING.getString("CONFIRM_REGISTERED_FAVORITE_FOLDER"))) return;
+		}
+
+		if(this.xmldoc){
+			var node = this.xmldoc.createElement("folder");
+			node.setAttribute("title",aFolder.title);
+			node.setAttribute("dbtype",aFolder.dbtype);
+			node.setAttribute("fid",aFolder.fid);
+			this.xmldoc.documentElement.appendChild(node);
+
+			this.xmlflash();
+
+		}
+	},
+
+	onPopupShowing : function(aEvent, aPopupRoot){
+		var r_fid = nsPreferences.copyUnicharPref("wiredmarker.rootfolder");
+		var r_dbtype = nsPreferences.copyUnicharPref("wiredmarker.rootfolder_dbtype");
+		if(!r_fid || !r_dbtype){
+			this.MENU_ALL.setAttribute("disabled","true");
+		}else{
+			this.MENU_ALL.removeAttribute("disabled");
+		}
+
+		var results = this.XPath.evaluateArray('//folder[@fid and @dbtype]',this.xmldoc);
+		if(results.length){
+			var osString = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS;
+			var parser = new DOMParser();
+			var i;
+			for(i=0;i<results.length;i++){
+				try{
+					var attr = results[i].attributes;
+					var j;
+					if(osString != "Darwin"){
+						var elemMenuitem = top.document.createElement("menuitem");
+						for(j=0;j<attr.length;j++){
+							elemMenuitem.setAttribute(attr[j].name,attr[j].value);
+						}
+						elemMenuitem.setAttribute("label",results[i].getAttribute("title"));
+						elemMenuitem.setAttribute("contextmenu","bitsFavoriteFolderContextmenu");
+						elemMenuitem.setAttribute("class","menuitem-iconic");
+						elemMenuitem.setAttribute("image","chrome://markingcollection/skin/folder.png");
+						var folders = this.Database.getFolderFormID(results[i].getAttribute("fid"),results[i].getAttribute("dbtype"));
+						if(folders && folders[0].fid_property){
+							var xmldoc = parser.parseFromString(folders[0].fid_property, "text/xml");
+							if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+							if(xmldoc){
+								var elems = xmldoc.getElementsByTagName("ICON");
+								if(elems && elems.length>0) elemMenuitem.setAttribute("image",elems[0].textContent);
+								elems = undefined;
+								xmldoc = undefined;
+							}
+						}
+						aPopupRoot.appendChild(elemMenuitem);
+					}else{
+						var elemMenu = top.document.createElement("menu");
+						for(j=0;j<attr.length;j++){
+							elemMenu.setAttribute(attr[j].name,attr[j].value);
+						}
+						elemMenu.setAttribute("label",results[i].getAttribute("title"));
+						elemMenu.setAttribute("class","menu-iconic");
+						elemMenu.setAttribute("image","chrome://markingcollection/skin/folder.png");
+						var folders = this.Database.getFolderFormID(results[i].getAttribute("fid"),results[i].getAttribute("dbtype"));
+						if(folders && folders[0].fid_property){
+							var xmldoc = parser.parseFromString(folders[0].fid_property, "text/xml");
+							if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+							if(xmldoc){
+								var elems = xmldoc.getElementsByTagName("ICON");
+								if(elems && elems.length>0) elemMenu.setAttribute("image",elems[0].textContent);
+								elems = undefined;
+								xmldoc = undefined;
+							}
+						}
+						var elemMenupopup = top.document.createElement("menupopup");
+						elemMenu.appendChild(elemMenupopup);
+						elemMenupopup.addEventListener("popupshowing", function(aEvent){aEvent.stopPropagation();}, false);
+						elemMenupopup.addEventListener("popuphiding", function(aEvent){aEvent.stopPropagation();}, false);
+						var elemMenuitemSel = top.document.createElement("menuitem");
+						elemMenuitemSel.setAttribute("label",this.STRING.getString("FAVORITEFOLDER_SELECT"));
+						for(j=0;j<attr.length;j++){
+							elemMenuitemSel.setAttribute(attr[j].name,attr[j].value);
+						}
+						elemMenuitemSel.setAttribute("class","menuitem-iconic");
+						elemMenuitemSel.setAttribute("image","chrome://markingcollection/skin/folder.png");
+						var folders = this.Database.getFolderFormID(results[i].getAttribute("fid"),results[i].getAttribute("dbtype"));
+						if(folders && folders[0].fid_property){
+							var xmldoc = parser.parseFromString(folders[0].fid_property, "text/xml");
+							if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+							if(xmldoc){
+								var elems = xmldoc.getElementsByTagName("ICON");
+								if(elems && elems.length>0) elemMenuitemSel.setAttribute("image",elems[0].textContent);
+								elems = undefined;
+								xmldoc = undefined;
+							}
+						}
+						elemMenupopup.appendChild(elemMenuitemSel);
+						var elemMenuitemDel = top.document.createElement("menuitem");
+						elemMenuitemDel.setAttribute("label",this.STRING.getString("FAVORITEFOLDER_DELETE"));
+						for(j=0;j<attr.length;j++){
+							elemMenuitemDel.setAttribute(attr[j].name,attr[j].value);
+						}
+						elemMenuitemDel.setAttribute("class","menuitem-iconic");
+						elemMenuitemDel.setAttribute("image","chrome://markingcollection/skin/menu_remove.png");
+						var folders = this.Database.getFolderFormID(results[i].getAttribute("fid"),results[i].getAttribute("dbtype"));
+						if(folders && folders[0].fid_property){
+							var xmldoc = parser.parseFromString(folders[0].fid_property, "text/xml");
+							if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+							if(xmldoc){
+								var elems = xmldoc.getElementsByTagName("ICON");
+								if(elems && elems.length>0) elemMenuitemDel.setAttribute("image",elems[0].textContent);
+								elems = undefined;
+								xmldoc = undefined;
+							}
+						}
+						elemMenuitemDel.addEventListener("command", function(aEvent){
+							aEvent.stopPropagation();
+							bitsFavoriteFolder._explicitOriginalTarget = aEvent.target;
+							bitsFavoriteFolder.removeFavoriteFolder(aEvent);
+						}, false);
+						elemMenupopup.appendChild(elemMenuitemDel);
+						aPopupRoot.appendChild(elemMenu);
+					}
+				}catch(e){}
+			}
+			parser = undefined;
+		}
+
+	},
+
+	onPopupHiding : function(aEvent, aPopupRoot){
+		setTimeout(function(){
+				var i;
+				for(i=aPopupRoot.childNodes.length-1;i>=0;i--){
+					if(aPopupRoot.childNodes[i].id == "bitsFavoriteFolderAllMenuseparator") break;
+					aPopupRoot.removeChild(aPopupRoot.childNodes[i]);
+				}
+			},0);
+
+	},
+
+	onClick : function(aEvent){
+		var contentWindow;
+		var mcTreeHandler;
+		var mcItemView;
+		var mcTreeViewModeService;
+
+		if(bitsMarkingCollection._contentWindow) contentWindow = bitsMarkingCollection._contentWindow;
+		if(contentWindow && contentWindow.mcTreeHandler) mcTreeHandler = contentWindow.mcTreeHandler;
+		if(contentWindow && contentWindow.mcItemView) mcItemView = contentWindow.mcItemView;
+		if(contentWindow && contentWindow.mcTreeViewModeService) mcTreeViewModeService = contentWindow.mcTreeViewModeService;
+
+
+		if(aEvent.target.id == bitsFavoriteFolder.idMENU_ALL){
+			this.Common.PREF.clearUserPref("wiredmarker.rootfolder");
+			this.Common.PREF.clearUserPref("wiredmarker.rootfolder_dbtype");
+			if(mcTreeViewModeService) mcTreeViewModeService.rebuild();
+			return;
+
+		}else if(aEvent.target.id == bitsFavoriteFolder.idMENU_SELECT){
+			try{var res = mcTreeHandler.resource;}catch(e){}
+			if(!res) return;
+
+			var fid = this.DataSource.getProperty(res, "id");
+			var dbtype = this.DataSource.getProperty(res, "dbtype");
+			var title = this.DataSource.getProperty(res, "title");
+
+			this.AddFavoriteFolder({fid:fid,dbtype:dbtype,title:title});
+
+
+
+		}else{
+			var fid = aEvent.target.getAttribute("fid");
+			var dbtype = aEvent.target.getAttribute("dbtype");
+
+			nsPreferences.setUnicharPref("wiredmarker.rootfolder", fid);
+			nsPreferences.setUnicharPref("wiredmarker.rootfolder_dbtype", dbtype);
+			if(mcTreeViewModeService) mcTreeViewModeService.rebuild();
+			return;
+
+		}
+		aEvent.stopPropagation();
+	},
+
+	onPopupFShowing : function(aEvent){
+		if(aEvent.explicitOriginalTarget.id == this.idMENU_ALL){
+			setTimeout(function(){aEvent.target.hidePopup();},0);
+			return;
+		}
+
+		this._explicitOriginalTarget = aEvent.explicitOriginalTarget;
+
+	},
+
+	_confirmRemovingFor : function(){
+		try{
+			if(this.confirmDelete){
+				return this.Common.confirm( this.STRING.getString("CONFIRM_DELETE") );
+			}
+			return true;
+		}catch(e){
+			return false;
+		}
+	},
+
+	removeFavoriteFolder : function(aEvent){
+		if(!this.xmldoc || !this._explicitOriginalTarget) return;
+		if(!this._confirmRemovingFor()) return;
+
+		var fid = this._explicitOriginalTarget.getAttribute("fid");
+		var dbtype = this._explicitOriginalTarget.getAttribute("dbtype");
+
+		var results = this.XPath.evaluateArray('//folder[@fid="'+fid+'" and @dbtype="'+dbtype+'"]',this.xmldoc);
+		if(results.length){
+			var i;
+			for(i=results.length-1;i>=0;i--){
+				results[i].parentNode.removeChild(results[i]);
+			}
+			this.xmlflash();
+		}
+		this._explicitOriginalTarget = undefined;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+};
+
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/menutree.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/menutree.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/menutree.js	(revision 5703)
@@ -0,0 +1,489 @@
+// ã¡ãã¥ãŒçšéå±€è¡šç€º
+var bitsMenuTree = {
+
+	_app_version : 0,
+
+	get STRING()     { return window.top.document.getElementById("MarkingCollectionOverlayString"); },
+	get DataSource() { return window.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.top.bitsObjectMng.Database;   },
+	get gBrowser()   { return window.top.bitsObjectMng.getBrowser();},
+
+	get SIDEBAR() { return window.top.document.getElementById("sidebar"); },
+	get SIDEBAR_DOC() {try{return this.SIDEBAR.contentDocument;}catch(e){return undefined;}},
+	get SIDEBAR_WIN() {try{return this.SIDEBAR.contentWindow;}catch(e){return undefined;}},
+	get mcTreeHandler() {try{return this.SIDEBAR_WIN.mcTreeHandler;}catch(e){return undefined;}},
+	get mcMainService() {try{return this.SIDEBAR_WIN.mcMainService;}catch(e){return undefined;}},
+	get mcController() {try{return this.SIDEBAR_WIN.mcController;}catch(e){return undefined;}},
+	get mcPropertyView() {try{return this.SIDEBAR_WIN.mcPropertyView;}catch(e){return undefined;}},
+	get mcTreeViewModeService() {try{return this.SIDEBAR_WIN.mcTreeViewModeService;}catch(e){return undefined;}},
+	get bitsItemView() {try{return this.SIDEBAR_WIN.bitsItemView;}catch(e){return undefined;}},
+
+	get _id_extensionsMenupopup() { return "bitsExtensionsMenuPopup"; },
+	get _id_favoritefolderMenuseparator() { return "bitsFavoriteFolderMenuseparator"; },
+	get _id_menutreeFolderContextmenu() { return "bitsMenuTreeFolderContextmenu"; },
+	get _id_menutreeObjectContextmenu() { return "bitsMenuTreeObjectContextmenu"; },
+	get _extensionsMenupopup()    { return window.top.document.getElementById(this._id_extensionsMenupopup); },
+
+	get idMENU_FOLDER_ADD_FAVORITE(){ return "bitsFavoriteFolderAddMenuitem"; },
+	get idMENU_FOLDER_REMOVE()      { return "bitsMenuTreeFolderRemoveMenuitem"; },
+	get idMENU_FOLDER_PROPERTY()    { return "bitsMenuTreeFolderPropertyMenuitem"; },
+
+	get MENU_FOLDER_ADD_FAVORITE(){ return document.getElementById(this.idMENU_FOLDER_ADD_FAVORITE); },
+	get MENU_FOLDER_REMOVE()      { return document.getElementById(this.idMENU_FOLDER_REMOVE); },
+	get MENU_FOLDER_PROPERTY()    { return document.getElementById(this.idMENU_FOLDER_PROPERTY); },
+
+	get idMENU_OBJECT_OPEN()    { return "bitsMenuTreeObjectOpenMenuitem"; },
+	get idMENU_OBJECT_OPENN()   { return "bitsMenuTreeObjectOpenNewTabMenuitem"; },
+	get idMENU_OBJECT_REMOVE()  { return "bitsMenuTreeObjectRemoveMenuitem"; },
+	get idMENU_OBJECT_PROPERTY(){ return "bitsMenuTreeObjectPropertyMenuitem"; },
+
+	get MENU_OBJECT_OPEN()    { return document.getElementById(this.idMENU_OBJECT_OPEN); },
+	get MENU_OBJECT_OPENN()   { return document.getElementById(this.idMENU_OBJECT_OPENN); },
+	get MENU_OBJECT_REMOVE()  { return document.getElementById(this.idMENU_OBJECT_REMOVE); },
+	get MENU_OBJECT_PROPERTY(){ return document.getElementById(this.idMENU_OBJECT_PROPERTY); },
+
+	get POPUP(){ return document.getElementById(this._id_menutreeObjectContextmenu); },
+
+	get confirmDelete() { return true; },
+
+/////////////////////////////////////////////////////////////////////
+	init : function(){
+		var info = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
+		this._app_version = parseInt(info.version);
+	},
+
+/////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////
+	done : function(){
+	},
+
+/////////////////////////////////////////////////////////////////////
+	popupshowing : function(event){
+		try{
+			if(!event.target.nodeName || event.target.nodeName != "menupopup") return;
+			var elemMenupopup = event.target;
+			var p_fid = elemMenupopup.getAttribute("fid");
+			var p_dbtype = elemMenupopup.getAttribute("dbtype");
+			if(!p_fid || !p_dbtype){
+				p_fid = nsPreferences.copyUnicharPref("wiredmarker.rootfolder");
+				p_dbtype = nsPreferences.copyUnicharPref("wiredmarker.rootfolder_dbtype");
+			}
+			if(elemMenupopup.id == bitsMenuTree._id_extensionsMenupopup && (!p_fid || !p_dbtype)){
+				var dbinfo = window.top.bitsMarkingCollection.dbinfo.getAllDBInfo();
+				if(dbinfo){
+					if(dbinfo.length > 1){
+						var i;
+						for(i=0;i<dbinfo.length;i++){
+							bitsMenuTree._popupshowingIndexContextMenu(
+								elemMenupopup,
+								[
+									{
+										fid       : "0",
+										dbtype    : dbinfo[i].database_dbtype,
+										fid_title : dbinfo[i].database_title,
+										icon      : dbinfo[i].database_icon,
+									}
+								]);
+						}
+						return;
+					}else{
+						p_fid = "0";
+						p_dbtype = dbinfo[0].database_dbtype;
+					}
+				}
+			}
+			if(!elemMenupopup.id || elemMenupopup.id == bitsMenuTree._id_extensionsMenupopup){
+				var foldres = bitsMenuTree.Database.getFolderFormPID(p_fid,p_dbtype);
+				if(foldres){
+					foldres.sort(function(a,b){ return a.pfid_order - b.pfid_order; });
+				}else{
+					foldres = [];
+				}
+				var objects = bitsMenuTree.Database.getObjectFormPID(p_fid,p_dbtype);
+				if(objects){
+					objects.sort(function(a,b){ return a.pfid_order - b.pfid_order; });
+				}else{
+					objects = [];
+				}
+				bitsMenuTree._popupshowingIndexContextMenu(elemMenupopup,[].concat(foldres,objects));
+			}
+		}catch(e){
+			bitsMenuTree._dump("bitsMenuTree.popupshowing():"+e);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_removeChild : function(aNode){
+		var i;
+		for(i=aNode.childNodes.length-1;i>=0;i--){
+			this._removeChild(aNode.childNodes[i]);
+			aNode.removeChild(aNode.childNodes[i]);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	popuphiding : function(event){
+		if(!event.target.nodeName || event.target.nodeName != "menupopup") return;
+		var elemMenupopup = event.target;
+		setTimeout(function(){
+			var i;
+			if(elemMenupopup.id == bitsMenuTree._id_extensionsMenupopup){
+				for(i=elemMenupopup.childNodes.length-1;i>=0;i--){
+					if(elemMenupopup.childNodes[i].id == bitsMenuTree._id_favoritefolderMenuseparator) break;
+					bitsMenuTree._removeChild(elemMenupopup.childNodes[i]);
+					elemMenupopup.removeChild(elemMenupopup.childNodes[i]);
+				}
+			}else if(!elemMenupopup.id){
+				for(i=elemMenupopup.childNodes.length-1;i>=0;i--){
+					bitsMenuTree._removeChild(elemMenupopup.childNodes[i]);
+					elemMenupopup.removeChild(elemMenupopup.childNodes[i]);
+				}
+			}
+		},0);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onMousedown : function(aEvent){
+		if(bitsMenuTree._app_version<=2) return;
+		bitsImageTooltip.onMousedown(aEvent);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onMousemove : function(aEvent){
+		if(bitsMenuTree._app_version<=2) return;
+		var param = {
+			menuitem : aEvent.target
+		};
+		try {
+			var oid = param.menuitem.getAttribute("oid");
+			var dbtype = param.menuitem.getAttribute("dbtype");
+			if(!oid || !dbtype) return;
+			var objs = bitsMenuTree.Database.getObject({oid:oid},dbtype);
+			if(objs && objs.length>0) param.obj = objs[0];
+		}catch(e){}
+
+		bitsImageTooltip.onMousemove(aEvent,param);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onMouseout : function(aEvent){
+		if(bitsMenuTree._app_version<=2) return;
+		bitsImageTooltip.onMouseout(aEvent);
+	},
+
+/////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////
+	commandIndexContextMenu : function(event){},
+
+/////////////////////////////////////////////////////////////////////
+	_popupshowingIndexContextMenu : function(elemMenupopup,foldres){
+		if(!foldres || foldres.length==0){
+			if(elemMenupopup.id != this._id_extensionsMenupopup) elemMenupopup.parentNode.removeChild(elemMenupopup);
+			return;
+		}
+		var parser = new DOMParser();
+		if(foldres && foldres.length>0){
+			var j;
+			for(j=0;j<foldres.length;j++){
+				if(!foldres[j]) continue;
+				if(foldres[j].fid && foldres[j].dbtype){
+					if(!foldres[j].fid_title) continue;
+					var tmp_foldres = bitsMenuTree.Database.getFolderFormPID(foldres[j].fid,foldres[j].dbtype);
+					if(!tmp_foldres) tmp_foldres = [];
+					if(tmp_foldres.length == 0){
+						var tmp_objects = bitsMenuTree.Database.getObjectFormPID(foldres[j].fid,foldres[j].dbtype);
+						if(!tmp_objects) tmp_objects = [];
+						tmp_foldres = tmp_foldres.concat(tmp_objects);
+					}
+					var elemMenuSub = top.document.createElement("menu");
+					if(!elemMenuSub) continue;
+					var key;
+					for(key in foldres[j]){
+						elemMenuSub.setAttribute(key,foldres[j][key]);
+					}
+					elemMenuSub.setAttribute("label",foldres[j].fid_title);
+					elemMenuSub.setAttribute("class","menu-iconic");
+					elemMenuSub.setAttribute("image","chrome://markingcollection/skin/folder.png");
+					if(foldres[j].fid != "0") elemMenuSub.setAttribute("contextmenu",this._id_menutreeFolderContextmenu);
+					if(foldres[j].icon){
+						elemMenuSub.setAttribute("image",foldres[j].icon);
+					}else if(foldres[j].fid_property){
+						var xmldoc = parser.parseFromString(foldres[j].fid_property, "text/xml");
+						if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+						if(xmldoc){
+							var elems = xmldoc.getElementsByTagName("ICON");
+							if(elems && elems.length>0) elemMenuSub.setAttribute("image",elems[0].textContent);
+							elems = undefined;
+							xmldoc = undefined;
+						}
+					}
+					if(tmp_foldres.length==0) elemMenuSub.setAttribute("disabled","true");
+					var elemMenuSubpopup = top.document.createElement("menupopup");
+					if(elemMenuSubpopup){
+						for(var key in foldres[j]){
+							elemMenuSubpopup.setAttribute(key,foldres[j][key]);
+						}
+						elemMenuSub.appendChild(elemMenuSubpopup);
+					}
+					elemMenupopup.appendChild(elemMenuSub);
+				}else{
+					var elemMenuitem = top.document.createElement("menuitem");
+					if(!elemMenuitem) continue;
+					this._setMenuitemObjectAttribute(elemMenuitem,foldres[j]);
+					elemMenuitem.setAttribute("contextmenu",this._id_menutreeObjectContextmenu);
+					elemMenuitem.addEventListener("command",bitsMenuTree.onCommand,false);
+					elemMenupopup.appendChild(elemMenuitem);
+				}
+			}
+		}
+		parser = undefined;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_setMenuitemObjectAttribute : function(aMenuitem,aObject){
+		for(var key in aObject){
+			aMenuitem.setAttribute(key,aObject[key]);
+		}
+		aMenuitem.setAttribute("label",aObject.oid_title);
+		aMenuitem.setAttribute("class","menuitem-iconic");
+		aMenuitem.addEventListener("mousedown",bitsMenuTree.onMousedown,false);
+		aMenuitem.addEventListener("mousemove",bitsMenuTree.onMousemove,false);
+		aMenuitem.addEventListener("mouseout" ,bitsMenuTree.onMouseout,false);
+		var icon = null;
+		if(aObject.oid_type.match(/^image\/(.+)$/)){
+			if(this._app_version>2){
+				var blobFile = this.Database.getObjectBLOBFile(aObject.oid,aObject.dbtype);
+				if(blobFile.exists()){
+					if(blobFile.fileSize>0){
+						var url = this.Common.convertFilePathToURL(blobFile.path);
+						if(url) icon = url;
+					}else if(aObject.oid_txt){
+						if(this.Common.getImageFromURL(aObject.oid_txt, blobFile)){
+							if(blobFile.exists() && blobFile.fileSize>0){
+								var url = this.Common.convertFilePathToURL(blobFile.path);
+								if(url) icon = url;
+							}
+						}
+					}
+				}
+			}
+		}else if(aObject.oid_type == "url"){
+			icon = this.Database.getFavicon(aObject.oid_txt,aObject.dbtype);
+			if(!icon) icon = this.Database.getFavicon(aObject.doc_url,aObject.dbtype);
+		}else{
+			var xmldoc;
+			if(xmldoc){
+				var xmlnode = xmldoc.getElementsByTagName("ICON")[0];
+				if(xmlnode) icon = xmlnode.textContent;
+			}else if(aObject.oid_property.match(/^.*<ICON>(.+?)<\/ICON>.*$/m)){
+				icon = RegExp.$1;
+			}
+			if(icon && icon != ""){
+				var url = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURL);
+				url.spec = icon;
+				if(url.scheme == "file"){
+					var file = this.Common.convertURLToFile(icon)
+					if(!file.exists()) icon = undefined;
+				}else if(url.scheme == "chrome"){
+					var val = this.existsIcon(url);
+					if(!val) icon = undefined;
+				}
+			}
+		}
+		if(!icon) icon = this.Database.getFavicon(aObject.doc_url,aObject.dbtype);
+		if(!icon){
+			if(aObject.oid_type.match(/^image\//)){
+				icon = "chrome://markingcollection/skin/image.png";
+			}else{
+				icon = "chrome://markingcollection/skin/defaultFavicon.png";
+			}
+		}
+		aMenuitem.setAttribute("image",icon);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onPopupFShowing : function(aEvent){
+		if(aEvent.target.id != this._id_menutreeFolderContextmenu && aEvent.target.id != this._id_menutreeObjectContextmenu) return;
+		this._explicitOriginalTarget = aEvent.explicitOriginalTarget;
+	},
+
+	onPopupCommand : function(aEvent){
+		switch(aEvent.target.id){
+			case this.idMENU_OBJECT_OPEN:
+				this.open();
+				break;
+			case this.idMENU_OBJECT_OPENN:
+				this.open(true);
+				break;
+			case this.idMENU_FOLDER_REMOVE:
+			case this.idMENU_OBJECT_REMOVE:
+				this.remove(aEvent);
+				break;
+			case this.idMENU_OBJECT_PROPERTY:
+				this.property();
+				break;
+			case this.idMENU_FOLDER_ADD_FAVORITE:
+				var target = this._explicitOriginalTarget;
+				if(target){
+					var fid = target.getAttribute("fid");
+					var dbtype = target.getAttribute("dbtype");
+					var title = target.getAttribute("fid_title");
+					bitsFavoriteFolder.AddFavoriteFolder({fid:fid,dbtype:dbtype,title:title});
+				}
+				break;
+			case this.idMENU_FOLDER_PROPERTY:
+				break;
+			default:
+				this._explicitOriginalTarget = null;
+				break;
+		}
+	},
+
+	onCommand : function(aEvent){
+		bitsMenuTree._explicitOriginalTarget = aEvent.target;
+		bitsMenuTree.open();
+	},
+
+/////////////////////////////////////////////////////////////////////
+// TREE é¢é£
+/////////////////////////////////////////////////////////////////////
+	open : function(tabbed){
+		if(!this._explicitOriginalTarget) return;
+		var target = this._explicitOriginalTarget;
+		var aObject = {};
+		aObject.oid = target.getAttribute("oid");
+		aObject.dbtype = target.getAttribute("dbtype");
+		aObject.fid_style = target.getAttribute("fid_style");
+		aObject.doc_url = target.getAttribute("doc_url");
+		aObject.oid_type = target.getAttribute("oid_type");
+
+		aObject = this.Database.getObject({oid:aObject.oid}, aObject.dbtype);
+		if(aObject && aObject.length){
+			aObject = aObject[0];
+			aObject.dbtype = target.getAttribute("dbtype");
+		}else{
+			return;
+		}
+		this.Common.loadFromObject(aObject,tabbed);
+	},
+
+	_confirmRemovingFor : function(){
+		try{
+			if(this.confirmDelete){
+				return this.Common.confirm( this.STRING.getString("CONFIRM_DELETE") );
+			}
+			return true;
+		}catch(e){
+			return false;
+		}
+	},
+
+	getSelection : function(){
+		var ret = [];
+		var rc;
+		var i;
+		for(rc=0;rc<this.TREE.view.selection.getRangeCount();rc++){
+			var start = {}, end = {};
+			this.TREE.view.selection.getRangeAt(rc, start, end);
+			for(i=start.value;i<= end.value;i++){
+				if(!this.TREE.view.selection.isSelected(i)) continue;
+				ret.push(i);
+			}
+		}
+		return ret;
+	},
+
+	validateMultipleSelection : function(aIdxList){
+		if(aIdxList.length != this.TREE.view.selection.count){
+			this.Common.alert(this.STRING.getString("ERROR_MULTIPLE_SELECTION"));
+			return false;
+		}
+		return true;
+	},
+
+	remove : function(aEvent){
+		if(!this._explicitOriginalTarget) return;
+		if(!this._explicitOriginalTarget.hasAttribute("dbtype")) return;
+		if(!this._confirmRemovingFor()) return;
+		if(this._explicitOriginalTarget.hasAttribute("oid")){
+			var aObject = {};
+			var target = this._explicitOriginalTarget;
+			aObject.oid = target.getAttribute("oid");
+			aObject.dbtype = target.getAttribute("dbtype");
+			aObject.pfid = target.getAttribute("pfid");
+			aObject.oid_type = target.getAttribute("oid_type");
+			this._removeObject(aObject);
+		}else if(this._explicitOriginalTarget.hasAttribute("fid")){
+			var aFolder = {};
+			var target = this._explicitOriginalTarget;
+			aFolder.fid = target.getAttribute("fid");
+			aFolder.dbtype = target.getAttribute("dbtype");
+			this._removeFolder(aFolder);
+		}
+		if(this.bitsItemView && this.bitsItemView.isChecked){
+			if(this._explicitOriginalTarget.hasAttribute("fid")){
+				if(this.mcTreeViewModeService) this.mcTreeViewModeService.rebuild();
+				this.bitsItemView.rebuild();
+			}else if(this._explicitOriginalTarget.hasAttribute("oid")){
+				this.bitsItemView.refresh();
+			}
+		}else{
+			if(this.mcTreeViewModeService) this.mcTreeViewModeService.rebuild();
+		}
+		return true;
+	},
+
+	_removeObject : function(aObject){
+		var match_exp = new RegExp("^"+bitsMarker.id_key+".+$","m");
+		var source;
+		if(!aObject.oid_type.match(/^image\/(.+)$/)) source = bitsMarker.id_key+aObject.dbtype+aObject.oid;
+		if(source) bitsMarker.unmarkerWindow(source);
+		this.Database.removeObject({oid:aObject.oid,pfid:aObject.pfid},aObject.dbtype,false);
+	},
+
+	_removeFolder : function(aFolder){
+		var i;
+		var Foldres = this.Database.getFolderFormPID(aFolder.fid,aFolder.dbtype,false);
+		if(Foldres){
+			for(i=0;i<Foldres.length;i++){
+				this._removeFolder(Foldres[i]);
+			}
+		}
+		var Objects = this.Database.getObjectFormPID(aFolder.fid,aFolder.dbtype,false);
+		if(Objects){
+			for(i=0;i<Objects.length;i++){
+				this._removeObject(Objects[i]);
+			}
+		}
+		this.Database.removeFolder(aFolder.fid,aFolder.dbtype,false);
+	},
+
+	property : function(){
+		if(this.TREE.currentIndex<0) return;
+		var row = this.TREE.currentIndex;
+		if(!this.itemObjects[row]) return;
+		var aObject = this.itemObjects[row];
+		var id = aObject.oid;
+		var style = aObject.fid_style;
+		var dbtype = aObject.dbtype;
+		var result = {
+			id       : aObject.oid,
+			title    : aObject.oid_title,
+			property : aObject.oid_property,
+			style    : aObject.fid_style,
+			dbtype   : aObject.dbtype,
+		};
+		window.openDialog("chrome://markingcollection/content/property.xul", "", "chrome,centerscreen,modal", id, result);
+		if(result.accept){
+			this.refresh();
+		}
+		return result.accept;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/mergeDialogOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/mergeDialogOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/mergeDialogOverlay.xul	(revision 5703)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/scrappartymerge.dtd">
+<overlay
+	id="mergeDialogOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/optionsDialog.js" />
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _mergeMainInit(aEvent){
+			setTimeout(function(){ spmOptionsDialog.init(aEvent); },0);
+		}
+		function _mergeMainDone(aEvent){
+			spmOptionsDialog.accept(aEvent);
+		}
+		window.addEventListener("load", _mergeMainInit, false);
+		window.addEventListener("unload", _mergeMainDone, false);
+	]]>
+	</script>
+	<stringbundleset id="spmStringBundles">
+		<stringbundle id="spmOptionsDialogString" src="chrome://markingcollection/locale/scrappartymerge.properties" />
+	</stringbundleset>
+	<tabbox id="mcSettingTabbox">
+		<tabs id="mcSettingTabs">
+			<tab id="mcMergeTab" label="&scrappartymerge.app.title;" image="chrome://markingcollection/skin/merge.png"/>
+		</tabs>
+		<tabpanels id="mcSettingTabPanels">
+			<tabpanel id="mcMergeTabPanel" orient="vertical" flex="1">
+				<groupbox>
+					<caption label="&scrappartymerge.condition;" style="background-color:#fff;"/>
+					<radiogroup  id="spmConditionMarker" oncommand="spmOptionsDialog.commandCondition(event);">
+						<radio id="spmConditionMarkerAll" label="&scrappartymerge.marker.all.label;"   value="&scrappartymerge.marker.all.value;"/>
+						<radio id="spmConditionMarkerSt"  label="&scrappartymerge.marker.start.label;" value="&scrappartymerge.marker.start.value;"/>
+						<radio id="spmConditionMarkerEn"  label="&scrappartymerge.marker.end.label;"   value="&scrappartymerge.marker.end.value;"/>
+					</radiogroup>
+				</groupbox>
+				<groupbox>
+					<caption label="&scrappartymerge.confirm;" style="background-color:#fff;"/>
+					<checkbox id="spmConfirmMerge" label="&scrappartymerge.confirm.merge;" oncommand="spmOptionsDialog.commandConfirm(event);"/>
+				</groupbox>
+			</tabpanel>
+		</tabpanels>
+	</tabbox>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/metaCaptureDialog.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/metaCaptureDialog.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/metaCaptureDialog.js	(revision 5703)
@@ -0,0 +1,653 @@
+var bitsMetaCaptureDialog = {
+
+	_xmlfile : null,
+	_xmldoc  : null,
+	_outtext : null,
+	_oid_property : null,
+	_oid_title : null,
+
+/////////////////////////////////////////////////////////////////////
+// ãã­ããã£
+/////////////////////////////////////////////////////////////////////
+	get DataSource() { return window.opener.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.opener.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.opener.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.opener.top.bitsObjectMng.Database;   },
+	get XML()        { return window.opener.top.bitsObjectMng.XML;        },
+	get gBrowser()   { return window.opener.top.bitsObjectMng.getBrowser();},
+
+	get bitsHyperAnchorDummy() { return window.opener.top.bitsHyperAnchorDummy; },
+
+	get STRING()     { return document.getElementById("bitsMetaCaptureString"); },
+
+	get DIALOG()     { return document.getElementById("bitsMetaCaptureDialog"); },
+
+	get TREE()       { return document.getElementById("bitsMetaCopyTagRxgexpTree"); },
+	get COL_USE()    { return document.getElementById("bitsMetaCopyTagRxgexpTreeUseCol"); },
+	get ADD()        { return document.getElementById("bitsMetaCopyTagRxgexpTreeAdd"); },
+	get DEL()        { return document.getElementById("bitsMetaCopyTagRxgexpTreeDel"); },
+	get CHK_REGEXP_EDIT() { return document.getElementById("bitsMetaCopyTagRxgexpEdit"); },
+
+	get TAG()        { return document.getElementById("bitsMetaCopyTagRxgexpTreeAddTagMenulist"); },
+	get REGEXP()     { return document.getElementById("bitsMetaCopyTagRxgexpTreeAddRxgexpTextbox"); },
+	get FORMAT()     { return document.getElementById("bitsMetaCopyTagRxgexpTreeAddFormatTextbox"); },
+
+	get CHK_HA()     { return document.getElementById("bitsMetaCopyItemHyperAnchor"); },
+	get CHK_TITLE()  { return document.getElementById("bitsMetaCopyItemTitle"); },
+	get CHK_NOTE()   { return document.getElementById("bitsMetaCopyItemNote"); },
+	get CHK_META()   { return document.getElementById("bitsMetaCopyItemMeta"); },
+	get CHK_HASH()   { return document.getElementById("bitsMetaCopyHyperanchorInURLHash"); },
+
+	get CHK_ANCHOR() { return document.getElementById("bitsMetaCopyOutputItemAnchor"); },
+
+	get GRP_HA()     { return document.getElementById("bitsMetaCopyItemHyperAnchorTagGroup"); },
+	get GRP_TITLE()  { return document.getElementById("bitsMetaCopyItemTitleTagGroup"); },
+	get GRP_NOTE()   { return document.getElementById("bitsMetaCopyItemNoteTagGroup"); },
+	get GRP_META()   { return document.getElementById("bitsMetaCopyItemMetaTagGroup"); },
+	get GRP_HASH()   { return document.getElementById("bitsMetaCopyHyperanchorGroupBox"); },
+
+	get TXT_HA()     { return document.getElementById("bitsMetaCopyItemHyperAnchorText"); },
+	get TXT_TITLE()  { return document.getElementById("bitsMetaCopyItemTitleText"); },
+	get TXT_NOTE()   { return document.getElementById("bitsMetaCopyItemNoteText"); },
+	get TXT_META()   { return document.getElementById("bitsMetaCopyItemMetaText"); },
+
+	get SMP_HA()     { return document.getElementById("bitsMetaCopySampleHyperAnchor"); },
+	get SMP_TITLE()  { return document.getElementById("bitsMetaCopySampleTitle"); },
+	get SMP_NOTE()   { return document.getElementById("bitsMetaCopySampleNote"); },
+	get SMP_META()   { return document.getElementById("bitsMetaCopySampleMeta"); },
+
+	get FMT_OUTPUT() { return document.getElementById("bitsMetaCopyOutputFormatTextbox"); },
+	get REG_OUTPUT() { return document.getElementById("bitsMetaCopyOutputRegExpTextbox"); },
+	get REG_I()      { return document.getElementById("bitsMetaCopyOutputRegExpI"); },
+	get REG_G()      { return document.getElementById("bitsMetaCopyOutputRegExpG"); },
+	get REG_M()      { return document.getElementById("bitsMetaCopyOutputRegExpM"); },
+	get REP_OUTPUT() { return document.getElementById("bitsMetaCopyOutputReplaceTextbox"); },
+	get SMP_OUTPUT() { return document.getElementById("bitsMetaOutputSample"); },
+
+	get ROW_PMCID()  { return document.getElementById("bitsMetaCopyItemMedlinePMCIDRow"); },
+	get ROW_PMID()   { return document.getElementById("bitsMetaCopyItemMedlinePMIDRow"); },
+	get ROW_SO()     { return document.getElementById("bitsMetaCopyItemMedlineSORow"); },
+
+	get xmldoc()     { return this._xmldoc; },
+
+/////////////////////////////////////////////////////////////////////
+// ã¡ãœãã
+/////////////////////////////////////////////////////////////////////
+	init : function(aEvent){
+		this._xmldoc = window.arguments[0].xmldoc;
+		this._oid_property = window.arguments[0].oid_property;
+		this._doc_title = window.arguments[0].doc_title;
+		this._oid_title = window.arguments[0].oid_title;
+		this._con_url = window.arguments[0].con_url;
+		this.makeFormatText = window.arguments[0].makeFormatText;
+		var elemNote = this._oid_property.getElementsByTagName("NOTE")[0];
+		if(elemNote){
+			this.CHK_NOTE.removeAttribute("disabled");
+		}
+		var elemMetas = this._oid_property.getElementsByTagName("METACAPTURE");
+		if(elemMetas && elemMetas.length>0 && (elemMetas[0].getAttribute("content") || elemMetas[0].textContent)){
+			this.CHK_META.removeAttribute("disabled");
+			for(var i=0;i<elemMetas.length;i++){
+				this.TAG.appendItem(elemMetas[i].getAttribute("tag"),elemMetas[i].getAttribute("tag"));
+			}
+			this.TAG.selectedIndex = 0;
+		}
+		var elemPMCID = this._oid_property.getElementsByTagName("PMCID")[0];
+		if(elemPMCID){
+			this.ROW_PMCID.removeAttribute("hidden");
+		}else{
+			this.ROW_PMCID.setAttribute("hidden","true");
+		}
+		var elemPMID = this._oid_property.getElementsByTagName("PMID")[0];
+		if(elemPMID){
+			this.ROW_PMID.removeAttribute("hidden");
+		}else{
+			this.ROW_PMID.setAttribute("hidden","true");
+		}
+		var elemSO = this._oid_property.getElementsByTagName("SO")[0];
+		if(elemSO){
+			this.ROW_SO.removeAttribute("hidden");
+		}else{
+			this.ROW_SO.setAttribute("hidden","true");
+		}
+		var copyitems = null;
+		var results = this.XPath.evaluateArray('/METACAPTURE[1]/COPY_ITEMS[1]',this.xmldoc);
+		if(!results || results.length == 0){
+			copyitems = this.xmldoc.createElement("COPY_ITEMS");
+			this.xmldoc.documentElement.appendChild(copyitems);
+		}else{
+			copyitems = results[0];
+		}
+		results = this.XPath.evaluateArray('/METACAPTURE[1]/COPY_ITEMS[1]/COPY_ITEM[@name="hyperanchor"]',this.xmldoc);
+		if(!results || results.length == 0){
+			var copyitem = this.xmldoc.createElement("COPY_ITEM");
+			copyitem.setAttribute("name","hyperanchor");
+			copyitems.appendChild(copyitem);
+			this.GRP_HA.disabled = true;
+			this.GRP_HA.value = "true";
+		}else{
+			this.CHK_HA.checked = (results[0].getAttribute("checked") == "true" ? true : false);
+			this.GRP_HA.disabled = (!this.CHK_HA.disabled && this.CHK_HA.checked ? false : true);
+			this.GRP_HA.value = (results[0].getAttribute("selected") != "" ? results[0].getAttribute("selected") : "true");
+		}
+		results = this.XPath.evaluateArray('/METACAPTURE[1]/COPY_ITEMS[1]/COPY_ITEM[@name="title"]',this.xmldoc);
+		if(!results || results.length == 0){
+			var copyitem = this.xmldoc.createElement("COPY_ITEM");
+			copyitem.setAttribute("name","title");
+			copyitems.appendChild(copyitem);
+			this.GRP_TITLE.disabled = true;
+			this.GRP_TITLE.value = "true";
+		}else{
+			this.CHK_TITLE.checked = (results[0].getAttribute("checked") == "true" ? true : false);
+			this.GRP_TITLE.disabled = (!this.CHK_TITLE.disabled && this.CHK_TITLE.checked ? false : true);
+			this.GRP_TITLE.value = (results[0].getAttribute("selected") != "" ? results[0].getAttribute("selected") : "true");
+		}
+		results = this.XPath.evaluateArray('/METACAPTURE[1]/COPY_ITEMS[1]/COPY_ITEM[@name="note"]',this.xmldoc);
+		if(!results || results.length == 0){
+			var copyitem = this.xmldoc.createElement("COPY_ITEM");
+			copyitem.setAttribute("name","note");
+			copyitems.appendChild(copyitem);
+			this.GRP_NOTE.disabled = true;
+			this.GRP_NOTE.value = "true";
+		}else{
+			this.CHK_NOTE.checked = (results[0].getAttribute("checked") == "true" ? true : false);
+			this.GRP_NOTE.disabled = (!this.CHK_NOTE.disabled && this.CHK_NOTE.checked ? false : true);
+			this.GRP_NOTE.value = (results[0].getAttribute("selected") != "" ? results[0].getAttribute("selected") : "true");
+		}
+		results = this.XPath.evaluateArray('/METACAPTURE[1]/COPY_ITEMS[1]/COPY_ITEM[@name="meta"]',this.xmldoc);
+		if(!results || results.length == 0){
+			var copyitem = this.xmldoc.createElement("COPY_ITEM");
+			copyitem.setAttribute("name","meta");
+			copyitems.appendChild(copyitem);
+			this.GRP_META.disabled = true;
+			this.GRP_META.value = "true";
+		}else{
+			this.CHK_META.checked = (results[0].getAttribute("checked") == "true" ? true : false);
+			this.GRP_META.disabled = (!this.CHK_META.disabled && this.CHK_META.checked ? false : true);
+			this.GRP_META.value = (results[0].getAttribute("selected") != "" ? results[0].getAttribute("selected") : "true");
+		}
+		var outputitems = null;
+		var results = this.XPath.evaluateArray('/METACAPTURE[1]/OUTPUT_ITEMS[1]',this.xmldoc);
+		if(!results || results.length == 0){
+			outputitems = this.xmldoc.createElement("OUTPUT_ITEMS");
+			this.xmldoc.documentElement.appendChild(outputitems);
+		}else{
+			outputitems = results[0];
+		}
+		this.CHK_ANCHOR.checked = (outputitems.getAttribute("anchor_checked")=="true"?true:false);
+		var elemHash = this._oid_property.getElementsByTagName("LOCATION_HASH")[0];
+		if(elemHash && elemHash.textContent){
+			this.CHK_HASH.checked = false;
+		}
+		results = this.XPath.evaluateArray('/METACAPTURE[1]/OUTPUT_ITEMS[1]/OUTPUT_ITEM',this.xmldoc);
+		if(!results || results.length == 0){
+			var outputitem = this.xmldoc.createElement("OUTPUT_ITEM");
+			outputitem.setAttribute("format","");
+			outputitems.appendChild(outputitem);
+		}else{
+			this.FMT_OUTPUT.value = results[0].getAttribute("format");
+			this.REG_OUTPUT.value = results[0].getAttribute("regexp");
+			this.REP_OUTPUT.value = results[0].getAttribute("replace");
+			this.REG_I.checked = (results[0].getAttribute("regexp_i")=="true"?true:false);
+			this.REG_G.checked = (results[0].getAttribute("regexp_g")=="true"?true:false);
+			this.REG_M.checked = (results[0].getAttribute("regexp_m")=="true"?true:false);
+		}
+		bitsMetaCaptureDialogOutputTree.xmldoc = this._xmldoc;
+		bitsMetaCaptureDialogOutputTree.xmlflash = window.arguments[0].xmlflash;
+		this.rebuild();
+		this.itemChecked();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	accept : function(aEvent){
+		window.arguments[0].accept = true;
+		window.arguments[0].xmldoc = this.xmldoc;
+		window.arguments[0].text = this._outtext;
+		var s = new XMLSerializer();
+		var xml = s.serializeToString(this.xmldoc);
+		return true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	itemChecked : function(aEvent){
+		var checked = false;
+		if(!checked && !this.CHK_HA.disabled && this.CHK_HA.checked) checked = true;
+		if(!checked && !this.CHK_TITLE.disabled && this.CHK_TITLE.checked) checked = true;
+		if(!checked && !this.CHK_NOTE.disabled && this.CHK_NOTE.checked) checked = true;
+		if(!checked && !this.CHK_META.disabled && this.CHK_META.checked) checked = true;
+		if(checked){
+			this.DIALOG.removeAttribute("buttondisabledaccept");
+		}else{
+			this.DIALOG.setAttribute("buttondisabledaccept","true");
+		}
+		if(aEvent && aEvent.target == this.CHK_REGEXP_EDIT) this.rebuild();
+		if(this.CHK_REGEXP_EDIT.checked){
+			this.TAG.removeAttribute("hidden");
+			this.REGEXP.removeAttribute("hidden");
+			this.FORMAT.removeAttribute("hidden");
+			this.ADD.removeAttribute("hidden");
+			this.DEL.removeAttribute("hidden");
+			this.COL_USE.removeAttribute("hidden");
+			this.TREE.removeAttribute("disabled");
+		}else{
+			this.TAG.setAttribute("hidden","true");
+			this.REGEXP.setAttribute("hidden","true");
+			this.FORMAT.setAttribute("hidden","true");
+			this.ADD.setAttribute("hidden","true");
+			this.DEL.setAttribute("hidden","true");
+			this.COL_USE.setAttribute("hidden","true");
+			this.TREE.setAttribute("disabled","true");
+		}
+		if(!this.CHK_HA.disabled && this.CHK_HA.checked){
+			this.GRP_HA.disabled = false;
+		}else{
+			this.GRP_HA.disabled = true;
+		}
+		if(!this.CHK_TITLE.disabled && this.CHK_TITLE.checked){
+			this.GRP_TITLE.disabled = false;
+		}else{
+			this.GRP_TITLE.disabled = true;
+		}
+		if(!this.CHK_NOTE.disabled && this.CHK_NOTE.checked){
+			this.GRP_NOTE.disabled = false;
+		}else{
+			this.GRP_NOTE.disabled = true;
+		}
+		if(!this.CHK_META.disabled && this.CHK_META.checked){
+			this.GRP_META.disabled = false;
+		}else{
+			this.GRP_META.disabled = true;
+		}
+		var results = this.XPath.evaluateArray('/METACAPTURE[1]/COPY_ITEMS[1]/COPY_ITEM[@name="hyperanchor"]',this.xmldoc);
+		results[0].setAttribute("checked",this.CHK_HA.checked);
+		results[0].setAttribute("selected",this.GRP_HA.value);
+		var results = this.XPath.evaluateArray('/METACAPTURE[1]/COPY_ITEMS[1]/COPY_ITEM[@name="title"]',this.xmldoc);
+		results[0].setAttribute("checked",this.CHK_TITLE.checked);
+		results[0].setAttribute("selected",this.GRP_TITLE.value);
+		var results = this.XPath.evaluateArray('/METACAPTURE[1]/COPY_ITEMS[1]/COPY_ITEM[@name="note"]',this.xmldoc);
+		results[0].setAttribute("checked",this.CHK_NOTE.checked);
+		results[0].setAttribute("selected",this.GRP_NOTE.value);
+		var results = this.XPath.evaluateArray('/METACAPTURE[1]/COPY_ITEMS[1]/COPY_ITEM[@name="meta"]',this.xmldoc);
+		results[0].setAttribute("checked",this.CHK_META.checked);
+		results[0].setAttribute("selected",this.GRP_META.value);
+		while(this.SMP_HA.hasChildNodes()){
+			this.SMP_HA.removeChild(this.SMP_HA.lastChild);
+		}
+		while(this.SMP_TITLE.hasChildNodes()){
+			this.SMP_TITLE.removeChild(this.SMP_TITLE.lastChild);
+		}
+		while(this.SMP_NOTE.hasChildNodes()){
+			this.SMP_NOTE.removeChild(this.SMP_NOTE.lastChild);
+		}
+		while(this.SMP_META.hasChildNodes()){
+			this.SMP_META.removeChild(this.SMP_META.lastChild);
+		}
+		if(checked){
+			this._outtext = "";
+			if(!this.CHK_HA.disabled && this.CHK_HA.checked){
+				var value = this._con_url;
+				var elem = this._oid_property.getElementsByTagName("HYPER_ANCHOR")[0];
+				if(elem) value = elem.textContent;
+				if(value && !this.GRP_HASH.hidden && this.CHK_HASH.checked){
+					var hashReg = new RegExp("^(.+)(#"+this.bitsHyperAnchorDummy._anchor_title + ")");
+					try{var textContent = this._oid_property.getElementsByTagName("LOCATION_HASH")[0].textContent;}catch(e){textContent="";}
+					value = value.replace(hashReg,"$1#"+textContent+"$2");
+				}
+				if(this.GRP_HA.value == "true") value = '<HYPER_ANCHOR>' + value + '</HYPER_ANCHOR>';
+				if(value){
+					this.SMP_HA.appendChild(this.xmldoc.createTextNode(value));
+					this._outtext += value + "\n";
+				}
+			}
+			if(!this.CHK_TITLE.disabled && this.CHK_TITLE.checked){
+				var value = "";
+				if(this.GRP_TITLE.value == "true"){
+					value += '<TITLE>' + this._oid_title + '</TITLE>';
+				}else{
+					value += this._oid_title;
+				}
+				if(value){
+					this.SMP_TITLE.appendChild(this.xmldoc.createTextNode(value));
+					this._outtext += value + "\n";
+				}
+			}
+			if(!this.CHK_NOTE.disabled && this.CHK_NOTE.checked){
+				var value = "";
+				var elem = this._oid_property.getElementsByTagName("NOTE")[0];
+				if(elem){
+					if(this.GRP_NOTE.value == "true"){
+						value += '<' + elem.nodeName + '>' + elem.textContent + '</' + elem.nodeName + '>';
+					}else{
+						value += elem.textContent;
+					}
+				}
+				if(value){
+					this.SMP_NOTE.appendChild(this.xmldoc.createTextNode(value));
+					this._outtext += value + "\n";
+				}
+			}
+			if(!this.CHK_META.disabled && this.CHK_META.checked){
+				var value = "";
+				var attrs = [];
+				var attrs_hash = {};
+				var regexps = this.XPath.evaluateArray('/METACAPTURE[1]/META_REGEXP_ITEMS[1]/META_REGEXP_ITEM[@use="true"]',this.xmldoc);
+				for(var regcnt=0;regcnt<regexps.length;regcnt++){
+					var temp_attrs = [];
+
+					var nodeName = "tag";
+					var nodeValue = regexps[regcnt].getAttribute(nodeName);
+					if(nodeValue != null && nodeValue != "") temp_attrs.push('@'+nodeName+'="'+nodeValue+'"');
+
+					var nodeName = "name";
+					var nodeValue = regexps[regcnt].getAttribute(nodeName);
+					if(nodeValue != null && nodeValue != "") temp_attrs.push('@'+nodeName+'="'+nodeValue+'"');
+
+					if(temp_attrs.length == 0) continue;
+					var attrs_key = temp_attrs.join(" and ");
+					if(attrs_hash[attrs_key] == undefined){
+						attrs.push(attrs_key);
+						attrs_hash[attrs_key] = [];
+					}
+					var temp_attrs = {};
+					var nodeName = "regexp";
+					var nodeValue = regexps[regcnt].getAttribute(nodeName);
+					if(nodeValue != null) temp_attrs[nodeName] = nodeValue;
+					var nodeName = "format";
+					var nodeValue = regexps[regcnt].getAttribute(nodeName);
+					if(nodeValue != null) temp_attrs[nodeName] = nodeValue;
+					attrs_hash[attrs_key].push(temp_attrs);
+				}
+				for(var regcnt=0;regcnt<attrs.length;regcnt++){
+					var attrs_key = attrs[regcnt];
+					if(attrs_key.indexOf('@tag="TITLE"')>=0){
+						var textContent = this._doc_title;
+						for(var rcnt=0;rcnt<attrs_hash[attrs_key].length;rcnt++){
+							var regexp = attrs_hash[attrs_key][rcnt].regexp;
+							var format = attrs_hash[attrs_key][rcnt].format;
+							if(!regexp || regexp == "") continue;
+							try{regexp = new RegExp(regexp);}catch(e){regexp=null;}
+							if(!regexp) continue;
+							if(!textContent.match(regexp)) continue;
+							textContent = textContent.replace(regexp,format);
+						}
+						if(this.GRP_META.value == "true"){
+							value += '<META>' + textContent + '</META>';
+						}else{
+							value += textContent;
+						}
+					}else{
+						var nodes = this.XPath.evaluateArray("//METACAPTURE[" + attrs_key + "]",this._oid_property);
+						for(var ncnt=0;ncnt<nodes.length;ncnt++){
+							var elem = nodes[ncnt];
+							var textContent = elem.getAttribute("content");
+							if(textContent == null || textContent == "") textContent = elem.textContent;
+							for(var rcnt=0;rcnt<attrs_hash[attrs_key].length;rcnt++){
+								var regexp = attrs_hash[attrs_key][rcnt].regexp;
+								var format = attrs_hash[attrs_key][rcnt].format;
+								if(!regexp || regexp == "") continue;
+								try{regexp = new RegExp(regexp);}catch(e){regexp=null;}
+								if(!regexp) continue;
+								if(!textContent.match(regexp)) continue;
+								textContent = textContent.replace(regexp,format);
+							}
+							if(this.GRP_META.value == "true"){
+								value += '<META>' + textContent + '</META>';
+							}else{
+								value += textContent;
+							}
+						}
+					}
+				}
+				if(value){
+					this.SMP_META.appendChild(this.xmldoc.createTextNode(value));
+					this._outtext += value + "\n";
+				}
+			}
+		}
+		var results = this.XPath.evaluateArray('/METACAPTURE[1]/OUTPUT_ITEMS[1]',this.xmldoc);
+		if(results && results.length){
+			results[0].setAttribute("anchor_checked",this.CHK_ANCHOR.checked);
+		}
+		this.outputInput();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	outputInput : function(aEvent){
+		var output = this.FMT_OUTPUT.value;
+		var flag = "";
+		flag += (this.REG_I.checked?'i':'');
+		flag += (this.REG_G.checked?'g':'');
+		flag += (this.REG_M.checked?'m':'');
+		try{var regexp = (this.REG_OUTPUT.value?new RegExp(this.REG_OUTPUT.value,flag):null);}catch(e){this._dump(e);}
+		var replace_text = this.REP_OUTPUT.value;
+		var replacement_key = null;
+		replacement_key = new RegExp(this.TXT_HA.value,'g');
+		output = output.replace(replacement_key,this.SMP_HA.textContent);
+		replacement_key = new RegExp(this.TXT_TITLE.value,'g');
+		output = output.replace(replacement_key,this.SMP_TITLE.textContent);
+		replacement_key = new RegExp(this.TXT_NOTE.value,'g');
+		output = output.replace(replacement_key,this.SMP_NOTE.textContent);
+		replacement_key = new RegExp(this.TXT_META.value,'g');
+		output = output.replace(replacement_key,this.SMP_META.textContent);
+		while(this.SMP_OUTPUT.hasChildNodes()){
+			this.SMP_OUTPUT.removeChild(this.SMP_OUTPUT.lastChild);
+		}
+		if(regexp && output.match(regexp)){
+			output = output.replace(regexp,replace_text);
+		}
+		if(this.CHK_ANCHOR.checked) output = '<a href="'+this.SMP_HA.textContent+'">'+output+'</a>';
+		output = this.makeFormatText(this.xmldoc,{
+			oid_property : this._oid_property,
+			doc_title    : this._doc_title,
+			oid_title    : this._oid_title,
+			con_url      : this._con_url
+		});
+		var output_arr = output.split("\n");
+		for(var i=0;i<output_arr.length;i++){
+			var label = this.SMP_OUTPUT.ownerDocument.createElement("label");
+			label.appendChild(this.SMP_OUTPUT.ownerDocument.createTextNode(output_arr[i]));
+			this.SMP_OUTPUT.appendChild(label);
+		}
+		this._outtext = output;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	regexpInput : function(aEvent){
+		var regexp = this.REGEXP.value;
+		regexp = regexp.replace(/^\s*/g,"").replace(/\s*$/g,"");
+
+		var format = this.FORMAT.value;
+		format = format.replace(/^\s*/g,"").replace(/\s*$/g,"");
+
+		if(regexp.length>0 && format.length>0){
+			this.ADD.removeAttribute("disabled");
+		}else{
+			this.ADD.setAttribute("disabled","true");
+		}
+		this.ADD.removeAttribute("disabled");
+	},
+
+/////////////////////////////////////////////////////////////////////
+// TREE è¡šç€ºå¶åŸ¡é¢é£
+/////////////////////////////////////////////////////////////////////
+	get rowItems(){
+		if(this.CHK_REGEXP_EDIT.checked){
+			return this.XPath.evaluateArray('/METACAPTURE[1]/META_REGEXP_ITEMS[1]/META_REGEXP_ITEM',this.xmldoc);
+		}else{
+			return this.XPath.evaluateArray('/METACAPTURE[1]/META_REGEXP_ITEMS[1]/META_REGEXP_ITEM[@use="true"]',this.xmldoc);
+		}
+	},
+	get rowCount(){
+		var results = this.rowItems;
+		return results.length;
+	},
+	getCellText : function(row,column){
+		var results = this.rowItems;
+		if(!results[row]) return null;
+		if(column.id == "bitsMetaCopyTagRxgexpTreeTagCol"){
+			return results[row].getAttribute("tag");
+		}else if(column.id == "bitsMetaCopyTagRxgexpTreeNameCol"){
+			return results[row].getAttribute("name");
+		}else if(column.id == "bitsMetaCopyTagRxgexpTreeRxgexpCol"){
+			return results[row].getAttribute("regexp");
+		}else if(column.id == "bitsMetaCopyTagRxgexpTreeFormatCol"){
+			return results[row].getAttribute("format");
+		}else{
+			return null;
+		}
+	},
+	getCellValue : function(row,column){
+		var results = this.rowItems;
+		if(!results[row]) return false;
+		if(column.id == "bitsMetaCopyTagRxgexpTreeUseCol"){
+			return (results[row].getAttribute("use") == "true" ? true : false);
+		}
+		return true;
+	},
+	setTree: function(treebox){ this.treebox = treebox; },
+	isEditable: function(row,column){
+		if(column.id == "bitsMetaCopyTagRxgexpTreeUseCol"){
+			return true;
+		}else{
+			return false;
+		}
+	},
+	isContainer: function(row){ return false; },
+	isSeparator: function(row){ return false; },
+	isSorted: function(){ return true; },
+	getLevel: function(row){ return 0; },
+	getImageSrc: function(row,column){ return null; },
+	getRowProperties: function(row,prop){
+	},
+	getCellProperties: function(row, column, prop) {
+	},
+	getColumnProperties: function(column, element, prop) {},
+	cycleHeader : function(col){},
+	setCellText : function(row,column,text){},
+	setCellValue : function(row,column,value){
+		var results = this.rowItems;
+		if(!results[row]) return;
+		if(column.id == "bitsMetaCopyTagRxgexpTreeUseCol"){
+			results[row].setAttribute("use",value);
+			this.itemChecked();
+		}
+	},
+  getParentIndex: function(idx) { return -1; },
+	canDrop : function(index, orient){
+		return false;
+	},
+	onDrop : function(row, orient){
+		bitsMetaCaptureDialog._dump("onDrop()");
+	},
+	drop : function(row, orient){
+		bitsMetaCaptureDialog._dump("drop()");
+	},
+
+
+/////////////////////////////////////////////////////////////////////
+	rebuild : function(){
+		this.TREE.view = bitsMetaCaptureDialog;
+	},
+
+/////////////////////////////////////////////////////////////////////
+// TREE ã€ãã³ãé¢é£
+/////////////////////////////////////////////////////////////////////
+	onClick : function(aEvent){
+		if(this.TREE.view.selection.count == 0) return false;
+		var idxList = this.getSelection();
+		if(this.validateMultipleSelection(idxList) == false) return false;
+		this.DEL.removeAttribute("disabled");
+
+		var row = idxList[0];
+		var results = this.rowItems;
+		this.REGEXP.value = results[row].getAttribute("regexp");
+		this.FORMAT.value = results[row].getAttribute("format");
+
+	},
+
+	onAdd : function(aEvent){
+		var elemRegexpItems = null;
+		var results = this.XPath.evaluateArray('/METACAPTURE[1]/META_REGEXP_ITEMS[1]',this.xmldoc);
+		if(!results || results.length == 0){
+			elemRegexpItems = this.xmldoc.createElement("META_REGEXP_ITEMS");
+			this.xmldoc.documentElement.appendChild(elemRegexpItems);
+		}else{
+			elemRegexpItems = results[0];
+		}
+		var node = this.xmldoc.createElement("META_REGEXP_ITEM");
+		node.setAttribute("tag",this.TAG.value);
+		var regexp = this.REGEXP.value;
+		regexp = regexp.replace(/^\s*/g,"").replace(/\s*$/g,"");
+		node.setAttribute("regexp",regexp);
+		var format = this.FORMAT.value;
+		format = format.replace(/^\s*/g,"").replace(/\s*$/g,"");
+		node.setAttribute("format",format);
+		elemRegexpItems.appendChild(node);
+		this.rebuild();
+	},
+
+	onDel : function(aEvent){
+		if(this.TREE.view.selection.count == 0) return false;
+		var idxList = this.getSelection();
+		if(this.validateMultipleSelection(idxList) == false) return false;
+		if(!this.confirmRemovingFor()) return false;
+		var results = this.rowItems;
+		var i;
+		for(i=idxList.length-1;i>=0;i--){
+			var row = idxList[i];
+			if(!results[row]) continue;
+			results[row].parentNode.removeChild(results[row]);
+		}
+		if(this.rowCount == 0) this.TREE.view.selection.clearSelection();
+		this.rebuild();
+		var idxList = this.getSelection();
+		if(this.rowCount == 0 || idxList.length == 0 || this.validateMultipleSelection(idxList) == false){
+			this.DEL.setAttribute("disabled","true");
+		}else{
+			this.DEL.removeAttribute("disabled");
+		}
+		this._changed = true;
+		this.TREE.focus();
+	},
+
+	confirmRemovingFor : function(){
+		try{
+			return this.Common.confirm( this.STRING.getString("CONFIRM_DELETE") );
+			return true;
+		}catch(e){
+			return false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getSelection : function(){
+		var ret = [];
+		var rc;
+		var i;
+		for(rc=0;rc<this.TREE.view.selection.getRangeCount();rc++){
+			var start = {}, end = {};
+			this.TREE.view.selection.getRangeAt(rc, start, end);
+			for(i=start.value;i<= end.value;i++){
+				if(!this.TREE.view.selection.isSelected(i)) continue;
+				ret.push(i);
+			}
+		}
+		return ret;
+	},
+
+	validateMultipleSelection : function(aIdxList){
+		if(aIdxList.length != this.TREE.view.selection.count){
+			alert(this.STRING.getString("ERROR_MULTIPLE_SELECTION"));
+			return false;
+		}
+		return true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.opener.top.bitsMarkingCollection._dump(aString);
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/metaCaptureDialog.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/metaCaptureDialog.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/metaCaptureDialog.xul	(revision 5703)
@@ -0,0 +1,329 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/setting.css" type="text/css" ?>
+<!DOCTYPE dialog [
+<!ENTITY % markingcollectionDTD SYSTEM "chrome://markingcollection/locale/markingcollection.dtd" >
+%markingcollectionDTD;
+<!ENTITY % metaDTD SYSTEM "chrome://markingcollection/locale/meta.dtd" >
+%metaDTD;
+]>
+<dialog
+	id="bitsMetaCaptureDialog"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	title="&meta.menuitem.hyperanchor.copyformatsetting;"
+	buttons="accept,cancel"
+	buttondisabledaccept="true"
+	style="width:600px;height:550px;"
+	persist="width,height"
+	onload="bitsMetaCaptureDialog.init();"
+	onunload="bitsMetaCaptureDialog.done();"
+	ondialogaccept="bitsMetaCaptureDialog.accept();">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/metaCaptureDialog.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/metaCaptureDialogOutputTree.js" />
+	<stringbundleset id="bitsMetaCaptureStringbundleset">
+		<stringbundle id="bitsMetaCaptureString" src="chrome://markingcollection/locale/markingcollection.properties" />
+	</stringbundleset>
+	<vbox
+		flex="1"
+		oncommand="bitsMetaCaptureDialog.itemChecked(event)"
+		style="overflow:auto;">
+		<hbox>
+			<groupbox flex="1">
+				<caption label="Tokens for Output Format"/>
+				<hbox flex="1">
+
+					<checkbox id="bitsMetaCopyItemHyperAnchor"       label="HYPER-ANCHOR Code" checked="true" hidden="true"/>
+					<radiogroup orient="horizontal" id="bitsMetaCopyItemHyperAnchorTagGroup" hidden="true">
+						<radio id="bitsMetaCopyItemHyperAnchorTag"     label="&meta.dialog.copyformat.radio.tag;"     value="true"/>
+						<radio id="bitsMetaCopyItemHyperAnchorTagNone" label="&meta.dialog.copyformat.radio.nonetag;" value="false" selected="true"/>
+					</radiogroup>
+					<checkbox id="bitsMetaCopyItemTitle"      label="&meta.dialog.copyformat.checkbox.title;" checked="true" hidden="true"/>
+					<radiogroup orient="horizontal" id="bitsMetaCopyItemTitleTagGroup" hidden="true">
+						<radio id="bitsMetaCopyItemTitleTag"     label="&meta.dialog.copyformat.radio.tag;"     value="true"/>
+						<radio id="bitsMetaCopyItemTitleTagNone" label="&meta.dialog.copyformat.radio.nonetag;" value="false" selected="true"/>
+					</radiogroup>
+					<checkbox id="bitsMetaCopyItemNote"       label="&meta.dialog.copyformat.checkbox.note;" checked="true" hidden="true"/>
+					<radiogroup orient="horizontal" id="bitsMetaCopyItemNoteTagGroup" hidden="true">
+						<radio id="bitsMetaCopyItemNoteTag"     label="&meta.dialog.copyformat.radio.tag;"     value="true"/>
+						<radio id="bitsMetaCopyItemNoteTagNone" label="&meta.dialog.copyformat.radio.nonetag;" value="false" selected="true"/>
+					</radiogroup>
+					<checkbox id="bitsMetaCopyItemMeta"       label="&meta.dialog.copyformat.checkbox.meta;" checked="true" hidden="true"/>
+					<radiogroup orient="horizontal" id="bitsMetaCopyItemMetaTagGroup" hidden="true">
+						<radio id="bitsMetaCopyItemMetaTag"     label="&meta.dialog.copyformat.radio.tag;"     value="true"/>
+						<radio id="bitsMetaCopyItemMetaTagNone" label="&meta.dialog.copyformat.radio.nonetag;" value="false" selected="true"/>
+					</radiogroup>
+
+					<grid flex="1">
+						<columns>
+							<column/>
+							<column flex="1"/>
+						</columns>
+						<rows>
+							<row align="center">
+								<hbox pack="end">
+									<label value="HYPER-ANCHOR Code" style="color:#666;"/>
+								</hbox>
+								<textbox id="bitsMetaCopyItemHyperAnchorText" readonly="true" size="7" onfocus="this.select()" value="HYPER_ANCHOR"/>
+							</row>
+							<row align="center">
+								<hbox pack="end">
+									<label value="&meta.dialog.copyformat.checkbox.title;" style="color:#666;"/>
+								</hbox>
+								<textbox id="bitsMetaCopyItemTitleText" readonly="true" size="7" onfocus="this.select()" value="WM_TITLE"/>
+							</row>
+							<row id="bitsMetaCopyItemMedlinePMCIDRow" align="center">
+								<hbox pack="end">
+									<label value="Pubmed Central ID" style="color:#666;"/>
+								</hbox>
+								<textbox id="bitsMetaCopyItemMedlinePMCIDText" readonly="true" flex="1" onfocus="this.select()" value="MEDLINE.PMCID"/>
+							</row>
+						</rows>
+					</grid>
+					<grid flex="1">
+						<columns>
+							<column/>
+							<column flex="1"/>
+						</columns>
+						<rows>
+							<row align="center">
+								<hbox pack="end">
+									<label value="&meta.dialog.copyformat.checkbox.note;" style="color:#666;"/>
+								</hbox>
+								<textbox id="bitsMetaCopyItemNoteText" readonly="true" size="7" onfocus="this.select()" value="WM_NOTE"/>
+							</row>
+							<row align="center">
+								<hbox pack="end">
+									<label value="&meta.dialog.copyformat.checkbox.meta;" style="color:#666;"/>
+								</hbox>
+								<textbox id="bitsMetaCopyItemMetaText" readonly="true" size="7" onfocus="this.select()" value="WM_META"/>
+							</row>
+							<row id="bitsMetaCopyItemMedlinePMIDRow" align="center">
+								<hbox pack="end">
+									<label value="PubMed ID" style="color:#666;"/>
+								</hbox>
+								<textbox id="bitsMetaCopyItemMedlinePMIDText" readonly="true" size="7" onfocus="this.select()" value="MEDLINE.PMID"/>
+							</row>
+							<row id="bitsMetaCopyItemMedlineSORow" align="center">
+								<hbox pack="end">
+									<label value="Source" style="color:#666;"/>
+								</hbox>
+								<textbox id="bitsMetaCopyItemMedlineSOText" readonly="true" flex="1" onfocus="this.select()" value="MEDLINE.SO"/>
+							</row>
+						</rows>
+					</grid>
+				</hbox>
+			</groupbox>
+		</hbox>
+		<groupbox id="bitsMetaCopyTagRxgexpTreeGroupBox" flex="1" hidden="true" style="margin-left:2em;width:550px;min-height:230px;">
+			<caption label="Regular Expressions" align="center">
+				<label value="&meta.dialog.copyformat.checkbox.meta; [ Regular Expressions ]"/>
+				<checkbox id="bitsMetaCopyTagRxgexpEdit" label="Edit"/>
+			</caption>
+			<hbox>
+				<menulist
+					id="bitsMetaCopyTagRxgexpTreeAddTagMenulist"
+					flex="0">
+					<menupopup/>
+				</menulist>
+				<textbox
+					id="bitsMetaCopyTagRxgexpTreeAddRxgexpTextbox"
+					flex="1"
+					oninput="bitsMetaCaptureDialog.regexpInput(event)"
+					onfocus="this.select()" />
+				<textbox
+					id="bitsMetaCopyTagRxgexpTreeAddFormatTextbox"
+					flex="1"
+					oninput="bitsMetaCaptureDialog.regexpInput(event)"
+					onfocus="this.select()" />
+				<toolbarbutton
+					id="bitsMetaCopyTagRxgexpTreeAdd"
+					label="&markingcollection.substitutiontree.add;"
+					image="chrome://markingcollection/skin/menu_create.png"
+					oncommand="bitsMetaCaptureDialog.onAdd(event);"/>
+			</hbox>
+			<hbox flex="1">
+				<tree
+					id="bitsMetaCopyTagRxgexpTree"
+					hidecolumnpicker="true"
+					seltype="single"
+					class="tree"
+					disabled="true"
+					flex="1"
+					editable="true"
+					onclick="bitsMetaCaptureDialog.onClick(event);"
+				>
+					<treecols id="bitsMetaCopyTagRxgexpTreeCols">
+						<treecol
+							id="bitsMetaCopyTagRxgexpTreeUseCol"
+							fixed="true"
+							src="chrome://markingcollection/skin/cbox-check.gif"
+							class="treecol-image"
+							type="checkbox"
+							editable="true"
+							width="30"/>
+						<treecol
+							id="bitsMetaCopyTagRxgexpTreeTagCol"
+							fixed="true"
+							label="HTML Tag"
+							width="70"/>
+						<treecol
+							id="bitsMetaCopyTagRxgexpTreeNameCol"
+							flex="1"
+							label="Attribute name"
+							hidden="true"
+							persist="width"/>
+						<splitter class="tree-splitter"/>
+						<treecol
+							id="bitsMetaCopyTagRxgexpTreeRxgexpCol"
+							flex="1"
+							fixed="false"
+							label="Regular Expressions"
+							persist="width"/>
+						<splitter class="tree-splitter"/>
+						<treecol
+							id="bitsMetaCopyTagRxgexpTreeFormatCol"
+							flex="1"
+							fixed="false"
+							label="Substituted form"
+							persist="width"/>
+						<splitter class="tree-splitter"/>
+					</treecols>
+					<treechildren/>
+				</tree>
+				<vbox>
+					<toolbarbutton
+						id="bitsMetaCopyTagRxgexpTreeDel"
+						label="&markingcollection.substitutiontree.del;"
+						image="chrome://markingcollection/skin/menu_remove.png"
+						disabled="true"
+						oncommand="bitsMetaCaptureDialog.onDel(event);"/>
+				</vbox>
+			</hbox>
+			<groupbox id="bitsMetaCopySampleGroupBox"  style="height:80px;">
+				<caption label="Sample"/>
+				<vbox flex="1" style="overflow:auto;">
+					<description id="bitsMetaCopySampleHyperAnchor" hidden="true"/>
+					<description id="bitsMetaCopySampleTitle" hidden="true"/>
+					<description id="bitsMetaCopySampleNote" hidden="true"/>
+					<description id="bitsMetaCopySampleMeta"/>
+				</vbox>
+			</groupbox>
+		</groupbox>
+		<groupbox id="bitsMetaCopyOutputGroupBox" flex="1">
+			<caption label="Output format" align="center">
+				<label value="Output format"/>
+				<checkbox id="bitsMetaCopyOutputEditCheckbox" label="Edit" oncommand="bitsMetaCaptureDialogOutputTree.onEdit(event);"/>
+			</caption>
+			<vbox>
+				<grid id="bitsMetaCopyOutputEditGrid" hidden="true">
+					<columns>
+						<column/>
+						<column flex="1"/>
+					</columns>
+					<rows>
+						<row align="start">
+							<label value="Format :"/>
+							<textbox
+								id="bitsMetaCopyOutputFormatTextbox"
+								multiline="true"
+								flex="1"
+								oninput="bitsMetaCaptureDialogOutputTree.outputInput(event)"
+								onfocus="this.select()" />
+						</row>
+						<row align="center">
+							<label value="Replace :"/>
+							<textbox
+								id="bitsMetaCopyOutputRegExpTextbox"
+								multiline="false"
+								flex="1"
+								oninput="bitsMetaCaptureDialogOutputTree.regexpInput(event)"
+								onfocus="this.select()" />
+						</row>
+						<row align="center">
+							<label value="To :"/>
+							<textbox
+								id="bitsMetaCopyOutputReplaceTextbox"
+								multiline="false"
+								flex="1"
+								oninput="bitsMetaCaptureDialogOutputTree.regexpInput(event)"
+								onfocus="this.select()" />
+						</row>
+						<row align="center">
+							<label/>
+							<vbox>
+								<hbox id="bitsMetaCopyHyperanchorGroupBox" align="center" pack="end">
+									<checkbox id="bitsMetaCopyHyperanchorInURLHash" label="&meta.dialog.copyformat.checkbox.hash;"/>
+								</hbox>
+								<hbox align="center" pack="end">
+									<checkbox id="bitsMetaCopyOutputRegExpI" label="Case sensitive(i)"/>
+									<checkbox id="bitsMetaCopyOutputRegExpG" label="Repeat(g)"/>
+									<checkbox id="bitsMetaCopyOutputRegExpM" label="Multiple lines(m)"/>
+								</hbox>
+							</vbox>
+						</row>
+					</rows>
+				</grid>
+			</vbox>
+			<hbox id="bitsMetaCopyOutputHBox" flex="1">
+				<tree
+					id="bitsMetaCopyOutputTree"
+					hidecolumnpicker="true"
+					seltype="single"
+					class="tree"
+					flex="1"
+					onclick="bitsMetaCaptureDialogOutputTree.onClick(event);"
+					style="min-height:82px;"
+				>
+					<treecols id="bitsMetaCopyOutputTreeCols">
+						<treecol
+							id="bitsMetaCopyOutputTreeFormatCol"
+							flex="1"
+							label="Format"
+							persist="width"/>
+						<splitter class="tree-splitter"/>
+						<treecol
+							id="bitsMetaCopyOutputTreeRxgexpCol"
+							flex="1"
+							label="RegExp"
+							persist="width"/>
+						<splitter class="tree-splitter"/>
+						<treecol
+							id="bitsMetaCopyOutputTreeReplaceCol"
+							flex="1"
+							label="Replace"
+							persist="width"/>
+						<treecol
+							id="bitsMetaCopyOutputTreeRxgexpFlagCol"
+							fixed="true"
+							label="Flag"
+							width="54"/>
+					</treecols>
+					<treechildren/>
+				</tree>
+				<vbox id="bitsMetaCopyOutputEditVBox" hidden="true">
+					<toolbarbutton
+						id="bitsMetaCopyOutputTreeAdd"
+						label="&markingcollection.substitutiontree.add;"
+						image="chrome://markingcollection/skin/menu_create.png"
+						oncommand="bitsMetaCaptureDialogOutputTree.onAdd(event);"/>
+					<toolbarbutton
+						id="bitsMetaCopyOutputTreeDel"
+						label="&markingcollection.substitutiontree.del;"
+						image="chrome://markingcollection/skin/menu_remove.png"
+						disabled="true"
+						oncommand="bitsMetaCaptureDialogOutputTree.onDel(event);"/>
+				</vbox>
+			</hbox>
+		</groupbox>
+		<groupbox flex="1">
+			<caption label="Sample"  align="center">
+				<label value="Sample"/>
+				<hbox flex="1" align="center" pack="end">
+					<checkbox id="bitsMetaCopyOutputItemAnchor" label="Add Anchor tag"/>
+				</hbox>
+			</caption>
+			<vbox id="bitsMetaOutputSample" flex="1" style="overflow:auto;"/>
+		</groupbox>
+	</vbox>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/metaCaptureDialogOutputTree.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/metaCaptureDialogOutputTree.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/metaCaptureDialogOutputTree.js	(revision 5703)
@@ -0,0 +1,338 @@
+var bitsMetaCaptureDialogOutputTree = {
+
+	_xmldoc  : null,
+	xmlflash : null,
+
+/////////////////////////////////////////////////////////////////////
+// ãã­ããã£
+/////////////////////////////////////////////////////////////////////
+	get DataSource(){ return window.opener.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.opener.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.opener.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.opener.top.bitsObjectMng.Database;   },
+	get XML()        { return window.opener.top.bitsObjectMng.XML;        },
+	get gBrowser()   { return window.opener.top.bitsObjectMng.getBrowser();},
+
+	get STRING()     { return document.getElementById("bitsMetaCaptureString"); },
+
+	get DIALOG()     { return document.getElementById("bitsMetaCaptureDialog"); },
+
+	get TREE()       { return document.getElementById("bitsMetaCopyOutputTree"); },
+	get ADD()        { return document.getElementById("bitsMetaCopyOutputTreeAdd"); },
+	get DEL()        { return document.getElementById("bitsMetaCopyOutputTreeDel"); },
+	get CHK_EDIT()   { return document.getElementById("bitsMetaCopyOutputEditCheckbox"); },
+	get GRD_EDIT()   { return document.getElementById("bitsMetaCopyOutputEditGrid"); },
+	get VBOX_EDIT()  { return document.getElementById("bitsMetaCopyOutputEditVBox"); },
+
+	get TAG()        { return document.getElementById("bitsMetaCopyTagRxgexpTreeAddTagMenulist"); },
+	get REGEXP()     { return document.getElementById("bitsMetaCopyTagRxgexpTreeAddRxgexpTextbox"); },
+	get FORMAT()     { return document.getElementById("bitsMetaCopyTagRxgexpTreeAddFormatTextbox"); },
+
+	get CHK_HA()     { return document.getElementById("bitsMetaCopyItemHyperAnchor"); },
+	get CHK_TITLE()  { return document.getElementById("bitsMetaCopyItemTitle"); },
+	get CHK_NOTE()   { return document.getElementById("bitsMetaCopyItemNote"); },
+	get CHK_META()   { return document.getElementById("bitsMetaCopyItemMeta"); },
+	get CHK_HASH()   { return document.getElementById("bitsMetaCopyHyperanchorInURLHash"); },
+
+	get CHK_ANCHOR(){ return document.getElementById("bitsMetaCopyOutputItemAnchor"); },
+
+
+	get GRP_HA()     { return document.getElementById("bitsMetaCopyItemHyperAnchorTagGroup"); },
+	get GRP_TITLE()  { return document.getElementById("bitsMetaCopyItemTitleTagGroup"); },
+	get GRP_NOTE()   { return document.getElementById("bitsMetaCopyItemNoteTagGroup"); },
+	get GRP_META()   { return document.getElementById("bitsMetaCopyItemMetaTagGroup"); },
+	get GRP_HASH()   { return document.getElementById("bitsMetaCopyHyperanchorGroupBox"); },
+
+	get TXT_HA()     { return document.getElementById("bitsMetaCopyItemHyperAnchorText"); },
+	get TXT_TITLE()  { return document.getElementById("bitsMetaCopyItemTitleText"); },
+	get TXT_NOTE()   { return document.getElementById("bitsMetaCopyItemNoteText"); },
+	get TXT_META()   { return document.getElementById("bitsMetaCopyItemMetaText"); },
+
+	get SMP_HA()     { return document.getElementById("bitsMetaCopySampleHyperAnchor"); },
+	get SMP_TITLE()  { return document.getElementById("bitsMetaCopySampleTitle"); },
+	get SMP_NOTE()   { return document.getElementById("bitsMetaCopySampleNote"); },
+	get SMP_META()   { return document.getElementById("bitsMetaCopySampleMeta"); },
+
+	get FMT_OUTPUT(){ return document.getElementById("bitsMetaCopyOutputFormatTextbox"); },
+	get REG_OUTPUT(){ return document.getElementById("bitsMetaCopyOutputRegExpTextbox"); },
+	get REG_I()      { return document.getElementById("bitsMetaCopyOutputRegExpI"); },
+	get REG_G()      { return document.getElementById("bitsMetaCopyOutputRegExpG"); },
+	get REG_M()      { return document.getElementById("bitsMetaCopyOutputRegExpM"); },
+	get REP_OUTPUT(){ return document.getElementById("bitsMetaCopyOutputReplaceTextbox"); },
+	get SMP_OUTPUT(){ return document.getElementById("bitsMetaOutputSample"); },
+
+	get xmldoc()     { return this._xmldoc; },
+	set xmldoc(aVal){ this._xmldoc = aVal; this.rebuild(); },
+
+/////////////////////////////////////////////////////////////////////
+// ã¡ãœãã
+/////////////////////////////////////////////////////////////////////
+	init : function(aEvent){
+		var outputitems = null;
+		var results = this.XPath.evaluateArray('/METACAPTURE[1]/OUTPUT_ITEMS[1]',this.xmldoc);
+		if(!results || results.length == 0){
+			outputitems = this.xmldoc.createElement("OUTPUT_ITEMS");
+			this.xmldoc.documentElement.appendChild(outputitems);
+		}else{
+			outputitems = results[0];
+			this.CHK_ANCHOR.checked = (results[0].getAttribute("checked")=="true"?true:false);
+		}
+
+		results = this.XPath.evaluateArray('/METACAPTURE[1]/OUTPUT_ITEMS[1]/OUTPUT_ITEM',this.xmldoc);
+		if(!results || results.length == 0){
+			var outputitem = this.xmldoc.createElement("OUTPUT_ITEM");
+			outputitem.setAttribute("format","");
+			outputitems.appendChild(outputitem);
+		}else{
+			this.FMT_OUTPUT.value = results[0].getAttribute("format");
+			this.REG_OUTPUT.value = results[0].getAttribute("regexp");
+			this.REP_OUTPUT.value = results[0].getAttribute("replace");
+			this.CHK_HASH.checked = (results[0].getAttribute("location_hash")=="true"?true:false);
+			this.REG_I.checked = (results[0].getAttribute("regexp_i")=="true"?true:false);
+			this.REG_G.checked = (results[0].getAttribute("regexp_g")=="true"?true:false);
+			this.REG_M.checked = (results[0].getAttribute("regexp_m")=="true"?true:false);
+		}
+
+		this.rebuild();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	regexpInput : function(aEvent){
+		bitsMetaCaptureDialog.itemChecked();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	outputInput : function(aEvent){
+		if(this.FMT_OUTPUT.value.length){
+			this.ADD.removeAttribute("disabled");
+		}else{
+			this.ADD.setAttribute("disabled","true");
+		}
+		bitsMetaCaptureDialog.itemChecked();
+	},
+
+/////////////////////////////////////////////////////////////////////
+// TREE è¡šç€ºå¶åŸ¡é¢é£
+/////////////////////////////////////////////////////////////////////
+	get rowItems(){
+		return this.XPath.evaluateArray('/METACAPTURE[1]/OUTPUT_ITEMS[1]/OUTPUT_ITEM',this.xmldoc);
+	},
+	get rowCount(){
+		var results = this.rowItems;
+		return results.length;
+	},
+	getCellText : function(row,column){
+		var results = this.rowItems;
+		if(!results[row]) return null;
+		if(column.id == "bitsMetaCopyOutputTreeFormatCol"){
+			return results[row].getAttribute("format");
+		}else if(column.id == "bitsMetaCopyOutputTreeRxgexpCol"){
+			return results[row].getAttribute("regexp");
+		}else if(column.id == "bitsMetaCopyOutputTreeRxgexpFlagCol"){
+			var text = "";
+			text += (results[row].getAttribute("location_hash")=="true"?"#":"");
+			text += (results[row].getAttribute("regexp_i")=="true"?"i":"");
+			text += (results[row].getAttribute("regexp_g")=="true"?"g":"");
+			text += (results[row].getAttribute("regexp_m")=="true"?"m":"");
+			return text;
+		}else if(column.id == "bitsMetaCopyOutputTreeReplaceCol"){
+			return results[row].getAttribute("replace");
+		}else{
+			return null;
+		}
+	},
+	getCellValue : function(row,column){
+		var results = this.rowItems;
+		if(!results[row]) return false;
+		if(column.id == "bitsMetaCopyTagRxgexpTreeUseCol"){
+			return (results[row].getAttribute("use") == "true" ? true : false);
+		}
+		return true;
+	},
+	setTree: function(treebox){ this.treebox = treebox; },
+	isEditable: function(row,column){
+		if(column.id == "bitsMetaCopyTagRxgexpTreeUseCol"){
+			return true;
+		}else{
+			return false;
+		}
+	},
+	isContainer: function(row){ return false; },
+	isSeparator: function(row){ return false; },
+	isSorted: function(){ return true; },
+	getLevel: function(row){ return 0; },
+	getImageSrc: function(row,column){ return null; },
+	getRowProperties: function(row,prop){},
+	getCellProperties: function(row, column, prop){},
+	getColumnProperties: function(column, element, prop){},
+	cycleHeader : function(col){},
+	setCellText : function(row,column,text){},
+	setCellValue : function(row,column,value){
+		var results = this.rowItems;
+		if(!results[row]) return;
+		if(column.id == "bitsMetaCopyTagRxgexpTreeUseCol"){
+			results[row].setAttribute("use",value);
+			this.itemChecked();
+		}
+	},
+  getParentIndex: function(idx){ return -1; },
+	canDrop : function(index, orient){
+		return false;
+	},
+	onDrop : function(row, orient){
+		bitsMetaCaptureDialog._dump("onDrop()");
+	},
+	drop : function(row, orient){
+		bitsMetaCaptureDialog._dump("drop()");
+	},
+
+
+/////////////////////////////////////////////////////////////////////
+	rebuild : function(){
+		this.TREE.view = bitsMetaCaptureDialogOutputTree;
+		if(this.rowCount > 0 && this.TREE.view.selection.count == 0){
+			this.TREE.view.selection.select(0);
+			var results = this.rowItems;
+			for(var i=0;i<results.length;i++){
+				if(results[i].getAttribute("selected") != "true") continue;
+				this.TREE.view.selection.select(i);
+				this.TREE.treeBoxObject.ensureRowIsVisible(i);
+				break;
+			}
+			this.onClick();
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+// TREE ã€ãã³ãé¢é£
+/////////////////////////////////////////////////////////////////////
+	onClick : function(aEvent){
+		if(this.TREE.view.selection.count == 0) return false;
+		var idxList = this.getSelection();
+		if(this.validateMultipleSelection(idxList) == false) return false;
+		this.DEL.removeAttribute("disabled");
+		var row = idxList[0];
+		var results = this.rowItems;
+		var format = results[row].getAttribute("format");
+		format = format.replace(/\\n/g,"\n");
+		this.FMT_OUTPUT.value = format;
+		this.REG_OUTPUT.value = results[row].getAttribute("regexp");
+		this.REP_OUTPUT.value = results[row].getAttribute("replace");
+		this.CHK_HASH.checked = (results[row].getAttribute("location_hash")=="true"?true:false);
+		this.REG_I.checked = (results[row].getAttribute("regexp_i")=="true"?true:false);
+		this.REG_G.checked = (results[row].getAttribute("regexp_g")=="true"?true:false);
+		this.REG_M.checked = (results[row].getAttribute("regexp_m")=="true"?true:false);
+		var selnodes = this.XPath.evaluateArray('/METACAPTURE[1]/OUTPUT_ITEMS[1]/OUTPUT_ITEM[@selected="true"]',this.xmldoc);
+		for(var i=0;i<selnodes.length;i++){
+			selnodes[i].removeAttribute("selected");
+		}
+		results[row].setAttribute("selected","true")
+		this.outputInput();
+	},
+
+	onEdit : function(aEvent){
+		if(this.CHK_EDIT.checked){
+			this.GRD_EDIT.removeAttribute("hidden");
+			this.VBOX_EDIT.removeAttribute("hidden");
+		}else{
+			this.GRD_EDIT.setAttribute("hidden","true");
+			this.VBOX_EDIT.setAttribute("hidden","true");
+		}
+	},
+
+	onAdd : function(aEvent){
+		var selnodes = this.XPath.evaluateArray('/METACAPTURE[1]/OUTPUT_ITEMS[1]/OUTPUT_ITEM[@selected="true"]',this.xmldoc);
+		for(var i=0;i<selnodes.length;i++){
+			selnodes[i].removeAttribute("selected");
+		}
+		var elemOutputItems = null;
+		var results = this.XPath.evaluateArray('/METACAPTURE[1]/OUTPUT_ITEMS[1]',this.xmldoc);
+		if(!results || results.length == 0){
+			elemOutputItems = this.xmldoc.createElement("OUTPUT_ITEMS");
+			this.xmldoc.documentElement.appendChild(elemOutputItems);
+		}else{
+			elemOutputItems = results[0];
+		}
+		var format = this.FMT_OUTPUT.value;
+		format = format.replace(/\x0D\x0A|\x0D|\x0A/g,"\\n");
+		var node = this.xmldoc.createElement("OUTPUT_ITEM");
+		node.setAttribute("format",format);
+		node.setAttribute("regexp",this.REG_OUTPUT.value);
+		node.setAttribute("replace",this.REP_OUTPUT.value);
+		node.setAttribute("location_hash",this.CHK_HASH.checked);
+		node.setAttribute("regexp_i",this.REG_I.checked);
+		node.setAttribute("regexp_g",this.REG_G.checked);
+		node.setAttribute("regexp_m",this.REG_M.checked);
+		node.setAttribute("selected","true");
+		elemOutputItems.appendChild(node);
+		if(this.xmlflash) this.xmlflash();
+		this.TREE.view.selection.clearSelection();
+		this.rebuild();
+	},
+
+	onDel : function(aEvent){
+		if(this.TREE.view.selection.count == 0) return false;
+		var idxList = this.getSelection();
+		if(this.validateMultipleSelection(idxList) == false) return false;
+		if(!this.confirmRemovingFor()) return false;
+		var results = this.rowItems;
+		var i;
+		for(i=idxList.length-1;i>=0;i--){
+			var row = idxList[i];
+			if(!results[row]) continue;
+			results[row].parentNode.removeChild(results[row]);
+		}
+		if(this.xmlflash) this.xmlflash();
+		if(this.rowCount == 0) this.TREE.view.selection.clearSelection();
+		this.rebuild();
+		var idxList = this.getSelection();
+		if(this.rowCount == 0 || idxList.length == 0 || this.validateMultipleSelection(idxList) == false){
+			this.DEL.setAttribute("disabled","true");
+		}else{
+			this.DEL.removeAttribute("disabled");
+		}
+		this._changed = true;
+		this.TREE.focus();
+	},
+
+	confirmRemovingFor : function(){
+		try{
+			return this.Common.confirm( this.STRING.getString("CONFIRM_DELETE") );
+			return true;
+		}catch(e){
+			return false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getSelection : function(){
+		var ret = [];
+		var rc;
+		var i;
+		for(rc=0;rc<this.TREE.view.selection.getRangeCount();rc++){
+			var start = {}, end = {};
+			this.TREE.view.selection.getRangeAt(rc, start, end);
+			for(i=start.value;i<= end.value;i++){
+				if(!this.TREE.view.selection.isSelected(i)) continue;
+				ret.push(i);
+			}
+		}
+		return ret;
+	},
+
+	validateMultipleSelection : function(aIdxList){
+		if(aIdxList.length != this.TREE.view.selection.count){
+			alert(this.STRING.getString("ERROR_MULTIPLE_SELECTION"));
+			return false;
+		}
+		return true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.opener.top.bitsMarkingCollection._dump(aString);
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/metaCaptureDialogOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/metaCaptureDialogOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/metaCaptureDialogOverlay.xul	(revision 5703)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE overlay [
+<!ENTITY % markingcollectionDTD SYSTEM "chrome://markingcollection/locale/markingcollection.dtd" >
+%markingcollectionDTD;
+<!ENTITY % metaDTD SYSTEM "chrome://markingcollection/locale/meta.dtd" >
+%metaDTD;
+]>
+<overlay
+	id="metaCaptureDialogOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _metaCaptureDialogOverlayInit(aEvent){
+			var confirm = nsPreferences.getBoolPref("wiredmarker.meta.capture.confirm", true);
+			document.getElementById("mcMetaCaptureConfirm").setAttribute("checked",!confirm);
+		}
+		function _metaCaptureDialogOverlayDone(aEvent){
+
+		}
+		function _metaCaptureConfirmCommand(aEvent){
+			nsPreferences.setBoolPref("wiredmarker.meta.capture.confirm", !aEvent.target.checked);
+		}
+		window.addEventListener("load", _metaCaptureDialogOverlayInit, false);
+		window.addEventListener("unload", _metaCaptureDialogOverlayDone, false);
+	]]>
+	</script>
+	<groupbox id="mcMetaCaptureTabGroupBox" hidden="true">
+		<caption label="&meta.dialog.capture.groupbox.caption;" style="background-color:#fff;"/>
+		<checkbox id="mcMetaCaptureConfirm" label="&meta.dialog.capture.groupbox.checkbox.confirm;" oncommand="_metaCaptureConfirmCommand(event)"/>
+	</groupbox>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/metacapture.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/metacapture.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/metacapture.js	(revision 5703)
@@ -0,0 +1,410 @@
+var bitsMetaCapture = {
+	_init : false,
+	_xmlfile : null,
+	_xmldoc  : null,
+
+	get STRING(){ return document.getElementById("MarkingCollectionOverlayString"); },
+
+	get DataSource(){ return window.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.top.bitsObjectMng.Common;     },
+	get Database()   { return window.top.bitsObjectMng.Database;   },
+	get XML()        { return window.top.bitsObjectMng.XML;        },
+	get XPath()      { return window.top.bitsObjectMng.XPath;      },
+	get gBrowser()   { return window.top.bitsObjectMng.getBrowser();},
+
+	get xmldoc()     { return this._xmldoc; },
+	get xmlurl()     { return (this._xmlfile?this.Common.convertFilePathToURL(this._xmlfile.path):""); },
+	get xmlfile()    { return this._xmlfile; },
+
+	get TOKEN_HA()    { return "HYPER_ANCHOR";},
+	get TOKEN_TITLE(){ return "WM_TITLE";},
+	get TOKEN_NOTE()  { return "WM_NOTE";},
+	get TOKEN_META()  { return "WM_META";},
+
+	get TOKEN_MEDLINE_PMCID(){ return "MEDLINE\\.PMCID";},
+	get TOKEN_MEDLINE_PMID()  { return "MEDLINE\\.PMID";},
+	get TOKEN_MEDLINE_SO()    { return "MEDLINE\\.SO";},
+
+/////////////////////////////////////////////////////////////////////
+	init : function(aEvent){
+		if(!this._init){
+			var extensionDir = this.Common.getExtensionDir().clone();
+			if(extensionDir){
+				this._xmlfile = extensionDir.clone();
+				this._xmlfile.append("metacapture.xml");
+			}
+			this._init = true;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	rebuild : function(){
+		if(this._xmlfile){
+			if(!this._xmlfile.exists()){
+				var aContent = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
+				aContent += '<!DOCTYPE METACAPTURE>\n';
+				aContent += '<METACAPTURE>\n';
+				aContent += '\t<CAPTURE_ITEMS>\n';
+				aContent += '\t\t<CAPTURE_ITEM tag="TITLE" value="#text"/>\n';
+				aContent += '\t</CAPTURE_ITEMS>\n';
+				aContent += '\t<META_REGEXP_ITEMS>\n';
+				aContent += '\t\t<META_REGEXP_ITEM tag="TITLE" use="true" regexp="" format=""/>\n';
+				aContent += '\t</META_REGEXP_ITEMS>\n';
+				aContent += '\t<COPY_ITEMS>\n';
+				aContent += '\t\t<COPY_ITEM name="hyperanchor" checked="true" selected="false"/>\n';
+				aContent += '\t\t<COPY_ITEM name="title" checked="true" selected="false"/>\n';
+				aContent += '\t\t<COPY_ITEM name="note" checked="true" selected="false"/>\n';
+				aContent += '\t\t<COPY_ITEM name="meta" checked="true" selected="false"/>\n';
+				aContent += '\t</COPY_ITEMS>\n';
+				aContent += '\t<OUTPUT_ITEMS>\n';
+				aContent += '\t\t<OUTPUT_ITEM format="WM_TITLE (WM_META)" regexp="Section (\\d+)/CHAPTER (\\d+)/(.+) from Gray" replace="$1-$2, $3, Gray\'s Anatomy 20th ED" location_hash="true" regexp_i="false" regexp_g="true" regexp_m="false" selected="true"/>\n';
+				aContent += '\t\t<OUTPUT_ITEM format="WM_TITLE [MEDLINE.SO]" regexp="\\.?\\s*Epub \\d{4} .+]\$" replace="]" location_hash="true" regexp_i="false" regexp_g="true" regexp_m="false"/>\n';
+				aContent += '\t\t<OUTPUT_ITEM format="WM_TITLE [PMID:MEDLINE.PMID]" regexp="" replace="" location_hash="true" regexp_i="false" regexp_g="true" regexp_m="false"/>\n';
+				aContent += '\t</OUTPUT_ITEMS>\n';
+				aContent += '</METACAPTURE>\n';
+				this.Common.writeFile(this._xmlfile,aContent,"UTF-8");
+			}
+			function _loadXMLDocument(pUri){
+				if(pUri == undefined) return undefined;
+				var xmlDocument = window.top.bitsMarkingCollection.loadXMLDocument(pUri);
+				if(xmlDocument){
+					return xmlDocument;
+				}else{
+					return undefined;
+				}
+			}
+			function _createXMLDocument(aXMLFile){
+				if(!aXMLFile) return undefined;
+				try{
+					return _loadXMLDocument(bitsSubstitutionTree.Common.IO.newFileURI(aXMLFile).spec);
+				}catch(ex){
+					bitsSubstitutionTree._dump("bitsSubstitutionTree._createXMLDocument():"+ ex);
+					return undefined;
+				}
+			}
+			this._xmldoc = _createXMLDocument(this._xmlfile);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	xmlflash : function(){
+		if(bitsMetaCapture.xmldoc && bitsMetaCapture._xmlfile){
+			var s = new XMLSerializer();
+			var xml = s.serializeToString(bitsMetaCapture.xmldoc);
+			bitsMetaCapture.Common.writeFile(bitsMetaCapture._xmlfile, xml+"\n","UTF-8");
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+// äžå¿äºææ§ã®çºã«å®çŸ©ããŠãã
+/////////////////////////////////////////////////////////////////////
+	copyToClipBoardByHyperanchor : function(aOID,aDBType){
+		this.copyToClipBoard(aOID,aDBType,"copy");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	copyToClipBoard : function(aOID,aDBType,aMode){
+		var obj = bitsMetaCapture.Database.getObject({oid:aOID},aDBType);
+		if(obj && obj.length>0){
+			var xmldoc = null;
+			if(aMode == "copy" || aMode == "copyformat" || aMode == "note" || aMode == "meta" || aMode == "format" || aMode == "setting"){
+				var parser = new DOMParser();
+				try{ xmldoc = parser.parseFromString(obj[0].oid_property,"text/xml"); }catch(e){xmldoc = null; }
+				parser = undefined;
+			}
+			if(aMode == "copy"){
+				var copytext = "";
+				if(xmldoc && xmldoc.documentElement){
+					var xmlnode = xmldoc.getElementsByTagName("HYPER_ANCHOR")[0];
+					if(xmlnode) copytext = xmlnode.textContent;
+					if(!copytext) copytext = obj[0].con_url;
+				}
+				this.textToClipBoard(copytext);
+
+			}else if(aMode == "note"){
+				var copytext = "";
+				if(xmldoc && xmldoc.documentElement){
+					var xmlnode = xmldoc.getElementsByTagName("NOTE")[0];
+					if(xmlnode) copytext = xmlnode.textContent;
+				}
+				this.textToClipBoard(copytext);
+
+			}else if(aMode == "pagetitle"){
+				this.textToClipBoard(obj[0].doc_title);
+
+			}else if(aMode == "meta"){
+				var text_arr = [];
+				this.rebuild();
+				var capture_items = this.XPath.evaluateArray('/METACAPTURE[1]/CAPTURE_ITEMS[1]/CAPTURE_ITEM',this.xmldoc);
+				if(capture_items && capture_items.length > 0){
+					var pt_flag = (capture_items.length>1?true:false);
+					for(var i=0;i<capture_items.length;i++){
+						var tag = capture_items[i].getAttribute("tag");
+						if(tag == "TITLE"){
+							text_arr.push((pt_flag?tag+"\t\t":"")+obj[0].doc_title);
+						}else{
+							var name = capture_items[i].getAttribute("name");
+							var aExpr;
+							if(name){
+								aExpr = '//METACAPTURE[@tag="'+tag+'" and @name="'+name+'"]';
+							}else{
+								aExpr = '//METACAPTURE[@tag="'+tag+'"]';
+								name = ""
+							}
+							var results = this.XPath.evaluateArray(aExpr,xmldoc);
+							if(results && results.length > 0){
+								for(var j=0;j<results.length;j++){
+									text_arr.push((pt_flag?tag+"\t"+name+"\t":"")+results[j].getAttribute("content"));
+								}
+							}
+						}
+					}
+				}
+				this.textToClipBoard(text_arr.join("\n"));
+
+			}else if(aMode == "copytext" || aMode == "title"){
+				this.textToClipBoard(obj[0].oid_title);
+
+			}else if(aMode == "format"){
+					this.rebuild();
+					this.textToClipBoard(this.makeFormatText(this.xmldoc,{
+						oid_property : xmldoc,
+						doc_title    : obj[0].doc_title,
+						oid_title    : obj[0].oid_title,
+						con_url      : obj[0].con_url
+					}));
+
+			}else if(aMode == "copyformat" || aMode == "setting"){
+				setTimeout(function(){
+					bitsMetaCapture.rebuild();
+
+					var result = {};
+					result.accept = false;
+					result.xmldoc = bitsMetaCapture.xmldoc;
+					result.xmlfile = bitsMetaCapture.xmlfile;
+					result.xmlflash = bitsMetaCapture.xmlflash;
+					result.makeFormatText = bitsMetaCapture.makeFormatText;
+					result.oid_property = xmldoc;
+					result.doc_title = obj[0].doc_title;
+					result.oid_title = obj[0].oid_title;
+					result.con_url = obj[0].con_url;
+					window.openDialog("chrome://markingcollection/content/metaCaptureDialog.xul", "", "chrome,centerscreen,modal,dialog,resizable=yes", result);
+					if(result.accept){
+						bitsMetaCapture.xmlflash();
+					}
+				},0);
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	textToClipBoard : function(aText){
+		if(aText){
+			var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
+			str.data=aText;
+			var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
+			trans.addDataFlavor("text/unicode");
+			trans.setTransferData("text/unicode",str,aText.length*2);
+			var clip = Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);
+			clip.emptyClipboard(clip.kGlobalClipboard);
+			clip.setData(trans,null,clip.kGlobalClipboard);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	makeFormatText : function(aXMLDoc,aData){
+		if(!aXMLDoc || !aData) return "";
+		var setting = {};
+		var format_text = {};
+		var results = this.XPath.evaluateArray('/METACAPTURE[1]/OUTPUT_ITEMS[1]/OUTPUT_ITEM[@selected="true"]',aXMLDoc);
+		if(results && results.length > 0){
+			setting.format = results[0].getAttribute("format");
+			setting.regexp = results[0].getAttribute("regexp");
+			setting.replace = results[0].getAttribute("replace");
+			setting.location_hash = (results[0].getAttribute("location_hash")=="true"?true:false);
+			setting.regexp_i = (results[0].getAttribute("regexp_i")=="true"?true:false);
+			setting.regexp_g = (results[0].getAttribute("regexp_g")=="true"?true:false);
+			setting.regexp_m = (results[0].getAttribute("regexp_m")=="true"?true:false);
+		}else{
+			return "";
+		}
+		var results = this.XPath.evaluateArray('/METACAPTURE[1]/OUTPUT_ITEMS[1]',aXMLDoc);
+		if(results && results.length > 0){
+			setting.anchor_checked = (results[0].getAttribute("anchor_checked")=="true"?true:false);
+		}
+		var value = aData.con_url;
+		var elem = aData.oid_property.getElementsByTagName("HYPER_ANCHOR")[0];
+		if(elem) value = elem.textContent;
+		if(value && setting.location_hash){
+			var hashReg = new RegExp("^(.+)(#"+bitsHyperAnchorDummy._anchor_title + ")");
+			try{var textContent = aData.oid_property.getElementsByTagName("LOCATION_HASH")[0].textContent;}catch(e){textContent = "";}
+			value = value.replace(hashReg,"$1#"+ textContent +"$2");
+		}
+		format_text.hyperanchor = value;
+		if(aData.oid_title){
+			format_text.title = aData.oid_title;
+		}else{
+			format_text.title = "";
+		}
+		var value = "";
+		var elem = aData.oid_property.getElementsByTagName("NOTE")[0];
+		if(elem) value = elem.textContent;
+		format_text.note = value;
+		var value = "";
+		var attrs = [];
+		var attrs_hash = {};
+		var regexps = this.XPath.evaluateArray('/METACAPTURE[1]/META_REGEXP_ITEMS[1]/META_REGEXP_ITEM[@use="true"]',aXMLDoc);
+		for(var regcnt=0;regcnt<regexps.length;regcnt++){
+			var temp_attrs = [];
+			var nodeName = "tag";
+			var nodeValue = regexps[regcnt].getAttribute(nodeName);
+			if(nodeValue != null && nodeValue != "") temp_attrs.push('@'+nodeName+'="'+nodeValue+'"');
+			var nodeName = "name";
+			var nodeValue = regexps[regcnt].getAttribute(nodeName);
+			if(nodeValue != null && nodeValue != "") temp_attrs.push('@'+nodeName+'="'+nodeValue+'"');
+			if(temp_attrs.length == 0) continue;
+			var attrs_key = temp_attrs.join(" and ");
+			if(attrs_hash[attrs_key] == undefined){
+				attrs.push(attrs_key);
+				attrs_hash[attrs_key] = [];
+			}
+			var temp_attrs = {};
+			var nodeName = "regexp";
+			var nodeValue = regexps[regcnt].getAttribute(nodeName);
+			if(nodeValue != null) temp_attrs[nodeName] = nodeValue;
+			var nodeName = "format";
+			var nodeValue = regexps[regcnt].getAttribute(nodeName);
+			if(nodeValue != null) temp_attrs[nodeName] = nodeValue;
+			attrs_hash[attrs_key].push(temp_attrs);
+		}
+		for(var regcnt=0;regcnt<attrs.length;regcnt++){
+			var attrs_key = attrs[regcnt];
+			if(attrs_key.indexOf('@tag="TITLE"')>=0){
+				var textContent = aData.doc_title;
+				for(var rcnt=0;rcnt<attrs_hash[attrs_key].length;rcnt++){
+					var regexp = attrs_hash[attrs_key][rcnt].regexp;
+					var format = attrs_hash[attrs_key][rcnt].format;
+					if(!regexp || regexp == "") continue;
+					try{regexp = new RegExp(regexp);}catch(e){regexp=null;}
+					if(!regexp) continue;
+					if(!textContent.match(regexp)) continue;
+					textContent = textContent.replace(regexp,format);
+				}
+				value += textContent;
+			}else{
+				var nodes = this.XPath.evaluateArray("//METACAPTURE[" + attrs_key + "]",aData.oid_property);
+				for(var ncnt=0;ncnt<nodes.length;ncnt++){
+					var elem = nodes[ncnt];
+					var textContent = elem.getAttribute("content");
+					if(textContent == null || textContent == "") textContent = elem.textContent;
+					for(var rcnt=0;rcnt<attrs_hash[attrs_key].length;rcnt++){
+						var regexp = attrs_hash[attrs_key][rcnt].regexp;
+						var format = attrs_hash[attrs_key][rcnt].format;
+						if(!regexp || regexp == "") continue;
+						try{regexp = new RegExp(regexp);}catch(e){regexp=null;}
+						if(!regexp) continue;
+						if(!textContent.match(regexp)) continue;
+						textContent = textContent.replace(regexp,format);
+					}
+					value += textContent;
+				}
+			}
+		}
+		format_text.meta = value;
+		format_text.medline = {};
+		var value = "";
+		var elem = aData.oid_property.getElementsByTagName("PMCID")[0];
+		if(elem) value = elem.textContent;
+		format_text.medline.pmcid = value;
+		var value = "";
+		var elem = aData.oid_property.getElementsByTagName("PMID")[0];
+		if(elem) value = elem.textContent;
+		format_text.medline.pmid = value;
+		var value = "";
+		var elem = aData.oid_property.getElementsByTagName("SO")[0];
+		if(elem) value = elem.textContent;
+		format_text.medline.so = value;
+		var output = setting.format;
+		var flag = "";
+		flag += (setting.regexp_i?'i':'');
+		flag += (setting.regexp_g?'g':'');
+		flag += (setting.regexp_m?'m':'');
+		try{var regexp = (setting.regexp?new RegExp(setting.regexp,flag):null);}catch(e){this._dump(e);}
+		var replace_text = setting.replace;
+		var replacement_key = null;
+		replacement_key = new RegExp(bitsMetaCapture.TOKEN_HA,'g');
+		output = output.replace(replacement_key,format_text.hyperanchor);
+		replacement_key = new RegExp(bitsMetaCapture.TOKEN_TITLE,'g');
+		output = output.replace(replacement_key,format_text.title);
+		replacement_key = new RegExp(bitsMetaCapture.TOKEN_NOTE,'g');
+		output = output.replace(replacement_key,format_text.note);
+		replacement_key = new RegExp(bitsMetaCapture.TOKEN_META,'g');
+		output = output.replace(replacement_key,format_text.meta);
+		replacement_key = new RegExp(bitsMetaCapture.TOKEN_MEDLINE_PMCID,'g');
+		output = output.replace(replacement_key,format_text.medline.pmcid);
+		replacement_key = new RegExp(bitsMetaCapture.TOKEN_MEDLINE_PMID,'g');
+		output = output.replace(replacement_key,format_text.medline.pmid);
+		replacement_key = new RegExp(bitsMetaCapture.TOKEN_MEDLINE_SO,'g');
+		output = output.replace(replacement_key,format_text.medline.so);
+		if(regexp && output.match(regexp)) output = output.replace(regexp,replace_text);
+		if(setting.anchor_checked) output = '<a href="'+format_text.hyperanchor+'">'+output+'</a>';
+		output = output.replace(/\\n/g,"\n");
+		return output;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	capture : function(aDoc,aProperty){
+		var confirm = nsPreferences.getBoolPref("wiredmarker.meta.capture.confirm", true);
+		if(!confirm) return aProperty;
+		this.rebuild();
+		var capture_items = this.XPath.evaluateArray('/METACAPTURE[1]/CAPTURE_ITEMS[1]/CAPTURE_ITEM[@tag!="TITLE"]',this.xmldoc);
+		if(!capture_items || capture_items.length == 0) return aProperty;
+		if(!aProperty || aProperty == "") aProperty = "<PROPERTY/>";
+		var parser = new DOMParser();
+		var xmldoc = parser.parseFromString(aProperty,"text/xml");
+		var extnode = null
+		var results = this.XPath.evaluateArray('//EXTENDED_MESSAGE',xmldoc);
+		if(!results || results.length == 0){
+			extnode = xmldoc.createElement("EXTENDED_MESSAGE");
+			xmldoc.documentElement.appendChild(extnode);
+		}else{
+			extnode = results[0];
+		}
+		var metanodes = null;
+		var results = this.XPath.evaluateArray('//METACAPTURES',xmldoc);
+		if(!results || results.length == 0){
+			metanodes = xmldoc.createElement("METACAPTURES");
+			extnode.appendChild(metanodes);
+		}else{
+			metanodes = results[0];
+		}
+		for(var i=0;i<capture_items.length;i++){
+			var tag = capture_items[i].getAttribute("tag");
+			var name = capture_items[i].getAttribute("name");
+			var value = capture_items[i].getAttribute("value");
+			if(!value) value = "#text";
+			var aExpr = '//'+tag.toLowerCase();
+			if(name) aExpr += '[@name="'+name+'"]';
+			var results = this.XPath.evaluateArray(aExpr,aDoc);
+			if(results && results.length > 0){
+				for(var j=0;j<results.length;j++){
+					var metanode = xmldoc.createElement("METACAPTURE");
+					metanode.setAttribute("tag",tag);
+					if(name) metanode.setAttribute("name",name);
+					metanode.setAttribute("content",(value=="#text"?results[j].textContent:results[j].getAttribute(value)));
+					metanodes.appendChild(metanode);
+				}
+			}
+		}
+		var s = new XMLSerializer();
+		return s.serializeToString(xmldoc);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+}
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/objectmng.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/objectmng.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/objectmng.js	(revision 5703)
@@ -0,0 +1,5403 @@
+var bitsObjectMng = {
+	uri       : "",
+	_index_arr : null,
+/////////////////////////////////////////////////////////////////////
+	get STRING(){ return document.getElementById("ObjectManagerOverlayString"); },
+	get NS_OBJECTMANAGEMENT(){
+		return "http://www.bits.cc/Wired-Marker/wiredmarker-rdf#"
+	},
+	get editmodeid(){
+		return "bitsExtentionEditMode";
+	},
+	get isEdit(){
+		var doc = bitsObjectMng.getBrowser().contentDocument;
+		var elem_edit = doc.getElementById(bitsObjectMng.editmodeid);
+		return elem_edit?true:false;
+	},
+	set isEdit(pValue){
+		var doc = bitsObjectMng.getBrowser().contentDocument;
+		var elem_edit = doc.getElementById(bitsObjectMng.editmodeid);
+		if(!elem_edit){
+			var elem_body = doc.body;
+			elem_edit = doc.createElement("span");
+			elem_edit.setAttribute("id",bitsObjectMng.editmodeid);
+			elem_body.appendChild(elem_edit);
+		}
+		return;
+	},
+/////////////////////////////////////////////////////////////////////
+	init : function(){
+		bitsObjectMng.DataSource.init();
+	},
+/////////////////////////////////////////////////////////////////////
+	done : function(){
+		bitsObjectMng.DataSource.save(bitsObjectMng.getBrowser().contentDocument);
+		bitsObjectMng.DataSource.done();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	load : function(event){
+		bitsObjectMng.DataSource.load(event);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	save : function(event){
+		bitsObjectMng.DataSource.save(event);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	saveload : function(event){
+		bitsObjectMng.DataSource.saveload(event);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getBrowser : function(){
+		return gBrowser;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		if(nsPreferences.getBoolPref("wiredmarker.debug", false)){
+			window.dump(bitsObjectMng.Common.convertFormUnicode(aString,"UTF-8")+"\n");
+			var dumpString = new String(aString);
+			var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"]
+			                      .getService(Components.interfaces.nsIConsoleService);
+			aConsoleService.logStringMessage(dumpString);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump2 : function(aString){
+		if(nsPreferences.getBoolPref("wiredmarker.debug", false)){
+			var dumpString = new String(aString);
+			var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
+			aConsoleService.logStringMessage(dumpString);
+			window.dump(aString+"\n");
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////
+	Common : {
+
+		get RDF()     { return Components.classes['@mozilla.org/rdf/rdf-service;1'].getService(Components.interfaces.nsIRDFService); },
+		get RDFC()    { return Components.classes['@mozilla.org/rdf/container;1'].getService(Components.interfaces.nsIRDFContainer); },
+		get RDFCU()   { return Components.classes['@mozilla.org/rdf/container-utils;1'].getService(Components.interfaces.nsIRDFContainerUtils); },
+		get DIR()     { return Components.classes['@mozilla.org/file/directory_service;1'].getService(Components.interfaces.nsIProperties); },
+		get IO()      { return Components.classes['@mozilla.org/network/io-service;1'].getService(Components.interfaces.nsIIOService); },
+		get UNICODE(){ return Components.classes['@mozilla.org/intl/scriptableunicodeconverter'].getService(Components.interfaces.nsIScriptableUnicodeConverter); },
+		get WINDOW()  { return Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(Components.interfaces.nsIWindowMediator); },
+		get PROMPT()  { return Components.classes['@mozilla.org/embedcomp/prompt-service;1'].getService(Components.interfaces.nsIPromptService); },
+		get PREF()    { return Components.classes['@mozilla.org/preferences;1'].getService(Components.interfaces.nsIPrefBranch); },
+		get JSSSL()   { return Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader); },
+		get ENV()     { return Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment); },
+		get FAVICON(){ return Components.classes["@mozilla.org/browser/favicon-service;1"].getService(Components.interfaces.nsIFaviconService); },
+		get MIME()    { return Components.classes["@mozilla.org/mime;1"].getService(Components.interfaces.nsIMIMEService); },
+		get STORAGE(){ return Components.classes["@mozilla.org/storage/service;1"].getService(Components.interfaces.mozIStorageService); },
+		get DNS()     { return Components.classes['@mozilla.org/network/dns-service;1'].getService(Components.interfaces.nsIDNSService); },
+		get FONT()    { return Components.classes['@mozilla.org/gfx/fontenumerator;1'].getService(Components.interfaces.nsIFontEnumerator); },
+
+/////////////////////////////////////////////////////////////////////
+		newItem : function(aID){
+			return {
+				id          : aID || "",
+				type        : "",
+				title       : "",
+				chars       : "",
+				comment     : "" ,
+				icon        : "",
+				source      : "",
+				uri         : "",
+				style       : "",
+				cssrule     : "",
+				editmode    : "",
+				pfid        : "",
+				pfid_order  : "",
+				dbtype      : "",
+				addon_id    : "",
+				contextmenu : "",
+				shortcut    : ""
+			};
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getExtensionDir : function(){
+			var dir;
+			try{
+				var isDefault = this.PREF.getBoolPref("objectmng.data.default");
+				dir = this.PREF.getComplexValue("objectmng.data.path", Components.interfaces.nsIPrefLocalizedString).data;
+				dir = this.convertPathToFile(dir);
+			}catch(ex){
+				isDefault = true;
+			}
+			if(isDefault){
+				dir = this.DIR.get("ProfD", Components.interfaces.nsIFile);
+				dir.append("ObjectManagement");
+				if(!dir.exists()){
+					dir = this.DIR.get("ProfD", Components.interfaces.nsIFile);
+					dir.append(bitsObjectMng.STRING.getString("APP_TITLE"));
+				}
+			}
+			if(!dir.exists()) dir.create(dir.DIRECTORY_TYPE, 0700);
+			return dir;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getContentDir : function(){
+			var dir = this.getExtensionDir().clone();
+			dir.append("data");
+			if(!dir.exists()) dir.create(dir.DIRECTORY_TYPE, 0700);
+			return dir;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getUser : function(){
+			try{
+				var user = this.ENV.get("USER");
+				if(!user || user == "") user = this.ENV.get("USERNAME");
+			}catch(ex){}
+			return user;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getHostname : function(){
+			try{
+				var user = this.ENV.get("HOSTNAME");
+				if(!user || user == "") user = this.ENV.get("COMPUTERNAME");
+			}catch(ex){}
+			return user;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getLang : function(){
+			var LANG = "Shift_jis";
+			try{
+				var lang = this.ENV.get("LANG");
+				if(lang && lang != "" && lang.match(/^ja_JP\.(.+)$/)) LANG = RegExp.$1;
+			}catch(ex){}
+			return LANG;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		alert : function(aMsg,aTitle,aWindow){
+			if(aTitle == undefined) aTitle = bitsObjectMng.STRING.getString("APP_DISP_TITLE");
+			if(aWindow == undefined) aWindow = window;
+			this.PROMPT.alert(aWindow, aTitle, aMsg);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		confirm : function(aMsg,aTitle,aFlag,aCheckMsg,aCheckState,aWindow){
+			var prompts = this.PROMPT;
+			if(aTitle == undefined) aTitle = bitsObjectMng.STRING.getString("APP_DISP_TITLE");
+			if(aFlag == undefined) aFlag = prompts.STD_YES_NO_BUTTONS + prompts.BUTTON_POS_1_DEFAULT;
+			if(aCheckState == undefined) aCheckState = {value: false};
+			if(aWindow == undefined) aWindow = window;
+			var button = prompts.confirmEx(aWindow, aTitle, aMsg, aFlag, "", "", "", aCheckMsg, aCheckState);
+			return button==0?true:false;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		prompt : function(aMsg,aTitle,aInput,aCheckMsg,aCheckState,aWindow){
+			var prompts = this.PROMPT;
+			if(aTitle == undefined) aTitle = bitsObjectMng.STRING.getString("APP_DISP_TITLE");
+			if(aInput == undefined) aInput = {value: ""};
+			if(aCheckState == undefined) aCheckState = {value: false};
+			if(aWindow == undefined) aWindow = window;
+			var result = prompts.prompt(aWindow, aTitle, aMsg, aInput, aCheckMsg, aCheckState);
+			if(result){
+				return {input:aInput.value,check:aCheckState.value};
+			}else{
+				return undefined;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		removeDirSafety : function(aDir, check){
+			var file;
+			var rtn = true;
+			try{
+				if(check && !aDir.leafName.match(/^\d{14}$/)) return;
+				var fileEnum = aDir.directoryEntries;
+				while(fileEnum.hasMoreElements()){
+					file = fileEnum.getNext().QueryInterface(Components.interfaces.nsIFile);
+					if(file.isFile()) file.remove(false);
+				}
+				file = aDir;
+				if(aDir.isDirectory()) aDir.remove(false);
+			}catch(ex){
+				bitsObjectMng._dump("ObjectManagement ERROR: Failed to remove file '" + file.leafName + "'.\n" + ex);
+				rtn = false;
+			}
+			return rtn;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getElemOffsetHeight : function(elem,height){
+			if(!elem) return 0;
+			if(!height) height = 0;
+			if(height < elem.offsetHeight) height = elem.offsetHeight;
+			for(var i=0;i<elem.childNodes.length;i++){
+				var c_elem = elem.childNodes[i];
+				if(c_elem.firstChild){
+					height = this.getElemOffsetHeight(c_elem,height);
+				}else{
+					if(height < c_elem.offsetHeight) height = c_elem.offsetHeight;
+				}
+			}
+			return height;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getElementById : function(pElemId){
+			try {
+				if(!pElemId || pElemId=="") return null;
+				var DOC = [];
+				if(gBrowser.contentWindow.frames){
+					for(var wincnt=0;wincnt<gBrowser.contentWindow.frames.length;wincnt++){
+						DOC.push(gBrowser.contentWindow.frames[wincnt].document);
+					}
+				}
+				DOC.push(gBrowser.contentDocument);
+				var elem = null;
+				var i;
+				var doc;
+				for(i=0;i<DOC.length;i++){
+					doc = DOC[i];
+					if(!doc) continue;
+					elem = doc.getElementById(pElemId);
+					if(elem) break;
+				}
+				return elem;
+			}catch(ex){
+				this._dump("bitsObjectMng.Common.getElementById():"+ex);
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		changeNodeStyleFromID : function(aSource,aStyle,pPfid,aID,aDBType){
+			if(!aID) return;
+			for(var i=0;i<gBrowser.browsers.length;i++){
+				var contentDocument = gBrowser.browsers[i].contentDocument;
+				var contentWindow = gBrowser.browsers[i].contentWindow;
+				var i;
+				var DOC = [];
+				if(contentWindow.frames){
+					for(var wincnt=0;wincnt<contentWindow.frames.length;wincnt++){
+						DOC.push(contentWindow.frames[wincnt].document);
+					}
+				}
+				DOC.push(contentDocument);
+				for(var j=0;j<DOC.length;j++){
+					var doc = DOC[j];
+					var xPathResult = bitsObjectMng.XPath.evaluate('//*[@id="'+aSource+'"]', doc);
+					for(var k=0;k<xPathResult.snapshotLength;k++){
+						var node = xPathResult.snapshotItem(k);
+						if(aID && aDBType) node.setAttribute("id",bitsMarker.id_key+aDBType+aID);
+						if(pPfid) node.setAttribute("pfid",pPfid);
+						if(aDBType) node.setAttribute("dbtype",aDBType);
+						if(aStyle){
+							node.setAttribute("style",aStyle);
+						}else{
+							node.removeAttribute("style");
+						}
+						if(aStyle && xPathResult.snapshotLength>1){
+							if(k==0){
+								node.style.borderRight = "";
+							}else if(k==(xPathResult.snapshotLength-1)){
+								node.style.borderLeft = "";
+							}else{
+								node.style.borderLeft = "";
+								node.style.borderRight = "";
+							}
+						}
+					}
+				}
+				DOC = undefined;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		doTopElement : function(pElemId,aStyle,aID,aDBType){
+			if(!pElemId || pElemId=="") return false;
+			var elem = this.getElementById(pElemId);
+			var rtnObj = null;
+			if(!elem && aID){
+				var DOC = [];
+				if(gBrowser.contentWindow.frames){
+					for(var wincnt=0;wincnt<gBrowser.contentWindow.frames.length;wincnt++){
+						DOC.push(gBrowser.contentWindow.frames[wincnt].document);
+					}
+				}
+				DOC.push(gBrowser.contentDocument);
+				rtnObj = bitsObjectMng.Database.getObjectFormID(aID,aDBType);
+				if(rtnObj){
+					for(var cnt=0;cnt<rtnObj.length;cnt++){
+						var rObj = rtnObj[cnt];
+						var doc = null;
+						for(var i=0;i<DOC.length;i++){
+							if(rObj.con_url == bitsAutocacheService.convertCacheURLToOriginalURL(this.getURLStringFromDocument(DOC[i]))){
+								doc = DOC[i];
+								break;
+							}
+						}
+						if(doc) bitsMarker.xPathMarker(doc,{start:rObj.bgn_dom,end:rObj.end_dom,context:rObj.oid_txt,con_url:rObj.con_url}, { id:rObj.oid, dbtype:rObj.dbtype, pfid:rObj.pfid, style:rObj.fid_style });
+					}
+				}
+				elem = this.getElementById(pElemId);
+			}
+			if(!elem) return false;
+			var xPathResult = bitsObjectMng.XPath.evaluate('//*[@id="'+elem.id+'"]', elem.ownerDocument);
+			var k;
+			var node;
+			var y_offs = -1;
+			var y_offs_temp;
+			var y_offs_elem = null;
+			for(k=0;k<xPathResult.snapshotLength;k++){
+				node = xPathResult.snapshotItem(k);
+				y_offs_temp = this.getPageOffsetTop(node);
+				if(y_offs == -1 || y_offs > y_offs_temp){
+					y_offs = y_offs_temp;
+					y_offs_elem = node;
+				}
+			}
+			if(y_offs_elem) elem = y_offs_elem;
+			if(y_offs < 0) y_offs = this.getPageOffsetTop( elem );
+			var height = this.getElemOffsetHeight( elem );
+			if(height>0){
+				y_offs -= 15;
+			}else{
+				if(elem.offsetHeight == 0) y_offs -= 15;
+			}
+			if(aStyle) this.changeNodeStyleFromID(pElemId,aStyle,(rtnObj && rtnObj.pdif)?rtnObj.pfid:undefined,aDBType);
+			var doc = elem.ownerDocument;
+			var win = doc.defaultView;
+			win.scroll( win.pageXOffset, y_offs );
+			return true;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		doTopElementIMG : function(aID,aDBType){
+			try{
+				if(!aID || aID=="") return false;
+				var elem = null;
+				var rtnObj = null;
+				if(!elem && aID){
+					var DOC = [];
+					if(gBrowser.contentWindow.frames){
+						for(var wincnt=0;wincnt<gBrowser.contentWindow.frames.length;wincnt++){
+							DOC.push(gBrowser.contentWindow.frames[wincnt].document);
+						}
+					}
+					DOC.push(gBrowser.contentDocument);
+					var doc = null;
+					rtnObj = bitsObjectMng.Database.getObjectFormID(aID,aDBType);
+					if(rtnObj){
+						var cnt;
+						var i;
+						var rObj;
+						for(cnt=0;cnt<rtnObj.length;cnt++){
+							rObj = rtnObj[cnt];
+							for(i=0;i<DOC.length;i++){
+								if(rObj.con_url == bitsAutocacheService.convertCacheURLToOriginalURL(this.getURLStringFromDocument(DOC[i]))){
+									doc = DOC[i];
+									break;
+								}
+							}
+							if(doc) break;
+						}
+					}
+					if(doc){
+						var aXPath = {};
+						rObj.bgn_dom.match(/(.+)\(([0-9]+)\)\(([0-9]+)\)/);
+						aXPath.startPath   = RegExp.$1;
+						aXPath.startOffset = RegExp.$2;
+						aXPath.startType   = RegExp.$3;
+						rObj.end_dom.match(/(.+)\(([0-9]+)\)\(([0-9]+)\)/);
+						aXPath.endPath   = RegExp.$1;
+						aXPath.endOffset = RegExp.$2;
+						aXPath.endType   = RegExp.$3;
+						if(rObj.bgn_dom != rObj.end_dom){
+							var startNode = bitsObjectMng.XPath.getCurrentNodeFromXPath(doc,aXPath.startPath,aXPath.startOffset,aXPath.startType);
+							if(!startNode || !startNode.node) return false;
+							var endNode = bitsObjectMng.XPath.getCurrentNodeFromXPath(doc,aXPath.endPath,aXPath.endOffset,aXPath.endType);
+							if(!endNode || !endNode.node) return false;
+							var range = doc.createRange();
+							try{
+								range.setStart(startNode.node, startNode.offset);
+								range.setEnd(endNode.node, endNode.offset);
+							}catch(e){
+								bitsObjectMng._dump("bitsObjectMng.Common.doTopElementIMG():"+e);
+								return false;
+							}
+							var nodeWalker = doc.createTreeWalker(range.commonAncestorContainer,NodeFilter.SHOW_ELEMENT,null,false);
+							if(nodeWalker){
+								var txtNode=nodeWalker.nextNode();
+								for(;txtNode;txtNode = nodeWalker.nextNode()){
+									if(!range) continue;
+									if(this.rangeCompareNode(range,txtNode) == 0) continue;
+									if(this.rangeCompareNode(range,txtNode) == 1) break;
+									if(txtNode.nodeName != "IMG") continue;
+									if(txtNode.src != rObj.oid_txt) continue;
+									elem = txtNode;
+									break;
+								}
+							}
+						}else{
+							var startNode = bitsObjectMng.XPath.getCurrentNodeFromXPath(doc,aXPath.startPath,aXPath.startOffset,aXPath.startType);
+							if(!startNode || !startNode.node) return false;
+							elem = startNode.node;
+						}
+					}
+				}
+				if(!elem) return false;
+				var y_offs = this.getPageOffsetTop( elem );
+				var height = elem.offsetHeight;
+				if(height>0){
+					y_offs -= 15;
+				}else{
+					if(elem.offsetHeight == 0) y_offs -= 15;
+				}
+				var doc = elem.ownerDocument;
+				var win;
+				if(doc) win = doc.defaultView;
+				if(win) win.scroll( win.pageXOffset, y_offs );
+				return true;
+			}catch(ex){
+				this._dump("bitsObjectMng.Common.doTopElementIMG():"+ex);
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		pageshow : function(aDoc){
+			var tab = gBrowser.selectedTab;
+			if(!tab || !tab.hasAttribute("Wired-Marker:oid") || !tab.hasAttribute("Wired-Marker:pfid") || !tab.hasAttribute("Wired-Marker:dbtype")) return;
+
+			var oid = tab.getAttribute("Wired-Marker:oid");
+			var pfid = tab.getAttribute("Wired-Marker:pfid");
+			var source = tab.getAttribute("Wired-Marker:source");
+			var dbtype = tab.getAttribute("Wired-Marker:dbtype");
+			var style = tab.getAttribute("Wired-Marker:style");
+
+			var aObject = bitsObjectMng.Database.getObject({oid:oid,pfid:pfid}, dbtype)[0];
+			if(aObject){
+				if(aObject.doc_url != aObject.con_url && aObject.doc_url == bitsAutocacheService.convertCacheURLToOriginalURL(this.getURLStringFromDocument(aDoc))){
+					var frame_name;
+					var frame_id;
+					var parser = new DOMParser();
+					var xmldoc = parser.parseFromString(aObject.oid_property,"text/xml");
+					if(xmldoc){
+						try{frame_name = xmldoc.getElementsByTagName("FRAME_NAME")[0].textContent;}catch(e){}
+					}
+					if(frame_name){
+						var win = aDoc.defaultView;
+						if(win.frames != null){
+							var loadFlag = false;
+							var i;
+							for(i=0;i<win.frames.length;i++){
+								if(win.frames[i].name != frame_name) continue;
+								if(bitsAutocacheService.convertCacheURLToOriginalURL(this.getURLStringFromDocument(win.frames[i].document)) == aObject.con_url) break;
+								win.frames[i].document.location = aObject.con_url;
+								loadFlag = true;
+								break;
+							}
+							if(!loadFlag && frame_id){
+								var nodes = bitsObjectMng.XPath.evaluate('//*[@id="'+frame_id+'"]',doc);
+								if(nodes && nodes.snapshotLength == 1){
+									frame_name = nodes.snapshotItem(0).name;
+									for(i=0;i<win.frames.length;i++){
+										if(win.frames[i].name != frame_name) continue;
+										if(bitsAutocacheService.convertCacheURLToOriginalURL(this.getURLStringFromDocument(win.frames[i].document)) == aObject.con_url) break;
+										win.frames[i].document.location = aObject.con_url;
+										loadFlag = true;
+										break;
+									}
+								}
+							}
+							if(loadFlag){
+								var tab = gBrowser.selectedTab;
+								if(tab){
+									tab.setAttribute("Wired-Marker:oid",id);
+									tab.setAttribute("Wired-Marker:pfid",pfid);
+									tab.setAttribute("Wired-Marker:dbtype",dbtype);
+									tab.setAttribute("Wired-Marker:style",style);
+									if(source) tab.setAttribute("Wired-Marker:source",source);
+								}
+								return;
+							}
+						}
+					}
+				}
+			}
+			var rtn = false;
+			if(source){
+				rtn = this.doTopElement(source,style,oid,dbtype);
+			}else{
+				rtn = this.doTopElementIMG(oid,dbtype)
+			}
+//bitsObjectMng._dump("pageshow():rtn=["+rtn+"]");
+			if(rtn){
+				tab.removeAttribute("Wired-Marker:oid");
+				tab.removeAttribute("Wired-Marker:pfid");
+				tab.removeAttribute("Wired-Marker:source");
+				tab.removeAttribute("Wired-Marker:dbtype");
+				tab.removeAttribute("Wired-Marker:style");
+				var self = this;
+				setTimeout(function(){
+					if(source){
+						rtn = self.doTopElement(source,style,oid,dbtype);
+					}else{
+						rtn = self.doTopElementIMG(oid,dbtype)
+					}
+				},2000);
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		loadFromObject : function(aObject, tabbed){
+			var doc = gBrowser.contentDocument;
+			var source;
+			if(!aObject.oid_type.match(/^image\/(.+)$/)) source = bitsMarker.id_key+aObject.dbtype+aObject.oid;
+			var id = aObject.oid;
+			var pfid = aObject.pfid;
+			var style = aObject.fid_style;
+			var cur_uri = this.getURLStringFromDocument(doc);
+			var res_uri = aObject.doc_url;
+			var dbtype = aObject.dbtype;
+			var location_hash = "";
+			var logical_page = "";
+			var physical_page = "";
+			if(aObject && aObject.oid_property){
+				try{
+					var parser = new DOMParser();
+					var xmldoc = parser.parseFromString(aObject.oid_property,"text/xml");
+					parser = undefined;
+					if(xmldoc){
+						var xmlnode = xmldoc.getElementsByTagName("LOCATION_HASH")[0];
+						if(xmlnode) location_hash = xmlnode.textContent;
+						if(aObject.oid_type.match(/^application\/pdf$/)){
+							var xmlnode = xmldoc.getElementsByTagName("LOGICAL_PAGE")[0];
+							if(xmlnode) logical_page = xmlnode.textContent;
+							var xmlnode = xmldoc.getElementsByTagName("PHYSICAL_PAGE")[0];
+							if(xmlnode) physical_page = xmlnode.textContent;
+						}
+						xmldoc = undefined;
+					}
+				}catch(e){
+					location_hash = "";
+				}
+			}
+			var loadFlag = false;
+			if(tabbed) loadFlag = tabbed;
+			if(!tabbed){
+				if(gBrowser.browsers.length == 1 && res_uri != "" && cur_uri != res_uri){
+					loadFlag = true;
+				}else if(cur_uri == res_uri){
+					loadFlag = false;
+					if(location_hash) doc.location.hash = location_hash;
+				}else{
+					loadFlag = true;
+					var i;
+					for(i=0;i<gBrowser.browsers.length;i++){
+						var doc = gBrowser.browsers[i].contentDocument;
+						var cur_uri = bitsAutocacheService.convertCacheURLToOriginalURL(this.getURLStringFromDocument(doc));
+						if(cur_uri == res_uri){
+							loadFlag = false;
+							gBrowser.tabContainer.selectedIndex = i;
+							if(location_hash) doc.location.hash = location_hash;
+							break;
+						}
+					}
+				}
+			}
+			var pdf_hash = "";
+			if(aObject.oid_type.match(/^application\/pdf$/)){
+				if(logical_page != "" || physical_page != "") pdf_hash = "page="+logical_page; //+'&search="'+aObject.oid_title+'"';
+				if(!loadFlag && pdf_hash != ""){
+					var doc = gBrowser.contentDocument;
+					doc.location.hash = pdf_hash;
+					gBrowser.reload(true);
+					return;
+				}
+			}
+			var source_elem = this.getElementById(source);
+//bitsObjectMng._dump("loadFromObject(1):loadFlag=["+loadFlag+"]");
+//bitsObjectMng._dump("loadFromObject(1):source_elem=["+source_elem+"]");
+			if(loadFlag){
+				if(location_hash){
+					res_uri += "#" + location_hash;
+				}else if(pdf_hash){
+					res_uri += "#" + pdf_hash;
+				}
+				var tab = this.loadURL(res_uri,tabbed);
+				if(tab){
+					tab.setAttribute("Wired-Marker:oid",id);
+					tab.setAttribute("Wired-Marker:pfid",pfid);
+					tab.setAttribute("Wired-Marker:dbtype",dbtype);
+					tab.setAttribute("Wired-Marker:style",style);
+					if(source) tab.setAttribute("Wired-Marker:source",source);
+				}
+				return;
+			}
+			var rtn = false;
+			if(!source_elem){
+				if(source && source != ""){
+					rtn = this.doTopElement(source,style,id,dbtype);
+				}else{
+					rtn = this.doTopElementIMG(id,dbtype);
+				}
+			}
+//bitsObjectMng._dump("loadFromObject(1):rtn=["+rtn+"]");
+			if(!rtn){
+				try{
+					if(aObject){
+						if(aObject.doc_url != aObject.con_url && aObject.doc_url == bitsAutocacheService.convertCacheURLToOriginalURL(this.getURLStringFromDocument(doc))){
+							var frame_name;
+							var frame_id;
+							var xmldoc;
+							var parser = new DOMParser();
+							if(aObject.oid_property) xmldoc = parser.parseFromString(aObject.oid_property,"text/xml");
+							parser = undefined;
+							if(xmldoc){
+								try{
+									var xmlnode = xmldoc.getElementsByTagName("FRAME_NAME")[0];
+									if(xmlnode) frame_name = xmlnode.textContent;
+									var xmlnode = xmldoc.getElementsByTagName("FRAME_ID")[0];
+									if(xmlnode) frame_id = xmlnode.textContent;
+								}catch(e){}
+							}
+//bitsObjectMng._dump("loadFromObject():frame_name=["+frame_name+"]");
+//bitsObjectMng._dump("loadFromObject():frame_id=["+frame_id+"]");
+							if(frame_name){
+								var win = doc.defaultView;
+								if(win.frames != null){
+									var loadFlag = false;
+									var i;
+									for(i=0;i<win.frames.length;i++){
+										if(win.frames[i].name != frame_name) continue;
+										if(bitsAutocacheService.convertCacheURLToOriginalURL(this.getURLStringFromDocument(win.frames[i].document)) == aObject.con_url) break;
+										win.frames[i].document.location = aObject.con_url;
+										loadFlag = true;
+										break;
+									}
+//bitsObjectMng._dump("loadFromObject(2):loadFlag=["+loadFlag+"]");
+									if(!loadFlag && frame_id){
+										var nodes = bitsObjectMng.XPath.evaluate('//*[@id="'+frame_id+'"]',doc);
+//bitsObjectMng._dump("loadFromObject(2):nodes=["+nodes+"]["+(nodes?nodes.snapshotLength:0)+"]");
+										if(nodes && nodes.snapshotLength == 1){
+											frame_name = nodes.snapshotItem(0).name;
+//bitsObjectMng._dump("loadFromObject():frame_name=["+frame_name+"]");
+											for(i=0;i<win.frames.length;i++){
+//bitsObjectMng._dump("loadFromObject():win.frames["+i+"].name=["+win.frames[i].name+"]");
+												if(win.frames[i].name != frame_name) continue;
+												if(bitsAutocacheService.convertCacheURLToOriginalURL(this.getURLStringFromDocument(win.frames[i].document)) == aObject.con_url) break;
+												win.frames[i].document.location = aObject.con_url;
+												loadFlag = true;
+												break;
+											}
+										}
+									}
+//bitsObjectMng._dump("loadFromObject(3):loadFlag=["+loadFlag+"]");
+									if(loadFlag){
+										var tab = gBrowser.selectedTab;
+										if(tab){
+											tab.setAttribute("Wired-Marker:oid",id);
+											tab.setAttribute("Wired-Marker:pfid",pfid);
+											tab.setAttribute("Wired-Marker:dbtype",dbtype);
+											tab.setAttribute("Wired-Marker:style",style);
+											if(source) tab.setAttribute("Wired-Marker:source",source);
+										}
+										return;
+									}
+								}
+							}
+						}
+					}
+				}catch(e){}
+				if(source && source != ""){
+					this.doTopElement(source,style,id,dbtype);
+				}else{
+					this.doTopElementIMG(id,dbtype);
+				}
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		loadURL : function(aURL, tabbed){
+			var win = this.WINDOW.getMostRecentWindow("navigator:browser");
+			var browser = win.document.getElementById("content");
+			if(tabbed) browser.selectedTab = browser.addTab('about:blank');
+			browser.loadURI(aURL);
+			return browser.selectedTab;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getTimeStamp : function(advance){
+			var dd = new Date;
+			if(advance) dd.setTime(dd.getTime() + 100000 * advance);
+			var y = dd.getFullYear();
+			var m = dd.getMonth() + 1; if(m < 10) m = "0" + m;
+			var d = dd.getDate();      if(d < 10) d = "0" + d;
+			var h = dd.getHours();     if(h < 10) h = "0" + h;
+			var i = dd.getMinutes();   if(i < 10) i = "0" + i;
+			var s = dd.getSeconds();   if(s < 10) s = "0" + s;
+			return y.toString() + m.toString() + d.toString() + h.toString() + i.toString() + s.toString();
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getFormatDate : function(){
+			var dd = new Date;
+			var y = dd.getFullYear();
+			var m = dd.getMonth() + 1; if(m < 10) m = "0" + m;
+			var d = dd.getDate();      if(d < 10) d = "0" + d;
+			var h = dd.getHours();     if(h < 10) h = "0" + h;
+			var i = dd.getMinutes();   if(i < 10) i = "0" + i;
+			var s = dd.getSeconds();   if(s < 10) s = "0" + s;
+			return  m.toString() + "/" + d.toString() + "/" + y.toString() + " " + h.toString() + ":" + i.toString() + ":" + s.toString();
+		},
+
+/////////////////////////////////////////////////////////////////////
+		formatFileSize : function(aBytes){
+			if(aBytes > 1000 * 1000){
+				return this.divideBy100( Math.round( aBytes / 1024 / 1024 * 100 ) ) + " MB";
+			}else if( aBytes == 0 ){
+				return "0 KB";
+			}else{
+				var kbytes = Math.round( aBytes / 1024 );
+				return (kbytes == 0 ? 1 : kbytes) + " KB";
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		divideBy100 : function(aInt){
+			if(aInt % 100 == 0){
+				return aInt / 100 + ".00";
+			}else if(aInt % 10 == 0){
+				return aInt / 100 + "0";
+			}else{
+				return aInt / 100;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getRootHref : function(aURLSpec){
+			var url = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURL);
+			url.spec = aURLSpec;
+			return url.scheme + "://" + url.host + "/";
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getBaseHref : function(sURI){
+			try{
+				var pos, base;
+				base = ((pos = sURI.indexOf("?"))     != -1) ? sURI.substring(0, pos)   : sURI;
+				base = ((pos = base.indexOf("#"))     != -1) ? base.substring(0, pos)   : base;
+				base = ((pos = base.lastIndexOf("/")) != -1) ? base.substring(0, ++pos) : base;
+				return base;
+			}catch(e){
+				bitsObjectMng._dump(bitsObjectMng.Common.getBaseHref.caller);
+				throw new Error("bitsObjectMng.Common.getBaseHref():"+e);
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getFileName : function(aURI){
+			var pos, name;
+			name = ((pos = aURI.indexOf("?"))     != -1) ? aURI.substring(0, pos) : aURI;
+			name = ((pos = name.indexOf("#"))     != -1) ? name.substring(0, pos) : name;
+			name = ((pos = name.lastIndexOf("/")) != -1) ? name.substring(++pos)  : name;
+			return name;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getFilesize : function(aFile){
+			if(!aFile) return 0;
+			if(aFile.isDirectory()){
+				var size = 0;
+				var entries = aFile.directoryEntries;
+				while(entries.hasMoreElements()){
+					var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+					if(!entry.isDirectory()){
+						size += this.getFilesize(entry);
+					}else if(entry.isDirectory() && !entry.leafName.match(/^\./)){
+						size += this.getFilesize(entry);
+					}
+				}
+				return size;
+			}else{
+				return aFile.fileSize;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		hasDirChilds : function(aDir){
+			if(!aDir) return 0;
+			if(aDir.isDirectory()){
+				var size = 0;
+				var entries = aDir.directoryEntries;
+				while(entries.hasMoreElements()){
+					var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+					if(!entry.isDirectory()){
+						return true;
+					}else if(entry.isDirectory() && !entry.leafName.match(/^\./)){
+						return true;
+					}
+				}
+				return false;
+			}else{
+				return true;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		copyDirChilds : function(aSrcDir,aDistDir){
+			try{
+				if(!aSrcDir || !aDistDir || !aSrcDir.exists()) return false;
+				if(!aDistDir.exists()) aDistDir.create(aDistDir.DIRECTORY_TYPE, 0777);
+				if(aSrcDir.isDirectory()){
+					var size = 0;
+					var entries = aSrcDir.directoryEntries;
+					while(entries.hasMoreElements()){
+						var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+						if(!entry.isDirectory()){
+							var target = aDistDir.clone();
+							target.append(entry.leafName);
+							if(target.exists()) target.remove(true);
+							try{
+								var istream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
+								istream.init(entry, -1, -1, false);
+								var bstream = Components.classes["@mozilla.org/binaryinputstream;1"].createInstance(Components.interfaces.nsIBinaryInputStream);
+								bstream.setInputStream(istream);
+								var bytes = bstream.readBytes(bstream.available());
+								var stream = Components.classes["@mozilla.org/network/safe-file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
+								stream.init(target, 0x04 | 0x08 | 0x20, 664, 0); // write, create, truncate
+								stream.write(bytes, bytes.length);
+								if(stream instanceof Components.interfaces.nsISafeOutputStream){
+									stream.finish();
+								}else{
+									stream.close();
+								}
+							}catch(e){
+								bitsObjectMng._dump("bitsObjectMng.Common.copyDirChilds():entry=["+entry.path+"]");
+								bitsObjectMng._dump("bitsObjectMng.Common.copyDirChilds():target=["+target.path+"]["+ target.path.length +"]");
+								bitsObjectMng._dump("bitsObjectMng.Common.copyDirChilds():"+e);
+							}
+						}else if(entry.isDirectory() && !entry.leafName.match(/^\./)){
+							var cloneDir = aDistDir.clone();
+							cloneDir.append(entry.leafName);
+							if(!this.copyDirChilds(entry.clone(),cloneDir)) return false;
+						}
+					}
+				}else{
+					aSrcDir.copyTo(aDistDir,aSrcDir.leafName);
+				}
+				return true;
+			}catch(e){
+				throw new Error("bitsObjectMng.Common.copyDirChilds():"+e);
+				return false;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		splitFileName : function(aFileName){
+			var pos = aFileName.lastIndexOf(".");
+			var ret = [];
+			if(pos != -1){
+				ret[0] = aFileName.substring(0, pos);
+				ret[1] = aFileName.substring(pos + 1, aFileName.length);
+			}else{
+				ret[0] = aFileName;
+				ret[1] = "";
+			}
+			return ret;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		validateFileName : function(aFileName){
+			aFileName = aFileName.replace(/[\"\?!~`]+/g, "");
+			aFileName = aFileName.replace(/[\*\&]+/g, "+");
+			aFileName = aFileName.replace(/[\\\/\|\:;]+/g, "-");
+			aFileName = aFileName.replace(/[\<]+/g, "(");
+			aFileName = aFileName.replace(/[\>]+/g, ")");
+			aFileName = aFileName.replace(/[\s]+/g, "_");
+			aFileName = aFileName.replace(/[%]+/g, "@");
+			return aFileName;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		resolveURL : function(aBaseURL, aRelURL){
+			try{
+				var baseURLObj = this.convertURLToObject(aBaseURL);
+				return baseURLObj.resolve(aRelURL);
+			}catch(ex){
+				bitsObjectMng._dump("ObjectManagement ERROR: Failed to resolve URL.[" + aBaseURL + "][" + aRelURL + "]");
+				return aRelURL;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		crop : function(aString, aMaxLength){
+			return aString.length > aMaxLength ? aString.substring(0, aMaxLength) + "..." : aString;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		readFile : function(aFile){
+			try{
+				var istream = Components.classes['@mozilla.org/network/file-input-stream;1'].createInstance(Components.interfaces.nsIFileInputStream);
+				istream.init(aFile, 1, 0, false);
+				var sstream = Components.classes['@mozilla.org/scriptableinputstream;1'].createInstance(Components.interfaces.nsIScriptableInputStream);
+				sstream.init(istream);
+				var content = sstream.read(sstream.available());
+				sstream.close();
+				istream.close();
+				return content;
+			}catch(ex){
+				bitsObjectMng._dump("ObjectManagement ERROR: readFile():" + ex);
+				return false;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		writeFile : function(aFile, aContent, aChars){
+			if(aFile.exists()) aFile.remove(false);
+			try{
+				aFile.create(aFile.NORMAL_FILE_TYPE, 0666);
+				this.UNICODE.charset = aChars;
+				aContent = this.UNICODE.ConvertFromUnicode(aContent);
+				var ostream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
+				ostream.init(aFile, 2, 0x200, false);
+				ostream.write(aContent, aContent.length);
+				ostream.close();
+			}catch(ex){
+				bitsObjectMng._dump("ObjectManagement ERROR: Failed to write file: " + aFile.path + "["+ ex + "]");
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		writeIndexDat : function(aItem, aFile){
+			if(!aFile){
+				aFile = this.getContentDir(aItem.id).clone();
+				aFile.append("index.dat");
+			}
+			var content = "";
+			for(var prop in aItem){
+				content += prop + "\t" + aItem[prop] + "\n";
+			}
+			this.writeFile(aFile, content, "UTF-8");
+		},
+
+/////////////////////////////////////////////////////////////////////
+		saveUriToFile : function(aURISpec, aFile){
+			if(aFile.exists()) return;
+			var uri = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURL);
+			uri.spec = aURISpec;
+			var WBP = Components.classes['@mozilla.org/embedding/browser/nsWebBrowserPersist;1'].createInstance(Components.interfaces.nsIWebBrowserPersist);
+			WBP.saveURI(uri, null, null, null, null, aFile);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		saveDataUrlToFile : function(aDataURL, aFile){
+			var io = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
+			var source = io.newURI(aDataURL, "UTF8", null);
+			var WBP = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"].createInstance(Components.interfaces.nsIWebBrowserPersist);
+			WBP.persistFlags = WBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES;
+			WBP.persistFlags |= WBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
+			var progressListener = {
+				onLocationChange : function(webProgress, request, location){},
+				onProgressChange : function(webProgress, request, curSelfProgress, maxSelfProgress, curTotalProgress, maxTotalProgress){},
+				onSecurityChange : function(webProgress, request, state){},
+				onStateChange    : function(webProgress, request, stateFlags, status){
+					if((WBP.currentState & WBP.PERSIST_STATE_FINISHED)){
+						if(aFile && aFile.exists()){
+						}else if(status != 0){
+						}
+					}
+				},
+				onStatusChange   : function(webProgress, request, status, message){},
+			};
+			WBP.progressListener = progressListener;
+			WBP.saveURI(source, null, null, null, null, aFile);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getImageFromURL : function(aUrl, aFile){
+			if(aUrl == undefined || aFile == undefined || aUrl == "") return false;
+			try{
+				var ioserv = this.IO;
+				var channel = ioserv.newChannel(aUrl, 0, null);
+				var stream = channel.open();
+				if(channel instanceof Components.interfaces.nsIHttpChannel && channel.responseStatus >= 300 && channel.responseStatus <= 302){
+					var Location = channel.getResponseHeader("Location");
+					channel = ioserv.newChannel(Location, 0, null);
+					stream = channel.open();
+				}
+				if(channel instanceof Components.interfaces.nsIHttpChannel && (channel.responseStatus != 200 || !channel.contentType.match(/^image\//))){
+					if(aFile.exists()) aFile.remove(true);
+					return false;
+				}else if(!(channel instanceof Components.interfaces.nsIHttpChannel)){
+					return false;
+				}
+				var bistream = Components.classes["@mozilla.org/binaryinputstream;1"].createInstance(Components.interfaces.nsIBinaryInputStream);
+				bistream.setInputStream(stream);
+				if(!aFile.exists()) aFile.create(aFile.NORMAL_FILE_TYPE, 0664);
+				var ostream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
+				ostream.init(aFile, 0x04 | 0x08 | 0x20, 664, 0); // write, create, truncate
+				var bostream = Components.classes["@mozilla.org/binaryoutputstream;1"].createInstance(Components.interfaces.nsIBinaryOutputStream);
+				bostream.setOutputStream(ostream);
+				var size = 0;
+				while(size = bistream.available()){
+					bostream.writeBytes(bistream.readBytes(size), size);
+				}
+				ostream.close();
+				return true;
+			}catch(e){
+				bitsObjectMng._dump("bitsObjectMng.Database.getImageFromURL():aUrl=["+aUrl+"]");
+				bitsObjectMng._dump("bitsObjectMng.Database.getImageFromURL():"+e);
+				return false;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		convertFormUnicode : function(aString, aCharset){
+			if(!aString) return "";
+			try{
+				this.UNICODE.charset = aCharset;
+				aString = this.UNICODE.ConvertFromUnicode(aString);
+			}catch(ex){}
+			return aString;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		convertToUnicode : function(aString, aCharset){
+			if(!aString) return "";
+			try{
+				this.UNICODE.charset = aCharset;
+				aString = this.UNICODE.ConvertToUnicode(aString);
+			}catch(ex){}
+			return aString;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		exceptCode : function(aString,rString){
+			if(rString == undefined) rString = " ";
+			var replaceString = new String(aString);
+			replaceString = replaceString.replace(/[\cA\cB\cC\cD\cE\cF\cG\cH\cI\cJ\cK\cL\cM\cN\cO\cP\cQ\cR\cS\cT\cU\cV\cW\cX\cY\cZ\c[\c\\\c]\c^\c_]/mg,rString);
+			replaceString = replaceString.replace(/[\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f]/mg,rString);
+			replaceString = replaceString.replace(/[\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f]/mg,rString);
+			replaceString = replaceString.replace(/[\x7f]/mg,rString);
+			return replaceString;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		convertPathToFile : function(aPath){
+			var aFile = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
+			aFile.initWithPath(aPath);
+			return aFile;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		convertFilePathToURL : function(aFilePath){
+			var tmpFile = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
+			tmpFile.initWithPath(aFilePath);
+			return this.IO.newFileURI(tmpFile).spec;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		convertURLToObject : function(aURLString){
+			var aURI = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURI);
+			aURI.spec = aURLString;
+			return aURI;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		convertURLToFile : function(aURLString){
+			var aURL = this.convertURLToObject(aURLString);
+			if(!aURL.schemeIs("file")) return undefined;
+			try{
+				var fileHandler = this.IO.getProtocolHandler("file").QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+				return fileHandler.getFileFromURLSpec(aURLString);
+			}catch(ex){
+				return undefined;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getURLStringFromDocument : function(aDocument){
+			if(!aDocument || !aDocument.location) return "";
+			var location = aDocument.location;
+			try{
+				return location.protocol + "//" + location.host +location.pathname + location.search;
+			}catch(ex){
+				return location.href;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getURLHashStringFromDocument : function(aDocument){
+			if(!aDocument || !aDocument.location) return "";
+			var location = aDocument.location;
+			try{
+				var hash = location.toString();
+				var hash_index = hash.indexOf("#");
+				if(hash_index>=0){
+					return hash.substr(hash_index).replace(/#hyperanchor.*$/g,"").replace(/^#/,"");
+				}else{
+					return "";
+				}
+			}catch(ex){
+				return "";
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getChromeImageURI : function(aURI){
+			try{
+				var channel = this.IO.newChannelFromURI(aURI);
+				var stream  = channel.open();
+				var bstream = Components.classes['@mozilla.org/binaryinputstream;1'].createInstance(Components.interfaces.nsIBinaryInputStream);
+				bstream.setInputStream(stream);
+				var len = stream.available();
+				var bytes = bstream.readByteArray(len);
+				bstream.close();
+				stream.close();
+				var mime = this.MIME.getTypeFromURI(aURI);
+				var images = String.fromCharCode.apply(String, bytes);
+				var image_b64 = btoa(images);
+				var dataUri = 'data:' + mime +';base64,' + image_b64;
+				return dataUri;
+			}catch(e){
+				bitsObjectMng._dump("bitsObjectMng.Common.getChromeImageURI():"+e);
+			}
+		  return null;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getFocusedWindow : function(){
+			var win = document.commandDispatcher.focusedWindow;
+			if(!win || win == window || win instanceof Components.interfaces.nsIDOMChromeWindow) win = window._content;
+			return win;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getDefaultIcon : function(type){
+			switch(type){
+				case "folder" : return "chrome://objectmng/skin/treefolder.png"; break;
+				default       : return "chrome://objectmng/skin/treeitem.png";   break;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getBoolPref : function(aName, aDefVal){
+			try{
+				return this.PREF.getBoolPref(aName);
+			}catch(ex){
+				return aDefVal;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getElementStyle : function(elem){
+			var style = {};
+			if(elem){
+				var resource_exp = new RegExp("^resource:");
+				var rules = Components.classes["@mozilla.org/inspector/dom-utils;1"].getService(Components.interfaces["inIDOMUtils"]).getCSSStyleRules(elem);
+				var i;
+				var j;
+				var propertyName;
+				var priority;
+				var value;
+				for(i=0;i<rules.Count();i++) {
+					var rule = rules.GetElementAt(i);
+					if(rule instanceof CSSStyleRule && (!rule.parentStyleSheet.href || !resource_exp.test(rule.parentStyleSheet.href))){
+						for(j=0;j<rule.style.length;j++){
+							propertyName = rule.style.item(j);
+							if(propertyName == '') continue;
+							priority = rule.style.getPropertyPriority(propertyName);
+							value = rule.style.getPropertyValue(propertyName);
+							if(!style[propertyName] || !style[propertyName].priority){
+								style[propertyName] = {};
+								style[propertyName].value = value;
+								style[propertyName].priority = priority;
+							}
+						}
+					}
+				}
+				if(elem.style){
+					for(j=0;j<elem.style.length;j++){
+						propertyName = elem.style.item(j);
+						if(propertyName == '') continue;
+						priority = elem.style.getPropertyPriority(propertyName);
+						value = elem.style.getPropertyValue(propertyName);
+						if(!style[propertyName] || !style[propertyName].priority){
+							style[propertyName] = {};
+							style[propertyName].value = value;
+							style[propertyName].priority = priority;
+						}
+					}
+				}
+			}
+			return style;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getPageOffsetTop : function(elem){
+			if(!elem) return 0;
+			var top = elem.offsetTop;
+			var tempElem;
+			var offsetHeight;
+			var scrollHeight;
+			var style;
+			var scrollTop;
+			while(elem && elem.offsetParent != null){
+				if(elem && elem.parentNode && elem.offsetParent != elem.parentNode){
+					tempElem = elem;
+					while(tempElem && tempElem.parentNode && elem.offsetParent != tempElem.parentNode){
+						offsetHeight = tempElem.parentNode.offsetHeight;
+						scrollHeight = tempElem.parentNode.scrollHeight;
+						if(offsetHeight != scrollHeight){
+							style = this.getElementStyle(tempElem.parentNode);
+							if(!style['height']) offsetHeight = scrollHeight;
+						}
+						if(offsetHeight != scrollHeight){
+							scrollTop = elem.offsetTop - tempElem.parentNode.offsetTop;
+							if(scrollTop>15) scrollTop -= 15;
+							if(scrollTop>0){
+								tempElem.parentNode.scrollTop = scrollTop;
+								if(tempElem.parentNode.scrollTop>0) top = tempElem.parentNode.offsetTop;
+							}
+							elem = tempElem.parentNode;
+							break;
+						}
+						tempElem = tempElem.parentNode;
+					}
+				}
+				if(elem.offsetParent.offsetHeight != elem.offsetParent.scrollHeight) elem.offsetParent.scrollTop = top - (top>15?15:0);
+				elem = elem.offsetParent;
+				if(elem) top += elem.offsetTop;
+			}
+			return top;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		addPrefListener : function(aObserver){
+			try{
+				var pbi = Components.classes['@mozilla.org/preferences;1'].getService(Components.interfaces.nsIPrefBranchInternal);
+				pbi.addObserver(aObserver.domain, aObserver, false);
+			}catch(e){}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		removePrefListener : function(aObserver){
+			try{
+				var pbi = Components.classes['@mozilla.org/preferences;1'].getService(Components.interfaces.nsIPrefBranchInternal);
+				pbi.removeObserver(aObserver.domain, aObserver);
+			}catch(e){}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		escapeComment : function(aStr){
+			if(aStr.length > 10000) this.alert("NOTICE: Too long comment makes ObjectManagement slow.");
+			return aStr.replace(/\r|\n|\t/g, " __BR__ ");
+		},
+
+/////////////////////////////////////////////////////////////////////
+		openManageWindow : function(aRes, aModEltID){
+			window.openDialog("chrome://objectmng/content/manage.xul", "ObjectManagement:Manage", "chrome,centerscreen,all,resizable,dialog=no", aRes, aModEltID);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		rangeCompareNode : function(aRange, aNode){
+			if(!aRange || !aNode || !aRange.compareBoundryPoints) return -1;
+			var nodeRange = aNode.ownerDocument.createRange();
+			try{
+				nodeRange.selectNode(aNode);
+			}catch(e){
+				nodeRange.selectNodeContents(aNode);
+			}
+			var nodeIsBefore = aRange.compareBoundryPoints(Range.START_TO_START, nodeRange) == 1;
+			var nodeIsAfter = aRange.compareBoundryPoints(Range.END_TO_END, nodeRange) == -1;
+
+			if(nodeIsBefore && !nodeIsAfter) return 0;
+			if(!nodeIsBefore && nodeIsAfter) return 1;
+			if(nodeIsBefore && nodeIsAfter)  return 2;
+			return 3;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		rangeIntersectsNode : function(aRange, aNode){
+			if(!aRange || !aNode || !aRange.compareBoundryPoints) return false;
+			var nodeRange = aNode.ownerDocument.createRange();
+			try{
+				nodeRange.selectNode(aNode);
+			}catch(e){
+				nodeRange.selectNodeContents(aNode);
+			}
+			return aRange.compareBoundaryPoints(Range.END_TO_START, nodeRange) == -1 && aRange.compareBoundaryPoints(Range.START_TO_END, nodeRange) == 1;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getHostName: function(){
+			var DNSService=this.DNS;
+			return DNSService.myHostName;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getIPAddress: function(){
+			try{
+				var DNSService=this.DNS;
+				var DNSRecord=DNSService.resolve(DNSService.myHostName, true);
+				var allIP = [];
+				var i;
+				for(i=0;DNSRecord.hasMore();i++) allIP[i]=DNSRecord.getNextAddrAsString();
+				return (allIP.length>0?allIP:undefined);
+			}catch(e){
+				bitsObjectMng._dump("bitsObjectMng.Common.getIPAddress():"+e);
+				return undefined;
+			}
+		},
+	},
+
+/////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////
+	DataSource : {
+		initflag : false,
+		inittime : "",
+		data : null,
+		file : null,
+		unshifting : false,
+		ABOUT_ROOT : "urn:wiredmarker:root",
+		ABOUT_ITEM : "urn:wiredmarker:item",
+		id2about : {},
+
+/////////////////////////////////////////////////////////////////////
+		get filename(){
+			if(this.inittime == "") this.inittime = bitsObjectMng.Common.getTimeStamp();
+			return "wiredmarker_"+this.inittime+".rdf";
+		},
+/////////////////////////////////////////////////////////////////////
+		init : function(aQuietWarning){
+			if(this.initflag) return;
+			this.initflag = true;
+			try{
+				this.file = bitsObjectMng.Common.getExtensionDir().clone();
+				this.file.append(this.filename);
+				if(!this.file.exists()){
+					this.initRdf();
+				}else{
+					this.data = null;
+					var fileURL = bitsObjectMng.Common.IO.newFileURI(this.file).spec;
+					this.data = bitsObjectMng.Common.RDF.GetDataSourceBlocking(fileURL);
+				}
+			}catch(e){
+				if(!aQuietWarning) bitsObjectMng._dump("ObjectManagement ERROR: Failed to initialize datasource.\n\n" + e);
+				this.initflag = false;
+			}
+			this.unshifting = bitsObjectMng.Common.getBoolPref("objectmng.tree.unshift", false);
+		},
+
+		
+/////////////////////////////////////////////////////////////////////
+		done : function(){
+			if(this.file.exists()) this.file.remove(true);
+			this.initflag = false;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		initRdf : function(){
+			try{
+				this.file = bitsObjectMng.Common.getExtensionDir().clone();
+				this.file.append(this.filename);
+				if(this.file.exists()) this.file.remove(true);
+				this.file.create(this.file.NORMAL_FILE_TYPE, 0666);
+				var content = '<?xml version="1.0"?>\n<RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#" xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>\n';
+				bitsObjectMng.Common.writeFile(this.file,content,"UTF-8");
+				var fileURL = bitsObjectMng.Common.IO.newFileURI(this.file).spec;
+				this.data = bitsObjectMng.Common.RDF.GetDataSourceBlocking(fileURL);
+				this.createEmptySeq(this.ABOUT_ROOT);
+				this.flush();
+			}catch(e){
+				bitsObjectMng._dump("ObjectManagement ERROR: Failed to initialize datasource.(rdf)\n\n" + e);
+			}
+			this.unshifting = bitsObjectMng.Common.getBoolPref("objectmng.tree.unshift", false);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		flush : function(){
+			this.data.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Flush();
+		},
+
+/////////////////////////////////////////////////////////////////////
+		refresh : function(){
+			this.data.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Refresh(true);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		sanitize : function(aVal){
+			if(!aVal || typeof(aVal) != "string") return "";
+			return aVal.replace(/[\x00-\x1F\x7F]/g, " ");
+		},
+
+/////////////////////////////////////////////////////////////////////
+		validateURI : function(aURI){
+			if(aURI == this.ABOUT_ROOT || aURI.match(/^urn:wiredmarker:item\d{14}$/)){
+				return true;
+			}else{
+				return false;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		addItem : function(aOMitem, aParName, aIdx, aMode){
+			var about = "";
+			if(aOMitem.about){
+				about = aOMitem.about;
+				delete aOMitem.about;
+			}else{
+				about = this.ABOUT_ITEM + aOMitem.id;
+			}
+			if(!this.validateURI(about)) return;
+			this.setID2About(aOMitem.id,aOMitem.pfid,about,aMode);
+			for(var key in aOMitem){
+				if(typeof(aOMitem[key]) == "string") aOMitem[key] = this.sanitize(aOMitem[key]);
+			}
+			try{
+				var cont = this.getContainer(aParName, false);
+				if(!cont){
+					cont = this.getContainer(this.ABOUT_ROOT, false);
+					aIdx = 0;
+				}
+				var newRes = bitsObjectMng.Common.RDF.GetResource(about);
+				for(var key in aOMitem){
+					if(aOMitem[key] != undefined) this.data.Assert(newRes, bitsObjectMng.Common.RDF.GetResource(bitsObjectMng.NS_OBJECTMANAGEMENT + key), bitsObjectMng.Common.RDF.GetLiteral(aOMitem[key]), true);
+				}
+				if(this.unshifting && (aIdx == 0 || aIdx == -1)) aIdx = 1;
+				if(0 < aIdx && aIdx < cont.GetCount()){
+					cont.InsertElementAt(newRes, aIdx, true);
+				}else{
+					cont.AppendElement(newRes);
+				}
+				this.flush();
+				return newRes;
+			}catch(e){
+				bitsObjectMng._dump("ObjectManagement ERROR: Failed to add resource to datasource.\n\n" + e);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		moveItem : function(curRes, curPar, tarPar, tarRelIdx){
+			try{
+				bitsObjectMng.Common.RDFC.Init(this.data, curPar);
+				bitsObjectMng.Common.RDFC.RemoveElement(curRes, true);
+			}catch(e){
+				bitsObjectMng._dump("ObjectManagement ERROR: Failed to move element at datasource (1).\n\n" + e);
+				return false;
+			}
+			if(this.unshifting){
+				if(tarRelIdx == 0 || tarRelIdx == -1) tarRelIdx = 1;
+			}
+			try{
+				bitsObjectMng.Common.RDFC.Init(this.data, tarPar);
+				if(tarRelIdx > 0){
+					bitsObjectMng.Common.RDFC.InsertElementAt(curRes, tarRelIdx, true);
+				}else{
+					bitsObjectMng.Common.RDFC.AppendElement(curRes);
+				}
+				return true;
+			}catch(e){
+				bitsObjectMng._dump("ObjectManagement ERROR: Failed to move element at datasource (2).\n\n" + e);
+				bitsObjectMng.Common.RDFC.Init(this.data, bitsObjectMng.Common.RDF.GetResource(this.ABOUT_ROOT));
+				bitsObjectMng.Common.RDFC.AppendElement(curRes, true);
+				return false;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		createEmptySeq : function(aResName){
+			if(!this.validateURI(aResName)) return;
+			bitsObjectMng.Common.RDFCU.MakeSeq(this.data, bitsObjectMng.Common.RDF.GetResource(aResName));
+		},
+
+/////////////////////////////////////////////////////////////////////
+		deleteItem : function(aRes){
+			var aParRes = this.findParentResource(aRes);
+			return this.deleteItemDescending(aRes,aParRes);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		deleteItemDescending : function(aRes, aParRes){
+			try{
+				bitsObjectMng.Common.RDFC.Init(this.data, aParRes);
+				bitsObjectMng.Common.RDFC.RemoveElement(aRes, true);
+				var rmIDs = [];
+				var addIDs = [];
+				var depth = 0;
+				do{
+					addIDs = this.cleanUpIsolation();
+					rmIDs = rmIDs.concat(addIDs);
+				}while(addIDs.length > 0 && ++depth < 100);
+				return rmIDs;
+			}catch(e){
+				bitsObjectMng._dump("bitsObjectMng.DataSource.deleteItemDescending():"+e);
+				return [];
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		cleanUpIsolation : function(){
+			var rmIDs = [];
+			try{
+				var resEnum = this.data.GetAllResources();
+				while(resEnum.hasMoreElements()){
+					var aRes = resEnum.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+					if(aRes.Value != this.ABOUT_ROOT && !this.data.ArcLabelsIn(aRes).hasMoreElements()){
+						rmIDs.push(this.removeResource(aRes));
+					}
+				}
+			}catch(e){
+				bitsObjectMng._dump("ObjectManagement ERROR: Failed to clean up datasource.\n" + e);
+			}
+			return rmIDs;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		removeResource : function(aRes){
+			var names = this.data.ArcLabelsOut(aRes);
+			var rmID = this.getProperty(aRes, "id");
+			while(names.hasMoreElements()){
+				try{
+					var name  = names.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+					var value = this.data.GetTarget(aRes, name, true);
+					this.data.Unassert(aRes, name, value);
+				}catch(e){}
+			}
+			return rmID;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getContainer : function(aResURI, force){
+			var cont = Components.classes['@mozilla.org/rdf/container;1'].createInstance(Components.interfaces.nsIRDFContainer);
+			try{
+				cont.Init(this.data, bitsObjectMng.Common.RDF.GetResource(aResURI));
+			}catch(e){
+				if(force){
+					if(!this.validateURI(aResURI)) return null;
+					return bitsObjectMng.Common.RDFCU.MakeSeq(this.data, bitsObjectMng.Common.RDF.GetResource(aResURI));
+				}else{
+					return null;
+				}
+			}
+			return cont;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		clearContainer : function(aResURI){
+			var cont = this.getContainer(aResURI, true);
+			while(cont.GetCount()){
+				cont.RemoveElementAt(1,true);
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		removeFromContainer : function(aResURI, aRes){
+			var cont = this.getContainer(aResURI, true);
+			if(cont) cont.RemoveElement(aRes, true);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getProperty : function(aRes, aProp){
+			try{
+				if(aRes.Value == this.ABOUT_ROOT) return "";
+				var retVal = this.data.GetTarget(aRes, bitsObjectMng.Common.RDF.GetResource(bitsObjectMng.NS_OBJECTMANAGEMENT + aProp), true);
+				return (retVal?retVal.QueryInterface(Components.interfaces.nsIRDFLiteral).Value:undefined);
+			}catch(e){
+				bitsObjectMng._dump("bitsObjectMng.DataSource.getProperty():"+bitsObjectMng.DataSource.getProperty.caller);
+				bitsObjectMng._dump("bitsObjectMng.DataSource.getProperty("+aRes+","+(aRes?aRes.Value:undefined)+","+aProp+"):["+e+"]");
+				return "";
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		setProperty : function(aRes, aProp, newVal){
+			try{
+				newVal = this.sanitize(newVal);
+				var aPropRes = bitsObjectMng.Common.RDF.GetResource(bitsObjectMng.NS_OBJECTMANAGEMENT + aProp);
+				var oldVal = this.data.GetTarget(aRes, aPropRes, true);
+				oldVal = oldVal.QueryInterface(Components.interfaces.nsIRDFLiteral);
+				newVal = bitsObjectMng.Common.RDF.GetLiteral(newVal);
+				this.data.Change(aRes, aPropRes, oldVal, newVal);
+			}catch(e){
+				bitsObjectMng._dump("bitsObjectMng.DataSource.setProperty("+aRes+","+aRes.Value+","+aProp+","+newVal+"):["+e+"]");
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		exists : function(aRes){
+			try{
+				if(typeof(aRes) == "string") aRes = bitsObjectMng.Common.RDF.GetResource(this.ABOUT_ITEM + aRes);
+				return this.data.ArcLabelsOut(aRes).hasMoreElements();
+			}catch(e){
+				bitsObjectMng._dump("bitsObjectMng.DataSource.exists("+aRes+"):["+e+"]");
+				return false;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		isContainer : function(aRes){
+			try{
+				return bitsObjectMng.Common.RDFCU.IsContainer(this.data, aRes);
+			}catch(e){
+				return false;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		identify : function(aID){
+			var i = 0;
+			while(this.exists(aID) && i < 100){
+				aID = bitsObjectMng.Common.getTimeStamp(--i);
+			}
+			return aID;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getRelativeIndex : function(aParRes, aRes){
+			return bitsObjectMng.Common.RDFCU.indexOf(this.data, aParRes, aRes);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		seqResources : function(aContRes, aRecursive){
+			if(!aRecursive || aRecursive == undefined) aRecursive = false;
+			var resList = [];
+
+			bitsObjectMng.Common.RDFC.Init(this.data, aContRes);
+			var resEnum = bitsObjectMng.Common.RDFC.GetElements();
+			while(resEnum.hasMoreElements()){
+				var res = resEnum.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+				resList.push(res);
+				if(this.isContainer(res) && aRecursive) resList = resList.concat(this.seqResources(res, aRecursive));
+			}
+			return resList;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		flattenResources : function(aContRes, aRule, aRecursive){
+			var resList = [];
+			if(aRule != 2) resList.push(aContRes);
+			bitsObjectMng.Common.RDFC.Init(this.data, aContRes);
+			var resEnum = bitsObjectMng.Common.RDFC.GetElements();
+			while(resEnum.hasMoreElements()){
+				var res = resEnum.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+				if(this.isContainer(res)){
+					if(aRecursive)
+						resList = resList.concat(this.flattenResources(res, aRule, aRecursive));
+					else
+						if(aRule != 2) resList.push(res);
+				}else{
+					if(aRule != 1) resList.push(res);
+				}
+			}
+			return resList;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		findParentResource : function(aRes){
+			var resEnum = this.data.GetAllResources();
+			while(resEnum.hasMoreElements()){
+				var res = resEnum.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+				if(!this.isContainer(res)) continue;
+				if(bitsObjectMng.Common.RDFCU.indexOf(this.data, res, aRes) != -1) return res;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		setID2About : function(aID,aPFID,aAbout,aMode){
+			if(aMode == undefined || aMode == "") aMode = bitsObjectMng.Database._defaultMode;
+			if(aAbout == undefined && this.id2about[aMode] == undefined) return;
+			if(this.id2about[aMode] == undefined){
+				if(aAbout == undefined) return;
+				this.id2about[aMode] = {};
+			}
+			if(aPFID == undefined) aPFID = "";
+			if(this.id2about[aMode][aPFID] == undefined){
+				if(aAbout == undefined) return;
+				this.id2about[aMode][aPFID] = {};
+			}
+			this.id2about[aMode][aPFID][aID] = aAbout;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getID2About : function(aID,aPFID,aMode){
+			if(aMode == undefined || aMode == "") aMode = bitsObjectMng.Database._defaultMode;
+			if(this.id2about[aMode] == undefined) return undefined;
+			if(aPFID == undefined) aPFID = "";
+			if(this.id2about[aMode][aPFID] == undefined) return undefined;
+			return (this.id2about[aMode][aPFID][aID]?this.id2about[aMode][aPFID][aID]:undefined);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getAbout : function(aID,aPFID,aMode){
+			if(aMode == undefined || aMode == "") aMode = bitsObjectMng.Database._defaultMode;
+			var about = this.ABOUT_ITEM+bitsObjectMng.Database._seqIdentify(aID);
+			this.setID2About(aID,aPFID,about,aMode);
+			return about;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		load : function(aLoadDoc){
+			return true;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		save : function(aSaveDoc){
+			return true;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		saveload : function(event){
+			if(!bitsObjectMng.DataSource.save(event)) bitsObjectMng.DataSource.load(event);
+		},
+
+/////////////////////////////////////////////////////////////////////
+
+
+	},
+
+/////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////
+	XML : {
+		_xmldoc : null,
+
+/////////////////////////////////////////////////////////////////////
+		get serializer(){
+			if(!this._xmldoc) return "";
+			var serializer = new XMLSerializer();
+			return serializer.serializeToString(this._xmldoc);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		createDocument : function(pUri){
+			if(this._xmldoc) this._xmldoc = null;
+			try{
+				var IO = Components.classes['@mozilla.org/network/io-service;1'].getService(Components.interfaces.nsIIOService);
+				var fileHandler = IO.getProtocolHandler("file").QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+				var aFile = fileHandler.getFileFromURLSpec(pUri);
+				var istream = Components.classes['@mozilla.org/network/file-input-stream;1'].createInstance(Components.interfaces.nsIFileInputStream);
+				istream.init(aFile, 1, 0, false);
+				var sstream = Components.classes['@mozilla.org/scriptableinputstream;1'].createInstance(Components.interfaces.nsIScriptableInputStream);
+				sstream.init(istream);
+				var fileContents = sstream.read(sstream.available());
+				sstream.close();
+				istream.close();
+				var domParser = new DOMParser();
+				var xmlDocument = domParser.parseFromString(fileContents, "text/xml");
+				if(xmlDocument && xmlDocument.documentElement.nodeName == "parsererror") xmlDocument = undefined;
+				return xmlDocument;
+			}catch(e){
+				mcDatabaseDialog._dump("XML.createDocument("+pUri+"):"+ e);
+				return undefined;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		parseFromString : function(aString){
+			if(this._xmldoc) this._xmldoc = null;
+			var parser = new DOMParser(); 
+			var xmlDocument = parser.parseFromString(aString,"text/xml"); 
+			if(xmlDocument && xmlDocument.documentElement.nodeName == "parsererror") xmlDocument = undefined;
+			this._xmldoc = xmlDocument;
+			return xmlDocument;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		updateItem : function (pParentNodeName,pItemNodeName,pItemNodeValue){
+			if(!this._xmldoc) return null;
+			var elemParentNode = this._xmldoc.getElementsByTagName(pParentNodeName);
+			if(!elemParentNode || elemParentNode.length == 0){
+				elemParentNode = this._xmldoc.createElement(pParentNodeName);
+				if(elemParentNode) this._xmldoc.appendChild(elemParentNode);
+			}else{
+				elemParentNode = elemParentNode[0];
+			}
+			if(elemParentNode){
+				var elemItemNode = elemParentNode.getElementsByTagName(pItemNodeName);
+				if(!elemItemNode || elemItemNode.length == 0){
+					elemItemNode = this._xmldoc.createElement(pItemNodeName);
+					if(elemItemNode) elemParentNode.appendChild(elemItemNode);
+				}else{
+					elemItemNode = elemItemNode[0];
+					if(elemItemNode && elemItemNode.hasChildNodes()){
+						var childNode = elemItemNode.lastChild;
+						while(childNode){
+							var previousSibling = childNode.previousSibling;
+							elemItemNode.removeChild(childNode);
+							childNode = previousSibling;
+						}
+					}
+				}
+				if(elemItemNode){
+					if(pItemNodeValue && pItemNodeValue != ""){
+						var elemTextNode = this._xmldoc.createTextNode(pItemNodeValue);
+						if(elemTextNode) elemItemNode.appendChild(elemTextNode);
+					}
+				}
+			}
+			this._xmldoc.normalize();
+			if(bitsMarkingCollection._app_version <7) this._xmldoc.normalizeDocument();
+			return elemItemNode;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getItem : function (pParentNodeName,pItemNodeName){
+			var rtnTextValue = null;
+			if(!this._xmldoc) return rtnTextValue;
+			this._xmldoc.normalize();
+			if(bitsMarkingCollection._app_version <7) this._xmldoc.normalizeDocument();
+			var elemParentNode = this._xmldoc.getElementsByTagName(pParentNodeName);
+			if(!elemParentNode || elemParentNode.length == 0) return rtnTextValue;
+			var elemItemNode = null;
+			if(pItemNodeName){
+				elemItemNode = elemParentNode[0].getElementsByTagName(pItemNodeName);
+				if(!elemItemNode || elemItemNode.length == 0) return rtnTextValue;
+				rtnTextValue = elemItemNode;
+			}else{
+				rtnTextValue = elemParentNode;
+			}
+			return rtnTextValue;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		removeItem : function (pParentNodeName,pItemNodeName){
+			if(!this._xmldoc) return;
+			this._xmldoc.normalize();
+			if(bitsMarkingCollection._app_version <7) this._xmldoc.normalizeDocument();
+			var elemParentNode = this._xmldoc.getElementsByTagName(pParentNodeName);
+			if(!elemParentNode || elemParentNode.length == 0) return;
+			elemParentNode = elemParentNode[0];
+			var elemItemNode = elemParentNode.getElementsByTagName(pItemNodeName);
+			if(!elemItemNode || elemItemNode.length == 0) return;
+			elemItemNode = elemItemNode[0];
+			elemParentNode.appendChild(elemItemNode);
+			return;
+		},
+
+/////////////////////////////////////////////////////////////////////
+	},
+
+/////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////
+	XPath : {
+
+		xpe : new XPathEvaluator(),
+
+/////////////////////////////////////////////////////////////////////
+		getOffsetFromParentNode : function(aNode,aOffset){
+			var xPathNode = aNode;
+			var xPathText = "";
+			var tmpOffset = aOffset;
+			var tmpEffectOffset = 0;
+			if(this._isTextNode(xPathNode)) xPathNode = xPathNode.parentNode;
+			if(xPathNode && xPathNode.id && xPathNode.id.indexOf("bits_") == 0) xPathNode = xPathNode.parentNode;
+			tmpEffectOffset = 0;
+			while(xPathNode && xPathNode.id && xPathNode.id.indexOf("bits_") == 0) xPathNode = xPathNode.parentNode;
+			while(xPathNode){
+				xPathText = this.createXPath(xPathNode);
+				if(xPathText.indexOf("bits_") < 0) break;
+				xPathNode = xPathNode.parentNode;
+			}
+			while(xPathText.match(/^(.*)?\/([A-Z]+)\[(\d+)\]$/)){
+				var rpath = RegExp.$1;
+				var rnode = RegExp.$2;
+				var rcnt = RegExp.$3;
+				for(;rcnt>0;rcnt--){
+					var rnode_xpath = this.evaluate(rpath+'/'+rnode+'['+rcnt+']',xPathNode.ownerDocument);
+					if(rnode_xpath){
+						for(r2cnt=0;r2cnt<rnode_xpath.snapshotLength;r2cnt++){
+							var r2node = rnode_xpath.snapshotItem(r2cnt);
+							if(r2node && r2node.id && r2node.id.indexOf("bits_") == 0){
+								xPathNode = r2node.parentNode;
+								rpath = this.createXPath(xPathNode);
+								rcnt = 0;
+								break;
+							}
+						}
+					}
+				}
+				xPathText = rpath;
+			}
+			if(xPathNode){
+				xPathText = this.createXPath(xPathNode);
+				if(this._isTextNode(aNode)){
+					var nodeWalker = xPathNode.ownerDocument.createTreeWalker(xPathNode,NodeFilter.SHOW_TEXT,null,false);
+					var txtNode=nodeWalker.nextNode();
+					if(txtNode){
+						for(;txtNode && txtNode != aNode;txtNode = nodeWalker.nextNode()){
+							tmpOffset += txtNode.nodeValue.length;
+						}
+						if(txtNode == aNode){
+							var xContext = txtNode.nodeValue;
+							if(txtNode.nodeValue.length>xContext.length) tmpOffset -= (txtNode.nodeValue.length-xContext.length);
+						}
+					}else{
+						tmpOffset = 0;
+					}
+				}else{
+					var nodeWalker = xPathNode.ownerDocument.createTreeWalker(aNode,NodeFilter.SHOW_TEXT,null,false);
+					var aTxtNode=nodeWalker.nextNode();
+					if(aTxtNode){
+						var nodeWalker = xPathNode.ownerDocument.createTreeWalker(xPathNode,NodeFilter.SHOW_TEXT,null,false);
+						var txtNode=nodeWalker.nextNode();
+						if(txtNode){
+							for(;txtNode && txtNode != aTxtNode;txtNode = nodeWalker.nextNode()){
+								tmpOffset += txtNode.nodeValue.length;
+							}
+							if(txtNode == aNode){
+								var xContext = txtNode.nodeValue;
+								if(txtNode.nodeValue.length>xContext.length) tmpOffset -= (txtNode.nodeValue.length-xContext.length);
+							}
+						}else{
+							tmpOffset = 0;
+						}
+					}
+				}
+			}
+			tmpOffset -= tmpEffectOffset;
+			return {
+				node   : xPathNode,
+				xpath  : xPathText,
+				offset : tmpOffset,
+				type   : aNode.nodeType,
+			};
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getCurrentNodeFromXPath : function(aDoc,aXPath,aOffset,aType){
+			try{
+				var rtnNode = null;
+				var tmpOffset = aOffset;
+				try{var evaluateNode = this.evaluate(aXPath,aDoc).snapshotItem(0);}catch(e){bitsObjectMng._dump("bitsObjectMng.XPath.getCurrentNodeFromXPath():"+e);}
+				if(evaluateNode && aType == 3){
+					var nodeWalker = aDoc.createTreeWalker(evaluateNode,NodeFilter.SHOW_TEXT,null,false);
+					var txtNode=nodeWalker.nextNode();
+					if(txtNode){
+						for(;txtNode;txtNode = nodeWalker.nextNode()){
+							if(tmpOffset - txtNode.nodeValue.length<0 || (tmpOffset>0 && (tmpOffset - txtNode.nodeValue.length)==0)){
+								rtnNode = txtNode;
+								break;
+							}
+							tmpOffset -= txtNode.nodeValue.length;
+							nodeWalker.currentNode = txtNode;
+						}
+					}else{
+						rtnNode = evaluateNode;
+					}
+				}else{
+					rtnNode = evaluateNode;
+				}
+				return { node: rtnNode, offset : tmpOffset};
+			}catch(ex){
+				bitsObjectMng._dump("bitsObjectMng.XPath.getCurrentNodeFromXPath():"+ex);
+				return undefined;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		_isTextNode : function(aNode){ 
+			return aNode.nodeType == aNode.TEXT_NODE;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getDocument : function(aNode){
+			return (aNode.ownerDocument == null ? aNode : aNode.ownerDocument);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getDocumentElement : function(aNode){
+			return (aNode.ownerDocument == null ? aNode.documentElement : aNode.ownerDocument.documentElement);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		createNSResolver : function(aNode){
+			return this.xpe.createNSResolver(this.getDocumentElement(aNode));
+		},
+
+/////////////////////////////////////////////////////////////////////
+		evaluateArray : function(aExpr, aNode){
+			var found = [];
+			try{
+				var result = this.xpe.evaluate(aExpr, aNode, this.createNSResolver(aNode), 0, null);
+				var res;
+				while(res = result.iterateNext()) found.push(res);
+			}catch(e){}
+			return found;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		evaluate : function(aExpr, aNode){
+			var rtn = this.xpe.evaluate(aExpr, aNode, this.createNSResolver(aNode), XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
+			if(rtn.snapshotLength == 0) rtn = this.getDocument(aNode).evaluate(aExpr, aNode, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
+			return rtn;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		isPMC : function(aNode){
+			if(!aNode || !aNode.ownerDocument) return false;
+			if(aNode.ownerDocument.URL.match(/^http:\/\/www\.pubmedcentral\.nih\.gov\//)) return true;
+			if(aNode.ownerDocument.URL.match(/^http:\/\/www\.ncbi\.nlm\.nih\.gov\/pmc\//)) return true;
+			return false;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		isUseNodeId : function(aNode){
+			if(!aNode.id || aNode.id.match(/^bits_/)) return false;
+			if(aNode.ownerDocument && aNode.ownerDocument.URL.match(/^https:\/\/mail\.google\.com\//)) return false;
+			var id_check = this.isPMC(aNode);
+			if(id_check && aNode.id.match(/^[A-Za-z_]+\d+[a-z]*$/)) return false;
+			var id_nodes = this.evaluate('//*[@id="'+aNode.id+'"]', aNode);
+			if(id_nodes.snapshotLength>1) return false;
+			return true;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		createXPath : function(aNode){
+			var nodeName = (aNode.nodeType == Node.ELEMENT_NODE) ? aNode.localName.toLowerCase() : (aNode.nodeType == Node.TEXT_NODE) ? 'text()' : (aNode.nodeType == Node.COMMENT_NODE) ? 'comment()' : '*';
+			if(this.isUseNodeId(aNode)) return '//'+nodeName+'[@id="'+aNode.id+'"]';
+			var path = [];
+			var node = aNode;
+			var i;
+			var j;
+			var tarNode;
+			var tarNodeName;
+			var ancestorNodes = []
+			var nodes = this.evaluate('ancestor::*', node);
+			var len = nodes.snapshotLength;
+			for(i=0;i<len;i++){ ancestorNodes.push(nodes.snapshotItem(i)); }
+			for(i=ancestorNodes.length-1;i>=0;i--){
+				tarNode = ancestorNodes[i];
+				if(tarNode.id && this.isUseNodeId(tarNode)) break;
+				nodes = this.evaluate('preceding-sibling::*[@id]', tarNode);
+				tarNode = null;
+				len = nodes.snapshotLength;
+				for(j=len-1;j>=0;j--){
+					tarNode = nodes.snapshotItem(j);
+					if(this.isUseNodeId(tarNode)) break;
+					tarNode = null;
+				}
+				if(tarNode) break;
+			}
+			if(tarNode){
+				tarNodeName = '//'+tarNode.localName.toLowerCase()+'[@id="'+tarNode.id+'"]';
+			}else{
+				tarNode = this.getDocumentElement(node);
+				tarNodeName = '/'+tarNode.localName.toLowerCase()+'[1]';
+			}
+			while(tarNode.parentNode != node.parentNode){
+				nodes = this.evaluate('preceding-sibling::'+nodeName, node);
+				path.unshift(nodeName+'['+(nodes.snapshotLength+1)+']');
+				node = node.parentNode;
+				nodeName = node.localName.toLowerCase();
+			}
+			if(tarNode != node){
+				var axis = 'following-sibling::';
+				nodes = this.evaluate(axis+nodeName, tarNode);
+				len = nodes.snapshotLength;
+				for(i=0;i<len&&nodes.snapshotItem(i)!=node;i++){}
+				path.unshift(axis+nodeName+'['+(i+1)+']');
+			}
+			path.unshift(tarNodeName);
+			return path.join('/');
+		},
+	},
+
+/////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////
+	Database : {
+		_dbConn : [],
+
+		_lastModifiedTime : [],
+		_checktimer : null,
+		_Listener : [],
+
+		_defaultMode    : "local",
+		_sharedMode     : "shared",
+		_repositoryMode : "repository",
+
+		_seq    : [],
+		_seqmin : "",
+
+		_version : "1.0",
+
+/////////////////////////////////////////////////////////////////////
+		get version(){
+			return this._version;
+		},
+		getVersion : function(aMode){
+			if(!aMode) return undefined;
+			if(!this._dbConn[aMode]) return undefined;
+			if(!this._dbConn[aMode].tableExists("om_version")) return undefined;
+			var lSql = 'select max(version) as version from om_version';
+			var lFld = [];
+			var statement = this._dbConn[aMode].createStatement(lSql);
+			if(!this.beginTransaction(aMode)) return null;
+			while(statement.executeStep()){
+				var row = {};
+				for(var j=0,k=statement.columnCount;j<k;j++){
+					row[statement.getColumnName(j)] = statement.getUTF8String(j);
+					if(row[statement.getColumnName(j)] == "null") row[statement.getColumnName(j)] = "";
+				}
+				lFld.push(row);
+			}
+			this.endTransaction(aMode);
+			statement.reset();
+			statement = undefined;
+			return (lFld && lFld.length>0 ? lFld[0].version : undefined);
+		},
+
+		_updateOidProperty : function (obj,aMode){
+			if(obj.oid_property == undefined) return undefined;
+			try{
+				var parser = new DOMParser();
+				try{var xmldoc = parser.parseFromString(obj.oid_property, "text/xml");}catch(e){
+					bitsObjectMng._dump("bitsObjectMng.Database._updateOidProperty():"+e);
+				}
+				parser = undefined;
+				if(xmldoc && xmldoc.documentElement.nodeName == "parsererror"){
+					obj.oid_property = undefined;
+					xmldoc = undefined;
+					return undefined;
+				}
+				if(xmldoc){
+					var xmlnode = xmldoc.getElementsByTagName("ARTICLE_INFO")[0];
+					if(xmlnode){
+						var domParser = new DOMParser();
+						var xmlDocument = domParser.parseFromString("<ARTICLE_INFO></ARTICLE_INFO>", "text/xml");
+						domParser = undefined;
+						if(xmlDocument){
+							for(var dcnt=0;dcnt<xmlnode.childNodes.length;dcnt++){
+								xmlDocument.documentElement.appendChild(xmlnode.childNodes[dcnt].cloneNode(true));
+							}
+							var removeElem = false;
+							for(var dcnt=xmlnode.childNodes.length-1;dcnt>=0;dcnt--){
+								var nodeName = xmlnode.childNodes[dcnt].nodeName;
+								if(nodeName == "DOC_INFO"){
+									var xmlnode2 = xmlnode.childNodes[dcnt];
+									for(var dcnt2=xmlnode2.childNodes.length-1;dcnt2>=0;dcnt2--){
+										if(xmlnode2.childNodes[dcnt2].nodeName == "PMID" || xmlnode2.childNodes[dcnt2].nodeName == "TI") continue;
+										xmlnode2.removeChild(xmlnode2.childNodes[dcnt2]);
+										removeElem = true;
+									}
+									continue;
+								}
+								if(nodeName == "DOC_MEDLINE_INFO"){
+									var xmlnode2 = xmlnode.childNodes[dcnt];
+									for(var dcnt2=xmlnode2.childNodes.length-1;dcnt2>=0;dcnt2--){
+										if(xmlnode2.childNodes[dcnt2].nodeName == "AU" || xmlnode2.childNodes[dcnt2].nodeName == "TA" || xmlnode2.childNodes[dcnt2].nodeName == "DP") continue;
+										xmlnode2.removeChild(xmlnode2.childNodes[dcnt2]);
+										removeElem = true;
+									}
+									continue;
+								}
+								if(nodeName == "SECTIONS"){
+									var xmlnodes = xmlnode.childNodes[dcnt].getElementsByTagName("SECTION");
+									for(var dcnts=0;dcnts<xmlnodes.length;dcnts++){
+										var xmlnode2 = xmlnodes[dcnts];
+										for(var dcnt2=xmlnode2.childNodes.length-1;dcnt2>=0;dcnt2--){
+											if(xmlnode2.childNodes[dcnt2].nodeName == "TITLE") continue;
+											xmlnode2.removeChild(xmlnode2.childNodes[dcnt2]);
+											removeElem = true;
+										}
+									}
+									continue;
+								}
+								xmlnode.removeChild(xmlnode.childNodes[dcnt]);
+								removeElem = true;
+							}
+							if(removeElem){
+								var s = new XMLSerializer();
+								var xml = s.serializeToString(xmlDocument);
+								s = undefined;
+								var pFile = this.getObjectPropertyDir(obj.oid,aMode);
+								pFile.append("article_info.xml");
+								bitsObjectMng.Common.writeFile(pFile,xml,'UTF-8');
+							}
+							xmlDocument = undefined;
+						}
+						xmlnode = undefined;
+					}else{
+						var pFile = this.getObjectPropertyDir(obj.oid,aMode);
+						pFile.append("article_info.xml");
+						if(pFile.exists()) pFile.remove(true);
+					}
+					var s = new XMLSerializer();
+					obj.oid_property = s.serializeToString(xmldoc);
+					s = undefined;
+				}
+			}catch(ex){
+				bitsObjectMng._dump("bitsObjectMng.Database._convert():"+ex);
+			}
+			return obj.oid_property;
+		},
+
+		_getStatementValue : function(aStatement,aIndex){
+			try{
+				var rtn = {};
+				rtn.name = aStatement.getColumnName(aIndex);
+				rtn.type = aStatement.getTypeOfIndex(aIndex);
+				switch(rtn.type){
+					case aStatement.VALUE_TYPE_INTEGER :
+					case aStatement.VALUE_TYPE_FLOAT :
+					case aStatement.VALUE_TYPE_TEXT :
+						rtn.value = aStatement.getUTF8String(aIndex);
+						break;
+					case aStatement.VALUE_TYPE_BLOB :
+						var array = {};
+						var size = {};
+						aStatement.getBlob(aIndex,size,array);
+						rtn.value = array.value;
+						break;
+					default :
+						break;
+				}
+				return rtn;
+			}catch(e){
+				bitsObjectMng._dump("bitsObjectMng.Database._getStatementValue():"+e);
+				return undefined;
+			}
+		},
+
+		_setStatementValue : function(aStatement,aIndex,aValue,aType){
+			try{
+				if(aType == undefined) aType = aStatement.VALUE_TYPE_TEXT;
+				if(aValue == undefined){
+					aStatement.bindNullParameter(aIndex);
+				}else{
+					switch(aType){
+						case aStatement.VALUE_TYPE_INTEGER :
+						case aStatement.VALUE_TYPE_FLOAT :
+						case aStatement.VALUE_TYPE_TEXT :
+							aStatement.bindUTF8StringParameter(aIndex,aValue);
+							break;
+						case aStatement.VALUE_TYPE_BLOB :
+							aStatement.bindBlobParameter(aIndex,aValue,aValue.length);
+							break;
+						default :
+							break;
+					}
+				}
+			}catch(e){
+				bitsObjectMng._dump("bitsObjectMng.Database._setStatementValue():"+e);
+			}
+		},
+
+		_convert : function(aMode,aTable){
+			var type = {};
+			var statement = this._dbConn[aMode].createStatement("PRAGMA TABLE_INFO("+aTable+")");
+			try{
+				var columnCount = statement.columnCount;
+				while (statement.executeStep()){
+					var pname;
+					var ptype;
+					for(var index=0;index<columnCount;index++){
+						switch(statement.getColumnName(index)){
+							case "name":
+								pname = statement.getUTF8String(index);
+								break;
+							case "type":
+								ptype = statement.getUTF8String(index);
+								switch(ptype){
+									case "TEXT":
+										type[pname] = statement.VALUE_TYPE_TEXT;
+										break;
+									case "NUMERIC":
+										type[pname] = statement.VALUE_TYPE_FLOAT;
+										break;
+									case "INTEGER":
+										type[pname] = statement.VALUE_TYPE_INTEGER;
+										break;
+									case "BLOB":
+										type[pname] = statement.VALUE_TYPE_BLOB;
+										break;
+								}
+								break;
+							default:
+								break;
+						}
+					}
+				}
+			}catch(e){
+				bitsObjectMng._dump("bitsObjectMng.Database._convert():"+e);
+			} finally {
+				statement.reset();
+			}
+			statement = undefined;
+
+			var pos = 0;
+			var rows = [];
+			var statement = this._dbConn[aMode].createStatement("select * from "+aTable);
+			try{
+				var columnCount = statement.columnCount;
+				while (statement.executeStep()){
+					var obj = {};
+					for(pos=0;pos<columnCount;pos++){
+						var rtn = this._getStatementValue(statement,pos);
+						if(!rtn) continue;
+						if(rtn.value != undefined) obj[rtn.name] = (rtn.type==statement.VALUE_TYPE_TEXT?unescape(rtn.value):rtn.value);
+					}
+					rows.push(obj);
+					obj = undefined;
+				}
+			}catch(e){
+				bitsObjectMng._dump("bitsObjectMng.Database._convert():"+e);
+			} finally {
+				statement.reset();
+			}
+			statement = undefined;
+
+			if((type.fid != undefined || type.oid != undefined) && rows.length>0){
+				var sql = "update "+aTable+" set ";
+				var column = [];
+				var names = [];
+				var obj = rows[0];
+				var index = 0;
+				for(var name in type){
+					if(type.fid != undefined && name == "fid") continue;
+					if(type.oid != undefined && name == "oid") continue;
+					if(type[name] != 3) continue;
+					index++;
+					column.push(name + "=?" + index);
+					names.push(name);
+				}
+				sql += column.join(",");
+				if(type.fid != undefined){
+					sql += " where fid=?" + (++index);
+				}else if(type.oid != undefined){
+					sql += " where oid=?" + (++index);
+				}
+				statement = this._dbConn[aMode].createStatement(sql);
+				for(pos=0;pos<rows.length;pos++){
+					var statement_c = statement.clone();
+					var obj = rows[pos]
+					if(obj.oid_property) obj.oid_property = this._updateOidProperty(obj,aMode);
+					for(index=0;index<names.length;index++){
+						this._setStatementValue(statement_c,index,obj[names[index]],type[names[index]]);
+					}
+					if(type.fid != undefined){
+						this._setStatementValue(statement_c,index,obj.fid,type.fid);
+					}else if(type.oid != undefined){
+						this._setStatementValue(statement_c,index,obj.oid,type.oid);
+					}
+					try{
+						statement_c.execute();
+					}catch(e){
+						bitsObjectMng._dump("bitsObjectMng.Database._convert():"+e);
+					} finally {
+						statement_c.reset();
+					}
+					statement_c = undefined;
+				}
+				statement = undefined;
+			}
+			return true;
+		},
+
+		_convertExec : function(aMode,aTable,type,rows,names,statement,progressWindow,offset){
+			var LIMIT = 10;
+			if(!progressWindow){
+				var x = screen.width;
+				var y = screen.height;
+				progressWindow = window.openDialog(
+					"chrome://markingcollection/content/progress.xul",
+					"myProgress", "chrome,centerscreen,alwaysRaised,dependent=yes,left="+x+",top="+y, 
+					{status: bitsObjectMng.STRING.getString("CONVERT_DATABASE") + "..."});
+				setTimeout(function(){bitsObjectMng.Database._convertExec(aMode,aTable,undefined,undefined,undefined,undefined,progressWindow);},0);
+				return;
+			}
+			if(!type || !rows){
+				if(offset == undefined) offset = 0;
+				var ourTransaction = false;
+				if(this._dbConn[aMode].transactionInProgress){
+					this._dbConn[aMode].beginTransactionAs(this._dbConn[aMode].TRANSACTION_DEFERRED);
+				}
+				type = {};
+				var statement = this._dbConn[aMode].createStatement("PRAGMA TABLE_INFO("+aTable+")");
+				try{
+					var columnCount = statement.columnCount;
+					while (statement.executeStep()){
+						var pname;
+						var ptype;
+						for(var index=0;index<columnCount;index++){
+							switch(statement.getColumnName(index)){
+								case "name":
+									pname = statement.getUTF8String(index);
+									break;
+								case "type":
+									ptype = statement.getUTF8String(index);
+									switch(ptype){
+										case "TEXT":
+											type[pname] = statement.VALUE_TYPE_TEXT;
+											break;
+										case "NUMERIC":
+											type[pname] = statement.VALUE_TYPE_FLOAT;
+											break;
+										case "INTEGER":
+											type[pname] = statement.VALUE_TYPE_INTEGER;
+											break;
+										case "BLOB":
+											type[pname] = statement.VALUE_TYPE_BLOB;
+											break;
+									}
+									break;
+								default:
+									break;
+							}
+						}
+					}
+				}catch(e){
+					bitsObjectMng._dump("bitsObjectMng.Database._convert():"+e);
+				} finally {
+					statement.reset();
+				}
+				statement = undefined;
+
+				var pos = 0;
+				rows = [];
+				var selectFld = "*";
+				if(aTable == "om_object") selectFld = "oid,doc_title,doc_url,con_url,bgn_dom,end_dom,oid_title,oid_property,oid_mode,oid_type,oid_txt,oid_date";
+				var statement = this._dbConn[aMode].createStatement("select "+ selectFld + " from "+aTable + " limit " + LIMIT + " offset " + offset);
+				try{
+					var columnCount = statement.columnCount;
+					while (statement.executeStep()){
+						var obj = {};
+						for(pos=0;pos<columnCount;pos++){
+							var rtn = this._getStatementValue(statement,pos);
+							if(!rtn) continue;
+							if(rtn.value != undefined) obj[rtn.name] = (rtn.type==statement.VALUE_TYPE_TEXT?unescape(rtn.value):rtn.value);
+						}
+						rows.push(obj);
+						obj = undefined;
+					}
+				}catch(e){
+					bitsObjectMng._dump("bitsObjectMng.Database._convert():"+e);
+				} finally {
+					statement.reset();
+				}
+				statement = undefined;
+			}
+			if((type.fid != undefined || type.oid != undefined) && rows.length>0){
+				if(!statement){
+					var sql = "update "+aTable+" set ";
+					var column = [];
+					names = [];
+					var obj = rows[0];
+					var index = 0;
+					for(var name in type){
+						if(type.fid != undefined && name == "fid") continue;
+						if(type.oid != undefined && name == "oid") continue;
+						if(type[name] != 3) continue;
+						index++;
+						column.push(name + "=?" + index);
+						names.push(name);
+					}
+					sql += column.join(",");
+					if(type.fid != undefined){
+						sql += " where fid=?" + (++index);
+					}else if(type.oid != undefined){
+						sql += " where oid=?" + (++index);
+					}
+					statement = this._dbConn[aMode].createStatement(sql);
+				}
+				if(rows.length>0){
+					var cnt;
+					for(cnt=0;cnt<1 && rows.length>0;cnt++){
+						var pos = rows.length;
+						var obj = rows.shift();
+						var statement_c = statement.clone();
+						if(obj.oid_property) obj.oid_property = this._updateOidProperty(obj,aMode);
+						for(index=0;index<names.length;index++){
+							this._setStatementValue(statement_c,index,obj[names[index]],type[names[index]]);
+						}
+						if(type.fid != undefined){
+							this._setStatementValue(statement_c,index,obj.fid,type.fid);
+						}else if(type.oid != undefined){
+							this._setStatementValue(statement_c,index,obj.oid,type.oid);
+						}
+						try{
+							statement_c.execute();
+						}catch(e){
+							bitsObjectMng._dump("bitsObjectMng.Database._convert():"+e);
+							for(index=0;index<names.length;index++){
+								bitsObjectMng._dump2("bitsObjectMng.Database._convert():["+index+"]["+type[names[index]]+"]["+names[index]+"]["+obj[names[index]]+"]");
+							}
+						} finally {
+							statement_c.reset();
+						}
+						statement_c = undefined;
+					}
+					if(rows.length == 0){
+						offset += LIMIT;
+						rows = undefined;
+					}
+					setTimeout(function(){bitsObjectMng.Database._convertExec(aMode,aTable,type,rows,names,statement,progressWindow,offset);},0);
+				}
+			}else if(rows.length==0){
+				type = undefined;
+				rows = undefined;
+				statement = undefined;
+
+				if(!this._dbConn[aMode].tableExists("om_version")) this._dbConn[aMode].executeSimpleSQL("CREATE TABLE om_version (version NUMERIC NOT NULL)");
+				this._dbConn[aMode].executeSimpleSQL("insert into om_version (version) values ('"+this.version+"')");
+				if(this._dbConn[aMode].transactionInProgress) this._dbConn[aMode].commitTransaction();
+
+				if(progressWindow && !progressWindow.closed) progressWindow.close();
+				progressWindow = undefined;
+				bitsObjectMng.Common.alert(bitsObjectMng.STRING.getString("CONVERT_END_DATABASE"));
+				var appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(Components.interfaces.nsIAppStartup);
+				var quitSeverity = appStartup.eAttemptQuit;
+				appStartup.quit(quitSeverity | appStartup.eRestart);
+				return;
+			}
+			if(progressWindow && !progressWindow.closed){
+				if(progressWindow.setStatus) progressWindow.setStatus(bitsObjectMng.STRING.getString("CONVERT_DATABASE") + "... [ "+ (offset+ (rows?(LIMIT-rows.length):0)) + " ]");
+				progressWindow.focus();
+			}
+			return true;
+		},
+
+		convert : function(aMode){
+			if(!aMode) return undefined;
+			if(!this._dbConn[aMode]) return undefined;
+			var version = this.getVersion(aMode);
+			if(parseFloat(version?version:0)>=parseFloat(this.version)) return;
+			var dbFile = this._dbConn[aMode].databaseFile.clone();
+			var aBackupFile = dbFile.parent.clone();
+			aBackupFile.append(dbFile.leafName+".old");
+			var bgcnt=0;
+			while(aBackupFile.exists()){
+				aBackupFile = dbFile.parent.clone();
+				aBackupFile.append(dbFile.leafName+".old."+(++bgcnt));
+			}
+			dbFile.copyTo(aBackupFile.parent ,aBackupFile.leafName);
+			var x = screen.width;
+			var y = screen.height;
+			progressWindow = window.openDialog(
+				"chrome://markingcollection/content/progress.xul",
+				"myProgress", "chrome,centerscreen,alwaysRaised,dependent=yes,left="+x+",top="+y, 
+				{status: bitsObjectMng.STRING.getString("CONVERT_DATABASE") + "..."});
+			setTimeout(function(){
+				var ourTransaction = false;
+				if (bitsObjectMng.Database._dbConn[aMode].transactionInProgress){
+					ourTransaction = true;
+					bitsObjectMng.Database._dbConn[aMode].beginTransactionAs(bitsObjectMng.Database._dbConn[aMode].TRANSACTION_DEFERRED);
+				}
+				if(!bitsObjectMng.Database._convert(aMode,"om_folder")) return;
+				if(ourTransaction) bitsObjectMng.Database._dbConn[aMode].commitTransaction();
+				setTimeout(function(){bitsObjectMng.Database._convertExec(aMode,"om_object",undefined,undefined,undefined,undefined,progressWindow);},0);
+			},0);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		init : function(aMode,aDBFile){
+			try{
+				if(aMode == undefined || aMode == "") aMode = bitsObjectMng.Database._defaultMode;
+				bitsObjectMng.Database.connect(aMode,aDBFile);
+				if(bitsObjectMng.Database._dbConn[aMode]){
+					bitsObjectMng.Database._createTable(aMode);
+					bitsObjectMng.Database._updateLastModifiedTime(aMode);
+					bitsObjectMng.Database._startUpdateCheck(aMode);
+				}else{
+					bitsObjectMng.Database._lastModifiedTime[aMode] = 0;
+				}
+			}catch(e){bitsObjectMng._dump("bitsObjectMng.Database.init("+aMode+"):"+e)}
+			return bitsObjectMng.Database._dbConn[aMode];
+		},
+/////////////////////////////////////////////////////////////////////
+		done : function(aMode,aVacuum){
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			if(this._dbConn[aMode]){
+				var dbFile = this._dbConn[aMode].databaseFile.clone();
+				this.disconnect(aMode,aVacuum);
+				this.backup(dbFile);
+				this._lastModifiedTime[aMode] = 0;
+				this._stopUpdateCheck(aMode);
+				delete this._dbConn[aMode];
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		backup : function(aFile){
+			try{
+				var bDir = bitsObjectMng.Common.getExtensionDir();
+				bDir.append("backup");
+				var aBackupFile = bDir.clone();
+				aBackupFile.append(aFile.leafName+".1");
+				if(aBackupFile.exists() && aFile.exists()){
+					if(aBackupFile.lastModifiedTime == aFile.lastModifiedTime) return;
+				}
+				for(var i=4;i>0;i--){
+					var aFile1 = bDir.clone();
+					aFile1.append(aFile.leafName+"."+i);
+					if(!aFile1.exists()) continue;
+					var aFile2 = bDir.clone();
+					aFile2.append(aFile.leafName+"."+(i+1));
+					if(aFile2.exists()) aFile2.remove(true);
+					aFile1.moveTo(aFile2.parent ,aFile2.leafName);
+				}
+				if(aBackupFile.exists()) aBackupFile.remove(true);
+				aFile.copyTo(aBackupFile.parent ,aBackupFile.leafName);
+			}catch(e){}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		_updateLastModifiedTime : function(aMode){
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			if(this._dbConn[aMode]){
+				var aFile = this._dbConn[aMode].databaseFile.clone();
+				if(aFile && aFile.exists()){
+					this._lastModifiedTime[aMode] = aFile.lastModifiedTime;
+				}else{
+					this._lastModifiedTime[aMode] = 0;
+				}
+			}else{
+				this._lastModifiedTime[aMode] = 0;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		_startUpdateCheck : function(aMode){
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			this._stopUpdateCheck(aMode);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		_stopUpdateCheck : function(aMode){
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			if(this._checktimer){
+				clearInterval(this._checktimer);
+				this._checktimer = null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		_updateCheck : function(aMode){
+			if(aMode == undefined || aMode == ""){
+				var mode;
+				for(mode in this._dbConn){
+					if(typeof this._dbConn[mode] == "function") continue;
+					var tmpRtn = bitsObjectMng.Database._updateCheck(mode);
+					if(tmpRtn) return true;
+				}
+				return false;
+			}
+			var rtn = false;
+			if(bitsObjectMng.Database._dbConn[aMode]){
+				var aFile = bitsObjectMng.Database._getConnectFile(aMode);
+				if(bitsObjectMng.Database._lastModifiedTime[aMode] != aFile.lastModifiedTime){
+					if(!bitsObjectMng.Database.lockDB(aMode)) return false;
+					bitsObjectMng.Database._updateLastModifiedTime(aMode);
+					rtn = true;
+					bitsObjectMng.Database.unlockDB(aMode);
+				}
+			}
+			return rtn;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		addEventListener : function(aType,aFunc,aBool,aMode){
+			if(!aType || !aFunc) return;
+			if(aMode == undefined || aMode == "") aMode = bitsObjectMng.Database._defaultMode;
+			aType = aType.toLowerCase();
+			aMode = aMode.toLowerCase();
+			if(!this._Listener) this._Listener = [];
+			if(!this._Listener[aMode]) this._Listener[aMode] = [];
+			if(!this._Listener[aMode][aType]) this._Listener[aMode][aType] = [];
+			if(!this._Listener[aMode][aType][aFunc]) this._Listener[aMode][aType][aFunc] = aFunc;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		removeEventListener : function(aType,aFunc,aBool,aMode){
+			if(!aType || !aFunc) return;
+			if(aMode == undefined || aMode == "") aMode = bitsObjectMng.Database._defaultMode;
+			aType = aType.toLowerCase();
+			aMode = aMode.toLowerCase();
+			if(!this._Listener) return;
+			if(!this._Listener[aMode]) return;
+			if(!this._Listener[aMode][aType]) return;
+			if(this._Listener[aMode][aType][aFunc]) this._Listener[aMode][aType][aFunc] = undefined;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		_execEventListener : function(aType,aBool,aMode){
+			if(!aType) return;
+			if(aMode == undefined || aMode == "") aMode = bitsObjectMng.Database._defaultMode;
+			aType = aType.toLowerCase();
+			aMode = aMode.toLowerCase();
+			if(!this._Listener) return;
+			if(!this._Listener[aMode]) return;
+			if(!this._Listener[aMode][aType]) return;
+			var key;
+			for(key in this._Listener[aMode][aType]){
+				var func = this._Listener[aMode][aType][key];
+				if(func) (func)();
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		_getConnectFile : function(aMode){
+			var dbFile = null;
+			if(typeof(aMode) == "string"){
+				if(aMode == this._defaultMode){
+					dbFile = bitsObjectMng.Common.getExtensionDir().clone();
+					var olddb = dbFile.clone();
+					olddb.append("objectmng.sqlite");
+					if(olddb.exists()) olddb.moveTo(dbFile,aMode+".sqlite");
+					dbFile.append(aMode+".sqlite");
+				}else{
+					var dbpath = nsPreferences.copyUnicharPref("wiredmarker.dbpath."+aMode,"");
+					if(dbpath == ""){
+						var dir = bitsObjectMng.Common.getExtensionDir().clone();
+						if(!dir.exists()) dir.create(dir.DIRECTORY_TYPE, 0770);
+						dbpath = dir.path;
+					}
+					if(dbpath != ""){
+						dbFile = bitsObjectMng.Common.convertPathToFile(dbpath);
+						if(!dbFile.exists()) dbFile.create(dir.DIRECTORY_TYPE, 0777);
+						dbFile.append(aMode+".sqlite");
+					}
+				}
+			}
+			return dbFile;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		connect : function(aMode,aDBFile){
+			var dbFile = undefined;
+			if(aDBFile != undefined){
+				dbFile = aDBFile;
+			}else{
+				dbFile = bitsObjectMng.Database._getConnectFile(aMode);
+			}
+			if(!this._dbConn[aMode] && dbFile){
+				try{
+					this._dbConn[aMode] = bitsObjectMng.Common.STORAGE.openDatabase(dbFile);
+				}catch(e){
+					bitsObjectMng._dump("bitsObjectMng.Database.connect("+aMode+","+dbFile.path+"):"+e)
+					this._dbConn[aMode] = undefined;
+				}
+			}
+			return (this._dbConn[aMode] != undefined);
+		},
+/////////////////////////////////////////////////////////////////////
+		disconnect : function(aMode,aVacuum){
+			if(aMode == undefined || aMode == "") aMode = bitsObjectMng.Database._defaultMode;
+			if(aVacuum == undefined) aVacuum = false;
+			try{
+				if(aVacuum) this.vacuum(aMode);
+			}catch(ex){};
+			this._dbConn[aMode] = undefined;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		vacuum : function(aMode){
+			if(aMode == undefined || aMode == "") aMode = bitsObjectMng.Database._defaultMode;
+			try{
+				this._dbConn[aMode].executeSimpleSQL("VACUUM");
+			}catch(ex){
+				bitsObjectMng._dump("bitsObjectMng.Database.vacuum():"+ex);
+			};
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getDatabaseFile : function(aMode){
+			if(aMode == undefined || aMode == "") aMode = bitsObjectMng.Database._defaultMode;
+			if(this._dbConn[aMode] == undefined) this.init(aMode);
+			return this._dbConn[aMode].databaseFile;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		attach : function(aAttachMode,aMode){
+			if(!aAttachMode) return false;
+			if(this._dbConn[aAttachMode] == undefined) this.init(aAttachMode);
+			if(!this._dbConn[aAttachMode]) return false;
+			var path = this._dbConn[aAttachMode].databaseFile.path;
+			var sql = 'ATTACH DATABASE "'+ path + '" AS "' + aAttachMode + '"';
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			try{
+				this._dbConn[aMode].executeSimpleSQL(sql);
+			}catch(ex){
+				bitsObjectMng._dump("bitsObjectMng.Database.attach():"+ex);
+				bitsObjectMng._dump("bitsObjectMng.Database.attach():"+sql);
+				return false;
+			}
+			return true;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		_createTable : function(aMode){
+			var ourTransaction = false;
+			try{
+				var createTable = !this._dbConn[aMode].tableExists("om_object");
+				if(!createTable) createTable = !this._dbConn[aMode].tableExists("om_link");
+				if(!createTable) createTable = !this._dbConn[aMode].tableExists("om_folder");
+				if(!createTable) createTable = !this._dbConn[aMode].tableExists("om_favicon");
+
+				if(!createTable) createTable = !this._dbConn[aMode].indexExists("om_object_index_url");
+				if(!createTable) createTable = !this._dbConn[aMode].indexExists("om_object_index_type");
+				if(!createTable) createTable = !this._dbConn[aMode].indexExists("om_object_index_oid");
+				if(!createTable) createTable = !this._dbConn[aMode].indexExists("om_object_index_con_url");
+				if(!createTable) createTable = !this._dbConn[aMode].indexExists("om_object_index_oid_date");
+
+				if(!createTable) createTable = !this._dbConn[aMode].indexExists("om_link_index_pfid");
+				if(!createTable) createTable = !this._dbConn[aMode].indexExists("om_link_index_oid");
+
+				if(!createTable) createTable = !this._dbConn[aMode].indexExists("om_folder_index_pfid");
+
+				if(createTable){
+					if(!this.beginTransaction(aMode)) return;
+					if(!this._dbConn[aMode].tableExists("om_object")){
+						this._dbConn[aMode].executeSimpleSQL(
+							"CREATE TABLE om_object (" +
+							"  oid          INTEGER," +
+							"  doc_title    TEXT NOT NULL," +
+							"  doc_url      TEXT NOT NULL," +
+							"  con_url      TEXT NOT NULL," +
+							"  bgn_dom      TEXT," +
+							"  end_dom      TEXT," +
+							"  oid_title    TEXT," +
+							"  oid_property TEXT," +
+							"  oid_mode     INTEGER DEFAULT 0," +
+							"  oid_type     TEXT NOT NULL," +
+							"  oid_txt      TEXT," +
+							"  oid_img      BLOB DEFAULT NULL,"+
+							"  oid_date     TEXT," +
+                                                        "  dasish_aid   TEXT," + // annotation id from DASISH REST backend response
+							"PRIMARY KEY (oid)"+
+							")"
+						);
+						if(!this._dbConn[aMode].tableExists("om_version")){
+							this._dbConn[aMode].executeSimpleSQL(
+								"CREATE TABLE om_version (" +
+								"  version      NUMERIC NOT NULL" +
+								")"
+							);
+							this._dbConn[aMode].executeSimpleSQL("insert into om_version (version) values ('"+this.version+"')");
+						}
+					}
+					if(!this._dbConn[aMode].tableExists("om_link")){
+						this._dbConn[aMode].executeSimpleSQL(
+							"CREATE TABLE om_link (" +
+							"  oid        INTEGER," +
+							"  pfid       INTEGER," +
+							"  pfid_order INTEGER," +
+							"PRIMARY KEY (oid,pfid)"+
+							")"
+						);
+					}
+					if(!this._dbConn[aMode].tableExists("om_folder")){
+						this._dbConn[aMode].executeSimpleSQL(
+							"CREATE TABLE om_folder (" +
+							"  fid          INTEGER," +
+							"  pfid         INTEGER NOT NULL," +
+							"  pfid_order   INTEGER NOT NULL," +
+							"  fid_title    TEXT," +
+							"  fid_property TEXT," +
+							"  fid_mode     INTEGER DEFAULT 0," +
+							"  fid_style    TEXT," +
+							"PRIMARY KEY (fid)"+
+							")"
+						);
+					}
+					if(!this._dbConn[aMode].tableExists("om_favicon")){
+						this._dbConn[aMode].executeSimpleSQL(
+							"CREATE TABLE om_favicon (" +
+							"  favicon_url  TEXT NOT NULL," +
+							"  favicon_mime TEXT NOT NULL," +
+							"  favicon_img  BLOB DEFAULT NULL,"+
+							"PRIMARY KEY (favicon_url)"+
+							")"
+						);
+					}
+					try{if(!this._dbConn[aMode].indexExists("om_object_index_url"))      this._dbConn[aMode].executeSimpleSQL("CREATE INDEX om_object_index_url  ON om_object(doc_url);");}catch(ex){}
+					try{if(!this._dbConn[aMode].indexExists("om_object_index_type"))     this._dbConn[aMode].executeSimpleSQL("CREATE INDEX om_object_index_type ON om_object(oid_type);");}catch(ex){}
+					try{if(!this._dbConn[aMode].indexExists("om_object_index_oid"))      this._dbConn[aMode].executeSimpleSQL("CREATE INDEX om_object_index_oid  ON om_object(oid);");}catch(ex){}
+					try{if(!this._dbConn[aMode].indexExists("om_object_index_con_url"))  this._dbConn[aMode].executeSimpleSQL("CREATE INDEX om_object_index_con_url ON om_object(con_url);");}catch(ex){}
+					try{if(!this._dbConn[aMode].indexExists("om_object_index_oid_date")) this._dbConn[aMode].executeSimpleSQL("CREATE INDEX om_object_index_oid_date ON om_object(oid_date);");}catch(ex){}
+
+					try{if(!this._dbConn[aMode].indexExists("om_link_index_pfid")) this._dbConn[aMode].executeSimpleSQL("CREATE INDEX om_link_index_pfid ON om_link(pfid);");}catch(ex){}
+					try{if(!this._dbConn[aMode].indexExists("om_link_index_oid"))  this._dbConn[aMode].executeSimpleSQL("CREATE INDEX om_link_index_oid  ON om_link(oid);");}catch(ex){}
+
+					try{if(!this._dbConn[aMode].indexExists("om_folder_index_pfid")) this._dbConn[aMode].executeSimpleSQL("CREATE INDEX om_folder_index_pfid ON om_folder(pfid);");}catch(ex){}
+
+					this.endTransaction(aMode);
+				}
+			}
+			finally {
+				if(this._dbConn[aMode].lastError) bitsObjectMng._dump("_createTable():"+this._dbConn[aMode].lastErrorString+" ("+this._dbConn[aMode].lastError+")");
+				if(ourTransaction){
+					this._dbConn[aMode].rollbackTransaction();
+					ourTransaction = false;
+				}
+			}
+			if(ourTransaction) this._dbConn[aMode].commitTransaction();
+		},
+
+/////////////////////////////////////////////////////////////////////
+		lockDB : function(aMode){
+			return true;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		unlockDB : function(aMode){
+			return true;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		beginTransaction : function(aMode){
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			if(this._dbConn[aMode] == undefined) this.init(aMode);
+			if(this._dbConn[aMode] == undefined) return false;
+			try{
+				if(bitsObjectMng.Database.lockDB(aMode)){
+					this._dbConn[aMode].executeSimpleSQL("BEGIN TRANSACTION");
+					return true;
+				}else{
+					return false;
+				}
+			}catch(ex){
+				bitsObjectMng._dump("bitsObjectMng.Database.beginTransaction("+aMode+"):"+ex);
+				bitsObjectMng.Database.unlockDB(aMode)
+				return false;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		endTransaction : function(aMode){
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			if(this._dbConn[aMode] == undefined) this.init(aMode);
+			if(this._dbConn[aMode] == undefined) return null;
+			try{
+				this._dbConn[aMode].executeSimpleSQL("END TRANSACTION");
+				bitsObjectMng.Database.unlockDB(aMode)
+				return true;
+			}catch(ex){
+				return false;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		select : function(aMode,aSql,aTransaction){
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			if(aTransaction == undefined) aTransaction = true;
+			if(this._dbConn[aMode] == undefined) this.init(aMode);
+			if(this._dbConn[aMode] == undefined) return null;
+			var ourTransaction = false;
+			if(aTransaction) if(!this.beginTransaction(aMode)) return null;
+			var i;
+			try{
+				var statement = this._dbConn[aMode].createStatement(aSql);
+				var k=statement.columnCount;
+				var columnNames = [];
+				for(i=0;i<k;i++){
+					columnNames.push(statement.getColumnName(i));
+				}
+			}catch(ex){
+				bitsObjectMng._dump("select(1):"+ex);
+				bitsObjectMng._dump("bitsObjectMng.Database.select():aSql="+aSql);
+				return null;
+			}
+			var dataset = [];
+			try{
+				while(statement.executeStep()){
+					var row = [];
+					var utf8String;
+					for(i=0;i<k;i++){
+						utf8String = statement.getUTF8String(i);
+						row[columnNames[i]] = utf8String ? utf8String : "";
+					}
+					dataset.push(row);
+				}
+				columnNames = undefined;
+			}
+			finally {
+				if(this._dbConn[aMode].lastError > 0 && this._dbConn[aMode].lastError <= 100){
+					bitsObjectMng._dump("select(3):"+this._dbConn[aMode].lastErrorString+" ("+this._dbConn[aMode].lastError+")\n\n"+aSql);
+				}
+				if(this._dbConn[aMode].lastError && this._dbConn[aMode].lastError != 101){
+					bitsObjectMng._dump("select(2):"+this._dbConn[aMode].lastErrorString+" ("+this._dbConn[aMode].lastError+")\n\n"+aSql);
+					dataset = null;
+				}
+				if(ourTransaction && this._dbConn[aMode].lastError && this._dbConn[aMode].lastError != 101){
+					this._dbConn[aMode].rollbackTransaction();
+					ourTransaction = false;
+				}
+				statement.reset();
+			}
+			if(aTransaction) this.endTransaction(aMode);
+			return dataset;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		selectB : function(aMode,aSql,aPara,aTransaction){
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			if(aTransaction == undefined) aTransaction = true;
+			if(this._dbConn[aMode] == undefined) this.init(aMode);
+			if(this._dbConn[aMode] == undefined) return null;
+			var ourTransaction = false;
+			if(aTransaction) if(!this.beginTransaction(aMode)) return null;
+			var i;
+			try{
+				var statement = this._dbConn[aMode].createStatement(aSql);
+				if(aPara){
+					var i;
+					for(i=0;i<aPara.length;i++){
+						this._setStatementValue(statement,i,aPara[i]);
+					}
+				}
+				var k=statement.columnCount;
+				var columnNames = [];
+				for(i=0;i<k;i++){
+					columnNames.push(statement.getColumnName(i));
+				}
+			}catch(ex){
+				bitsObjectMng._dump("bitsObjectMng.Database.selectB(1):"+ex);
+				bitsObjectMng._dump("bitsObjectMng.Database.selectB():aSql="+aSql);
+				return null;
+			}
+			var dataset = [];
+			try{
+				while(statement.executeStep()){
+					var row = {};
+					var utf8String;
+					for(i=0;i<k;i++){
+						utf8String = statement.getUTF8String(i);
+						row[columnNames[i]] = utf8String ? utf8String : "";
+					}
+					dataset.push(row);
+				}
+				columnNames = undefined;
+			}
+			finally {
+				if(this._dbConn[aMode].lastError > 0 && this._dbConn[aMode].lastError <= 100){
+					bitsObjectMng._dump("selectB(3):"+this._dbConn[aMode].lastErrorString+" ("+this._dbConn[aMode].lastError+")\n\n"+aSql);
+				}
+				if(this._dbConn[aMode].lastError && this._dbConn[aMode].lastError != 101){
+					bitsObjectMng._dump("selectB(2):"+this._dbConn[aMode].lastErrorString+" ("+this._dbConn[aMode].lastError+")\n\n"+aSql);
+					dataset = null;
+				}
+				if(ourTransaction && this._dbConn[aMode].lastError && this._dbConn[aMode].lastError != 101){
+					this._dbConn[aMode].rollbackTransaction();
+					ourTransaction = false;
+				}
+				statement.reset();
+			}
+			if(aTransaction) this.endTransaction(aMode);
+			return dataset;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		selectBF : function(aMode,aSql,aPara,aFindRegExp,aTransaction){
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			if(aTransaction == undefined) aTransaction = true;
+			if(this._dbConn[aMode] == undefined) this.init(aMode);
+			if(this._dbConn[aMode] == undefined) return null;
+			var ourTransaction = false;
+			if(aTransaction) if(!this.beginTransaction(aMode)) return null;
+			var i;
+			try{
+				var statement = this._dbConn[aMode].createStatement(aSql);
+				if(aPara){
+					var i;
+					for(i=0;i<aPara.length;i++){
+						this._setStatementValue(statement,i,aPara[i]);
+					}
+				}
+				var k=statement.columnCount;
+				var columnNames = [];
+				for(i=0;i<k;i++){
+					columnNames.push(statement.getColumnName(i));
+				}
+			}catch(ex){
+				bitsObjectMng._dump("bitsObjectMng.Database.selectBF(1):"+ex);
+				bitsObjectMng._dump("bitsObjectMng.Database.selectBF():aSql="+aSql);
+				return null;
+			}
+			var dataset = [];
+			try{
+				while(statement.executeStep()){
+					var arr = [];
+					var row = {};
+					var utf8String;
+					for(i=0;i<k;i++){
+						utf8String = statement.getUTF8String(i);
+						row[columnNames[i]] = utf8String ? utf8String : "";
+						arr.push(utf8String ? utf8String : "");
+					}
+					if(arr.join("\n").match(aFindRegExp)) dataset.push(row);
+				}
+				columnNames = undefined;
+			}
+			finally {
+				if(this._dbConn[aMode].lastError > 0 && this._dbConn[aMode].lastError <= 100){
+					bitsObjectMng._dump("selectBF(3):"+this._dbConn[aMode].lastErrorString+" ("+this._dbConn[aMode].lastError+")\n\n"+aSql);
+				}
+				if(this._dbConn[aMode].lastError && this._dbConn[aMode].lastError != 101){
+					bitsObjectMng._dump("selectBF(2):"+this._dbConn[aMode].lastErrorString+" ("+this._dbConn[aMode].lastError+")\n\n"+aSql);
+					dataset = null;
+				}
+				if(ourTransaction && this._dbConn[aMode].lastError && this._dbConn[aMode].lastError != 101){
+					this._dbConn[aMode].rollbackTransaction();
+					ourTransaction = false;
+				}
+				statement.reset();
+			}
+			if(aTransaction) this.endTransaction(aMode);
+			return dataset;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		selectCount : function(aMode,aSql,aTransaction){
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			if(aTransaction == undefined) aTransaction = true;
+			if(this._dbConn[aMode] == undefined) this.init(aMode);
+			if(this._dbConn[aMode] == undefined) return null;
+			var ourTransaction = false;
+			if(aTransaction) if(!this.beginTransaction(aMode)) return null;
+			try{
+				var statement = this._dbConn[aMode].createStatement(aSql);
+			}catch(ex){
+				bitsObjectMng._dump("selectCount():"+ex);
+				bitsObjectMng._dump("bitsObjectMng.Database.selectCount():aSql="+aSql);
+				return null;
+			}
+			var rtnCount = 0;
+			try{
+				if(statement.executeStep()) rtnCount = statement.getInt32(0);
+			}
+			finally {
+				if(this._dbConn[aMode].lastError && this._dbConn[aMode].lastError != 100){
+					bitsObjectMng._dump("selectCount():"+this._dbConn[aMode].lastErrorString+" ("+this._dbConn[aMode].lastError+")\n\n"+aSql);
+					dataset = 0;
+				}
+				if(ourTransaction && this._dbConn[aMode].lastError && this._dbConn[aMode].lastError != 101){
+					this._dbConn[aMode].rollbackTransaction();
+					ourTransaction = false;
+				}
+				statement.reset();
+			}
+			if(aTransaction) this.endTransaction(aMode);
+			return rtnCount;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		selectCountB : function(aMode,aSql,aPara,aTransaction){
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			if(aTransaction == undefined) aTransaction = true;
+			if(this._dbConn[aMode] == undefined) this.init(aMode);
+			if(this._dbConn[aMode] == undefined) return null;
+			var ourTransaction = false;
+			if(aTransaction) if(!this.beginTransaction(aMode)) return null;
+			try{
+				var statement = this._dbConn[aMode].createStatement(aSql);
+				if(aPara){
+					var i;
+					for(i=0;i<aPara.length;i++){
+						this._setStatementValue(statement,i,aPara[i]);
+					}
+				}
+			}catch(ex){
+				bitsObjectMng._dump("bitsObjectMng.Database.selectCountB():"+ex);
+				bitsObjectMng._dump("bitsObjectMng.Database.selectCountB():aSql="+aSql);
+				return null;
+			}
+			var rtnCount = 0;
+			try{
+				if(statement.executeStep()) rtnCount = statement.getInt32(0);
+			}
+			finally {
+				if(this._dbConn[aMode].lastError && this._dbConn[aMode].lastError != 100){
+					bitsObjectMng._dump("selectCountB():"+this._dbConn[aMode].lastErrorString+" ("+this._dbConn[aMode].lastError+")\n\n"+aSql);
+					dataset = 0;
+				}
+				if(ourTransaction && this._dbConn[aMode].lastError && this._dbConn[aMode].lastError != 101){
+					this._dbConn[aMode].rollbackTransaction();
+					ourTransaction = false;
+				}
+				statement.reset();
+			}
+			if(aTransaction) this.endTransaction(aMode);
+			return rtnCount;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		cmd : function(aMode,aSql,aTransaction){
+			var rtn = true;
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			if(aTransaction == undefined) aTransaction = true;
+			if(this._dbConn[aMode] == undefined) this.init(aMode);
+			if(this._dbConn[aMode] == undefined) return false;
+			var ourTransaction = false;
+			if(aTransaction) if(!this.beginTransaction(aMode)) return null;
+			try{
+				var statement = this._dbConn[aMode].createStatement(aSql);
+			}catch(ex){
+				bitsObjectMng._dump("cmd():"+ex);
+				bitsObjectMng._dump("bitsObjectMng.Database.cmd():aSql="+aSql);
+				return false;
+			}
+			try{
+				statement.execute();
+			}
+			finally {
+				if(this._dbConn[aMode].lastError){
+					bitsObjectMng._dump("cmd():"+this._dbConn[aMode].lastErrorString+" ("+this._dbConn[aMode].lastError+")");
+					bitsObjectMng._dump("bitsObjectMng.Database.cmd():aSql="+aSql);
+					rtn = false;
+				}
+				if(ourTransaction && this._dbConn[aMode].lastError){
+					this._dbConn[aMode].rollbackTransaction();
+					ourTransaction = false;
+				}
+				statement.reset();
+			}
+			if(ourTransaction) this._dbConn[aMode].commitTransaction();
+			if(aTransaction) this.endTransaction(aMode);
+			return rtn;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		cmdB : function(aMode,aSql,aPara,aTransaction){
+			var rtn = true;
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			if(aTransaction == undefined) aTransaction = true;
+			if(this._dbConn[aMode] == undefined) this.init(aMode);
+			if(this._dbConn[aMode] == undefined) return false;
+			var ourTransaction = false;
+			if(aTransaction) if(!this.beginTransaction(aMode)) return null;
+			try{
+				var statement = this._dbConn[aMode].createStatement(aSql);
+				if(aPara){
+					var i;
+					for(i=0;i<aPara.length;i++){
+						this._setStatementValue(statement,i,aPara[i]);
+					}
+				}
+			}catch(ex){
+				bitsObjectMng._dump("bitsObjectMng.Database.cmdB():"+ex);
+				bitsObjectMng._dump("bitsObjectMng.Database.cmdB():aSql="+aSql);
+				return false;
+			}
+			try{
+				statement.execute();
+			}
+			finally {
+				if(this._dbConn[aMode].lastError){
+					bitsObjectMng._dump("bitsObjectMng.Database.cmdB():"+this._dbConn[aMode].lastErrorString+" ("+this._dbConn[aMode].lastError+")");
+					bitsObjectMng._dump("bitsObjectMng.Database.cmdB():aSql="+aSql);
+					rtn = false;
+				}
+				if(ourTransaction && this._dbConn[aMode].lastError){
+					this._dbConn[aMode].rollbackTransaction();
+					ourTransaction = false;
+				}
+				statement.reset();
+			}
+			if(ourTransaction) this._dbConn[aMode].commitTransaction();
+			if(aTransaction) this.endTransaction(aMode);
+			return rtn;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		cmdArray : function(aMode,aSql,aTransaction){
+			var rtn = true;
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			if(aTransaction == undefined) aTransaction = true;
+			if(this._dbConn[aMode] == undefined) this.init(aMode);
+			if(this._dbConn[aMode] == undefined) return false;
+			var ourTransaction = false;
+			if(aTransaction) if(!this.beginTransaction(aMode)) return null;
+			var cnt;
+			for(cnt=0;cnt<aSql.length;cnt++){
+				try{
+					var statement = this._dbConn[aMode].createStatement(aSql[cnt]);
+				}catch(ex){
+					bitsObjectMng._dump("bitsObjectMng.Database.cmdArray():"+ex);
+					bitsObjectMng._dump("bitsObjectMng.Database.cmdArray():aSql="+aSql[cnt]);
+					return false;
+				}
+				try{
+					statement.execute();
+				}
+				finally {
+					if(this._dbConn[aMode].lastError){
+						bitsObjectMng._dump("bitsObjectMng.Database.cmdArray():"+this._dbConn[aMode].lastErrorString+" ("+this._dbConn[aMode].lastError+")");
+						rtn = false;
+					}
+					if(ourTransaction && !rtn){
+						this._dbConn[aMode].rollbackTransaction();
+						ourTransaction = false;
+					}
+					statement.reset();
+					if(!rtn) break;
+				}
+			}
+			if(ourTransaction) this._dbConn[aMode].commitTransaction();
+			if(aTransaction) this.endTransaction(aMode);
+			return rtn;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		cmdArrayB : function(aMode,aSql,aPara,aTransaction){
+			var rtn = true;
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			if(aTransaction == undefined) aTransaction = true;
+			if(this._dbConn[aMode] == undefined) this.init(aMode);
+			if(this._dbConn[aMode] == undefined) return false;
+			var ourTransaction = false;
+			if(aTransaction) if(!this.beginTransaction(aMode)) return null;
+			var cnt;
+			for(cnt=0;cnt<aSql.length;cnt++){
+				try{
+					var statement = this._dbConn[aMode].createStatement(aSql[cnt]);
+					if(aPara){
+						var i;
+						for(i=0;i<aPara[cnt].length;i++){
+							this._setStatementValue(statement,i,aPara[cnt][i]);
+						}
+					}
+				}catch(ex){
+					bitsObjectMng._dump("bitsObjectMng.Database.cmdArrayB():"+ex);
+					bitsObjectMng._dump("bitsObjectMng.Database.cmdArrayB():aSql="+aSql[cnt]);
+					if(this._dbConn[aMode].lastError) bitsObjectMng._dump("bitsObjectMng.Database.cmdArrayB():"+this._dbConn[aMode].lastErrorString+" ("+this._dbConn[aMode].lastError+")");
+					return false;
+				}
+				try{
+					statement.execute();
+				}
+				finally {
+					if(this._dbConn[aMode].lastError){
+						bitsObjectMng._dump("bitsObjectMng.Database.cmdArrayB():"+this._dbConn[aMode].lastErrorString+" ("+this._dbConn[aMode].lastError+")");
+						rtn = false;
+					}
+					if(ourTransaction && !rtn){
+						this._dbConn[aMode].rollbackTransaction();
+						ourTransaction = false;
+					}
+					statement.reset();
+					if(!rtn) break;
+				}
+			}
+			if(ourTransaction) this._dbConn[aMode].commitTransaction();
+			if(aTransaction) this.endTransaction(aMode);
+			return rtn;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		newObject : function(aID,aMode,aTransaction){
+			try{
+				if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+				if(aTransaction == undefined) aTransaction = true;
+				if(aID == undefined){
+					aID = this._oidIdentify(aMode,bitsObjectMng.Common.getTimeStamp(),aTransaction);
+				}else{
+					aID = this._oidIdentify(aMode,aID,aTransaction);
+				}
+				return {
+					oid          : ""+aID,
+					pfid         : ""+0 ,
+					doc_title    : "",
+					doc_url      : "",
+					con_url      : "",
+					bgn_dom      : "" ,
+					end_dom      : "",
+					oid_title    : "",
+					oid_property : "" ,
+					oid_mode     : ""+0,
+					oid_type     : "" ,
+					oid_txt      : "",
+					oid_img      : null,
+					oid_date     : "",
+				};
+			}catch(ex){
+				bitsObjectMng._dump("Database.newObject():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		newFolder : function(aID,aMode,aTransaction){
+			try{
+				if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+				if(aTransaction == undefined) aTransaction = true;
+				if(aID == undefined){
+					aID = this._fidIdentify(aMode,bitsObjectMng.Common.getTimeStamp(),aTransaction);
+				}else{
+					aID = this._fidIdentify(aMode,aID,aTransaction);
+				}
+				return {
+					fid          : ""+aID,
+					pfid         : ""+0 ,
+					pfid_order   : ""+0,
+					fid_title    : ""+0,
+					fid_property : "" ,
+					fid_mode     : ""+0,
+					fid_style    : "",
+				};
+			}catch(ex){
+				bitsObjectMng._dump("Database.newFolder():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		existsObject : function(aObject,aMode){
+			try{
+				if(!aObject) return false;
+				if(aMode == undefined || aMode == ""){
+					var rtn = false;
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmp = bitsObjectMng.Database.existsObject(aObject,mode);
+						if(tmp) rtn = tmp;
+					}
+					return rtn;
+				}
+				var para = [];
+				var where = [];
+				var key;
+				var index=0;
+				for(key in aObject){
+					if(key == "pfid" || key == "pfid_order"){
+						where.push("om_link."+key+"=?"+(++index));
+					}else{
+						where.push("om_object."+key+"=?"+(++index));
+					}
+					para.push(aObject[key]);
+				}
+				var oSql = 'select' +
+									' count(om_object.oid) as num' +
+									' from om_object' +
+									' LEFT JOIN om_link ON om_link.oid = om_object.oid';
+				if(where.length>0) oSql += " where " + where.join(" and ");
+				var oFld = this.selectB(aMode,oSql,para);
+				if(oFld && oFld.length>0){
+					return (parseInt(oFld[0].num)>0?true:false);
+				}else{
+					return false;
+				}
+			}catch(ex){
+				bitsObjectMng._dump("existsObject():"+ex);
+				return false;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		isOpenDB : function(aMode){
+			return(this._dbConn[aMode] != undefined);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		_idExists : function(aMode,aID,aTransaction){
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			if(aTransaction == undefined) aTransaction = true;
+			var oSql = 'select count(oid) from om_object where oid="'+aID+'"';
+			var oRtn = this.selectCount(aMode,oSql,aTransaction);
+			if(oRtn>0) return true;
+			var fSql = 'select count(fid) from om_folder where fid="'+aID+'"';
+			var fRtn = this.selectCount(aMode,fSql,aTransaction);
+			return (fRtn>0);
+		},
+/////////////////////////////////////////////////////////////////////
+		_dasish_aid_exists : function(aMode,dasish_aid,aTransaction){
+                        //helper function for finding existing annotations
+                        var found = false;
+                        
+			if(aMode == undefined || aMode == "" || aMode == "dwan") aMode = 'local';
+			if(aTransaction == undefined) aTransaction = true;
+			var oSql = 'SELECT COUNT(dasish_aid) FROM om_object WHERE dasish_aid="'+dasish_aid+'"';
+			var oRtn = this.selectCount(aMode,oSql,aTransaction);
+			if(oRtn > 0){ 
+                            return true;
+                        }else{
+                            return false;
+                        }
+                        
+		},
+
+/////////////////////////////////////////////////////////////////////
+		_oidExists : function(aMode,aID,aTransaction){
+			if(aTransaction == undefined) aTransaction = true;
+			return this._idExists(aMode,aID,aTransaction);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		_oidIdentify : function(aMode,aID,aTransaction){
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			if(aTransaction == undefined) aTransaction = true;
+			var i = 0;
+			while(this._oidExists(aMode,aID,aTransaction) && i < 100){
+				aID = bitsObjectMng.Common.getTimeStamp(--i);
+			}
+			return aID;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		_oidCount : function(aMode,aID,aTransaction){
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			if(aTransaction == undefined) aTransaction = true;
+			var aSql = 'select count(oid) from om_link where oid="'+aID+'"';
+			var rtn = this.selectCount(aMode,aSql,aTransaction);
+			return rtn;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		_linkExists : function(aMode, aLink, aTransaction){
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			if(aTransaction == undefined) aTransaction = true;
+			var oSql = 'select count(oid) from om_link where oid="'+aLink.oid+'" and pfid="'+aLink.pfid+'"';
+			var oRtn = this.selectCount(aMode,oSql,aTransaction);
+			return (oRtn>0);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		_fidExists : function(aMode,aID,aTransaction){
+			if(aTransaction == undefined) aTransaction = true;
+			return this._idExists(aMode,aID,aTransaction);
+		},
+
+/////////////////////////////////////////////////////////////////////
+		_fidCount : function(aMode,aID){
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			var aSql = 'select count(fid) from om_folder';
+			if(aID != undefined) aSql += ' where fid="'+aID+'"'
+			var rtn = this.selectCount(aMode,aSql);
+			return rtn;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		_fidIdentify : function(aMode,aID,aTransaction){
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			if(aTransaction == undefined) aTransaction = true;
+			var i = 0;
+			while(this._fidExists(aMode,aID,aTransaction) && i < 100){
+				aID = bitsObjectMng.Common.getTimeStamp(--i);
+			}
+			return aID;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getCountFromPID : function(aPID,aMode){
+			if(!aPID) return -1;
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			var aSql = 'select count(pfid) as num from om_folder where pfid='+aPID+' union select count(pfid) as num from om_link where pfid='+aPID;
+			var rtn = this.selectCount(aMode,aSql);
+			return rtn;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		addObject : function(aObject,aMode,aTransaction){
+                    annotationProxy.log("addObject aMode: "+aMode);
+                    annotationProxy.log("addObject aTransaction: "+aTransaction);
+                    //annotationProxy.log("addObject aObject: "+JSON.stringify(aObject, null, '  '));
+                    var postToRemote = true;
+                    if(aMode == 'dwan' || aMode == ''){
+                        aMode = '_uncategorized';
+                        postToRemote = false;
+                    }
+                    if(aObject.hasOwnProperty('dasish_aid')){
+                        postToRemote = false;
+                    }
+                    
+                    
+			try{
+				if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+				if(aTransaction == undefined) aTransaction = true;
+				var rtn = true;
+				if(aObject.oid == undefined || aObject.pfid == undefined){
+					rtn = false;
+				}
+				if(rtn && aObject.pfid != "0"){
+					rtn = this._fidExists(aMode,aObject.pfid,aTransaction);
+					if(!rtn) bitsObjectMng._dump("bitsObjectMng.Database.addObject():aObject.pfid="+aObject.pfid);
+				}
+				if(aObject.style) delete aObject.style;
+				if(aObject.cssstyle) delete aObject.cssstyle;
+				if(aObject.oid_property) aObject.oid_property = this._updateOidProperty(aObject,aMode);
+				if(rtn){
+					var lcolumns = [];
+					var lvalues = [];
+					var lpara = [];
+					var lindex = 0;
+					var columns = [];
+					var values = [];
+					var para = [];
+					var index = 0;
+					var key;
+					for(key in aObject){
+						if(!aObject[key] || aObject[key] == "") continue;
+						if(key == "pfid" || key == "pfid_order"){
+							lcolumns.push(key);
+							lvalues.push('?'+(++lindex));
+							lpara.push(aObject[key]);
+							continue;
+						}
+						if(key == "oid"){
+							lcolumns.push(key);
+							lvalues.push('?'+(++lindex));
+							lpara.push(aObject[key]);
+						}
+						columns.push(key);
+						values.push('?'+(++index));
+						para.push(aObject[key]);
+					}
+					if(columns.length == 0) rtn = false;
+					if(rtn){
+						var sqlArr = [];
+						var sqlPara = [];
+						var aSql1 = "insert into om_link ("+ lcolumns.join(",") +") values ("+ lvalues.join(",") +")";
+						var aSql2 = "insert into om_object ("+ columns.join(",") +") values ("+ values.join(",") +")";
+                                                //alert("INSERT "+aObject.note);
+                                                
+                                                if(postToRemote == true) {
+                                                    annotationProxy.postAnnotation(aObject);
+                                                }
+						sqlArr.push(aSql1);
+						sqlArr.push(aSql2);
+						sqlPara.push(lpara);
+						sqlPara.push(para);
+						rtn = this.cmdArrayB(aMode,sqlArr,sqlPara,aTransaction);
+						if(!rtn){
+                                                    annotationProxy.log('added to the database: oid: '+aObject.oid);
+							bitsObjectMng._dump("bitsObjectMng.Database.addObject():aSql1="+aSql1);
+							bitsObjectMng._dump("bitsObjectMng.Database.addObject():aSql2="+aSql2);
+						}else{
+                                                    annotationProxy.log('not added to the database: oid: '+aObject.oid);
+                                                }
+					}
+				}
+				if(!rtn) rtn = this._oidExists(aMode,aObject.oid,aTransaction);
+				if(rtn) nsPreferences.setUnicharPref("wiredmarker.last_update", bitsObjectMng.Common.getTimeStamp()+"\t"+aMode+"\t"+bitsObjectMng.DataSource.inittime + "\tINSERT\tOBJECT");
+			}catch(ex){
+				bitsObjectMng._dump("Database.addObject():"+ex);
+			}
+			return rtn;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		addLink : function(aLink,aMode,aTransaction){
+			try{
+				if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+				if(aTransaction == undefined) aTransaction = true;
+				var rtn = true;
+				if(!aLink || aLink.oid == undefined || aLink.pfid == undefined){
+					rtn = false;
+				}
+				if(rtn){
+					rtn = !this._linkExists(aMode, aLink, aTransaction);
+					if(!rtn) bitsObjectMng._dump("bitsObjectMng.Database.addLink():_linkExists=["+ !rtn + "]");
+				}
+				if(rtn){
+					rtn = this._fidExists(aMode,aLink.pfid,aTransaction);
+					if(!rtn) bitsObjectMng._dump("bitsObjectMng.Database.addLink():aLink.pfid="+aLink.pfid);
+				}
+				if(rtn){
+					rtn = this._oidExists(aMode,aLink.oid,aTransaction);
+					if(!rtn) bitsObjectMng._dump("bitsObjectMng.Database.addLink():aLink.oid="+aLink.oid);
+				}
+				if(rtn){
+					var columns = [];
+					var values = [];
+					var para = [];
+					var index=0;
+					for(var key in aLink){
+						if(!aLink[key] || aLink[key] == "") continue;
+						columns.push(key);
+						values.push('?'+(++index));
+						para.push(aLink[key]);
+					}
+					if(columns.length == 0) rtn = false;
+					if(rtn){
+						var aSql = "insert into om_link ("+ columns.join(",") +") values ("+ values.join(",") +")";
+						rtn = this.cmdB(aMode,aSql,para,aTransaction);
+					}
+					if(!rtn){
+						bitsObjectMng._dump("bitsObjectMng.Database.addLink():aSql="+aSql);
+					}
+				}
+				if(rtn) nsPreferences.setUnicharPref("wiredmarker.last_update", bitsObjectMng.Common.getTimeStamp()+"\t"+aMode+"\t"+bitsObjectMng.DataSource.inittime + "\tINSERT\tLINK");
+			}catch(ex){
+				bitsObjectMng._dump("Database.addLink():"+ex);
+			}
+			return rtn;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		addFolder : function(aFolder,aMode,aTransaction){
+			try{
+				if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+				if(aTransaction == undefined) aTransaction = true;
+				var columns = [];
+				var values = [];
+				var para = [];
+				var index=0;
+				for(var key in aFolder){
+					if(!aFolder[key] || aFolder[key] == "") continue;
+					columns.push(key);
+					values.push('?'+(++index));
+					para.push(aFolder[key]);
+				}
+				if(columns.length == 0) return false;
+				var aSql = "insert into om_folder ("+ columns.join(",") +") values ("+ values.join(",") +")";
+				var rtn = this.cmdB(aMode,aSql,para,aTransaction);
+				if(rtn) nsPreferences.setUnicharPref("wiredmarker.last_update", bitsObjectMng.Common.getTimeStamp()+"\t"+aMode+"\t"+bitsObjectMng.DataSource.inittime + "\tINSERT\tFOLDER");
+				return rtn;
+			}catch(ex){
+				bitsObjectMng._dump("Database.addFolder():"+ex);
+				return false;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getAllObjectFormDocument : function(aDocument,aMode,aNoMode,aType){
+			try{
+				if(!aDocument) return null;
+				var doc_url = bitsObjectMng.Common.getURLStringFromDocument(aDocument);
+				if(doc_url == "") return null;
+				var statement = undefined;
+				var oFld = this.getAllObjectFormURL(doc_url, aMode, aNoMode,aType);
+				if(oFld && oFld.length>0)
+					return oFld;
+				else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("Database.getAllObjectFormDocument():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getAllObjectFormURL : function(aURL, aMode, aNoMode, aType){
+			try{
+				if(!aURL) return null;
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(mode == aNoMode) continue;
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.getAllObjectFormURL(aURL, mode, undefined, aType);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0)
+						return rtnArr;
+					else
+						return null;
+				}
+				var doc_url = aURL;
+				if(doc_url == "") return null;
+				var obj = {doc_url:doc_url};
+				if(aType) obj.oid_type = aType;
+				var rtnFld = this.getObject(obj,aMode);
+				if(rtnFld && rtnFld.length>0)
+					return rtnFld;
+				else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("Database.getAllObjectFormURL():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getAllObjectFormContentURL : function(aContentURL, aMode){
+			try{
+				if(!aContentURL) return null;
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.getAllObjectFormContentURL(aContentURL, mode);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0)
+						return rtnArr;
+					else
+						return null;
+				}
+				var con_url = aContentURL;
+				if(!con_url || con_url == "") return null;
+				var obj = {con_url:con_url};
+				var rtnFld = this.getObject(obj,aMode);
+				if(rtnFld && rtnFld.length>0)
+					return rtnFld;
+				else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("Database.getAllObjectFormContentURL():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getAllObjectFormPIDandURL : function(aPID,aURL,aMode){
+			try{
+				if(!aPID || !aURL) return null;
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.getAllObjectFormPIDandURL(aPID,aURL,mode);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0)
+						return rtnArr;
+					else
+						return null;
+				}
+				var oFld = this.getObject({pfid:aPID,doc_url:aURL},aMode);
+				if(oFld && oFld.length>0)
+					return oFld;
+				else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("Database.getAllObjectFormPIDandURL():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getObjectFormURL : function(aURL,aMode,aTransaction){
+			try{
+				if(!aURL) return null;
+				if(aTransaction == undefined) aTransaction = true;
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.getObjectFormURL(aURL,mode,false);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0)
+						return rtnArr;
+					else
+						return null;
+				}
+				var oFld = this.getObject({doc_url:aURL},aMode);
+				if(oFld && oFld.length>0)
+					return oFld;
+				else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("Database.getObjectFormURL():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getObject : function(aObject,aMode,aLimit){
+			try{
+				if(!aObject) return null;
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var modeArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						modeArr.push(mode);
+						var tmpArr = bitsObjectMng.Database.getObject(aObject,mode);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0){
+						var modeHash = {};
+						for(var i=0;i<modeArr.length;i++){
+							modeHash[modeArr[i]] = i;
+						}
+						rtnArr.sort(function(a,b){
+							var a_order = parseInt(a.oid);
+							var b_order = parseInt(b.oid);
+							if(a_order < b_order) return -1;
+							if(a_order > b_order) return 1;
+							if(modeHash[a.dbtype] < modeHash[b.dbtype]) return -1;
+							if(modeHash[a.dbtype] > modeHash[b.dbtype]) return 1;
+							return 0;
+						});
+						return rtnArr;
+					}else{
+						return null;
+					}
+				}
+				var para = [];
+				var where = [];
+				var key;
+				var index=0;
+				for(key in aObject){
+					if(key.indexOf("substr") == 0){
+						where.push(key+"=?"+(++index));
+						para.push(aObject[key]);
+					}else if(key == "pfid" || key == "pfid_order"){
+						if((aObject[key]+"").toLowerCase() == "null"){
+							where.push("om_link."+key+" is null");
+						}else{
+							where.push("om_link."+key+"=?"+(++index));
+							para.push(aObject[key]);
+						}
+					}else{
+						if((aObject[key]+"").toLowerCase() == "null"){
+							where.push("om_object."+key+" is null");
+						}else{
+							where.push("om_object."+key+"=?"+(++index));
+							para.push(aObject[key]);
+						}
+					}
+				}
+				var oSql = 'select' +
+									' om_link.pfid' +
+									',om_link.pfid_order' +
+									',om_object.oid' +
+									',om_object.doc_title' +
+									',om_object.doc_url' +
+									',om_object.con_url' +
+									',om_object.bgn_dom' +
+									',om_object.end_dom' +
+									',om_object.oid_title' +
+									',om_object.oid_property' +
+									',om_object.oid_mode' +
+									',om_object.oid_type' +
+									',om_object.oid_txt' +
+									',om_object.oid_date' +
+                                                                        ',om_object.dasish_aid' +
+									',"'+aMode+'" as dbtype' +
+									',om_folder.fid_style' +
+									',om_folder.fid_title' +
+									',om_folder.pfid_order as folder_order' +
+									' from om_object' +
+									' LEFT JOIN om_link ON om_link.oid = om_object.oid' +
+									' LEFT JOIN om_folder ON om_folder.fid = om_link.pfid';
+				if(where.length>0) oSql += " where " + where.join(" and ");
+				oSql += ' order by om_link.pfid_order';
+				if(aLimit && parseInt(aLimit)>0) oSql += ' LIMIT ' + parseInt(aLimit);
+				var oFld = this.selectB(aMode,oSql,para);
+				if(oFld && oFld.length>0)
+					return oFld;
+				else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("getObject():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getObjectMaxYear : function(aMode){
+			try{
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.getObjectMaxYear(mode);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0){
+						rtnArr.sort();
+						return [rtnArr.pop()];
+					}else{
+						return null;
+					}
+				}
+				var oSql = 'select max(substr(oid_date,7,4)) as year from om_object';
+				var oFld = this.selectB(aMode,oSql);
+				if(oFld && oFld.length>0)
+					return oFld;
+				else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("getObjectMaxYear():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getObjectMinYear : function(aMode){
+			try{
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.getObjectMinYear(mode);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0){
+						rtnArr.sort();
+						return [rtnArr.shift()];
+					}else{
+						return null;
+					}
+				}
+				var oSql = 'select min(substr(oid_date,7,4)) as year from om_object';
+				var oFld = this.selectB(aMode,oSql);
+				if(oFld && oFld.length>0)
+					return oFld;
+				else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("getObjectMinYear():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getObjectYear : function(aMode){
+			try{
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.getObjectYear(mode);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0){
+						var hash = {};
+						for(var i=0;i<rtnArr.length;i++){
+							hash[rtnArr[i]] = rtnArr[i];
+						}
+						rtnArr.length = 0;
+						for(var key in hash){
+							rtnArr.push(key);
+						}
+						rtnArr.sort();
+						return rtnArr;
+					}else{
+						return null;
+					}
+				}
+				var oSql = 'select substr(oid_date,7,4) as year from om_object group by year order by year';
+				var oFld = this.selectB(aMode,oSql);
+				if(oFld && oFld.length>0){
+					for(var i=0;i<oFld.length;i++){
+						oFld[i] = oFld[i].year;
+					}
+					return oFld;
+				}else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("getObjectMinYear():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getObjectMonthFromYear : function(aYear,aMode){
+			try{
+				if(!aYear) return null;
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.getObjectMonthFromYear(aYear,mode);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0){
+						var hash = {};
+						for(var i=0;i<rtnArr.length;i++){
+							hash[rtnArr[i]] = rtnArr[i];
+						}
+						rtnArr.length = 0;
+						for(var key in hash){
+							rtnArr.push(key);
+						}
+						rtnArr.sort();
+						return rtnArr;
+					}else{
+						return null;
+					}
+				}
+				var oSql = 'select substr(oid_date,1,2) as month from om_object where substr(oid_date,7,4)=?1 group by month order by month';
+				var oFld = this.selectB(aMode,oSql,[aYear]);
+				if(oFld && oFld.length>0){
+					for(var i=0;i<oFld.length;i++){
+						oFld[i] = oFld[i].month;
+					}
+					return oFld;
+				}else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("getObjectMonthFromYear():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getObjectDayFromYearMonth : function(aYear,aMonth,aMode){
+			try{
+				if(!aYear) return null;
+				if(!aMonth) return null;
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.getObjectDayFromYearMonth(aYear,aMonth,mode);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0){
+						var hash = {};
+						for(var i=0;i<rtnArr.length;i++){
+							hash[rtnArr[i]] = rtnArr[i];
+						}
+						rtnArr.length = 0;
+						for(var key in hash){
+							rtnArr.push(key);
+						}
+						rtnArr.sort();
+						return rtnArr;
+					}else{
+						return null;
+					}
+				}
+				var oSql = 'select substr(oid_date,4,2) as day from om_object where substr(oid_date,7,4)=?1 and substr(oid_date,1,2)=?2 group by day order by day';
+				var oFld = this.selectB(aMode,oSql,[aYear,aMonth]);
+				if(oFld && oFld.length>0){
+					for(var i=0;i<oFld.length;i++){
+						oFld[i] = oFld[i].day;
+					}
+					return oFld;
+				}else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("getObjectDayFromYearMonth():"+ex);
+				return null;
+			}
+		},
+
+
+/////////////////////////////////////////////////////////////////////
+		findObject : function(aFindRegExp,aMode,aObject){
+			try{
+				if(!aFindRegExp && !aObject) return null;
+				if(!aFindRegExp && aObject) return this.getObject(aObject,aMode);
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.findObject(aFindRegExp,mode,aObject);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0)
+						return rtnArr;
+					else
+						return null;
+				}
+				var para = [];
+				var where = [];
+				var key;
+				var index=0;
+				if(aObject){
+					for(key in aObject){
+						if(key == "pfid" || key == "pfid_order"){
+							where.push("om_link."+key+"=?"+(++index));
+						}else{
+							where.push("om_object."+key+"=?"+(++index));
+						}
+						para.push(aObject[key]);
+					}
+				}
+				var oSql = 'select' +
+									' om_link.pfid' +
+									',om_link.pfid_order' +
+									',om_object.oid' +
+									',om_object.doc_title' +
+									',om_object.doc_url' +
+									',om_object.con_url' +
+									',om_object.bgn_dom' +
+									',om_object.end_dom' +
+									',om_object.oid_title' +
+									',om_object.oid_property' +
+									',om_object.oid_mode' +
+									',om_object.oid_type' +
+									',om_object.oid_txt' +
+									',om_object.oid_date' +
+                                                                        ',om_object.dasish_aid' +
+									',"'+aMode+'" as dbtype' +
+									',om_folder.fid_style' +
+									',om_folder.fid_title' +
+									',om_folder.pfid_order as folder_order' +
+									' from om_object' +
+									' LEFT JOIN om_link ON om_link.oid = om_object.oid' +
+									' LEFT JOIN om_folder ON om_folder.fid = om_link.pfid';
+				if(where.length>0) oSql += " where " + where.join(" and ");
+				oSql += ' order by om_link.pfid_order';
+				var oFld = this.selectBF(aMode,oSql,para,aFindRegExp);
+				if(oFld && oFld.length>0)
+					return oFld;
+				else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("findObject():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getObjectWithProperty : function(aObject,aMode){
+			try{
+				if(!aObject) return null;
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.getObjectWithProperty(aObject,mode);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0)
+						return rtnArr;
+					else
+						return null;
+				}
+				var para = [];
+				var where = [];
+				var key;
+				var index=0;
+				for(key in aObject){
+					if(key == "pfid" || key == "pfid_order"){
+						where.push("om_link."+key+"=?"+(++index));
+					}else{
+						where.push("om_object."+key+"=?"+(++index));
+					}
+					para.push(aObject[key]);
+				}
+				var oSql = 'select' +
+									' om_link.pfid' +
+									',om_link.pfid_order' +
+									',om_object.oid' +
+									',om_object.doc_title' +
+									',om_object.doc_url' +
+									',om_object.con_url' +
+									',om_object.bgn_dom' +
+									',om_object.end_dom' +
+									',om_object.oid_title' +
+									',om_object.oid_property' +
+									',om_object.oid_mode' +
+									',om_object.oid_type' +
+									',om_object.oid_txt' +
+									',om_object.oid_date' +
+                                                                        ',om_object.dasish_aid' +
+									',"'+aMode+'" as dbtype' +
+									',om_folder.fid_style' +
+									' from om_object' +
+									' LEFT JOIN om_link ON om_link.oid = om_object.oid' +
+									' LEFT JOIN om_folder ON om_folder.fid = om_link.pfid';
+				if(where.length>0) oSql += " where " + where.join(" and ");
+				oSql += ' order by om_link.pfid_order';
+				var oFld = this.selectB(aMode,oSql,para);
+				if(oFld && oFld.length>0){
+					var domParser = new DOMParser();
+					var xmlSerializer = new XMLSerializer();
+					for(var i=0;i<oFld.length;i++){
+						if(!oFld[i].oid_property || oFld[i].oid_property == "") continue;
+						var dir = this.getObjectPropertyDir(oFld[i].oid,aMode);
+						if(!dir || !dir.exists()) continue;
+						var entries = dir.directoryEntries;
+						while(entries.hasMoreElements()){
+							var pFile = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+							var xml = bitsObjectMng.Common.readFile(pFile);
+							var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
+							converter.charset = "UTF-8";
+							xml = converter.ConvertToUnicode(xml);
+							var xmldoc2 = domParser.parseFromString(xml, "text/xml");
+							if(xmldoc2 && xmldoc2.documentElement.nodeName == "parsererror") xmldoc2 = undefined;
+							if(!xmldoc2 || !xmldoc2.documentElement) continue;
+							var xmldoc = domParser.parseFromString(oFld[i].oid_property, "text/xml");
+							if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+							if(!xmldoc) continue;
+							var xmlnode = xmldoc.getElementsByTagName(xmldoc2.documentElement.nodeName)[0];
+							if(xmlnode){
+								while(xmlnode.hasChildNodes()){
+									xmlnode.removeChild(xmlnode.firstChild);
+								}
+							}else{
+								xmlnode = xmldoc.createElement(xmldoc2.documentElement.nodeName);
+								xmldoc.documentElement.appendChild(xmlnode);
+							}
+							if(!xmlnode) continue;
+							var xmlnode2 = xmldoc2.documentElement;
+							for(var dcnt=0;dcnt<xmlnode2.childNodes.length;dcnt++){
+								xmlnode.appendChild(xmlnode2.childNodes[dcnt].cloneNode(true));
+							}
+							xmlnode2 = undefined;
+							xmldoc2 = undefined;
+							oFld[i].oid_property = xmlSerializer.serializeToString(xmldoc);
+							xmlnode = undefined;
+							xmldoc = undefined;
+						}
+					}
+					xmlSerializer = undefined;
+					domParser = undefined;
+					return oFld;
+				}else{
+					return null;
+				}
+			}catch(ex){
+				bitsObjectMng._dump("getObject():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getObjectFormID : function(aID,aMode){
+			try{
+				if(!aID) return null;
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					for(var mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.getObjectFormID(aID,mode);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0)
+						return rtnArr;
+					else
+						return null;
+				}
+				var oFld = this.getObject({oid:aID},aMode);
+				if(oFld && oFld.length>0)
+					return oFld;
+				else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("getObjectFormID():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getObjectFormPID : function(aFID,aMode,aLimit){
+			try{
+				if(!aFID) return null;
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.getObjectFormID(aID,mode);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0)
+						return rtnArr;
+					else
+						return null;
+				}
+				var lFld = this.getObject({pfid:aFID},aMode,aLimit);
+				if(lFld && lFld.length>0)
+					return lFld;
+				else
+					return null;
+			}catch(ex){
+				if(statement){
+					this.endTransaction(aMode);
+					statement.reset();
+					statement = undefined;
+				}
+				bitsObjectMng._dump("getObjectFormPID():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getObjectDir : function(aID,aMode){
+			var dir = bitsObjectMng.Common.getContentDir();
+			var dir_new = dir.clone();
+			dir.append(aID);
+			dir_new.append(aMode);
+			dir_new.append(aID);
+			if(dir.exists()) return dir;
+			return dir_new;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getObjectBLOBFile : function(aID,aMode){
+			var blobFile = this.getObjectDir(aID,aMode);
+			blobFile.append("oid_img");
+			return blobFile;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getObjectPropertyDir : function(aID,aMode){
+			var pDir = this.getObjectDir(aID,aMode);
+			pDir.append("oid_property");
+			return pDir;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getObjectBLOB : function(aID,aMode,aTransaction){
+			try{
+				if(!aID) return null;
+				if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+				if(aTransaction == undefined) aTransaction = true;
+				var oFld = [];
+				var imgFile = this.getObjectBLOBFile(aID,aMode);
+				if(imgFile.exists()){
+					var istream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
+					istream.init(imgFile, -1, -1, false);
+					var bstream = Components.classes["@mozilla.org/binaryinputstream;1"].createInstance(Components.interfaces.nsIBinaryInputStream);
+					bstream.setInputStream(istream);
+					var bytes = bstream.readByteArray(bstream.available());
+					istream.close();
+					oFld.push(bytes);
+					return oFld;
+				}
+				var oSql = 'select oid_img from om_object where oid=?1';
+				if(aTransaction) if(!this.beginTransaction(aMode)) return null;
+				var statement = this._dbConn[aMode].createStatement(oSql);
+				statement.bindUTF8StringParameter(0,aID);
+				while(statement.executeStep()){
+					var array = {};
+					var size = {};
+					statement.getBlob(0,size,array);
+					oFld.push(array.value);
+				}
+				statement.reset();
+				statement = undefined;
+				if(aTransaction) this.endTransaction(aMode);
+				if(oFld && oFld.length>0)
+					return oFld;
+				else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("getObjectBLOB():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getAllObject : function(aMode){
+			try{
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.getAllObject(mode);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0)
+						return rtnArr;
+					else
+						return null;
+				}
+				var rtnFld = this.getObject({},aMode);
+				if(rtnFld && rtnFld.length>0)
+					return rtnFld;
+				else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("getAllObject():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getURL : function(aMode){
+			try{
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.getURL(mode);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0)
+						return rtnArr;
+					else
+						return null;
+				}
+				var oSql = 'select doc_url from om_object group by doc_url';
+				var oFld = this.select(aMode,oSql);
+				if(oFld && oFld.length>0)
+					return oFld;
+				else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("getURL():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getAllFolder : function(aMode,aTransaction){
+			try{
+				if(aTransaction == undefined) aTransaction = true;
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.getAllFolder(mode,false);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0)
+						return rtnArr;
+					else
+						return null;
+				}
+				var fSql = 'select *,"'+aMode+'" as dbtype from om_folder';
+				var fFld = [];
+				if(aTransaction) if(!this.beginTransaction(aMode)) return null;
+				var statement = this._dbConn[aMode].createStatement(fSql);
+				while(statement.executeStep()){
+					var row = [];
+					var j,k
+					for(j=0,k=statement.columnCount;j<k;j++){
+						row[statement.getColumnName(j)] = statement.getUTF8String(j);
+						if(row[statement.getColumnName(j)] == "null") row[statement.getColumnName(j)] = "";
+					}
+					fFld.push(row);
+				}
+				statement.reset();
+				statement = undefined;
+				if(aTransaction) this.endTransaction(aMode);
+				if(fFld && fFld.length>0)
+					return fFld;
+				else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("getAllFolder():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getFolderFormID : function(aID,aMode,aNoMode,aTransaction){
+			try{
+				if(!aID) return null;
+				if(aTransaction == undefined) aTransaction = true;
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(mode == aNoMode) continue;
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.getFolderFormID(aID,mode,undefined,aTransaction);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0)
+						return rtnArr;
+					else
+						return null;
+				}
+				var fSql = 'select *,"'+aMode+'" as dbtype from om_folder where fid =?1';
+				var fFld = this.selectB(aMode,fSql,[aID],aTransaction);
+				if(fFld && fFld.length>0)
+					return fFld;
+				else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("getFolderFormID():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getFolderFormPID : function(aPID,aMode,aTransaction){
+			try{
+				if(!aPID) return null;
+				if(aTransaction == undefined) aTransaction = true;
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.getFolderFormPID(aPID,mode,aTransaction);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0)
+						return rtnArr;
+					else
+						return null;
+				}
+				var fSql = 'select *,"'+aMode+'" as dbtype from om_folder where pfid = ?1';
+				var fFld = this.selectB(aMode,fSql,[aPID],aTransaction);
+				if(fFld && fFld.length>0)
+					return fFld;
+				else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("getFolderFormPID():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getFolderFormTitle : function(aTitle,aMode,aTransaction){
+			try{
+				if(!aTitle) return null;
+				if(aTransaction == undefined) aTransaction = true;
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.getFolderFormTitle(aTitle,mode,aTransaction);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0)
+						return rtnArr;
+					else
+						return null;
+				}
+				var fSql = 'select *,"'+aMode+'" as dbtype from om_folder where fid_title =?1';
+				var fFld = this.selectB(aMode,fSql,[aTitle],aTransaction);
+				if(fFld && fFld.length>0)
+					return fFld;
+				else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("getFolderFormTitle():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getFolder : function(aFolder,aMode){
+			try{
+				if(!aFolder) return null;
+				if(aMode == undefined || aMode == ""){
+					var rtnArr = [];
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpArr = bitsObjectMng.Database.getFolder(aFolder,mode);
+						if(tmpArr) rtnArr = rtnArr.concat(tmpArr);
+					}
+					if(rtnArr && rtnArr.length>0)
+						return rtnArr;
+					else
+						return null;
+				}
+				var para = [];
+				var where = [];
+				var key;
+				var index=0;
+				for(key in aFolder){
+					where.push("om_folder."+key+"=?"+(++index));
+					para.push(aFolder[key]);
+				}
+				var oSql = 'select' +
+									' om_folder.*' +
+									',"'+aMode+'" as dbtype' +
+									' from om_folder';
+				if(where.length>0) oSql += " where " + where.join(" and ");
+				oSql += ' order by om_folder.pfid_order';
+				var oFld = this.selectB(aMode,oSql,para);
+				if(oFld && oFld.length>0)
+					return oFld;
+				else
+					return null;
+			}catch(ex){
+				bitsObjectMng._dump("getFolder():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getMaxOrderFormPID : function(aPID,aMode,aTransaction){
+			try{
+				if(!aPID) return null;
+				if(aTransaction == undefined) aTransaction = true;
+				if(aMode == undefined || aMode == ""){
+					var rtnValue = 0;
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpValue = bitsObjectMng.Database.getMaxOrderFormPID(aPID,mode,aTransaction);
+						if(tmpValue && tmpValue>rtnValue) rtnValue = tmpValue;
+					}
+					return rtnValue;
+				}
+				var oSql = 'select max(pfid_order) as max_order from (select pfid_order FROM om_link where pfid=' + aPID +' union select pfid_order from om_folder where pfid=' + aPID +')';
+				var rtn = this.selectCount(aMode,oSql,aTransaction);
+				return rtn;
+			}catch(ex){
+				bitsObjectMng._dump("Database.getMaxOrderFormPID():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getMaxObjectOrderFormPID : function(aPID,aMode){
+			try{
+				if(!aPID) return null;
+				if(aMode == undefined || aMode == ""){
+					var rtnValue = 0;
+					var mode;
+					for(mode in this._dbConn){
+						if(typeof this._dbConn[mode] == "function") continue;
+						var tmpValue = bitsObjectMng.Database.getMaxObjectOrderFormPID(aPID,mode);
+						if(tmpValue && tmpValue>rtnValue) rtnValue = tmpValue;
+					}
+					return rtnValue;
+				}
+				var oSql = 'select max(pfid_order) as max_order FROM om_link where pfid=' + aPID;
+				var rtn = this.selectCount(aMode,oSql);
+				return rtn;
+			}catch(ex){
+				bitsObjectMng._dump("Database.getMaxObjectOrderFormPID():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		getFavicon : function(aURL,aMode){
+			try{
+				if(!aURL) return undefined;
+				if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+				var image_data;
+				var mime;
+				var array = {};
+				var size = {};
+				try{
+					var pageURI = bitsObjectMng.Common.convertURLToObject(aURL);
+					var faviconURI = bitsObjectMng.Common.FAVICON.getFaviconForPage(pageURI);
+				}catch(ex2){}
+				if(!faviconURI) return null;
+				if(array.value==undefined){
+					var mimeType = {};
+					var dataLen  = {};
+					var dataArr = bitsObjectMng.Common.FAVICON.getFaviconData(faviconURI,mimeType,dataLen);
+					mime = mimeType.value;
+					size.value = dataLen.value;
+					if(size.value>0){
+						array.value = dataArr;
+					}
+				}
+				if(array.value){
+					var images = String.fromCharCode.apply(String, array.value);
+					image_data = 'data:' + mime + ';base64,' + btoa(images);
+				}
+				return image_data;
+			}catch(ex){
+				bitsObjectMng._dump("getFavicon():"+ex);
+				return null;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		removeObject : function(aObject,aMode,aTransaction){
+			try{
+				if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+				if(aTransaction == undefined) aTransaction = true;
+				if(aTransaction) if(!this.beginTransaction(aMode)) return false;
+				var rtn = false;
+				if(aObject && aObject.oid){
+					rtn = this.removeLink(aObject,aMode,false);
+					if(rtn && this._oidCount(aMode,aObject.oid,false) == 0){
+                                            
+                                                // send DELETE request to MPI REST server  
+                                                annotationFramework.deleteAnnotationByOid(aObject.oid);
+                                                
+						var aSql = "delete from om_object";
+						aSql += ' where oid="'+ aObject.oid +'"';
+						rtn = this.cmd(aMode,aSql,false);
+					}
+				}
+				if(!rtn){
+					bitsObjectMng._dump("bitsObjectMng.Database.removeObject():rtn=["+rtn+"]");
+				}
+
+				if(rtn){
+					var dDir = this.getObjectDir(aObject.oid,aMode);
+					if(dDir.exists()) dDir.remove(true);
+					dDir = undefined;
+				}
+				if(aTransaction) this.endTransaction(aMode);
+				if(rtn) nsPreferences.setUnicharPref("wiredmarker.last_update", bitsObjectMng.Common.getTimeStamp()+"\t"+aMode+"\t"+bitsObjectMng.DataSource.inittime + "\tDELETE\tOBJECT");
+				return rtn;
+			}catch(ex){
+				if(aTransaction) this.endTransaction(aMode);
+				bitsObjectMng._dump("Database.removeObject():"+ex);
+				return false;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		removeLink : function(aObject,aMode,aTransaction){
+			try{
+				if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+				if(aTransaction == undefined) aTransaction = true;
+				var aSql = "delete from om_link";
+				if(aObject){
+					if(aObject.oid && aObject.pfid){
+						aSql += ' where oid='+ aObject.oid +' and pfid='+ aObject.pfid;
+					}else if(aObject.oid){
+						aSql += ' where oid='+ aObject.oid;
+					}
+				}
+				var rtn = this.cmd(aMode,aSql,aTransaction);
+				if(!rtn) bitsObjectMng.Common.alert("removeLink()!!");
+				return rtn;
+			}catch(ex){
+				bitsObjectMng._dump("Database.removeLink():"+ex);
+				bitsObjectMng._dump("Database.removeLink():"+aSql);
+				return false;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		removeFolder : function(aID,aMode,aTransaction){
+			try{
+				if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+				if(aTransaction == undefined) aTransaction = true;
+				if(aTransaction) if(!this.beginTransaction(aMode)) return null;
+				var lSql = 'select oid from om_link';
+				if(aID) lSql += ' where pfid="'+ aID +'"';
+				var lFld = [];
+				var statement = this._dbConn[aMode].createStatement(lSql);
+				while(statement.executeStep()){
+					var row = [];
+					for(var j=0,k=statement.columnCount;j<k;j++){
+						row[statement.getColumnName(j)] = statement.getUTF8String(j);
+						if(row[statement.getColumnName(j)] == "null") row[statement.getColumnName(j)] = "";
+					}
+					lFld.push(row);
+				}
+				statement.reset();
+				statement = undefined;
+				if(lFld && lFld.length>0){
+					var oSql = 'delete from om_object where oid=?1';
+					for(var i=0;i<lFld.length;i++){
+						try{
+							statement = this._dbConn[aMode].createStatement(oSql);
+							statement.bindUTF8StringParameter(0,lFld[i].oid);
+							statement.execute();
+							statement.reset();
+						}catch(ex2){
+							bitsObjectMng._dump("bitsObjectMng.Database.removeFolder():"+ex2);
+							bitsObjectMng._dump("bitsObjectMng.Database.removeFolder():lFld["+i+"].oid=["+lFld[i].oid+"]");
+						}
+					}
+					statement = undefined;
+					lSql = 'delete from om_link';
+					if(aID) lSql += ' where pfid="'+ aID +'"';
+					statement = this._dbConn[aMode].createStatement(lSql);
+					statement.execute();
+					statement.reset();
+					statement = undefined;
+				}
+				var fSql = 'select fid from om_folder';
+				if(aID) fSql += ' where pfid="'+ aID +'"';
+				var fFld = [];
+				var statement = this._dbConn[aMode].createStatement(fSql);
+				while(statement.executeStep()){
+					var row = [];
+					for(var j=0,k=statement.columnCount;j<k;j++){
+						row[statement.getColumnName(j)] = statement.getUTF8String(j);
+						if(row[statement.getColumnName(j)] == "null") row[statement.getColumnName(j)] = "";
+					}
+					fFld.push(row);
+				}
+				statement.reset();
+				statement = undefined;
+				if(fFld && fFld.length>0){
+					for(var i=0;i<fFld.length;i++){
+						bitsObjectMng.Database.removeFolder(fFld[i].fid,aMode,false);
+					}
+				}
+				var aSql = "delete from om_folder";
+				if(aID) aSql += ' where fid="'+ aID +'"';
+				var rtn = this.cmd(aMode,aSql,false);
+				if(aTransaction) this.endTransaction(aMode);
+				if(rtn) nsPreferences.setUnicharPref("wiredmarker.last_update", bitsObjectMng.Common.getTimeStamp()+"\t"+aMode+"\t"+bitsObjectMng.DataSource.inittime + "\tDELETE\tFOLDER");
+				return rtn;
+			}catch(ex){
+				bitsObjectMng._dump("Database.removeFolder():"+ex);
+				if(aSql) bitsObjectMng._dump("Database.removeFolder():"+aSql);
+				if(aTransaction) this.endTransaction(aMode);
+				return false;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		updateObject : function(aObject,aMode){
+			try{
+				if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+				var rtn = true;
+				var om_link = {};
+				var values = [];
+				var para = [];
+				var index=0;
+				if(aObject.style) delete aObject.style;
+				if(aObject.cssstyle) delete aObject.cssstyle;
+				if(aObject.oid_property) aObject.oid_property = this._updateOidProperty(aObject,aMode);
+				var key;
+				for(key in aObject){
+					if(aObject[key] == undefined || key == "oid") continue;
+					if(key == "pfid" || key == "pfid_new"){
+						om_link.pfid = aObject[key];
+						continue;
+					}
+					if(key == "pfid_old"){
+						om_link.pfid_old = aObject[key];
+						continue;
+					}
+					if(key == "pfid_order"){
+						om_link.pfid_order = aObject[key];
+						continue;
+					}
+					values.push(key+'=?'+(++index));
+					para.push(aObject[key]);
+				}
+				if(!aObject.oid || aObject.oid == "") rtn = false;
+				if(rtn && om_link.pfid != undefined && om_link.pfid_old != undefined){
+					if(rtn){
+						if(om_link.pfid != om_link.pfid_old) rtn = !this._linkExists(aMode, {oid:aObject.oid, pfid:om_link.pfid});
+						if(!rtn) bitsObjectMng._dump("bitsObjectMng.Database.updateObject():_linkExists=["+ !rtn + "]");
+					}
+					if(rtn){
+						var aSql = 'update om_link set pfid="'+ om_link.pfid +'" where oid="'+ aObject.oid +'" and pfid="'+ om_link.pfid_old +'"';
+						rtn = this.cmd(aMode,aSql);
+					}
+				}
+				if(rtn && om_link.pfid != undefined && om_link.pfid_order != undefined){
+					var aSql = 'update om_link set pfid_order="'+ om_link.pfid_order +'" where oid="'+ aObject.oid +'" and pfid="'+ om_link.pfid +'"';
+					rtn = this.cmd(aMode,aSql);
+				}
+				if(rtn && values.length>0){
+					var aSql = 'update om_object set '+ values.join(",") +' where oid="'+ aObject.oid +'"';
+                                        //alert("UPDATE oid: "+aObject.oid);
+                                        annotationProxy.updateFullAnnotation(aObject);
+					rtn = this.cmdB(aMode,aSql,para);
+				}
+				if(rtn) nsPreferences.setUnicharPref("wiredmarker.last_update", bitsObjectMng.Common.getTimeStamp()+"\t"+aMode+"\t"+bitsObjectMng.DataSource.inittime + "\tUPDATE\tOBJECT");
+				return rtn;
+			}catch(ex){
+				bitsObjectMng._dump("Database.updateObject():"+ex);
+				return false;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		updateObjectBLOB : function(aOID,aArray,aMode,aTransaction){
+			try{
+				if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+				if(aTransaction == undefined) aTransaction = true;
+				var rtn = true;
+				var om_link = {};
+				var values = [];
+				if(!aOID || !aArray) return false;
+				var imgFile = this.getObjectBLOBFile(aOID,aMode);
+				if(!imgFile.exists()) imgFile.create(imgFile.NORMAL_FILE_TYPE, 0664);
+				var regexp = new RegExp("^data:image/\\w+?;base64,");
+				if(typeof aArray == "object" && aArray.length != undefined){
+					var ostream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
+					ostream.init(imgFile, 0x04 | 0x08 | 0x20, 664, 0); // write, create, truncate
+					var bstream = Components.classes["@mozilla.org/binaryoutputstream;1"].createInstance(Components.interfaces.nsIBinaryOutputStream);
+					bstream.setOutputStream(ostream);
+					bstream.writeByteArray(aArray, aArray.length);
+					ostream.close();
+				}else if(typeof aArray == "string" && regexp.test(aArray)){
+					bitsObjectMng.Common.saveDataUrlToFile(aArray,imgFile);
+				}else{
+					return false;
+				}
+				if(aTransaction) if(!this.beginTransaction(aMode)) return null;
+				var statement = this._dbConn[aMode].createStatement('update om_object set oid_img=?1 where oid = ?2');
+				statement.bindNullParameter(0);
+				statement.bindUTF8StringParameter(1,aOID);
+				statement.execute();
+				statement.reset();
+				if(aTransaction) this.endTransaction(aMode);
+				statement = undefined;
+				return rtn;
+			}catch(ex){
+				bitsObjectMng._dump("Database.updateObjectBLOB():"+ex);
+				return false;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		updateFolder : function(aFolder,aMode,aTransaction){
+			try{
+				if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+				if(aTransaction == undefined) aTransaction = true;
+				var values = [];
+				var para = [];
+				var index=0;
+				var key;
+				for(key in aFolder){
+					if(aFolder[key] == undefined || key == "fid") continue;
+					values.push(key+'=?'+(++index));
+					para.push(aFolder[key]);
+				}
+				if(values.length == 0 || !aFolder.fid|| aFolder.fid == "") return false;
+				var aSql = 'update om_folder set ' + values.join(",") + ' where fid="'+ aFolder.fid +'"';
+				var rtn = this.cmdB(aMode,aSql,para,aTransaction);
+				if(rtn) nsPreferences.setUnicharPref("wiredmarker.last_update", bitsObjectMng.Common.getTimeStamp()+"\t"+aMode+"\t"+bitsObjectMng.DataSource.inittime + "\tUPDATE\tFOLDER");
+				return rtn;
+			}catch(ex){
+				bitsObjectMng._dump("ERROR!!:Database.updateFolder():"+ex);
+				return false;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		initSeq : function (){
+			this._seqmin = bitsObjectMng.Common.getTimeStamp();
+			this._seq = [];
+		},
+
+/////////////////////////////////////////////////////////////////////
+		_seqIdentify : function (aID,aMode){
+			if(aID == undefined) aID = bitsObjectMng.Common.getTimeStamp();
+			if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+			var i = 0;
+			while(this._seq[aID] && i < 100){
+				aID = ""+parseInt(this._seqmin)-1;
+			}
+			this._seq[aID] = aID.toString();
+			if(parseInt(aID) < parseInt(this._seqmin)) this._seqmin = this._seq[aID];
+			return this._seq[aID];
+		},
+
+/////////////////////////////////////////////////////////////////////
+		makeObjectToItem : function(aObject,aAbout){
+			var info = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
+			var app_version = parseInt(info.version);
+			var xmldoc = null;
+			if(aObject.oid_property && aObject.oid_property != ""){
+				try{
+					var parser = new DOMParser();
+					xmldoc = parser.parseFromString(aObject.oid_property, "text/xml");
+					parser = undefined;
+				}catch(ex){}
+				if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+			}
+			var newItem = bitsObjectMng.Common.newItem();
+			newItem.about = (aAbout?aAbout:bitsObjectMng.DataSource.getAbout(aObject.oid,aObject.pfid,aObject.dbtype));
+			newItem.id = aObject.oid;
+			newItem.type = "item";
+			newItem.title = aObject.oid_title;
+			newItem.comment = "";
+			newItem.uri = aObject.doc_url;
+			newItem.date = aObject.oid_date;
+			if(aObject.oid_type.match(/^image\/(.+)$/)){
+				if(app_version>2){
+					var blobFile = this.getObjectBLOBFile(aObject.oid,aObject.dbtype);
+					if(blobFile.exists()){
+						if(blobFile.fileSize>0){
+							var url = bitsObjectMng.Common.convertFilePathToURL(blobFile.path);
+							if(url) newItem.icon = url;
+						}else if(aObject.oid_txt){
+							if(bitsObjectMng.Common.getImageFromURL(aObject.oid_txt, blobFile)){
+								if(blobFile.exists() && blobFile.fileSize>0){
+									var url = bitsObjectMng.Common.convertFilePathToURL(blobFile.path);
+									if(url) newItem.icon = url;
+								}
+							}
+						}
+					}
+				}
+			}else if(aObject.oid_type == "url"){
+				newItem.icon = this.getFavicon(aObject.oid_txt,aObject.dbtype);
+				if(!newItem.icon) newItem.icon = this.getFavicon(aObject.doc_url,aObject.dbtype);
+			}else{
+				var icon;
+				if(xmldoc){
+					var xmlnode = xmldoc.getElementsByTagName("ICON")[0];
+					if(xmlnode) icon = xmlnode.textContent;
+				}else{
+					if(aObject.oid_property.match(/^.*<ICON>(.+?)<\/ICON>.*$/m)){
+						icon = RegExp.$1;
+					}
+				}
+				if(icon != undefined && icon != ""){
+					var url = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURL);
+					url.spec = icon;
+					if(url.scheme == "file"){
+						var file = bitsObjectMng.Common.convertURLToFile(icon)
+						if(!file.exists()) icon = undefined;
+					}else if(url.scheme == "chrome"){
+						var val = this.existsIcon(url);
+						if(!val) icon = undefined;
+					}
+				}
+				if(icon != undefined && icon != "") newItem.icon = icon;
+			}
+			if(!newItem.icon){
+				try{
+					newItem.icon = this.getFavicon(aObject.doc_url,aObject.dbtype);
+					if(newItem.icon == undefined) delete newItem.icon;
+				}catch(ex){}
+			}
+			if(!newItem.icon){
+				if(aObject.oid_type.match(/^image\//)){
+					newItem.icon = "chrome://markingcollection/skin/image.png";
+				}else{
+					newItem.icon = "chrome://markingcollection/skin/defaultFavicon.png";
+				}
+			}
+			if(xmldoc){
+				var xmlnode = xmldoc.getElementsByTagName("TREE_TITLE")[0];
+				if(xmlnode) newItem.title = xmlnode.textContent;
+			}else if(aObject.oid_property){
+				if(aObject.oid_property.match(/^.*<TREE_TITLE>(.+?)<\/TREE_TITLE>.*$/m)){
+					newItem.title = RegExp.$1;
+				}
+			}
+			if(!aObject.oid_type.match(/^image\/(.+)$/)){
+				newItem.source = bitsMarker.id_key+aObject.dbtype+aObject.oid;
+			}
+			newItem.editmode = aObject.oid_mode;
+			newItem.pfid = aObject.pfid;
+			newItem.pfid_order = aObject.pfid_order;
+			newItem.dbtype = aObject.dbtype;
+			newItem.list = null;
+			return newItem;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		existsIcon : function(aURI){
+			var rtn = false;
+			try{
+				const IOService = bitsObjectMng.Common.IO;
+				var channel = IOService.newChannelFromURI(aURI);
+				var stream  = channel.open();
+				var bstream = Components.classes['@mozilla.org/binaryinputstream;1'].createInstance(Components.interfaces.nsIBinaryInputStream);
+				bstream.setInputStream(stream);
+				if(bstream.available()>0) rtn = true;
+				bstream.close();
+				stream.close();
+			}
+		  catch(e){}
+		  return rtn;
+		},
+
+/////////////////////////////////////////////////////////////////////
+		makeRdf : function (aID,aRecursive,aNewID,aPfid2Folder,aFid2Folder,aPfid2Object,aFile,aMode){
+			try{
+				if(aMode == undefined || aMode == "") aMode = this._defaultMode;
+				var baseID = aID;
+				var results = [];
+				var dirArray = [];
+				var fileArray = [];
+				var folders = null;
+				if(aID == undefined){
+					baseID = "0";
+					folders = aPfid2Folder[baseID];
+				}else{
+					folders = aFid2Folder[baseID];
+				}
+				if(folders){
+					var folderFilterHash;
+					var tmpFolderFilter = nsPreferences.copyUnicharPref("wiredmarker.filter.folder","");
+					var tmpFolderFilterArr = tmpFolderFilter.split("\t");
+					var i;
+					for(i=0;i<tmpFolderFilterArr.length;i++){
+						if(!tmpFolderFilterArr[i].match(/^(\d+):(\d+):(.+)$/)) continue;
+						if(!folderFilterHash) folderFilterHash = {};
+						var filter_fid = RegExp.$1;
+						var filter_casesensitive = RegExp.$2;
+						var filter_keyword = RegExp.$3;
+						folderFilterHash[filter_fid] = new RegExp(filter_keyword,(filter_casesensitive==1)?"mg":"img");
+					}
+					tmpFolderFilterArr = undefined;
+					tmpFolderFilter = undefined;
+					var icon;
+					var i;
+					for(i=0;i<folders.length;i++){
+						var newItem = bitsObjectMng.Common.newItem();
+						newItem.about = bitsObjectMng.DataSource.getAbout(folders[i].fid,folders[i].pfid,aMode);
+						newItem.id = folders[i].fid;
+						newItem.pfid = folders[i].pfid;
+						newItem.type = "folder";
+						newItem.title = folders[i].fid_title;
+						newItem.comment = "";
+						newItem.style = folders[i].fid_style;
+						newItem.editmode = folders[i].fid_mode;
+						newItem.pfid_order = folders[i].pfid_order;
+						newItem.cssrule = 'css_'+aMode+'_'+folders[i].fid;
+						newItem.dbtype = folders[i].dbtype;
+						newItem.Folder = "true";
+						newItem.list = null;
+						newItem.addon_id = "";
+						newItem.contextmenu = "";
+						newItem.shortcut = "";
+						bitsObjectMng.DataSource.setID2About(folders[i].fid,folders[i].pfid,newItem.about,aMode);
+						var xmldoc = null;
+						if(folders[i].fid_property && folders[i].fid_property != ""){
+							try{
+								var parser = new DOMParser();
+								xmldoc = parser.parseFromString(folders[i].fid_property, "text/xml");
+								parser = undefined;
+							}catch(ex){}
+							if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+						}
+						icon = undefined;
+						if(folderFilterHash && folderFilterHash[folders[i].fid]) icon = "chrome://markingcollection/skin/filter.png";
+						if(!icon){
+							if(xmldoc){
+								var xPathResult = bitsObjectMng.XPath.evaluate('/PROPERTY[1]/ADDON[1]/ICON[1]', xmldoc);
+								if(xPathResult && xPathResult.snapshotLength>0){
+									icon = xPathResult.snapshotItem(0).textContent;
+								}else{
+									var xmlnode = xmldoc.getElementsByTagName("ICON")[0];
+									if(xmlnode) icon = xmlnode.textContent;
+								}
+								xPathResult = undefined;
+								var xPathResult = bitsObjectMng.XPath.evaluate('/PROPERTY[1]/ADDON[1]/ID[1]', xmldoc);
+								if(xPathResult && xPathResult.snapshotLength>0){
+									if(newItem.addon_id != "") newItem.addon_id += "\n";
+									newItem.addon_id = xPathResult.snapshotItem(0).textContent;
+								}
+								xPathResult = undefined;
+							}else if(folders[i].fid_property){
+								if(folders[i].fid_property.match(/^.*<ICON>(.+?)<\/ICON>.*$/m)){
+									icon = RegExp.$1;
+								}
+							}
+						}
+						if(icon != undefined && icon != ""){
+							var url = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURL);
+							url.spec = icon;
+							if(url.scheme == "file"){
+								var file = bitsObjectMng.Common.convertURLToFile(icon)
+								if(!file.exists()) icon = undefined;
+							}else if(url.scheme == "chrome"){
+								var val = this.existsIcon(url);
+								if(!val) icon = undefined;
+							}
+						}
+						if(icon != undefined && icon != "") newItem.icon = icon;
+						var contextmenu;
+						contextmenu = undefined;
+						if(xmldoc){
+							var xPathResult = bitsObjectMng.XPath.evaluate('/PROPERTY[1]/CONTEXTMENU[1]', xmldoc);
+							if(xPathResult && xPathResult.snapshotLength>0){
+								contextmenu = xPathResult.snapshotItem(0).textContent;
+							}else{
+								var xmlnode = xmldoc.getElementsByTagName("CONTEXTMENU")[0];
+								if(xmlnode) contextmenu = xmlnode.textContent;
+							}
+							xPathResult = undefined;
+						}else if(folders[i].fid_property){
+							if(folders[i].fid_property.match(/^.*<CONTEXTMENU>(.+?)<\/CONTEXTMENU>.*$/m)){
+								contextmenu = RegExp.$1;
+							}
+						}
+						if(contextmenu != undefined && contextmenu != "") newItem.contextmenu = contextmenu;
+						dirArray.push(newItem);
+					}
+					folders = undefined
+				}else{
+					return null;
+				}
+				if(dirArray.length>0){
+					var cnt;
+					for(cnt=0;cnt<dirArray.length;cnt++){
+						var result = [];
+						if(aRecursive){
+							var folders = aPfid2Folder[dirArray[cnt].id];
+							if(folders){
+								var i;
+								for(i=0;i<folders.length;i++){
+									var rtn = this.makeRdf(folders[i].fid,aRecursive,aNewID,aPfid2Folder,aFid2Folder,aPfid2Object,undefined,aMode);
+									if(!rtn || !rtn.list) continue;
+									result = result.concat(rtn.list);
+								}
+							}
+						}
+						var objects = aPfid2Object[dirArray[cnt].id];
+						if(objects){
+							var i;
+							for(i=0;i<objects.length;i++){
+								var newItem = this.makeObjectToItem(objects[i]);
+								fileArray.push(newItem);
+							}
+							objects = undefined
+						}
+						if(fileArray.length>0) result = result.concat(fileArray);
+						dirArray[cnt].list = result;
+						results.push(dirArray[cnt]);
+						result = null;
+						fileArray = [];
+					}
+				}
+				dirArray = null;
+				fileArray = null;
+				if(aFile != undefined){
+					var out_txt = "";
+					var out_txt_utf8 = "";
+					out_txt += '<?xml version="1.0"?>\n';
+					out_txt += '<RDF:RDF xmlns:NS1="' + bitsObjectMng.NS_OBJECTMANAGEMENT + '"\n';
+					out_txt += '         xmlns:NC="http://home.netscape.com/NC-rdf#"\n';
+					out_txt += '         xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">\n';
+					out_txt += '  <RDF:Seq RDF:about="'+ bitsObjectMng.DataSource.ABOUT_ROOT +'">\n';
+					if(results){
+						var cnt;
+						for(cnt=0;cnt<results.length;cnt++){
+							out_txt += '    <RDF:li RDF:resource="'+ results[cnt].about +'"/>\n';
+						}
+					}
+					out_txt += '  </RDF:Seq>\n';
+					out_txt += this._outputRDF(results);
+					out_txt += '</RDF:RDF>\n';
+					bitsObjectMng.Common.writeFile(aFile,out_txt,"UTF-8");
+				}
+				return {list:results, id:baseID };
+			}catch(e){
+				bitsObjectMng._dump("bitsObjectMng.makeRdf()"+e);
+				return undefined;
+			}
+		},
+
+/////////////////////////////////////////////////////////////////////
+		_outputRDF : function(pArray){
+			var cnt;
+			var seq;
+			var key;
+			var out_txt = "";
+			for(cnt=0;cnt<pArray.length;cnt++){
+				if(pArray[cnt].list){
+					out_txt += '  <RDF:Seq RDF:about="'+ pArray[cnt].about +'">\n';
+					if(pArray[cnt].list){
+						pArray[cnt].list.sort(
+							function(a,b){
+								var len = parseInt(a.pfid_order)-parseInt(b.pfid_order);
+								return len;
+							}
+						);
+						for(seq=0;seq<pArray[cnt].list.length;seq++){
+							out_txt += '    <RDF:li RDF:resource="'+ pArray[cnt].list[seq].about +'"/>\n';
+						}
+					}
+					out_txt += '  </RDF:Seq>\n';
+				}
+				if(pArray[cnt].id != "0"){
+					out_txt += '  <RDF:Description RDF:about="' + pArray[cnt].about +'"';
+					for(key in pArray[cnt]){
+						if(key == "list") continue;
+						if(key == "about") continue;
+						if(pArray[cnt][key] == undefined) continue;
+						if(typeof pArray[cnt][key] == "function") continue;
+						pArray[cnt][key] = pArray[cnt][key].replace(/&/mg,"&amp;").replace(/</mg,"&lt;").replace(/>/mg,"&gt;").replace(/\"/mg,"&quot;");
+						if(pArray[cnt][key] != undefined) out_txt += '\n                   NS1:'+key+'="'+pArray[cnt][key]+'"';
+					}
+					out_txt += '/>\n';
+				}
+				if(pArray[cnt].list){
+					out_txt += this._outputRDF(pArray[cnt].list);
+				}
+			}
+			return out_txt;
+		},
+
+/////////////////////////////////////////////////////////////////////
+	},
+
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/objecttooltip.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/objecttooltip.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/objecttooltip.js	(revision 5703)
@@ -0,0 +1,130 @@
+var bitsObjectTooltip = {
+	tooltipTimer : null,
+	_contextmenushow : false,
+
+	get gBrowser(){ return gBrowser; },
+
+	get TOOLTIP()    { return window.top.document.getElementById("MarkingCollectionObjectTooltip"); },
+	get TITLE()      { return window.top.document.getElementById("MarkingCollectionObjectTooltipTitleLabel"); },
+	get NOTE()       { return window.top.document.getElementById("MarkingCollectionObjectTooltipNoteDescription"); },
+	get CONTEXTMENU(){ return window.top.document.getElementById("contentAreaContextMenu"); },
+
+	get Database(){ return window.top.bitsObjectMng.Database; },
+
+	init : function(){
+		this.gBrowser.addEventListener("mousemove",bitsObjectTooltip.mousemove,false);
+		this.CONTEXTMENU.addEventListener("popupshowing",bitsObjectTooltip.contextmenushown,false);
+		this.CONTEXTMENU.addEventListener("popuphiding",bitsObjectTooltip.contextmenuhidden,false);
+	},
+
+	done : function(){
+		this.gBrowser.removeEventListener("mousemove",bitsObjectTooltip.mousemove,false);
+		this.CONTEXTMENU.removeEventListener("popupshowing",bitsObjectTooltip.contextmenushown,false);
+		this.CONTEXTMENU.removeEventListener("popuphiding",bitsObjectTooltip.contextmenuhidden,false);
+	},
+
+	contextmenushown : function(event){
+		bitsObjectTooltip._contextmenushow = true;
+		bitsObjectTooltip.hideTooltip();
+	},
+
+	contextmenuhidden : function(event){
+		bitsObjectTooltip._contextmenushow = false;
+	},
+
+	mousemove : function(event){
+		try{ if(!bitsMarker) return; }catch(ex){ return; }
+		var match_exp = new RegExp("^"+bitsMarker.id_key+"\\D+(\\d+)$","m");
+		var click_oid = "";
+		var parent = event.rangeParent;
+		while(parent){
+			if(parent.id && parent.id.match(match_exp)){
+				var dbtype = parent.getAttribute("dbtype");
+				match_exp = new RegExp("^"+bitsMarker.id_key+dbtype+"(\\d+)$","m");
+				if(match_exp.test(parent.id)){
+					click_oid = RegExp.$1;
+					break;
+				}
+			}
+			parent = parent.parentNode;
+		}
+		var disptooltip = nsPreferences.getBoolPref("wiredmarker.marker.mouseover.disptooltip", true);
+		if(!disptooltip || !parent || click_oid == "" || !event.target.id || (event.target.id && event.target.id != parent.id)){
+			bitsObjectTooltip.hideTooltip();
+			return;
+		}
+		bitsObjectTooltip.showTooltip({
+			element : parent,
+			oid     : click_oid,
+			dbtype  : parent.getAttribute("dbtype"),
+			pfid    : parent.getAttribute("pfid"),
+			screenX : event.screenX,
+			screenY : event.screenY,
+		});
+	},
+
+	hideTooltip : function(aParam){
+//		this.TITLE.value = '';
+		while(this.TITLE.hasChildNodes()){
+			this.TITLE.removeChild(this.TITLE.lastChild);
+		}
+		while(this.NOTE.hasChildNodes()){
+			this.NOTE.removeChild(this.NOTE.lastChild);
+		}
+		if(this.tooltipTimer) clearTimeout(this.tooltipTimer);
+		this.tooltipTimer = null;
+		this.TOOLTIP.hidePopup();
+	},
+
+	showTooltip : function(aParam){
+		if(this._contextmenushow) return;
+		this.hideTooltip();
+		this.tooltipTimer = setTimeout(function(){
+			bitsObjectTooltip._showTooltip(aParam);
+		},500)
+	},
+
+	_showTooltip : function(aParam){
+		var objects = this.Database.getObject({oid : aParam.oid},aParam.dbtype);
+		if(!objects || objects.length == 0){
+			this.hideTooltip();
+			return;
+		}
+		var object = objects[0];
+//		this.TITLE.value = object.oid_title;
+		this.TITLE.appendChild(this.TITLE.ownerDocument.createTextNode(object.oid_title));
+
+		var oid_note = "";
+		var domParser = new DOMParser();
+		if(object.oid_property && object.oid_property != ""){
+			var xmldoc = domParser.parseFromString(object.oid_property, "text/xml");
+			if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+			if(xmldoc){
+				var xmlnode = xmldoc.getElementsByTagName("NOTE")[0];
+				if(xmlnode) oid_note = xmlnode.textContent;
+			}
+			if(oid_note == undefined) oid_note = "";
+		}
+		domParser = undefined;
+		if(oid_note != ""){
+			oid_note = oid_note.replace(/^\s*/g,"").replace(/\s*$/g,"");
+			this.NOTE.appendChild(this.NOTE.ownerDocument.createTextNode(oid_note));
+		}
+		this.showPopup(aParam.screenX,aParam.screenY,aParam);
+	},
+
+	showPopup: function(x, y, aParam){
+		if(this.tooltipTimer) clearTimeout(this.tooltipTimer);
+		this.tooltipTimer = null;
+		if(this.TOOLTIP.openPopupAtScreen){
+			this.TOOLTIP.openPopupAtScreen(x, y, false);
+		}else{
+			this.TOOLTIP.showPopup(aParam.element, x, y, "tooltip");
+		}
+	},
+
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/objecttooltipOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/objecttooltipOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/objecttooltipOverlay.xul	(revision 5703)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+	id="objecttooltipOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://markingcollection/content/objecttooltip.js"/>
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _objecttooltipOverlayInit(aEvent){
+			window.setTimeout(
+				function(){
+					bitsObjectTooltip.init(aEvent);
+				},0);
+		}
+		function _objecttooltipOverlayDone(aEvent){
+			bitsObjectTooltip.done(aEvent);
+		}
+		window.addEventListener("load", _objecttooltipOverlayInit, false);
+		window.addEventListener("unload", _objecttooltipOverlayDone, false);
+	]]>
+	</script>
+	<popupset id="mainPopupSet">
+		<tooltip id="MarkingCollectionObjectTooltip" flex="1">
+			<grid>
+				<columns>
+					<column/>
+					<column flex="1"/>
+				</columns>
+				<rows>
+					<row>
+						<hbox align="start" pack="end">
+							<description value="&markingcollection.setting.marker.mouseover.title; : " style="font-weight:bold;"/>
+						</hbox><description id="MarkingCollectionObjectTooltipTitleLabel"/>
+					</row>
+					<row>
+						<hbox align="start" pack="end">
+							<description value="&markingcollection.setting.marker.mouseover.note; : " style="font-weight:bold;"/>
+						</hbox><description id="MarkingCollectionObjectTooltipNoteDescription"/>
+					</row>
+				</rows>
+			</grid>
+		</tooltip>
+	</popupset>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/optionsDialog.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/optionsDialog.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/optionsDialog.js	(revision 5703)
@@ -0,0 +1,86 @@
+var spmOptionsDialog = {
+
+/////////////////////////////////////////////////////////////////////
+	get STRING()     { return document.getElementById("spmOptionsDialogString"); },
+	get DataSource() { return window.opener.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.opener.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.opener.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.opener.top.bitsObjectMng.Database;   },
+	get gBrowser()   { return window.opener.top.bitsObjectMng.getBrowser();},
+
+	get ConditionMarker()    { return document.getElementById("spmConditionMarker"); },
+	get ConditionMarkerAll() { return document.getElementById("spmConditionMarkerAll"); },
+	get ConditionMarkerSt()  { return document.getElementById("spmConditionMarkerSt"); },
+	get ConditionMarkerEn()  { return document.getElementById("spmConditionMarkerEn"); },
+	get ConfirmMerge()       { return document.getElementById("spmConfirmMerge"); },
+
+	prefs : {},
+
+/////////////////////////////////////////////////////////////////////
+	initPrefs : function(){
+		this.prefs.conditionMerge = nsPreferences.getIntPref("wiredmarker.merge.conditionMerge", 0);
+		this.prefs.confirmMerge   = nsPreferences.getBoolPref("wiredmarker.merge.confirmMerge",  true);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	init : function(){
+		if(spmOptionsDialog._init) return;
+		try{
+			this._init = true;
+			this.initPrefs();
+			switch(this.prefs.conditionMerge){
+				case 1:
+					this.ConditionMarkerSt.setAttribute("selected",true);
+					this.ConditionMarkerEn.removeAttribute("selected");
+					this.ConditionMarkerAll.removeAttribute("selected");
+					break;
+				case 2:
+					this.ConditionMarkerEn.setAttribute("selected",true);
+					this.ConditionMarkerSt.removeAttribute("selected");
+					this.ConditionMarkerAll.removeAttribute("selected");
+					break;
+				default:
+					this.ConditionMarkerAll.setAttribute("selected",true);
+					this.ConditionMarkerSt.removeAttribute("selected");
+					this.ConditionMarkerEn.removeAttribute("selected");
+					break;
+			}
+			this.ConfirmMerge.setAttribute("checked",this.prefs.confirmMerge);
+
+		}catch(ex){
+			this.Common.alert("spmOptionsDialog.init():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(event){
+		if(this._init){
+			this._init = false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	commandCondition : function(aEvent){
+		this.prefs.conditionMerge = this.ConditionMarker.value;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	commandConfirm : function(aEvent){
+		this.prefs.confirmMerge = this.ConfirmMerge.checked;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	accept : function(aEvent){
+		nsPreferences.setIntPref("wiredmarker.merge.conditionMerge", this.prefs.conditionMerge);
+		nsPreferences.setBoolPref("wiredmarker.merge.confirmMerge",  this.prefs.confirmMerge);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	cancel : function(aEvent){
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		if(nsPreferences.getBoolPref("wiredmarker.debug", false)) window.dump(aString+"\n");
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/optionsDialog.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/optionsDialog.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/optionsDialog.xul	(revision 5703)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/scrappartymerge.dtd">
+<dialog
+	id="spmOptionsDialog"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml"
+	title="&scrappartymerge.menu.option;"
+	buttons="accept,cancel"
+	onload="spmOptionsDialog.init();"
+	ondialogaccept="spmOptionsDialog.accept();"
+	ondialogcancel="spmOptionsDialog.cancel();">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/optionsDialog.js" />
+	<stringbundleset id="spmStringBundles">
+		<stringbundle id="spmOptionsDialogString" src="chrome://markingcollection/locale/scrappartymerge.properties" />
+	</stringbundleset>
+	<dialogheader title="&scrappartymerge.menu.option; - &scrappartymerge.app.title;" description=""/>
+	<groupbox>
+		<caption label="&scrappartymerge.condition;"/>
+		<radiogroup  id="spmConditionMarker" oncommand="spmOptionsDialog.commandCondition(event);">
+			<radio id="spmConditionMarkerAll" label="&scrappartymerge.marker.all.label;"   value="&scrappartymerge.marker.all.value;"/>
+			<radio id="spmConditionMarkerSt"  label="&scrappartymerge.marker.start.label;" value="&scrappartymerge.marker.start.value;"/>
+			<radio id="spmConditionMarkerEn"  label="&scrappartymerge.marker.end.label;"   value="&scrappartymerge.marker.end.value;"/>
+		</radiogroup>
+	</groupbox>
+	<groupbox>
+		<caption label="&scrappartymerge.confirm;"/>
+		<checkbox id="spmConfirmMerge" label="&scrappartymerge.confirm.merge;" oncommand="spmOptionsDialog.commandConfirm(event);"/>
+	</groupbox>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/overlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/overlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/overlay.xul	(revision 5703)
@@ -0,0 +1,401 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://browser/skin/searchbar.css" type="text/css"?>
+<?xml-stylesheet href="chrome://markingcollection/skin/overlay.css" type="text/css"?>
+<?xml-stylesheet title="bitsMarkingCollectionCSS" href="data:text/css,window{}" type="text/css"?>
+<?xul-overlay href="chrome://markingcollection/content/autocacheOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/tagoutputOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/treelistOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/objecttooltipOverlay.xul"?>
+<!DOCTYPE overlay [
+<!ENTITY % markingcollectionDTD SYSTEM "chrome://markingcollection/locale/markingcollection.dtd" >
+%markingcollectionDTD;
+<!ENTITY % scrappartymergeDTD SYSTEM "chrome://markingcollection/locale/scrappartymerge.dtd" >
+%scrappartymergeDTD;
+<!ENTITY % metaDTD SYSTEM "chrome://markingcollection/locale/meta.dtd" >
+%metaDTD;
+]>
+<overlay
+    id="markingcollectiontasksOverlay"
+    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+    xmlns:html="http://www.w3.org/1999/xhtml"
+>
+    <script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+    <script type="application/x-javascript" src="chrome://markingcollection/content/objectmng.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/markingcollection.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/articlenavigation.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/scrappartymerge.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/marker.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/contextmenu.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/html2xhtml.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/md5.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/addon.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/hyperanchor.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/menutree.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/menufavoritefolder.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/treelist.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/treeexport.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/imagetooltip.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/substitutiontree.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/importtag.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/treeproject.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/shortcut.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/metacapture.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/pubmedcentral.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/markerRemap.js"/>
+    
+    <!-- added for annotator-service -->
+    <script type="application/x-javascript" src="chrome://markingcollection/content/annotator-service/lib/jquery-1.9.1.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/annotator-service/lib/jquery.xml2json.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/annotator-service/annotation-service.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/annotator-service/annotations.wired.marker.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/annotator-service/conversion.utils.js"/>
+    <!-- end -->    
+    <script type="application/x-javascript">
+	<![CDATA[        
+		function _markingcollectionInit(aEvent){
+			window.setTimeout(
+				function(){
+                                        
+					bitsObjectMng.init(aEvent);
+					bitsMarkingCollection.init(aEvent);
+					bitsArticleNavigation.init(aEvent);
+					bitsScrapPartyMergeService.init(aEvent);
+					bitsFavoriteFolder.init(aEvent);
+				},0);
+		}
+		function _markingcollectionDone(aEvent){
+			bitsFavoriteFolder.done(aEvent);
+			bitsScrapPartyMergeService.done(aEvent);
+			bitsArticleNavigation.done(aEvent);
+			bitsMarkingCollection.done(aEvent);
+			bitsObjectMng.done(aEvent);
+		}
+		window.addEventListener("load", _markingcollectionInit, false);
+		window.addEventListener("unload", _markingcollectionDone, false);
+	]]>
+    </script>
+    <stringbundleset id="stringbundleset">
+        <stringbundle id="ObjectManagerOverlayString"     src="chrome://markingcollection/locale/objectmng.properties" />
+        <stringbundle id="MarkingCollectionOverlayString" src="chrome://markingcollection/locale/markingcollection.properties" />
+        <stringbundle id="ArticleNavigationOverlayString" src="chrome://markingcollection/locale/articlenavigation.properties" />
+        <stringbundle id="bitsScrapPartyMergeString"      src="chrome://markingcollection/locale/scrappartymerge.properties" />
+        <stringbundle id="bitsMarkerRemapString"          src="chrome://markingcollection/locale/remap.properties" />
+        <stringbundle id="bitsDefaultString"              src="chrome://global/locale/intl.properties" />
+    </stringbundleset>
+    <broadcasterset id="mainBroadcasterSet">
+        <!--
+            <broadcaster id="viewMarkingCollection"
+                    autoCheck="false"
+                    label="&markingcollection.app.title;"
+                    type="checkbox" group="sidebar"
+                    sidebarurl="chrome://markingcollection/content/sidebar.xul"
+                    sidebartitle="&markingcollection.app.title;"
+                    oncommand="toggleSidebar('viewMarkingCollection');"/>
+        -->
+        <broadcaster id="viewMarkingCollection"
+                     autoCheck="false"
+                     label="&markingcollection.app.title;"
+                     type="checkbox" group="sidebar"
+                     sidebarurl="chrome://markingcollection/content/sidebar.xul"
+                     sidebartitle="My Annotations"
+                     oncommand="toggleSidebar('viewMarkingCollection'); document.getElementById('sidebar-title').setAttribute('style','font-size: 1.2em; text-align: center; margin: 2pt 28pt 2pt 0; vertical-align: middle; height: 30px;');"/>
+    </broadcasterset>
+    <toolbarpalette id="BrowserToolbarPalette">
+        <toolbarbutton
+            id="markingcollection-button"
+            tooltiptext="&markingcollection.app.title;"
+            observes="viewMarkingCollection"
+            class="toolbarbutton-1"
+            label="&markingcollection.app.title;"
+            ondragover="toggleSidebar('viewMarkingCollection',true);" />
+    </toolbarpalette>
+    <menupopup id="viewSidebarMenu">
+        <menuitem id="viewSidebarMenu_bitsExecMenu" observes="viewMarkingCollection" key="bits_key_openMarkingCollection" />
+    </menupopup>
+    <keyset id="mainKeyset"/>
+
+    <!-- app menu (ver.4.0ïœ) -->
+    <vbox id="appmenuSecondaryPane">
+        <!--
+        <splitmenu
+            id="bitsExtensionsAppMenu"
+            iconic="true"
+            label="&markingcollection.app.title;"
+            style="list-style-image:url(chrome://markingcollection/skin/icon_16.gif);"
+            insertbefore="appmenu_addons"
+            observes="viewMarkingCollection">
+        </splitmenu>
+        -->
+        <splitmenu
+            id="bitsExtensionsAppMenu"
+            iconic="true"
+            label="&markingcollection.app.title;"
+            style="list-style-image:url(chrome://markingcollection/skin/annotator-skin/alphatransparent/dasish_16_16.png);"
+            insertbefore="appmenu_addons"
+            observes="viewMarkingCollection">
+        </splitmenu>
+    </vbox>
+
+    <menubar id="main-menubar">
+        <menu id="bitsExtensionsMainMenu" label="&markingcollection.app.title;" accesskey="&markingcollection.key.menubar;" insertafter="bookmarks-menu bookmarksMenu" hidden="true">
+            <menupopup
+                id="bitsExtensionsMenuPopup"
+                onpopupshowing="bitsMenuTree.popupshowing(event);"
+                onpopuphiding="bitsMenuTree.popuphiding(event);"
+            >
+                <menuitem id="bitsExecMenu" observes="viewMarkingCollection" key="bits_key_openMarkingCollection" />
+                <menuitem
+                    id="bitsScrappartyOptionMenuitem"
+                    label="&markingcollection.tools.settings;..."
+                    class="menuitem-iconic"
+                    image="chrome://markingcollection/skin/icon_option.gif"
+                    insertafter="bitsExecMenu"
+                    oncommand="bitsMarkingCollection.openPrefWindow();"/>
+                <menu id="bitsOptionMenu" label="&markingcollection.menu.addon;&markingcollection.tools.settings;" class="menu-iconic" image="chrome://markingcollection/skin/extensions_16.png" accesskey="a" hidden="true"/>
+                <menuseparator />
+                <menu
+                    id="bitsFavoriteFolderMenu"
+                    type="menu"
+                    label="&markingcollection.favorite; "
+                    class="menu-iconic favoritefolder"
+                    oncommand="bitsFavoriteFolder.onClick(event);">
+                    <menupopup
+                        id="bitsFavoriteFolderPopupmenu"
+                        onpopupshowing="bitsFavoriteFolder.onPopupShowing(event,this);"
+                        onpopuphiding="bitsFavoriteFolder.onPopupHiding(event,this);">
+                        <menuitem id="bitsFavoriteFolderAllMenuitem" label="&markingcollection.defaultFolder;" class="menuitem-iconic" image="chrome://markingcollection/skin/folder.png"/>
+                        <menuseparator id="bitsFavoriteFolderAllMenuseparator"/>
+                    </menupopup>
+                </menu>
+                <menuseparator id="bitsFavoriteFolderMenuseparator"/>
+            </menupopup>
+        </menu>
+        <menu id="tools-menu">
+            <menupopup id="menu_ToolsPopup">
+                <!-- Wired-Marker icon not used for DASISH Web Annotator  -->
+                <!--
+            <menu
+                id="bitsExtensionsToolsMenu"
+                label="&markingcollection.app.title;"
+                accesskey="&markingcollection.key.menubar;"
+                class="menu-iconic"
+                image="chrome://markingcollection/skin/icon_16.gif"
+                insertafter="devToolsSeparator"
+                hidden="true"/> -->
+                <menu
+                    id="bitsExtensionsToolsMenu"
+                    label="&markingcollection.app.title;"
+                    accesskey="&markingcollection.key.menubar;"
+                    insertafter="devToolsSeparator"
+                    hidden="true"/>                
+            </menupopup>
+        </menu>
+    </menubar>
+    <menupopup id="contentAreaContextMenu">
+        <!-- Wired-Marker icon not used for DASISH Web Annotator  -->    
+        <!--
+<menuitem
+        id="MarkingCollectionContextMenuUncategorized"
+        label="&markingcollection.marker.uncategorized;..."
+        oncommand="bitsContextMenu.commandIndexContextMenu(event)"
+        class="menuitem-iconic"
+        image="chrome://markingcollection/skin/icon_16.gif"
+        insertbefore="context-bookmarklink"/>
+        -->
+        <menuitem
+            id="MarkingCollectionContextMenuUncategorized"
+            label="&markingcollection.marker.uncategorized;..."
+            oncommand="bitsContextMenu.commandIndexContextMenu(event)"
+            class="menuitem-iconic"
+            image="chrome://markingcollection/skin/annotator-skin/alphatransparent/dasish_16_16.png"
+            insertbefore="context-bookmarklink"/>
+        <menuseparator id="" observes="MarkingCollectionContextMenuUncategorized" insertbefore="context-bookmarklink" />
+        <!-- <menu id="MarkingCollectionContextMenu" class="menu-iconic" label="&markingcollection.app.title;" image="chrome://markingcollection/skin/icon_16.gif" insertbefore="context-bookmarklink"> -->
+        <menu id="MarkingCollectionContextMenu" class="menu-iconic" label="&markingcollection.app.title;" image="chrome://markingcollection/skin/annotator-skin/alphatransparent/dasish_16_16.png" insertbefore="context-bookmarklink">
+            <menupopup
+                id="MarkingCollectionContextMenupopup"
+                onpopupshowing="bitsContextMenu.popupshowingIndexContextMenu(event)"
+                onpopuphidden="bitsContextMenu.popuphiddenIndexContextMenu(event)"
+                oncommand="bitsContextMenu.commandIndexContextMenu(event)"
+                onclick="bitsContextMenu.clickIndexContextMenu(event)"
+            >
+                <menuitem id="MarkingCollectionContextMenuItemMarkerCopyToClipboard" label="&markingcollection.hyperanchor.copy_to_clipboard;" class="menuitem-iconic"  image="chrome://markingcollection/skin/marker_copy.png" />
+                <menuseparator id="MarkingCollectionContextMenuSeparatorMarkerCopyToClipboard" />
+                <menuitem id="MarkingCollectionContextMenuItemMarkerProperty" label="&markingcollection.property;" class="menuitem-iconic"  image="chrome://markingcollection/skin/menu_property.png" />
+                <menuseparator id="MarkingCollectionContextMenuSeparatorMarkerProperty" />
+                <menuitem id="MarkingCollectionContextMenuItemMarkerRemarker" label="&markingcollection.marker.remarker;" class="menuitem-iconic"  image="chrome://markingcollection/skin/remove_marker.png" />
+                <menuitem id="MarkingCollectionContextMenuItemMarkerRemove" label="&markingcollection.marker.remove;" class="menuitem-iconic"  image="chrome://markingcollection/skin/remove_marker.png" />
+                <menuitem id="MarkingCollectionContextMenuItemMarkerRemoveAll" label="&markingcollection.marker.remove.all;" class="menuitem-iconic"  image="chrome://markingcollection/skin/remove_marker.png" />
+                <menuseparator id="MarkingCollectionContextMenuSeparatorMarkerRemove" />
+            </menupopup>
+        </menu>
+        <menuseparator id="MarkingCollectionContextMenuSeparator" observes="MarkingCollectionContextMenu" insertbefore="context-bookmarklink" />
+    </menupopup>
+    <hbox id="browser">
+        <splitter id="bitsBrowserLeftSplitter" class="chromeclass-extrachrome" hidden="true"/>
+        <vbox id="appcontent">
+            <browser id="MarkingCollectionBrowser" collapsed="true" type="content"/>
+        </vbox>
+        <hbox id="ArticleNavigationConcordance" style="width:15px;" persist="width"  hidden="true">
+            <html:div id="ArticleNavigationConcordanceArea"  style="position:relative;left:0px;top:0px;border:1px solid #999999;background-color:#ffffff;overflow:hidden;" flex="1">
+                <html:div id="ArticleNavigationConcordanceBaseLine" style="position:absolute;left:0px;top:0px;width:100%;height:100%;background-color:#999999;overflow:hidden;"/>
+                <html:div id="ArticleNavigationConcordanceItemSection"  style="display:none;position:absolute;left:0px; top:1%;width:16px;height:1px;background-color:#000000;z-index:5;"/>
+                <html:div id="ArticleNavigationConcordanceItemSentence" style="display:none;position:absolute;left:7px; top:1%;width:4px;height:2px; background-color:#ffeeee;border:1px solid #ffbbbb;z-index:10;"/>
+                <html:div id="ArticleNavigationConcordanceItemMapping"  style="display:none;position:absolute;left:1px;top:10%;width:6px;height:2px; background-color:#ffff00;z-index:20;"/>
+                <html:div id="ArticleNavigationConcordanceDispPos"  style="display:none;position:absolute; background-color:#ffffff;z-index:500;opacity:0.5;"/>
+            </html:div>
+        </hbox>
+    </hbox>
+    <statusbar id="status-bar">
+        <statusbarpanel id="MarkingCollectionProgressPanel" insertbefore="statusbar-progresspanel" hidden="true">
+            <progressmeter id="MarkingCollectionProgressmeter" mode="normal" value="50"/>
+        </statusbarpanel>
+    </statusbar>
+    <popupset id="mainPopupSet">
+        <tooltip id="MarkingCollectionImageTooltip">
+            <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml" flex="0">
+                <html:canvas id="MarkingCollectionImageTooltipCanvas"/>
+            </window>
+        </tooltip>
+        <menupopup
+            id="bitsItemTreePopup"
+            onpopupshowing="bitsItemView.onPopupShowing(event);"
+            onpopuphiding="bitsItemView.onPopupHiding(event);"
+            oncommand="bitsItemView.onPopupCommand(event);">
+            <menuitem
+                id="bitsItemTreePopupOpen"
+                label="&markingcollection.open;"
+                default="true"/>
+            <menuitem
+                id="bitsItemTreePopupOpenNewTab"
+                label="&markingcollection.open.newtab;"/>
+            <menuseparator observes="bitsItemTreePopupOpen"/>
+            <menuitem
+                id="bitsItemTreePopupRemove"
+                class="menuitem-iconic"
+                label="&markingcollection.remove;"
+                image="chrome://markingcollection/skin/menu_remove.png"/>
+            <menuseparator observes="bitsItemTreePopupRemove"/>
+            <menuitem
+                id="bitsItemTreePopupProperty"
+                class="menuitem-iconic"
+                label="&markingcollection.property;"
+                image="chrome://markingcollection/skin/menu_property.png"/>
+        </menupopup>
+        <menupopup
+            id="bitsFavoriteFolderContextmenu"
+            onpopupshowing="bitsFavoriteFolder.onPopupFShowing(event);">
+            <menuitem
+                class="menuitem-iconic"
+                label="&markingcollection.remove;"
+                image="chrome://markingcollection/skin/menu_remove.png"
+                oncommand="bitsFavoriteFolder.removeFavoriteFolder(event);"/>
+            <menuseparator hidden="true"/>
+            <menuitem
+                class="menuitem-iconic"
+                label="&markingcollection.property;"
+                image="chrome://markingcollection/skin/menu_property.png"
+                disabled="true" hidden="true"/>
+        </menupopup>
+        <menupopup
+            id="bitsMenuTreeFolderContextmenu"
+            onpopupshowing="bitsMenuTree.onPopupFShowing(event);"
+            oncommand="bitsMenuTree.onPopupCommand(event);">
+            <menuitem
+                id="bitsFavoriteFolderAddMenuitem"
+                label="&markingcollection.favorite.add;"
+                class="menuitem-iconic bookmark-item"
+                image="chrome://markingcollection/skin/menu_create.png"/>
+            <menuseparator observes="bitsMenuTreeFolderRemoveMenuitem"/>
+            <menuitem
+                id="bitsMenuTreeFolderRemoveMenuitem"
+                class="menuitem-iconic"
+                label="&markingcollection.remove;"
+                image="chrome://markingcollection/skin/menu_remove.png"/>
+            <menuseparator/>
+            <menuitem
+                id="bitsMenuTreeFolderPropertyMenuitem"
+                class="menuitem-iconic"
+                label="&markingcollection.property;"
+                image="chrome://markingcollection/skin/menu_property.png"
+                disabled="true"/>
+        </menupopup>
+        <menupopup
+            id="bitsMenuTreeObjectContextmenu"
+            onpopupshowing="bitsMenuTree.onPopupFShowing(event);"
+            oncommand="bitsMenuTree.onPopupCommand(event);">
+            <menuitem
+                id="bitsMenuTreeObjectOpenMenuitem"
+                label="&markingcollection.open;"
+                default="true"/>
+            <menuitem
+                id="bitsMenuTreeObjectOpenNewTabMenuitem"
+                label="&markingcollection.open.newtab;"/>
+            <!--
+                                    <menuseparator id="bitsMenuTreeObjectHyperAnchorCopyToClipboardMenuseparator" observes="bitsMenuTreeObjectHyperAnchorCopyToClipboard"/>
+                                    <menu
+                                            id="bitsMenuTreeObjectHyperAnchorCopyToClipboard"
+                                            label="&markingcollection.hyperanchor.sidebar_copy_to_clipboard;"
+                                            class="menu-iconic"
+                                            image="chrome://markingcollection/skin/marker_copy.png">
+                                            <menupopup>
+                                                    <menuitem
+                                                            label="&meta.menuitem.hyperanchor.copy_to_clipboard;"
+                                                            class="menuitem-iconic"
+                                                            image="chrome://markingcollection/skin/marker_copy.png"
+                                                            oncommand="mcController.copy('copy');"/>
+                                                    <menuitem
+                                                            label="&meta.menuitem.hyperanchor.copytitle_to_clipboard;"
+                                                            class="menuitem-iconic"
+                                                            image="chrome://markingcollection/skin/marker_copytext.png"
+                                                            oncommand="mcController.copy('title');"/>
+                                                    <menuitem
+                                                            label="&meta.menuitem.hyperanchor.copynote_to_clipboard;"
+                                                            class="menuitem-iconic"
+                                                            image="chrome://markingcollection/skin/marker_copytext.png"
+                                                            oncommand="mcController.copy('note');"/>
+                                                    <menuitem
+                                                            label="&meta.menuitem.hyperanchor.copymeta_to_clipboard;"
+                                                            class="menuitem-iconic"
+                                                            image="chrome://markingcollection/skin/marker_copytext.png"
+                                                            oncommand="mcController.copy('pagetitle');"/>
+                                            </menupopup>
+                                    </menu>
+                                    <menuitem
+                                            id="bitsMenuTreeObjectHyperAnchorCopyFormatToClipboard"
+                                            label="&meta.menuitem.hyperanchor.copyformat_to_clipboard;"
+                                            class="menuitem-iconic"
+                                            image="chrome://markingcollection/skin/marker_copy.png"
+                                            oncommand="mcController.copy('format');" />
+                                    <menuitem
+                                            id="bitsMenuTreeObjectHyperAnchorCopyFormatSetting"
+                                            label="&meta.menuitem.hyperanchor.copyformatsetting;..."
+                                            class="menuitem-iconic"
+                                            image="chrome://markingcollection/skin/marker_copy.png"
+                                            oncommand="mcController.copy('setting');"/>
+                                    <menuseparator
+                                            id="bitsMenuTreeObjectTagOutputMenuseparator"
+                                            observes="bitsMenuTreeObjectTagOutput"/>
+                                    <menuitem
+                                            id="bitsMenuTreeObjectTagOutput"
+                                            class="menuitem-iconic"
+                                            label="&markingcollection.tagoutput.menu.title;..."
+                                            image="chrome://markingcollection/skin/tag_save.png"
+                                            oncommand="window.top.bitsTagOutputService.onTagOutputRdfCommand({event:event});"/>
+            -->
+            <menuseparator observes="bitsItemTreePopupOpen"/>
+            <menuitem
+                id="bitsMenuTreeObjectRemoveMenuitem"
+                class="menuitem-iconic"
+                label="&markingcollection.remove;"
+                image="chrome://markingcollection/skin/menu_remove.png"/>
+            <menuseparator observes="bitsItemTreePopupRemove"/>
+            <menuitem
+                id="bitsMenuTreeObjectPropertyMenuitem"
+                class="menuitem-iconic"
+                label="&markingcollection.property;"
+                image="chrome://markingcollection/skin/menu_property.png"
+                disabled="true"/>
+        </menupopup>
+    </popupset>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/progress.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/progress.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/progress.xul	(revision 5703)
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<window
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	hidechrome="true"
+	onload="onLoad();"
+	onblur="onBlur();"
+>
+<script><![CDATA[
+  var gStatus,gStatus2, gProgressMeter, gBlur;
+  var maxProgress = 100;
+  function onLoad() {
+    gBlur = false;
+    setWindowSize();
+    gStatus = document.getElementById("status");
+    gProgressMeter = document.getElementById("progressmeter");
+
+    if("arguments" in window && window.arguments.length > 0) {
+      setStatus(window.arguments[0].status);
+    }
+    setWindowSize();
+  }
+
+  function onBlur() {
+    if(!gBlur){
+      window.focus();
+      setWindowSize();
+    }
+  }
+
+  function setProgress(value) {
+    if(!gProgressMeter) return;
+    gProgressMeter.value = 100 * value / maxProgress;
+  }
+
+  function setStatus(text) {
+    if(!gStatus) return;
+    gStatus.value = "Status: " + text;
+    setWindowSize();
+  }
+
+  function setWindowSize(){
+    try{ window.sizeToContent(); }catch(e){}
+    if(gBlur){
+      var x = screen.width - window.outerWidth;
+      var y = screen.height - window.outerHeight;
+      window.moveTo(x,y);
+    }else{
+      if(window.opener){
+        var x = (window.opener.screenX + (window.opener.outerWidth/2)) - (window.outerWidth/2);
+        var y = (window.opener.screenY + (window.opener.outerHeight/2)) - (window.outerHeight/2);
+        window.moveTo(x,y);
+      }
+    }
+  }
+
+]]></script>
+<vbox style="border: 2px solid #c3d1df">
+	<hbox flex="1">
+		<label id="status" value="(No status)"/>
+	</hbox>
+	<hbox flex="1" id="hbox">
+	  <progressmeter id="progressmeter" mode="undetermined" flex="1"/>
+	</hbox>
+</vbox>
+</window>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/progress_determined.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/progress_determined.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/progress_determined.xul	(revision 5703)
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<window
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	hidechrome="true"
+	onload="onLoad();"
+	onblur="onBlur();"
+>
+<script><![CDATA[
+  var gStatus,gStatus2, gProgressMeter, gBlur, gCallback;
+  var maxProgress = 100;
+  function onLoad() {
+    gBlur = false;
+    setWindowSize();
+    gStatus = document.getElementById("status");
+    gProgressMeter = document.getElementById("progressmeter");
+
+    if("arguments" in window && window.arguments.length > 0) {
+      if(window.arguments[0].status) setStatus(window.arguments[0].status);
+      if(window.arguments[0].progress != undefined) setProgress(window.arguments[0].progress);
+      if(window.arguments[0].callback) gCallback = window.arguments[0].callback;
+      if(!gCallback) document.getElementById("cancel").setAttribute("hidden","true");
+    }
+    setWindowSize();
+  }
+
+  function onBlur() {
+    if(!gBlur){
+      window.focus();
+      setWindowSize();
+    }
+  }
+
+  function setProgress(value) {
+    if(!gProgressMeter) return;
+    gProgressMeter.value = value;
+  }
+
+  function setStatus(text) {
+    if(!gStatus) return;
+    gStatus.value = "Status: " + text;
+    setWindowSize();
+  }
+
+  function setCallback(aCallback) {
+    if(!aCallback) return;
+    gCallback = aCallback;
+    var elem = document.getElementById("cancel");
+    if(gCallback)
+      elem.removeAttribute("hidden");
+    else
+      elem.setAttribute("hidden","true");
+    setWindowSize();
+  }
+
+  function commandCallback(aEvent) {
+    document.getElementById("cancel").setAttribute("disabled","true");
+    if(gCallback) setTimeout(function(){ gCallback(aEvent); },0);
+  }
+
+  function setWindowSize(){
+    window.sizeToContent();
+    if(gBlur){
+      var x = screen.width - window.outerWidth;
+      var y = screen.height - window.outerHeight;
+      window.moveTo(x,y);
+    }else{
+      if(window.opener){
+        var x = (window.opener.screenX + (window.opener.outerWidth/2)) - (window.outerWidth/2);
+        var y = (window.opener.screenY + (window.opener.outerHeight/2)) - (window.outerHeight/2);
+        window.moveTo(x,y);
+      }
+    }
+  }
+
+]]></script>
+
+<vbox style="border: 2px solid #c3d1df">
+	<hbox flex="1">
+		<label id="status" value="(No status)"/>
+	</hbox>
+	<hbox flex="1" id="hbox">
+	  <progressmeter id="progressmeter" mode="determined" flex="1"/>
+	</hbox>
+	<hbox flex="1" pack="center">
+		<button id="cancel" label="cancel" oncommand="commandCallback(event);"/>
+	</hbox>
+</vbox>
+</window>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/property.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/property.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/property.js	(revision 5703)
@@ -0,0 +1,815 @@
+var mcPropService = {
+
+	get STRING()     { return document.getElementById("mcPropString"); },
+	get ICON()       { return document.getElementById("mcPropIcon"); },
+	get TITLE()      { return document.getElementById("mcPropTitle"); },
+	get NOTE()       { return document.getElementById("mcPropNote"); },
+	get TAG()        { return document.getElementById("mcPropTagTextbox"); },
+	get DB_PATH()    { return document.getElementById("mcPropDBPath"); },
+	get DB_DATE()    { return document.getElementById("mcPropDBDate"); },
+	get DB_SIZE()    { return document.getElementById("mcPropDBSize"); },
+	get ICON_SIZE()  { return document.getElementById("mcPropIconsize"); },
+	get ICON_SIZE_S(){ return document.getElementById("mcPropIconsizeSmall"); },
+	get ICON_SIZE_L(){ return document.getElementById("mcPropIconsizeLarge"); },
+	get ICON_SIZE_I(){ return document.getElementById("mcPropIconsizeImage"); },
+
+	get TITLE_HBOX() { return document.getElementById("mcPropTitleHBox"); },
+
+	get TABBOX()     { return document.getElementById("mcPropTabbox"); },
+
+	get GENERAL_TAB() { return document.getElementById("mcPropGeneralTab"); },
+	get NOTE_TAB()    { return document.getElementById("mcPropNoteTab"); },
+
+	get EXTENDED_MESSAGE_TAB() { return document.getElementById("mcPropExtendedMessageTab"); },
+	get LOGICAL_PAGE()         { return document.getElementById("mcPropExtendedMessageLogicalPageTextbox"); },
+	get PHYSICAL_PAGE()        { return document.getElementById("mcPropExtendedMessagePhysicalPageTextbox"); },
+
+	get URL_TAB()    { return document.getElementById("mcPropURLTab"); },
+	get URL_PANEL()  { return document.getElementById("mcPropURLTabpanel"); },
+	get URL()        { return document.getElementById("mcPropURLTextbox"); },
+
+	get METACAPTURE_TAB()   { return document.getElementById("mcPropMetaCaptureTab"); },
+	get METACAPTURE_PANEL() { return document.getElementById("mcPropMetaCaptureTabpanel"); },
+	get METACAPTURE()       { return document.getElementById("mcPropMetaCaptureTextbox"); },
+
+	get MEDLINE_TAB()   { return document.getElementById("mcPropMedlineTab"); },
+	get MEDLINE_PMCID() { return document.getElementById("mcPropMedlinePMCIDTextbox"); },
+	get MEDLINE_PMID()  { return document.getElementById("mcPropMedlinePMIDTextbox"); },
+	get MEDLINE_SO()    { return document.getElementById("mcPropMedlineSOTextbox"); },
+
+	get SC_DISABLED(){ return document.getElementById("mcPropShortcutDisabled"); },
+	get SC_SHIFT()   { return document.getElementById("mcPropShortcutShift"); },
+	get SC_ALT()     { return document.getElementById("mcPropShortcutAlt"); },
+	get SC_ACCEL()   { return document.getElementById("mcPropShortcutAccel"); },
+	get SC_KEY()     { return document.getElementById("mcPropShortcutKey"); },
+	get SC_MOD()     { return document.getElementById("mcPropShortcutModifiers"); },
+
+	get DataSource() { return window.opener.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.opener.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.opener.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.opener.top.bitsObjectMng.Database;   },
+	get XML()        { return window.opener.top.bitsObjectMng.XML;        },
+	get gBrowser()   { return window.opener.top.bitsObjectMng.getBrowser();},
+	get mcItemView() { return window.opener.mcItemView;},
+
+	id       : null,
+	item     : null,
+	resource : null,
+	property : "",
+	_xmldoc : null,
+
+	get xmldoc(){ return this._xmldoc; },
+
+	init : function(){
+		try {
+			if(window.arguments[1] && window.arguments[1].id){
+				this.id = window.arguments[1].id;
+			}else{
+				this.id = window.arguments[0];
+			}
+		}catch(ex){
+			document.location.href.match(/\?id\=(.*)$/);
+			this.id = RegExp.$1;
+		}
+		if(!this.id) return;
+		this.item = this.Common.newItem();
+		this.resource = this.Common.RDF.GetResource(this.DataSource.ABOUT_ITEM + this.id);
+		var prop;
+		var value;
+		for(prop in this.item){
+			value = undefined;
+			if(window.arguments[1] && window.arguments[1][prop]){
+				value = window.arguments[1][prop];
+			}else{
+				value = this.DataSource.getProperty(this.resource, prop);
+			}
+			if(value == undefined) continue;
+			this.item[prop] = value;
+		}
+		if(this.item["editmode"] == undefined) this.item["editmode"] = this.DataSource.getProperty(this.resource, "editmode");
+		this.TITLE.value = this.item.title;
+		this.TITLE.defaultValue = this.item.title;
+		try{this.TITLE.editor.transactionManager.clear();}catch(ex2){}
+		this._extended_message = null;
+		if(this.item.dbtype){
+			this.dbtype = this.item.dbtype;
+		}else{
+			this.dbtype = this.DataSource.getProperty(this.resource, "dbtype");
+		}
+		this.GENERAL_TAB.setAttribute("hidden","true");
+		this.NOTE_TAB.setAttribute("hidden","true");
+		this.URL_TAB.setAttribute("hidden","true");
+		this.METACAPTURE_TAB.setAttribute("hidden","true");
+		this.MEDLINE_TAB.setAttribute("hidden","true");
+		this.EXTENDED_MESSAGE_TAB.setAttribute("hidden","true");
+		if(this.item.property){
+			this.property = this.item.property;
+		}else{
+			this.property = "";
+			if(this.DataSource.isContainer(this.resource)){
+				var rValue = this.Database.getFolderFormID(this.item.id,this.dbtype);
+				if(rValue) this.property = rValue[0].fid_property;
+			}else{
+				var rValue = this.Database.getObjectFormID(this.item.id,this.dbtype);
+				if(rValue){
+					this.property = rValue[0].oid_property;
+					this.URL.value = rValue[0].con_url;
+					this.METACAPTURE.value = rValue[0].doc_title;
+					this._extended_message = (rValue[0].oid_type == "application/pdf" ? true : null);
+					this.URL_TAB.removeAttribute("hidden");
+					this.METACAPTURE_TAB.removeAttribute("hidden");
+				}
+			}
+		}
+		var parser = new DOMParser();
+		var xmldoc;
+		if(this.property != "") xmldoc = parser.parseFromString(this.property, "text/xml");
+		parser = undefined;
+		var note_elem;
+		var iconsize_elem;
+		var propertyOverlay_elem;
+		var tag_elem;
+		var url_elem;
+		var metacapture_elem;
+		var logical_elem;
+		var physical_elem;
+		var medline_pmcid_elem;
+		var medline_pmid_elem;
+		var medline_so_elem;
+		if(xmldoc){
+			note_elem = xmldoc.getElementsByTagName("NOTE")[0];
+			iconsize_elem = xmldoc.getElementsByTagName("ICON_SIZE")[0];
+			propertyOverlay_elem = xmldoc.getElementsByTagName("PROPERTYOVERLAY")[0];
+			tag_elem = xmldoc.getElementsByTagName("TAG")[0];
+			url_elem = xmldoc.getElementsByTagName("HYPER_ANCHOR")[0];
+			logical_elem = xmldoc.getElementsByTagName("LOGICAL_PAGE")[0];
+			physical_elem = xmldoc.getElementsByTagName("PHYSICAL_PAGE")[0];
+			metacapture_elem = xmldoc.getElementsByTagName("METACAPTURE")[0];
+
+			medline_pmcid_elem = xmldoc.getElementsByTagName("PMCID")[0];
+			medline_pmid_elem = xmldoc.getElementsByTagName("PMID")[0];
+			medline_so_elem = xmldoc.getElementsByTagName("SO")[0];
+		}
+		if(url_elem){
+			this.URL.value = url_elem.textContent;
+		}
+		if(metacapture_elem){
+			this.METACAPTURE.value = metacapture_elem.getAttribute("content");
+		}
+		if(this._extended_message){
+			this.EXTENDED_MESSAGE_TAB.removeAttribute("hidden");
+			if(logical_elem){
+				this.LOGICAL_PAGE.value = logical_elem.textContent;
+				this.item.logical = logical_elem.textContent;
+			}
+			if(physical_elem){
+				this.PHYSICAL_PAGE.value = physical_elem.textContent;
+				this.item.physical = physical_elem.textContent;
+			}
+		}
+		if(medline_pmcid_elem || medline_pmid_elem || medline_so_elem){
+			this.MEDLINE_TAB.removeAttribute("hidden");
+			this.MEDLINE_PMCID.value = medline_pmcid_elem.textContent;
+			this.MEDLINE_PMID.value = medline_pmid_elem.textContent;
+			this.MEDLINE_SO.value = medline_so_elem.textContent;
+		}
+		this.item.note = "";
+		if(note_elem){
+			this.item.note = note_elem.textContent;
+		}else if(this.property != ""){
+			this.property = this.property.replace(/[\r\n\t]/mg," __BR__ ");
+			if(this.property.match(/^.*<NOTE>(.*?)<\/NOTE>.*$/m)){
+				this.item.note = RegExp.$1;
+			}else if(this.property.match(/^<PROPERTY>.*<\/PROPERTY>.*$/m)){
+				this.item.note = "";
+			}else{
+				this.item.note = this.property;
+			}
+			this.item.note = this.item.note.replace(/&/mg,"&amp;").replace(/</mg,"&lt;").replace(/>/mg,"&gt;").replace(/\"/mg,"&quot;");
+			this.property = this.property.replace(/ __BR__ /mg,"\n");
+			this.item.note = this.item.note.replace(/ __BR__ /mg,"\n");
+		}
+		this.item.iconsize = "small";
+		if(iconsize_elem){
+			this.item.iconsize = iconsize_elem.textContent;
+		}else if(this.property != ""){
+			var property = this.property.replace(/[\r\n\t]/mg," __BR__ ");
+			if(property.match(/^.*<ICON_SIZE>(.*?)<\/ICON_SIZE>.*$/m)){
+				this.item.iconsize = RegExp.$1;
+			}
+			this.item.iconsize = this.item.iconsize.replace(/ __BR__ /mg,"\n");
+		}
+		var info = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
+		if(parseInt(info.version)>2 && this.mcItemView.isChecked){
+			if(this.item.iconsize == "small"){
+				this.ICON_SIZE_S.setAttribute("selected",true);
+				this.ICON_SIZE_L.removeAttribute("selected");
+			}else{
+				this.ICON_SIZE_L.setAttribute("selected",true);
+				this.ICON_SIZE_S.removeAttribute("selected");
+			}
+			this.ICON_SIZE_I.setAttribute("iconsize",this.item.iconsize);
+		}else{
+			this.ICON_SIZE_L.setAttribute("disabled","true");
+			this.ICON_SIZE_S.setAttribute("disabled","true");
+		}
+		this.NOTE.value = this.item.note;
+		try{this.NOTE.editor.transactionManager.clear();}catch(ex2){}
+		if(tag_elem) this.item.tag = tag_elem.textContent;
+		if(this.item.tag != undefined) this.TAG.value = this.item.tag;
+		try{this.TAG.editor.transactionManager.clear();}catch(ex2){}
+		document.getElementById("mcPropSample").setAttribute("style",this.item.style);
+		if(this.item.editmode && (parseInt(this.item.editmode) & 0xFFFF)){
+			if((parseInt(this.item.editmode) & 0x0001)){
+				document.getElementById("mcPropMarkerCustomButton").setAttribute("disabled",true);
+			}
+			if((parseInt(this.item.editmode) & 0x0002)){
+				document.getElementById("mcPropMarkerGroup").setAttribute("hidden",true);
+				document.getElementById("mcPropTagGroup").setAttribute("hidden",true);
+				document.getElementById("mcPropShortcutGroup").setAttribute("hidden",true);
+			}
+			if((parseInt(this.item.editmode) & 0x0004)){
+				document.getElementById("mcPropTagGroup").setAttribute("hidden",true);
+				document.getElementById("mcPropShortcutGroup").setAttribute("hidden",true);
+			}
+			if(!(parseInt(this.item.editmode) & 0x00F0)){
+				this.TITLE.removeAttribute("readonly");
+				this.TITLE.removeAttribute("style");
+				this.TAG.removeAttribute("readonly");
+				this.TAG.removeAttribute("style");
+			}
+			if(!(parseInt(this.item.editmode) & 0x0F00)){
+				this.NOTE.removeAttribute("readonly");
+				this.NOTE.removeAttribute("style");
+			}
+		}else if(!this.DataSource.isContainer(this.resource)){
+			document.getElementById("mcPropMarkerGroup").setAttribute("hidden",true);
+			document.getElementById("mcPropTagGroup").setAttribute("hidden",true);
+			document.getElementById("mcPropShortcutGroup").setAttribute("hidden",true);
+			document.getElementById("mcPropIconsizeGroup").setAttribute("hidden",true);
+			this.TITLE.removeAttribute("readonly");
+			this.TITLE.removeAttribute("style");
+			this.TAG.removeAttribute("readonly");
+			this.TAG.removeAttribute("style");
+			this.NOTE.removeAttribute("readonly");
+			this.NOTE.removeAttribute("style");
+		}else{
+			this.TITLE.removeAttribute("readonly");
+			this.TITLE.removeAttribute("style");
+			this.TAG.removeAttribute("readonly");
+			this.TAG.removeAttribute("style");
+			this.NOTE.removeAttribute("readonly");
+			this.NOTE.removeAttribute("style");
+		}
+		document.getElementById("mcPropDatabaseGroup").setAttribute("hidden",true);
+		if(parseInt(this.item.editmode) & 0x1000){
+			var aDBFile = this.Database.getDatabaseFile(this.dbtype);
+			if(aDBFile){
+				var aFile = this.Common.convertPathToFile(aDBFile.path);
+				this.DB_PATH.value = aFile.path;
+				this.DB_DATE.value = (new Date(aFile.lastModifiedTime)).toLocaleString();
+				this.DB_SIZE.value = this.formatFileSize(aFile.fileSize);
+				document.getElementById("mcPropDatabaseGroup").removeAttribute("hidden");
+			}
+		}
+		if(!document.getElementById("mcPropShortcutGroup").hasAttribute("hidden")){
+			var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
+			this._opener = wm.getMostRecentWindow("navigator:browser");
+			var osString = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS;
+			if(osString == "Darwin"){
+				this.SC_ALT.setAttribute('label','Option');
+				this.SC_ACCEL.setAttribute('label','Command');
+			}
+			if(!this.id || !this.dbtype || !this._opener){
+				this.SC_DISABLED.setAttribute("disabled","true");
+				this.SC_SHIFT.setAttribute("disabled","true");
+				this.SC_ALT.setAttribute("disabled","true");
+				this.SC_ACCEL.setAttribute("disabled","true");
+				this.SC_KEY.setAttribute("disabled","true");
+			}else{
+				var bitsShortcutService = this._opener.top.bitsShortcutService;
+				if(bitsShortcutService){
+					var sc = bitsShortcutService.getShortcut(this.id,this.dbtype);
+					if(!sc || sc.disabled){
+						this.SC_DISABLED.checked = false;
+					}else{
+						this.SC_DISABLED.checked = true;
+					}
+					if(!this.SC_DISABLED.checked){
+						this.SC_SHIFT.setAttribute("disabled","true");
+						this.SC_ALT.setAttribute("disabled","true");
+						this.SC_ACCEL.setAttribute("disabled","true");
+						this.SC_KEY.setAttribute("disabled","true");
+					}
+					if(sc){
+						this.SC_SHIFT.checked = sc.shift;
+						this.SC_ALT.checked = sc.alt;
+						this.SC_ACCEL.checked = sc.accel;
+						if(sc.key){
+							this.SC_KEY.value = sc.key;
+							var acceltext = [];
+							if(sc.accel){
+								if(osString == "Darwin"){
+									acceltext.push('Command');
+								}else{
+									acceltext.push('Ctrl');
+								}
+							}
+							if(sc.shift) acceltext.push('Shift');
+							if(sc.alt){
+								if(osString == "Darwin"){
+									acceltext.push('Option');
+								}else{
+									acceltext.push('Alt');
+								}
+							}
+							this.SC_MOD.value = acceltext.join("+")+" +";
+						}
+					}
+				}
+			}
+			try{this.SC_KEY.editor.transactionManager.clear();}catch(ex2){}
+		}
+		if(propertyOverlay_elem){
+			document.loadOverlay(propertyOverlay_elem.textContent, null);
+			setTimeout(function(){
+				window.sizeToContent();
+				setTimeout(function(){ window.sizeToContent(); },500);
+			},100);
+		}
+		this.NOTE_TAB.removeAttribute("hidden");
+		this.GENERAL_TAB.removeAttribute("hidden");
+		document.title = this.item.title;
+		return;
+	},
+
+	_createXMLDoc : function(aContent){
+		var parser = new DOMParser();
+		this._xmldoc = parser.parseFromString(aContent, "text/xml");
+		parser = undefined;
+	},
+
+	_xmlSerializer : function(){
+		var s = new XMLSerializer();
+		var aContent = s.serializeToString(this.xmldoc);
+		s = undefined;
+		return aContent;
+	},
+
+	accept : function(){
+		var newVals = {
+			title    : this.TITLE.value,
+			tag      : this.TAG.value,
+			style    : document.getElementById("mcPropSample").style.cssText,
+			note     : this.Common.escapeComment(this.NOTE.value),
+			iconsize : (this.ICON_SIZE.disabled?"small":this.ICON_SIZE.value),
+		};
+		if(this._extended_message){
+			newVals["logical"] = this.LOGICAL_PAGE.value;
+			newVals["logical"] = newVals["logical"].replace(/\t/mg,"        ");
+			newVals["logical"] = this.Common.exceptCode(newVals["logical"]);
+			newVals["logical"] = newVals["logical"].replace(/\x0D\x0A|\x0D|\x0A/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+
+			newVals["physical"] = this.PHYSICAL_PAGE.value;
+			newVals["physical"] = newVals["physical"].replace(/\t/mg,"        ");
+			newVals["physical"] = this.Common.exceptCode(newVals["physical"]);
+			newVals["physical"] = newVals["physical"].replace(/\x0D\x0A|\x0D|\x0A/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+		}
+
+		var changed = this.DataSource.isContainer(this.resource);
+		if(!this.DataSource.isContainer(this.resource) && newVals.style) delete newVals.style;
+
+		newVals["title"] = newVals["title"].replace(/\t/mg,"        ");
+		newVals["title"] = this.Common.exceptCode(newVals["title"]);
+		newVals["title"] = newVals["title"].replace(/\x0D\x0A|\x0D|\x0A/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+		if(newVals["title"] == ""){
+			this.TITLE.value = this.TITLE.defaultValue;
+			this.TABBOX.selectedTab = this.GENERAL_TAB;
+			var self = this;
+			setTimeout(function(){ self.TITLE.focus(); },0);
+			return false;
+		}
+		if(this.DataSource.isContainer(this.resource)){
+			var parRes = this.DataSource.findParentResource(this.resource);
+			if(!parRes) return;
+			var i;
+			var listTitle = "";
+			var listRes = this.DataSource.flattenResources(parRes,1,false);
+			for(i=0;i<listRes.length;i++){
+				if(listRes[i].Value == this.resource.Value) continue;
+				listTitle = this.DataSource.getProperty(listRes[i],"title");
+				listTitle = listTitle.replace(/^\s*/img,"").replace(/\s*$/img,"");
+				if(listTitle == newVals["title"]) break;
+				listTitle = "";
+			}
+			if(listTitle == newVals["title"]){
+				this.TITLE.value = this.TITLE.defaultValue;
+				var self = this;
+				setTimeout(function(){ self.TITLE.focus(); },0);
+				return false;
+			}
+		}
+
+		newVals["tag"] = newVals["tag"].replace(/\t/mg,"        ");
+		newVals["tag"] = this.Common.exceptCode(newVals["tag"]);
+		newVals["tag"] = newVals["tag"].replace(/\x0D\x0A|\x0D|\x0A/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+
+		newVals["note"] = newVals["note"].replace(/\t/mg,"        ");
+		newVals["note"] = newVals["note"].replace(/\x0D\x0A|\x0D|\x0A/g," __BR__ ");
+		newVals["note"] = this.Common.exceptCode(newVals["note"]);
+		newVals["note"] = newVals["note"].replace(/[\r\n]/mg, " ").replace(/ __BR__ /mg,"\n");
+
+		var props;
+		for(props in newVals){
+			if(this.item[props] == newVals[props]) continue;
+			this.item[props] = newVals[props];
+			changed = true;
+		}
+
+		if(!this.DataSource.isContainer(this.resource) && this.item.style) delete this.item.style;
+
+		if(changed){
+			if(this.item.title) this.item.title = this.item.title.replace(/[\r\n]/mg, " ");
+			//ææ°ã®æ
+å ±ãååŸ
+			var dbitem = {};
+			if(this.item.id){
+				if(this.item.tag || this.item.note || this.item.iconsize || this.item.logical || this.item.physical){
+					if(this.property == "") this.property = "<PROPERTY/>";
+					this._createXMLDoc(this.property);
+					if(this.xmldoc){
+						if(this.item.tag != undefined){
+							var tag = this.xmldoc.getElementsByTagName("TAG")[0];
+							if(this.item.tag != "" && !tag){
+								tag = this.xmldoc.createElement("TAG");
+								this.xmldoc.documentElement.appendChild(tag);
+							}else if(this.item.tag == "" && tag){
+								tag.parentNode.removeChild(tag);
+								tag = undefined;
+							}
+							if(tag){
+								while(tag.hasChildNodes()){ tag.removeChild(tag.lastChild); }
+								tag.appendChild(this.xmldoc.createTextNode(this.item.tag));
+							}
+						}
+						if(this.item.note != undefined){
+							var note = this.xmldoc.getElementsByTagName("NOTE")[0];
+							if(this.item.note != "" && !note){
+								note = this.xmldoc.createElement("NOTE");
+								this.xmldoc.documentElement.appendChild(note);
+							}else if(this.item.note == "" && note){
+								note.parentNode.removeChild(note);
+								note = undefined;
+							}
+							if(note){
+								while(note.hasChildNodes()){ note.removeChild(note.lastChild); }
+								note.appendChild(this.xmldoc.createTextNode(this.item.note));
+							}
+						}
+						if(this.item.iconsize && this.DataSource.isContainer(this.resource)){
+							var iconsize = this.xmldoc.getElementsByTagName("ICON_SIZE")[0];
+							if(!iconsize){
+								iconsize = this.xmldoc.createElement("ICON_SIZE");
+								this.xmldoc.documentElement.appendChild(iconsize);
+							}
+							while(iconsize.hasChildNodes()){ iconsize.removeChild(iconsize.lastChild); }
+							iconsize.appendChild(this.xmldoc.createTextNode(this.item.iconsize));
+						}
+						if(this.item.logical != undefined){
+							var logical = this.xmldoc.getElementsByTagName("LOGICAL_PAGE")[0];
+							if(this.item.logical != "" && !logical){
+								logical = this.xmldoc.createElement("LOGICAL_PAGE");
+								var extras_msg = this.xmldoc.getElementsByTagName("EXTENDED_MESSAGE")[0];
+								if(!extras_msg){
+									extras_msg = this.xmldoc.createElement("EXTENDED_MESSAGE");
+									this.xmldoc.documentElement.appendChild(extras_msg);
+								}
+								extras_msg.appendChild(logical);
+							}else if(this.item.logical == "" && logical){
+								logical.parentNode.removeChild(logical);
+								logical = undefined;
+							}
+							if(logical){
+								while(logical.hasChildNodes()){ logical.removeChild(logical.lastChild); }
+								logical.appendChild(this.xmldoc.createTextNode(this.item.logical));
+							}
+						}
+						if(this.item.physical != undefined){
+							var physical = this.xmldoc.getElementsByTagName("PHYSICAL_PAGE")[0];
+							if(this.item.physical != "" && !physical){
+								physical = this.xmldoc.createElement("PHYSICAL_PAGE");
+								var extras_msg = this.xmldoc.getElementsByTagName("EXTENDED_MESSAGE")[0];
+								if(!extras_msg){
+									extras_msg = this.xmldoc.createElement("EXTENDED_MESSAGE");
+									this.xmldoc.documentElement.appendChild(extras_msg);
+								}
+								extras_msg.appendChild(physical);
+							}else if(this.item.physical == "" && physical){
+								physical.parentNode.removeChild(physical);
+								physical = undefined;
+							}
+							if(physical){
+								while(physical.hasChildNodes()){ physical.removeChild(physical.lastChild); }
+								physical.appendChild(this.xmldoc.createTextNode(this.item.physical));
+							}
+						}
+						this.property = this._xmlSerializer();
+					}
+				}
+				if(this.DataSource.isContainer(this.resource)){
+					dbitem.fid = this.id;
+					if(this.item.title != undefined) dbitem.fid_title = this.item.title;
+					if(this.item.note != undefined)  dbitem.fid_property = this.property;
+					if(this.item.style != undefined) dbitem.fid_style = this.item.style;
+					if(this.item.note != undefined || this.item.iconsize != undefined) dbitem.fid_property = this.property;
+					changed = this.Database.updateFolder(dbitem,this.dbtype);
+				}else{
+					dbitem.oid = this.id;
+					if(this.item.title != undefined)   dbitem.oid_title = this.item.title;
+					if(this.item.note != undefined) dbitem.oid_property = this.property;
+					changed = this.Database.updateObject(dbitem,this.dbtype);
+				}
+			}
+		}
+		if(changed){
+			for(props in this.item){
+				if(props == "tag") continue;
+				if(props == "note") continue;
+				if(props == "index") continue;
+				if(props == "addon_id") continue;
+				if(props == "iconsize") continue;
+				this.DataSource.setProperty(this.resource, props, this.item[props]);
+			}
+			if(this.DataSource.isContainer(this.resource)) this.DataSource.setProperty(this.resource,"cssrule",'css_'+this.dbtype+'_'+this.id);
+			try{
+				var update_id = this.DataSource.getProperty(this.resource,"id");
+				var listRes2 = this.DataSource.flattenResources(this.Common.RDF.GetResource(this.DataSource.ABOUT_ROOT),2,true);
+				for(var j=0;j<listRes2.length;j++){
+					var id = this.DataSource.getProperty(listRes2[j],"id");
+					if(id != update_id) continue;
+					this.DataSource.setProperty(listRes2[j],"title",this.item.title);
+				}
+			}catch(e){}
+			this.DataSource.flush();
+		}
+		if(window.arguments[1]) window.arguments[1].accept = changed;
+
+		if(!document.getElementById("mcPropShortcutGroup").hasAttribute("hidden") && this.id && this.dbtype && this._opener){
+			var bitsShortcutService = this._opener.top.bitsShortcutService;
+			if(bitsShortcutService){
+				var sc = bitsShortcutService.getShortcut(this.id,this.dbtype);
+				if(!sc) sc = {disabled:true};
+				sc.disabled = !this.SC_DISABLED.checked;
+				sc.shift    = this.SC_SHIFT.checked;
+				sc.alt      = this.SC_ALT.checked;
+				sc.accel    = this.SC_ACCEL.checked;
+				sc.title    = this.item.title;
+				sc.style    = this.item.style;
+
+				var key = this.SC_KEY.value;
+				key = key.replace(/\t/mg,"        ");
+				key = this.Common.exceptCode(key);
+				key = key.replace(/[\r\n]/mg, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+				if(key){
+					sc.key = key;
+				}else{
+					sc.disabled = true;
+				}
+				bitsShortcutService.setShortcut(this.id,this.dbtype,sc);
+			}
+		}
+		return true;
+	},
+
+	cancel : function(){
+		if(window.arguments[1]) window.arguments[1].accept = false;
+	},
+
+	undoTitle : function(){
+		try{
+			while(this.TITLE.editor.transactionManager.numberOfUndoItems>0){
+				this.TITLE.editor.undo(1);
+				var title = this.TITLE.value;
+				title = title.replace(/\t/mg,"        ");
+				title = this.Common.exceptCode(title);
+				title = title.replace(/[\r\n]/mg, " ").replace(/^\s*/img,"").replace(/\s*$/img,"");
+				if(title != "") break;
+			}
+		}catch(ex2){_dump(ex2);}
+		window.focus();
+		var self = this;
+		setTimeout(function(){self.TITLE.focus();},100);
+	},
+
+	inputTitle : function(aEvent){
+		var title = this.TITLE.value;
+		title = title.replace(/\t/g,"        ");
+		title = this.Common.exceptCode(title);
+		title = title.replace(/[\r\n]/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+		if(title == ""){
+			this.TITLE_HBOX.style.borderColor = 'red';
+		}else{
+			this.TITLE_HBOX.style.borderColor = 'transparent';
+		}
+	},
+
+	checkedTitle : function(aEvent){
+		var title = this.TITLE.value;
+		title = title.replace(/\t/g,"        ");
+		title = this.Common.exceptCode(title);
+		title = title.replace(/[\r\n]/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+		if(title == ""){
+			aEvent.preventDefault();
+			aEvent.stopPropagation();
+			this.TABBOX.selectedTab = this.GENERAL_TAB;
+			if(Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS != "Darwin"){
+				this.Common.alert(this.STRING.getString("ERROR_NOT_ENTER_TITLE"));
+//				this.undoTitle();
+				this.TITLE.value = this.TITLE.defaultValue;
+				var self = this;
+				setTimeout(function(){ self.TITLE.focus(); },0);
+			}
+			var title = this.TITLE.value;
+			title = title.replace(/\t/g,"        ");
+			title = this.Common.exceptCode(title);
+			title = title.replace(/[\r\n]/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+			if(title == ""){
+				this.TITLE_HBOX.style.borderColor = 'red';
+			}else{
+				this.TITLE_HBOX.style.borderColor = 'transparent';
+			}
+			return false;
+		}
+		if(this.DataSource.isContainer(this.resource)){
+			var parRes = this.DataSource.findParentResource(this.resource);
+			if(!parRes) return;
+			var i;
+			var listTitle = "";
+			var listRes = this.DataSource.flattenResources(parRes,1,false);
+			for(i=0;i<listRes.length;i++){
+				if(listRes[i].Value == this.resource.Value) continue;
+				listTitle = this.DataSource.getProperty(listRes[i],"title");
+				listTitle = listTitle.replace(/^\s*/img,"").replace(/\s*$/img,"");
+				if(listTitle == title) break;
+			}
+			if(listTitle != title) return true;
+			if(Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS != "Darwin"){
+				this.Common.alert(this.STRING.getString("ERROR_INVALID_TITLE"));
+				this.TITLE.value = this.TITLE.defaultValue;
+				var self = this;
+				setTimeout(function(){ self.TITLE.focus(); },0);
+			}else{
+				this.TITLE.value = "";
+			}
+			aEvent.preventDefault();
+			aEvent.stopPropagation();
+			return false;
+		}else{
+			return true;
+		}
+		this.undoTitle();
+		return false;
+	},
+
+	updateNoteTab : function(aNote){
+		var elem = this.NOTE_TAB;
+		if(aNote != undefined)
+			elem.setAttribute("image", "chrome://markingcollection/skin/edit_comment.png");
+		else
+			elem.removeAttribute("image");
+	},
+
+	checkedTag : function(){
+		var tag = this.TAG.value.replace(/[\r\n]/mg, " ").replace(/^\s*/img,"").replace(/\s*$/img,"");
+		if(tag.match(/^[^a-z]/i)) this.Common.alert(this.STRING.getString("WARNING_NOT_BEGIN_ENGLISH_TAG"));
+	},
+
+	commandColor : function(event){
+		document.getElementById("mcPropSample").style.backgroundColor = event.target.style.backgroundColor;
+		document.getElementById("mcPropSample").style.color = event.target.style.color;
+	},
+
+	commandBorderStyle : function(event){
+		document.getElementById("mcPropSample").style.borderStyle = event.target.style.borderStyle;
+	},
+
+	commandBorderColor : function(event){
+		document.getElementById("mcPropSample").style.borderColor = event.target.style.backgroundColor;
+	},
+
+	commandBorderWidth : function(event){
+		document.getElementById("mcPropSample").style.borderWidth = event.target.style.borderWidth;
+	},
+
+	commandIconsize : function(event){
+		this.ICON_SIZE_I.setAttribute("iconsize",this.ICON_SIZE.value);
+	},
+
+	openDialog : function(){
+		var result = {
+			accept : false,
+			style  : document.getElementById("mcPropSample").style.cssText,
+		};
+		if(!this.item.index) this.item.index = -1;
+
+		window.openDialog('chrome://markingcollection/content/markerCustom.xul', '', 'modal,centerscreen,chrome',this.item.index,result);
+		if(result.accept) document.getElementById("mcPropSample").setAttribute("style",result.style);
+	},
+
+	formatFileSize : function(aBytes){
+		if(aBytes > 1000 * 1000){
+			return this.divideBy100( Math.round( aBytes / 1024 / 1024 * 100 ) ) + " MB";
+		}else if( aBytes == 0 ){
+			return "0 KB";
+		}else{
+			var kbytes = Math.round( aBytes / 1024 );
+			return (kbytes == 0 ? 1 : kbytes) + " KB";
+		}
+	},
+
+	divideBy100 : function(aInt){
+		if(aInt % 100 == 0){
+			return aInt / 100 + ".00";
+		}else if(aInt % 10 == 0){
+			return aInt / 100 + "0";
+		}else{
+			return aInt / 100;
+		}
+	},
+
+	vacuumDB : function(){
+		this.Database.vacuum(this.dbtype);
+		setTimeout(
+			function(){
+				document.getElementById("mcPropDatabaseGroup").setAttribute("hidden",true);
+				if(parseInt(mcPropService.item.editmode) & 0x1000){
+					var aDBFile = mcPropService.Database.getDatabaseFile(mcPropService.dbtype);
+					if(aDBFile){
+						mcPropService.DB_PATH.value = aDBFile.path;
+						mcPropService.DB_DATE.value = (new Date(aDBFile.lastModifiedTime)).toLocaleString();
+						mcPropService.DB_SIZE.value = mcPropService.formatFileSize(aDBFile.fileSize);
+						document.getElementById("mcPropDatabaseGroup").removeAttribute("hidden");
+					}
+				}
+		},500);
+	},
+
+	commandShortcut : function(aEvent){
+		if(!this.SC_DISABLED.checked){
+			this.SC_SHIFT.setAttribute("disabled","true");
+			this.SC_ALT.setAttribute("disabled","true");
+			this.SC_ACCEL.setAttribute("disabled","true");
+			this.SC_KEY.setAttribute("disabled","true");
+		}else{
+			this.SC_SHIFT.removeAttribute("disabled");
+			this.SC_ALT.removeAttribute("disabled");
+			this.SC_ACCEL.removeAttribute("disabled");
+			this.SC_KEY.removeAttribute("disabled");
+			this.SC_KEY.focus();
+		}
+			this.SC_SHIFT.setAttribute("disabled","true");
+			this.SC_ALT.setAttribute("disabled","true");
+			this.SC_ACCEL.setAttribute("disabled","true");
+
+	},
+	inputShortcut : function(aEvent){
+		var osString = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS;
+		var sc = {
+			key     : ""+String.fromCharCode(aEvent.charCode).toUpperCase(),
+			shift   : aEvent.shiftKey,
+			alt     : aEvent.altKey,
+			accel   : (osString == "Darwin" ? aEvent.metaKey: aEvent.ctrlKey)
+		};
+		this.SC_KEY.value = '';
+		this.SC_MOD.value = '';
+		if(!sc.key || !(sc.shift||sc.alt||sc.accel)) return;
+		this.SC_SHIFT.checked = sc.shift;
+		this.SC_ALT.checked = sc.alt;
+		this.SC_ACCEL.checked = sc.accel;
+
+		var acceltext = [];
+		if(sc.accel){
+			if(osString == "Darwin"){
+				acceltext.push('Command');
+			}else{
+				acceltext.push('Ctrl');
+			}
+		}
+		if(sc.shift) acceltext.push('Shift');
+		if(sc.alt){
+			if(osString == "Darwin"){
+				acceltext.push('Option');
+			}else{
+				acceltext.push('Alt');
+			}
+		}
+		this.SC_MOD.value = acceltext.join("+")+" +";
+
+		this.SC_KEY.value = sc.key;
+		this.SC_KEY.focus();
+	},
+};
+
+function _dump(aString){
+	window.opener.top.bitsMarkingCollection._dump(aString);
+}
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/property.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/property.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/property.xul	(revision 5703)
@@ -0,0 +1,224 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/property.css" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/setting.css" type="text/css" ?>
+<!DOCTYPE dialog [
+<!ENTITY % overlayDTD   SYSTEM "chrome://markingcollection/locale/markingcollection.dtd" >
+%overlayDTD;
+<!ENTITY % markerCustomDTD SYSTEM "chrome://markingcollection/locale/markerCustom.dtd" >
+%markerCustomDTD;
+<!ENTITY % markerDTD SYSTEM "chrome://markingcollection/locale/marker.dtd" >
+%markerDTD;
+]>
+<dialog
+	id="mcPropDialog"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	buttons="accept,cancel"
+	onload="mcPropService.init();"
+	ondialogaccept="return mcPropService.accept(event);"
+	ondialogcancel="mcPropService.cancel();">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/property.js" />
+	<stringbundleset id="mcStringBundles">
+		<stringbundle id="mcPropString" src="chrome://markingcollection/locale/markingcollection.properties" />
+	</stringbundleset>
+	<tabbox id="mcPropTabbox">
+		<tabs orient="horizontal">
+			<tab label="&markingcollection.prop.general;" id="mcPropGeneralTab" />
+			<tab label="&markingcollection.prop.note;" id="mcPropNoteTab" />
+			<tab label="&markingcollection.prop.extended_message;" id="mcPropExtendedMessageTab"/>
+			<tab label="PubMed Central" id="mcPropMedlineTab"/>
+			<tab label="HYPER-ANCHOR Code" id="mcPropURLTab"/>
+			<tab label="&markingcollection.prop.metacapture;" id="mcPropMetaCaptureTab"/>
+		</tabs>
+		<tabpanels id="mcPropTabpanels">
+			<tabpanel id="mcPropGeneralTabpanel" orient="vertical">
+				<groupbox id="mcPropTitleGroup" flex="1">
+					<caption label="&markingcollection.prop.title;" />
+					<hbox id="mcPropTitleHBox" style="border:2px solid transparent;">
+						<textbox
+							id="mcPropTitle"
+							multiline="true"
+							newlines="replacewithspaces"
+							readonly="true"
+							flex="1"
+							emptytext="&marker.initdata.dialog.emptytext.title;"
+							placeholder="&marker.initdata.dialog.emptytext.title;"
+							style="-moz-appearance:none !important;border:none;"
+							onfocus="this.select()"
+							oninput="mcPropService.inputTitle(event);"
+							onblur="mcPropService.inputTitle(event);"
+							onchange="mcPropService.checkedTitle(event);"/>
+					</hbox>
+				</groupbox>
+				<groupbox id="mcPropTagGroup" flex="1">
+					<caption label="&markingcollection.prop.tag;" />
+					<textbox
+						id="mcPropTagTextbox"
+						flex="1"
+						emptytext="&markingcollection.prop.tag.emptytext;"
+						placeholder="&markingcollection.prop.tag.emptytext;"
+						newlines="replacewithspaces"
+						readonly="true"
+						onfocus="this.select()"
+						onchange="mcPropService.checkedTag();"
+						style="-moz-appearance:none !important;border:none;"/>
+				</groupbox>
+				<groupbox id="mcPropMarkerGroup" flex="1">
+					<caption label="&markingcollection.marker;" />
+					<hbox flex="1">
+						<vbox flex="1" style="background:white;padding:10px;border:1px solid ThreeDShadow;text-align:center;" align="center">
+							<label id="mcPropSample" value="Firefox, rediscover the web" />
+						</vbox>
+						<spacer flex="1" />
+						<vbox flex="1">
+							<button id="mcPropMarkerCustomButton" label="&markingcollection.button.customize;..." oncommand="mcPropService.openDialog();" />
+						</vbox>
+					</hbox>
+				</groupbox>
+				<groupbox id="mcPropIconsizeGroup" flex="1" hidden="true">
+					<caption label="&markingcollection.icon_size;" />
+					<hbox flex="1">
+						<image id="mcPropIconsizeImage" class="iconsize" iconsize="small"/>
+						<radiogroup id="mcPropIconsize" orient="horizontal" onclick="mcPropService.commandIconsize(event);">
+							<radio id="mcPropIconsizeLarge" value="large" label="&markingcollection.icon_size.large;"/>
+							<radio id="mcPropIconsizeSmall" value="small" label="&markingcollection.icon_size.small;" selected="true"/>
+						</radiogroup>
+					</hbox>
+				</groupbox>
+				<groupbox id="mcPropShortcutGroup" flex="1">
+					<caption><checkbox id="mcPropShortcutDisabled" label="&markingcollection.shortcut;" oncommand="mcPropService.commandShortcut(event);"/></caption>
+					<description style="-moz-appearance:none;color:#ff0000;">&markingcollection.shortcut.attention_modifiers;</description>
+					<hbox flex="1" align="center" pack="center">
+						<checkbox id="mcPropShortcutAccel" label="Control" hidden="true"/>
+						<checkbox id="mcPropShortcutShift" label="Shift" hidden="true"/>
+						<checkbox id="mcPropShortcutAlt" label="Alt" hidden="true"/>
+						<label id="mcPropShortcutModifiers" control="mcPropShortcutKey"/>
+						<textbox id="mcPropShortcutKey" size="1" maxlength="1" readonly="true" onfocus="this.select()" onkeypress="mcPropService.inputShortcut(event);"/>
+					</hbox>
+				</groupbox>
+				<groupbox id="mcPropDatabaseGroup" flex="1">
+					<caption label="&markingcollection.database;" />
+					<grid flex="1">
+						<columns>
+							<column />
+							<column flex="1" />
+						</columns>
+						<rows id="mcPropDBRows">
+							<row align="center">
+								<label value="path:" />
+								<textbox id="mcPropDBPath" readonly="true" />
+							</row>
+							<row align="center">
+								<label value="date:" />
+								<textbox id="mcPropDBDate" readonly="true" />
+							</row>
+							<row id="mcPropSizeRow" align="center">
+								<label value="size:" />
+								<textbox id="mcPropDBSize" readonly="true" />
+							</row>
+						</rows>
+					</grid>
+					<hbox flex="1">
+						<spacer flex="1" />
+						<button id="mcPropMarkerCustomButton1" label="&markingcollection.database.vacuum;" oncommand="mcPropService.vacuumDB();" />
+					</hbox>
+				</groupbox>
+			</tabpanel>
+			<tabpanel id="mcPropNoteTabpanel">
+				<groupbox id="mcPropNoteGroup" flex="1">
+					<caption label="&markingcollection.prop.note;" />
+					<textbox
+						id="mcPropNote"
+						multiline="true"
+						readonly="true"
+						flex="1"
+						style="background:white;padding:10px;border:1px solid ThreeDShadow;text-align:center;"
+						onfocus="this.select()"
+						oninput="mcPropService.updateNoteTab(this.value);" />
+				</groupbox>
+			</tabpanel>
+			<tabpanel id="mcPropExtendedMessageTabpanel">
+				<grid flex="1">
+					<columns>
+						<column />
+						<column />
+					</columns>
+					<rows>
+						<row align="center">
+							<hbox flex="1" pack="end">
+								<label value="Logical Page:" />
+							</hbox>
+							<textbox id="mcPropExtendedMessageLogicalPageTextbox" size="1"   onfocus="this.select();"/>
+						</row>
+						<row align="center">
+							<hbox flex="1" pack="end">
+								<label value="Physical Page:" />
+							</hbox>
+							<textbox id="mcPropExtendedMessagePhysicalPageTextbox" size="1"  onfocus="this.select();"/>
+						</row>
+					</rows>
+				</grid>
+			</tabpanel>
+			<tabpanel id="mcPropMedlineTabpanel">
+				<grid flex="1">
+					<columns>
+						<column />
+						<column flex="1"/>
+					</columns>
+					<rows>
+						<row align="center">
+							<hbox flex="1" pack="end">
+								<label value="Pubmed Central ID:" />
+							</hbox>
+							<textbox
+								id="mcPropMedlinePMCIDTextbox"
+								readonly="true"
+								style="-moz-appearance:none !important;border:none;background:white !important;"
+								onfocus="this.select()"/>
+						</row>
+						<row align="center">
+							<hbox flex="1" pack="end">
+								<label value="Pubmed ID:" />
+							</hbox>
+							<textbox
+								id="mcPropMedlinePMIDTextbox"
+								readonly="true"
+								style="-moz-appearance:none !important;border:none;background:white !important;"
+								onfocus="this.select()"/>
+						</row>
+						<row align="start">
+							<hbox flex="1" pack="end">
+								<label value="Source:" />
+							</hbox>
+							<textbox
+								id="mcPropMedlineSOTextbox"
+								multiline="true"
+								readonly="true"
+								style="-moz-appearance:none !important;border:none;background:white !important;"
+								onfocus="this.select()"/>
+						</row>
+					</rows>
+				</grid>
+			</tabpanel>
+			<tabpanel id="mcPropURLTabpanel">
+				<textbox
+					id="mcPropURLTextbox"
+					multiline="true"
+					readonly="true"
+					flex="1"
+					style="-moz-appearance:none !important;border:none;background:white !important;"
+					onfocus="this.select()"/>
+			</tabpanel>
+			<tabpanel id="mcPropMetaCaptureTabpanel">
+				<textbox
+					id="mcPropMetaCaptureTextbox"
+					multiline="true"
+					readonly="true"
+					flex="1"
+					style="-moz-appearance:none !important;border:none;background:white !important;"
+					onfocus="this.select()"/>
+			</tabpanel>
+		</tabpanels>
+	</tabbox>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/pubmedcentral.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/pubmedcentral.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/pubmedcentral.js	(revision 5703)
@@ -0,0 +1,694 @@
+var bitsPubmedCentralService = {
+	_init     : false,
+	_threadID : 0,
+	_mainThread : null,
+	_backgroundThread : null,
+	_stack : [],
+
+	_capture : {
+		confirm : false,
+		substitution : {
+			confirm : false,
+			format  : "MEDLINE.SO from PMC",
+		},
+	},
+
+	get STRING()  { return document.getElementById("MarkingCollectionOverlayString"); },
+	get UNICODE() { return Components.classes['@mozilla.org/intl/scriptableunicodeconverter'].getService(Components.interfaces.nsIScriptableUnicodeConverter); },
+
+	get Common()   { return window.top.bitsObjectMng.Common; },
+	get Database() { return window.top.bitsObjectMng.Database;   },
+
+	get mainThread() { return this._mainThread; },
+	get backgroundThread() { return this._backgroundThread; },
+
+	get SIDEBAR()     { return window.top.document.getElementById("sidebar"); },
+	get SIDEBAR_WIN() {try{return this.SIDEBAR.contentWindow;}catch(e){return undefined;}},
+	get SIDEBAR_DOC() {try{return this.SIDEBAR.contentDocument;}catch(e){return undefined;}},
+
+/////////////////////////////////////////////////////////////////////
+	init : function(aEvent){
+		if(!this._init){
+			var info = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
+			this._app_version = parseInt(info.version);
+			if(this._app_version>=3){
+				this._capture.confirm = nsPreferences.getBoolPref("wiredmarker.pubmedcentral.capture.confirm", true);
+				this._capture.substitution.confirm = nsPreferences.getBoolPref("wiredmarker.pubmedcentral.capture.substitution.confirm", true);
+				var format = nsPreferences.copyUnicharPref("wiredmarker.pubmedcentral.capture.substitution.format");
+				if(format == null) nsPreferences.setUnicharPref("wiredmarker.pubmedcentral.capture.substitution.format", this._capture.substitution.format);
+
+				this._mainThread = Components.classes["@mozilla.org/thread-manager;1"].getService().mainThread;
+			}
+			this._init = true;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(aEvent){
+		if(this._backgroundThread) delete this._backgroundThread;
+		if(this._mainThread) delete this._mainThread;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	formatPMCID : function(aPMCID){
+		try{
+			if(!aPMCID) return undefined;
+			if(aPMCID.match(/^\d+$/)) aPMCID = "PMC"+aPMCID;
+			if(!aPMCID.match(/^PMC\d+$/)) return undefined;
+			return aPMCID;
+		}catch(err){
+			this._dump("bitsPubmedCentralService.getExtensionDir():"+err);
+			return undefined;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getExtensionDir : function(aPMCID){
+		try{
+			aPMCID = this.formatPMCID(aPMCID);
+			if(!aPMCID) return undefined;
+			var extensionDir = this.Common.getExtensionDir().clone();
+			extensionDir.append("PubmedCentral");
+			var arr = aPMCID.split("");
+			while(arr.length>0){
+				extensionDir.append(arr.shift());
+			}
+			return extensionDir;
+		}catch(err){
+			this._dump("bitsPubmedCentralService.getExtensionDir():"+err);
+			return undefined;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getPubmedInfo : function(aObject){
+		this._capture.confirm = nsPreferences.getBoolPref("wiredmarker.pubmedcentral.capture.confirm", true);
+		this._capture.substitution.confirm = nsPreferences.getBoolPref("wiredmarker.pubmedcentral.capture.substitution.confirm", true);
+		this._capture.substitution.format = nsPreferences.copyUnicharPref("wiredmarker.pubmedcentral.capture.substitution.format");
+		if(!this._capture.confirm) return;
+		if(!aObject) return;
+		if(!aObject.con_url.match(/^http:\/\/www\.pubmedcentral\.nih\.gov\/.+?\?artid=(\d+)/) && !aObject.con_url.match(/^http:\/\/www\.ncbi\.nlm\.nih\.gov\/pmc\/articles\/([^\/]+)/)) return;
+		var pmcid = RegExp.$1;
+		pmcid = this.formatPMCID(pmcid);
+		this.execThread(pmcid,function(aResult){
+			if(!aObject.oid_property) aObject.oid_property = '<PROPERTY/>';
+			var parser = new DOMParser();
+			var xml_property = parser.parseFromString(aObject.oid_property, "text/xml");
+			parser = undefined;
+			var extras_msg = xml_property.getElementsByTagName("EXTENDED_MESSAGE")[0];
+			if(!extras_msg){
+				extras_msg = xml_property.createElement("EXTENDED_MESSAGE");
+				xml_property.documentElement.appendChild(extras_msg);
+			}
+			elem_medline = xml_property.createElement("MEDLINE");
+			extras_msg.appendChild(elem_medline);
+			if(aResult.medline.PMID){
+				var elem_pmid = xml_property.createElement("PMID");
+				elem_pmid.appendChild(xml_property.createTextNode(aResult.medline.PMID));
+				elem_medline.appendChild(elem_pmid);
+			}
+			if(aResult.medline.SO){
+				var elem_so = xml_property.createElement("SO");
+				elem_so.appendChild(xml_property.createTextNode(aResult.medline.SO));
+				elem_medline.appendChild(elem_so);
+			}
+			aResult.medline.PMCID = pmcid;
+			var elem_pmcid = xml_property.createElement("PMCID");
+			elem_pmcid.appendChild(xml_property.createTextNode(pmcid));
+			elem_medline.appendChild(elem_pmcid);
+			var s = new XMLSerializer();
+			aObject.oid_property = s.serializeToString(xml_property);
+			s = undefined;
+			if(bitsPubmedCentralService._capture.substitution.confirm){
+				var keys_arr = [];
+				for(var key in aResult.medline){
+					keys_arr.push(key);
+				}
+				keys_arr.sort();
+				keys_arr.sort(function(a,b){return b.length-a.length;});
+				var format = nsPreferences.copyUnicharPref("wiredmarker.pubmedcentral.capture.substitution.format");
+				for(var i=0;i<keys_arr.length;i++){
+					var regexp = new RegExp("MEDLINE\\."+keys_arr[i],"g");
+					format = format.replace(regexp,aResult.medline[keys_arr[i]]);
+				}
+				aObject.doc_title = format;
+			}
+			var dbtype = aObject.dbtype;
+			delete aObject.dbtype;
+			delete aObject.fid_style;
+			delete aObject.fid_title;
+			delete aObject.folder_order;
+			bitsPubmedCentralService.Database.updateObject(aObject,dbtype);
+			setTimeout(function(){
+				aObject.dbtype = dbtype;
+				var contentWindow = bitsPubmedCentralService.SIDEBAR_WIN;
+				var contentDocument = bitsPubmedCentralService.SIDEBAR_DOC;
+				var mcTreeHandler = null;
+				if(contentWindow && contentWindow.mcPropertyView) mcPropertyView = contentWindow.mcPropertyView;
+				if(mcPropertyView && mcPropertyView._id == aObject.oid && mcPropertyView._dbtype == aObject.dbtype){
+					mcPropertyView.dispProperty(aObject);
+				}
+			},500);
+		})
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getPubmedInfoSync : function(aObject){
+		this._capture.confirm = nsPreferences.getBoolPref("wiredmarker.pubmedcentral.capture.confirm", true);
+		this._capture.substitution.confirm = nsPreferences.getBoolPref("wiredmarker.pubmedcentral.capture.substitution.confirm", true);
+		this._capture.substitution.format = nsPreferences.copyUnicharPref("wiredmarker.pubmedcentral.capture.substitution.format");
+		if(!this._capture.confirm) return aObject;
+		if(!aObject) return aObject;
+		if(!aObject.con_url.match(/^http:\/\/www\.pubmedcentral\.nih\.gov\/.+?\?artid=(\d+)/) && !aObject.con_url.match(/^http:\/\/www\.ncbi\.nlm\.nih\.gov\/pmc\/articles\/([^\/]+)/)) return;
+		var pmcid = RegExp.$1;
+		pmcid = this.formatPMCID(pmcid);
+		var aResult = this.execThread(pmcid);
+		if(!aObject.oid_property) aObject.oid_property = '<PROPERTY/>';
+		var parser = new DOMParser();
+		var xml_property = parser.parseFromString(aObject.oid_property, "text/xml");
+		parser = undefined;
+		var extras_msg = xml_property.getElementsByTagName("EXTENDED_MESSAGE")[0];
+		if(!extras_msg){
+			extras_msg = xml_property.createElement("EXTENDED_MESSAGE");
+			xml_property.documentElement.appendChild(extras_msg);
+		}
+		elem_medline = xml_property.createElement("MEDLINE");
+		extras_msg.appendChild(elem_medline);
+		if(aResult.medline.PMID){
+			var elem_pmid = xml_property.createElement("PMID");
+			elem_pmid.appendChild(xml_property.createTextNode(aResult.medline.PMID));
+			elem_medline.appendChild(elem_pmid);
+		}
+		if(aResult.medline.SO){
+			var elem_so = xml_property.createElement("SO");
+			elem_so.appendChild(xml_property.createTextNode(aResult.medline.SO));
+			elem_medline.appendChild(elem_so);
+		}
+		aResult.medline.PMCID = pmcid;
+		var elem_pmcid = xml_property.createElement("PMCID");
+		elem_pmcid.appendChild(xml_property.createTextNode(pmcid));
+		elem_medline.appendChild(elem_pmcid);
+		var s = new XMLSerializer();
+		aObject.oid_property = s.serializeToString(xml_property);
+		s = undefined;
+		if(bitsPubmedCentralService._capture.substitution.confirm){
+			var keys_arr = [];
+			for(var key in aResult.medline){
+				keys_arr.push(key);
+			}
+			keys_arr.sort();
+			keys_arr.sort(function(a,b){return b.length-a.length;});
+			var format = nsPreferences.copyUnicharPref("wiredmarker.pubmedcentral.capture.substitution.format");
+			for(var i=0;i<keys_arr.length;i++){
+				var regexp = new RegExp("MEDLINE\\."+keys_arr[i],"g");
+				format = format.replace(regexp,aResult.medline[keys_arr[i]]);
+			}
+			aObject.doc_title = format;
+		}
+		return aObject;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	execThread : function(aPMCID,aCB){
+		//Threadãäœ¿çšããªã
+		if(aCB){
+			setTimeout(function(){
+				var func = new bitsPubmedCentralServiceFunc(aPMCID,aCB);
+				var aResult = func.run();
+				if(aCB) (aCB)(aResult);
+			},0);
+			return;
+		}else{
+			var func = new bitsPubmedCentralServiceFunc(aPMCID,aCB);
+			var aResult = func.run();
+			return aResult;
+		}
+		//Threadãäœ¿çšãã
+		if(!this._mainThread) return;
+		this._threadID++;
+		if(this._backgroundThread){
+			this._stack.push({pmcid : aPMCID, callback : aCB});
+		}else{
+			this._backgroundThread = Components.classes["@mozilla.org/thread-manager;1"].getService().newThread(0);
+			this.backgroundThread.dispatch(new bitsPubmedCentralServiceWorkingThread(this._threadID, aPMCID, aCB), this.backgroundThread.DISPATCH_NORMAL);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	exitThread : function(aResult,aCB){
+		if(this._backgroundThread) delete this._backgroundThread;
+		this._backgroundThread = null;
+		if(aCB) (aCB)(aResult);
+		if(this._stack.length){
+			var stack = this._stack.shift();
+			this.execThread(stack.pmcid,stack.callback);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+};
+
+/////////////////////////////////////////////////////////////////////
+var bitsPubmedCentralServiceFunc = function(aPMCID, aCB) {
+	this.pmcid = aPMCID;
+	this.callback = aCB; //äºææ§ã®çºãå®éã«ã¯äœ¿çšããªã
+	this.result = 0;
+};
+
+bitsPubmedCentralServiceFunc.prototype = {
+	getText : function(pUrl){
+		var text = null;
+		try{
+			var xmlhttp = new XMLHttpRequest();
+			if(xmlhttp){
+				xmlhttp.open("GET",pUrl,false);
+				xmlhttp.send(null);
+				if(xmlhttp.status == 200){
+					if(xmlhttp.responseText.length >0) return xmlhttp.responseText;
+				}else{
+					bitsPubmedCentralService._dump("bitsPubmedCentralServiceWorkingThread.getText():error=["+ req.status +" "+ req.statusText+"]");
+				}
+			}
+		}catch(err){
+			Components.utils.reportError(err);
+		}
+		return undefined;
+	},
+
+	getXML : function(pUrl){
+		var xmldoc = null;
+		try{
+			var responseText = this.getText(pUrl);
+			if(responseText){
+				var parser = new DOMParser();
+				xmldoc = parser.parseFromString(responseText, "text/xml");
+				parser = undefined;
+			}
+		}catch(err){
+			Components.utils.reportError(err);
+		}
+		return xmldoc;
+	},
+
+	searchNCBI : function(aPMCID){
+		aPMCID = bitsPubmedCentralService.formatPMCID(aPMCID);
+		if(!aPMCID) return undefined;
+		const getURL = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=";
+		var url = getURL + aPMCID;
+		var xmldoc = this.getXML(url);
+		if(!xmldoc) return undefined;
+		var elemId = xmldoc.getElementsByTagName("Id")[0];
+		if(elemId){
+			return elemId.textContent;
+		}else{
+			return undefined;
+		}
+	},
+
+	fetchNCBI : function(aPMID, aRetmode){
+		const getMEDLINEURL = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&retmode=text&rettype=medline&id=";
+		const getXMLURL = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&retmode=xml&id=";
+		if(!aRetmode || aRetmode == 'xml'){
+			return this.getXML(getXMLURL + aPMID);
+		}else{
+			return this.getText(getMEDLINEURL + aPMID);
+		}
+		return undefined;
+	},
+
+	convertFormUnicode : function(aString, aCharset){
+		if(!aString) return "";
+		try {
+			bitsPubmedCentralService.UNICODE.charset = aCharset;
+			aString = bitsPubmedCentralService.UNICODE.ConvertFromUnicode(aString);
+		}catch(ex){}
+		return aString;
+	},
+
+	convertToUnicode : function(aString, aCharset){
+		if(!aString) return "";
+		try {
+			bitsPubmedCentralService.UNICODE.charset = aCharset;
+			aString = bitsPubmedCentralService.UNICODE.ConvertToUnicode(aString);
+		}catch(ex){}
+		return aString;
+	},
+
+	writeFile : function(aFile, aContent){
+		if(aFile.exists()) aFile.remove(false);
+		try {
+			aFile.create(aFile.NORMAL_FILE_TYPE, 0666);
+			var content = this.convertFormUnicode(aContent,"UTF-8");
+			var ostream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
+			ostream.init(aFile, 2, 0x200, false);
+			ostream.write(content, content.length);
+			ostream.close();
+		}catch(ex){
+			bitsPubmedCentralService._dump("bitsPubmedCentralService ERROR: Failed to write file: " + aFile.path + "["+ ex + "]");
+		}
+	},
+
+	readFile : function(aFile){
+		if(!aFile || !aFile.exists()) return undefined;
+		try {
+			var istream = Components.classes['@mozilla.org/network/file-input-stream;1'].createInstance(Components.interfaces.nsIFileInputStream);
+			istream.init(aFile, 1, 0, false);
+			var sstream = Components.classes['@mozilla.org/scriptableinputstream;1'].createInstance(Components.interfaces.nsIScriptableInputStream);
+			sstream.init(istream);
+			var content = sstream.read(sstream.available());
+			sstream.close();
+			istream.close();
+			content = this.convertToUnicode(content,"UTF-8");
+			return content;
+		}catch(ex){
+			bitsPubmedCentralService._dump("bitsPubmedCentralService ERROR: readFile():" + ex);
+			return undefined;
+		}
+	},
+
+	createXMLDocument : function(aXMLFile){
+		if(!aXMLFile) return undefined;
+		try{
+			var fileContents = this.readFile(aXMLFile);
+			var parser = new DOMParser();
+			var xmlDocument = parser.parseFromString(fileContents, "text/xml");
+			parser = undefined;
+			return xmlDocument;
+		}catch(ex){
+			bitsPubmedCentralService._dump("bitsPubmedCentralServiceWorkingThread.createXMLDocument():"+ ex);
+			return undefined;
+		}
+	},
+
+	analysisMedline : function(aMedline){
+		if(!aMedline) return undefined;
+		try{
+			var rtn = {};
+			var arr = aMedline.replace(/\x0D\x0A|\x0D|\x0A/g,"\n").split("\n");
+			var key = "";
+			var val = "";
+			for(var i=0;i<arr.length;i++){
+				if(arr[i].match(/^([A-Z]+)\s*\-\s(.+)$/)){
+					key = RegExp.$1;
+					val = RegExp.$2;
+					if(rtn[key]){
+						if(typeof rtn[key] == "string"){
+							var oldval = rtn[key];
+							rtn[key] = [oldval];
+						}
+						rtn[key].push(val);
+					}else{
+						rtn[key] = val;
+					}
+				}else if(arr[i].match(/^\s+?(\S.+)$/)){
+					val = RegExp.$1;
+					rtn[key] += ' ' + val;
+					rtn[key] = rtn[key].replace(/\s{2,}/g," ");
+				}
+			}
+			return rtn;
+		}catch(ex){
+			bitsPubmedCentralService._dump("bitsPubmedCentralServiceWorkingThread.analysisMedline():"+ ex);
+			return undefined;
+		}
+	},
+
+	run : function() {
+		try {
+			var xmldoc = null;
+			var medline = null;
+			var xmlFile = bitsPubmedCentralService.getExtensionDir(this.pmcid);
+			var medlineFile = xmlFile.clone();
+			xmlFile.append(this.pmcid+".xml");
+			medlineFile.append(this.pmcid+".txt");
+			if(!xmlFile.exists()){
+				var pmid = this.searchNCBI(this.pmcid);
+				if(pmid){
+					xmldoc = this.fetchNCBI(pmid);
+					if(xmldoc){
+						var s = new XMLSerializer();
+						var xml = s.serializeToString(xmldoc);
+						s = undefined;
+						this.writeFile(xmlFile, xml+"\n","UTF-8");
+					}
+					medline = this.fetchNCBI(pmid,'text');
+					if(medline) this.writeFile(medlineFile, medline,"UTF-8");
+				}
+			}else{
+				xmldoc = this.createXMLDocument(xmlFile);
+				medline = this.readFile(medlineFile);
+			}
+			if(medline) medline = this.analysisMedline(medline);
+			this.result = {
+				xmldoc  : xmldoc,
+				medline : medline,
+			};
+			return this.result;
+
+		}catch(err){
+			Components.utils.reportError(err);
+		}
+	}
+};
+
+/////////////////////////////////////////////////////////////////////
+var bitsPubmedCentralServiceMainThread = function(threadID, aResult, aCB) {
+	this.threadID = threadID;
+	this.result = aResult;
+	this.callback = aCB;
+};
+
+bitsPubmedCentralServiceMainThread.prototype = {
+	run: function() {
+		try {
+			// ããã§ã¯ãŒã­ã³ã°ã¹ã¬ããã®å®äºã«å¯ŸããŠåå¿ãè¿ã
+			bitsPubmedCentralService.exitThread(this.result,this.callback);
+		}catch(err){
+			Components.utils.reportError(err);
+		}
+	},
+
+	QueryInterface: function(iid) {
+		if( iid.equals(Components.interfaces.nsIRunnable) ||
+				iid.equals(Components.interfaces.nsISupports)) {
+			return this;
+		}
+		throw Components.results.NS_ERROR_NO_INTERFACE;
+	}
+};
+
+/////////////////////////////////////////////////////////////////////
+var bitsPubmedCentralServiceWorkingThread = function(threadID, aPMCID, aCB) {
+	this.threadID = threadID;
+	this.pmcid = aPMCID;
+	this.callback = aCB;
+	this.result = 0;
+};
+
+bitsPubmedCentralServiceWorkingThread.prototype = {
+	getText : function(pUrl){
+		var text = null;
+		try{
+			var xmlhttp = new XMLHttpRequest();
+			if(xmlhttp){
+				xmlhttp.open("GET",pUrl,false);
+				xmlhttp.send(null);
+				if(xmlhttp.status == 200){
+					if(xmlhttp.responseText.length >0) return xmlhttp.responseText;
+				}else{
+					bitsPubmedCentralService._dump("bitsPubmedCentralServiceWorkingThread.getText():error=["+ req.status +" "+ req.statusText+"]");
+				}
+			}
+		}catch(err){
+			Components.utils.reportError(err);
+		}
+		return undefined;
+	},
+
+	getXML : function(pUrl){
+		var xmldoc = null;
+		try{
+			var responseText = this.getText(pUrl);
+			if(responseText){
+				var parser = new DOMParser();
+				xmldoc = parser.parseFromString(responseText, "text/xml");
+				parser = undefined;
+			}
+		}catch(err){
+			Components.utils.reportError(err);
+		}
+		return xmldoc;
+	},
+
+	searchNCBI : function(aPMCID){
+		aPMCID = bitsPubmedCentralService.formatPMCID(aPMCID);
+		if(!aPMCID) return undefined;
+		const getURL = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=";
+		var url = getURL + aPMCID;
+		var xmldoc = this.getXML(url);
+		if(!xmldoc) return undefined;
+		var elemId = xmldoc.getElementsByTagName("Id")[0];
+		if(elemId){
+			return elemId.textContent;
+		}else{
+			return undefined;
+		}
+	},
+
+	fetchNCBI : function(aPMID, aRetmode){
+		const getMEDLINEURL = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&retmode=text&rettype=medline&id=";
+		const getXMLURL = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&retmode=xml&id=";
+		if(!aRetmode || aRetmode == 'xml'){
+			return this.getXML(getXMLURL + aPMID);
+		}else{
+			return this.getText(getMEDLINEURL + aPMID);
+		}
+		return undefined;
+	},
+
+	convertFormUnicode : function(aString, aCharset){
+		if(!aString) return "";
+		try {
+			bitsPubmedCentralService.UNICODE.charset = aCharset;
+			aString = bitsPubmedCentralService.UNICODE.ConvertFromUnicode(aString);
+		}catch(ex){}
+		return aString;
+	},
+
+	convertToUnicode : function(aString, aCharset){
+		if(!aString) return "";
+		try {
+			bitsPubmedCentralService.UNICODE.charset = aCharset;
+			aString = bitsPubmedCentralService.UNICODE.ConvertToUnicode(aString);
+		}catch(ex){}
+		return aString;
+	},
+
+	writeFile : function(aFile, aContent){
+		if(aFile.exists()) aFile.remove(false);
+		try {
+			aFile.create(aFile.NORMAL_FILE_TYPE, 0666);
+			var content = this.convertFormUnicode(aContent,"UTF-8");
+			var ostream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
+			ostream.init(aFile, 2, 0x200, false);
+			ostream.write(content, content.length);
+			ostream.close();
+		}catch(ex){
+			bitsPubmedCentralService._dump("bitsPubmedCentralService ERROR: Failed to write file: " + aFile.path + "["+ ex + "]");
+		}
+	},
+
+	readFile : function(aFile){
+		if(!aFile || !aFile.exists()) return undefined;
+		try {
+			var istream = Components.classes['@mozilla.org/network/file-input-stream;1'].createInstance(Components.interfaces.nsIFileInputStream);
+			istream.init(aFile, 1, 0, false);
+			var sstream = Components.classes['@mozilla.org/scriptableinputstream;1'].createInstance(Components.interfaces.nsIScriptableInputStream);
+			sstream.init(istream);
+			var content = sstream.read(sstream.available());
+			sstream.close();
+			istream.close();
+			content = this.convertToUnicode(content,"UTF-8");
+			return content;
+		}catch(ex){
+			bitsPubmedCentralService._dump("bitsPubmedCentralService ERROR: readFile():" + ex);
+			return undefined;
+		}
+	},
+
+	createXMLDocument : function(aXMLFile){
+		if(!aXMLFile) return undefined;
+		try{
+			var fileContents = this.readFile(aXMLFile);
+			var parser = new DOMParser();
+			var xmlDocument = parser.parseFromString(fileContents, "text/xml");
+			parser = undefined;
+			return xmlDocument;
+		}catch(ex){
+			bitsPubmedCentralService._dump("bitsPubmedCentralServiceWorkingThread.createXMLDocument():"+ ex);
+			return undefined;
+		}
+	},
+
+	analysisMedline : function(aMedline){
+		if(!aMedline) return undefined;
+		try{
+			var rtn = {};
+			var arr = aMedline.replace(/\x0D\x0A|\x0D|\x0A/g,"\n").split("\n");
+			var key = "";
+			var val = "";
+			for(var i=0;i<arr.length;i++){
+				if(arr[i].match(/^([A-Z]+)\s*\-\s(.+)$/)){
+					key = RegExp.$1;
+					val = RegExp.$2;
+					if(rtn[key]){
+						if(typeof rtn[key] == "string"){
+							var oldval = rtn[key];
+							rtn[key] = [oldval];
+						}
+						rtn[key].push(val);
+					}else{
+						rtn[key] = val;
+					}
+				}else if(arr[i].match(/^\s+?(\S.+)$/)){
+					val = RegExp.$1;
+					rtn[key] += ' ' + val;
+					rtn[key] = rtn[key].replace(/\s{2,}/g," ");
+				}
+			}
+			return rtn;
+		}catch(ex){
+			bitsPubmedCentralService._dump("bitsPubmedCentralServiceWorkingThread.analysisMedline():"+ ex);
+			return undefined;
+		}
+	},
+
+	run : function() {
+		try {
+			// ããã§ã¯ãŒã­ã³ã°ã¹ã¬ãããåŠçãè¡ã
+			var xmldoc = null;
+			var medline = null;
+			var xmlFile = bitsPubmedCentralService.getExtensionDir(this.pmcid);
+			var medlineFile = xmlFile.clone();
+			xmlFile.append(this.pmcid+".xml");
+			medlineFile.append(this.pmcid+".txt");
+			if(!xmlFile.exists()){
+				var pmid = this.searchNCBI(this.pmcid);
+				if(pmid){
+					xmldoc = this.fetchNCBI(pmid);
+					if(xmldoc){
+						var s = new XMLSerializer();
+						var xml = s.serializeToString(xmldoc);
+						s = undefined;
+						this.writeFile(xmlFile, xml+"\n","UTF-8");
+					}
+					medline = this.fetchNCBI(pmid,'text');
+					if(medline) this.writeFile(medlineFile, medline,"UTF-8");
+				}
+			}else{
+				xmldoc = this.createXMLDocument(xmlFile);
+				medline = this.readFile(medlineFile);
+			}
+			if(medline) medline = this.analysisMedline(medline);
+			this.result = {
+				xmldoc  : xmldoc,
+				medline : medline,
+			};
+			// åŠçãçµäºããããçµäºãç¥ãããããã«ã¡ã€ã³ã¹ã¬ããã«ã³ãŒã«ããã¯ãã
+			bitsPubmedCentralService.mainThread.dispatch(new bitsPubmedCentralServiceMainThread(this.threadID, this.result, this.callback), bitsPubmedCentralService.backgroundThread.DISPATCH_NORMAL);
+		}catch(err){
+			Components.utils.reportError(err);
+		}
+	},
+
+	QueryInterface : function(iid) {
+		if(	iid.equals(Components.interfaces.nsIRunnable) ||
+				iid.equals(Components.interfaces.nsISupports)) {
+			return this;
+		}
+		throw Components.results.NS_ERROR_NO_INTERFACE;
+	}
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/pubmedcentralDialogOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/pubmedcentralDialogOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/pubmedcentralDialogOverlay.xul	(revision 5703)
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE overlay [
+<!ENTITY % markingcollectionDTD SYSTEM "chrome://markingcollection/locale/markingcollection.dtd" >
+%markingcollectionDTD;
+<!ENTITY % metaDTD SYSTEM "chrome://markingcollection/locale/meta.dtd" >
+%metaDTD;
+]>
+<overlay
+	id="pubmedcentralDialogOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _pubmedcentralDialogOverlayInit(aEvent){
+
+			var info = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
+			this._app_version = parseInt(info.version);
+			if(this._app_version>=3){
+				var confirm = nsPreferences.getBoolPref("wiredmarker.pubmedcentral.capture.confirm", true);
+				document.getElementById("mcPubmedCentralConfirm").checked = confirm;
+
+				var substitution = nsPreferences.getBoolPref("wiredmarker.pubmedcentral.capture.substitution.confirm", true);
+				document.getElementById("mcPubmedCentralSubstitution").checked = substitution;
+
+				document.getElementById("mcPubmedCentralSubstitutionText").value = nsPreferences.copyUnicharPref("wiredmarker.pubmedcentral.capture.substitution.format");
+			}else{
+				document.getElementById("mcPubmedCentralConfirm").disabled = true;
+				document.getElementById("mcPubmedCentralConfirm").checked = false;
+				document.getElementById("mcPubmedCentralSubstitution").checked = false;
+				document.getElementById("mcPubmedCentralSubstitutionText").value = "";
+			}
+			_pubmedcentralConfirmCommand();
+		}
+		function _pubmedcentralDialogOverlayDone(aEvent){
+
+		}
+		function _pubmedcentralConfirmCommand(aEvent){
+			var checked = document.getElementById("mcPubmedCentralConfirm").checked;
+			nsPreferences.setBoolPref("wiredmarker.pubmedcentral.capture.confirm", checked);
+
+			document.getElementById("mcPubmedCentralSubstitution").disabled = !checked;
+			_pubmedcentralSubstitutionCommand();
+		}
+
+		function _pubmedcentralSubstitutionCommand(aEvent){
+			var checked = document.getElementById("mcPubmedCentralSubstitution").checked;
+			var disabled = document.getElementById("mcPubmedCentralSubstitution").disabled;
+			nsPreferences.setBoolPref("wiredmarker.pubmedcentral.capture.substitution.confirm", checked);
+
+			document.getElementById("mcPubmedCentralSubstitutionTokensPMCIDTextbox").disabled = (!checked || disabled);
+			document.getElementById("mcPubmedCentralSubstitutionTokensPMIDTextbox").disabled = (!checked || disabled);
+			document.getElementById("mcPubmedCentralSubstitutionTokensSOTextbox").disabled = (!checked || disabled);
+			document.getElementById("mcPubmedCentralSubstitutionText").disabled = (!checked || disabled);
+		}
+
+		function _pubmedcentralSubstitutionTextChange(aEvent){
+			nsPreferences.setUnicharPref("wiredmarker.pubmedcentral.capture.substitution.format", aEvent.target.value);
+		}
+
+		window.addEventListener("load", _pubmedcentralDialogOverlayInit, false);
+		window.addEventListener("unload", _pubmedcentralDialogOverlayDone, false);
+	]]>
+	</script>
+	<tabbox id="mcSettingTabbox">
+		<tabpanels id="mcSettingTabPanels">
+			<tabbox id="mcMenuTabbox">
+				<tabs id="mcMenuTabs">
+					<tab id="mcPubmedCentralTab" label="&markingcollection.setting.pubmedcentral;" image="chrome://markingcollection/skin/PMC.png"/>
+				</tabs>
+				<tabpanels id="mcMenuTabPanels">
+					<tabpanel id="mcPubmedCentralTabPanel" orient="vertical" flex="1">
+						<groupbox id="mcPubmedCentralTabGroupBox">
+							<caption label="&meta.dialog.pubmedcentral.pdf.groupbox.caption;" style="background-color:#fff;"/>
+							<checkbox id="mcPubmedCentralConfirm" label="&meta.dialog.pubmedcentral.pdf.capture.checkbox.confirm;" oncommand="_pubmedcentralConfirmCommand(event)"/>
+							<checkbox id="mcPubmedCentralSubstitution" label="&meta.dialog.pubmedcentral.pdf.substitution.checkbox.confirm;" oncommand="_pubmedcentralSubstitutionCommand(event)"/>
+							<hbox>
+								<groupbox id="mcPubmedCentralSubstitutionTokensGroupBox" flex="1">
+									<caption label="Tokes of MEDLINE:" style="background-color:#fff;"/>
+									<grid>
+										<columns>
+											<column />
+											<column flex="1"/>
+											<column />
+											<column flex="1"/>
+										</columns>
+										<rows>
+											<row align="center">
+												<hbox flex="1" pack="end">
+													<label value="PubMed Central ID:" style="color:#666;" />
+												</hbox>
+												<textbox id="mcPubmedCentralSubstitutionTokensPMCIDTextbox" readonly="true" size="7" onfocus="this.select()" value="MEDLINE.PMCID"/>
+												<hbox flex="1" pack="end">
+													<label value="PubMed ID:" style="color:#666;" />
+												</hbox>
+												<textbox id="mcPubmedCentralSubstitutionTokensPMIDTextbox" readonly="true" size="7" onfocus="this.select()" value="MEDLINE.PMID"/>
+											</row>
+											<row align="center">
+											</row>
+											<row align="center">
+												<label/>
+												<label/>
+												<hbox flex="1" pack="end">
+													<label value="Source:" style="color:#666;" />
+												</hbox>
+												<textbox id="mcPubmedCentralSubstitutionTokensSOTextbox" readonly="true" size="7" onfocus="this.select()" value="MEDLINE.SO"/>
+											</row>
+										</rows>
+									</grid>
+								</groupbox>
+							</hbox>
+							<hbox align="center">
+								<label   id="mcPubmedCentralSubstitutionLabel" value="Format :"/>
+								<textbox id="mcPubmedCentralSubstitutionText"  value="" flex="1" onchange="_pubmedcentralSubstitutionTextChange(event)"/>
+							</hbox>
+						</groupbox>
+					</tabpanel>
+				</tabpanels>
+			</tabbox>
+		</tabpanels>
+	</tabbox>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/removeDialog.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/removeDialog.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/removeDialog.js	(revision 5703)
@@ -0,0 +1,69 @@
+var removeDialog = {
+
+/////////////////////////////////////////////////////////////////////
+	get STRING()     { return document.getElementById("removeDialogString"); },
+	get DataSource() { return window.opener.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.opener.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.opener.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.opener.top.bitsObjectMng.Database;   },
+	get gBrowser()   { return window.opener.top.bitsObjectMng.getBrowser();},
+
+	get DIALOG()     { return document.getElementById("removeDialog"); },
+	get LIST()       { return document.getElementById("removeList"); },
+
+/////////////////////////////////////////////////////////////////////
+	init : function(){
+		if(removeDialog._init) return;
+
+		try {
+			this.info = window.arguments[0];
+
+			if(this.info.title) document.title = this.info.title;
+
+			this.LIST.suppressonselect = true;
+			if(this.info.list){
+				for(var i=0;i<this.info.list.length;i++){
+					this.LIST.appendItem(unescape(this.info.list[i].leafName) , this.Common.convertFilePathToURL(this.info.list[i].path));
+				}
+			}
+			this.LIST.currentIndex = -1;
+			this.LIST.clearSelection();
+			this.LIST.suppressonselect = false;
+
+			this._init = true;
+		}catch(ex){
+			this.Common.alert("removeDialog.init():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(event){
+		if(this._init){
+			this._init = false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	commandList : function(aEvent){
+		if(this.LIST.currentIndex>=0) this.DIALOG.removeAttribute("buttondisabledaccept");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	accept : function(aEvent){
+		window.arguments[0].accept = true;
+		for(var i=this.LIST.selectedItems.length-1;i>=0;i--){
+			var aFile = this.Common.convertURLToFile(this.LIST.selectedItems[i].value);
+			if(aFile && aFile.exists()) aFile.remove(true);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	cancel : function(aEvent){
+		window.arguments[0].accept = false;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		if(nsPreferences.getBoolPref("wiredmarker.debug", false)) window.dump(aString+"\n");
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/removeDialog.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/removeDialog.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/removeDialog.xul	(revision 5703)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<dialog
+	id="removeDialog"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml"
+	buttons="accept,cancel"
+	buttonlabelaccept="&markingcollection.templateFolder.remove;"
+	defaultButton="cancel"
+	buttondisabledaccept="true"
+	onload="removeDialog.init(event);"
+	ondialogaccept="removeDialog.accept(event);"
+	ondialogcancel="removeDialog.cancel(event);">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/removeDialog.js" />
+	<stringbundleset id="spmStringBundles">
+		<stringbundle id="removeDialogString" src="chrome://markingcollection/locale/markingcollection.properties" />
+	</stringbundleset>
+	<listbox id="removeList" seltype="multiple" onselect="removeDialog.commandList(event);"/>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/replacedURL.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/replacedURL.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/replacedURL.js	(revision 5703)
@@ -0,0 +1,199 @@
+var mcReplacedURL = {
+
+	get STRING()     { return document.getElementById("mcRepString"); },
+	get SEARCHLIST() { return document.getElementById("mcRepSearchMenulist"); },
+	get REPLACETEXT(){ return document.getElementById("mcRepReplaceTextbox"); },
+	get ACCEPTBTN()  { return document.getElementById("mcRepDialog").getButton("accept"); },
+	get REPLACEBTN() { return document.getElementById("mcRepReplaceButton"); },
+	get REPLACETAR() { return document.getElementById("mcRepTargetDirectory"); },
+
+	get DataSource() { return window.opener.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.opener.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.opener.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.opener.top.bitsObjectMng.Database;   },
+	get XML()        { return window.opener.top.bitsObjectMng.XML;        },
+	get gBrowser()   { return window.opener.top.bitsObjectMng.getBrowser();},
+
+	item     : null,
+	resource : null,
+	property : "",
+	changed  : false,
+
+	init : function(){
+		this.item = window.arguments[0];
+		this.resource = this.item.res;
+		this.list = this.item.list;
+		this.objArr = [];
+		this.id2changed = [];
+		var dbtype = this.DataSource.getProperty(this.resource, "dbtype");
+		var i;
+		for(i=0;i<this.list.length;i++){
+			this.objArr.push(this.list[i]);
+			this.id2changed[this.list[i].oid] = false;
+		}
+		this.remakeList();
+		var title = this.STRING.getString("REPLACED_URL");
+		document.title = title + " [ " + this.DataSource.getProperty(this.resource, "title") + " ]";
+    window.sizeToContent();
+		var width = window.opener.top.innerWidth - 50;
+		window.resizeTo(width,window.outerHeight);
+		if(this.ACCEPTBTN)  this.ACCEPTBTN.setAttribute("disabled","true");
+		if(this.REPLACEBTN) this.REPLACEBTN.setAttribute("disabled","true");
+	},
+
+	remakeList : function(){
+		var i,key;
+		var hash = [];
+		var aURI;
+		var aURL;
+		for(i=0;i<this.objArr.length;i++){
+			var uri = this.objArr[i].doc_url;
+			if(this.REPLACETAR.selected){
+				aURI = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURI);
+				aURI.spec = uri;
+				aURL = aURI.QueryInterface(Components.interfaces.nsIURL);
+				uri = aURL.prePath+aURL.directory;
+			}
+			hash[uri] = "";
+		}
+		var arr = [];
+		for(key in hash){
+			if(typeof hash[key] == "function") continue;
+			arr.push(key);
+		}
+		arr.sort();
+		this.SEARCHLIST.removeAllItems();
+		this.SEARCHLIST.value = "";
+		for(i=0;i<arr.length;i++){
+			this.SEARCHLIST.appendItem(arr[i],"","");
+		}
+	},
+
+	changeTarget : function(){
+		this.remakeList();
+	},
+
+	change : function(){
+		var searched_text = this.SEARCHLIST.value;
+		var replaced_text = this.REPLACETEXT.value;
+		if(!searched_text || searched_text == "" || !replaced_text || replaced_text == ""){
+			this.REPLACEBTN.setAttribute("disabled","true");
+		}else{
+			this.REPLACEBTN.removeAttribute("disabled");
+		}
+	},
+
+	displayURL : function(){
+		var uri = this.gBrowser.contentDocument.location.href;
+		if(this.REPLACETAR.selected){
+			var aURI = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURI);
+			aURI.spec = uri;
+			var aURL = aURI.QueryInterface(Components.interfaces.nsIURL);
+			uri = aURL.prePath+aURL.directory;
+		}
+		this.REPLACETEXT.value = uri;
+		this.change();
+	},
+
+	folderURL : function(){
+		var folder = this.getFolder();
+		if(!folder) return;
+		this.REPLACETEXT.value = this.Common.convertFilePathToURL(folder.path);
+		this.change();
+	},
+
+	getFolder : function (){
+		var picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
+		var result = null;
+		try{
+			picker.init(window, "Selected Folder", picker.modeGetFolder);
+			var showResult = picker.show();
+			if(showResult == picker.returnOK){
+				result = picker.file;
+			}else if(showResult == picker.returnReplace){
+				if(picker.file.exists()) picker.file.remove(false);
+				result = picker.file;
+			}
+		}catch(e){
+			result = null;
+		}
+		return result;
+	},
+
+	replaced : function(){
+		var searched_text = this.SEARCHLIST.value;
+		var replaced_text = this.REPLACETEXT.value;
+		if(!searched_text || searched_text == "") return;
+		var replacedNum = 0;
+		var i;
+		for(i=0;i<this.objArr.length;i++){
+			if(this.objArr[i].doc_url.indexOf(searched_text)>=0){
+				replacedNum++;
+			}else if(this.objArr[i].con_url.indexOf(searched_text)>=0){
+				replacedNum++;
+			}
+		}
+		if(replacedNum==0){
+			this.Common.alert(this.STRING.getString("ALERT_REPLACED_URL"),undefined,window);
+			return;
+		}
+		var title = this.STRING.getString("CONFIRM_REPLACED_URL");
+		if(!this.Common.confirm("[ "+replacedNum + " ] " + title,undefined,undefined,undefined,undefined,window)) return;
+		var parser = new DOMParser();
+		var s = new XMLSerializer();
+		for(i=0;i<this.objArr.length;i++){
+			if(this.objArr[i].doc_url.indexOf(searched_text)>=0){
+				this.objArr[i].doc_url = this.objArr[i].doc_url.replace(searched_text, replaced_text);
+				this.id2changed[this.objArr[i].oid] = true;
+			}
+			if(this.objArr[i].con_url.indexOf(searched_text)>=0){
+				this.objArr[i].con_url = this.objArr[i].con_url.replace(searched_text, replaced_text);
+				this.id2changed[this.objArr[i].oid] = true;
+			}
+			if(this.objArr[i].oid_property){
+				try{ var xmldoc = parser.parseFromString(this.objArr[i].oid_property,"text/xml"); }catch(e){xmldoc = null; }
+				if(xmldoc && xmldoc.documentElement){
+					var xmlnode = xmldoc.getElementsByTagName("HYPER_ANCHOR")[0];
+					if(xmlnode && xmlnode.textContent.indexOf(searched_text)>=0){
+						var hyperAnchor = xmlnode.textContent;
+						while(xmlnode.hasChildNodes()){
+							xmlnode.removeChild(xmlnode.lastChild);
+						}
+						hyperAnchor = hyperAnchor.replace(searched_text, replaced_text);
+						xmlnode.appendChild(xmldoc.createTextNode(hyperAnchor));
+						this.objArr[i].oid_property = s.serializeToString(xmldoc);
+					}
+				}
+			}
+			this.changed |= this.id2changed[this.objArr[i].oid];
+		}
+		s = undefined;
+		parser = undefined;
+		if(this.changed && this.ACCEPTBTN) this.ACCEPTBTN.removeAttribute("disabled");
+		this.remakeList();
+	},
+
+	accept : function(){
+		var rtnArr = [];
+		var i;
+		for(i=0;i<this.objArr.length;i++){
+			if(!this.id2changed[this.objArr[i].oid]) continue;
+			rtnArr.push(this.objArr[i]);
+		}
+		if(window.arguments[0]){
+			if(rtnArr.length>0) window.arguments[0].objArr = rtnArr;
+			window.arguments[0].accept = this.changed;
+			if(window.arguments[0].callback) window.arguments[0].callback(window.arguments[0]);
+		}
+	},
+
+	cancel : function(){
+		if(window.arguments[0]) window.arguments[0].accept = false;
+	},
+};
+
+
+function _dump(aString){
+	window.opener.top.bitsMarkingCollection._dump(aString);
+}
+
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/replacedURL.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/replacedURL.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/replacedURL.xul	(revision 5703)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<!DOCTYPE window SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<dialog
+	id="mcRepDialog"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	buttons="accept,cancel,extra1"
+	defaultButton="extra1"
+	onload="mcReplacedURL.init();"
+	ondialogaccept="mcReplacedURL.accept();"
+	ondialogcancel="mcReplacedURL.cancel();">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/replacedURL.js" />
+	<stringbundleset id="mcStringBundles">
+		<stringbundle id="mcRepString" src="chrome://markingcollection/locale/markingcollection.properties" />
+	</stringbundleset>
+	<groupbox flex="1">
+		<grid>
+			<columns>
+				<column/>
+				<column flex="1"/>
+			</columns>
+			<rows>
+				<row>
+					<label value="&markingcollection.edit.replacedTarget;"/>
+					<radiogroup id="mcRepTarget" orient="horizontal" oncommand="mcReplacedURL.changeTarget()">
+						<radio id="mcRepTargetDirectory" label="&markingcollection.edit.replacedTarget.directory;" selected="true"/>
+						<radio id="mcRepTargetFile" label="&markingcollection.edit.replacedTarget.file;"/>
+					</radiogroup>
+				</row>
+				<separator class="groove-thin"/>
+				<row>
+					<label control="mcRepSearchMenulist" value="&markingcollection.edit.searched;:"/>
+					<menulist id="mcRepSearchMenulist" editable="true" flex="1" onfocus="this.select()" oninput="mcReplacedURL.change()" oncommand="mcReplacedURL.change()">
+						<menupopup/>
+					</menulist>
+				</row>
+				<row>
+					<label control="mcRepReplaceTextbox" value="&markingcollection.edit.replaced;:"/>
+					<hbox>
+						<textbox id="mcRepReplaceTextbox" value="" flex="1" onfocus="this.select()" oninput="mcReplacedURL.change()"/>
+						<toolbarbutton type="menu" label="&markingcollection.edit.getURL;">
+							<menupopup>
+								<menuitem label="&markingcollection.edit.displayURL;" class="menuitem-iconic" image="chrome://markingcollection/skin/firefox.png" oncommand="mcReplacedURL.displayURL();"/>
+								<menuitem label="&markingcollection.edit.folderURL;" class="menuitem-iconic" image="chrome://markingcollection/skin/folder-close.png" oncommand="mcReplacedURL.folderURL();"/>
+							</menupopup>
+						</toolbarbutton>
+					</hbox>
+				</row>
+				<row>
+					<spacer/>
+					<hbox>
+					<spacer flex="1"/>
+						<button id="mcRepReplaceButton" label="&markingcollection.edit.replaced;" dlgtype="extra1" oncommand="mcReplacedURL.replaced();"/>
+					</hbox>
+				</row>
+			</rows>
+		</grid>
+	</groupbox>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/repository.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/repository.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/repository.js	(revision 5703)
@@ -0,0 +1,886 @@
+var mcRepository = {
+
+	_passwd : "",
+
+	get SIDEBAR() { return window.top.document.getElementById("sidebar"); },
+	get BUTTON()  { return document.getElementById("mcToolbarRepositorySettingButton"); },
+	get POPUP()   { return document.getElementById("mcPopup"); },
+
+	get PATH()    { return document.getElementById("mcRepositoryPath"); },
+	get USER()    { return document.getElementById("mcRepositoryUser"); },
+	get PASSWD()  { return document.getElementById("mcRepositoryPassword"); },
+	get PASSWDL() { return document.getElementById("mcRepositoryPasswordLabel"); },
+
+	get top(){
+		if(window.opener){
+			return window.opener.top;
+		}else if(window.top){
+			return window.top;
+		}else{
+			return null;
+		}
+	},
+	get DataSource() { return mcRepository.top.bitsObjectMng.DataSource; },
+	get Common()     { return mcRepository.top.bitsObjectMng.Common;     },
+	get Database()   { return mcRepository.top.bitsObjectMng.Database;   },
+
+	get mcMainService(){
+		if(window.opener){
+			return window.opener.mcMainService;
+		}else{
+			return mcMainService;
+		}
+	},
+
+	get isChecked() {
+		var aMode = mcRepository.Mode;
+		var path = nsPreferences.copyUnicharPref("markingcollection.dbpath."+aMode, "");
+		var user = nsPreferences.copyUnicharPref("markingcollection.repository.user", "");
+		return (path!="" && user != "");
+	},
+
+	get Mode(){
+		return this.Database._repositoryMode;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	init : function(){
+		this._passwd = "";
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(){
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onload : function(){
+		var aMode = mcRepository.Mode;
+		var path = nsPreferences.copyUnicharPref("markingcollection.dbpath."+aMode, "");
+		mcRepository.PATH.value = path;
+		var user = nsPreferences.copyUnicharPref("markingcollection.repository.user", "");
+		mcRepository.USER.value = user;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onunload : function(){
+		return;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	ondialogaccept : function(){
+		if(mcRepository.PATH.value != ""){
+			var aDir = mcRepository.getNsILocalFile(mcRepository.PATH.value);
+			if(!aDir || !aDir.exists()){
+				if(window.arguments[0]) window.arguments[0].accept = false;
+				return false;
+			}
+		}
+		var aMode = mcRepository.Mode;
+		nsPreferences.setUnicharPref("markingcollection.dbpath."+aMode  , mcRepository.PATH.value);
+		nsPreferences.setUnicharPref("markingcollection.repository.user", mcRepository.USER.value);
+		if(window.arguments[0]) window.arguments[0].accept = true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	ondialogcancel : function(){
+		if(window.arguments[0]) window.arguments[0].accept = false;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getNsILocalFile : function(aPath){
+		var aFile = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
+		if(aFile) aFile.initWithPath(aPath);
+		return aFile;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	commandRepositorySetting : function(aEvent){
+		var result = {};
+		window.openDialog("chrome://markingcollection/content/repositorysetting.xul", "", "chrome,centerscreen,modal", result);
+		aEvent.stopPropagation();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	commandRepositoryMerge : function(aEvent){
+		aEvent.stopPropagation();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	commandChangedRepository : function(aEvent){
+		var checked = this.getRepositoryPath(aEvent);
+		if(checked){
+			var aMode = mcRepository.Mode;
+			var path = nsPreferences.copyUnicharPref("markingcollection.dbpath."+aMode, "");
+			mcRepository.PATH.value = path;
+		}
+		aEvent.stopPropagation();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getRepositoryPath : function(aEvent){
+		var picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
+		var result = false;
+		try{
+			var picker_title = mcRepository.mcMainService.STRING.getString("SELECTED_REPOSITORY_FOLDER");
+			picker.init(window, picker_title, picker.modeGetFolder);
+			var showResult = picker.show();
+			if(showResult == picker.returnOK){
+				var aMode = mcRepository.Mode;
+				nsPreferences.setUnicharPref("markingcollection.dbpath."+aMode, picker.file.path);
+				result = true;
+			}
+		}catch(e){
+			result = false;
+			this.Common.alert(e);
+		}
+		return result;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	popupshowing : function(aEvent){
+		if(aEvent.originalTarget.localName != "popup") return;
+		var res = mcTreeHandler.resource;
+		if(!res){ aEvent.preventDefault(); return; }
+		var type   = mcRepository.DataSource.getProperty(res,"type");
+		var dbtype = mcRepository.DataSource.getProperty(res,"dbtype");
+		var contFolderList = [];
+		var contItemList = [];
+		if(type.indexOf("folder")>=0){
+			contFolderList = mcRepository.DataSource.flattenResources(res, 1, false);
+			contItemList = mcRepository.DataSource.flattenResources(res, 2, true);
+		}
+		try{
+			document.getElementById("mcPopupMergeContents").hidden    =  type.indexOf("folder")>=0 ;
+			document.getElementById("mcPopupMerges").hidden           =  type=="item";
+			document.getElementById("mcPopupMergeAllFolder").hidden   =  type=="item" || contFolderList.length<=1 || mcRepository.Database._defaultMode != dbtype;
+			document.getElementById("mcPopupMergeFolder").hidden      =  type!="folder";
+			document.getElementById("mcPopupMergeAllContents").hidden =  contItemList.length==0;
+		}catch(ex){
+			mcRepository._dump("mcRepository.popupshowing():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	lockRepository : function(){
+		try{
+			var path = nsPreferences.copyUnicharPref("markingcollection.dbpath."+this.Mode, "");
+			var user = nsPreferences.copyUnicharPref("markingcollection.repository.user", "");
+			if(path == "") return false;
+			var dbLockFile = this.Common.convertPathToFile(path);
+			dbLockFile.append(".repository.lock");
+			if(!dbLockFile.exists()){
+				try{
+					dbLockFile.create(dbLockFile.DIRECTORY_TYPE, 0700);
+					this.logFile = this.Common.convertPathToFile(path);
+					this.logFile.append(".repository.log");
+					if(this.logFile.exists()){
+						this.logContent = this.Common.readFile(this.logFile);
+					}else{
+						this.logContent = "";
+					}
+					this.logContent += "["+this.Common.getTimeStamp()+"]:LOCK:"+user+"\n";
+					return true;
+				}catch(ex2){
+					bitsObjectMng._dump("mcRepository.lockRepository():"+ex2);
+					return false;
+				}
+			}
+		}catch(ex){
+			mcRepository._dump("mcRepository.lockRepository():"+ex);
+			return false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	unlockRepository : function(){
+		try{
+			var path = nsPreferences.copyUnicharPref("markingcollection.dbpath."+this.Mode, "");
+			var user = nsPreferences.copyUnicharPref("markingcollection.repository.user", "");
+			if(path == "") return false;
+			var dbLockFile = mcRepository.Common.convertPathToFile(path);
+			dbLockFile.append(".repository.lock");
+			if(dbLockFile.exists()){
+				try{
+					this.logContent += "["+this.Common.getTimeStamp()+"]:UNLOCK:"+user+"\n";
+					var tmpArr = this.logContent.split("\n");
+					if(tmpArr.length>1000){
+						this.logContent = tmpArr.slice(tmpArr.length-1000-1).join("\n");
+					}
+					this.Common.writeFile(this.logFile,this.logContent,"UTF-8");
+					dbLockFile.remove(true);
+				}catch(ex2){
+					bitsObjectMng._dump("mcRepository.unlockRepository():"+ex2);
+					return false;
+				}
+				return true;
+			}else{
+				return false;
+			}
+		}catch(ex){
+			mcRepository._dump("mcRepository.unlockRepository():"+ex);
+			return false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	confirm : function(aString){
+		var res = mcTreeHandler.resource;
+		if(!res) return false;
+		var title = mcRepository.DataSource.getProperty(res,"title");
+		if(!this.Common.confirm(mcRepository.mcMainService.STRING.getString(aString) + "[ " + title + " ]")) return false;
+		return true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	initRepository : function(){
+		if(!this.lockRepository()){
+			var path = nsPreferences.copyUnicharPref("markingcollection.dbpath."+this.Mode, "");
+			if(path != ""){
+				var logFile = this.Common.convertPathToFile(path);
+				logFile.append(".repository.log");
+				var logContent = "";
+				if(logFile.exists()){
+					logContent = this.Common.readFile(logFile);
+				}
+			}
+			this.Common.alert(mcRepository.mcMainService.STRING.getString("BUSY_REPOSITORY"));
+			return false;
+		}
+		this.Database.init(this.Mode);
+		return true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	endRepository : function(){
+		this.Database.done(this.Mode);
+		this.unlockRepository();
+		return true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	mergeObjectExec : function(aRes,aParRes,aParTitle){
+		if(!aRes) return false;
+		if(!this.title2fid[aParTitle]) return false;
+		var pfid = this.DataSource.getProperty(aParRes,"id");
+		var oid = this.DataSource.getProperty(aRes,"id");
+		var dbtype = this.DataSource.getProperty(aRes,"dbtype");
+		var objects = this.Database.getObject({oid:oid,pfid:pfid},dbtype);
+		if(!objects) return false;
+		var rtnObject = this.existsRepositoryObject(objects[0]);
+		if(rtnObject){
+			this.updateRepositoryObject(objects[0],rtnObject,aParTitle);
+		}else{
+			this.addRepositoryObject(objects[0],aParTitle);
+		}
+		return true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	mergeFolderExec : function(aRes,aParTitle){
+		if(!aRes) return false;
+		var fid = this.DataSource.getProperty(aRes,"id");
+		var dbtype = this.DataSource.getProperty(aRes,"dbtype");
+		var title = this.DataSource.getProperty(aRes,"title");
+		var folders = this.Database.getFolderFormID(fid,dbtype);
+		if(!folders) return false;
+		var aResTitle = aParTitle + "\t" + folders[0].fid_title;
+		aResTitle = aResTitle.replace(/^\s*/img,"");
+		if(this.title2fid[aResTitle]){
+			this.updateRepositoryFolder(folders[0],aResTitle);
+			if(this.confirmRepositoryDeleteFolder(aRes,aParTitle,aResTitle) || this.confirmRepositoryDeleteObject(aRes,aParTitle,aResTitle)) this.getRepository();
+		}else{
+			this.addRepositoryFolder(folders[0],aParTitle);
+		}
+		var i;
+		var contFolderList = this.DataSource.flattenResources(aRes, 1, false);
+		for(i=0;i<contFolderList.length;i++){
+			if(contFolderList[i].Value == aRes.Value) continue;
+			this.mergeFolderExec(contFolderList[i],aResTitle);
+		}
+		var contItemList = this.DataSource.flattenResources(aRes, 2, false);
+		for(i=0;i<contItemList.length;i++){
+			this.mergeObjectExec(contItemList[i],aRes,aResTitle);
+		}
+		return true;
+	},
+
+
+/////////////////////////////////////////////////////////////////////
+	merge : function(aEvent){
+		if(!this.isChecked){
+			this.commandRepositorySetting(aEvent);
+			if(!this.isChecked) return;
+		}
+		if(!this.confirm("CONFIRM_REPOSITORY_MERGE")) return;
+		this._dump("mcRepository.merge()");
+		if(!this.initRepository()) return false;
+		if(!this.getRepository()){
+			this.endRepository();
+			this.Common.alert("err!!");
+			return;
+		}
+		var res = mcTreeHandler.resource;
+		if(!res) return false;
+		var parRes = null;
+		if(this.DataSource.isContainer(res)){
+			parRes = res;
+		}else{
+			parRes = this.DataSource.findParentResource(res);
+		}
+		var merRes = parRes;
+		var merFolder = [];
+		var fid = "";
+		while(1){
+			fid = this.DataSource.getProperty(merRes, "id");
+			if(fid == "0") break;
+			merFolder.push(merRes);
+			merRes = this.DataSource.findParentResource(merRes);
+		}
+		var parTitle = "";
+		var merTitle = "";
+		if(merFolder.length > 0){
+			var pfid;
+			var dbtype;
+			var i;
+			for(i=merFolder.length-1;i>=0;i--){
+				fid = this.DataSource.getProperty(merFolder[i], "id");
+				dbtype = this.DataSource.getProperty(merFolder[i], "dbtype");
+				var folders = this.Database.getFolderFormID(fid,dbtype);
+				if(!folders) continue;
+				parTitle = merTitle;
+				merTitle += "\t" + folders[0].fid_title;
+				merTitle = merTitle.replace(/^\s*/img,"");
+				if(this.title2fid[merTitle]) continue;
+				this.addRepositoryFolder(folders[0],parTitle);
+			}
+		}
+		if(this.DataSource.isContainer(res)){
+			if(merFolder.length > 0 && parRes.Value == res.Value){
+				this.mergeFolderExec(parRes,parTitle);
+			}else{
+				if(this.confirmRepositoryDeleteFolder(parRes,parTitle,merTitle)) this.getRepository();
+				var contFolderList = this.DataSource.flattenResources(parRes, 1, false);
+				var i;
+				for(i=0;i<contFolderList.length;i++){
+					if(contFolderList[i].Value == parRes.Value) continue;
+					this.mergeFolderExec(contFolderList[i],merTitle);
+				}
+			}
+		}else{
+			this.mergeObjectExec(res,parRes,merTitle);
+		}
+		this.endRepository();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	importObjectExec : function(aOID,aFID,aImpTitle,dbtype){
+		if(aOID == undefined) return false;
+		if(aFID == undefined) return false;
+		if(aImpTitle == undefined) return false;
+		if(dbtype == undefined) return false;
+		if(!this.title2fid[aImpTitle]) return false;
+		var objects = this.Database.getObject({oid:aOID,pfid:aFID},dbtype);
+		if(!objects) return false;
+		var rtnObject = this.existsRepositoryObject(objects[0]);
+		if(rtnObject){
+			if(rtnObject.oid_title    != objects[0].oid_title ||
+				 rtnObject.oid_property != objects[0].oid_property){
+				var dispTitle = "/" + aImpTitle.replace(/\t+/img,"/") + "/" + objects[0].oid_title;
+				if(this.Common.confirm(this.mcMainService.STRING.getString("CONFIRM_UPDATE_OBJECT") + "[ " + dispTitle + " ]")){
+					objects[0].oid_title = rtnObject.oid_title;
+					objects[0].oid_property = rtnObject.oid_property;
+					if(objects[0].dbtype) delete objects[0].dbtype;
+					if(objects[0].fid_style) delete objects[0].fid_style;
+					this.Database.updateObject(objects[0],dbtype);
+				}
+			}
+		}
+		return true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	importFolderExec : function(aFldID,aFldTitle,aDBType){
+		if(!aFldID) return false;
+		if(!this.title2fid[aFldTitle] && aFldTitle != "") return false;
+		if(this.title2fid[aFldTitle] && this.om_folder_hash[this.title2fid[aFldTitle]]){
+			var folders = this.Database.getFolderFormID(aFldID,aDBType);
+			if(folders){
+				if(this.om_folder_hash[this.title2fid[aFldTitle]].fid_property != folders[0].fid_property ||
+					 this.om_folder_hash[this.title2fid[aFldTitle]].fid_style    != folders[0].fid_style){
+					var dispTitle = "/" + aFldTitle.replace(/\t+/img,"/");
+					if(this.Common.confirm(this.mcMainService.STRING.getString("CONFIRM_UPDATE_FOLDER") + "[ " + dispTitle + " ]1")){
+						folders[0].fid_property = this.om_folder_hash[this.title2fid[aFldTitle]].fid_property;
+						folders[0].fid_style = this.om_folder_hash[this.title2fid[aFldTitle]].fid_style;
+						if(folders[0].dbtype) delete folders[0].dbtype;
+						this.Database.updateFolder(folders[0],aDBType);
+					}
+				}
+			}
+		}
+		if(this.pfid2fid[aFldID] && this.pfid2fid[aFldID].length>0){
+			var folders = this.Database.getFolderFormPID(aFldID,aDBType);
+			var i,j,fid;
+			for(i=0;i<this.pfid2fid[aFldID].length;i++){
+				fid = this.pfid2fid[aFldID][i];
+				var folder = null;
+				if(folders){
+					for(j=0;j<folders.length;j++){
+						var fldTitle = aFldTitle + "\t" + folders[j].fid_title;
+						fldTitle = fldTitle.replace(/^\s*/img,"");
+						if(!this.title2fid[fldTitle] || this.title2fid[fldTitle] != fid) continue;
+						folder = folders[j];
+						break;
+					}
+				}
+				if(folder){
+					if(this.om_folder_hash[fid].fid_property != folder.fid_property ||
+						 this.om_folder_hash[fid].fid_style    != folder.fid_style){
+						var dispTitle = "/" + aFldTitle.replace(/\t+/img,"/") + "/" + folder.fid_title;
+						if(this.Common.confirm(this.mcMainService.STRING.getString("CONFIRM_UPDATE_FOLDER") + "[ " + dispTitle + " ]2")){
+							folder.fid_property = this.om_folder_hash[fid].fid_property;
+							folder.fid_style = this.om_folder_hash[fid].fid_style;
+							if(folder.dbtype) delete folder.dbtype;
+							this.Database.updateFolder(folder,aDBType);
+						}
+					}
+				}else{
+					folder = this.om_folder_hash[fid];
+					folder.fid = this.Database._fidIdentify(aDBType,folder.fid);
+					folder.pfid = aFldID;
+					this.Database.addFolder(folder,aDBType);
+				}
+				var fldTitle = aFldTitle + "\t" + folder.fid_title;
+				fldTitle = fldTitle.replace(/^\s*/img,"");
+				this.importFolderExec(folder.fid,fldTitle,aDBType);
+			}
+		}
+		if(this.pfid2oid[aFldID] && this.pfid2oid[aFldID].length>0){
+			var objects = this.Database.getObjectFormPID(aFldID,aDBType);
+			var i,j,oid;
+			for(i=0;i<this.pfid2oid[aFldID].length;i++){
+				oid = this.pfid2oid[aFldID][i];
+				var object = null;
+				if(objects){
+					for(j=0;j<objects.length;j++){
+
+						if(
+							this.om_object_hash[oid].doc_url  != objects[j].doc_url ||
+							this.om_object_hash[oid].con_url  != objects[j].con_url ||
+							this.om_object_hash[oid].bgn_dom  != objects[j].bgn_dom ||
+							this.om_object_hash[oid].end_dom  != objects[j].end_dom ||
+							this.om_object_hash[oid].oid_type != objects[j].oid_type
+						) continue;
+
+						object = objects[j];
+						break;
+					}
+				}
+				if(object){
+					if(this.om_object_hash[oid].oid_title    != object.oid_title ||
+						 this.om_object_hash[oid].oid_property != object.oid_property){
+						var dispTitle = "/" + aFldTitle.replace(/\t+/img,"/") + "/" + object.oid_title;
+						if(this.Common.confirm(this.mcMainService.STRING.getString("CONFIRM_UPDATE_OBJECT") + "[ " + dispTitle + " ]")){
+							object.oid_title = this.om_object_hash[oid].oid_title;
+							object.oid_property = this.om_object_hash[oid].oid_property;
+							if(object.dbtype) delete object.dbtype;
+							if(object.fid_style) delete object.fid_style;
+							this.Database.updateObject(object,aDBType);
+						}
+					}
+				}else{
+					object = this.om_object_hash[oid];
+					object.oid = this.Database._oidIdentify(aDBType,object.oid);
+					object.pfid = aFldID;
+					this.Database.addObject(object,aDBType);
+					var blob = this.Database.getObjectBLOB(oid,this.Mode);
+					if(blob && blob.length>0 && blob[0].length>0){
+						this.Database.updateObjectBLOB(oid,blob[0],aDBType);
+					}
+				}
+			}
+		}
+		return true;
+	},
+
+
+/////////////////////////////////////////////////////////////////////
+	import : function(aEvent){
+		if(!this.isChecked){
+			this.commandRepositorySetting(aEvent);
+			if(!this.isChecked) return;
+		}
+		if(!this.confirm("CONFIRM_REPOSITORY_IMPOER")) return;
+		this._dump("mcRepository.import()");
+		if(!this.initRepository()) return false;
+		if(!this.getRepository()){
+			this.Common.alert("err!!");
+			return;
+		}
+		var res = mcTreeHandler.resource;
+		if(!res) return false;
+		var parRes = null;
+		if(this.DataSource.isContainer(res)){
+			parRes = res;
+		}else{
+			parRes = this.DataSource.findParentResource(res);
+		}
+		var impRes = parRes;
+		var impFolder = [];
+		var fid = "";
+		while(1){
+			fid = this.DataSource.getProperty(impRes, "id");
+			if(fid == "0") break;
+			impFolder.push(impRes);
+			impRes = this.DataSource.findParentResource(impRes);
+		}
+		var impTitle = "";
+		if(impFolder.length > 0){
+			var pfid;
+			var dbtype;
+			var i;
+			for(i=impFolder.length-1;i>=0;i--){
+				fid = this.DataSource.getProperty(impFolder[i], "id");
+				dbtype = this.DataSource.getProperty(impFolder[i], "dbtype");
+				var folders = this.Database.getFolderFormID(fid,dbtype);
+				if(!folders) continue;
+
+				impTitle += "\t" + folders[0].fid_title;
+				impTitle = impTitle.replace(/^\s*/img,"");
+			}
+		}
+		if(this.DataSource.isContainer(res)){
+			fid = this.DataSource.getProperty(res, "id");
+			var dbtype = this.DataSource.getProperty(res,"dbtype");
+			this.importFolderExec(fid.toString(),impTitle,dbtype);
+		}else{
+			fid = this.DataSource.getProperty(parRes, "id");
+			var oid = this.DataSource.getProperty(res, "id");
+			var dbtype = this.DataSource.getProperty(res,"dbtype");
+			this.importObjectExec(oid.toString(),fid.toString(),impTitle,dbtype);
+		}
+		this.endRepository();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getRepository : function(){
+		try{
+			var aMode = this.Mode;
+			if(!this.Database.beginTransaction(aMode)) return false;
+			var oSql = 'select * from om_object';
+			var lSql = 'select * from om_link';
+			var fSql = 'select * from om_folder';
+			var i;
+			this.om_object_hash = [];
+			this.om_folder_hash = [];
+			this.oid2pfid = [];
+			this.pfid2oid = [];
+			this.fid2pfid = [];
+			this.pfid2fid = [];
+			this.title2fid = [];
+			this.fid2title = [];
+			this.om_object = this.Database.select(aMode,oSql,false);
+			this.om_link = this.Database.select(aMode,lSql,false);
+			this.om_folder = this.Database.select(aMode,fSql,false);
+			if(this.om_link && this.om_link.length>0){
+				for(i=0;i<this.om_link.length;i++){
+					if(!this.oid2pfid[this.om_link[i].oid.toString()])  this.oid2pfid[this.om_link[i].oid.toString()] = [];
+					if(!this.pfid2oid[this.om_link[i].pfid.toString()]) this.pfid2oid[this.om_link[i].pfid.toString()] = [];
+					this.oid2pfid[this.om_link[i].oid.toString()].push(this.om_link[i].pfid);
+					this.pfid2oid[this.om_link[i].pfid.toString()].push(this.om_link[i].oid);
+				}
+			}
+			if(this.om_object && this.om_object.length>0){
+				for(i=0;i<this.om_object.length;i++){
+					this.om_object_hash[this.om_object[i].oid.toString()] = this.om_object[i];
+				}
+			}
+			if(this.om_folder && this.om_folder.length>0){
+				for(i=0;i<this.om_folder.length;i++){
+					this.om_folder_hash[this.om_folder[i].fid.toString()] = this.om_folder[i];
+					if(!this.fid2pfid[this.om_folder[i].fid.toString()])  this.fid2pfid[this.om_folder[i].fid.toString()] = [];
+					if(!this.pfid2fid[this.om_folder[i].pfid.toString()]) this.pfid2fid[this.om_folder[i].pfid.toString()] = [];
+					this.fid2pfid[this.om_folder[i].fid.toString()].push(this.om_folder[i].pfid);
+					this.pfid2fid[this.om_folder[i].pfid.toString()].push(this.om_folder[i].fid);
+				}
+				this.makeTitle2Folder("0");
+			}
+			this.Database.endTransaction(aMode);
+			return true;
+		}catch(ex){
+			try{ this.Database.endTransaction(aMode); }catch(ex2){}
+			mcRepository._dump("mcRepository.getRepository():"+ex);
+			return false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	makeTitle2Folder : function(aPFid){
+		var pfid = aPFid.toString();
+		if(!this.pfid2fid[pfid]) return;
+		var i;
+		for(i=0;i<this.pfid2fid[pfid].length;i++){
+			var title = "";
+			if(this.fid2title[pfid]) title = this.fid2title[pfid] + "\t";
+			var fid = this.pfid2fid[pfid][i].toString();
+			title += this.om_folder_hash[fid].fid_title;
+			this.fid2title[fid] = title;
+			this.title2fid[title] = fid;
+			this.makeTitle2Folder(fid);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	addRepositoryFolder : function(aFolder,aParTitle){
+		try{
+			var aMode = this.Mode;
+			var aTitle = aParTitle + "\t" + aFolder.fid_title;
+			aTitle = aTitle.replace(/^\s*/img,"");
+			var dispTitle = "/" + aTitle.replace(/\t+/img,"/");
+		if(!this.Common.confirm(this.mcMainService.STRING.getString("CONFIRM_REPOSITORY_ADD_FOLDER") + "[ " + dispTitle + " ]")) return false;
+			if(!this.Database.beginTransaction(aMode)) return false;
+			aFolder.fid = this.Database._fidIdentify(aMode,aFolder.fid,false);
+			if(this.title2fid[aParTitle]){
+				aFolder.pfid = this.title2fid[aParTitle];
+			}else{
+				aFolder.pfid = "0";
+			}
+			if(aFolder.dbtype) delete aFolder.dbtype;
+			this.Database.addFolder(aFolder,aMode,false);
+			this.om_folder_hash[aFolder.fid.toString()] = aFolder;
+			if(!this.fid2pfid[aFolder.fid.toString()])  this.fid2pfid[aFolder.fid.toString()] = [];
+			if(!this.pfid2fid[aFolder.pfid.toString()]) this.pfid2fid[aFolder.pfid.toString()] = [];
+			this.fid2pfid[aFolder.fid.toString()].push(aFolder.pfid);
+			this.pfid2fid[aFolder.pfid.toString()].push(aFolder.fid);
+			this.fid2title[aFolder.fid.toString()] = aTitle;
+			this.title2fid[aTitle] = aFolder.fid;
+			this.Database.endTransaction(aMode);
+			return true;
+		}catch(ex){
+			try{ this.Database.endTransaction(aMode); }catch(ex2){}
+			mcRepository._dump("mcRepository.addRepositoryFolder():"+ex);
+			return false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	updateRepositoryFolder : function(aFolder,aResTitle){
+		try{
+			var aMode = this.Mode;
+			if(!this.title2fid[aResTitle]) return false;
+			var fid = this.title2fid[aResTitle];
+			if(this.om_folder_hash[fid].fid_property == aFolder.fid_property && this.om_folder_hash[fid].fid_style == aFolder.fid_style) return true;
+			var dispTitle = "/" + aResTitle.replace(/\t+/img,"/");
+			if(!this.Common.confirm(this.mcMainService.STRING.getString("CONFIRM_REPOSITORY_UPDATE_FOLDER") + "[ " + dispTitle + " ]")) return false;
+			if(!this.Database.beginTransaction(aMode)) return false;
+			aFolder.fid = this.title2fid[aResTitle];
+			aFolder.pfid = this.om_folder_hash[aFolder.fid.toString()].pfid;
+			if(aFolder.dbtype) delete aFolder.dbtype;
+			this.Database.updateFolder(aFolder,aMode,false);
+			this.om_folder_hash[aFolder.fid.toString()] = aFolder;
+			this.Database.endTransaction(aMode);
+			return true;
+		}catch(ex){
+			try{ this.Database.endTransaction(aMode); }catch(ex2){}
+			this._dump("mcRepository.updateRepositoryFolder():"+ex);
+			return false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	confirmRepositoryDeleteFolder : function(parRes,parTitle,merTitle){
+		var rtn = false;
+		var contFolderList = this.DataSource.flattenResources(parRes, 1, false);
+		var i;
+		var usefid = [];
+		for(i=0;i<contFolderList.length;i++){
+			if(contFolderList[i].Value == parRes.Value) continue;
+			var resTitle = merTitle + "\t" + this.DataSource.getProperty(contFolderList[i], "title");
+			resTitle = resTitle.replace(/^\s*/img,"");
+			if(!this.title2fid[resTitle]) continue;
+			var fid = this.title2fid[resTitle];
+			usefid[fid.toString()] = fid;
+		}
+		var pfid = "0";
+		if(this.title2fid[merTitle]) pfid = this.title2fid[merTitle].toString();
+		if(this.pfid2fid[pfid] && this.pfid2fid[pfid].length>0){
+			for(i=0;i<this.pfid2fid[pfid].length;i++){
+				var fid = this.pfid2fid[pfid][i].toString();
+				if(usefid[fid]) continue;
+				var msgTitle = "/" + this.fid2title[fid].replace(/\t+/img,"/");
+				if(!this.Common.confirm(this.mcMainService.STRING.getString("CONFIRM_REPOSITORY_DELETE_FOLDER") + "[ " + msgTitle + " ]")) continue;
+				rtn = this.deleteRepositoryFolder(fid);
+			}
+		}
+		return rtn;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	deleteRepositoryFolder : function(aFID){
+		try{
+			var aMode = this.Mode;
+			if(!this.Database.beginTransaction(aMode)) return false;
+			this.Database.removeFolder(aFID,aMode,false);
+			this.Database.endTransaction(aMode);
+			return true;
+		}catch(ex){
+			try{ this.Database.endTransaction(aMode); }catch(ex2){}
+			mcRepository._dump("mcRepository.deleteRepositoryFolder():"+ex);
+			return false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	existsRepositoryObject : function(aObject,aParTitle){
+		var rtnObject = null;
+		var oid;
+		for(oid in this.om_object_hash){
+			if(typeof this.om_object_hash[oid] == "function") continue;
+			if(
+				this.om_object_hash[oid].doc_url  != aObject.doc_url ||
+				this.om_object_hash[oid].con_url  != aObject.con_url ||
+				this.om_object_hash[oid].bgn_dom  != aObject.bgn_dom ||
+				this.om_object_hash[oid].end_dom  != aObject.end_dom ||
+				this.om_object_hash[oid].oid_type != aObject.oid_type
+			) continue;
+			rtnObject = this.om_object_hash[oid];
+			break;
+		}
+		return rtnObject;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	addRepositoryObject : function(aObject,aParTitle){
+		var aMode = this.Mode;
+		try{
+			var dispTitle = "/" + aParTitle.replace(/\t+/img,"/") + "/" + aObject.oid_title;
+			if(!this.Common.confirm(this.mcMainService.STRING.getString("CONFIRM_REPOSITORY_ADD_OBJECT") + "[ " + dispTitle + " ]")) return false;
+			if(!this.Database.beginTransaction(aMode)) return false;
+			aObject.oid = this.Database._oidIdentify(aMode,aObject.oid,false);
+			if(this.title2fid[aParTitle]){
+				aObject.pfid = this.title2fid[aParTitle];
+			}else{
+				aObject.pfid = "0";
+			}
+			var blob = this.Database.getObjectBLOB(aObject.oid,aObject.dbtype,false);
+			if(aObject.dbtype) delete aObject.dbtype;
+			if(aObject.fid_style) delete aObject.fid_style;
+			this.Database.addObject(aObject,aMode,false);
+			if(blob && blob.length>0 && blob[0].length>0){
+				this.Database.updateObjectBLOB(aObject.oid,blob[0],aMode,false);
+			}
+			this.om_object_hash[aObject.oid.toString()] = aObject;
+			if(!this.oid2pfid[aObject.oid.toString()])  this.oid2pfid[aObject.oid.toString()] = [];
+			if(!this.pfid2oid[aObject.pfid.toString()]) this.pfid2oid[aObject.pfid.toString()] = [];
+			this.oid2pfid[aObject.oid.toString()].push(aObject.pfid);
+			this.pfid2oid[aObject.pfid.toString()].push(aObject.oid);
+			this.Database.endTransaction(aMode);
+			return true;
+		}catch(ex){
+			try{ this.Database.endTransaction(aMode); }catch(ex2){}
+			this._dump("mcRepository.addRepositoryObject():"+ex);
+			return false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	updateRepositoryObject : function(aObject,aRObject,aParTitle){
+		var aMode = this.Mode;
+		try{
+			var addlink = true;
+			var pfid;
+			if(this.title2fid[aParTitle]){
+				pfid = this.title2fid[aParTitle];
+			}else{
+				pfid = "0";
+			}
+			if(this.oid2pfid[aObject.oid.toString()] && this.oid2pfid[aObject.oid.toString()].length>0){
+				var i;
+				for(i=0;i<this.oid2pfid[aObject.oid.toString()].length;i++){
+					if(pfid != this.oid2pfid[aObject.oid.toString()][i]) continue;
+					addlink = false;
+					break;
+				}
+			}
+			if(!addlink && aRObject.oid_title == aObject.oid_title && aRObject.oid_property == aObject.oid_property) return true;
+			var dispTitle = "/" + aParTitle.replace(/\t+/img,"/") + "/" + aObject.oid_title;
+			if(addlink){
+				if(!this.Common.confirm(this.mcMainService.STRING.getString("CONFIRM_REPOSITORY_ADD_OBJECT") + "[ " + dispTitle + " ]")) return false;
+			}else{
+				if(!this.Common.confirm(this.mcMainService.STRING.getString("CONFIRM_REPOSITORY_UPDATE_OBJECT") + "[ " + dispTitle + " ]")) return false;
+			}
+			if(!this.Database.beginTransaction(aMode)) return false;
+			if(aRObject.oid_title != aObject.oid_title || aRObject.oid_property != aObject.oid_property){
+				aRObject.oid_title = aObject.oid_title;
+				aRObject.oid_property = aObject.oid_property;
+				if(aRObject.dbtype) delete aRObject.dbtype;
+				if(aRObject.fid_style) delete aRObject.fid_style;
+				if(aRObject.pfid) delete aRObject.pfid;
+				this.Database.updateObject(aRObject,aMode,false);
+				this.om_object_hash[aRObject.oid.toString()] = aRObject;
+			}
+			if(addlink){
+				this.Database.addLink({oid:aRObject.oid,pfid:pfid,pfid_order:aObject.pfid_order},aMode,false);
+				if(!this.oid2pfid[aRObject.oid.toString()])  this.oid2pfid[aRObject.oid.toString()] = [];
+				if(!this.pfid2oid[pfid.toString()]) this.pfid2oid[pfid.toString()] = [];
+				this.oid2pfid[aRObject.oid.toString()].push(pfid);
+				this.pfid2oid[pfid.toString()].push(aRObject.oid);
+			}
+			this.Database.endTransaction(aMode);
+			return true;
+		}catch(ex){
+			try{ this.Database.endTransaction(aMode); }catch(ex2){}
+			this._dump("mcRepository.updateRepositoryObject():"+ex);
+			return false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	confirmRepositoryDeleteObject : function(parRes,parTitle,merTitle){
+		var rtn = false;
+		var contObjectList = this.DataSource.flattenResources(parRes, 2, false);
+		var i;
+		var usefid = [];
+		var pfid = "0";
+		if(this.title2fid[merTitle]) pfid = this.title2fid[merTitle].toString();
+		for(i=0;i<contObjectList.length;i++){
+			var oid = this.DataSource.getProperty(contObjectList[i], "id");
+			var dbtype = this.DataSource.getProperty(contObjectList[i], "dbtype");
+			var objects = this.Database.getObject({oid:oid,pfid:pfid},dbtype);
+			if(!objects) continue;
+			var object = this.existsRepositoryObject(objects[0],merTitle);
+			if(!object) continue;
+			usefid[oid.toString()] = object.oid;
+		}
+		if(this.pfid2oid[pfid] && this.pfid2oid[pfid].length>0){
+			for(i=0;i<this.pfid2oid[pfid].length;i++){
+				var oid = this.pfid2oid[pfid][i].toString();
+				if(usefid[oid]) continue;
+				var msgTitle = "/" + this.fid2title[pfid].replace(/\t+/img,"/") + "/" + this.om_object_hash[oid].oid_title;
+				if(!this.Common.confirm(this.mcMainService.STRING.getString("CONFIRM_REPOSITORY_DELETE_OBJECT") + "[ " + msgTitle + " ]")) continue;
+				rtn = this.deleteRepositoryObject({oid:oid,pfid:pfid});
+			}
+		}
+		return rtn;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	deleteRepositoryObject : function(aObject){
+		try{
+			var aMode = this.Mode;
+			if(!this.Database.beginTransaction(aMode)) return false;
+			this.Database.removeObject(aObject,aMode,false);
+			this.Database.endTransaction(aMode);
+			return true;
+		}catch(ex){
+			try{ this.Database.endTransaction(aMode); }catch(ex2){}
+			mcRepository._dump("mcRepository.deleteRepositoryObject():"+ex);
+			return false;
+		}
+	},
+
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function (aString){
+		if(nsPreferences.getBoolPref("scrapparty.debug", false)) window.dump(aString+"\n");
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/repositoryoverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/repositoryoverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/repositoryoverlay.xul	(revision 5703)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+	id="repositoryOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://global/content/nsJSSupportsUtils.js"/>
+	<script type="application/x-javascript" src="chrome://global/content/nsJSComponentManager.js"/>
+	<script type="application/x-javascript" src="chrome://markingcollection/content/repository.js"/>
+	<script type="application/x-javascript" src="chrome://markingcollection/content/md5.js"/>
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _repositoryMainInit(){
+			mcRepository.init();
+		}
+		function _repositoryMainDone(){
+			mcRepository.done();
+		}
+		window.addEventListener("load", _repositoryMainInit, false);
+		window.addEventListener("unload", _repositoryMainDone, false);
+	]]>
+	</script>
+	<toolbox id="mcToolbox">
+		<toolbar id="mcToolbar">
+			<toolbarbutton id="mcToolbarRepositorySettingButton" image="chrome://markingcollection/skin/repository.png" tooltiptext="&markingcollection.repository;&markingcollection.repository.settings;" oncommand="mcRepository.commandRepositorySetting(event)" insertbefore="mcToolbarPropertyViewButton"/>
+		</toolbar>
+	</toolbox>
+	<popupset id="mcPopupSet">
+		<menupopup id="mcPopup">
+			<menuseparator id="mcMenuseparatorRepository" observes="mcMenuRepository" insertbefore="mcPopupTreeListViewMenuSeparator"/>
+			<menu id="mcMenuRepository" class="menu-iconic" label="&markingcollection.repository;" image="chrome://markingcollection/skin/repository.png" onmouseover="event.stopPropagation();" insertbefore="mcPopupTreeListViewMenuSeparator">
+				<menupopup id="mcMenupopupRepository">
+					<menuitem id="mcMenuitemRepositoryMerge"  class="menuitem-iconic" label="&markingcollection.repository.merge;"  image="chrome://markingcollection/skin/merge.png"  oncommand="mcRepository.merge(event);" />
+					<menuitem id="mcMenuitemRepositoryImport" class="menuitem-iconic" label="&markingcollection.repository.import;" image="chrome://markingcollection/skin/import.png" oncommand="mcRepository.import(event);" />
+				</menupopup>
+			</menu>
+		</menupopup>
+	</popupset>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/repositorysetting.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/repositorysetting.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/repositorysetting.xul	(revision 5703)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/property.css" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/setting.css" type="text/css" ?>
+<!DOCTYPE wizard [
+<!ENTITY % overlayDTD   SYSTEM "chrome://markingcollection/locale/markingcollection.dtd" >
+%overlayDTD;
+<!ENTITY % markerCustomDTD SYSTEM "chrome://markingcollection/locale/markerCustom.dtd" >
+%markerCustomDTD;
+]>
+<dialog
+	id="mcRepositoryDialog"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	title="&markingcollection.tools.settings; - &markingcollection.repository;"
+	buttons="accept,cancel"
+	onload="mcRepository.onload();"
+	onunload="mcRepository.onunload();"
+	ondialogaccept="mcRepository.ondialogaccept();"
+	ondialogcancel="mcRepository.ondialogcancel();">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://global/content/nsJSSupportsUtils.js"/>
+	<script type="application/x-javascript" src="chrome://global/content/nsJSComponentManager.js"/>
+	<script type="application/x-javascript" src="chrome://markingcollection/content/repository.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/md5.js" />
+	<vbox flex="1">
+		<groupbox id="mcRepositoryPathGroup" flex="1">
+			<caption label="&markingcollection.repository.folder;" />
+			<hbox>
+				<textbox id="mcRepositoryPath" flex="1"/>
+				<toolbarbutton id="mcToolbarRepositoryMergeButton" image="chrome://markingcollection/skin/folder-close.png" tooltiptext="&markingcollection.repository;&markingcollection.repository.folder;" oncommand="mcRepository.commandChangedRepository(event)"/>
+			</hbox>
+		</groupbox>
+		<groupbox id="mcRepositoryUserGroup" flex="1">
+			<caption label="&markingcollection.repository.user;" />
+			<grid flex="1">
+				<columns>
+					<column />
+					<column flex="1"/>
+				</columns>
+				<rows>
+					<row>
+						<label value="E-Mail :" control="mcRepositoryUser"/>
+						<textbox id="mcRepositoryUser"/>
+					</row>
+					<row>
+						<label   id="mcRepositoryPasswordLabel" value="Password :" control="mcRepositoryPassword" hidden="true"/>
+						<textbox id="mcRepositoryPassword"      type="password" hidden="true"/>
+					</row>
+				</rows>
+			</grid>
+		</groupbox>
+	</vbox>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/sample sheet.xsl
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/sample sheet.xsl	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/sample sheet.xsl	(revision 5703)
@@ -0,0 +1,220 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="html" version="4.01" encoding="UTF-8" indent="yes" />
+  <xsl:template match="/">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="LIST">
+    <html>
+      <head>
+        <title><xsl:value-of select="@title" /></title>
+        <script type="text/javascript">
+          function twisty(elem){
+            var cur_twisty = (elem.src.indexOf("twisty-open")>=0)?true:false;
+            var childid = elem.getAttribute("childid").split(",");
+            for(var i=0;i &lt; childid.length;i++){
+              var child_elem = document.getElementById(childid[i]);
+              if(!child_elem) continue;
+              child_elem.style.display = cur_twisty?'none':'';
+            }
+            elem.src = cur_twisty?"chrome://markingcollection/skin/twisty-clsd.png":"chrome://markingcollection/skin/twisty-open.png";
+          }
+          function load(aEvent){
+            var nodeWalker = document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,false);
+            for(var txtNode=nodeWalker.nextNode();txtNode;txtNode = nodeWalker.nextNode()){
+              if(txtNode.nodeValue.match(/^(data:image\/\w+;base64,).*/img)){ txtNode.nodeValue = RegExp.$1; }
+              txtNode.nodeValue = txtNode.nodeValue.replace(/([\/&amp;\?])(\w)/mg,"$1 $2");
+            }
+          }
+        </script>
+
+      </head>
+      <body style="margin: 1em;" onload="load(event)">
+        <xsl:apply-templates/>
+      </body>
+    </html>
+  </xsl:template>
+
+  <xsl:template match="FOLDER">
+    <xsl:choose>
+      <xsl:when test="position() = 2">
+        <div>
+          <xsl:attribute name="id">
+            <xsl:value-of select="ID" />
+          </xsl:attribute>
+          <table style="margin-left: 0.25em;padding:0px;border:1px solid #fc6;" width="100%">
+            <tr><td style="background-color: #fc6;font-weight: bold;">
+              <img src="chrome://markingcollection/skin/twisty-open.png" valign="center" style="margin-right: 4px;" onclick="twisty(this)">
+                <xsl:attribute name="childid">
+                  <xsl:value-of select="CHILDID" />
+                </xsl:attribute>
+              </img>
+              <xsl:value-of select="FID_TITLE" />
+            </td></tr>
+            <tr><td>
+              <xsl:apply-templates />
+            </td></tr>
+          </table>
+        </div>
+      </xsl:when>
+      <xsl:otherwise>
+        <div>
+          <xsl:attribute name="id">
+            <xsl:value-of select="ID" />
+          </xsl:attribute>
+
+          <table style="margin-left: 1em;padding:0px;border-left:1px solid #fc6;border-top:1px solid #fc6;" width="100%">
+            <tr><td style="background-color: #fc6;font-weight: bold;">
+              <img src="chrome://markingcollection/skin/twisty-open.png" valign="center" style="margin-right: 4px;" onclick="twisty(this)">
+                <xsl:attribute name="childid">
+                  <xsl:value-of select="CHILDID" />
+                </xsl:attribute>
+              </img>
+              <xsl:value-of select="FID_TITLE" />
+            </td></tr>
+            <tr><td>
+              <xsl:apply-templates />
+            </td></tr>
+          </table>
+        </div>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="FOLDER/FID_TITLE" />
+  <xsl:template match="FOLDER/FID_NOTE" />
+  <xsl:template match="FOLDER/FID_STYLE" />
+  <xsl:template match="FOLDER/ID" />
+  <xsl:template match="FOLDER/CHILDID" />
+
+
+
+  <xsl:template match="OBJECT">
+    <div>
+      <xsl:attribute name="id">
+        <xsl:value-of select="ID" />
+      </xsl:attribute>
+      <table style="margin-left: 1em;padding:0px;border-left:1px solid #fc6;border-top:1px solid #fc6;" width="100%">
+        <thead>
+          <tr>
+            <td colspan="3" style="background-color: #ffc;font-weight: bold;">
+              <img src="chrome://markingcollection/skin/twisty-open.png" valign="center" style="margin-right: 4px;" onclick="twisty(this)">
+                <xsl:attribute name="childid"><xsl:value-of select="ID" />child</xsl:attribute>
+              </img>
+              <label edit="true" dbcolumn="title">
+                <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
+                <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
+                <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
+                <xsl:value-of select="OID_TITLE" />
+              </label>
+            </td>
+          </tr>
+        </thead>
+        <tbody>
+          <xsl:attribute name="id"><xsl:value-of select="ID" />child</xsl:attribute>
+          <tr>
+            <th width="10" style="background-color: #e6e6e6;">Note</th>
+             <xsl:choose>
+               <xsl:when test="OID_IMG!=''">
+                  <td width="" style="font-family:serif;">
+                    <label edit="true" dbcolumn="property::note">
+                      <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
+                      <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
+                      <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
+                      <xsl:value-of select="OID_PROPERTY_NOTE" />
+                    </label>
+                  </td>
+                  <td rowspan="4" align="right" valign="top">
+                    <img edit="true" style="border-left:1px solid #ff9;">
+                      <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
+                      <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
+                      <xsl:attribute name="src"><xsl:value-of select="OID_IMG" /></xsl:attribute>
+                      <xsl:attribute name="width"><xsl:value-of select="OID_IMG_DISP_WIDTH" /></xsl:attribute>
+                      <xsl:attribute name="height"><xsl:value-of select="OID_IMG_DISP_HEIGHT" /></xsl:attribute>
+                      <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
+                    </img>
+                  </td>
+               </xsl:when>
+               <xsl:when test="OID_STRUCTURE!=''">
+                  <td width="" style="font-family:serif;">
+                    <label edit="true" dbcolumn="property::note">
+                      <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
+                      <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
+                      <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
+                      <xsl:value-of select="OID_PROPERTY_NOTE" />
+                    </label>
+                  </td>
+                  <td rowspan="4" align="" valign="top" style="border-left:1px solid #ff9;">
+                    <xsl:copy-of select="OID_STRUCTURE" />
+                  </td>
+               </xsl:when>
+               <xsl:otherwise>
+                  <td width="400" style="font-family:serif;">
+                    <label edit="true" dbcolumn="property::note">
+                      <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
+                      <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
+                      <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
+                      <xsl:value-of select="OID_PROPERTY_NOTE" />
+                    </label>
+                  </td>
+               </xsl:otherwise>
+             </xsl:choose>
+          </tr>
+          <tr>
+            <th width="10" style="background-color: #e6e6e6;">Private</th>
+              <td style="font-family:serif;">
+
+                <xsl:choose>
+                  <xsl:when test="OID_PROPERTY_PRIVATE!=''">
+                    <xsl:apply-templates select="/LIST/FOLDER/OBJECT/OID_PROPERTY_PRIVATE" />
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <label edit="true" dbcolumn="property::private">
+                      <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
+                      <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
+                      <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
+                      <xsl:value-of select="OID_PROPERTY_PRIVATE" />
+                    </label>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </td>
+          </tr>
+          <tr>
+            <th width="10" style="background-color: #e6e6e6;">URL</th>
+            <td>
+              <a>
+                <xsl:attribute name="href">
+                  <xsl:value-of select="DOC_URL" />
+                </xsl:attribute>
+                <xsl:value-of select="DOC_URL" />
+              </a>
+            </td>
+          </tr>
+          <tr>
+            <th width="10" style="background-color: #e6e6e6;">Contents</th>
+            <td  style="">
+              <xsl:value-of select="OID_TXT" />
+            </td>
+          </tr>
+
+        </tbody>
+      </table>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="OID_PROPERTY_PRIVATE">
+   <xsl:choose>
+     <xsl:when test="@type='checkbox'">
+     </xsl:when>
+     <xsl:otherwise>
+      <label edit="true" dbcolumn="property::private">
+        <xsl:attribute name="oid"><xsl:value-of select="@oid" /></xsl:attribute>
+        <xsl:attribute name="dbtype"><xsl:value-of select="@dbtype" /></xsl:attribute>
+        <xsl:attribute name="input"><xsl:value-of select="@type" /></xsl:attribute>
+        <xsl:value-of select="." />
+      </label>
+     </xsl:otherwise>
+   </xsl:choose>
+  </xsl:template>
+
+</xsl:stylesheet>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/scrappartymerge.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/scrappartymerge.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/scrappartymerge.js	(revision 5703)
@@ -0,0 +1,319 @@
+function bitsScrapPartyMergeObserver(aEvent){
+	try{
+		switch(aEvent.type){
+			case "load":
+				var merge = bitsScrapPartyMergeService.availableness;
+				var button = aEvent.target.getElementById("mcToolbarButtonScrapPartyMerge");
+				button.setAttribute("checked",merge);
+				break;
+			default:
+				break;
+		}
+	}catch(ex){
+		bitsScrapPartyMergeService._dump("bitsScrapPartyMergeObserver():"+ex);
+		aEvent.preventDefault();
+	}
+};
+
+var bitsScrapPartyMergeService = {
+	prefs : {},
+	_isCancel : false,
+	_isConfirm : false,
+
+/////////////////////////////////////////////////////////////////////
+	get STRING()     { return document.getElementById("bitsScrapPartyMergeString"); },
+	get DataSource() { return bitsObjectMng.DataSource; },
+	get Common()     { return bitsObjectMng.Common;     },
+	get XPath()      { return bitsObjectMng.XPath;      },
+	get Database()   { return bitsObjectMng.Database;   },
+	get gBrowser()   { return bitsObjectMng.getBrowser();},
+
+	get BROWSER() {  return document.getElementById("bitsScrapPartyMergeBrowser"); },
+
+/////////////////////////////////////////////////////////////////////
+	get availableness(){ return true; },
+	get cancel(){ return bitsScrapPartyMergeService._isCancel; },
+	get confirm(){ return bitsScrapPartyMergeService._isConfirm; },
+
+/////////////////////////////////////////////////////////////////////
+	initPrefs : function(){
+		this.prefs.conditionMerge = nsPreferences.getIntPref("wiredmarker.merge.conditionMerge", 0);
+		this.prefs.confirmMerge   = nsPreferences.getBoolPref("wiredmarker.merge.confirmMerge",  true);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	init : function(aEvent){
+		if(this._init) return;
+		try{
+			if(!bitsObjectMng){
+				setTimeout(function(){bitsScrapPartyMergeService.init(aEvent)},1000);
+				return;
+			}
+		}catch(ex){
+			setTimeout(function(){bitsScrapPartyMergeService.init(aEvent)},1000);
+			return;
+		}
+		try{
+			this._init = true;
+			this.initPrefs();
+		}catch(ex){
+			this.Common.alert("bitsScrapPartyMergeService.init():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(event){
+		if(this._init){
+			this._init = false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	dispOptions : function(event){
+		window.openDialog('chrome://markingcollection/content/optionsDialog.xul',undefined,'modal,centerscreen,chrome');
+		this.initPrefs();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	dispConfirm : function(aInfo){
+		var result = {};
+		window.openDialog('chrome://markingcollection/content/confirmDialog.xul',undefined,'modal,centerscreen,chrome',aInfo,result);
+		this._isSameprocessing = result.sameprocessing
+		this._isMergeMode = result.accept
+		return result.accept;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onClick : function(aEvent){
+		bitsScrapPartyMergeService._onClick(aEvent);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_onClick : function(aEvent){
+		var button = aEvent.target;
+		//button.setAttribute("checked",!eval(button.getAttribute("checked")));
+		//nsPreferences.setBoolPref("wiredmarker.merge", eval(button.getAttribute("checked")));
+	},
+
+/////////////////////////////////////////////////////////////////////
+	mergeResource : function(aPram){
+		try{
+			if(aPram == undefined || aPram.modCtrl || aPram.modShift) return 0;
+			if(!bitsScrapPartyMergeService.availableness) return 0;
+			this._isCancel = false;
+			this._isSameprocessing = false;
+			this._isMergeMode = 0;
+			this._isConfirm = false;
+			var rtn = this._mergeResource(aPram)
+			return rtn;
+		}catch(ex){
+			this._dump("bitsScrapPartyMergeService.mergeResource():ex="+ex);
+			return 0;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_mergeResource : function(aPram){
+		var tree = aPram.tree;
+		var srcRes = aPram.srcRes;
+		var dstRes = aPram.dstRes;
+		var modCtrl = aPram.modCtrl;
+		var modAlt = aPram.modAlt;
+		var modShift = aPram.modShift;
+		var srcTitle = this.DataSource.getProperty(srcRes,"title");
+		srcTitle = srcTitle.replace(/^\s+/mg,"").replace(/\s+$/mg,"");
+		var dstParentRes = this.DataSource.isContainer(dstRes) ? dstRes : this.DataSource.findParentResource(dstRes);
+		dstRes = null;
+		var dstTarget = this.DataSource.flattenResources(dstParentRes, (this.DataSource.isContainer(srcRes)?1:2), false);
+		var i;
+		for(i=0;i<dstTarget.length;i++){
+			if(dstTarget[i].Value == dstParentRes.Value) continue;
+			var dstTitle = this.DataSource.getProperty(dstTarget[i],"title");
+			dstTitle = dstTitle.replace(/^\s+/mg,"").replace(/\s+$/mg,"");
+			if(srcTitle != dstTitle) continue;
+			dstRes = dstTarget[i];
+			break;
+		}
+		if(!dstRes) return 0;
+		var srcParentRes = this.DataSource.isContainer(srcRes) ? srcRes : this.DataSource.findParentResource(srcRes);
+		var dstParentRes = this.DataSource.isContainer(dstRes) ? dstRes : this.DataSource.findParentResource(dstRes);
+		if(srcParentRes.Value == dstParentRes.Value) return 0;
+		var rtnObject = undefined;
+		if(this.DataSource.isContainer(srcRes)){
+			var pfid = this.DataSource.getProperty(srcRes,"id");
+			var dbtype = this.DataSource.getProperty(srcRes,"dbtype");
+			rtnObject = this.Database.getObject({pfid:pfid}, dbtype);
+		}else{
+			var pfid = this.DataSource.getProperty(srcParentRes,"id");
+			var oid = this.DataSource.getProperty(srcRes,"id");
+			var dbtype = this.DataSource.getProperty(srcRes,"dbtype");
+			rtnObject = this.Database.getObject({oid:oid, pfid:pfid}, dbtype);
+		}
+		var rtn = 0;
+		var i,j;
+		if(rtnObject){
+			for(i=0;i<rtnObject.length;i++){
+				var dstFID = this.DataSource.getProperty(dstParentRes,"id");
+				var dstDBType = this.DataSource.getProperty(dstParentRes,"dbtype");
+				rtn |= this._merge(rtnObject[i], {fid:dstFID, dbtype:dstDBType});
+				if(this._isCancel) return rtn;
+			}
+		}
+		if(this.DataSource.isContainer(srcRes)){
+			var srcFolder = this.DataSource.flattenResources(srcRes, 1, false);
+			var dstFolder = this.DataSource.flattenResources(dstRes, 1, false);
+			for(i=1;i<srcFolder.length;i++){
+				aPram.srcRes = srcFolder[i];
+				for(j=1;j<dstFolder.length;j++){
+					aPram.dstRes = dstFolder[j];
+					rtn |= this._mergeResource(aPram);
+					if(this._isCancel) return rtn;
+				}
+			}
+		}
+		return rtn;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_merge : function(aObject, dstFolder, aDBFunc, aTransaction){
+		var rtn = 0;
+		try{
+			if(!aObject.con_url || aObject.con_url == "") return rtn;
+			if(!aDBFunc) aDBFunc = this.Database;
+			var dstFID = dstFolder.fid;
+			var dstDBType = dstFolder.dbtype;
+			var srcOID = aObject.oid;
+			var srcDBTYPE = aObject.dbtype;
+			var srcTitle = aObject.oid_title.replace(/^\s+/mg,"").replace(/\s+$/mg,"");
+			var srcProperty = "";
+			if(aObject.oid_property && aObject.oid_property != ""){
+				try{
+					var parser = new DOMParser();
+					xmldoc = parser.parseFromString(aObject.oid_property, "text/xml");
+					parser = undefined;
+					var note = xmldoc.getElementsByTagName("NOTE")[0];
+					if(note) srcProperty = note.textContent;
+				}catch(e){}
+			}
+			var info = {};
+			info.src = {
+				title : srcTitle,
+				note  : srcProperty,
+			};
+			var rtnObject;
+			if(
+				(aObject.con_url && aObject.con_url != "") &&
+				(aObject.bgn_dom && aObject.bgn_dom != "") &&
+				(aObject.end_dom && aObject.end_dom != "")
+			){
+				switch(this.prefs.conditionMerge){
+					case 1:
+						rtnObject = aDBFunc.getObjectWithProperty({con_url:aObject.con_url, bgn_dom:aObject.bgn_dom, pfid:dstFID}, dstDBType, aTransaction);
+						break;
+					case 2:
+						rtnObject = aDBFunc.getObjectWithProperty({con_url:aObject.con_url, end_dom:aObject.end_dom, pfid:dstFID}, dstDBType, aTransaction);
+						break;
+					default:
+						rtnObject = aDBFunc.getObjectWithProperty({con_url:aObject.con_url, bgn_dom:aObject.bgn_dom, end_dom:aObject.end_dom, pfid:dstFID}, dstDBType, aTransaction);
+						break;
+				}
+			}else{
+				rtnObject = aDBFunc.getObjectWithProperty({con_url:aObject.con_url, oid_title:srcTitle, pfid:dstFID}, dstDBType, aTransaction);
+			}
+			if(rtnObject){
+				var i;
+				for(i=0;i<rtnObject.length;i++){
+					if(srcOID == rtnObject[i].oid && srcDBTYPE == rtnObject[i].dbtype) continue;
+					var mergemode = 4;
+					var dstTitle = rtnObject[i].oid_title.replace(/^\s+/mg,"").replace(/\s+$/mg,"");
+					if(srcTitle == dstTitle){
+						if(!this._isConfirm){
+							if(nsPreferences.getBoolPref("wiredmarker.merge.confirmMerge",  true) && !this.Common.confirm(this.STRING.getString("CONFIRM_MERGE"))){
+								this._isCancel = true;
+								return rtn;
+							}
+							this._isConfirm = true;
+						}
+						var oid_property = "";
+						if(rtnObject[i].oid_property && rtnObject[i].oid_property != ""){
+							try{
+								var parser = new DOMParser();
+								xmldoc = parser.parseFromString(rtnObject[i].oid_property, "text/xml");
+								parser = undefined;
+								var note = xmldoc.getElementsByTagName("NOTE")[0];
+								if(note) oid_property = note.textContent;
+							}catch(e){}
+						}
+						info.dst = {
+							title : dstTitle,
+							note  : oid_property,
+						};
+						if(!this._isSameprocessing){
+							mergemode = this.dispConfirm(info);
+						}else{
+							mergemode = this._isMergeMode;
+						}
+						if(mergemode == 3){	//ç Žæ£
+							rtn |= 0x04;
+							continue;
+						}
+						if(mergemode == 0){	//ã­ã£ã³ã»ã«
+							this._isCancel = true;
+							return rtn;
+						}
+					}
+					var oid_property = rtnObject[i].oid_property;
+					oid_property = oid_property.replace(/[\r\n]+/mg," __BR__ ");
+					if(mergemode == 1 || mergemode == 2){
+						if(oid_property.match(/^(.*<NOTE>)(.*?)(<\/NOTE>.*)$/m)){
+							var prev = RegExp.$1;
+							var note = "";
+							if(mergemode == 1){	//ããŒãž
+								note = RegExp.$2;
+								if(note != "") note += "\n";
+								note += srcProperty;
+							}else{	//äžæžã
+								note = srcProperty;
+							}
+							var next = RegExp.$3;
+							oid_property = prev + note + next;
+						}else{
+							oid_property = "<PROPERTY><NOTE>" + srcProperty + "</NOTE></PROPERTY>";
+						}
+						oid_property = oid_property.replace(/ __BR__ /mg,"\n");
+						if(aDBFunc.updateObject({oid : rtnObject[i].oid, oid_property : oid_property} ,dstDBType, aTransaction)){
+							if(mergemode == 1){	//ããŒãž
+								rtn |= 0x01;
+							}else{	//äžæžã
+								rtn |= 0x02;
+							}
+						}
+					}else if(mergemode == 4){	//è¿œå 
+						var pfid_order = aDBFunc.getMaxOrderFormPID(dstFID, dstDBType, aTransaction);
+						var oid = aDBFunc._oidIdentify(dstDBType, aObject.oid, aTransaction);
+						aObject.oid = oid;
+						aObject.pfid = dstFID;
+						aObject.pfid_order = ++pfid_order;
+						if(aObject.dbtype) delete aObject.dbtype;
+						if(aObject.fid_style) delete aObject.fid_style;
+						if(aDBFunc.addObject(aObject, dstDBType, aTransaction)){
+							rtn |= 0x10;
+							var blobs =aDBFunc.getObjectBLOB(aObject.oid,aObject.dbtype);
+							if(blobs && blobs.length>0) aDBFunc.updateObjectBLOB(aObject.oid,blobs[0],dstDBType);
+						}
+					}
+				}
+			}else{	//è¿œå 
+			}
+			return rtn;
+		}catch(ex){
+			this._dump("bitsScrapPartyMergeService._merge():ex="+ex);
+			return rtn;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/searchacross.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/searchacross.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/searchacross.js	(revision 5703)
@@ -0,0 +1,268 @@
+var bitsSearchAcross = {
+	_id : 'searchacross',
+	_timer : null,
+	_value : "",
+
+	get id(){return this._id;},
+	get value(){return this._value;},
+
+	get STRING() { return document.getElementById("MarkingCollectionOverlayString"); },
+
+	get DataSource() { return window.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.top.bitsObjectMng.Common;     },
+	get Database()   { return window.top.bitsObjectMng.Database;   },
+	get XML()        { return window.top.bitsObjectMng.XML;        },
+	get XPath()      { return window.top.bitsObjectMng.XPath;      },
+	get gBrowser()   { return window.top.bitsObjectMng.getBrowser();},
+
+	get TEXTBOX()    { return document.getElementById("bitsSearchAcrossTextbox"); },
+
+	get SIDEBAR_TREETABBOX(){ return document.getElementById("mcTreeTabbox"); },
+	get SIDEBAR_TREETABPANEL(){ return document.getElementById("mcTreeTabCustom"); },
+
+/////////////////////////////////////////////////////////////////////
+	init : function(){
+		var info = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
+		this.app_version = parseInt(info.version);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(){},
+
+/////////////////////////////////////////////////////////////////////
+	rebuild : function(){
+		if(!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex)) mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+		mcTreeHandler.TREE.focus();
+		mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(mcTreeHandler.TREE.currentIndex);
+		mcPropertyView.dispProperty();
+		if(mcItemView.isChecked){
+			mcItemView.onTreeClick();
+		}else{
+			var objects;
+			var viewmode = mcTreeViewModeService.viewmode;
+			var findRegExp = new RegExp(this.value,"img");
+			if(viewmode == "all"){
+				objects = this.Database.findObject(findRegExp);
+			}else{
+				var doc_url = window.top.bitsAutocacheService.convertCacheURLToOriginalURL(this.Common.getURLStringFromDocument(this.gBrowser.contentDocument));
+				objects = this.Database.findObject(findRegExp,undefined,{doc_url:doc_url});
+			}
+			if(objects){
+				for(var i=0;i<objects.length;i++){
+					var about = this.DataSource.ABOUT_ITEM+this.Database._seqIdentify(objects[i].oid);
+					this.addItem(this.Database.makeObjectToItem(objects[i],about),false);
+				}
+				this.DataSource.flush();
+				mcTreeHandler.TREE.builder.rebuild();
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	search : function(aString){
+		if(aString == undefined && this._value=="") return;
+		var currentIndex = mcTreeHandler.TREE.currentIndex;
+		var isSelected = (currentIndex>=0?mcTreeHandler.TREE.view.selection.isSelected(currentIndex):false);
+		var curRes = mcTreeHandler.resource;
+		var object = null;
+		if(aString != undefined){
+			this._value = (new String(aString)).replace(/\x0D\x0A|\x0D|\x0A/g, " ").replace(/\s{2,}/g," ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+			this.removeItem();
+		}else if(!this.removeItem()){
+			return;
+		}
+		if(this.value.length > 0){
+			var newRes = this.createSearchFolder(this.value);
+			mcTreeHandler.TREE.builder.rebuild();
+			var newIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(newRes);
+			if(aString != undefined){
+				this.SIDEBAR_TREETABBOX.selectedTab = this.SIDEBAR_TREETABPANEL;
+				mcTreeHandler.TREE.currentIndex = newIdx;
+				if(newIdx>=0){
+					this.rebuild();
+					mcTreeHandler.TREE.currentIndex = newIdx;
+					if(!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex)) mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+				}
+			}else if(mcItemView.isChecked){
+				if(curRes) currentIndex = mcTreeHandler.TREE.builderView.getIndexOfResource(curRes);
+				if((currentIndex<0 || currentIndex == newIdx) && newIdx>=0){
+					mcTreeHandler.TREE.currentIndex = newIdx;
+					this.rebuild();
+				}else if(currentIndex>=0){
+					mcTreeHandler.TREE.currentIndex = currentIndex;
+					if(!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex)) mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+					mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(mcTreeHandler.TREE.currentIndex);
+					var curIdx=mcItemView.TREE.currentIndex;
+					mcItemView.onTreeClick();
+					var object = null;
+					if(curIdx>=0){
+						mcItemView.TREE.currentIndex = curIdx;
+						if(!mcItemView.TREE.view.selection.isSelected(mcItemView.TREE.currentIndex)) mcItemView.TREE.view.selection.select(mcItemView.TREE.currentIndex);
+						mcItemView.TREE.treeBoxObject.ensureRowIsVisible(mcItemView.TREE.currentIndex);
+						object = mcItemView.object;
+					}else{
+						object = mcTreeHandler.object;
+					}
+				}
+			}else{
+				this.rebuild();
+				currentIndex = -1;
+				if(curRes) currentIndex = mcTreeHandler.TREE.builderView.getIndexOfResource(curRes);
+				mcTreeHandler.TREE.currentIndex = currentIndex;
+				if(mcTreeHandler.TREE.currentIndex>=0){
+					if(!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex)) mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+					mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(mcTreeHandler.TREE.currentIndex);
+					object = mcTreeHandler.object;
+				}
+			}
+		}else{
+			mcTreeHandler.TREE.builder.rebuild();
+			currentIndex = -1;
+			if(curRes) currentIndex = mcTreeHandler.TREE.builderView.getIndexOfResource(curRes);
+			mcTreeHandler.TREE.currentIndex = currentIndex;
+			var object = null;
+			if(currentIndex>=0){
+				if(isSelected && !mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex)) mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+				mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(mcTreeHandler.TREE.currentIndex);
+				if(mcItemView.isChecked){
+					var curIdx=mcItemView.TREE.currentIndex;
+					mcItemView.onTreeClick();
+					if(curIdx>=0){
+						mcItemView.TREE.currentIndex = curIdx;
+						if(!mcItemView.TREE.view.selection.isSelected(mcItemView.TREE.currentIndex)) mcItemView.TREE.view.selection.select(mcItemView.TREE.currentIndex);
+						mcItemView.TREE.treeBoxObject.ensureRowIsVisible(mcItemView.TREE.currentIndex);
+						object = mcItemView.object;
+					}else{
+						object = mcTreeHandler.object;
+					}
+				}else{
+					object = mcTreeHandler.object;
+				}
+			}
+		}
+		if(object){
+			mcPropertyView.dispProperty(object);
+		}else{
+			mcPropertyView.dispProperty();
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createSearchFolder : function(aString){
+		var newItem = this.Common.newItem(this.id);
+		newItem.title = "Search ["+aString+"]";
+		newItem.type = "folder";
+		newItem.editmode = "false";
+		var newRes = this.addItem(newItem);
+		var idx = mcTreeHandler.TREE.builderView.getIndexOfResource(newRes);
+		if(idx>=0 && !mcTreeHandler.TREE.view.isContainerOpen(idx)) mcTreeHandler.TREE.view.toggleOpenState(idx);
+		return newRes;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getAbout : function(){
+		return this.DataSource.ABOUT_ITEM + this.id;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getResource : function(){
+		return this.Common.RDF.GetResource(this.getAbout());
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getIndex : function(){
+		return mcTreeHandler.TREE.builderView.getIndexOfResource(this.getResource());
+	},
+
+/////////////////////////////////////////////////////////////////////
+	removeItem : function(){
+		var idx = -1;
+		var curRes = this.getResource();
+		if(curRes) idx = mcTreeHandler.TREE.builderView.getIndexOfResource(curRes);
+		if(idx<0) return false;
+		try{
+			var names = this.DataSource.data.ArcLabelsOut(curRes);
+			while(names.hasMoreElements()){
+				try{
+					var name  = names.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+					var value = this.DataSource.data.GetTarget(curRes, name, true);
+					this.DataSource.data.Unassert(curRes, name, value);
+				}catch(e){}
+			}
+		}catch(e){}
+		var cont = this.DataSource.getContainer(this.DataSource.ABOUT_ROOT, false);
+		cont.RemoveElement(curRes,true);
+		this.DataSource.flush();
+		return true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	addItem : function(aOMitem,aFlash){
+		if(aFlash == undefined) aFlash = true;
+		for(var key in aOMitem){
+			if(typeof(aOMitem[key]) == "string") aOMitem[key] = this.DataSource.sanitize(aOMitem[key]);
+		}
+		try{
+			var cont;
+			if(aOMitem.type == "folder"){
+				cont = this.DataSource.getContainer(this.DataSource.ABOUT_ROOT, false);
+			}else{
+				cont = this.DataSource.getContainer(this.getAbout(), false);
+			}
+			var newRes;
+			if(aOMitem.type == "folder"){
+				newRes = this.getResource();
+			}else{
+				if(aOMitem.about){
+					newRes = this.Common.RDF.GetResource(aOMitem.about);
+				}else{
+					newRes = this.Common.RDF.GetResource(this.DataSource.ABOUT_ITEM + aOMitem.id);
+					aOMitem.id = aOMitem.oid;
+					delete aOMitem.oid;
+				}
+			}
+			for(var key in aOMitem){
+				if(aOMitem[key] != undefined) this.DataSource.data.Assert(newRes, this.Common.RDF.GetResource(window.top.bitsObjectMng.NS_OBJECTMANAGEMENT + key), this.Common.RDF.GetLiteral(aOMitem[key]), true);
+			}
+			if(aOMitem.type == "folder"){
+				cont.InsertElementAt(newRes, 1, true);
+			}else{
+				cont.AppendElement(newRes);
+			}
+			if(aOMitem.type == "folder") this.Common.RDFCU.MakeSeq(this.DataSource.data, this.Common.RDF.GetResource(newRes.Value));
+			if(aFlash) this.DataSource.flush();
+			return newRes;
+		}catch(e){
+			this._dump("bitsSearchAcross.addItem():" + e);
+			return null;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onSearchButtonCommand : function(aEvent){
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onSearchKeyInput : function(aEvent){
+		var value = aEvent.target.value;
+		if(this._timer) clearTimeout(this._timer);
+		this._timer = setTimeout(function(){ bitsSearchAcross.search(value); },2000);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onSearchKeyPress : function(aEvent){
+		switch(aEvent.keyCode){
+			case aEvent.DOM_VK_RETURN :
+				if(this._timer) clearTimeout(this._timer);
+				this.search(aEvent.target.value);
+				break;
+			default:
+				break;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/searchacrossSidebarOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/searchacrossSidebarOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/searchacrossSidebarOverlay.xul	(revision 5703)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/sidebar.css" type="text/css"?>
+<!DOCTYPE overlay [
+<!ENTITY % markingcollectionDTD SYSTEM "chrome://markingcollection/locale/markingcollection.dtd" >
+%markingcollectionDTD;
+<!ENTITY % metaDTD SYSTEM "chrome://markingcollection/locale/meta.dtd" >
+%metaDTD;
+<!ENTITY % searchacrossDTD SYSTEM "chrome://markingcollection/locale/searchacross.dtd" >
+%searchacrossDTD;
+]>
+<overlay
+	id="searchacrossOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://global/content/nsJSSupportsUtils.js"/>
+	<script type="application/x-javascript" src="chrome://global/content/nsJSComponentManager.js"/>
+	<script type="application/x-javascript" src="chrome://markingcollection/content/searchacross.js"/>
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _searchacrossOverlayInit(e){
+			bitsSearchAcross.init(e);
+		}
+		function _searchacrossOverlayDone(e){
+			bitsSearchAcross.done(e);
+		}
+		window.addEventListener("load", _searchacrossOverlayInit, false);
+		window.addEventListener("unload", _searchacrossOverlayDone, false);
+	]]>
+	</script>
+	<box id="bitsSidebarBox">
+		<vbox id="bitsSidebarVBox">
+			<toolbox id="mcToolbox">
+				<toolbar id="mcToolbar">
+					<hbox insertbefore="mcToolbarAddonHBox" flex="1">
+						<toolbarbutton id="bitsSearchAcrossButton" class="search-go-button" tooltiptext="" oncommand="bitsSearchAcross.onSearchButtonCommand(event)" hidden="true"/>
+						<textbox
+							id="bitsSearchAcrossTextbox"
+							emptytext="&searchacross.search.textbox.emptytext;"
+							placeholder="&searchacross.search.textbox.emptytext;"
+							newlines="replacewithspaces"
+							type="autocomplete"
+							autocompletesearch="form-history"
+							completedefaultindex="false"
+							flex="1"
+							style="font-size:0.9em;margin-left:0px;"
+							onfocus="this.select();"
+							oninput="bitsSearchAcross.onSearchKeyInput(event)"
+							onkeypress="bitsSearchAcross.onSearchKeyPress(event)"/>
+					</hbox>
+				</toolbar>
+			</toolbox>
+		</vbox>
+	</box>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/serverDialogOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/serverDialogOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/serverDialogOverlay.xul	(revision 5703)
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE overlay [
+<!ENTITY % markingcollectionDTD SYSTEM "chrome://markingcollection/locale/markingcollection.dtd" >
+%markingcollectionDTD;
+<!ENTITY % metaDTD SYSTEM "chrome://markingcollection/locale/marker.dtd" >
+%metaDTD;
+]>
+<overlay
+    id="serverDialogOverlay"
+    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+    xmlns:html="http://www.w3.org/1999/xhtml">
+    
+    <script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" /> <!-- Required for access to the Preference Manager component. -->
+    <script type="application/x-javascript" src="chrome://markingcollection/content/annotator-service/annotation-service.js"/>
+    
+    <script type="application/x-javascript">
+    <![CDATA[
+    var def_url_mode;
+    function _serverDialogOverlayInit(aEvent) {
+        // Set the default textbox value to the REST URL default value that is used.
+        document.getElementById("mcMarkerURLTextDefault").value = annotationFramework.getDefaultBackend();
+        var url_mode = nsPreferences.copyUnicharPref("wiredmarker.marker.initdata.url","WM_REST_DEFAULT");
+        var url_format = nsPreferences.copyUnicharPref("wiredmarker.marker.initdata.url_format");
+        document.getElementById("mcMarkerURLFormatText").disabled = true;
+        switch(url_mode){
+            case "WM_REST_DEFAULT":
+                    document.getElementById("mcMarkerURLRadiogroup").selectedItem = document.getElementById("mcMarkerURLText");
+                    break;
+            case "WM_REST_UserDefined":
+                    document.getElementById("mcMarkerURLRadiogroup").selectedItem = document.getElementById("mcMarkerURLFormat");
+                    document.getElementById("mcMarkerURLFormatText").disabled = false;
+                    break;
+        }
+        if(url_format) document.getElementById("mcMarkerURLFormatText").value = url_format;
+        
+        def_url_mode = url_mode;
+    }
+    
+    function _serverDialogOverlayDone(aEvent) {
+        var value = document.getElementById("mcMarkerURLFormatText").value;
+	value = value.replace(/^\s+/g,"").replace(/\s+$/g,"");
+	if(value == "") nsPreferences.setUnicharPref("wiredmarker.marker.initdata.url", def_url_mode);
+    }
+    
+    function _markerDialogOverlayURLCommand(aEvent){
+        if(aEvent.target.id=="mcMarkerURLFormat"){
+                document.getElementById("mcMarkerURLFormatText").disabled = false;
+                document.getElementById("mcMarkerURLFormatText").focus();
+        }else{
+                document.getElementById("mcMarkerURLFormatText").disabled = true;
+                def_url_mode = aEvent.target.value;
+        }
+        nsPreferences.setUnicharPref("wiredmarker.marker.initdata.url", aEvent.target.value);
+    }
+    
+    function _markerDialogOverlayURLInput(aEvent){
+	nsPreferences.setUnicharPref("wiredmarker.marker.initdata.url_format", aEvent.target.value);
+    }
+    
+    window.addEventListener("load", _serverDialogOverlayInit, false);
+    window.addEventListener("unload", _serverDialogOverlayDone, false);
+       
+    ]]>
+    </script>  
+  
+    <!-- container used to display a set of tabbed pages of elements -->
+    <tabbox id="mcSettingTabbox">
+    
+        <!-- Create server top level tab in settings window. -->
+        <tabs id="mcSettingTabs">     
+            <tab id="mcServerTab" label="&markingcollection.server.tab;" image="chrome://markingcollection/skin/annotator-skin/server.png"/>
+        </tabs>		
+    
+        <!-- container to hold the set of pages, i.e. the contents of the pages, in a tabbox -->
+        <tabpanels id="mcSettingTabPanels">
+            
+            <!-- individual panel in a tabpanels element: holds elements in parent tabpanels container -->
+            <tabpanel id="mcServerTabPanel" orient="vertical" flex="1">
+            
+                <!-- use groupbox xul element to group related elements together -->
+                <groupbox id="serverSelectOption" flex="1">
+                    
+                    <!-- caption appears along the top of the parent groupbox -->
+                    <caption label="&markingcollection.server.groupbox.caption;" id="selectServerURLCaption"/>
+                        
+                    <!-- hbox element can contain any number of child elements, this container element defaults to horizontal orientation -->
+                    <hbox>
+                        
+                        <!-- radiogroup element comprises a group of radio buttons, only one radio button inside the group can be selected at a time, defaults to vertical orientation -->
+                        <radiogroup flex="1" id="mcMarkerURLRadiogroup" oncommand="_markerDialogOverlayURLCommand(event);">
+                            <grid>
+                                
+                                <columns>
+                                    <column/>
+                                    <column flex="1" id="textboxColumn"/>
+                                </columns>
+                                
+                                <rows>
+
+                                    <row>
+                                        <radio id="mcMarkerURLText" value="WM_REST_DEFAULT" label="&markingcollection.server.rest.default;" selected="true"/>
+                                        <textbox id="mcMarkerURLTextDefault" readonly="true" onfocus="this.select()"/>
+                                    </row>
+                                        
+                                    <row>
+                                        <radio id="mcMarkerURLFormat" value="WM_REST_UserDefined" label="&markingcollection.server.rest.userdefined;"/>
+                                        <textbox id="mcMarkerURLFormatText" onfocus="this.select()" disabled="true" onchange="_markerDialogOverlayURLInput(event);"/>
+                                    </row>
+                                    
+                                </rows>
+                                
+                            </grid>
+        
+                        </radiogroup>
+                             
+                    </hbox>
+                              
+                </groupbox>
+                                    
+            </tabpanel>
+                            
+        </tabpanels>
+    
+    </tabbox>
+
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/settingDialog.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/settingDialog.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/settingDialog.js	(revision 5703)
@@ -0,0 +1,36 @@
+var mcSettingService = {
+	
+	get BrowserWindow() { return Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow("navigator:browser"); },
+	
+	_rebootFlag : false,
+	_lastModifiedTime : 0,
+	_xmlfile : null,
+	_uncategorized_use : true,
+	
+	get rebootFlag() { return this._rebootFlag; },
+	set rebootFlag(aFlag) { this._rebootFlag = aFlag; },
+
+	init : function(){
+		window.sizeToContent();
+	},
+
+	done : function(){
+		
+		if(window.arguments && window.arguments[0]){
+			window.arguments[0].reboot = this._rebootFlag;
+		}else{
+			
+			var bitsMarkingCollection = mcSettingService.BrowserWindow.bitsMarkingCollection;
+			var bitsContextMenu = mcSettingService.BrowserWindow.bitsContextMenu;
+			
+			bitsMarkingCollection.dbinfo.init(true);
+			bitsContextMenu.rebuildCSS();
+			
+			var mcTreeViewModeService = bitsMarkingCollection._contentWindow.mcTreeViewModeService;
+			var bitsTreeDate = bitsMarkingCollection._contentWindow.bitsTreeDate;
+			if(mcTreeViewModeService) mcTreeViewModeService.rebuild();
+			if(bitsTreeDate) bitsTreeDate.refresh();
+		}
+	},
+
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/settingDialog.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/settingDialog.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/settingDialog.xul	(revision 5703)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/setting.css" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/annotator-skin/dasish.css" type="text/css"?>
+<?xul-overlay href="chrome://markingcollection/content/menuDialogOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/treeContextmenuDialogOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/treeprojectDialogOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/markerInitDataDialogOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/generalDialogOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/substitutiontreeOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/shortcutDialogOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/databaseDialogOverlay.xul"?>
+
+<!-- new tab for choice of server(s) -->
+<?xul-overlay href="chrome://markingcollection/content/serverDialogOverlay.xul"?>
+
+<?xul-overlay href="chrome://markingcollection/content/mergeDialogOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/hyperanchorDialogOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/autocacheDialogOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/metaCaptureDialogOverlay.xul"?>
+<!-- PubMedCentral Dialogue not needed for DASISH Web Annotator -->
+<!-- <?xul-overlay href="chrome://markingcollection/content/pubmedcentralDialogOverlay.xul"?> -->
+
+<!DOCTYPE prefwindow SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<dialog id="mcSettingWindow"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	title="&markingcollection.tools.settings; - &markingcollection.app.title;"
+	buttons="accept"
+	buttonlabelaccept="&markingcollection.tools.label.accept;"
+	buttonaccesskeyaccept="&markingcollection.tools.key.accept;"
+	onload="mcSettingService.init();"
+	onunload="mcSettingService.done();">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/settingDialog.js" />
+	<stringbundleset id="mcSettingStringbundleset">
+		<stringbundle id="mcSettingString" src="chrome://markingcollection/locale/markingcollection.properties" />
+	</stringbundleset>
+	<dialogheader title="&markingcollection.app.title; &markingcollection.tools.settings;" hidden="true" />
+
+	<tabbox id="mcSettingTabbox" flex="1">
+		<tabs id="mcSettingTabs" orient="horizontal"/>
+		<tabpanels id="mcSettingTabPanels" flex="1"/>
+	</tabbox>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/sharedfolder.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/sharedfolder.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/sharedfolder.js	(revision 5703)
@@ -0,0 +1,136 @@
+var mcTreeSharedFolder = {
+
+	get SIDEBAR() { return window.top.document.getElementById("sidebar"); },
+	get BUTTON()   { return document.getElementById("mcToolbarSharedFolderButton"); },
+
+	get DataSource() { return window.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.top.bitsObjectMng.Common;     },
+	get Database()   { return window.top.bitsObjectMng.Database;   },
+
+	get isChecked() {
+		var checked = this.BUTTON.getAttribute("checked");
+		if(!checked || checked == "false"){
+			checked = false;
+		}else{
+			checked = true;
+		}
+		return checked;
+	},
+
+	get Mode(){
+		return this.Database._sharedMode;
+	},
+
+	init : function(){
+		var view = this.Common.getBoolPref("markingcollection.sharedfolder.view", false);
+		this.BUTTON.setAttribute("checked",view);
+
+		if(view){
+			var aMode = mcTreeSharedFolder.Mode;
+			mcTreeSharedFolder.Database.init(aMode);
+			mcTreeSharedFolder.initMarkerFolder(aMode);
+		}
+	},
+
+	done : function(){
+	},
+
+	getNsILocalFile : function(aPath){
+		var aFile = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
+		if(aFile) aFile.initWithPath(aPath);
+		return aFile;
+	},
+
+	commandDispSharedFolder : function(aEvent){
+		var checked = this.isChecked;
+		if(!checked){
+			checked = true;
+		}else{
+			checked = false;
+		}
+		var aMode = mcTreeSharedFolder.Mode;
+		if(!checked){
+			this.BUTTON.setAttribute("checked",checked);
+			this.Common.PREF.setBoolPref("markingcollection.sharedfolder.view",checked);
+			mcTreeSharedFolder.Database.done(aMode);
+			mcTreeViewModeService.rebuild();
+		}else{
+			var path = nsPreferences.copyUnicharPref("markingcollection.dbpath."+aMode, "");
+			if(path == "") checked = this.commandGetSharedFolderPath(aEvent);
+			if(checked){
+				this.BUTTON.setAttribute("checked",checked);
+				this.Common.PREF.setBoolPref("markingcollection.sharedfolder.view",checked);
+				mcTreeSharedFolder.Database.done(aMode);
+				mcTreeSharedFolder.Database.init(aMode);
+				mcTreeSharedFolder.initMarkerFolder(aMode);
+				mcTreeViewModeService.rebuild();
+			}
+		}
+		aEvent.stopPropagation();
+	},
+
+	commandChangedSharedFolder : function(aEvent){
+		var checked = this.commandGetSharedFolderPath(aEvent);
+		if(checked){
+			var aMode = mcTreeSharedFolder.Mode;
+			mcTreeSharedFolder.Database.done(aMode);
+			mcTreeSharedFolder.Database.init(aMode);
+			mcTreeSharedFolder.initMarkerFolder(aMode);
+			mcTreeViewModeService.rebuild();
+		}
+		aEvent.stopPropagation();
+	},
+
+	commandGetSharedFolderPath : function(aEvent){
+		var picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
+		var result = false;
+		try{
+			var picker_title = mcMainService.STRING.getString("SELECTED_SHARED_FOLDER");
+			picker.init(window, picker_title, picker.modeGetFolder);
+			var showResult = picker.show();
+			if(showResult == picker.returnOK){
+				var aMode = mcTreeSharedFolder.Mode;
+				mcTreeSharedFolder.Database.done(aMode);
+				nsPreferences.setUnicharPref("markingcollection.dbpath."+aMode, picker.file.path);
+				result = true;
+			}
+		}catch(e){
+			result = false;
+			this.Common.alert(e);
+		}
+		return result;
+	},
+
+	createMarkerFolder : function(aMode,pTitle,pTarResName,pStyle,pIndex,pPID,pOrder){
+		try{
+			if(!pPID) pPID = 0;
+			var newID = this.DataSource.identify(this.Common.getTimeStamp());
+			var newFolder = this.Database.newFolder(newID,aMode);
+			newFolder.fid_title = pTitle;
+			newFolder.fid_style = pStyle;
+			newFolder.pfid = ""+pPID;
+			if(pOrder) newFolder.pfid_order = ""+pOrder;
+			if(!pPID) newFolder.fid_mode = ""+0x0002;
+			if(!this.Database.addFolder(newFolder,aMode)) return null;
+			return newFolder.fid;
+		}catch(e){
+			_dump("bitsContextMenu.createMarkerFolder():"+e);
+			return null;
+		}
+	},
+
+	initMarkerFolder : function(aMode){
+		if(this.Database._fidCount(aMode) == 0){
+			var folder_title = mcMainService.STRING.getString("MARKER_FOLDER");
+			var pfid = this.createMarkerFolder(aMode,folder_title,undefined,undefined,undefined,undefined,1);
+			var i;
+			for(i=8;i>0;i--){
+				var idx = i;
+				var title = folder_title + idx;
+				var cssText = nsPreferences.copyUnicharPref("markingcollection.marker.style." + idx, bitsMarker.PRESET_STYLES[idx]);
+				this.createMarkerFolder(aMode,title,undefined,cssText,idx,pfid,idx);
+			}
+		}
+	},
+
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/shortcut.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/shortcut.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/shortcut.js	(revision 5703)
@@ -0,0 +1,385 @@
+var bitsShortcutService = {
+	_xmlfilename : 'shortcut.xml',
+	_xmlfolder : null,
+	_xmlfile : null,
+	_xmldoc : null,
+	_shortcut_keyset_id  : 'bits_keyset_',
+	_shortcut_keyset_number  : null,
+	_shortcut_id  : 'bits_key_',
+	_shortcut_app_key : 'X',
+	_shortcut_app_id  : 'openMarkingCollection',
+	_namespace    : 'http://www.bits.cc/Wired-Marker/',
+	_ns_alias     : 'WM',
+
+	get STRING() { return document.getElementById("MarkingCollectionOverlayString"); },
+
+	get DataSource() { return window.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.top.bitsObjectMng.Common;     },
+	get Database()   { return window.top.bitsObjectMng.Database;   },
+	get XML()        { return window.top.bitsObjectMng.XML;        },
+	get XPath()      { return window.top.bitsObjectMng.XPath;      },
+	get gBrowser()   { return window.top.bitsObjectMng.getBrowser();},
+
+	get SIDEBAR() { return window.top.document.getElementById("sidebar"); },
+	get SIDEBAR_DOC() {try{return this.SIDEBAR.contentDocument;}catch(e){return undefined;}},
+	get SIDEBAR_WIN() {try{return this.SIDEBAR.contentWindow;}catch(e){return undefined;}},
+	get mcTreeHandler() {try{return this.SIDEBAR_WIN.mcTreeHandler;}catch(e){return undefined;}},
+	get mcMainService() {try{return this.SIDEBAR_WIN.mcMainService;}catch(e){return undefined;}},
+	get mcController() {try{return this.SIDEBAR_WIN.mcController;}catch(e){return undefined;}},
+	get mcPropertyView() {try{return this.SIDEBAR_WIN.mcPropertyView;}catch(e){return undefined;}},
+	get bitsItemView() {try{return this.SIDEBAR_WIN.bitsItemView;}catch(e){return undefined;}},
+	get mcTreeViewModeService() {try{return this.SIDEBAR_WIN.mcTreeViewModeService;}catch(e){return undefined;}},
+
+	get KEYSET() { return window.top.document.getElementById("mainKeyset"); },
+
+	get xmldoc()        { return this._xmldoc; },
+	get xmlfile()       { return this._xmlfile; },
+	get namespace()     { return this._namespace; },
+	get ns_alias()      { return this._ns_alias; },
+	get confirmDelete() { return true; },
+	get shortcut_app_id() { return this._shortcut_id+this._shortcut_app_id; },
+
+/////////////////////////////////////////////////////////////////////
+	init : function(){
+		try{
+			var extensionDir = this.Common.getExtensionDir().clone();
+			if(extensionDir){
+				this._xmlfolder = extensionDir;
+				this._xmlfile = extensionDir.clone();
+				this._xmlfile.append(this._xmlfilename);
+				var defaultMode = this.Database._defaultMode;
+				if(!this._xmlfile.exists()){
+					var title = this.STRING.getString("APP_SHORTCUT_TITLE");
+					var order = 0;
+					order++;
+					var aContent = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
+					aContent += '<!DOCTYPE SHORTCUTS>\n<SHORTCUTS xmlns:WM="'+this.namespace+'">\n';
+					aContent += '  <SHORTCUT id="'+this.shortcut_app_id+'" command="viewMarkingCollection" key="'+this._shortcut_app_key+'" shift="false" alt="true" access="false" '+this.ns_alias+':title="'+title+'" '+this.ns_alias+':disabled="false" '+this.ns_alias+':hidden="false" '+this.ns_alias+':removed="false"/>\n';
+					aContent += '</SHORTCUTS>\n';
+					this.Common.writeFile(this._xmlfile,aContent,"UTF-8");
+				}
+				if(this._xmlfile.exists()){
+					function _loadXMLDocument(pUri){
+						if(pUri == undefined) return undefined;
+						var xmlDocument = bitsMarkingCollection.loadXMLDocument(pUri);
+						if(xmlDocument){
+							return xmlDocument.documentElement;
+						}else{
+							return undefined;
+						}
+					}
+					function _createXMLDocument(aXMLFile){
+						if(!aXMLFile) return undefined;
+						try{
+							return _loadXMLDocument(bitsShortcutService.Common.IO.newFileURI(aXMLFile).spec);
+						}catch(ex){
+							bitsShortcutService._dump("bitsMarkingCollection._createXMLDocument():"+ ex);
+							return undefined;
+						}
+					}
+					this._xmldoc = _createXMLDocument(this._xmlfile);
+				}
+			}
+			this.gBrowser.addEventListener("keypress", this.onkeypress, false);
+		}catch(e){
+			this._dump("bitsShortcutService.init():"+e);
+		}
+		if(this.xmldoc && this.KEYSET){
+			this._removeKeys();
+			this._appendKeys();
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(){
+		try{
+			this.gBrowser.removeEventListener("keypress", this.onkeypress, false);
+		}catch(e){
+			this._dump("bitsShortcutService.done():"+e);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onkeypress : function(aEvent){
+		bitsShortcutService._onkeypress(aEvent);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_onkeypress : function(aEvent){
+		try{
+			var win = this.Common.getFocusedWindow();
+			var sel = win.getSelection();
+			var isSelected = false;
+			try{ isSelected = ( sel.anchorNode === sel.focusNode && sel.anchorOffset == sel.focusOffset ) ? false : true; }catch(e){}
+			if(!isSelected) return;
+		}catch(e){
+			return;
+		}
+		var osString = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS;
+		var result = {
+			key     : ""+String.fromCharCode(aEvent.charCode).toUpperCase(),
+			shift   : aEvent.shiftKey,
+			alt     : aEvent.altKey,
+			accel   : (osString == "Darwin" ? aEvent.metaKey: aEvent.ctrlKey)
+		};
+		if(!result.key) return;
+		var elemSCs =  this.evaluateArray('//SHORTCUT[@WM:hidden="false" and @WM:disabled="false" and @WM:removed="true" and @key="'+result.key+'" and @shift="'+result.shift+'" and @alt="'+result.alt+'" and @accel="'+result.accel+'"]');
+		if(!elemSCs || elemSCs.length<=0) return;
+		var param = {
+			target : elemSCs[0]
+		};
+		this.oncommand(param);
+		aEvent.preventDefault();
+		aEvent.stopPropagation();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	oncommand : function(aEvent){
+		var win = this.Common.getFocusedWindow();
+		var sel = win.getSelection();
+		var isSelected = false;
+		try{ isSelected = ( sel.anchorNode === sel.focusNode && sel.anchorOffset == sel.focusOffset ) ? false : true; }catch(e){}
+		var fid = aEvent.target.getAttribute("fid");
+		var fid_style = aEvent.target.getAttribute("style");
+		var dbtype = aEvent.target.getAttribute("dbtype");
+		if(fid != "" && dbtype != "" && isSelected){
+			var newResArr =  bitsMarkingCollection.addSelectedText({fid:fid,fid_style:fid_style,dbtype:dbtype},-1);
+			if(!newResArr) return;
+			var mcTreeHandler = this.mcTreeHandler;
+			var mcController = this.mcController;
+			if(mcTreeHandler && mcController){
+				mcController.rebuildLocal();
+				var XferData = {};
+				XferData.data = "";
+				XferData.flavour = {};
+				XferData.flavour.contentType = "text/x-moz-url";
+				var XferDataSet = {};
+				XferDataSet.first = {};
+				XferDataSet.first.first = XferData;
+				var row = mcTreeHandler.TREE.builderView.getIndexOfResource(newResArr[0]);
+				if(row<0){
+					var folderRes = bitsContextMenu.DataSource.findParentResource(newResArr[0]);
+					row = mcTreeHandler.TREE.builderView.getIndexOfResource(folderRes);
+				}
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	evaluateArray : function(aExpr) {
+		return this.XPath.evaluateArray(aExpr,this.xmldoc);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	confirmRemovingFor : function(){
+		try{
+			if(bitsShortcutService.confirmDelete) return this.Common.confirm( this.STRING.getString("CONFIRM_DELETE") );
+			return true;
+		}catch(e){
+			alert(e);
+			return false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getShortcut : function(aID,aDBType){
+		var elemSCs =  this.evaluateArray('//SHORTCUT[@fid="'+aID+'" and @dbtype="'+aDBType+'"]');
+		if(!elemSCs || elemSCs.length<=0) return undefined;
+		var rtn = {};
+		var attrs = elemSCs[0].attributes;
+		for(var i=attrs.length-1;i>=0;i--){
+			if(attrs[i].name == "WM:disabled"){
+				rtn.disabled = (attrs[i].value=='true'?true:false);
+			}else if(attrs[i].name.indexOf(this.ns_alias)==0){
+				continue;
+			}else if(attrs[i].value == 'true'){
+				rtn[attrs[i].name] = true;
+			}else if(attrs[i].value == 'false'){
+				rtn[attrs[i].name] = false;
+			}else{
+				rtn[attrs[i].name] = attrs[i].value;
+			}
+		}
+		return rtn;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	setShortcut : function(aID,aDBType,aAttr){
+		if(!aID||!aDBType||!aAttr) return;
+		var elemSC;
+		var elemSCs =  this.evaluateArray('//SHORTCUT[@fid="'+aID+'" and @dbtype="'+aDBType+'"]');
+		if(!elemSCs || elemSCs.length<=0){
+			elemSC = this.xmldoc.ownerDocument.createElement('SHORTCUT');
+			elemSC.setAttributeNS(this.namespace,'disabled','false');
+			elemSC.setAttributeNS(this.namespace,'hidden','false');
+			elemSC.setAttributeNS(this.namespace,'removed','true');
+			elemSC.setAttribute('id',this._shortcut_id+aID+'_'+aDBType);
+			elemSC.setAttribute('fid',aID);
+			elemSC.setAttribute('dbtype',aDBType);
+			this.xmldoc.appendChild(elemSC);
+		}else{
+			elemSC = elemSCs[0];
+		}
+		if(!aAttr.key){
+			elemSC.parentNode.removeChild(elemSC);
+		}else{
+			for(var key in aAttr){
+				if(key == "disabled" || key == "title"){
+					elemSC.setAttributeNS(this.namespace,key,aAttr[key]);
+				}else{
+					elemSC.setAttribute(key,aAttr[key]);
+				}
+			}
+		}
+		this._xmlflash();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getAcceltext : function(aID,aDBType){
+		return this._getAcceltext(this._shortcut_id+aID+'_'+aDBType);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_getAcceltext : function(aID){
+		var elemSCs =  this.evaluateArray('//SHORTCUT[@WM:hidden="false" and @WM:disabled="false" and @id="'+aID+'"]');
+		if(!elemSCs || elemSCs.length<=0) return "";
+		var osString = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS;
+		var acceltext = [];
+		var sccnt=0;
+		if(elemSCs[sccnt].getAttribute('accel') == 'true'){
+			if(osString == "Darwin"){
+				acceltext.push('Command');
+			}else{
+				acceltext.push('Ctrl');
+			}
+		}
+		if(elemSCs[sccnt].getAttribute('shift') == 'true') acceltext.push('Shift');
+		if(elemSCs[sccnt].getAttribute('alt') == 'true'){
+			if(osString == "Darwin"){
+				acceltext.push('Option');
+			}else{
+				acceltext.push('Alt');
+			}
+		}
+		acceltext.push(elemSCs[sccnt].getAttribute('key'));
+		return acceltext.join("+");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_appendKeys : function(){
+		if(!this.xmldoc || this._shortcut_keyset_number) return;
+		var elemSCs =  this.evaluateArray('//SHORTCUT[@WM:hidden="false" and @WM:disabled="false"]');
+		if(!elemSCs || elemSCs.length<=0){
+			var acceltext = "";
+			var menuitem1 = document.getElementById("bitsExecMenu");
+			if(menuitem1) menuitem1.setAttribute("acceltext",acceltext);
+			var menuitem2 = document.getElementById("viewSidebarMenu_bitsExecMenu");
+			if(menuitem2) menuitem2.setAttribute("acceltext",acceltext);
+			return;
+		}
+		this._shortcut_keyset_number = this.Common.getTimeStamp();
+		var elemKeyset = document.documentElement.appendChild(document.createElement('keyset'));
+		elemKeyset.setAttribute("id",this._shortcut_keyset_id+this._shortcut_keyset_number);
+		var db_hash = {};
+		var dbinfo = bitsMarkingCollection.dbinfo.getAllDBInfo();
+		if(dbinfo){
+			var i;
+			for(i=0;i<dbinfo.length;i++){
+				db_hash[""+dbinfo[i].database_dbtype] = dbinfo[i];
+			}
+		}
+		var sccnt=0;
+		for(sccnt=0;sccnt<elemSCs.length;sccnt++){
+			elemSCs[sccnt].removeAttribute('meta');
+			elemSCs[sccnt].removeAttribute('control');
+			if(!elemSCs[sccnt].hasAttributes()) continue;
+			var key = elemSCs[sccnt].getAttribute('key');
+			if(!key || key == '') continue;
+			var id = elemSCs[sccnt].getAttribute('id');
+			if(!id || id == '') continue;
+			if(id != this.shortcut_app_id) continue;
+			var dbtype = elemSCs[sccnt].getAttribute('dbtype');
+			if(dbtype && dbtype != ''){
+				if(!db_hash[dbtype]) continue;
+			}
+			var elemKey = document.createElement("key");
+			elemKey.setAttribute('id',id);
+			var fid = elemSCs[sccnt].getAttribute('fid');
+			if(fid && fid != '') elemKey.setAttribute('fid',fid);
+			if(dbtype && dbtype != '') elemKey.setAttribute('dbtype',dbtype);
+			if(elemKey.hasAttribute('fid') && elemKey.hasAttribute('dbtype')){
+				elemKey.setAttribute('oncommand','bitsShortcutService.oncommand(event);');
+			}
+			var command = elemSCs[sccnt].getAttribute('command');
+			if(command && command != '') elemKey.setAttribute('command',command);
+			if(key && key != '') elemKey.setAttribute('key',key);
+			var modifiers = [];
+			if(elemSCs[sccnt].getAttribute('accel') == 'true') modifiers.push('accel');
+			if(elemSCs[sccnt].getAttribute('shift') == 'true') modifiers.push('shift');
+			if(elemSCs[sccnt].getAttribute('alt') == 'true') modifiers.push('alt');
+			if(modifiers.length>0) elemKey.setAttribute('modifiers',modifiers.join(","));
+			elemKeyset.appendChild(elemKey);
+		}
+		var elemKey = document.getElementById(this.shortcut_app_id);
+		if(elemKey){
+			var acceltext = this._getAcceltext(this.shortcut_app_id);
+			var menuitem1 = document.getElementById("bitsExecMenu");
+			if(menuitem1) menuitem1.setAttribute("acceltext",acceltext);
+			var menuitem2 = document.getElementById("viewSidebarMenu_bitsExecMenu");
+			if(menuitem2) menuitem2.setAttribute("acceltext",acceltext);
+		}else{
+			var acceltext = "";
+			var menuitem1 = document.getElementById("bitsExecMenu");
+			if(menuitem1) menuitem1.setAttribute("acceltext",acceltext);
+			var menuitem2 = document.getElementById("viewSidebarMenu_bitsExecMenu");
+			if(menuitem2) menuitem2.setAttribute("acceltext",acceltext);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_removeKeys : function(){
+		if(!this.xmldoc || !this._shortcut_keyset_number) return;
+		var elemKeyset = document.getElementById(this._shortcut_keyset_id+this._shortcut_keyset_number);
+		if(!elemKeyset) return;
+		var childNodes = elemKeyset.childNodes;
+		var cnt;
+		for(cnt=childNodes.length-1;cnt>=0;cnt--){
+			elemKeyset.removeChild(childNodes[cnt]);
+		}
+		elemKeyset.parentNode.removeChild(elemKeyset);
+		this._shortcut_keyset_number = null;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	xmlflash : function(aTimeout){
+		try{
+			if(!aTimeout) aTimeout = 0;
+			var self = this;
+			setTimeout(function(){ self._xmlflash(); },aTimeout);
+		}catch(e){
+			this._dump("bitsShortcutService.xmlflash():"+e);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_xmlflash : function(aTimeout){
+		try{
+			if(!this.xmldoc || !this.xmlfile) return;
+			var s = new XMLSerializer();
+			var xml = s.serializeToString(this.xmldoc);
+			this.Common.writeFile(this.xmlfile, xml+"\n","UTF-8");
+			this._removeKeys();
+			this._appendKeys();
+			if(this.mcTreeViewModeService) this.mcTreeViewModeService.showShortcutKey();
+		}catch(e){
+			this._dump("bitsShortcutService._xmlflash():"+e);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+};
+
+
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/shortcutDialogOverlay.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/shortcutDialogOverlay.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/shortcutDialogOverlay.js	(revision 5703)
@@ -0,0 +1,425 @@
+var bitsShortcutDialogOverlay = {
+	_init : false,
+	_opener : null,
+	_changed : false,
+	_app_version : 2,
+
+	get TAB_PANELS() { return document.getElementById("mcSettingTabPanels"); },
+	get idPANEL()  { return 'mcShortcutTabPanel'; },
+
+	get TREE()     { return document.getElementById("bitsShortcutTree"); },
+	get ADD()      { return document.getElementById("bitsShortcutAdd"); },
+	get EDIT()     { return document.getElementById("bitsShortcutEdit"); },
+	get DEL()      { return document.getElementById("bitsShortcutDel"); },
+	get DISP()     { return document.getElementById("bitsShortcutDisp"); },
+
+	get idTITLE()    { return 'bitsShortcutTitleCol'; },
+	get idKEY()      { return 'bitsShortcutKeyCol'; },
+	get idSHIFT()    { return 'bitsShortcutShiftCol'; },
+	get idALT()      { return 'bitsShortcutAltCol'; },
+	get idACCEL()    { return 'bitsShortcutAccelCol'; },
+	get idDISABLED() { return 'bitsShortcutDisabledCol'; },
+	get idPRIORITY() { return 'bitsShortcutPriorityCol'; },
+
+	get STRING()     { return this._opener.top.document.getElementById("MarkingCollectionOverlayString"); },
+	get DataSource() { return this._opener.top.bitsObjectMng.DataSource; },
+	get Common()     { return this._opener.top.bitsObjectMng.Common;     },
+	get XPath()      { return this._opener.top.bitsObjectMng.XPath;      },
+	get Database()   { return this._opener.top.bitsObjectMng.Database;   },
+	get XML()        { return this._opener.top.bitsObjectMng.XML;   },
+	get gBrowser()   { return this._opener.top.bitsObjectMng.getBrowser();},
+	get bitsMarkingCollection() { return this._opener.top.bitsMarkingCollection;},
+
+
+	get bitsShortcutService(){ return this._opener.top.bitsShortcutService; },
+	get xmldoc()             { return this.bitsShortcutService.xmldoc; },
+	get namespace()          { return this.bitsShortcutService.namespace; },
+	get evaluateArray()      { return this.bitsShortcutService.evaluateArray; },
+	get confirmRemovingFor() { return this.bitsShortcutService.confirmRemovingFor; },
+	get check_img() { return "chrome://markingcollection/skin/cbox-check.gif"; },
+
+/////////////////////////////////////////////////////////////////////
+	init : function(aEvent){
+		if(!this._init){
+			var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
+			this._opener = wm.getMostRecentWindow("navigator:browser");
+
+			var osString = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS;
+			if(osString == "Darwin"){
+				document.getElementById(this.idALT).setAttribute('label','Option');
+				document.getElementById(this.idACCEL).setAttribute('label','Command');
+			}
+
+			this.DISP.checked = nsPreferences.getBoolPref("wiredmarker.shortcut.tree_disp", true);
+
+			this.TAB_PANELS.addEventListener("select", this.tabselect, false);
+
+			var db_hash = {};
+			var dbinfo = this.bitsMarkingCollection.dbinfo.getAllDBInfo();
+			if(dbinfo){
+				var i;
+				for(i=0;i<dbinfo.length;i++){
+					db_hash[""+dbinfo[i].database_dbtype] = dbinfo[i];
+				}
+			}
+			var elemSCs =  this.evaluateArray('//SHORTCUT[@fid and @dbtype]');
+			var sccnt;
+			for(sccnt=elemSCs.length-1;sccnt>=0;sccnt--){
+				var fid = elemSCs[sccnt].getAttribute('fid');
+				var dbtype = elemSCs[sccnt].getAttribute('dbtype');
+				if(dbtype){
+					if(!db_hash[dbtype] && elemSCs[sccnt].getAttributeNS(this.namespace,'hidden') == 'false'){
+						elemSCs[sccnt].setAttributeNS(this.namespace,'hidden','true');
+						this._changed = true;
+					}else if(db_hash[dbtype] && elemSCs[sccnt].getAttributeNS(this.namespace,'hidden') == 'true'){
+						elemSCs[sccnt].setAttributeNS(this.namespace,'hidden','false');
+						this._changed = true;
+					}
+				}
+				if(fid && dbtype && db_hash[dbtype] && !this.Database._fidExists(dbtype,fid)){
+					elemSCs[sccnt].parentNode.removeChild(elemSCs[sccnt]);
+					this._changed = true;
+				}
+			}
+			var info = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
+			this._app_version = parseFloat(info.version);
+			if(this._app_version<3.1){
+				this.TREE.addEventListener("draggesture", bitsShortcutDialogOverlay.onOldDraggesture, false);
+				this.TREE.addEventListener("dragover", bitsShortcutDialogOverlay.onOldDragover, false);
+				this.TREE.addEventListener("dragdrop", bitsShortcutDialogOverlay.onOldDragdrop, false);
+				this.TREE.addEventListener("dragexit", bitsShortcutDialogOverlay.onOldDragexit, false);
+			}else{
+				this.TREE.addEventListener("dragstart", bitsShortcutDialogOverlay.onDragEvents, false);
+				this.TREE.addEventListener("drag", bitsShortcutDialogOverlay.onDragEvents, false);
+				this.TREE.addEventListener("dragend", bitsShortcutDialogOverlay.onDragEvents, false);
+
+				this.TREE.addEventListener("dragenter", bitsShortcutDialogOverlay.onDropEvents, false);
+				this.TREE.addEventListener("dragover", bitsShortcutDialogOverlay.onDropEvents, false);
+				this.TREE.addEventListener("dragleave", bitsShortcutDialogOverlay.onDropEvents, false);
+				this.TREE.addEventListener("drop", bitsShortcutDialogOverlay.onDropEvents, false);
+			}
+			this.rebuild();
+			this._init = true;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(aEvent){
+		this.TAB_PANELS.removeEventListener("select", this.tabselect, false);
+		if(this._app_version<3.1){
+			this.TREE.removeEventListener("draggesture", bitsShortcutDialogOverlay.onOldDraggesture, false);
+			this.TREE.removeEventListener("dragover", bitsShortcutDialogOverlay.onOldDragover, false);
+			this.TREE.removeEventListener("dragdrop", bitsShortcutDialogOverlay.onOldDragdrop, false);
+			this.TREE.removeEventListener("dragexit", bitsShortcutDialogOverlay.onOldDragexit, false);
+		}else{
+			this.TREE.removeEventListener("dragstart", bitsShortcutDialogOverlay.onDragEvents, false);
+			this.TREE.removeEventListener("drag", bitsShortcutDialogOverlay.onDragEvents, false);
+			this.TREE.removeEventListener("dragend", bitsShortcutDialogOverlay.onDragEvents, false);
+
+			this.TREE.removeEventListener("dragenter", bitsShortcutDialogOverlay.onDropEvents, false);
+			this.TREE.removeEventListener("dragover", bitsShortcutDialogOverlay.onDropEvents, false);
+			this.TREE.removeEventListener("dragleave", bitsShortcutDialogOverlay.onDropEvents, false);
+			this.TREE.removeEventListener("drop", bitsShortcutDialogOverlay.onDropEvents, false);
+		}
+		if(this._changed) this.bitsShortcutService.xmlflash(100);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	tabselect : function(aEvent){
+		setTimeout(function(){bitsShortcutDialogOverlay._tabselect(aEvent);},0);
+	},
+
+	_tabselect : function(aEvent){
+		if(this.TAB_PANELS.selectedPanel.id != this.idPANEL) return;
+	},
+
+/////////////////////////////////////////////////////////////////////
+// TREE è¡šç€ºå¶åŸ¡é¢é£
+/////////////////////////////////////////////////////////////////////
+	getTreeNodes : function(aExpr){
+		aExpr = (aExpr?' and ' + aExpr:'');
+		return this.evaluateArray('//SHORTCUT[@WM:hidden="false"' + aExpr + ']');
+	},
+	get rowCount(){
+		var results = this.getTreeNodes();
+		return results.length;
+	},
+	getCellText : function(row,column){
+		var results = this.getTreeNodes();
+		if(!results[row]) return null;
+		if(column.id == this.idTITLE){
+			return results[row].getAttributeNS(this.namespace,"title");
+		}else if(column.id == this.idKEY){
+			return results[row].getAttribute("key");
+		}else if(column.id == this.idPRIORITY){
+			return row+1;
+		}else{
+			return null;
+		}
+	},
+	getCellValue : function(row,column){
+		var results = this.getTreeNodes();
+		if(!results[row]) return null;
+		if(column.id == this.idSHIFT){
+			return (results[row].getAttribute('shift') == 'true' ? true : false);
+		}else if(column.id == this.idALT){
+			return (results[row].getAttribute('alt') == 'true' ? true : false);
+		}else if(column.id == this.idACCEL){
+			return (results[row].getAttribute('accel') == 'true' ? true : false);
+		}else if(column.id == this.idDISABLED){
+			return (results[row].getAttributeNS(this.namespace,'disabled') == 'true' ? true : false);
+		}
+		return null;
+	},
+	setTree: function(treebox){ this.treebox = treebox; },
+	isContainer: function(row){ return false; },
+	isSeparator: function(row){ return false; },
+	isSorted: function(){ return true; },
+	getLevel: function(row){ return 0; },
+	getImageSrc: function(row,column){
+		return null;
+	},
+	getRowProperties: function(row,prop){
+		var aserv=Components.classes["@mozilla.org/atom-service;1"].getService(Components.interfaces.nsIAtomService);
+		var results = this.getTreeNodes();
+		if(!results[row]) return;
+		if(results[row].getAttributeNS(this.namespace,'disabled') == 'true') prop.AppendElement(aserv.getAtom("disabled"));
+	},
+	getCellProperties: function(row, column, prop){
+		var aserv=Components.classes["@mozilla.org/atom-service;1"].getService(Components.interfaces.nsIAtomService);
+		var results = this.getTreeNodes();
+		if(!results[row]) return;
+		if(results[row].getAttributeNS(this.namespace,'disabled') == 'true') prop.AppendElement(aserv.getAtom("disabled"));
+	},
+	getColumnProperties: function(column, element, prop){},
+	cycleHeader : function(col){},
+	setCellText : function(row,column,text){},
+  getParentIndex: function(idx) { return -1; },
+	canDrop : function(index, orient){
+		return true;
+	},
+	onDrop : function(row, orient){},
+	drop : function(row, orient){
+		if(orient>0) row++;
+		if(row>=this.rowCount) row = this.rowCount-1;
+		var results = this.getTreeNodes();
+		var dropnode = results[row];
+		if(!dropnode) return;
+		var dragnode = results[this.TREE.currentIndex];
+		if(!dragnode) return;
+		if(dropnode == dragnode) return;
+		if(row==this.rowCount-1 && orient>0){
+			dropnode.parentNode.appendChild(dragnode);
+			this.TREE.currentIndex = row;
+		}else{
+			dropnode.parentNode.insertBefore(dragnode,dropnode);
+			this.TREE.currentIndex = row;
+		}
+		if(!this.TREE.view.selection.isSelected(this.TREE.currentIndex)) this.TREE.view.selection.select(this.TREE.currentIndex);
+		this.rebuild();
+		this._changed = true;
+	},
+	dragDropObserver :{
+		onDragStart : function(event, transferData, action){
+			try{
+				var row = bitsShortcutDialogOverlay.TREE.currentIndex;
+				var results = bitsShortcutDialogOverlay.getTreeNodes();
+				if(!results[row]) return null;
+				var id = results[row].getAttribute("id");
+				transferData.data = new TransferData();
+				transferData.data.addDataForFlavour("moz/rdfitem", id);
+			}catch(ex){
+				bitsShortcutDialogOverlay._dump("dragDropObserver.onDragStart():"+ex);
+			}
+		},
+		getSupportedFlavours : function(){
+			var flavours = new FlavourSet();
+			flavours.appendFlavour("moz/rdfitem");
+			return flavours;
+		},
+		onDragOver : function(event, flavour, session){},
+		onDragExit : function(event, session){},
+		onDrop     : function(event, transferData, session){},
+	},
+
+/////////////////////////////////////////////////////////////////////
+// Drag & Drop Old Callback functions
+/////////////////////////////////////////////////////////////////////
+	onOldDraggesture: function(aEvent){
+		nsDragAndDrop.startDrag(aEvent,bitsShortcutDialogOverlay.dragDropObserver);
+		aEvent.stopPropagation();
+	},
+	onOldDragover: function(aEvent){
+		nsDragAndDrop.dragOver(aEvent,bitsShortcutDialogOverlay.dragDropObserver);
+		aEvent.stopPropagation();
+	},
+	onOldDragdrop: function(aEvent){
+		nsDragAndDrop.drop(aEvent,bitsShortcutDialogOverlay.dragDropObserver);
+		aEvent.stopPropagation();
+	},
+	onOldDragexit: function(aEvent){
+		nsDragAndDrop.dragExit(aEvent,bitsShortcutDialogOverlay.dragDropObserver);
+		aEvent.stopPropagation();
+	},
+
+/////////////////////////////////////////////////////////////////////
+// Drag & Drop New Callback functions
+/////////////////////////////////////////////////////////////////////
+	onDragEvents: function(aEvent){
+		switch (aEvent.type) {
+			case "dragstart":
+				try{
+					var row = bitsShortcutDialogOverlay.TREE.currentIndex;
+					var results = bitsShortcutDialogOverlay.getTreeNodes();
+					if(!results[row]) return null;
+					var id = results[row].getAttribute("id");
+					var transferData = aEvent.dataTransfer;
+					transferData.setData("moz/rdfitem", id);
+				}catch(ex){
+					bitsShortcutDialogOverlay._dump("bitsShortcutDialogOverlay.onDragEvents().dragstart:"+ex);
+				}
+				break;
+			case "drag":
+			break;
+			case "dragend":
+			break;
+		}
+	},
+
+	onDropEvents: function(aEvent){
+		switch (aEvent.type) {
+			case "dragenter":
+			case "dragover":
+				aEvent.preventDefault();
+				break;
+			case "drop":
+				aEvent.preventDefault();
+				break;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	rebuild : function(){
+		this.TREE.view = bitsShortcutDialogOverlay;
+	},
+
+/////////////////////////////////////////////////////////////////////
+// TREE ã€ãã³ãé¢é£
+/////////////////////////////////////////////////////////////////////
+	onClick : function(aEvent){
+		if(this.TREE.view.selection.count == 0){
+			this.EDIT.setAttribute("disabled","true");
+			this.DEL.setAttribute("disabled","true");
+			return false;
+		}
+		var idxList = this.getSelection();
+		if(this.validateMultipleSelection(idxList) == false){
+			this.EDIT.setAttribute("disabled","true");
+			this.DEL.setAttribute("disabled","true");
+			return false;
+		}
+		var results = this.getTreeNodes();
+		if(!results[idxList[0]]){
+			this.EDIT.setAttribute("disabled","true");
+			this.DEL.setAttribute("disabled","true");
+			return false;
+		}
+		this.EDIT.removeAttribute("disabled");
+		if(idxList.length==1 && results[idxList[0]].getAttributeNS(this.namespace,"removed")=='false'){
+			this.DEL.setAttribute("disabled","true");
+		}else{
+			this.DEL.removeAttribute("disabled");
+		}
+	},
+
+	onDblClick : function(aEvent){
+		var row = this.TREE.currentIndex;
+		var results = this.getTreeNodes();
+		if(!results[row]) return false;
+		var disabled = (results[row].getAttributeNS(this.namespace,"disabled")=='true'?true:false);
+		results[row].setAttributeNS(this.namespace,"disabled",(disabled?'false':'true'));
+		this.rebuild();
+		this._changed = true;
+	},
+
+	onAdd : function(aEvent){},
+
+	onEdit : function(aEvent){
+		if(this.TREE.view.selection.count == 0) return false;
+		var idxList = this.getSelection();
+		if(this.validateMultipleSelection(idxList) == false) return false;
+		var row = this.TREE.currentIndex;
+		var results = this.getTreeNodes();
+		if(!results[row]) return false;
+		var result = {
+			accept  : false,
+			title   : results[row].getAttributeNS(this.namespace,"title"),
+			key     : results[row].getAttribute("key"),
+			shift   : (results[row].getAttribute('shift') == 'true' ? true : false),
+			alt     : (results[row].getAttribute('alt')   == 'true' ? true : false),
+			accel   : (results[row].getAttribute('accel') == 'true' ? true : false),
+			removed : (results[row].getAttributeNS(this.namespace,"removed")=='true'?true:false)
+		};
+		window.openDialog("chrome://markingcollection/content/shortcutProperty.xul", "", "chrome,centerscreen,modal", result);
+		if(!result.accept) return false;
+		delete result.accept;
+		results[row].setAttributeNS(this.namespace,"title",result.title);
+		results[row].setAttribute("key",result.key)
+		results[row].setAttribute("shift",result.shift)
+		results[row].setAttribute("alt",result.alt)
+		results[row].setAttribute("accel",result.accel)
+		this.rebuild();
+		this._changed = true;
+		return true;
+	},
+
+	onDel : function(aEvent){
+		if(this.TREE.view.selection.count == 0) return false;
+		var idxList = this.getSelection();
+		if(this.validateMultipleSelection(idxList) == false) return false;
+		if(!this.confirmRemovingFor()) return false;
+		var results = this.getTreeNodes();
+		var i;
+		for(i=idxList.length-1;i>=0;i--){
+			var row = idxList[i];
+			if(!results[row]) continue;
+			if(results[row].getAttributeNS(this.namespace,"removed")=='false') continue;
+			this.xmldoc.removeChild(results[row]);
+		}
+		this.rebuild();
+		this._changed = true;
+		this.onClick(aEvent);
+	},
+
+	onDispTree : function(aEvent){
+		nsPreferences.setBoolPref("wiredmarker.shortcut.tree_disp", this.DISP.checked);
+	},
+/////////////////////////////////////////////////////////////////////
+	getSelection : function(){
+		var ret = [];
+		var rc;
+		var i;
+		for(rc=0;rc<this.TREE.view.selection.getRangeCount();rc++){
+			var start = {}, end = {};
+			this.TREE.view.selection.getRangeAt(rc, start, end);
+			for(i=start.value;i<= end.value;i++){
+				if(!this.TREE.view.selection.isSelected(i)) continue;
+				ret.push(i);
+			}
+		}
+		return ret;
+	},
+
+	validateMultipleSelection : function(aIdxList){
+		if(aIdxList.length != this.TREE.view.selection.count){
+			alert(this.STRING.getString("ERROR_MULTIPLE_SELECTION"));
+			return false;
+		}
+		return true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		this._opener.top.bitsMarkingCollection._dump(aString);
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/shortcutDialogOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/shortcutDialogOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/shortcutDialogOverlay.xul	(revision 5703)
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/shortcut.css" type="text/css" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+	id="shortcutDialogOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
+	<script type="application/x-javascript" src="chrome://markingcollection/content/shortcutDialogOverlay.js"/>
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _shortcutDialogInit(aEvent){
+			bitsShortcutDialogOverlay.init(aEvent);
+		}
+		function _shortcutDialogDone(aEvent){
+			bitsShortcutDialogOverlay.done(aEvent);
+		}
+		window.addEventListener("load", _shortcutDialogInit, false);
+		window.addEventListener("unload", _shortcutDialogDone, false);
+	]]>
+	</script>
+	<tabbox id="mcSettingTabbox">
+		<tabs id="mcSettingTabs">
+			<tab id="mcShortcutTab" label="&markingcollection.shortcut.tab;" image="chrome://markingcollection/skin/shortcut.png"/>
+		</tabs>
+		<tabpanels id="mcSettingTabPanels">
+			<tabpanel id="mcShortcutTabPanel" orient="vertical" flex="1">
+				<hbox flex="1">
+					<tree
+						id="bitsShortcutTree"
+						flex="1"
+						hidecolumnpicker="true"
+						seltype="multiple"
+						class="plain"
+						onclick="bitsShortcutDialogOverlay.onClick(event);"
+						ondblclick="bitsShortcutDialogOverlay.onDblClick(event);"
+					>
+						<treecols id="bitsShortcutCols">
+							<treecol
+								id="bitsShortcutPriorityCol"
+								flex="1"
+								style="min-width:19px;"/>
+							<treecol
+								id="bitsShortcutTitleCol"
+								flex="100"
+								label="Title"
+								/>
+							<treecol
+								id="bitsShortcutShiftCol"
+								label="Shift"
+								flex="1"
+								type="checkbox"
+								/>
+							<treecol
+								id="bitsShortcutAltCol"
+								label="Alt"
+								flex="1"
+								type="checkbox"
+								/>
+							<treecol
+								id="bitsShortcutAccelCol"
+								label="Control"
+								flex="1"
+								type="checkbox"
+								/>
+							<treecol
+								id="bitsShortcutKeyCol"
+								label="Key"
+								flex="1"
+								/>
+							<treecol
+								id="bitsShortcutDisabledCol"
+								label="Disabled"
+								type="checkbox"
+								flex="1"
+								/>
+						</treecols>
+						<treechildren/>
+					</tree>
+					<vbox>
+						<toolbarbutton
+							id="bitsShortcutAdd"
+							label="&markingcollection.shortcut.add;"
+							image="chrome://markingcollection/skin/menu_create.png"
+							hidden="true"
+							oncommand="bitsShortcutDialogOverlay.onAdd(event);"/>
+						<toolbarbutton
+							id="bitsShortcutEdit"
+							label="&markingcollection.shortcut.edit;"
+							image="chrome://markingcollection/skin/menu_property.png"
+							disabled="true"
+							oncommand="bitsShortcutDialogOverlay.onEdit(event);"/>
+						<toolbarbutton
+							id="bitsShortcutDel"
+							label="&markingcollection.shortcut.del;"
+							image="chrome://markingcollection/skin/menu_remove.png"
+							disabled="true"
+							oncommand="bitsShortcutDialogOverlay.onDel(event);"/>
+					</vbox>
+				</hbox>
+				<checkbox id="bitsShortcutDisp" label="&markingcollection.shortcut.disptree;" oncommand="bitsShortcutDialogOverlay.onDispTree(event);"/>
+				<description style="-moz-appearance: none;color:#ff0000;">&markingcollection.shortcut.attention1;</description>
+				<description style="-moz-appearance: none;color:#ff0000;">&markingcollection.shortcut.attention2;</description>
+			</tabpanel>
+		</tabpanels>
+	</tabbox>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/shortcutProperty.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/shortcutProperty.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/shortcutProperty.js	(revision 5703)
@@ -0,0 +1,171 @@
+var mcSCPropService = {
+	_opener : null,
+
+	get Common()     { return this._opener.top.bitsObjectMng.Common;     },
+
+	get STRING()     { return document.getElementById("mcSCPropString"); },
+	get DIALOG()     { return document.getElementById("mcSCPropDialog"); },
+	get TITLE()      { return document.getElementById("mcSCPropTitle"); },
+	get SHIFT()      { return document.getElementById("mcSCPropShift"); },
+	get ALT()        { return document.getElementById("mcSCPropAlt"); },
+	get ACCEL()      { return document.getElementById("mcSCPropAccel"); },
+	get KEY()        { return document.getElementById("mcSCPropKey"); },
+	get MOD()        { return document.getElementById("mcSCPropModifiers"); },
+
+	property : null,
+
+	init : function(){
+		var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
+		this._opener = wm.getMostRecentWindow("navigator:browser");
+		var osString = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS;
+		if(osString == "Darwin"){
+			this.ALT.setAttribute('label','Option');
+			this.ACCEL.setAttribute('label','Command');
+		}
+		try {
+			this.property = window.arguments[0];
+		}catch(e){}
+		if(!this.property) return;
+		this.TITLE.value = this.property.title;
+		try{this.TITLE.editor.transactionManager.clear();}catch(ex2){}
+		if(!this.property.removed) this.TITLE.setAttribute("readonly","true");
+		this.KEY.value = this.property.key;
+		try{this.KEY.editor.transactionManager.clear();}catch(ex2){}
+		this.SHIFT.checked = this.property.shift;
+		this.ALT.checked = this.property.alt;
+		this.ACCEL.checked = this.property.accel;
+		var acceltext = [];
+		if(this.ACCEL.checked){
+			if(osString == "Darwin"){
+				acceltext.push('Command');
+			}else{
+				acceltext.push('Ctrl');
+			}
+		}
+		if(this.SHIFT.checked) acceltext.push('Shift');
+		if(this.ALT.checked){
+			if(osString == "Darwin"){
+				acceltext.push('Option');
+			}else{
+				acceltext.push('Alt');
+			}
+		}
+		this.MOD.value = acceltext.join("+")+" +";
+		document.title = this.property.title;
+		return;
+	},
+
+	accept : function(){
+		var changed = false;
+		var newVals = {
+			title : this.TITLE.value,
+			shift : this.SHIFT.checked,
+			alt   : this.ALT.checked,
+			accel : this.ACCEL.checked,
+			key   : this.KEY.value
+		};
+		newVals.title = newVals.title.replace(/\t/mg,"        ");
+		newVals.title = this.Common.exceptCode(newVals.title);
+		newVals.title = newVals.title.replace(/[\r\n]/mg, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+		newVals.key = newVals.key.replace(/\t/mg,"        ");
+		newVals.key = this.Common.exceptCode(newVals.key);
+		newVals.key = newVals.key.replace(/[\r\n]/mg, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+		var key;
+		for(key in newVals){
+			if(window.arguments[0][key] == newVals[key]) continue;
+			window.arguments[0][key] = newVals[key];
+			changed = true;
+		}
+		if(window.arguments[0]) window.arguments[0].accept = changed;
+		return true;
+	},
+
+	cancel : function(){
+		if(window.arguments[0]) window.arguments[0].accept = false;
+	},
+
+	inputTitle : function(aEvent){
+		var title = this.TITLE.value;
+		title = title.replace(/\t/mg,"        ");
+		title = this.Common.exceptCode(title);
+		title = title.replace(/[\r\n]/mg, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+		var key = this.KEY.value;
+		key = key.replace(/\t/mg,"        ");
+		key = this.Common.exceptCode(key);
+		key = key.replace(/[\r\n]/mg, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+		if(title.length == 0 || key.length == 0){
+			this.DIALOG.setAttribute("buttondisabledaccept","true");
+		}else if(
+			title              != this.property.title ||
+			key                != this.property.key ||
+			this.SHIFT.checked != this.property.shift ||
+			this.ALT.checked   != this.property.alt ||
+			this.ACCEL.checked != this.property.accel
+		){
+			this.DIALOG.removeAttribute("buttondisabledaccept");
+		}else{
+			this.DIALOG.setAttribute("buttondisabledaccept","true");
+		}
+	},
+
+	inputKey : function(aEvent){
+		var title = this.TITLE.value;
+		title = title.replace(/\t/mg,"        ");
+		title = this.Common.exceptCode(title);
+		title = title.replace(/[\r\n]/mg, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+		var osString = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS;
+		var sc = {
+			key     : ""+String.fromCharCode(aEvent.charCode).toUpperCase(),
+			shift   : aEvent.shiftKey,
+			alt     : aEvent.altKey,
+			accel   : (osString == "Darwin" ? aEvent.metaKey: aEvent.ctrlKey)
+		};
+		if(title.length == 0 || sc.key.length == 0){
+			this.DIALOG.setAttribute("buttondisabledaccept","true");
+		}else if(
+			title              != this.property.title ||
+			sc.key             != this.property.key ||
+			this.SHIFT.checked != this.property.shift ||
+			this.ALT.checked   != this.property.alt ||
+			this.ACCEL.checked != this.property.accel
+		){
+			this.DIALOG.removeAttribute("buttondisabledaccept");
+		}else{
+			this.DIALOG.setAttribute("buttondisabledaccept","true");
+		}
+		this.KEY.value = '';
+		this.MOD.value = '';
+		if(!sc.key || !(sc.shift||sc.alt||sc.accel)) return;
+		this.SHIFT.checked = sc.shift;
+		this.ALT.checked = sc.alt;
+		this.ACCEL.checked = sc.accel;
+		var acceltext = [];
+		var sccnt=0;
+		if(sc.accel){
+			if(osString == "Darwin"){
+				acceltext.push('Command');
+			}else{
+				acceltext.push('Ctrl');
+			}
+		}
+		if(sc.shift) acceltext.push('Shift');
+		if(sc.alt){
+			if(osString == "Darwin"){
+				acceltext.push('Option');
+			}else{
+				acceltext.push('Alt');
+			}
+		}
+		this.MOD.value = acceltext.join("+")+" +";
+		this.KEY.value = sc.key;
+		this.KEY.focus();
+
+	},
+
+	_dump : function(aString){
+		this._opener.top.bitsMarkingCollection._dump(aString);
+	}
+};
+
+
+
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/shortcutProperty.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/shortcutProperty.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/shortcutProperty.xul	(revision 5703)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/property.css" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/setting.css" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/shortcut.css" type="text/css" ?>
+<!DOCTYPE dialog SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<dialog
+	id="mcSCPropDialog"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	width="350"
+	buttons="accept,cancel"
+	buttondisabledaccept="true"
+	onload="mcSCPropService.init();window.sizeToContent();"
+	ondialogaccept="return mcSCPropService.accept();"
+	ondialogcancel="mcSCPropService.cancel();">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/shortcutProperty.js" />
+	<stringbundleset id="mcStringBundles">
+		<stringbundle id="mcSCPropString" src="chrome://markingcollection/locale/markingcollection.properties" />
+	</stringbundleset>
+	<hbox align="center">
+		<label value="Title:" control="mcSCPropTitle"/>
+		<textbox id="mcSCPropTitle" onfocus="this.select()" oninput="mcSCPropService.inputTitle(event);" onkeyup="mcSCPropService.inputTitle(event);" onkeypress="mcSCPropService.inputTitle(event);"/>
+	</hbox>
+	<description control="mcSCPropKey" style="-moz-appearance: none;color:#ff0000;">&markingcollection.shortcut.attention_modifiers;</description>
+	<hbox align="center" pack="center">
+		<spacer flex="1" hidden="true"/>
+		<checkbox id="mcSCPropAccel" label="Control" oncommand="mcSCPropService.inputTitle(event);" hidden="true"/>
+		<checkbox id="mcSCPropShift" label="Shift" oncommand="mcSCPropService.inputTitle(event);" hidden="true"/>
+		<checkbox id="mcSCPropAlt" label="Alt" oncommand="mcSCPropService.inputTitle(event);" hidden="true"/>
+		<label id="mcSCPropModifiers" value="" control="mcSCPropKey"/>
+		<textbox id="mcSCPropKey" size="1" maxlength="1" readonly="true" onfocus="this.select()" onkeypress="mcSCPropService.inputKey(event);"/>
+	</hbox>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/sidebar.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/sidebar.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/sidebar.xul	(revision 5703)
@@ -0,0 +1,412 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/content/places/places.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://markingcollection/skin/sidebar.css" type="text/css"?>
+<?xml-stylesheet href="chrome://markingcollection/skin/overlay.css" type="text/css"?>
+<?xul-overlay href="chrome://markingcollection/content/captureSidebarOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/itemviewSidebarOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/treepropertySidebarOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/autocacheSidebarOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/treeprojectSidebarOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/tagoutputSidebarOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/hyperanchorSidebarOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/treeContextmenuSidebarOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/treedateSidebarOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/searchacrossSidebarOverlay.xul"?>
+<?xul-overlay href="chrome://markingcollection/content/markerRemapSidebarOverlay.xul"?>
+<!DOCTYPE window [
+<!ENTITY % markingcollectionDTD SYSTEM "chrome://markingcollection/locale/markingcollection.dtd" >
+%markingcollectionDTD;
+<!ENTITY % treecontextmenuDTD SYSTEM "chrome://markingcollection/locale/treecontextmenu.dtd" >
+%treecontextmenuDTD;
+]>
+<window
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns:html="http://www.w3.org/1999/xhtml"
+    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+    title=""
+    id="MarkingCollectionWindow"
+>
+
+    <script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
+    <script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+    <script type="application/x-javascript" src="chrome://global/content/nsJSSupportsUtils.js"/>
+    <script type="application/x-javascript" src="chrome://global/content/nsJSComponentManager.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/tree.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/treerootfolder.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/marker.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/templatefolder.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/xmlimport.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/treefolderfilter.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/database.js"/>
+        
+    <!-- added for extended part on login information -->
+    <script type="application/x-javascript" src="chrome://markingcollection/content/annotator-service/lib/jquery-1.9.1.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/annotator-service/lib/jquery.popupWindow.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/annotator-service/annotations.wired.marker.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/annotator-service/annotation-service.js"/>
+    <script type="application/x-javascript" src="chrome://markingcollection/content/sidebarUserLogin.js"/>
+        
+    <script type="application/x-javascript">
+	<![CDATA[
+		function quitApp(){
+			var nsIAppStartup = Components.interfaces.nsIAppStartup;
+			Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(nsIAppStartup).quit(nsIAppStartup.eAttemptQuit);
+		}
+		function restartApp(){
+			var nsIAppStartup = Components.interfaces.nsIAppStartup;
+			Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(nsIAppStartup).quit(nsIAppStartup.eRestart | nsIAppStartup.eAttemptQuit);
+		}
+		function _MarkingCollectionWindowInit(aEvent){
+			mcMainService.init(aEvent);
+                        // Extra hook for DWAN user login information
+                        UserLogin.checkUserLogin();
+		}
+		function _MarkingCollectionWindowDone(aEvent){
+			mcMainService.done(aEvent);
+		}
+                
+                function loginDone(){
+                    UserLogin.checkUserLogin();
+                }
+                
+                function openLoginDialog(){
+                    var params = new Object();;
+                    params.callback = function(){loginDone();};
+                    params.backend = annotationFramework.getBackend();
+                    window.openDialog("chrome://markingcollection/content/loginDialog.xul", "", 
+                                      "chrome,centerscreen,modal", 
+                                      params);
+                }
+                
+                function logout(){
+                    annotationFramework.logout();
+
+                    UserLogin.checkUserLogin();           
+                }
+                
+		window.addEventListener("load", _MarkingCollectionWindowInit, false);
+		window.addEventListener("unload", _MarkingCollectionWindowDone, false);
+	]]>
+    </script>
+    
+    <!-- TODO: Better to use another container instead, e.g. (vbox, box)? -->
+    <description id="loginInfo">
+        <label id="loginStatus"/>
+        <!-- TODO: Check on performance: opening dialogue takes too long at times. -->
+        <button id="loginButton"  label="Login" oncommand="openLoginDialog();"/>
+        <button id="logoutButton" label="Logout" oncommand="logout();" hidden="true"/>
+    </description>
+    
+    <stringbundleset id="mcStringBundles">
+        <stringbundle id="mcMainString" src="chrome://markingcollection/locale/markingcollection.properties" />
+    </stringbundleset>
+    <box id="bitsSidebarBox" orient="horizontal" flex="1">
+        <vbox id="bitsSidebarVBox" persist="height" flex="1">
+            <toolbox id="mcToolbox" class="plain" style="overflow:hidden;min-width:10em;">
+                <toolbar id="mcToolbar" class="plain">
+                    <toolbarbutton id="mcToolbarCreateFolderButton" image="chrome://markingcollection/skin/toolbar_create.png" oncommand="mcTreeHandler.create(-1);" checked="false" hidden="true"/>
+                    <toolbarbutton id="mcToolbarToggle" tooltiptext="&markingcollection.toggle.all;" image="chrome://markingcollection/skin/toolbar_toggle.png" oncommand="mcTreeHandler.toggleAllFolders();" hidden="true"/>
+                    <toolbarbutton id="mcToolbarMenuButton" type="menu" label="menu " hidden="true">
+                        <menupopup id="mcToolbarMenuPopup">
+                            <menuitem id="mcToolbarQuitButton"    label="Quit  "    oncommand="quitApp();"/>
+                            <menuitem id="mcToolbarRestartButton" label="Restart  " oncommand="restartApp();"/>
+                        </menupopup>
+                    </toolbarbutton>
+                    <spacer flex="1"/>
+                    <hbox id="mcToolbarAddonHBox"  flex="1">
+                        <spacer flex="1"/>
+                    </hbox>
+                    <separator orient="vertical" class="thin"/>
+                    <toolbarbutton id="mcToolbarPropertyViewButton" image="chrome://markingcollection/skin/menu_property.png" tooltiptext="&markingcollection.property;" oncommand="mcPropertyView.onClick(event)" checked="false"/>
+                    <toolbarbutton
+                        id="mcToolbarViewModeButton"
+                        type="menu"
+                        label="&markingcollection.viewMode; "
+                        tooltiptext="&markingcollection.viewMode;"
+                        oncommand="mcTreeViewModeService.onClick(event);">
+                        <menupopup id="mcToolbarViewModePopup">
+                            <menuitem id="mcToolbarViewModeItemSingle" label="&markingcollection.viewMode.single;" value="single" type="radio" />
+                            <menuitem id="mcToolbarViewModeItemAll"    label="&markingcollection.viewMode.all;"    value="all"    type="radio" />
+                        </menupopup>
+                    </toolbarbutton>
+                </toolbar>
+            </toolbox>
+            <vbox id="mcTreeVBox" flex="1">
+                <tabbox id="mcTreeTabbox" flex="1">
+                    <tabs id="mcTreeTabs">
+                        <tab id="mcTreeTabCustom" label="Custom"/>
+                    </tabs>
+                    <tabpanels id="mcTreeTabpanels" flex="1">
+                        <tabpanel id="mcTreeTabpanelCustom">
+                            <tree
+                                id="mcTree"
+                                datasources="rdf:null"
+                                statedatasource=""
+                                ref=""
+                                tooltip="mcPopupTooltip"
+                                flags="dont-build-content"
+                                hidecolumnpicker="true"
+                                seltype="single"
+                                class="plain"
+                                flex="1">
+                                <treecols id="mcTreeCols">
+                                    <treecol id="mcTreeColTitle" hideheader="true" primary="true" class="sortDirectionIndicator" sortActive="true" sortDirection="natural" overflow="true" flex="90"/>
+                                    <treecol id="mcTreeColShortcut" hideheader="true" fixed="true" minWidth="60" width="60" crop="start"/>
+                                    <treecol id="mcTreeColStyle"    hideheader="true" fixed="true" minWidth="10" width="10"/>
+                                    <treecol id="mcTreeColWork"     hideheader="true" flex="1"/>
+                                </treecols>
+                                <template>
+                                    <rule id="mcTreeRule">
+                                        <treechildren flex="1">
+                                            <treeitem uri="rdf:*">
+                                                <treerow>
+                                                    <treecell
+                                                        id="mcTreeItem"
+                                                        label="rdf:http://www.bits.cc/Wired-Marker/wiredmarker-rdf#title"
+                                                        value="rdf:http://www.bits.cc/Wired-Marker/wiredmarker-rdf#uri"
+                                                        src="rdf:http://www.bits.cc/Wired-Marker/wiredmarker-rdf#icon"
+                                                        properties="Name rdf:http://www.bits.cc/Wired-Marker/wiredmarker-rdf#type"
+                                                    />
+                                                    <treecell
+                                                        label="rdf:http://www.bits.cc/Wired-Marker/wiredmarker-rdf#shortcut"
+                                                        properties="Shoutcut"
+                                                    />
+                                                    <treecell
+                                                        label=""
+                                                        properties="rdf:http://www.bits.cc/Wired-Marker/wiredmarker-rdf#cssrule"
+                                                    />
+                                                </treerow>
+                                            </treeitem>
+                                        </treechildren>
+                                    </rule>
+                                </template>
+                            </tree>
+                        </tabpanel>
+                    </tabpanels>
+                </tabbox>
+            </vbox>
+        </vbox>
+    </box>
+    <splitter id="bitsFindSplitter" hidden="true"/>
+    <vbox id="bitsFindVBox" hidden="true"/>
+    <splitter id="mcPropertyViewSplitter"/>
+    <vbox id="mcPropertyViewVBox"/>
+    <splitter id="bitsBrowserAutocacheSplitter"/>
+    <vbox id="bitsBrowserAutocacheVBox"/>
+    <splitter id="captureMenuSplitter" hidden="true" />
+    <vbox id="captureMenuVBox" hidden="true" />
+    <splitter id="htmlcanvasMenuSplitter" hidden="true" />
+    <vbox id="htmlcanvasMenuVBox" hidden="true" />
+    <popupset id="mcPopupSet">
+        <menupopup
+            id="mcPopup"
+            onpopupshowing="mcController.onPopupShowing(event);"
+            onpopuphiding="mcController.onPopupHiding(event);">
+            <menuitem
+                id="mcPopupOpen"
+                label="&markingcollection.open;"
+                oncommand="mcController.open(null,false);"
+                nodelay="true"
+                default="true"/>
+            <menuitem
+                id="mcPopupOpenNewTab"
+                label="&markingcollection.open.newtab;"
+                oncommand="mcController.open(null,true);"
+                nodelay="true"/>
+            <menuitem
+                id="mcPopupOpenAllItems"
+                label="&markingcollection.folder.openall;"
+                oncommand="mcController.openAllInTabs(null);"
+                hidden="true"/>
+            <menuseparator
+                id="mcPopupOpenSeparator"
+                hidden="true"/>
+            <menu
+                id="mcPopupCreates"
+                class="menu-iconic"
+                label="&markingcollection.new.folder;"
+                image="chrome://markingcollection/skin/menu_create.png"
+                onmouseover="event.stopPropagation();">
+                <menupopup
+                    id="mcPopupCreatesMenu"
+                    onpopupshowing="mcTreeTemplateFolder.onPopupShowing(event);"
+                    onpopuphiding="mcTreeTemplateFolder.onPopupHiding(event);"
+                    oncommand="mcTreeTemplateFolder.onCommand(event,mcTreeHandler.TREE.currentIndex);">
+                    <menuitem
+                        id="mcPopupCreateContents"
+                        class="menuitem-iconic"
+                        label="&markingcollection.new.defaultFolder;..."
+                        image="chrome://markingcollection/skin/treefolder.png"
+                        oncommand="mcTreeHandler.create(mcTreeHandler.TREE.currentIndex);event.stopPropagation();"/>
+                    <menuseparator
+                        id="mcPopupCreateContentsMenuseparator"
+                        observes="mcPopupCreateContents"/>
+                </menupopup>
+            </menu>
+
+            <menu
+                id="mcPopupViewMenu"
+                class="menu-iconic"
+                image="chrome://markingcollection/skin/view.png"
+                label="&treecontextmenu.view.list;">
+                <menupopup>
+                    <menuitem
+                        id="mcPopupListView"
+                        class="menuitem-iconic"
+                        label="&treecontextmenu.view.list;"
+                        image="chrome://markingcollection/skin/list.png"
+                        oncommand="window.top.bitsTreeListService.dispList(event,'chrome://markingcollection/content/listview_drag.xsl');"/>
+
+                    <menu
+                        id="mcPopupTreeListViewMenu"
+                        class="menu-iconic"
+                        label="&markingcollection.treelistview;"
+                        image="chrome://markingcollection/skin/toolbar_listview.png">
+                        <menupopup
+                            id="mcPopupTreeListViewMenuPopup"
+                            onpopupshowing="window.top.bitsTreeListService.onPopupShowing(event);"
+                            onpopuphiding="window.top.bitsTreeListService.onPopupHiding(event);"
+                            oncommand="window.top.bitsTreeListService.onCommand(event);">
+                            <menuitem
+                                id="mcPopupTreeListView"
+                                class="menuitem-iconic"
+                                label="&markingcollection.treelistview.defaults;"
+                                image="chrome://markingcollection/skin/stylesheet.png"
+                                oncommand="window.top.bitsTreeListService.dispList(event);"/>
+                            <menuseparator observes="mcPopupTreeListViewSeparator"/>
+                        </menupopup>
+                    </menu>
+                </menupopup>
+            </menu>
+
+            <menuseparator
+                id="mcPopupImportTagMenuSeparator"
+                observes="mcPopupImportTag"/>
+            <menuitem
+                id="mcPopupImportTag"
+                class="menuitem-iconic"
+                label="&markingcollection.importTagAll;..."
+                image="chrome://markingcollection/skin/importtag.png"
+                oncommand="window.top.bitsImportTagService.dispList(event);"/>
+            <menuseparator id="mcPopupAddonMenuSeparator" observes="mcPopupAddonMenu"/>
+            <menu
+                id="mcPopupAddonMenu"
+                class="menu-iconic"
+                label="&markingcollection.addon;"
+                image="chrome://markingcollection/skin/extensions_16.png"
+                hidden="true">
+                <menupopup
+                    id="mcPopupAddonMenuPopup"
+                    onpopupshowing="window.top.bitsScrapPartyAddonService.onPopupShowing(event,mcTreeHandler.resource);"
+                    onpopuphiding="window.top.bitsScrapPartyAddonService.onPopupHiding(event);"
+                    oncommand="window.top.bitsScrapPartyAddonService.onCommand(event,mcTreeHandler.resource);" />
+            </menu>
+            <menuseparator observes="mcPopupRootFolder"/>
+            <menuitem
+                id="mcPopupRootFolder"
+                type="checkbox"
+                label="&markingcollection.rootFolder;"
+                oncommand="mcTreeRootFolder.onClick(event);" />
+            <menuseparator id="mcPopupFolderAutoOpenSeparator"/>
+            <menuitem
+                id="mcPopupFolderAutoOpen"
+                type="checkbox"
+                label="&markingcollection.folderAutoOpen;"
+                oncommand="var checked = (event.target.getAttribute('checked')=='true'?true:false);nsPreferences.setBoolPref('wiredmarker.folderautoopen',!checked);event.target.setAttribute('checked',checked);" />
+            <menuseparator id="mcPopupFilterSeparator" hidden="true"/>
+            <menuitem
+                id="mcPopupFilter"
+                class="menuitem-iconic"
+                label="&markingcollection.filter;..."
+                image="chrome://markingcollection/skin/filter.png"
+                oncommand="mcTreeFolderFilterService.onCommand(event)"
+                disabled="false"/>
+            <menuseparator observes="mcPopupExport"/>
+            <menuitem
+                id="mcPopupImport"
+                label="&markingcollection.import;..."
+                oncommand=""
+                disabled="true"
+                hidden="true"/>
+            <menuitem
+                id="mcPopupExport"
+                class="menuitem-iconic"
+                label="&markingcollection.export;..."
+                image="chrome://markingcollection/skin/zip.png"
+                oncommand="window.top.bitsTreeExportService.saveFile(event)"
+                disabled="false"/>
+            <menuseparator observes="mcPopupEditReplacedURL"/>
+            <menuitem
+                id="mcPopupEditReplacedURL"
+                class="menuitem-iconic"
+                label="&markingcollection.edit.replacedURL;..."
+                image="chrome://markingcollection/skin/edit.png"
+                oncommand="mcTreeHandler.replacedURL(event);"
+                hidden="true"/>
+            <menuseparator observes="mcPopupRemoves"/>
+            <menu
+                id="mcPopupRemoves"
+                class="menu-iconic"
+                label="&markingcollection.remove;"
+                image="chrome://markingcollection/skin/menu_remove.png"
+                onmouseover="event.stopPropagation();">
+                <menupopup id="mcPopupRemovesMenu">
+                    <menuitem
+                        id="mcPopupRemoveFolder"
+                        class="menuitem-iconic"
+                        label="&markingcollection.remove.folder;"
+                        image="chrome://markingcollection/skin/treefolder.png"
+                        oncommand="setTimeout(function(){mcTreeHandler.removeFolder(event);},0);" />
+                    <menuitem
+                        id="mcPopupRemoveAllFolder"
+                        class="menuitem-iconic"
+                        label="&markingcollection.remove.folderall;"
+                        image="chrome://markingcollection/skin/treefolder.png"
+                        oncommand="setTimeout(function(){mcTreeHandler.removeAllFolder(event);},0);"/>
+                    <menuitem
+                        id="mcPopupRemoveAllContents"
+                        class="menuitem-iconic"
+                        label="&markingcollection.remove.itemall;"
+                        image="chrome://markingcollection/skin/treeitem.png"
+                        oncommand="setTimeout(function(){mcTreeHandler.removeAll(event);},0);" />
+                </menupopup>
+            </menu>
+            <menuseparator observes="mcPopupTemplateFolder"/>
+            <menu
+                id="mcPopupTemplateFolder"
+                label="&markingcollection.templateFolder;"
+                onpopupshowing="mcTreeTemplateFolder.onPopupShowingMng(event);">
+                <menupopup>
+                    <menuitem
+                        id="mcPopupTemplateFolderCreate"
+                        class="menuitem-iconic"
+                        label="&markingcollection.templateFolder.create;..."
+                        image="chrome://markingcollection/skin/menu_create.png"
+                        oncommand="mcTreeTemplateFolder.onClick(event,mcTreeHandler.TREE.currentIndex);" />
+                    <menuitem
+                        id="mcPopupTemplateFolderRemove"
+                        class="menuitem-iconic"
+                        label="&markingcollection.templateFolder.remove;..."
+                        image="chrome://markingcollection/skin/menu_remove.png"
+                        oncommand="mcTreeTemplateFolder.onRemove(event);" />
+                </menupopup>
+            </menu>
+            <menuseparator observes="mcPopupRemoveContents"/>
+            <menuitem
+                id="mcPopupRemoveContents"
+                class="menuitem-iconic"
+                label="&markingcollection.remove;"
+                image="chrome://markingcollection/skin/menu_remove.png"
+                oncommand="setTimeout(function(){mcTreeHandler.remove(event);},0);" />
+            <menuseparator observes="mcPopupProperty"/>
+            <menuitem
+                id="mcPopupProperty"
+                class="menuitem-iconic"
+                label="&markingcollection.property;"
+                image="chrome://markingcollection/skin/menu_property.png"
+                oncommand="mcController.property(null);" />
+        </menupopup>
+    </popupset>
+</window>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/sidebarUserLogin.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/sidebarUserLogin.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/sidebarUserLogin.js	(revision 5703)
@@ -0,0 +1,85 @@
+var UserLogin = {
+    checkUserLogin: function() {
+        var user = annotationProxy.getLoggedInInfo(function(result) {
+            // TODO: Do we need to refine the status code checks?
+
+            // user is logged in
+            if (result.status === 200) {
+
+                /*
+                 value = "You are logged in as " + user.dislayName + ".";
+                 var loginInfo = document.getElementById("loginInfo");
+                 var newLabel = document.createElement("label");
+                 newLabel.setAttribute("value", value);
+                 newLabel.setAttribute("id", "loggedIn");
+                 loginInfo.appendChild(newLabel);
+                 */
+                var loginStatus = document.getElementById("loginStatus");
+                loginStatus.setAttribute("class", "loggedIn");
+                loginStatus.setAttribute("value", result.user.dislayName);
+
+                // Hide login button
+                document.getElementById("loginButton").hidden = true;
+                document.getElementById("logoutButton").hidden = false;
+
+
+
+                // user is not logged in
+            } else if (result.status === 401) {
+                document.getElementById("loginButton").hidden = false;
+                document.getElementById("logoutButton").hidden = true;
+
+                // Label element with status information
+                var loginStatus = document.getElementById("loginStatus");
+                var value = "Please sign in to the DASISH annotation server.";
+                loginStatus.setAttribute("value", value);
+                loginStatus.setAttribute("class", "notLoggedIn");
+                // TODO: Flexible width style or other solution?
+                loginStatus.setAttribute("width", "300");
+
+                // Button for login into backend
+                var loginButton = document.getElementById("loginButton");
+                loginButton.setAttribute("label", "Login");
+                loginButton.setAttribute("class", "loginButton");
+                loginButton.setAttribute("width", "300");
+
+            } else { // server connection timeout, server error 500+, or other
+                document.getElementById("loginButton").hidden = false;
+                document.getElementById("logoutButton").hidden = true;
+
+                // Label element with status information
+                var loginStatus = document.getElementById("loginStatus");
+                var value = "Please sign in to the DASISH annotation server.";
+                loginStatus.setAttribute("value", value);
+                loginStatus.setAttribute("class", "notLoggedIn");
+                // TODO: Flexible width style or other solution?
+                loginStatus.setAttribute("width", "300");
+
+                // Button for login into backend
+                var loginButton = document.getElementById("loginButton");
+                loginButton.setAttribute("label", "Login");
+                loginButton.setAttribute("class", "loginButton");
+                loginButton.setAttribute("width", "300");
+                // TODO: Refine alert. Maybe some type of XUL window? Should the server admin mail address be given?
+                alert("There might be some trouble with the server connection for " + annotationFramework.getBackend() + ". Please try again later or ask your server administrator for assistance.");
+            }
+        });
+    },
+    openPopup: function() {
+        var target = document.getElementById("loginInfo"); // description element id in sidebar.xul
+        var wURL = annotationFramework.getBackend() + "/api/authentication/login";
+        $(target).popupWindow({
+            windowURL: wURL,
+            windowName: 'DWAN Login Window',
+            height: 550,
+            width: 640,
+            scrollbars: 1,
+            resizable: 1,
+            centerScreen: 1,
+            location: 1,
+            status: 1,
+            menubar: 1,
+            toolbar: 1
+        });
+    }
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/substitutiontree.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/substitutiontree.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/substitutiontree.js	(revision 5703)
@@ -0,0 +1,174 @@
+/////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////
+var bitsSubstitutionTree = {
+	_xmlfile : null,
+	_xmldoc  : null,
+
+	get idMENU()        { return "bitsSubstitutionTreeMenu"; },
+	get idMENU_ALL()    { return "bitsSubstitutionTreeAllMenuitem"; },
+	get idMENU_SELECT(){ return "bitsSubstitutionTreeSelectMenuitem"; },
+
+	get idCMENU()       { return "bitsSubstitutionTreeContextmenu"; },
+
+	get MENU()          { return document.getElementById(this.idMENU); },
+	get MENU_ALL()      { return document.getElementById(this.idMENU_ALL); },
+
+	get CMENU()         { return document.getElementById(this.idCMENU); },
+
+	get TITLE()         { return window.top.document.getElementById("sidebar-title"); },
+
+	get STRING()     { return window.top.document.getElementById("MarkingCollectionOverlayString"); },
+	get DataSource(){ return window.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.top.bitsObjectMng.Database;   },
+	get gBrowser()   { return window.top.bitsObjectMng.getBrowser();},
+
+	get xmldoc()     { return this._xmldoc; },
+	get xmlurl()     { return (this._xmlfile?this.Common.convertFilePathToURL(this._xmlfile.path):""); },
+
+	get confirmDelete(){ return true; },
+
+	baseURL  : "",
+	shouldRebuild : false,
+
+	init : function(){
+		var extensionDir = this.Common.getExtensionDir().clone();
+		if(extensionDir){
+			this._xmlfile = extensionDir.clone();
+			this._xmlfile.append("substitutiontree.xml");
+			if(!this._xmlfile.exists()){
+				var aContent = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
+				aContent += '<!DOCTYPE items>\n<items/>\n';
+				this.Common.writeFile(this._xmlfile,aContent,"UTF-8");
+			}
+			function _loadXMLDocument(pUri){
+				if(pUri == undefined) return undefined;
+				var xmlDocument = window.top.bitsMarkingCollection.loadXMLDocument(pUri);
+				if(xmlDocument){
+					return xmlDocument;
+				}else{
+					return undefined;
+				}
+			}
+			function _createXMLDocument(aXMLFile){
+				if(!aXMLFile) return undefined;
+				try{
+					return _loadXMLDocument(bitsSubstitutionTree.Common.IO.newFileURI(aXMLFile).spec);
+				}catch(ex){
+					bitsSubstitutionTree._dump("bitsSubstitutionTree._createXMLDocument():"+ ex);
+					return undefined;
+				}
+			}
+			this._xmldoc = _createXMLDocument(this._xmlfile);
+		}
+	},
+
+	done : function(){
+		this.xmlflash();
+	},
+
+	rebuild : function(){
+	},
+
+	xmlflash : function(){
+		var s = new XMLSerializer();
+		var xml = s.serializeToString(bitsSubstitutionTree.xmldoc);
+		bitsSubstitutionTree.Common.writeFile(bitsSubstitutionTree._xmlfile, xml+"\n","UTF-8");
+	},
+
+	addSubstitution : function(aItem){
+		var results = this.XPath.evaluateArray('//item[@src="'+aItem.src+'"]',this.xmldoc);
+		if(results.length){
+			this.Common.alert(this.STRING.getString("ALERT_REGISTERED"));
+			return false;
+		}
+		if(this.xmldoc){
+			var node = this.xmldoc.createElement("item");
+			node.setAttribute("src",aItem.src);
+			node.setAttribute("alt",aItem.alt);
+			this.xmldoc.documentElement.appendChild(node);
+			this.xmlflash();
+		}
+	},
+
+	_confirmRemovingFor : function(){
+		try{
+			if(bitsSubstitutionTree.confirmDelete){
+				return this.Common.confirm( bitsSubstitutionTree.STRING.getString("CONFIRM_DELETE") );
+			}
+			return true;
+		}catch(e){
+			return false;
+		}
+	},
+
+	removeSubstitution : function(aEvent){
+		if(!this.xmldoc || !this._explicitOriginalTarget) return;
+		if(!this._confirmRemovingFor()) return;
+		var src = this._explicitOriginalTarget.getAttribute("src");
+		var results = this.XPath.evaluateArray('//item[@src="'+src+'"]',this.xmldoc);
+		if(results.length){
+			var i;
+			for(i=results.length-1;i>=0;i--){
+				results[i].parentNode.removeChild(results[i]);
+			}
+			this.xmlflash();
+		}
+		this._explicitOriginalTarget = undefined;
+	},
+
+	getSubstitutionText : function(aNode){
+		var selectimportimage = nsPreferences.copyUnicharPref("wiredmarker.selectimportimage","none");
+		var src = (aNode.src?aNode.src:"");
+		var alt = (aNode.alt?aNode.alt:"");
+		if(selectimportimage == "alt") return alt;
+		if(selectimportimage == "alt_substitution" && alt != "") return alt;
+		if(selectimportimage == "substitution") alt = "";
+		src = src.replace(/^\s*/mg,"").replace(/\s*$/mg,"");
+		if(src == "") return "";
+		try{
+			var aURI = this.Common.convertURLToObject(src);
+			var aURL = aURI.QueryInterface(Components.interfaces.nsIURL);
+		}catch(e){}
+		if(!aURL) return "";
+		var results = this.XPath.evaluateArray('//item[@src="'+aURL.fileName+'"]',this.xmldoc);
+		if(results.length){
+			alt = results[0].getAttribute("alt");
+		}else{
+			var confirm = nsPreferences.getBoolPref("wiredmarker.substitution.confirm", true);
+			if(confirm){
+				if(this.Common.confirm( this.STRING.getString("CONFIRM_SUBSTITUTION_TABLE_NONE") )){
+					var src = {value: aURL.fileName};
+					var alt = {value: (aNode.alt?aNode.alt:"")};
+					var check = {value: false};
+					var result = false;
+					do{
+						result = this.Common.PROMPT.prompt(window, this.STRING.getString("MSG_SUBSTITUTION_ADD"), this.STRING.getString("MSG_SUBSTITUTION_INPUT_FILENAME"), src, null, check);
+						if(!result) return alt;
+						src.value = src.value.replace(/^\s*/mg,"").replace(/\s*$/mg,"");
+					}while(src.value == "");
+					var src_results = this.XPath.evaluateArray('//item[@src="'+src.value+'"]',this.xmldoc);
+					if(src_results.length){
+						this.Common.alert(this.STRING.getString("ALERT_REGISTERED"));
+						return alt;
+					}
+					result = this.Common.PROMPT.prompt(window, this.STRING.getString("MSG_SUBSTITUTION_ADD"), this.STRING.getString("MSG_SUBSTITUTION_FILENAME") + ":["+src.value+"]\n" + this.STRING.getString("MSG_SUBSTITUTION_INPUT_SUBSTITUTE_TEXT"), alt, null, check);
+					if(!result) return alt;
+					var node = this.xmldoc.createElement("item");
+					node.setAttribute("src",src.value);
+					node.setAttribute("alt",alt.value);
+					this.xmldoc.documentElement.appendChild(node);
+					alt = alt.value;
+				}
+			}
+		}
+		return (alt?alt:"");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+};
+
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/substitutiontreeOverlay.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/substitutiontreeOverlay.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/substitutiontreeOverlay.js	(revision 5703)
@@ -0,0 +1,220 @@
+var bitsSubstitutionTreeOverlay = {
+	_init : false,
+	_pref : {},
+	_app_version : 0,
+	_changed : false,
+
+	get POS_DEFAULT()     { return this.POS_TREE_RIGHT; },
+	get POS_TREE_BOTTOM() { return "tree_bottom"; },
+	get POS_TREE_RIGHT()  { return "tree_right"; },
+
+	get BUTTON() {
+		try{
+			return bitsMarkingCollection._contentWindow.document.getElementById("mcToolbarItemTreeButton");
+		}catch(e){ return undefined; }
+	},
+
+	get TREE()     { return document.getElementById("bitsSubstitutionTree"); },
+	get ADD()      { return document.getElementById("bitsSubstitutionTreeAdd"); },
+	get EDIT()     { return document.getElementById("bitsSubstitutionTreeEdit"); },
+	get DEL()      { return document.getElementById("bitsSubstitutionTreeDel"); },
+
+	get STRING()     { return window.opener.top.document.getElementById("MarkingCollectionOverlayString"); },
+	get DataSource() { return window.opener.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.opener.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.opener.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.opener.top.bitsObjectMng.Database;   },
+	get XML()        { return window.opener.top.bitsObjectMng.XML;   },
+	get gBrowser()   { return window.opener.top.bitsObjectMng.getBrowser();},
+
+
+	get bitsSubstitutionTree(){ return window.opener.top.bitsSubstitutionTree; },
+	get xmldoc()              { return this.bitsSubstitutionTree.xmldoc; },
+	get confirmRemovingFor()  { return this.bitsSubstitutionTree._confirmRemovingFor; },
+
+/////////////////////////////////////////////////////////////////////
+	init : function(aEvent){
+		if(!this._init){
+			this.rebuild();
+			this._init = true;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	disp : function(aEvent){
+		this.treeDispChange();
+		this.rebuild();
+		this.SPLITTER.setAttribute("hidden",!this._pref.disp);
+		this.VBOX.setAttribute("hidden",!this._pref.disp);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(aEvent){
+		if(this._changed) this.bitsSubstitutionTree.xmlflash();
+	},
+
+/////////////////////////////////////////////////////////////////////
+// TREE è¡šç€ºå¶åŸ¡é¢é£
+/////////////////////////////////////////////////////////////////////
+	get rowCount(){
+		var results = this.XPath.evaluateArray('//item',this.xmldoc);
+		return results.length;
+	},
+	getCellText : function(row,column){
+		var results = this.XPath.evaluateArray('//item',this.xmldoc);
+		if(!results[row]) return null;
+		if(column.id == "bitsSubstitutionTreeSrcCol"){
+			return results[row].getAttribute("src");
+		}else if(column.id == "bitsSubstitutionTreeAltCol"){
+			return results[row].getAttribute("alt");
+		}else{
+			return null;
+		}
+	},
+	setTree: function(treebox){ this.treebox = treebox; },
+	isContainer: function(row){ return false; },
+	isSeparator: function(row){ return false; },
+	isSorted: function(){ return true; },
+	getLevel: function(row){ return 0; },
+	getImageSrc: function(row,column){ return null; },
+	getRowProperties: function(row,prop){
+	},
+	getCellProperties: function(row, column, prop) {
+	},
+	getColumnProperties: function(column, element, prop) {},
+	cycleHeader : function(col){},
+	setCellText : function(row,column,text){},
+  getParentIndex: function(idx) { return -1; },
+	canDrop : function(index, orient){
+		return false;
+	},
+	onDrop : function(row, orient){},
+	drop : function(row, orient){},
+
+
+/////////////////////////////////////////////////////////////////////
+	rebuild : function(){
+		this.TREE.view = bitsSubstitutionTreeOverlay;
+	},
+
+/////////////////////////////////////////////////////////////////////
+// TREE ã€ãã³ãé¢é£
+/////////////////////////////////////////////////////////////////////
+	onClick : function(aEvent){
+		if(this.TREE.view.selection.count == 0) return false;
+		var idxList = this.getSelection();
+		if(this.validateMultipleSelection(idxList) == false) return false;
+		this.EDIT.removeAttribute("disabled");
+		this.DEL.removeAttribute("disabled");
+	},
+
+	onDblClick : function(aEvent){
+		this.onEdit(aEvent);
+	},
+
+	onAdd : function(aEvent){
+		var src = {value: ""};
+		var alt = {value: ""};
+		var check = {value: false};
+		var result = false;
+		do{
+			result = this.Common.PROMPT.prompt(window, this.STRING.getString("MSG_SUBSTITUTION_ADD"), this.STRING.getString("MSG_SUBSTITUTION_INPUT_FILENAME"), src, null, check);
+			if(!result) return;
+			src.value = src.value.replace(/^\s*/mg,"").replace(/\s*$/mg,"");
+		}while(src.value == "");
+		var src_results = this.XPath.evaluateArray('//item[@src="'+src.value+'"]',this.xmldoc);
+		if(src_results.length){
+			alert(this.STRING.getString("ALERT_REGISTERED"));
+			return;
+		}
+		result = this.Common.PROMPT.prompt(window, this.STRING.getString("MSG_SUBSTITUTION_ADD"), this.STRING.getString("MSG_SUBSTITUTION_FILENAME") + ":["+src.value+"]\n" + this.STRING.getString("MSG_SUBSTITUTION_INPUT_SUBSTITUTE_TEXT"), alt, null, check);
+		if(!result) return;
+		var node = this.xmldoc.createElement("item");
+		node.setAttribute("src",src.value);
+		node.setAttribute("alt",alt.value);
+		this.xmldoc.documentElement.appendChild(node);
+		this.rebuild();
+		this._changed = true;
+	},
+
+	onEdit : function(aEvent){
+		if(this.TREE.view.selection.count == 0) return false;
+		var idxList = this.getSelection();
+		if(this.validateMultipleSelection(idxList) == false) return false;
+		var src = {value: ""};
+		var alt = {value: ""};
+		var check = {value: false};
+		var result = false;
+		var results = this.XPath.evaluateArray('//item',this.xmldoc);
+		var i;
+		for(i=0;i<idxList.length;i++){
+			var row = idxList[i];
+			if(!results[row]) continue;
+			var org_src = results[row].getAttribute("src");
+			src.value = org_src;
+			alt.value = results[row].getAttribute("alt");
+			do{
+				result = this.Common.PROMPT.prompt(window, this.STRING.getString("MSG_SUBSTITUTION_EDIT"), this.STRING.getString("MSG_SUBSTITUTION_INPUT_FILENAME"), src, null, check);
+				if(!result) return;
+				src.value = src.value.replace(/^\s*/mg,"").replace(/\s*$/mg,"");
+				if(src.value != org_src){
+					var src_results = this.XPath.evaluateArray('//item[@src="'+src.value+'"]',this.xmldoc);
+					if(src_results.length){
+						alert(this.STRING.getString("ALERT_REGISTERED"));
+						return;
+					}
+				}
+			}while(src.value == "");
+			result = this.Common.PROMPT.prompt(window, this.STRING.getString("MSG_SUBSTITUTION_EDIT"), this.STRING.getString("MSG_SUBSTITUTION_FILENAME") + ":["+src.value+"]\n" + this.STRING.getString("MSG_SUBSTITUTION_INPUT_SUBSTITUTE_TEXT"), alt, null, check);
+			if(!result) return;
+			results[row].setAttribute("src",src.value);
+			results[row].setAttribute("alt",alt.value);
+		}
+		this._changed = true;
+	},
+
+	onDel : function(aEvent){
+		if(this.TREE.view.selection.count == 0) return false;
+		var idxList = this.getSelection();
+		if(this.validateMultipleSelection(idxList) == false) return false;
+		if(!this.confirmRemovingFor()) return false;
+		var results = this.XPath.evaluateArray('//item',this.xmldoc);
+		var i;
+		for(i=idxList.length-1;i>=0;i--){
+			var row = idxList[i];
+			if(!results[row]) continue;
+			this.xmldoc.documentElement.removeChild(results[row]);
+		}
+		this.rebuild();
+		this._changed = true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getSelection : function(){
+		var ret = [];
+		var rc;
+		var i;
+		for(rc=0;rc<this.TREE.view.selection.getRangeCount();rc++){
+			var start = {}, end = {};
+			this.TREE.view.selection.getRangeAt(rc, start, end);
+			for(i=start.value;i<= end.value;i++){
+				if(!this.TREE.view.selection.isSelected(i)) continue;
+				ret.push(i);
+			}
+		}
+		return ret;
+	},
+
+	validateMultipleSelection : function(aIdxList){
+		if(aIdxList.length != this.TREE.view.selection.count){
+			alert(this.STRING.getString("ERROR_MULTIPLE_SELECTION"));
+			return false;
+		}
+		return true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		if(nsPreferences.getBoolPref("wiredmarker.debug", false)) window.dump(this.Common.convertFormUnicode(aString,"Shift_jis")+"\n");
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/substitutiontreeOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/substitutiontreeOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/substitutiontreeOverlay.xul	(revision 5703)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+	id="substitutiontreeOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/substitutiontreeOverlay.js"/>
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _substitutiontreeInit(aEvent){
+			bitsSubstitutionTreeOverlay.init(aEvent);
+		}
+		function _substitutiontreeDone(aEvent){
+			bitsSubstitutionTreeOverlay.done(aEvent);
+		}
+		window.addEventListener("load", _substitutiontreeInit, false);
+		window.addEventListener("unload", _substitutiontreeDone, false);
+	]]>
+	</script>
+	<groupbox id="bitsSubstitutionTreeGroupBox">
+		<hbox flex="1">
+			<tree
+				id="bitsSubstitutionTree"
+				tooltip="mcPopupTooltip"
+				flex="1"
+				hidecolumnpicker="true"
+				seltype="single"
+				class="tree"
+				onclick="bitsSubstitutionTreeOverlay.onClick(event);"
+				ondblclick="bitsSubstitutionTreeOverlay.onDblClick(event);"
+			>
+				<treecols id="bitsSubstitutionTreeCols">
+					<treecol
+						id="bitsSubstitutionTreeSrcCol"
+						flex="1"
+						label="&markingcollection.substitutiontree.src;"
+						persist="width"/>
+					<splitter class="tree-splitter"/>
+					<treecol
+						id="bitsSubstitutionTreeAltCol"
+						flex="1"
+						label="&markingcollection.substitutiontree.alt;"
+						persist="width"/>
+				</treecols>
+				<treechildren/>
+			</tree>
+			<vbox>
+				<toolbarbutton
+					id="bitsSubstitutionTreeAdd"
+					label="&markingcollection.substitutiontree.add;"
+					image="chrome://markingcollection/skin/menu_create.png"
+					oncommand="bitsSubstitutionTreeOverlay.onAdd(event);"/>
+				<toolbarbutton
+					id="bitsSubstitutionTreeEdit"
+					label="&markingcollection.substitutiontree.edit;"
+					image="chrome://markingcollection/skin/menu_property.png"
+					disabled="true"
+					oncommand="bitsSubstitutionTreeOverlay.onEdit(event);"/>
+				<toolbarbutton
+					id="bitsSubstitutionTreeDel"
+					label="&markingcollection.substitutiontree.del;"
+					image="chrome://markingcollection/skin/menu_remove.png"
+					disabled="true"
+					oncommand="bitsSubstitutionTreeOverlay.onDel(event);"/>
+			</vbox>
+		</hbox>
+	</groupbox>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/tagoutput.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/tagoutput.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/tagoutput.js	(revision 5703)
@@ -0,0 +1,574 @@
+/////////////////////////////////////////////////////////////////////
+// ã¿ã°ä»ãåºåæ©èœé¢é£
+/////////////////////////////////////////////////////////////////////
+var bitsTagOutputService = {
+
+	_saveinfo : null,
+
+	get STRING()     { return document.getElementById("MarkingCollectionOverlayString"); },
+	get DataSource() { return bitsObjectMng.DataSource; },
+	get Common()     { return bitsObjectMng.Common;     },
+	get XPath()      { return bitsObjectMng.XPath;      },
+	get Database()   { return bitsObjectMng.Database;   },
+	get gBrowser()   { return bitsObjectMng.getBrowser();},
+
+	get BROWSER()    { return document.getElementById("bitsTagOutputBrowser"); },
+
+	get SIDEBAR() { return window.top.document.getElementById("sidebar"); },
+	get CONTENT() { return window.top.document.getElementById("content"); },
+
+	get SIDEBAR_DOC() {try{return this.SIDEBAR.contentDocument;}catch(e){return undefined;}},
+	get SIDEBAR_WIN() {try{return this.SIDEBAR.contentWindow;}catch(e){return undefined;}},
+	get mcTreeHandler() {try{return this.SIDEBAR_WIN.mcTreeHandler;}catch(e){return undefined;}},
+	get mcMainService() {try{return this.SIDEBAR_WIN.mcMainService;}catch(e){return undefined;}},
+	get mcController() {try{return this.SIDEBAR_WIN.mcController;}catch(e){return undefined;}},
+	get mcPropertyView() {try{return this.SIDEBAR_WIN.mcPropertyView;}catch(e){return undefined;}},
+	get mcTreeViewModeService() {try{return this.SIDEBAR_WIN.mcTreeViewModeService;}catch(e){return undefined;}},
+	get bitsItemView() {try{return this.SIDEBAR_WIN.bitsItemView;}catch(e){return undefined;}},
+
+	get TREE_POPUP(){try{return this.SIDEBAR_DOC.getElementById("mcPopup");}catch(e){return undefined;}},
+	get TREE_LISTVIEWMENU(){try{return this.SIDEBAR_DOC.getElementById("mcPopupViewMenu");}catch(e){return undefined;}},
+	get TREE_TAGOUTPUTMENU(){try{return this.SIDEBAR_DOC.getElementById("mcPopupTagOutput");}catch(e){return undefined;}},
+	get TREE_TAGOUTPUTMENU_SEP(){try{return this.SIDEBAR_DOC.getElementById("mcPopupTagOutputMenuseparator");}catch(e){return undefined;}},
+
+	get ITEMTREE_POPUP(){try{return this.SIDEBAR_DOC.getElementById("bitsItemTreePopup");}catch(e){return undefined;}},
+	get ITEMTREE_CACHEMENU(){try{return this.SIDEBAR_DOC.getElementById("bitsItemTreePopupCache");}catch(e){return undefined;}},
+	get ITEMTREE_TAGOUTPUTMENU(){try{return this.SIDEBAR_DOC.getElementById("bitsItemTreePopupTagOutput");}catch(e){return undefined;}},
+	get ITEMTREE_TAGOUTPUTMENU_SEP(){try{return this.SIDEBAR_DOC.getElementById("bitsItemTreePopupTagOutputMenuseparator");}catch(e){return undefined;}},
+
+	get _contentAreaContextMenu() { return window.top.document.getElementById("contentAreaContextMenu"); },
+	get CONTEXTMENU() { return window.top.document.getElementById("MarkingCollectionContextMenuTagOutput"); },
+	get CONTEXTMENUSEP() { return window.top.document.getElementById("MarkingCollectionContextMenuTagOutputSeparator"); },
+
+
+/////////////////////////////////////////////////////////////////////
+	init : function(aEvent){
+		this._contentAreaContextMenu.addEventListener("popupshowing",this.popupshowing_contextmenu,false);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(aEvent){
+		this._contentAreaContextMenu.removeEventListener("popupshowing",this.popupshowing_contextmenu,false);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	load : function(aEvent){
+		var popup = this.TREE_POPUP;
+		if(!popup) return;
+		popup.addEventListener("popupshowing",this.popupshowing_tree, false);
+		var popup = this.ITEMTREE_POPUP;
+		if(!popup) return;
+		popup.addEventListener("popupshowing",this.popupshowing_itemview, false);
+//		popup.addEventListener("popupshown",this.popupshown_tree, false);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	unload : function(aEvent){
+		var popup = this.TREE_POPUP;
+		if(!popup) return;
+		popup.removeEventListener("popupshowing",this.popupshowing_tree, false);
+		var popup = this.ITEMTREE_POPUP;
+		if(!popup) return;
+		popup.removeEventListener("popupshowing",this.popupshowing_itemview, false);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	popupshowing_contextmenu : function(aEvent){
+		bitsTagOutputService._popupshowing_contextmenu(aEvent);
+	},
+
+	_popupshowing_contextmenu : function(aEvent){
+		this.CONTEXTMENUSEP.setAttribute("hidden","true");
+		this.CONTEXTMENU.setAttribute("hidden","true");
+		var contextmenu_mode = nsPreferences.copyUnicharPref("wiredmarker.contextmenu.mode");
+		var contextmenu_type = nsPreferences.copyUnicharPref("wiredmarker.contextmenu.type","");
+		if(contextmenu_mode == "legacy" && contextmenu_type == "simple") return;
+		var popup_elem = false;
+		var cm = bitsContextMenu._contextMenuObject;
+		if(cm && (cm.isTextSelected || cm.onLink || cm.onImage)) popup_elem = true;
+		if(this.isDispContextmenu(this.gBrowser.contentDocument)){
+			this.CONTEXTMENU.removeAttribute("hidden");
+			if(popup_elem) this.CONTEXTMENUSEP.removeAttribute("hidden");
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	popupshowing_tree : function(aEvent){
+		bitsTagOutputService._popupshowing_tree(aEvent);
+	},
+
+	_popupshowing_tree : function(aEvent){
+		var contextmenu_mode = nsPreferences.copyUnicharPref("wiredmarker.contextmenu.mode");
+		if(contextmenu_mode == "legacy"){
+			var contextmenu_type = nsPreferences.copyUnicharPref("wiredmarker.contextmenu.type","");
+			if(contextmenu_type == "simple"){
+				this.TREE_TAGOUTPUTMENU.setAttribute("hidden","true");
+			}else{
+				this.TREE_TAGOUTPUTMENU.removeAttribute("hidden");
+			}
+			if(contextmenu_type == "simple"){
+				this.TREE_TAGOUTPUTMENU_SEP.setAttribute("hidden","true");
+			}else{
+				this.TREE_TAGOUTPUTMENU_SEP.removeAttribute("hidden");
+			}
+		}else{
+			this.TREE_TAGOUTPUTMENU.removeAttribute("hidden");
+			if(this.TREE_LISTVIEWMENU.hasAttribute("hidden")){
+				this.TREE_TAGOUTPUTMENU_SEP.setAttribute("hidden","true");
+			}else{
+				this.TREE_TAGOUTPUTMENU_SEP.removeAttribute("hidden");
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	popupshown_tree : function(aEvent){
+		bitsTagOutputService._popupshown_tree(aEvent);
+	},
+
+	_popupshown_tree : function(aEvent){
+		var popup = aEvent.target;
+		var elem = popup.firstChild;
+		while(elem){
+			if(!elem.hidden) this._dump("elem=["+elem.nodeName+"]["+elem.id+"]["+elem.hidden+"]");
+			elem = elem.nextSibling;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	popupshowing_itemview : function(aEvent){
+		bitsTagOutputService._popupshowing_itemview(aEvent);
+	},
+
+	_popupshowing_itemview : function(aEvent){
+		var contextmenu_mode = nsPreferences.copyUnicharPref("wiredmarker.contextmenu.mode");
+		if(contextmenu_mode == "legacy"){
+			var contextmenu_type = nsPreferences.copyUnicharPref("wiredmarker.contextmenu.type","");
+			if(contextmenu_type == "simple"){
+				this.ITEMTREE_TAGOUTPUTMENU.setAttribute("hidden","true");
+			}else{
+				this.ITEMTREE_TAGOUTPUTMENU.removeAttribute("hidden");
+			}
+			if(contextmenu_type == "simple"){
+				this.ITEMTREE_TAGOUTPUTMENU_SEP.setAttribute("hidden","true");
+			}else{
+				this.ITEMTREE_TAGOUTPUTMENU_SEP.removeAttribute("hidden");
+			}
+		}else{
+			this.ITEMTREE_TAGOUTPUTMENU.removeAttribute("hidden");
+			this.ITEMTREE_TAGOUTPUTMENU_SEP.removeAttribute("hidden");
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	pageshow : function(aEvent){
+		bitsTagOutputService._pageshow(aEvent);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_pageshow : function(aEvent){
+		var aDoc = aEvent.target;
+		var URLString = this.Common.getURLStringFromDocument(aDoc);
+		if(URLString.indexOf("chrome:") >= 0 || URLString.indexOf("about:") >= 0){
+			if(this._saveinfo.cb){
+				var self = this;
+				setTimeout(function(){ self._saveinfo.cb(aEvent); },0);
+			}
+			return;
+		}
+		if(this._saveinfo.uri != URLString || !aDoc.body) return;
+		if(!this._saveinfo.file){
+			var aSaveFile = this.getSaveFile(this.getDocomentFilename(aDoc));
+			if(aSaveFile){
+				this._saveinfo.file = aSaveFile.clone();
+			}else{
+				this.BROWSER.removeEventListener("pageshow", this.pageshow, false);
+				this._saveinfo.cb = undefined;
+				this._saveinfo = undefined;
+				return;
+			}
+		}
+		var orgURLString = URLString;
+		if(bitsAutocacheService.isCacheURL(orgURLString)) orgURLString = bitsAutocacheService.convertCacheURLToOriginalURL(orgURLString);
+		var folderTag = {}
+		var rtnObj = this.Database.getAllObjectFormContentURL(orgURLString);
+		if(rtnObj && rtnObj.length>0){
+			var cnt;
+			for(cnt=0;cnt<rtnObj.length;cnt++){
+				var rObj = rtnObj[cnt];
+				if(rObj.oid_type.match(/^image\/(.+)$/)) continue;
+				if(!aDoc.defaultView) return;
+				var rtnContent = bitsMarker.xPathMarker(
+					aDoc,
+					{
+						start   : rObj.bgn_dom,
+						end     : rObj.end_dom,
+						context : rObj.oid_txt,
+						con_url : URLString
+					},{
+						id     : rObj.oid,
+						dbtype : rObj.dbtype,
+						pfid   : rObj.pfid,
+						style  : rObj.fid_style
+					}
+				);
+				if(folderTag[rObj.pfid]) continue;
+				folderTag[rObj.pfid] = {
+					dbtype : rObj.dbtype,
+					style  : rObj.fid_style
+				};
+			}
+			var parser = new DOMParser();
+			for(var fid in folderTag){
+				var rtnFolder = this.Database.getFolder({fid:fid},folderTag[fid].dbtype);
+				if(!rtnFolder) continue;
+				rtnFolder = rtnFolder[0];
+				folderTag[fid].tag = rtnFolder.fid_title;
+				if(rtnFolder.fid_property){
+					var xmldoc = parser.parseFromString(rtnFolder.fid_property, "text/xml");
+					if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+					if(xmldoc){
+						var tagNode = xmldoc.getElementsByTagName("TAG")[0];
+						if(tagNode) folderTag[fid].tag = tagNode.textContent;
+						tagNode = undefined;
+						xmldoc = undefined;
+					}
+				}
+			}
+			parser = undefined;
+			var nodesSnapshot = this.getMarkerNodes(aDoc);
+			for(var i=0;i<nodesSnapshot.snapshotLength;i++){
+				var node = nodesSnapshot.snapshotItem(i);
+				var fid = node.getAttribute('pfid');
+				if(!folderTag[fid]) continue;
+				if(this._saveinfo.hidden){
+					var range = aDoc.createRange();
+					range.selectNodeContents(node);
+					var tagNode = aDoc.createElement(folderTag[fid].tag);
+					var docfrag = range.extractContents();
+					tagNode.appendChild(docfrag);
+					range.insertNode(tagNode);
+					range = undefined;
+				}else{
+					var tagNode = aDoc.createTextNode('<'+folderTag[fid].tag+'>');
+					if(node.firstChild){
+						node.insertBefore(tagNode,node.firstChild);
+					}else{
+						node.appendChild(tagNode);
+					}
+					node.appendChild(aDoc.createTextNode('</'+folderTag[fid].tag+'>'));
+				}
+				if(this._saveinfo.style){
+					var attrs = node.attributes;
+					for(var a=attrs.length-1;a>=0;a--){
+						if(attrs[a].name == 'style') continue;
+						node.removeAttribute(attrs[a].name);
+					}
+				}else{
+					var parent = node.parentNode;
+					var children = node.childNodes;
+					var index;
+					for(index = children.length-1;index>=0;index--){
+						parent.insertBefore(children[0],node);
+					}
+					parent.removeChild(node);
+					parent.normalize();
+				}
+			}
+			if(this._saveinfo.rpath){
+				if(aDoc.images && aDoc.images.length>0){
+					for(var i=0;i<aDoc.images.length;i++){
+						aDoc.images[i].setAttribute("src",aDoc.images[i].src);
+					}
+				}
+				if(aDoc.links && aDoc.links.length>0){
+					for(var i=0;i<aDoc.links.length;i++){
+						aDoc.links[i].setAttribute("href",aDoc.links[i].href);
+					}
+				}
+				var nodesSnapshot = this.XPath.evaluate('//link[@href]',aDoc);
+				for(var i=0;i<nodesSnapshot.snapshotLength;i++){
+					var node = nodesSnapshot.snapshotItem(i);
+					node.setAttribute("href",node.href);
+				}
+				var nodesSnapshot = this.XPath.evaluate('//*[@style]',aDoc);
+				for(var i=0;i<nodesSnapshot.snapshotLength;i++){
+					var node = nodesSnapshot.snapshotItem(i);
+					if(!node.style.backgroundImage) continue;
+					if(node.style.backgroundImage.match(/^url\((.+)?\)/)){
+						node.style.backgroundImage = 'url(' + this.Common.resolveURL(aDoc.location.href,RegExp.$1) + ')';
+					}
+				}
+			}
+			var file = null;
+			if(!this._saveinfo.file.exists() || this._saveinfo.file.isFile()){
+				file = this._saveinfo.file.clone();
+			}else if(this._saveinfo.file.isDirectory()){
+				var fn = this.getDocomentFilename(aDoc);
+				if(fn){
+					file = this._saveinfo.file.clone();
+					file.append(fn);
+					if(file.exists()){
+						if(!this.Common.confirm(this.STRING.getString("CONFIRM_FILE_OVERWRITE")+"\n["+file.path+"]")){
+							file = this.getSaveFile(file.path);
+							if(!file){
+								if(this._saveinfo.list && this._saveinfo.list.length>0) this._saveinfo.list.length = 0;
+								this._saveinfo.cb = undefined;
+							}
+						}
+					}
+				}
+			}
+			if(file){
+				var content = null;
+				if(this._saveinfo.style || this._saveinfo.hidden || aDoc.contentType != 'text/plain'){
+					content = '<html>' + aDoc.documentElement.innerHTML + '</html>';
+				}else{
+					var nodesSnapshot = this.XPath.evaluate('/html/body/pre[1]',aDoc);
+					if(nodesSnapshot && nodesSnapshot.snapshotLength>0) content = nodesSnapshot.snapshotItem(0).textContent;
+				}
+				if(content) this.writeFile(file,content,aDoc.characterSet);
+			}
+		}
+		if(this._saveinfo.list && this._saveinfo.list.length>0){
+			this._saveinfo.uri = this._saveinfo.list.shift();
+			this.BROWSER.loadURI(this._saveinfo.uri);
+		}else if(this._saveinfo.cb){
+			var self = this;
+			setTimeout(function(){ self._saveinfo.cb(aEvent); },0);
+		}else{
+			this.BROWSER.removeEventListener("pageshow", this.pageshow, false);
+			this._saveinfo.cb = undefined;
+			this._saveinfo = undefined;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	isDispContextmenu : function(aDoc){
+		var nodesSnapshot = this.getMarkerNodes(aDoc);
+		return (nodesSnapshot&&nodesSnapshot.snapshotLength>0?true:false);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getMarkerNodes : function(aDoc){
+		return this.XPath.evaluate('//*[@id and @dbtype and @pfid]',aDoc);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getOptions : function(){
+		var result = {
+			accept : false,
+			uri    : null,
+			file   : null,
+			list   : null,
+			cb     : this.outputDone,
+			hidden : nsPreferences.getBoolPref("wiredmarker.tagoutput.tag.hidden", false),
+			style  : nsPreferences.getBoolPref("wiredmarker.tagoutput.tag.style",  false),
+			rpath  : nsPreferences.getBoolPref("wiredmarker.tagoutput.path.change",true)
+		};
+		window.openDialog("chrome://markingcollection/content/tagoutputDialog.xul", "", "chrome,centerscreen,modal", result);
+		if(result.accept){
+			nsPreferences.setBoolPref("wiredmarker.tagoutput.tag.hidden", result.hidden);
+			nsPreferences.setBoolPref("wiredmarker.tagoutput.tag.style",  result.style);
+			nsPreferences.setBoolPref("wiredmarker.tagoutput.path.change",result.rpath);
+			delete result.accept;
+			return result;
+		}else{
+			return undefined;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onTagOutputRdfCommand : function(aParam){
+		if(!this.mcTreeHandler) return;
+		var aRes = this.mcTreeHandler.resource;
+		if(!aRes) return;
+		this._saveinfo = this.getOptions();
+		if(!this._saveinfo) return;
+		if(this.DataSource.isContainer(aRes)){
+			this._saveinfo.file = this.getSaveFolder(this.DataSource.getProperty(aRes, "title"));
+			if(!this._saveinfo.file) return;
+
+			this._saveinfo.list = [];
+			var hash = {};
+
+			var folderList = this.DataSource.flattenResources(aRes, 1, true);
+//			this._dump(folderList.length);
+			var f;
+			for(f=0;f<folderList.length;f++){
+				var fid = this.DataSource.getProperty(folderList[f], "id");
+				var dbtype = this.DataSource.getProperty(folderList[f], "dbtype");
+				var rtnObjs = this.Database.getObject({pfid:fid},dbtype);
+				if(rtnObjs && rtnObjs.length){
+					var i;
+					for(i=0;i<rtnObjs.length;i++){
+						if(hash[rtnObjs[i].doc_url] != undefined) continue;
+						hash[rtnObjs[i].doc_url] = rtnObjs[i].doc_url;
+						this._saveinfo.list.push(rtnObjs[i].doc_url);
+					}
+				}
+			}
+
+//			this._dump("this._saveinfo.list.length=["+this._saveinfo.list.length+"]");
+
+			if(this._saveinfo.list.length>0){
+				this._saveinfo.uri = this._saveinfo.list.shift();
+				this.BROWSER.addEventListener("pageshow", this.pageshow, false);
+				this.BROWSER.loadURI(this._saveinfo.uri);
+			}
+		}else{
+			this._saveinfo.uri = this.DataSource.getProperty(aRes, "uri");
+			this.BROWSER.addEventListener("pageshow", this.pageshow, false);
+			this.BROWSER.loadURI(this._saveinfo.uri);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onTagOutputItemviewCommand : function(aParam){
+		var object = this.bitsItemView.object;
+		if(!object) return;
+		this._saveinfo = this.getOptions();
+		if(!this._saveinfo) return;
+		this._saveinfo.uri = object.doc_url;
+		this.BROWSER.addEventListener("pageshow", this.pageshow, false);
+		this.BROWSER.loadURI(this._saveinfo.uri);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onTagOutputContextmenuCommand : function(aParam){
+		this._saveinfo = this.getOptions();
+		if(!this._saveinfo) return;
+		this._saveinfo.uri = this.Common.getURLStringFromDocument(this.gBrowser.contentDocument);
+		this.BROWSER.addEventListener("pageshow", this.pageshow, false);
+		this.BROWSER.loadURI(this._saveinfo.uri);
+		aParam.event.stopPropagation();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	outputDone : function(aEvent){
+		bitsTagOutputService._outputDone(aEvent);
+	},
+
+	_outputDone : function(aEvent){
+		if(this._saveinfo.uri == this.Common.getURLStringFromDocument(aEvent.target)){
+			this.BROWSER.removeEventListener("pageshow", this.pageshow, false);
+			this._saveinfo.cb = undefined;
+			this._saveinfo = undefined;
+			this.Common.alert('Output documents.');
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	writeFile : function(aFile, aContent, aCharacterSet){
+		try {
+			if(aCharacterSet == undefined) aCharacterSet = 'UTF-8';
+			if(!aFile.parent.exists()) aFile.parent.create(aFile.DIRECTORY_TYPE, 0777);
+			if(aFile.exists()) aFile.remove(false);
+			aFile.create(aFile.NORMAL_FILE_TYPE, 0666);
+			var content = this.Common.convertFormUnicode(aContent,aCharacterSet);
+			var ostream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
+			ostream.init(aFile, 2, 0x200, false);
+			ostream.write(content, content.length);
+			ostream.close();
+			return true;
+		}catch(ex){
+			this._dump("bitsTagOutputService ERROR: Failed to write file: " + aFile.path + "["+ ex + "]");
+			return false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	saveTagDocoment : function (aParam){
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getDocomentFilename : function (aDoc){
+		var fileBaseName = null;
+		var fileExtension = null;
+		var fileDefault = null;
+		var aURL = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURL);
+		aURL.spec = (typeof aDoc == 'string' ? aDoc : aDoc.location.href);
+		if(aURL.fileBaseName) fileBaseName = aURL.fileBaseName;
+		if(aURL.fileExtension) fileExtension = aURL.fileExtension;
+		if(!fileBaseName){
+			var fileName = this.Common.getFileName(aURL.spec);
+			var splitFileName = this.Common.splitFileName(fileName);
+			if(!splitFileName[0] || splitFileName[0] == ""){
+				fileBaseName = "";
+				var arr = aURL.spec.split("/");
+				while(arr.length){
+					fileBaseName = arr.pop();
+					if(fileBaseName.length>0) break;
+				}
+				if(fileBaseName.length == 0) fileBaseName = "index";
+			}else{
+				fileBaseName = decodeURIComponent(splitFileName[0]);
+			}
+		}
+		if(!fileExtension && typeof aDoc == 'object'){
+			if(aDoc.contentType=='text/plain'){
+				fileExtension = 'txt';
+			}else{
+				fileExtension = 'html';
+			}
+		}
+		if(typeof aDoc == 'object' && aDoc.contentType && aDoc.contentType=='text/html') fileExtension = 'html';
+		if(fileExtension){
+			if(this._saveinfo.style || this._saveinfo.hidden) fileExtension = "html";
+			if(fileExtension != 'html') fileExtension = "txt";
+		}
+		if(fileBaseName && fileExtension) fileDefault = fileBaseName + "." + fileExtension;
+		return fileDefault;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getSaveFile : function (aFilename){
+		var picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
+		var result = null;
+		try{
+			var title = "Selected Save File";
+			picker.init(window, title, picker.modeSave);
+			if(aFilename) picker.defaultString  = aFilename;
+			picker.appendFilters(picker.filterAll|picker.filterText|picker.filterHTML);
+			var showResult = picker.show();
+			if(showResult == picker.returnOK){
+				result = picker.file;
+			}else if(showResult == picker.returnReplace){
+				if(picker.file.exists()) picker.file.remove(false);
+				result = picker.file;
+			}
+		}catch(e){
+			result = null;
+			this.Common.alert(e);
+		}
+		return result;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getSaveFolder : function (aTitle){
+		var picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
+		var result = null;
+		try{
+			var title = "Selected Save Folder";
+			if(aTitle) title += " ["+aTitle+"]";
+			picker.init(window, title, picker.modeGetFolder);
+			if(aTitle) picker.defaultString  = aTitle;
+			var showResult = picker.show();
+			if(showResult == picker.returnOK){
+				result = picker.file;
+			}else if(showResult == picker.returnReplace){
+				if(picker.file.exists()) picker.file.remove(false);
+				result = picker.file;
+			}
+		}catch(e){
+			result = null;
+			this.Common.alert(e);
+		}
+		return result;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	}
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/tagoutputDialog.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/tagoutputDialog.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/tagoutputDialog.js	(revision 5703)
@@ -0,0 +1,120 @@
+var tagoutputDialog = {
+
+/////////////////////////////////////////////////////////////////////
+	get STRING()     { return document.getElementById("tagoutputDialogString"); },
+	get DataSource() { return window.opener.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.opener.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.opener.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.opener.top.bitsObjectMng.Database;   },
+	get gBrowser()   { return window.opener.top.bitsObjectMng.getBrowser();},
+
+	get DIALOG() { return document.getElementById("tagoutputDialog"); },
+	get STYLE_NO()   { return document.getElementById("no_style"); },
+	get STYLE_WITH() { return document.getElementById("with_style"); },
+	get VISIBILITY_VISIBLE() { return document.getElementById("visible"); },
+	get VISIBILITY_HIDDEN()  { return document.getElementById("hidden"); },
+	get FORMAT() { return document.getElementById("format"); },
+	get PATH() { return document.getElementById("path"); },
+
+/////////////////////////////////////////////////////////////////////
+	init : function(){
+		if(tagoutputDialog._init) return;
+
+		try {
+			this.info = window.arguments[0];
+		}catch(ex){
+		}
+
+		if(this.info.hidden){
+			this.VISIBILITY_HIDDEN.setAttribute("selected","true");
+			this.VISIBILITY_VISIBLE.removeAttribute("selected");
+		}else{
+			this.VISIBILITY_VISIBLE.setAttribute("selected","true");
+			this.VISIBILITY_HIDDEN.removeAttribute("selected");
+		}
+
+		if(this.info.style){
+			this.STYLE_WITH.setAttribute("selected","true");
+			this.STYLE_NO.removeAttribute("selected");
+		}else{
+			this.STYLE_NO.setAttribute("selected","true");
+			this.STYLE_WITH.removeAttribute("selected");
+		}
+
+		this.setFormatString();
+
+		this.PATH.checked = this.info.rpath;
+
+		try{
+			this._init = true;
+		}catch(ex){
+			this.Common.alert("tagoutputDialog.init():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(event){
+		if(this._init){
+			this._init = false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	setFormatString : function(){
+		if(this.STYLE_WITH.selected || this.VISIBILITY_HIDDEN.selected){
+			this.FORMAT.setAttribute("value",this.STRING.getString("MSG_FILE_FORMAT_HTML"));
+		}else{
+			this.FORMAT.setAttribute("value",this.STRING.getString("MSG_FILE_FORMAT_ORIGINAL"));
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	style : function(aEvent){
+		if(aEvent.target.value == 'with'){
+			this.STYLE_WITH.setAttribute("selected","true");
+			this.STYLE_NO.removeAttribute("selected");
+			this.info.style = true;
+		}else{
+			this.STYLE_NO.setAttribute("selected","true");
+			this.STYLE_WITH.removeAttribute("selected");
+			this.info.style = false;
+		}
+		this.setFormatString();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	visibility : function(aEvent){
+		if(aEvent.target.value == 'hidden'){
+			this.VISIBILITY_HIDDEN.setAttribute("selected","true");
+			this.VISIBILITY_VISIBLE.removeAttribute("selected");
+			this.info.hidden = true;
+		}else{
+			this.VISIBILITY_VISIBLE.setAttribute("selected","true");
+			this.VISIBILITY_HIDDEN.removeAttribute("selected");
+			this.info.hidden = false;
+		}
+		this.setFormatString();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	path : function(aEvent){
+		this.info.rpath = aEvent.target.checked;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	accept : function(aEvent){
+		window.arguments[0].accept = true;
+		return true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	cancel : function(aEvent){
+		window.arguments[0].accept = false;
+		return true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		if(nsPreferences.getBoolPref("wiredmarker.debug", false)) window.dump(aString+"\n");
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/tagoutputDialog.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/tagoutputDialog.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/tagoutputDialog.xul	(revision 5703)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<dialog
+	id="tagoutputDialog"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml"
+	title="&markingcollection.tagoutput.menu.title;"
+	buttons="accept,cancel"
+	defaultButton="accept"
+	onload="tagoutputDialog.init();"
+	ondialogaccept="return tagoutputDialog.accept();"
+	ondialogcancel="return tagoutputDialog.cancel();">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/tagoutputDialog.js"/>
+	<stringbundleset id="tagoutputDialogStringBundles">
+		<stringbundle id="tagoutputDialogString" src="chrome://markingcollection/locale/markingcollection.properties" />
+	</stringbundleset>
+	<groupbox>
+		<caption label="&markingcollection.tagoutput.output.caption;"/>
+		<groupbox>
+			<caption label="&markingcollection.tagoutput.style.caption;"/>
+			<radiogroup orient="horizontal" oncommand="tagoutputDialog.style(event)">
+				<radio id="no_style"   value="no"   label="&markingcollection.tagoutput.style.no_style;"/>
+				<radio id="with_style" value="with" label="&markingcollection.tagoutput.style.with_style;"/>
+			</radiogroup>
+		</groupbox>
+		<groupbox>
+			<caption label="&markingcollection.tagoutput.visibility.caption;"/>
+			<radiogroup oncommand="tagoutputDialog.visibility(event)">
+				<radio id="visible" value="visible" label="&markingcollection.tagoutput.visibility.visible;"/>
+				<radio id="hidden"  value="hidden"  label="&markingcollection.tagoutput.visibility.hidden;"/>
+				<hbox align="right">
+					<vbox style="background-color:#fff;">
+						<description style="color:#f00">&markingcollection.tagoutput.visibility.description1;</description>
+						<description style="color:#f00">&markingcollection.tagoutput.visibility.description2;</description>
+					</vbox>
+				</hbox>
+			</radiogroup>
+		</groupbox>
+		<groupbox align="center">
+			<caption label="&markingcollection.tagoutput.format.caption;"/>
+			<label id="format" value=""/>
+		</groupbox>
+	</groupbox>
+	<groupbox>
+		<caption label="&markingcollection.tagoutput.html.caption;"/>
+		<checkbox id="path" label="&markingcollection.tagoutput.html.path;" oncommand="tagoutputDialog.path(event)"/>
+	</groupbox>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/tagoutputOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/tagoutputOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/tagoutputOverlay.xul	(revision 5703)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+	id="tagoutputOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://markingcollection/content/tagoutput.js"/>
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _tagoutputOverlayInit(aEvent){
+			window.setTimeout(
+				function(){
+					bitsTagOutputService.init(aEvent);
+				},0);
+		}
+		function _tagoutputOverlayDone(aEvent){
+			bitsTagOutputService.done(aEvent);
+		}
+		window.addEventListener("load", _tagoutputOverlayInit, false);
+		window.addEventListener("unload", _tagoutputOverlayDone, false);
+	]]>
+	</script>
+	<menupopup id="contentAreaContextMenu">
+		<menu id="MarkingCollectionContextMenu">
+			<menupopup id="MarkingCollectionContextMenupopup">
+				<menuseparator
+					id="MarkingCollectionContextMenuTagOutputSeparator"
+					insertafter="MarkingCollectionContextMenuSeparatorMarkerRemove"/>
+				<menuitem
+					id="MarkingCollectionContextMenuTagOutput"
+					class="menuitem-iconic"
+					label="&markingcollection.tagoutput.menu.title;..."
+					image="chrome://markingcollection/skin/tag_save.png"
+					oncommand="window.top.bitsTagOutputService.onTagOutputContextmenuCommand({event:event});"
+					insertafter="MarkingCollectionContextMenuSeparatorMarkerRemove"/>
+			</menupopup>
+		</menu>
+	</menupopup>
+	<vbox id="appcontent">
+		<browser id="bitsTagOutputBrowser" collapsed="true" type="content"/>
+	</vbox>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/tagoutputSidebarOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/tagoutputSidebarOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/tagoutputSidebarOverlay.xul	(revision 5703)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://browser/skin/searchbar.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/content/places/places.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://markingcollection/skin/sidebar.css" type="text/css"?>
+<?xml-stylesheet href="chrome://markingcollection/skin/overlay.css" type="text/css"?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+	id="tagoutputOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _tagoutputInit(aEvent){
+			window.top.bitsTagOutputService.load(aEvent);
+		}
+		function _tagoutputDone(aEvent){
+			window.top.bitsTagOutputService.unload(aEvent);
+		}
+		window.addEventListener("load", _tagoutputInit, false);
+		window.addEventListener("unload", _tagoutputDone, false);
+	]]>
+	</script>
+	<popupset id="mcPopupSet">
+		<menupopup id="mcPopup">
+			<menuitem
+				id="mcPopupTagOutput"
+				class="menuitem-iconic"
+				label="&markingcollection.tagoutput.menu.title;..."
+				image="chrome://markingcollection/skin/tag_save.png"
+				oncommand="window.top.bitsTagOutputService.onTagOutputRdfCommand({event:event});"
+				insertafter="mcPopupProjectDocumentsMenu"/>
+			<menuseparator
+				id="mcPopupTagOutputMenuseparator"
+				observes="mcPopupTagOutput"
+				insertafter="mcPopupProjectDocumentsMenu"/>
+		</menupopup>
+		<menupopup id="bitsItemTreePopup">
+			<menuseparator id="bitsItemTreePopupTagOutputMenuseparator" observes="bitsItemTreePopupCache" insertafter="bitsItemTreePopupCacheMenuseparator"/>
+			<menuitem
+				id="bitsItemTreePopupTagOutput"
+				class="menuitem-iconic"
+				label="&markingcollection.tagoutput.menu.title;..."
+				image="chrome://markingcollection/skin/tag_save.png"
+				oncommand="window.top.bitsTagOutputService.onTagOutputItemviewCommand({event:event});"
+				insertafter="bitsItemTreePopupCacheMenuseparator"/>
+		</menupopup>
+	</popupset>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/templatefolder.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/templatefolder.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/templatefolder.js	(revision 5703)
@@ -0,0 +1,364 @@
+var mcTreeTemplateFolder = {
+
+	get STRING() { return document.getElementById("mcMainString"); },
+
+	get DataSource() { return window.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.top.bitsObjectMng.Common;     },
+	get Database()   { return window.top.bitsObjectMng.Database;   },
+	get XML()     { return window.top.bitsObjectMng.XML;           },
+	get gBrowser()   { return window.top.bitsObjectMng.getBrowser();},
+
+	get DEFAULT_TEMPLATE(){
+		var defname = mcTreeTemplateFolder.STRING.getString("MARKER_FOLDER");
+		var note = mcTreeTemplateFolder.STRING.getString("TEMPLATE_MARKER_FOLDER_COMMENT");
+		var tmpArr = [
+			'<?xml version="1.0" encoding="utf-8"?>',
+			'<!DOCTYPE TEMPLATE>',
+			'<TEMPLATE>',
+			'  <TITLE>'+defname+'</TITLE>',
+			'  <NOTE>'+note+'</NOTE>',
+			'  <FOLDER title="'+defname+'" style="" note="">',
+			'    <FOLDER title="'+defname+'1" style="' + mcTreeTemplateFolder.STRING.getString("MARKER_CUSTOM_1") + '" note="" />',
+			'    <FOLDER title="'+defname+'2" style="' + mcTreeTemplateFolder.STRING.getString("MARKER_CUSTOM_2") + '" note="" />',
+			'    <FOLDER title="'+defname+'3" style="' + mcTreeTemplateFolder.STRING.getString("MARKER_CUSTOM_3") + '" note="" />',
+			'    <FOLDER title="'+defname+'4" style="' + mcTreeTemplateFolder.STRING.getString("MARKER_CUSTOM_4") + '" note="" />',
+			'    <FOLDER title="'+defname+'5" style="' + mcTreeTemplateFolder.STRING.getString("MARKER_CUSTOM_5") + '" note="" />',
+			'    <FOLDER title="'+defname+'6" style="' + mcTreeTemplateFolder.STRING.getString("MARKER_CUSTOM_6") + '" note="" />',
+			'    <FOLDER title="'+defname+'7" style="' + mcTreeTemplateFolder.STRING.getString("MARKER_CUSTOM_7") + '" note="" />',
+			'    <FOLDER title="'+defname+'8" style="' + mcTreeTemplateFolder.STRING.getString("MARKER_CUSTOM_8") + '" note="" />',
+			'  </FOLDER>',
+			'</TEMPLATE>'
+		];
+		return tmpArr.join("\n");
+	},
+
+	init : function(){
+		var file = this.getTemplateDir();
+		var num = 0;
+		var entries = file.directoryEntries;
+		while(entries.hasMoreElements()){
+			var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+			if(!entry.isFile()) continue;
+			num++;
+		}
+		if(num==0){
+			var defname = this.STRING.getString("TEMPLATE_MARKER_TITLE");
+			file.append(escape(defname));
+			this.Common.writeFile(file, this.DEFAULT_TEMPLATE, "UTF-8");
+		}
+	},
+
+	done : function(){},
+
+	createFolder : function(aNode,aPfid,aRes){
+		var title = aNode.getAttribute("title");
+		var style = aNode.getAttribute("style");
+		var dbtype = this.DataSource.getProperty(aRes,"dbtype");
+		var newFolder = this.Database.newFolder(undefined,dbtype);
+		newFolder.fid_title = title;
+		newFolder.fid_style = style;
+		newFolder.pfid = ""+aPfid;
+		newFolder.fid_mode = ""+0;
+		if(!this.Database.addFolder(newFolder,dbtype)) return null;
+		var pfid = newFolder.fid;
+		var newID = this.DataSource.identify(newFolder.fid);
+		var newItem = this.Common.newItem();
+		newItem.about = this.DataSource.ABOUT_ITEM + newID;
+		newItem.id = newFolder.fid;
+		newItem.pfid = newFolder.pfid;
+		newItem.title = title;
+		newItem.type = "folder";
+		newItem.style = style;
+		newItem.cssrule = 'css_'+dbtype+'_'+newID;
+		newItem.editmode = newFolder.fid_mode;
+		newItem.dbtype = dbtype;
+		var tarResName = aRes.Value;
+		var tarRelIdx;
+		try{
+			var cont = this.DataSource.getContainer(tarResName, false);
+			tarRelIdx = cont.GetCount();
+		}catch(ex){
+			tarRelIdx = -1;
+		}
+		var newRes = this.DataSource.addItem(newItem, tarResName, tarRelIdx, dbtype);
+		if(newRes && newRes.Value){
+			this.DataSource.flush();
+			this.DataSource.createEmptySeq(newRes.Value);
+		}else{
+			this.Database.removeFolder({fid:pfid},dbtype);
+			return null;
+		}
+		var pfid_order=0;
+		var childNodes = aNode.childNodes;
+		for(var i=0;i<childNodes.length;i++){
+			switch(childNodes[i].nodeName){
+				case "FOLDER":
+					var rtn = mcTreeTemplateFolder.createFolder(childNodes[i],pfid,newRes);
+					if(rtn){
+						pfid_order++;
+						this.Database.updateFolder({fid:rtn.fid,pfid_order:pfid_order},dbtype);
+					}else{
+						this.Database.removeFolder({fid:pfid},dbtype);
+						return null;
+					}
+					break;
+				default:
+					break;
+			}
+		}
+		return {fid:pfid,res:newRes};
+	},
+
+	onCommand : function(aEvent,aIndex){
+		setTimeout(function(){ mcTreeTemplateFolder._onCommand(aEvent,aIndex); },0);
+	},
+
+	_onCommand : function(aEvent,aIndex){
+		var curIdx = aIndex;
+		var curRes = null;
+		if(curIdx>=0){
+			if(!mcTreeHandler.TREE.view.isContainer(curIdx)) return;
+			curRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+			if(!mcTreeHandler.TREE.view.isContainerOpen(curIdx)) mcTreeHandler.TREE.view.toggleOpenState(curIdx);
+		}else{
+			return;
+		}
+		var pfid = this.DataSource.getProperty(curRes,"id");
+		var dbtype = this.DataSource.getProperty(curRes,"dbtype");
+		var rtn;
+		var uri = this.Common.convertFilePathToURL(aEvent.target.id);
+		var xmldoc = window.top.bitsMarkingCollection.loadXMLDocument(uri);
+		if(xmldoc){
+			var elem = xmldoc.getElementsByTagName("TEMPLATE");
+			if(elem && elem.length>0){
+				var contResList = this.DataSource.seqResources(curRes);
+				var pfid_order=contResList.length;
+				var childNodes = elem[0].childNodes;
+				for(var i=0;i<childNodes.length;i++){
+					switch(childNodes[i].nodeName){
+						case "FOLDER":
+							rtn = mcTreeTemplateFolder.createFolder(childNodes[i],pfid,curRes);
+							if(rtn){
+								pfid_order++;
+								this.Database.updateFolder({fid:rtn.fid,pfid_order:pfid_order},dbtype);
+							}else{
+								return;
+							}
+							break;
+						default:
+							break;
+					}
+				}
+			}
+		}
+		if(!rtn) return;
+		mcTreeCssService.init();
+		mcTreeHandler.TREE.builder.rebuild();
+		var newRes = this.Common.RDF.GetResource(rtn.res.Value);
+		var newIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(newRes);
+		if(!mcTreeHandler.TREE.view.isContainerOpen(newIdx)) mcTreeHandler.TREE.view.toggleOpenState(newIdx);
+		mcTreeHandler.TREE.view.selection.select(newIdx);
+		mcTreeHandler.TREE.focus();
+		var result = mcController.property(newRes);
+		if(result){
+			window.top.bitsMarkingCollection.reOrder(curRes);
+		}else{
+			mcTreeHandler.remove(undefined,undefined,true);
+		}
+		mcController.rebuildLocal();
+		var selectIdx = newIdx;
+		if(selectIdx>=0){
+			mcTreeHandler.TREE.currentIndex = selectIdx;
+			if(!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex)) mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+			mcTreeHandler.TREE.focus();
+			mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(selectIdx);
+			mcPropertyView.dispProperty(mcTreeHandler.object);
+		}
+
+	},
+
+	createMenu : function(aParentNode,aEntry){
+		if(aEntry.isFile()){
+			var elemMenuitem = aParentNode.ownerDocument.createElement("menuitem");
+			if(elemMenuitem){
+				var label = unescape(aEntry.leafName);
+				if(label.lastIndexOf(".xml")>=0) label = label.substr(0,label.lastIndexOf(".xml"));
+				elemMenuitem.setAttribute("id",aEntry.path);
+				elemMenuitem.setAttribute("label",label+"...");
+				elemMenuitem.setAttribute("image","chrome://markingcollection/skin/add-template-folder.png");
+				elemMenuitem.setAttribute("class","menuitem-iconic");
+				aParentNode.appendChild(elemMenuitem);
+			}
+		}else if(aEntry.isDirectory()){
+			var elemMenuSub = top.document.createElement("menu");
+			var elemMenuSubpopup = top.document.createElement("menupopup");
+			if(!elemMenuSub || !elemMenuSubpopup) return;
+			elemMenuSub.setAttribute("label",unescape(aEntry.leafName));
+			elemMenuSub.setAttribute("class","menu-iconic");
+			elemMenuSub.setAttribute("image","chrome://markingcollection/skin/treefolder.png");
+			elemMenuSubpopup.setAttribute("id",aEntry.path);
+			elemMenuSub.appendChild(elemMenuSubpopup);
+			aParentNode.appendChild(elemMenuSub);
+			var entries = aEntry.directoryEntries;
+			while(entries.hasMoreElements()){
+				var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+				mcTreeTemplateFolder.createMenu(elemMenuSubpopup,entry);
+			}
+		}
+	},
+
+	onPopupShowingMng : function(aEvent){
+		var fileNum = 0;
+		var dir  = mcTreeTemplateFolder.getTemplateDir();
+		var entries = dir.directoryEntries;
+		while(entries.hasMoreElements()){
+			var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+			if(unescape(entry.leafName) == this.STRING.getString("TEMPLATE_MARKER_TITLE")) continue;
+			fileNum++;
+		}
+		if(fileNum==0){
+			document.getElementById("mcPopupTemplateFolderRemove").setAttribute("disabled","true");
+			document.getElementById("mcPopupFolderTemplateFolderRemove").setAttribute("disabled","true");
+		}else{
+			document.getElementById("mcPopupTemplateFolderRemove").removeAttribute("disabled");
+			document.getElementById("mcPopupFolderTemplateFolderRemove").removeAttribute("disabled");
+		}
+	},
+
+	onPopupShowing : function(aEvent){
+		var dir  = mcTreeTemplateFolder.getTemplateDir();
+		var entries = dir.directoryEntries;
+		while(entries.hasMoreElements()){
+			var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+			mcTreeTemplateFolder.createMenu(aEvent.target,entry);
+		}
+	},
+
+	onPopupHiding : function(aEvent){
+		var elem = aEvent.target.lastChild;
+		for(var i=aEvent.target.childNodes.length-1;i>=0;i--){
+			if(aEvent.target.childNodes[i].nodeName == "menuseparator") break;
+			aEvent.target.removeChild(aEvent.target.childNodes[i]);
+		}
+	},
+
+
+	onClick : function(aEvent,aIndex){
+		var curIdx = aIndex;
+		var aRes = null;
+		if(curIdx>=0){
+			if(!mcTreeHandler.TREE.view.isContainer(curIdx)) return;
+			aRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+			var result = {};
+			result.title = this.DataSource.getProperty(aRes,"title");
+			result.note = this.DataSource.getProperty(aRes,"note");
+			result.accept = true;
+			window.openDialog("chrome://markingcollection/content/templatefolderproperty.xul", "", "chrome,centerscreen,modal", result);
+			if(result.accept){
+				var file  = mcTreeTemplateFolder.getTemplateDir();
+				file.append(escape(result.title));
+				if(file.exists()){
+					var confirm_mng = mcTreeTemplateFolder.STRING.getString("CONFIRM_TEMPLATE_UPDATE");
+					if(this.Common.confirm(confirm_mng)){
+						file.remove(false);
+					}else{
+						mcTreeTemplateFolder.onClick(aEvent,aIndex);
+						return;
+					}
+				}
+				file.create(file.NORMAL_FILE_TYPE, 0666);
+				ostream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
+				ostream.init(file, 2, 0x200, false);
+				result.title = result.title.replace(/&/mg,"&amp;").replace(/</mg,"&lt;").replace(/>/mg,"&gt;").replace(/\"/mg,"&quot;");
+				result.note = result.note.replace(/&/mg,"&amp;").replace(/</mg,"&lt;").replace(/>/mg,"&gt;").replace(/\"/mg,"&quot;");
+				var aContent = '<?xml version="1.0" encoding="utf-8"?>\n<!DOCTYPE TEMPLATE>\n<TEMPLATE>\n  <TITLE>'+result.title+'</TITLE>\n  <NOTE>'+result.note+'</NOTE>\n';
+				this.Common.UNICODE.charset = "UTF-8";
+				aContent = this.Common.UNICODE.ConvertFromUnicode(aContent);
+				ostream.write(aContent, aContent.length);
+				mcTreeTemplateFolder.createTemplate(aRes,ostream);
+				aContent = "</TEMPLATE>\n";
+				this.Common.UNICODE.charset = "UTF-8";
+				aContent = this.Common.UNICODE.ConvertFromUnicode(aContent);
+				ostream.write(aContent, aContent.length);
+				ostream.close();
+			}
+		}else{
+			return;
+		}
+	},
+
+	onRemove : function(aEvent){
+		var result = {
+			accept : false,
+			list   : [],
+			title  : mcTreeTemplateFolder.STRING.getString("DEL_TEMPLATE_MARKER"),
+		};
+		var dir  = mcTreeTemplateFolder.getTemplateDir();
+		var entries = dir.directoryEntries;
+		while(entries.hasMoreElements()){
+			var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+			if(entry.isFile()){
+				if(unescape(entry.leafName) == this.STRING.getString("TEMPLATE_MARKER_TITLE")) continue;
+				result.list.push(entry);
+			}else if(entry.isDirectory()){
+			}
+		}
+		window.openDialog("chrome://markingcollection/content/removeDialog.xul", "", "chrome,centerscreen,modal", result);
+		if(result.accept){
+		}
+	},
+
+	getTemplateDir : function(){
+		var dir  = window.top.bitsMarkingCollection.getExtensionDir().clone();
+		dir.append("template");
+		if(!dir.exists()) dir.create(dir.DIRECTORY_TYPE, 0700);
+		return dir;
+	},
+
+	createTemplate : function(aRes,aFile,aDepth){
+		var ostream = aFile;
+		var title = this.DataSource.getProperty(aRes,"title");
+		var note = this.DataSource.getProperty(aRes,"note");
+		var style = this.DataSource.getProperty(aRes,"style");
+		if(aDepth == undefined) aDepth = 0;
+		if(aFile == undefined){
+			var file  = mcTreeTemplateFolder.getTemplateDir();
+			file.append(escape(title));
+			if(file.exists()){
+				file.remove(false);
+			}
+			file.create(file.NORMAL_FILE_TYPE, 0666);
+			ostream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
+			ostream.init(file, 2, 0x200, false);
+		}
+		var aTab = "";
+		for(var i=0;i<=aDepth;i++){
+			aTab += "  ";
+		}
+		var contResList = this.DataSource.flattenResources(aRes, 1, false);
+		title = title.replace(/&/mg,"&amp;").replace(/</mg,"&lt;").replace(/>/mg,"&gt;").replace(/\"/mg,"&quot;");
+		if(style) style = style.replace(/&/mg,"&amp;").replace(/</mg,"&lt;").replace(/>/mg,"&gt;").replace(/\"/mg,"&quot;");
+		if(note) note = note.replace(/&/mg,"&amp;").replace(/</mg,"&lt;").replace(/>/mg,"&gt;").replace(/\"/mg,"&quot;");
+		var aContent = aTab + '<FOLDER title="'+title+'" style="'+style+'" note="'+note+'"';
+		if(contResList.length<=1) aContent += ' /';
+		aContent += '>\n';
+		this.Common.UNICODE.charset = "UTF-8";
+		aContent = this.Common.UNICODE.ConvertFromUnicode(aContent);
+		ostream.write(aContent, aContent.length);
+		var contResList = this.DataSource.flattenResources(aRes, 1, false);
+		if(contResList.length>1){
+			for(var i=0;i<contResList.length;i++){
+				if(contResList[i].Value == aRes.Value) continue;
+				mcTreeTemplateFolder.createTemplate(contResList[i],ostream,aDepth+1);
+			}
+			aContent = aTab + '</FOLDER>\n';
+			this.Common.UNICODE.charset = "UTF-8";
+			aContent = this.Common.UNICODE.ConvertFromUnicode(aContent);
+			ostream.write(aContent, aContent.length);
+		}
+		if(aFile == undefined){
+			ostream.close();
+		}
+	},
+
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/templatefolderproperty.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/templatefolderproperty.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/templatefolderproperty.js	(revision 5703)
@@ -0,0 +1,50 @@
+var mcPropService = {
+
+	get STRING()     { return document.getElementById("mcPropString"); },
+
+	get DataSource() { return window.opener.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.opener.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.opener.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.opener.top.bitsObjectMng.Database;   },
+	get gBrowser()   { return window.opener.top.bitsObjectMng.getBrowser();},
+
+	item     : null,
+
+	init : function(){
+		try {
+			this.item = window.arguments[0];
+		}catch(ex){
+		}
+		if(!this.item) return;
+		if(this.item.title){
+			document.title = this.item.title;
+			document.getElementById("mcPropTitle").value = this.item.title;
+		}
+		if(this.item.note) document.getElementById("mcPropNote").value = this.item.note;
+		try{document.getElementById("mcPropTitle").editor.transactionManager.clear();}catch(ex2){}
+		try{document.getElementById("mcPropNote").editor.transactionManager.clear();}catch(ex2){}
+		return;
+	},
+
+	accept : function(){
+		var newVals = {
+			title : document.getElementById("mcPropTitle").value,
+			note  : this.Common.escapeComment(document.getElementById("mcPropNote").value),
+		};
+		var props;
+		for(props in newVals){
+			if(this.item[props] == newVals[props]) continue;
+			window.arguments[0][props] = newVals[props];
+			window.arguments[0].accept = true;
+		}
+	},
+
+	cancel : function(){
+		if(window.arguments[0]) window.arguments[0].accept = false;
+	},
+};
+
+function _dump(aString){
+	if(nsPreferences.getBoolPref("wiredmarker.debug", false)) window.dump(aString+"\n");
+}
+
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/templatefolderproperty.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/templatefolderproperty.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/templatefolderproperty.xul	(revision 5703)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/property.css" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/setting.css" type="text/css" ?>
+<!DOCTYPE wizard [
+<!ENTITY % overlayDTD   SYSTEM "chrome://markingcollection/locale/markingcollection.dtd" >
+%overlayDTD;
+<!ENTITY % markerCustomDTD SYSTEM "chrome://markingcollection/locale/markerCustom.dtd" >
+%markerCustomDTD;
+]>
+<dialog
+	id="mcPropDialog"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	buttons="accept,cancel"
+	onload="mcPropService.init();"
+	ondialogaccept="mcPropService.accept();"
+	ondialogcancel="mcPropService.cancel();">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/templatefolderproperty.js" />
+	<hbox flex="1">
+		<tree
+			id="mcTreeFiles"
+			datasources="rdf:null"
+			ref="urn:allmarker:root"
+			flags="dont-build-content"
+			hidecolumnpicker="true"
+			seltype="single"
+			class="plain" flex="1"  hidden="true">
+			<treecols>
+				<treecol id="mcTreeFilesName" hideheader="true" primary="true" flex="1"/>
+			</treecols>
+			<template>
+				<rule>
+					<treechildren>
+						<treeitem uri="rdf:*">
+							<treerow>
+								<treecell label="rdf:http://home.netscape.com/NC-rdf#Name" />
+							</treerow>
+						</treeitem>
+					</treechildren>
+				</rule>
+			</template>
+		</tree>
+		<vbox flex="1">
+			<groupbox id="mcPropTitleGroup" flex="1">
+				<caption label="&markingcollection.prop.title;" />
+				<textbox id="mcPropTitle" flex="1" style=""/>
+			</groupbox>
+			<groupbox id="mcPropNoteGroup" flex="1">
+				<caption label="&markingcollection.prop.note;" />
+				<textbox id="mcPropNote" multiline="true" flex="1" style="" oninput="" />
+			</groupbox>
+		</vbox>
+	</hbox>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/tree.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/tree.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/tree.js	(revision 5703)
@@ -0,0 +1,3929 @@
+var mcTreeHandler = {
+    get TREE() {
+        return document.getElementById("mcTree");
+    },
+    get TREE_POPUP() {
+        return document.getElementById("mcToolbarRootFolderButton");
+    },
+    get POPUP() {
+        return document.getElementById("mcPopup");
+    },
+    get POPUP_FOLDER() {
+        return document.getElementById("mcPopupFolder");
+    },
+    get POPUP_OBJECT() {
+        return document.getElementById("mcPopupObject");
+    },
+    get DataSource() {
+        return window.top.bitsObjectMng.DataSource;
+    },
+    get Common() {
+        return window.top.bitsObjectMng.Common;
+    },
+    get XPath() {
+        return window.top.bitsObjectMng.XPath;
+    },
+    get Database() {
+        return window.top.bitsObjectMng.Database;
+    },
+    get gBrowser() {
+        return window.top.bitsObjectMng.getBrowser();
+    },
+    get resource() {
+        try {
+            if (this.TREE.view.selection.count < 1 || this.TREE.currentIndex < 0)
+                return null;
+            else
+                return this.TREE.builderView.getResourceAtIndex(this.TREE.currentIndex);
+        } catch (ex) {
+            _dump(ex);
+            return null;
+        }
+    },
+    get object() {
+        var rValue;
+        var obj = null;
+        var res = this.resource;
+        if (res) {
+            var id = this.DataSource.getProperty(res, "id");
+            var dbtype = this.DataSource.getProperty(res, "dbtype");
+            var rValue;
+            if (this.DataSource.isContainer(res)) {
+                rValue = this.Database.getFolderFormID(id, dbtype);
+                if (!rValue) {
+                    rValue = [];
+                    rValue[0] = {
+                        fid: id,
+                        fid_title: this.DataSource.getProperty(res, "title"),
+                        dbtype: dbtype,
+                        fid_mode: this.DataSource.getProperty(res, "editmode")
+                    };
+                }
+            } else {
+                rValue = mcTreeHandler.Database.getObjectFormID(id, dbtype);
+            }
+        }
+        if (rValue && rValue.length > 0)
+            obj = rValue[0];
+        return obj;
+    },
+    autoCollapse: false,
+    progressWindow: null,
+    init: function(isContainer) {
+        try {
+            this.TREE.setAttribute("ref", this.DataSource.ABOUT_ROOT);
+            this.TREE.database.AddDataSource(this.DataSource.data);
+            this.autoCollapse = nsPreferences.getBoolPref("wiredmarker.tree.autoCollapse", false);
+            if (isContainer)
+                document.getElementById("mcTreeRule").setAttribute("iscontainer", true);
+            this.TREE.builder.rebuild();
+
+            this.TREE_POPUP.setAttribute("ref", this.DataSource.ABOUT_ROOT);
+            this.TREE_POPUP.database.AddDataSource(this.DataSource.data);
+            this.TREE_POPUP.builder.rebuild();
+        } catch (ex) {
+        }
+    },
+    done: function() {
+        this.DataSource.flush();
+        var dsEnum = this.TREE.database.GetDataSources();
+        while (dsEnum.hasMoreElements()) {
+            var ds = dsEnum.getNext().QueryInterface(Components.interfaces.nsIRDFDataSource);
+            this.TREE.database.RemoveDataSource(ds);
+        }
+    },
+    pageshow: function() {
+        try {
+            var selectIdx = mcTreeHandler.TREE.currentIndex;
+            mcTreeHandler.TREE.builder.rebuild();
+            if (selectIdx >= 0) {
+                mcTreeHandler.TREE.currentIndex = selectIdx;
+                if (!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex))
+                    mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+                mcTreeHandler.TREE.focus();
+            }
+        } catch (ex) {
+        }
+    },
+    onPopuphidden: function(aEvent) {
+        var self = mcTreeHandler;
+        var resource = self.resource;
+        if (resource) {
+            var contextmenu = self.DataSource.getProperty(resource, "contextmenu");
+            var menu = document.getElementById(contextmenu);
+            if (menu)
+                menu.setAttribute("hidden", "true");
+        }
+    },
+    onMousedown: function(aEvent) {
+        mcTreeImageTooltip.onMousedown(aEvent);
+        mcItemView.onTreeClick(aEvent);
+        if (aEvent.button == 2) {
+            if (bitsSearchAcross.getIndex() == mcTreeHandler.TREE.currentIndex) {
+                mcTreeHandler.TREE.removeAttribute("contextmenu");
+                return;
+            }
+            var contextmenu_mode = nsPreferences.copyUnicharPref("wiredmarker.contextmenu.mode");
+            if (contextmenu_mode == "legacy") {
+                mcTreeHandler.TREE.setAttribute("contextmenu", this.POPUP.id);
+                this.POPUP.removeEventListener("popuphidden", mcTreeHandler.onPopuphidden, false);
+                var resource = this.resource;
+                if (resource) {
+                    var contextmenu = this.DataSource.getProperty(resource, "contextmenu");
+                    if (contextmenu != undefined && contextmenu != "") {
+                        var menu = document.getElementById(contextmenu);
+                        if (menu)
+                            menu.removeAttribute("hidden");
+                        this.POPUP.addEventListener("popuphidden", mcTreeHandler.onPopuphidden, false);
+                    }
+                }
+            } else {
+                var resource = this.resource;
+                if (this.DataSource.isContainer(resource)) {
+                    mcTreeHandler.TREE.setAttribute("contextmenu", this.POPUP_FOLDER.id);
+                    this.POPUP_FOLDER.removeEventListener("popuphidden", mcTreeHandler.onPopuphidden, false);
+                    if (resource) {
+                        var contextmenu = this.DataSource.getProperty(resource, "contextmenu");
+                        if (contextmenu != undefined && contextmenu != "") {
+                            var menu = document.getElementById(contextmenu);
+                            if (menu)
+                                menu.removeAttribute("hidden");
+                            this.POPUP_FOLDER.addEventListener("popuphidden", mcTreeHandler.onPopuphidden, false);
+                        }
+                    }
+                } else {
+                    mcTreeHandler.TREE.setAttribute("contextmenu", this.POPUP_OBJECT.id);
+                    this.POPUP_OBJECT.removeEventListener("popuphidden", mcTreeHandler.onPopuphidden, false);
+                    if (resource) {
+                        var contextmenu = this.DataSource.getProperty(resource, "contextmenu");
+                        if (contextmenu != undefined && contextmenu != "") {
+                            var menu = document.getElementById(contextmenu);
+                            if (menu)
+                                menu.removeAttribute("hidden");
+                            this.POPUP_OBJECT.addEventListener("popuphidden", mcTreeHandler.onPopuphidden, false);
+                        }
+                    }
+                }
+            }
+        } else {
+            mcTreeHandler.TREE.removeAttribute("contextmenu");
+        }
+    },
+    onMouseup: function(aEvent) {
+    },
+    onMousemove: function(aEvent) {
+        var param = {
+            tree: mcTreeHandler.TREE
+        };
+        try {
+            var row = {};
+            var col = {};
+            var childElt = {};
+            param.tree.treeBoxObject.getCellAt(aEvent.clientX, aEvent.clientY, row, col, childElt);
+            if (!row.value || !col.value || !childElt.value || childElt.value != "text") {
+            } else {
+                param.row = row;
+                param.col = col;
+                param.childElt = childElt;
+                if (mcTreeImageTooltip.tooltipRow != row.value) {
+                    var curRes = param.tree.builderView.getResourceAtIndex(row.value);
+                    var id = this.DataSource.getProperty(curRes, "id");
+                    var dbtype = this.DataSource.getProperty(curRes, "dbtype");
+                    var rtnObj = this.Database.getObject({oid: id}, dbtype);
+                    if (rtnObj)
+                        param.obj = rtnObj[0];
+                }
+            }
+        } catch (e) {
+        }
+        mcTreeImageTooltip.onMousemove(aEvent, param);
+    },
+    onMouseout: function(aEvent) {
+        mcTreeImageTooltip.onMouseout(aEvent);
+    },
+    onClick: function(aEvent, aType) {
+        var curIdx = this.TREE.currentIndex;
+        if (bitsSearchAcross.getIndex() == curIdx) {
+            mcPropertyView.dispProperty();
+            return;
+        }
+        if (curIdx >= 0)
+            mcPropertyView.dispProperty(mcTreeHandler.object);
+        var res = (mcTreeHandler.TREE.view.selection.count >= 1 && mcTreeHandler.TREE.currentIndex >= 0) ? mcTreeHandler.resource : null;
+        if (aEvent.button == 2) {
+            window.top.bitsScrapPartyAddonService.eventListener(aEvent, 1, res);
+            aEvent.stopPropagation();
+            return;
+        }
+        if (aEvent.button != 0 && aEvent.button != 1) {
+            window.top.bitsScrapPartyAddonService.eventListener(aEvent, 1, res);
+            aEvent.stopPropagation();
+            return;
+        }
+        var row = {};
+        var col = {};
+        var obj = {};
+        this.TREE.treeBoxObject.getCellAt(aEvent.clientX, aEvent.clientY, row, col, obj);
+        if (!obj.value || obj.value == "twisty")
+            return;
+        if (this.TREE.view.isContainer(curIdx)) {
+            var curRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+            var source = this.DataSource.getProperty(curRes, "source");
+            if (source != "")
+                mcController.open(this.resource, aEvent.button == 1 || aEvent.ctrlKey || aEvent.shiftKey);
+        } else {
+            if (aType < 2 && aEvent.button != 1)
+                return;
+            mcController.open(this.resource, aEvent.button == 1 || aEvent.ctrlKey || aEvent.shiftKey);
+        }
+        window.top.bitsScrapPartyAddonService.eventListener(aEvent, 1, res);
+    },
+    onKeyDown: function(aEvent) {
+    },
+    onKeyUp: function(aEvent) {
+    },
+    onKeyPress: function(aEvent) {
+        switch (aEvent.keyCode) {
+            case aEvent.DOM_VK_RETURN :
+                if (this.TREE.view.isContainer(this.TREE.currentIndex))
+                    return;
+                mcController.open(this.resource, aEvent.ctrlKey || aEvent.shiftKey);
+                break;
+            case aEvent.DOM_VK_DELETE :
+                if (bitsSearchAcross.getIndex() == mcTreeHandler.TREE.currentIndex)
+                    return;
+                if (!(aEvent.ctrlKey || aEvent.shiftKey)) {
+                    aEvent.preventDefault();
+                    var res = mcTreeHandler.resource;
+                    if (!res)
+                        return;
+                    var id = this.DataSource.getProperty(res, "id");
+                    var type = this.DataSource.getProperty(res, "type");
+                    if (type == "localfolder")
+                        return;
+                    if (type == window.top.bitsMarkingCollection._uncategorized.dbtype)
+                        return;
+                    var refRootfolder = nsPreferences.copyUnicharPref("wiredmarker.rootfolder", "");
+                    if (refRootfolder == id)
+                        return;
+                    this.remove(aEvent);
+                }
+                break;
+            case aEvent.DOM_VK_F2 :
+                mcController.property(this.resource);
+                break;
+            default:
+                break;
+        }
+    },
+    onDblClick: function(aEvent) {
+        if (aEvent.originalTarget.localName != "treechildren" || aEvent.button != 0)
+            return;
+        if (this.TREE.view.isContainer(this.TREE.currentIndex))
+            return;
+        if (aEvent.button == 2) {
+            aEvent.stopPropagation();
+            return;
+        }
+        mcController.open(this.resource, aEvent.ctrlKey || aEvent.shiftKey);
+        return;
+    },
+    existsFolderTitle: function(aRes, aTitle) {
+        var i;
+        var len;
+        var contResList = this.DataSource.flattenResources(aRes, 1, false);
+        for (i = 0, len = contResList.length; i < len; i++) {
+            if (aRes.Value == contResList[i].Value)
+                continue;
+            if (this.DataSource.getProperty(contResList[i], "title") == aTitle)
+                return true;
+        }
+        return false;
+    },
+    create: function(pIdx) {
+        var curIdx = pIdx;
+        var curRes = null;
+        if (pIdx >= 0) {
+            if (!mcTreeHandler.TREE.view.isContainer(curIdx))
+                return;
+            curRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+            if (!mcTreeHandler.TREE.view.isContainerOpen(curIdx))
+                mcTreeHandler.TREE.view.toggleOpenState(curIdx);
+        } else {
+            curRes = this.Common.RDF.GetResource(mcTreeHandler.TREE.ref);
+        }
+        var title = this.DataSource.getProperty(curRes, "title");
+        var style = this.DataSource.getProperty(curRes, "style");
+        var editmode = "0";
+        if (title != "") {
+            title = "New Folder [" + title + "]";
+        } else {
+            title = "New Folder";
+        }
+        if (editmode == "")
+            editmode = "0";
+        if (!style || style == "") {
+            var styleIdx = nsPreferences.getIntPref("wiredmarker.folderstyleindex", 1);
+            if (styleIdx > 8)
+                styleIdx = 1;
+            style = bitsMarker.PRESET_STYLES[styleIdx];
+            nsPreferences.setIntPref("wiredmarker.folderstyleindex", styleIdx);
+        }
+        if (this.existsFolderTitle(curRes, title)) {
+            var newTitle;
+            var cnt = 1;
+            do {
+                newTitle = title + "(" + (++cnt) + ")";
+            } while (this.existsFolderTitle(curRes, newTitle));
+            title = newTitle;
+        }
+        var newRes = mcMainService.createGroupFolder(title, curRes.Value, undefined, style, "", editmode);
+        mcController.rebuildLocal();
+        window.top.bitsMarkingCollection.reOrder(curRes);
+        var newIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(newRes);
+        mcTreeHandler.TREE.view.selection.select(newIdx);
+        mcTreeHandler.TREE.focus();
+        var result = mcController.property(newRes);
+        if (result) {
+            window.top.bitsMarkingCollection.reOrder(curRes);
+        } else {
+            mcTreeHandler.remove(undefined, undefined, true);
+        }
+        var newIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(newRes);
+        mcController.rebuildLocal();
+        var selectIdx = newIdx;
+        if (selectIdx < 0)
+            selectIdx = pIdx;
+        mcTreeHandler.TREE.currentIndex = selectIdx;
+        if (!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex))
+            mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+        mcTreeHandler.TREE.focus();
+        mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(selectIdx);
+        mcPropertyView.dispProperty(mcTreeHandler.object);
+    },
+    removeFolder: function(aEvent) {
+        if (!mcController.confirmRemovingFor(this.resource))
+            return false;
+        if (aEvent)
+            window.top.bitsScrapPartyAddonService.eventListener(aEvent, 0, this.resource);
+        var aMode = this.DataSource.getProperty(this.resource, "dbtype");
+        if (!this.Database.beginTransaction(aMode))
+            return false;
+        var curIdx = this.TREE.currentIndex;
+        var curRes = this.TREE.builderView.getResourceAtIndex(curIdx);
+        this._removeFolder(curRes);
+        this.Database.endTransaction(aMode);
+        mcController.rebuildLocal();
+        mcItemView.onTreeClick();
+        if (aEvent)
+            window.top.bitsScrapPartyAddonService.eventListener(aEvent, 1, this.resource);
+    },
+    _removeFolder: function(aRes) {
+        if (!aRes)
+            return [];
+        var curRes = aRes;
+        try {
+            this._removeAll(curRes);
+            var delObj = [];
+            var foldResList = this.DataSource.flattenResources(curRes, 1, true);
+            for (i = foldResList.length - 1; i >= 0; i--) {
+                var pRes = this.DataSource.findParentResource(foldResList[i]);
+                if (!this.DataSource.data.ArcLabelsOut(foldResList[i]).hasMoreElements() || this.Common.RDFCU.indexOf(this.DataSource.data, pRes, foldResList[i]) < 0)
+                    continue;
+                delObj.push({
+                    id: this.DataSource.getProperty(foldResList[i], "id"),
+                    dbtype: this.DataSource.getProperty(foldResList[i], "dbtype")
+                });
+                this.Common.RDFC.Init(this.DataSource.data, pRes);
+                this.Common.RDFC.RemoveElement(foldResList[i], true);
+            }
+            var rmIDs = [];
+            var addIDs = [];
+            var depth = 0;
+            do {
+                addIDs = this.DataSource.cleanUpIsolation();
+                rmIDs = rmIDs.concat(addIDs);
+            } while (addIDs.length > 0 && ++depth < 100);
+            this.DataSource.flush();
+            for (var i = 0; i < delObj.length; i++) {
+                this.Database.removeFolder(delObj[i].id, delObj[i].dbtype, false);
+            }
+        } catch (e) {
+            _dump("mcTreeHandler._removeFolder():" + e);
+        }
+    },
+    removeAllFolder: function(aEvent) {
+        if (!mcController.confirmRemovingFor(this.resource))
+            return false;
+        if (aEvent)
+            window.top.bitsScrapPartyAddonService.eventListener(aEvent, 0, this.resource);
+        var aMode = this.DataSource.getProperty(this.resource, "dbtype");
+        if (!this.Database.beginTransaction(aMode))
+            return false;
+        var curRes = this.TREE.builderView.getResourceAtIndex(this.TREE.currentIndex);
+        try {
+            var delObj = [];
+            var foldResList = this.DataSource.flattenResources(curRes, 1, false);
+            var i, j;
+            for (i = foldResList.length - 1; i >= 0; i--) {
+                if (foldResList[i].Value == curRes.Value)
+                    continue;
+                this._removeAll(foldResList[i]);
+            }
+            var foldResList = this.DataSource.flattenResources(curRes, 1, true);
+            for (i = foldResList.length - 1; i >= 0; i--) {
+                if (foldResList[i].Value == curRes.Value)
+                    continue;
+                var pRes = this.DataSource.findParentResource(foldResList[i]);
+                if (!this.DataSource.data.ArcLabelsOut(foldResList[i]).hasMoreElements() || this.Common.RDFCU.indexOf(this.DataSource.data, pRes, foldResList[i]) < 0)
+                    continue;
+                delObj.push({
+                    id: this.DataSource.getProperty(foldResList[i], "id"),
+                    dbtype: this.DataSource.getProperty(foldResList[i], "dbtype")
+                });
+                this.Common.RDFC.Init(this.DataSource.data, pRes);
+                this.Common.RDFC.RemoveElement(foldResList[i], true);
+            }
+            var rmIDs = [];
+            var addIDs = [];
+            var depth = 0;
+            do {
+                addIDs = this.DataSource.cleanUpIsolation();
+                rmIDs = rmIDs.concat(addIDs);
+            } while (addIDs.length > 0 && ++depth < 100);
+            this.DataSource.flush();
+            for (var i = 0; i < delObj.length; i++) {
+                this.Database.removeFolder(delObj[i].id, delObj[i].dbtype, false);
+            }
+        } catch (e) {
+            _dump("mcTreeHandler.removeAllFolder():" + e);
+        }
+        this.Database.endTransaction(aMode);
+        mcController.rebuildLocal();
+        if (aEvent)
+            window.top.bitsScrapPartyAddonService.eventListener(aEvent, 1, this.resource);
+    },
+    removeAll: function(aEvent) {
+        if (!mcController.confirmRemovingFor(this.resource))
+            return false;
+        if (aEvent)
+            window.top.bitsScrapPartyAddonService.eventListener(aEvent, 0, this.resource);
+        var aMode = this.DataSource.getProperty(this.resource, "dbtype");
+        if (!this.Database.beginTransaction(aMode))
+            return false;
+        var curRes = this.TREE.builderView.getResourceAtIndex(this.TREE.currentIndex);
+        this._removeAll(curRes);
+        this.Database.endTransaction(aMode);
+        mcController.rebuildLocal();
+        if (aEvent)
+            window.top.bitsScrapPartyAddonService.eventListener(aEvent, 1, this.resource);
+    },
+    _removeAll: function(aRes) {
+        if (!aRes)
+            return false;
+        var curRes = aRes;
+        try {
+            var delObj = [];
+            var foldResList = this.DataSource.flattenResources(curRes, 1, true);
+            var i, j;
+            for (i = foldResList.length - 1; i >= 0; i--) {
+                var pfid = this.DataSource.getProperty(foldResList[i], "id");
+                var contResList = this.DataSource.flattenResources(foldResList[i], 2, false);
+                this.Common.RDFC.Init(this.DataSource.data, foldResList[i]);
+                for (j = 0; j < contResList.length; j++) {
+                    if (!this.DataSource.data.ArcLabelsOut(contResList[j]).hasMoreElements() || this.Common.RDFCU.indexOf(this.DataSource.data, foldResList[i], contResList[j]) < 0)
+                        continue;
+                    delObj.push({
+                        pfid: pfid,
+                        id: this.DataSource.getProperty(contResList[j], "id"),
+                        dbtype: this.DataSource.getProperty(contResList[j], "dbtype"),
+                        source: this.DataSource.getProperty(contResList[j], "source")
+                    });
+                    this.Common.RDFC.RemoveElement(contResList[j], true);
+                }
+            }
+            var rmIDs = [];
+            var addIDs = [];
+            var depth = 0;
+            do {
+                addIDs = this.DataSource.cleanUpIsolation();
+                rmIDs = rmIDs.concat(addIDs);
+            } while (addIDs.length > 0 && ++depth < 100);
+            this.DataSource.flush();
+            var match_exp = new RegExp("^" + bitsMarker.id_key + ".+$", "m");
+            for (var i = 0; i < delObj.length; i++) {
+                this.Database.removeObject({oid: delObj[i].id, pfid: delObj[i].pfid}, delObj[i].dbtype, false);
+                if (delObj[i].source.match(match_exp))
+                    bitsMarker.unmarkerWindow(delObj[i].source);
+            }
+        } catch (e) {
+            _dump("mcTreeHandler.removeAll():" + e);
+            return false;
+        }
+        return true;
+    },
+    remove: function(aEvent, pRes, pConfirm, aTransaction) {
+        if (pConfirm == undefined)
+            pConfirm = false;
+        if (aTransaction == undefined)
+            aTransaction = true;
+        if (pRes == undefined && this.TREE.view.selection.count == 0)
+            return false;
+        if (!pConfirm)
+            if (!mcController.confirmRemovingFor(this.resource))
+                return false;
+        if (aEvent)
+            window.top.bitsScrapPartyAddonService.eventListener(aEvent, 0, this.resource);
+        var resList = [];
+        var parList = [];
+        if (this.TREE.view.selection.count > 1) {
+            var idxList = this.getSelection(false, 2);
+            if (idxList.length < 1)
+                return false;
+            if (this.validateMultipleSelection(idxList) == false)
+                return false;
+            var i;
+            for (i = 0; i < idxList.length; i++) {
+                resList.push(this.TREE.builderView.getResourceAtIndex(idxList[i]));
+                parList.push(this.getParentResource(idxList[i]));
+            }
+        } else {
+            var curRes;
+            var parRes;
+            if (pRes == undefined) {
+                var curIdx = this.TREE.currentIndex;
+                curRes = this.TREE.builderView.getResourceAtIndex(curIdx);
+                parRes = this.getParentResource(curIdx);
+            } else {
+                curRes = pRes;
+                parRes = this.DataSource.findParentResource(pRes);
+            }
+            resList.push(curRes);
+            parList.push(parRes);
+            var match_exp = new RegExp("^" + bitsMarker.id_key + ".+$", "m");
+            var source = this.DataSource.getProperty(curRes, "source");
+            if (source.match(match_exp))
+                bitsMarker.unmarkerWindow(source);
+            var id = this.DataSource.getProperty(curRes, "id");
+            var dbtype = this.DataSource.getProperty(curRes, "dbtype");
+            var pfid = this.DataSource.getProperty(curRes, "pfid");
+            var about = this.DataSource.getID2About(id, pfid, dbtype);
+            if (curRes.Value != about) {
+                var res = mcTreeDNDHandler.Common.RDF.GetResource(about);
+                resList.push(res);
+                parList.push(this.DataSource.findParentResource(res));
+                var source = this.DataSource.getProperty(res, "source");
+                if (source.match(match_exp))
+                    bitsMarker.unmarkerWindow(source);
+            }
+            if (aTransaction)
+                if (!this.Database.beginTransaction(dbtype))
+                    return false;
+            if (this.DataSource.isContainer(curRes)) {
+                this.Database.removeFolder(id, dbtype, false);
+            } else {
+                this.Database.removeObject({oid: id, pfid: pfid}, dbtype, false);
+            }
+            if (aTransaction)
+                this.Database.endTransaction(dbtype);
+        }
+        var rmIDs = mcController.removeInternal(resList, parList, false);
+        if (aTransaction)
+            mcPropertyView.dispProperty(mcTreeHandler.object);
+        this.isEdit = true;
+        if (aEvent)
+            window.top.bitsScrapPartyAddonService.eventListener(aEvent, 1, this.resource);
+        return true;
+    },
+    replacedURL: function(aEvent) {
+        var curIdx = this.TREE.currentIndex;
+        var curRes = this.TREE.builderView.getResourceAtIndex(curIdx);
+        var parRes = this.getParentResource(curIdx);
+        var id = this.DataSource.getProperty(curRes, "id");
+        var dbtype = this.DataSource.getProperty(curRes, "dbtype");
+        if (!this.DataSource.isContainer(curRes))
+            return;
+        var folderFilterHash = {};
+        var tmpFolderFilter = nsPreferences.copyUnicharPref("wiredmarker.filter.folder", "");
+        var tmpFolderFilterArr = tmpFolderFilter.split("\t");
+        var i;
+        for (i = 0; i < tmpFolderFilterArr.length; i++) {
+            if (!tmpFolderFilterArr[i].match(/^(\d+):(\d+):(.+)$/))
+                continue;
+            var filter_fid = RegExp.$1;
+            var filter_casesensitive = RegExp.$2;
+            var filter_keyword = RegExp.$3;
+            folderFilterHash[filter_fid] = new RegExp(filter_keyword, (filter_casesensitive == 1) ? "mg" : "img");
+        }
+        tmpFolderFilterArr = undefined;
+        tmpFolderFilter = undefined;
+        var prompts = this.Common.PROMPT;
+        var flags = prompts.STD_YES_NO_BUTTONS + prompts.BUTTON_POS_1_DEFAULT;
+        var button = prompts.confirmEx(window, mcMainService.STRING.getString("CONFIRM_REPLACED_TITLE"), mcMainService.STRING.getString("CONFIRM_REPLACED_TARGET"), flags, "", "", "", null, {});
+        var contResList = [];
+        if (button == 0) {
+            var folderList = this.DataSource.flattenResources(curRes, 1, true);
+            for (var i = 0; i < folderList.length; i++) {
+                var fid = this.DataSource.getProperty(folderList[i], "id");
+                var rtn = this.Database.getObject({pfid: fid}, dbtype);
+                if (!rtn)
+                    continue;
+                if (folderFilterHash[fid])
+                    rtn = rtn.filter(function(element, index, array) {
+                        return folderFilterHash[fid].test(element.oid_title);
+                    });
+                contResList = contResList.concat(rtn);
+            }
+        } else {
+            var rtn = this.Database.getObject({pfid: id}, dbtype);
+            if (rtn) {
+                if (folderFilterHash[fid])
+                    rtn = rtn.filter(function(element, index, array) {
+                        return folderFilterHash[fid].test(element.oid_title);
+                    });
+                contResList = contResList.concat(rtn);
+            }
+        }
+        if (contResList.length == 0) {
+            this.Common.alert(mcMainService.STRING.getString("ALERT_REPLACED_URL"), mcMainService.STRING.getString("CONFIRM_REPLACED_TITLE"));
+            return;
+        }
+        var result = {};
+        result.res = curRes;
+        result.list = contResList;
+        result.accept = false;
+        result.objArr = null;
+        result.callback = this._replacedURL_CB;
+        if (this._replacedURL_window && !this._replacedURL_window.closed)
+            this._replacedURL_window.close();
+        this._replacedURL_window = window.openDialog("chrome://markingcollection/content/replacedURL.xul", "", "chrome,centerscreen,alwaysRaised=yes,dependent=yes", result);
+    },
+    _replacedURL_CB: function(aResult) {
+        var self = mcTreeHandler;
+        if (aResult.accept) {
+            if (!self.progressWindow) {
+                var x = screen.width;
+                var y = screen.height;
+                self.progressWindow = window.openDialog(
+                        "chrome://markingcollection/content/progress.xul",
+                        "myProgress", "chrome,centerscreen,alwaysRaised,dependent=yes,left=" + x + ",top=" + y,
+                        {status: mcMainService.STRING.getString("MSG_REPLACED_URL") + "..."});
+            }
+            if (self.progressWindow && !self.progressWindow.closed) {
+                if (aResult.objArr.length > 0) {
+                    if (self.progressWindow.setStatus)
+                        self.progressWindow.setStatus(mcMainService.STRING.getString("MSG_REPLACED_URL") + "... [ " + aResult.objArr.length + " ]");
+                    self.progressWindow.focus();
+                    setTimeout(function() {
+                        mcTreeHandler._replacedURL(aResult.objArr);
+                    }, 0);
+                } else {
+                    if (self.progressWindow && !self.progressWindow.closed)
+                        self.progressWindow.close();
+                    self.progressWindow = null;
+                }
+            }
+        }
+        if (self._replacedURL_window && !self._replacedURL_window.closed)
+            self._replacedURL_window.close();
+        self._replacedURL_window = null;
+    },
+    _replacedURL: function(aObjArr) {
+        if (this.progressWindow && !this.progressWindow.closed) {
+            if (aObjArr.length > 0) {
+                if (this.progressWindow.setStatus)
+                    this.progressWindow.setStatus(mcMainService.STRING.getString("MSG_REPLACED_URL") + "... [ " + aObjArr.length + " ]");
+                this.progressWindow.focus();
+            } else {
+                if (this.progressWindow && !this.progressWindow.closed)
+                    this.progressWindow.close();
+                this.progressWindow = null;
+            }
+        }
+        if (aObjArr.length <= 0) {
+            mcTreeViewModeService.rebuild();
+            return;
+        }
+
+        var obj = aObjArr.shift();
+        var dbtype = obj.dbtype;
+        delete obj.dbtype;
+        if (obj.fid_style != undefined)
+            delete obj.fid_style;
+        if (obj.fid_title != undefined)
+            delete obj.fid_title;
+        if (obj.folder_order != undefined)
+            delete obj.folder_order;
+        var rtn = this.Database.updateObject(obj, dbtype);
+
+        setTimeout(function() {
+            mcTreeHandler._replacedURL(aObjArr);
+        }, 0);
+    },
+    getParentResource: function(aIdx) {
+        var parIdx = this.TREE.builderView.getParentIndex(aIdx);
+        if (parIdx == -1)
+            return this.TREE.resource;
+        else
+            return this.TREE.builderView.getResourceAtIndex(parIdx);
+    },
+    getSelection: function(idx2res, rule) {
+        var ret = [];
+        var rc;
+        var i;
+        for (rc = 0; rc < this.TREE.view.selection.getRangeCount(); rc++) {
+            var start = {}, end = {};
+            this.TREE.view.selection.getRangeAt(rc, start, end);
+            for (i = start.value; i <= end.value; i++) {
+                if (rule == 1 && !this.TREE.view.isContainer(i))
+                    continue;
+                if (rule == 2 && this.TREE.view.isContainer(i))
+                    continue;
+                ret.push(idx2res ? this.TREE.builderView.getResourceAtIndex(i) : i);
+            }
+        }
+        return ret;
+    },
+    validateMultipleSelection: function(aIdxList) {
+        if (aIdxList.length != this.TREE.view.selection.count) {
+            this.Common.alert(mcMainService.STRING.getString("ERROR_MULTIPLE_SELECTION"));
+            return false;
+        }
+        return true;
+    },
+    toggleFolder: function(aIdx) {
+        if (!aIdx)
+            aIdx = this.TREE.currentIndex;
+        this.TREE.view.toggleOpenState(aIdx);
+        if (this.autoCollapse)
+            this.collapseFoldersBut(aIdx);
+    },
+    toggleAllFolders: function(forceClose) {
+        var willOpen = true;
+        var i;
+        for (i = 0; i < this.TREE.view.rowCount; i++) {
+            if (!this.TREE.view.isContainer(i))
+                continue;
+            if (this.TREE.view.isContainerOpen(i)) {
+                willOpen = false;
+                break;
+            }
+        }
+        if (forceClose)
+            willOpen = false;
+        if (willOpen) {
+            for (i = 0; i < this.TREE.view.rowCount; i++) {
+                if (this.TREE.view.isContainer(i) && !this.TREE.view.isContainerOpen(i))
+                    this.TREE.view.toggleOpenState(i);
+            }
+        } else {
+            for (i = this.TREE.view.rowCount - 1; i >= 0; i--) {
+                if (this.TREE.view.isContainer(i) && this.TREE.view.isContainerOpen(i))
+                    this.TREE.view.toggleOpenState(i);
+            }
+        }
+    },
+    openAllFolders: function() {
+        var i;
+        for (i = 0; i < this.TREE.view.rowCount; i++) {
+            if (this.TREE.view.isContainer(i) && !this.TREE.view.isContainerOpen(i))
+                this.TREE.view.toggleOpenState(i);
+        }
+    },
+    collapseFoldersBut: function(curIdx) {
+        var ascIdxList = {};
+        ascIdxList[curIdx] = true;
+        while (curIdx >= 0) {
+            curIdx = this.TREE.builderView.getParentIndex(curIdx);
+            ascIdxList[curIdx] = true;
+        }
+        var i;
+        for (i = this.TREE.view.rowCount - 1; i >= 0; i--) {
+            if (!ascIdxList[i] && this.TREE.view.isContainer(i) && this.TREE.view.isContainerOpen(i)) {
+                this.TREE.view.toggleOpenState(i);
+            }
+        }
+    },
+};
+
+var mcController = {
+    _pageshow_elem_id: "",
+    _pageshow_elem_dbtype: "",
+    _pageshow_id: "",
+    get DataSource() {
+        return window.top.bitsObjectMng.DataSource;
+    },
+    get Common() {
+        return window.top.bitsObjectMng.Common;
+    },
+    get XPath() {
+        return window.top.bitsObjectMng.XPath;
+    },
+    get Database() {
+        return window.top.bitsObjectMng.Database;
+    },
+    get gBrowser() {
+        return window.top.bitsObjectMng.getBrowser();
+    },
+    get isTreeContext() {
+        return document.popupNode.nodeName == "treechildren";
+    },
+    onPopupShowing: function(aEvent) {
+        if (aEvent.originalTarget.localName != "popup")
+            return;
+        var res = mcTreeHandler.resource;
+        if (!res) {
+            aEvent.preventDefault();
+            return;
+        }
+        var viewmode = mcTreeViewModeService.viewmode;
+        var id = this.DataSource.getProperty(res, "id");
+        var type = this.DataSource.getProperty(res, "type");
+        var title = this.DataSource.getProperty(res, "title");
+        var source = this.DataSource.getProperty(res, "source");
+        var dbtype = this.DataSource.getProperty(res, "dbtype");
+        if (type == window.top.bitsMarkingCollection._uncategorized.dbtype)
+            type = 'localfolder';
+        var hidePopupRemoveFolder = false;
+        var contFolderList = [];
+        var contItemList = [];
+        var existsObject = false;
+        if (type.indexOf("folder") >= 0) {
+            contFolderList = this.DataSource.flattenResources(res, 1, false);
+            contItemList = this.DataSource.flattenResources(res, 2, true);
+            var folderList = this.DataSource.flattenResources(res, 1, true);
+            for (var i = 0; i < folderList.length; i++) {
+                var fid = this.DataSource.getProperty(folderList[i], "id");
+                if (!this.Database.existsObject({pfid: fid}, dbtype))
+                    continue;
+                existsObject = true;
+                break;
+            }
+            var refRootfolder = nsPreferences.copyUnicharPref("wiredmarker.rootfolder", "");
+            if (refRootfolder == id)
+                hidePopupRemoveFolder = true;
+        }
+        var contextmenu_type = nsPreferences.copyUnicharPref("wiredmarker.contextmenu.type", "");
+        try {
+            document.getElementById("mcPopupOpen").hidden = type.indexOf("folder") >= 0;
+            document.getElementById("mcPopupOpenNewTab").hidden = type.indexOf("folder") >= 0;
+            document.getElementById("mcPopupOpenAllItems").hidden = true;
+            document.getElementById("mcPopupOpenSeparator").hidden = (document.getElementById("mcPopupOpen").hidden && document.getElementById("mcPopupOpenAllItems").hidden);
+            document.getElementById("mcPopupCreates").hidden = type.indexOf("folder") < 0;
+            document.getElementById("mcPopupRemoveContents").hidden = type.indexOf("folder") >= 0;
+            document.getElementById("mcPopupRemoves").hidden = type == "item" || (contFolderList.length <= 1 && type == "localfolder");
+            document.getElementById("mcPopupRemoveAllFolder").hidden = type == "item" || contFolderList.length <= 1;
+            document.getElementById("mcPopupRemoveFolder").hidden = type != "folder" || hidePopupRemoveFolder;
+            document.getElementById("mcPopupRemoveAllContents").hidden = contItemList.length == 0;
+            document.getElementById("mcPopupEditReplacedURL").hidden = type.indexOf("folder") < 0 || !existsObject || contextmenu_type == "simple";
+            document.getElementById("mcPopupViewMenu").hidden = type.indexOf("folder") < 0;
+            document.getElementById("mcPopupRootFolder").hidden = true;
+            document.getElementById("mcPopupFilter").hidden = type.indexOf("folder") < 0 || contextmenu_type == "simple";
+            document.getElementById("mcPopupFilterSeparator").hidden = !document.getElementById("mcPopupRootFolder").hidden || document.getElementById("mcPopupFilter").hidden || contextmenu_type == "simple";
+            document.getElementById("mcPopupExport").hidden = type.indexOf("folder") < 0;
+            document.getElementById("mcPopupTemplateFolder").hidden = type != "folder";
+            document.getElementById("mcPopupImportTag").hidden = type != "folder" || contextmenu_type == "simple";
+            document.getElementById("mcPopupFolderAutoOpenSeparator").hidden = !document.getElementById("mcPopupRootFolder").hidden || mcItemView.isChecked;
+            document.getElementById("mcPopupFolderAutoOpenSeparator").hidden = type != "folder" || mcItemView.isChecked;
+            ;
+            document.getElementById("mcPopupFolderAutoOpen").hidden = type != "folder" || mcItemView.isChecked;
+            document.getElementById("mcPopupAddonMenu").hidden = !(type.indexOf("folder") == 0 && window.top.bitsScrapPartyAddonService.existsAddon(true) && contFolderList.length <= 1 && !existsObject) || contextmenu_type == "simple";
+            document.getElementById("mcPopupHyperAnchorCopyToClipboard").hidden = type.indexOf("folder") >= 0;
+            document.getElementById("mcPopupHyperAnchorCopyFormatSetting").hidden = type.indexOf("folder") >= 0;
+            document.getElementById("mcPopupHyperAnchorCopyFormatToClipboard").hidden = type.indexOf("folder") >= 0;
+            if (!document.getElementById("mcPopupRootFolder").hidden) {
+                var index = mcTreeHandler.TREE.currentIndex;
+                var res = mcTreeHandler.TREE.builderView.getResourceAtIndex(index);
+                var baseID = this.DataSource.getProperty(res, "id");
+                var rootfolder = nsPreferences.copyUnicharPref("wiredmarker.rootfolder", "");
+                if (baseID == rootfolder) {
+                    document.getElementById("mcPopupRootFolder").setAttribute("checked", true);
+                } else {
+                    document.getElementById("mcPopupRootFolder").removeAttribute("checked");
+                }
+            }
+            if (!document.getElementById("mcPopupFilter").hidden) {
+                if (mcTreeFolderFilterService.isUseFilter(res))
+                    document.getElementById("mcPopupFilter").setAttribute("checked", true);
+                else
+                    document.getElementById("mcPopupFilter").removeAttribute("checked");
+            }
+            if (!document.getElementById("mcPopupFolderAutoOpen").hidden) {
+                var folderautoopen = nsPreferences.getBoolPref("wiredmarker.folderautoopen", true);
+                if (folderautoopen) {
+                    document.getElementById("mcPopupFolderAutoOpen").removeAttribute("checked");
+                } else {
+                    document.getElementById("mcPopupFolderAutoOpen").setAttribute("checked", true);
+                }
+            }
+            document.getElementById("mcPopupFolderRemoveAllContents").hidden = contItemList.length == 0;
+            document.getElementById("mcPopupFolderRemoveFolder").hidden = type != "folder" || hidePopupRemoveFolder;
+            window.top.bitsScrapPartyAddonService.eventListener(aEvent, 1, res);
+        } catch (ex) {
+            _dump(ex)
+        }
+    },
+    onPopupHiding: function(aEvent) {
+        if (aEvent.originalTarget.localName != "popup")
+            return;
+        var res = mcTreeHandler.resource;
+        if (!res) {
+            aEvent.preventDefault();
+            return;
+        }
+        try {
+            window.top.bitsScrapPartyAddonService.eventListener(aEvent, 1, res);
+        } catch (ex) {
+            _dump(ex)
+        }
+    },
+    copy: function(aMode) {
+        var aRes = mcTreeHandler.resource;
+        if (!aRes)
+            return;
+        if (!aMode)
+            aMode = 'copy';
+        var id = this.DataSource.getProperty(aRes, "id");
+        if (!id)
+            return;
+        switch (this.DataSource.getProperty(aRes, "type")) {
+            case "folder" :
+            case "item" :
+                var id = this.DataSource.getProperty(aRes, "id");
+                var dbtype = this.DataSource.getProperty(aRes, "dbtype");
+                window.top.bitsMetaCapture.copyToClipBoard(id, dbtype, aMode);
+                break;
+            default :
+                break;
+        }
+    },
+    open: function(aRes, tabbed) {
+        if (!aRes)
+            aRes = mcTreeHandler.resource;
+        if (!aRes)
+            return;
+        var id = this.DataSource.getProperty(aRes, "id");
+        if (!id)
+            return;
+        switch (this.DataSource.getProperty(aRes, "type")) {
+            case "folder" :
+            case "item" :
+                var id = this.DataSource.getProperty(aRes, "id");
+                var pfid = this.DataSource.getProperty(aRes, "pfid");
+                var dbtype = this.DataSource.getProperty(aRes, "dbtype");
+                var aObject = this.Database.getObject({oid: id, pfid: pfid}, dbtype)[0];
+                this.Common.loadFromObject(aObject, tabbed);
+                break;
+            default :
+                this.Common.loadURL(mcMainService.baseURL + "data/" + id + "/index.html", tabbed || mcMainService.prefs.tabsOpen);
+        }
+    },
+    openAllInTabs: function(aRes) {
+        if (!aRes)
+            aRes = mcTreeHandler.resource;
+        if (!aRes)
+            return;
+        var resList = this.DataSource.flattenResources(aRes, 2, true);
+        resList.forEach(
+                function(res) {
+                    var uri = window.top.bitsObjectMng.DataSource.getProperty(res, "uri");
+                    window.top.bitsObjectMng.Common.loadURL(uri, true);
+                }
+        );
+    },
+    property: function(aRes) {
+        if (!aRes)
+            aRes = mcTreeHandler.resource;
+        if (!aRes)
+            return;
+        var id = this.DataSource.getProperty(aRes, "id");
+        if (!id)
+            return;
+        var result = {};
+        var regexp = new RegExp("^" + this.DataSource.ABOUT_ITEM + "(\\d+)$");
+        aRes.Value.match(regexp);
+        id = RegExp.$1;
+        var old_style = this.DataSource.getProperty(aRes, "style");
+        window.openDialog("chrome://markingcollection/content/property.xul", "", "chrome,centerscreen,modal", id, result);
+        if (result.accept) {
+            try {
+                this.DataSource.flush();
+                this.rebuildLocal();
+                if (this.DataSource.isContainer(aRes)) {
+                    var fid = this.DataSource.getProperty(aRes, "id");
+                    var dbtype = this.DataSource.getProperty(aRes, "dbtype");
+                    var style = this.DataSource.getProperty(aRes, "style");
+                    var title = this.DataSource.getProperty(aRes, "title");
+                    if (fid == "0" && dbtype == window.top.bitsMarkingCollection._uncategorized.dbtype) {
+                        nsPreferences.setUnicharPref("wiredmarker.uncategorized.style", style);
+                        nsPreferences.setUnicharPref("wiredmarker.uncategorized.title", title);
+                    } else {
+                        if (this.Database.updateFolder({fid: fid, fid_style: style}, dbtype))
+                            this.DataSource.setProperty(aRes, "style", style);
+                    }
+                    var doc_url = this.Common.getURLStringFromDocument(this.gBrowser.contentDocument);
+                    var contResList = this.Database.getObject({pfid: fid, doc_url: doc_url}, dbtype);
+                    if (contResList) {
+                        var i;
+                        for (i = 0; i < contResList.length; i++) {
+                            var source = bitsMarker.id_key + contResList[i].dbtype + contResList[i].oid;
+                            mcTreeDNDHandler.Common.changeNodeStyleFromID(source, style, fid, contResList[i].oid, contResList[i].dbtype);
+                        }
+                    }
+                    this.DataSource.flush();
+                    mcTreeCssService.init();
+                    this.rebuildLocal();
+                    mcPropertyView.dispProperty(mcTreeHandler.object);
+                    if (mcItemView.isChecked)
+                        mcItemView.onTreeClick();
+                } else {
+                    mcPropertyView.dispProperty(mcTreeHandler.object);
+                }
+            } catch (ex) {
+                _dump("property():[" + ex + "]");
+            }
+        }
+        return result.accept;
+    },
+    removeInternal: function(aResList, aParResList, aBypassConfirm) {
+        var rmIDs = [];
+        for (var i = 0; i < aResList.length; i++) {
+            var id = this.DataSource.getProperty(aResList[i], "id");
+            var dbtype = this.DataSource.getProperty(aResList[i], "dbtype");
+            var pfid = this.DataSource.getProperty(aResList[i], "pfid");
+            if (!this.DataSource.exists(aResList[i]) || this.DataSource.getRelativeIndex(aParResList[i], aResList[i]) < 0) {
+                _dump("ERROR: Failed to remove resource.\n" + aResList[i].Value);
+                continue;
+            }
+            rmIDs = rmIDs.concat(this.DataSource.deleteItemDescending(aResList[i], aParResList[i]));
+            this.DataSource.setID2About(id, pfid, undefined, dbtype);
+        }
+        this.DataSource.flush();
+        return rmIDs;
+    },
+    confirmRemovingFor: function(aRes) {
+        try {
+            if (this.DataSource.isContainer(aRes) || mcMainService.prefs.confirmDelete) {
+                return this.Common.confirm(mcMainService.STRING.getString("CONFIRM_DELETE"));
+            }
+            return true;
+        } catch (e) {
+            return false;
+        }
+    },
+    rebuildLocal: function() {
+        var currentIndex = mcTreeHandler.TREE.currentIndex;
+        mcTreeHandler.TREE.builder.rebuild();
+        if (currentIndex >= 0) {
+            mcTreeHandler.TREE.currentIndex = currentIndex;
+            if (!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex))
+                mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+            mcTreeHandler.TREE.focus();
+            mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(currentIndex);
+            mcPropertyView.dispProperty(mcTreeHandler.object);
+        }
+    },
+};
+
+var mcMainService = {
+    get STRING() {
+        return document.getElementById("mcMainString");
+    },
+    get DataSource() {
+        return window.top.bitsObjectMng.DataSource;
+    },
+    get Common() {
+        return window.top.bitsObjectMng.Common;
+    },
+    get XPath() {
+        return window.top.bitsObjectMng.XPath;
+    },
+    get Database() {
+        return window.top.bitsObjectMng.Database;
+    },
+    get gBrowser() {
+        return window.top.bitsObjectMng.getBrowser();
+    },
+    baseURL: "",
+    prefs: {},
+    _init: false,
+    init: function(aEvent) {
+        try {
+            if (!window.top.bitsObjectMng) {
+                setTimeout(function() {
+                    mcMainService.init(aEvent);
+                }, 1000);
+                return;
+            }
+        } catch (ex) {
+            setTimeout(function() {
+                mcMainService.init(aEvent);
+            }, 1000);
+            return;
+        }
+        try {
+            window.top.bitsMarkingCollection._contentWindow = document.defaultView;
+            this.initPrefs();
+            this.DataSource.init();
+            mcTreeHandler.init(false);
+            mcTreeDNDHandler.init();
+            mcTreeMultiDocumentService.init();
+            mcItemView.init();
+            mcTreeRootFolder.init();
+            mcTreeViewModeService.init();
+            mcTreeCssService.init();
+            bitsTreeDate.init(aEvent);
+            mcTreeTemplateFolder.init();
+            mcTreeImageTooltip.init();
+            mcTreeFavoriteFolder.init();
+            try {
+                this.gBrowser.addEventListener("pageshow", mcTreeHandler.pageshow, false);
+                window.top.addEventListener("focus", mcDatabaseUpdate.rebuild, false);
+            } catch (ex2) {
+                _dump2("mcMainService.init():" + ex2);
+            }
+            this.Common.addPrefListener(mcDatabaseObserver);
+            var clone = top.document.getElementById("mciconimage");
+            if (!clone) {
+                var sidebartitle = top.document.getElementById("sidebar-title");
+                var sidebarthrobber = top.document.getElementById("sidebar-throbber");
+                clone = sidebarthrobber.cloneNode(false);
+                /* clone.setAttribute("src","chrome://markingcollection/skin/icon_16.gif"); */
+                /* DASISH icon set as src (icon shown in top area of left sidebar */
+                clone.setAttribute("src", "chrome://markingcollection/skin/annotator-skin/alphatransparent/dasish_header_logo.png");
+                clone.setAttribute("id", "mciconimage");
+                clone.setAttribute("crop", "end");
+                sidebartitle.parentNode.setAttribute("style", "background: #d4dde5");
+                sidebartitle.parentNode.insertBefore(clone, sidebartitle);
+            }
+            var viewmode = mcTreeViewModeService.viewmode;
+            if (viewmode == "each")
+                mcTreeHandler.openAllFolders();
+            if (window.top.bitsScrapPartyAddonService && window.top.bitsScrapPartyAddonService.existsAddon()) {
+                var addon_info_arr = window.top.bitsScrapPartyAddonService.getAddonInfo();
+                if (addon_info_arr && addon_info_arr.length > 0) {
+                    var i;
+                    for (i = 0; i < addon_info_arr.length; i++) {
+                        if (!addon_info_arr[i].side_toolbar)
+                            continue;
+                        if (!addon_info_arr[i].side_toolbar.attrs.xul)
+                            continue;
+                        try {
+                            var xul = document.getElementsByTagName(addon_info_arr[i].side_toolbar.attrs.xul)[0].cloneNode(false);
+                            delete addon_info_arr[i].side_toolbar.attrs.xul;
+                            var j;
+                            for (j = xul.attributes.length - 1; j >= 0; j--) {
+                                xul.removeAttribute(xul.attributes[j].name);
+                            }
+                            var event_attr = [];
+                            var key;
+                            for (key in addon_info_arr[i].side_toolbar.attrs) {
+                                if (key.match(/^on([A-Za-z]+)$/)) {
+                                    event_attr[RegExp.$1] = addon_info_arr[i].side_toolbar.attrs[key];
+                                } else {
+                                    xul.setAttribute(key, addon_info_arr[i].side_toolbar.attrs[key]);
+                                }
+                            }
+                            var pxul = document.getElementById("mcToolbarAddonHBox");
+                            pxul.appendChild(xul);
+                            for (key in event_attr) {
+                                //xul.addEventListener(key,eval(event_attr[key]),false);
+                            }
+                        } catch (ex_xul) {
+                            continue;
+                        }
+                    }
+                }
+                try {
+                    window.top.bitsScrapPartyAddonService.eventListener(aEvent, 1, undefined);
+                } catch (ex) {
+                    _dump2(ex)
+                }
+            }
+            try {
+                if (nsPreferences.getBoolPref("wiredmarker.debug", false))
+                    document.getElementById("mcToolbarMenuButton").removeAttribute("hidden");
+            } catch (e) {
+            }
+            try {
+                mcTreeViewModeService.rebuild();
+            } catch (ex2) {
+                _dump2("mcMainService.init():" + ex2);
+            }
+            mcDatabaseUpdate.init();
+            mcItemView.disp();
+        } catch (ex) {
+            this.Common.alert("mcMainService.init():" + ex);
+        }
+    },
+    initPrefs: function() {
+        this.prefs.confirmDelete = window.top.bitsObjectMng.Common.getBoolPref("wiredmarker.confirmDelete", true);
+        this.prefs.tabsOpen = window.top.bitsObjectMng.Common.getBoolPref("wiredmarker.tabs.open", false);
+        this.prefs.tabsOpenSource = window.top.bitsObjectMng.Common.getBoolPref("wiredmarker.tabs.openSource", false);
+    },
+    refresh: function() {
+        mcTreeHandler.done();
+        mcTreeDNDHandler.quit();
+        this.init();
+    },
+    done: function(aEvent) {
+        try {
+            mcItemView.done();
+            mcTreeRdfRebuildItem.done();
+            this.Common.removePrefListener(mcDatabaseObserver);
+            this.gBrowser.removeEventListener("pageshow", mcTreeHandler.pageshow, false);
+            window.top.removeEventListener("focus", mcDatabaseUpdate.rebuild, false);
+            var mciconimage = top.document.getElementById("mciconimage");
+            if (mciconimage)
+                mciconimage.parentNode.removeChild(mciconimage);
+            mcTreeHandler.done();
+            mcTreeDNDHandler.quit();
+            mcTreeViewModeService.done();
+            mcTreeTemplateFolder.done();
+            mcTreeImageTooltip.done();
+            try {
+                window.top.bitsScrapPartyAddonService.eventListener(aEvent, 1, undefined);
+            } catch (ex2) {
+                _dump(ex)
+            }
+            window.top.bitsObjectMng.DataSource.done();
+        } catch (ex) {
+            this.Common.alert('done():' + ex);
+        }
+        try {
+            window.top.bitsMarkingCollection._contentWindow = null;
+        } catch (e) {
+        }
+    },
+    locate: function(aRes) {
+        if (aRes.Value == window.top.bitsObjectMng.DataSource.ABOUT_ROOT)
+            return;
+        var resList = [aRes];
+        var i;
+        for (i = 0; i < 32; i++) {
+            aRes = window.top.bitsObjectMng.DataSource.findParentResource(aRes);
+            if (aRes.Value == window.top.bitsObjectMng.DataSource.ABOUT_ROOT)
+                break;
+            resList.unshift(aRes);
+        }
+        for (i = 0; i < resList.length; i++) {
+            var idx = mcTreeHandler.TREE.builderView.getIndexOfResource(resList[i]);
+            if (!mcTreeHandler.TREE.view.isContainerOpen(idx))
+                mcTreeHandler.TREE.view.toggleOpenState(idx);
+        }
+        mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(idx);
+        mcTreeHandler.TREE.view.selection.select(idx);
+        mcTreeHandler.TREE.focus();
+        mcPropertyView.dispProperty(mcTreeHandler.object);
+    },
+    createGroupFolder: function(pTitle, pTarResName, pGroup, pStyle, pSource, pEditMode, pIndex) {
+        var tarRes = this.Common.RDF.GetResource(pTarResName);
+        var pPID = this.DataSource.getProperty(tarRes, "id");
+        var dbtype = this.DataSource.getProperty(tarRes, "dbtype");
+        var folder = this.Database.getFolderFormID(pPID, dbtype);
+        var newFolder = this.Database.newFolder();
+        newFolder.fid_title = pTitle;
+        newFolder.fid_style = pStyle;
+        newFolder.pfid = "" + pPID;
+        newFolder.fid_mode = "" + pEditMode;
+        if (!this.Database.addFolder(newFolder, dbtype))
+            return null;
+        var newItem = this.Common.newItem();
+        newItem.id = newFolder.fid;
+        newItem.about = this.DataSource.getAbout(newFolder.fid, newFolder.pfid, dbtype);
+        newItem.pfid = pPID;
+        newItem.title = pTitle;
+        newItem.type = "folder";
+        newItem.style = pStyle;
+        newItem.source = pSource;
+        newItem.cssrule = 'css_' + dbtype + '_' + newFolder.fid;
+        newItem.dbtype = dbtype;
+        if (pIndex)
+            newItem.index = pIndex;
+        if (pEditMode) {
+            newItem.editmode = pEditMode;
+        } else {
+            newItem.editmode = "false";
+        }
+//0.299*R + 0.587*G + 0.114*B
+        var tarResName, tarRelIdx;
+        tarResName = pTarResName;
+        try {
+            var cont = window.top.bitsObjectMng.DataSource.getContainer(tarResName, false);
+            tarRelIdx = cont.GetCount();
+        } catch (ex) {
+            tarRelIdx = -1;
+        }
+        var newRes = window.top.bitsObjectMng.DataSource.addItem(newItem, tarResName, tarRelIdx, dbtype);
+        if (newRes && newRes.Value) {
+            window.top.bitsObjectMng.DataSource.flush();
+            window.top.bitsObjectMng.DataSource.createEmptySeq(newRes.Value);
+        }
+        return newRes;
+    },
+    openPrefWindow: function() {
+        window.top.bitsMarkingCollection.openPrefWindow();
+    },
+};
+
+var mcTreeDNDHandler = {
+    row: 0,
+    orient: 0,
+    modAlt: false,
+    modShift: false,
+    modCtrl: false,
+    modMeta: false,
+    _dataTransfer: null, //3.1ä»¥é
+
+    folderAutoOpenRow: -1,
+    rangeParent: null,
+    originalTarget: null,
+    get DataSource() {
+        return window.top.bitsObjectMng.DataSource;
+    },
+    get Common() {
+        return window.top.bitsObjectMng.Common;
+    },
+    get XPath() {
+        return window.top.bitsObjectMng.XPath;
+    },
+    get Database() {
+        return window.top.bitsObjectMng.Database;
+    },
+    get gBrowser() {
+        return window.top.bitsObjectMng.getBrowser();
+    },
+    onDragDrop: function(aEvent) {
+        mcTreeDNDHandler.getModifiers(aEvent);
+        this.nsDragAndDrop_drop(aEvent, mcTreeDNDHandler.dragDropObserver);
+        aEvent.stopPropagation();
+    },
+    nsDragAndDrop_drop: function(aEvent, aDragDropObserver) {
+        if (!("onDrop" in aDragDropObserver))
+            return;
+        if (!nsDragAndDrop.checkCanDrop(aEvent, aDragDropObserver))
+            return;
+        if (nsDragAndDrop.mDragSession.canDrop) {
+            var flavourSet = aDragDropObserver.getSupportedFlavours();
+            var transferData = mcTreeDNDHandler.nsTransferable_get(flavourSet, nsDragAndDrop.getDragData, true);
+            var multiple = "canHandleMultipleItems" in aDragDropObserver && aDragDropObserver.canHandleMultipleItems;
+            var dropData = multiple ? transferData : transferData.first.first;
+            aDragDropObserver.onDrop(aEvent, dropData, nsDragAndDrop.mDragSession);
+        }
+        aEvent.stopPropagation();
+    },
+    nsTransferable_get: function(aFlavourSet, aRetrievalFunc, aAnyFlag) {
+        if (!aRetrievalFunc)
+            throw "No data retrieval handler provided!";
+        var supportsArray = aRetrievalFunc(aFlavourSet);
+        var dataArray = [];
+        var count = supportsArray.Count();
+        for (var i = 0; i < count; i++) {
+            var trans = supportsArray.GetElementAt(i);
+            if (!trans)
+                continue;
+            trans = trans.QueryInterface(Components.interfaces.nsITransferable);
+            var data = {};
+            var length = {};
+            var currData = null;
+            if (aAnyFlag) {
+                var flavour = {};
+                try {
+                    trans.getAnyTransferData(flavour, data, length);
+                    if (data && flavour) {
+                        var selectedFlavour = aFlavourSet.flavourTable[flavour.value];
+                        if (selectedFlavour)
+                            dataArray[i] = FlavourToXfer(data.value, length.value, selectedFlavour);
+                    }
+                } catch (ex) {
+                    _dump2("nsTransferable_get(" + i + "):" + ex);
+                    continue;
+                }
+            } else {
+                var firstFlavour = aFlavourSet.flavours[0];
+                trans.getTransferData(firstFlavour, data, length);
+                if (data && firstFlavour)
+                    dataArray[i] = FlavourToXfer(data.value, length.value, firstFlavour);
+            }
+        }
+        return new TransferDataSet(dataArray);
+    },
+    dragDropObserver: {
+        onDragStart: function(event, transferData, action) {
+            try {
+                mcTreeImageTooltip.hidePopup()
+            } catch (ex) {
+            }
+            try {
+                if (event.originalTarget.localName != "treechildren")
+                    return;
+                var curIdx = mcTreeHandler.TREE.currentIndex;
+                var res = mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+                var source = mcTreeDNDHandler.DataSource.getProperty(res, "source");
+                var editmode = mcTreeDNDHandler.DataSource.getProperty(res, "editmode");
+                var curPar = mcTreeHandler.getParentResource(curIdx);
+                var p_source = window.top.bitsObjectMng.DataSource.getProperty(curPar, "source");
+                transferData.data = new TransferData();
+                transferData.data.addDataForFlavour("moz/rdfitem", res.Value);
+            } catch (ex) {
+                _dump("dragDropObserver.onDragStart():" + ex);
+            }
+        },
+        getSupportedFlavours: function() {
+            var flavours = new FlavourSet();
+            flavours.appendFlavour("moz/rdfitem");
+            flavours.appendFlavour("text/x-moz-url");
+            flavours.appendFlavour("text/html");
+            flavours.appendFlavour("text/xml");
+            flavours.appendFlavour("application/x-moz-url");
+            flavours.appendFlavour("application/x-moz-file", "nsIFile");
+            flavours.appendFlavour("text/unicode");
+            flavours.appendFlavour("wired-marker/folder");
+            flavours.appendFlavour("wired-marker/object");
+            return flavours;
+        },
+        onDragOver: function(event, flavour, session) {
+        },
+        onDragExit: function(event, session) {
+        },
+        onDrop: function(event, transferData, session) {
+        },
+    },
+    builderObserver: {
+        canDrop: function(index, orient) {
+            var XferDataSet = null;
+            var XferData = null;
+            var doraggedData = null;
+            var XferDataType = null;
+            var info = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
+            var app_version = parseFloat(info.version);
+            if (app_version < 3.1) {
+                try {
+                    XferDataSet = nsTransferable.get(mcTreeDNDHandler.dragDropObserver.getSupportedFlavours(), nsDragAndDrop.getDragData, true);
+                    XferData = XferDataSet.first.first;
+                    doraggedData = XferData.data;
+                    XferDataType = XferData.flavour.contentType;
+                } catch (ex) {
+                }
+            } else {
+                try {
+                    if (mcTreeDNDHandler._dataTransfer) {
+                        var dataTransfer = mcTreeDNDHandler._dataTransfer;
+                        XferData = {};
+                        var supportedTypes = ["moz/rdfitem", "wired-marker/object", "text/x-moz-url", "text/url-list", "text/plain", "application/x-moz-file"];
+                        var types = dataTransfer.types;
+                        types = supportedTypes.filter(function(value) {
+                            return types.contains(value);
+                        });
+                        if (types.length) {
+                            XferData.data = dataTransfer.getData(types[0]);
+                            XferData.flavour = {contentType: types[0]};
+                            if (!XferData.data)
+                                XferData.data = dataTransfer.mozGetDataAt(types[0], 0);
+                        }
+                        if (XferData.data) {
+                            doraggedData = XferData.data;
+                            XferDataType = XferData.flavour.contentType;
+                        }
+                    }
+                } catch (ex) {
+                    XferData = undefined;
+                    doraggedData = undefined;
+                    XferDataType = undefined;
+                }
+            }
+            try {
+                var res = (index == -1) ? [mcTreeHandler.TREE.ref, 0] : mcTreeDNDHandler.getTarget(index, orient);
+                var curRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(index);
+                var editmode = window.top.bitsObjectMng.DataSource.getProperty(curRes, "editmode");
+                var dbtype = window.top.bitsObjectMng.DataSource.getProperty(curRes, "dbtype");
+                if (dbtype == "")
+                    return false;
+                if (res[0] == mcTreeHandler.TREE.ref && !(editmode & 0x1000))
+                    return false;
+                if (mcTreeHandler.TREE.currentIndex >= 0 && XferDataType == "moz/rdfitem") {
+                    var srcRes = mcTreeHandler.resource;
+                    var d_editmode = window.top.bitsObjectMng.DataSource.getProperty(srcRes, "editmode");
+                    if (res[0] != mcTreeHandler.TREE.ref && (d_editmode & 0x1000))
+                        return false;
+                    if (res[0] != mcTreeHandler.TREE.ref && ((editmode & 0x1000) && (d_editmode & 0x1000)))
+                        return false;
+                } else {
+                    if (editmode & 0x1000) {
+                        if (XferDataType == "text/x-moz-url" || XferDataType == "application/x-moz-file") {
+                            var url;
+                            var aFile;
+                            if (XferDataType == "text/x-moz-url") {
+                                url = doraggedData.split("\n")[0];
+                                aFile = mcTreeHandler.Common.convertURLToFile(url);
+                            } else if (XferDataType == "application/x-moz-file") {
+                                aFile = doraggedData;
+                                url = mcTreeDNDHandler.Common.convertFilePathToURL(aFile.path);
+                            }
+                            if (!aFile || !aFile.exists() || !url)
+                                return false;
+                            var splitFileName = mcTreeHandler.Common.splitFileName(url);
+                            if (splitFileName[1].toLowerCase() != "xml" && splitFileName[1].toLowerCase() != "zip")
+                                return false;
+                        } else {
+                            return false;
+                        }
+                    } else if (index > 0 && orient < 0) {
+                        var prevRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(index - 1);
+                        var prevEditmode = window.top.bitsObjectMng.DataSource.getProperty(prevRes, "editmode");
+                        if (prevEditmode & 0x1000)
+                            return false;
+                    }
+                }
+                if (index != -1 && !mcTreeHandler.TREE.view.isContainer(index) && orient == 0)
+                    return false;
+                window.top.bitsScrapPartyAddonService.builderViewObserver.canDrop(index, orient, mcTreeHandler.TREE);
+                return true;
+            } catch (ex) {
+                return false;
+            }
+        },
+        onDrop: function(row, orient) {
+            var XferDataSet = null;
+            var XferData = null;
+            var doraggedData = null;
+            var XferDataType = null;
+            var info = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
+            var app_version = parseFloat(info.version);
+            if (app_version < 3.1) {
+                try {
+                    XferDataSet = nsTransferable.get(mcTreeDNDHandler.dragDropObserver.getSupportedFlavours(), nsDragAndDrop.getDragData, true);
+                    XferData = XferDataSet.first.first;
+                    doraggedData = XferData.data;
+                    XferDataType = XferData.flavour.contentType;
+                } catch (ex) {
+                }
+            } else {
+                try {
+                    if (mcTreeDNDHandler._dataTransfer) {
+                        var dataTransfer = mcTreeDNDHandler._dataTransfer;
+                        XferData = {};
+                        var supportedTypes = ["moz/rdfitem", "wired-marker/object", "text/x-moz-url", "text/url-list", "text/plain", "application/x-moz-file"];
+                        var types = dataTransfer.types;
+                        types = supportedTypes.filter(function(value) {
+                            return types.contains(value);
+                        });
+                        if (types.length) {
+                            XferData.data = dataTransfer.getData(types[0]);
+                            XferData.flavour = {contentType: types[0]};
+                            if (!XferData.data)
+                                XferData.data = dataTransfer.mozGetDataAt(types[0], 0);
+                        }
+                        if (XferData.data) {
+                            doraggedData = XferData.data;
+                            XferDataType = XferData.flavour.contentType;
+                        }
+                    }
+                } catch (ex) {
+                }
+            }
+            var state;
+//			try{
+            if (XferDataType == "moz/rdfitem") {
+                if (mcTreeHandler.TREE.currentIndex >= 0 && mcTreeHandler.TREE.currentIndex != row && window.top.bitsScrapPartyMergeService) {
+                    var srcRes = mcTreeHandler.resource;
+                    var dstRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(row);
+                    var param = {
+                        tree: mcTreeHandler.TREE,
+                        srcRes: srcRes,
+                        dstRes: dstRes,
+                        modCtrl: mcTreeDNDHandler.modCtrl,
+                        modAlt: mcTreeDNDHandler.modAlt,
+                        modShift: mcTreeDNDHandler.modShift,
+                        modMeta: mcTreeDNDHandler.modMeta
+                    };
+                    var mergeRtn = window.top.bitsScrapPartyMergeService.mergeResource(param);
+                    if (mergeRtn) {
+                        window.top.bitsScrapPartyAddonService.builderViewObserver.onDrop(row, orient, mcTreeHandler.TREE, XferDataSet);
+                        return;
+                    }
+                    if (window.top.bitsScrapPartyMergeService.cancel) {
+                        window.top.bitsScrapPartyAddonService.builderViewObserver.onDrop(row, orient, mcTreeHandler.TREE, XferDataSet);
+                        mcTreeViewModeService.rebuild();
+                        return;
+                    }
+                    var src_dbtype = mcTreeDNDHandler.DataSource.getProperty(srcRes, "dbtype");
+                    var dst_dbtype = mcTreeDNDHandler.DataSource.getProperty(dstRes, "dbtype");
+                    if (src_dbtype == window.top.bitsMarkingCollection._uncategorized.dbtype || dst_dbtype == window.top.bitsMarkingCollection._uncategorized.dbtype || mcTreeDNDHandler.modShift) {
+                        mcTreeDNDHandler.modShift = true;
+                        mcTreeDNDHandler.move(row, orient);
+                    } else {
+                        if (mcTreeDNDHandler.modCtrl || mcTreeDNDHandler.modMeta) {
+                            mcTreeDNDHandler.copy(row, orient);
+                        } else {
+                            mcTreeDNDHandler.move(row, orient);
+                        }
+                    }
+                } else {
+                    if (mcTreeDNDHandler.modCtrl || mcTreeDNDHandler.modMeta) {
+                        mcTreeDNDHandler.copy(row, orient);
+                    } else {
+                        mcTreeDNDHandler.move(row, orient);
+                    }
+                }
+            } else if (XferDataType == "wired-marker/object" && XferData) {
+                var dstRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(row);
+                var type = mcTreeHandler.DataSource.getProperty(dstRes, "type");
+                if (!(type & 0x1000) && mcTreeHandler.TREE.currentIndex >= 0 && mcTreeHandler.TREE.currentIndex != row && window.top.bitsScrapPartyMergeService) {
+                    var srcRes = mcTreeHandler.resource;
+                    var mergeRtn = mcItemView.mergeObject(srcRes, dstRes);
+                    if (mergeRtn)
+                        return;
+                    var src_dbtype = mcTreeDNDHandler.DataSource.getProperty(srcRes, "dbtype");
+                    if (!src_dbtype || src_dbtype == "") {
+                        if (mcItemView.isChecked) {
+                            var object = mcItemView.object;
+                            if (object.dbtype)
+                                src_dbtype = object.dbtype;
+                        }
+                    }
+                    if (!src_dbtype || src_dbtype == "")
+                        return;
+                    var dst_dbtype = mcTreeDNDHandler.DataSource.getProperty(dstRes, "dbtype");
+                    if (src_dbtype == window.top.bitsMarkingCollection._uncategorized.dbtype || dst_dbtype == window.top.bitsMarkingCollection._uncategorized.dbtype || mcTreeDNDHandler.modShift) {
+                        mcItemView.moveObject(dstRes, true);
+                    } else {
+                        if (mcItemView.modCtrl || mcItemView.modMeta) {
+                            mcItemView.copyObject(dstRes);
+                        } else {
+                            mcItemView.moveObject(dstRes, mcItemView.modShift);
+                        }
+                    }
+                }
+            } else if (XferDataType == "application/x-moz-file" && XferData) {
+                if (XferData.data instanceof Components.interfaces.nsIFile) {
+                    var urlString = mcTreeDNDHandler.Common.convertFilePathToURL(XferData.data.path);
+                    state = mcTreeDNDHandler.capture(urlString, row, orient);
+                }
+            } else if (XferData && XferData.data) {
+                if (
+                        mcTreeDNDHandler.originalTarget &&
+                        mcTreeDNDHandler.originalTarget.nodeName == "IMG" &&
+                        mcTreeDNDHandler.originalTarget.hasAttribute('oid') &&
+                        mcTreeDNDHandler.originalTarget.hasAttribute('dbtype') &&
+                        mcTreeDNDHandler.originalTarget.hasAttribute('pfid')) {
+                    var oid = mcTreeDNDHandler.originalTarget.getAttribute('oid');
+                    var dbtype = mcTreeDNDHandler.originalTarget.getAttribute('dbtype');
+                    var pfid = mcTreeDNDHandler.originalTarget.getAttribute('pfid');
+                    var dstRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(row);
+                    var dst_fid = mcTreeDNDHandler.DataSource.getProperty(dstRes, "id");
+                    var dst_dbtype = mcTreeDNDHandler.DataSource.getProperty(dstRes, "dbtype");
+                    var dst_style = mcTreeDNDHandler.DataSource.getProperty(dstRes, "style");
+                    if (dst_fid == pfid && dst_dbtype == dbtype)
+                        return;
+                    var srcObjects = mcTreeDNDHandler.Database.getObject({oid: oid, pfid: pfid}, dbtype);
+                    var mergeRtn = window.top.bitsTreeListService.mergeObject({fid: dst_fid, dbtype: dst_dbtype}, srcObjects[0]);
+                    if (mergeRtn)
+                        return;
+                    var rtnObj = null;
+                    if (dbtype == window.top.bitsMarkingCollection._uncategorized.dbtype || mcTreeDNDHandler.modShift) {
+                        rtnObj = window.top.bitsTreeListService.moveObject({fid: dst_fid, dbtype: dst_dbtype, fid_style: dst_style}, srcObjects[0], true);
+                    } else {
+                        rtnObj = window.top.bitsTreeListService.copyObject({fid: dst_fid, dbtype: dst_dbtype, fid_style: dst_style}, srcObjects[0]);
+                    }
+                    if (rtnObj) {
+                        setTimeout(function() {
+                            try {
+                                mcTreeHandler.TREE.currentIndex = row;
+                                if (!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex))
+                                    mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+                                mcPropertyView.dispProperty(mcTreeHandler.object);
+                                var viewmode = mcTreeViewModeService.viewmode;
+                                if (mcItemView.isChecked) {
+                                    mcItemView._bitsItemView.onTreeClick({viewmode: viewmode, fid: dst_fid, dbtype: dst_dbtype, res: dstRes});
+                                } else {
+                                    var f_pfid = undefined;
+                                    var rtnFolder = mcTreeDNDHandler.Database.getFolder({fid: pfid}, dbtype);
+                                    if (rtnFolder && rtnFolder.length)
+                                        f_pfid = rtnFolder[0].pfid;
+                                    rtnFolder = undefined;
+                                    if (dbtype == window.top.bitsMarkingCollection._uncategorized.dbtype || mcTreeDNDHandler.modShift) {
+                                        var srcPRes = mcTreeDNDHandler.Common.RDF.GetResource(mcTreeDNDHandler.DataSource.getID2About(pfid, f_pfid, dbtype));
+                                        var srcAbout = mcTreeDNDHandler.DataSource.getID2About(oid, pfid, dbtype);
+                                        var srcRes = mcTreeDNDHandler.Common.RDF.GetResource(srcAbout);
+                                        if (mcTreeDNDHandler.DataSource.moveItem(srcRes, srcPRes, dstRes, -1)) {
+                                            mcTreeDNDHandler.DataSource.setProperty(srcRes, "dbtype", dst_dbtype);
+                                            mcTreeDNDHandler.DataSource.setProperty(srcRes, "pfid", dst_fid);
+                                            mcTreeDNDHandler.DataSource.setProperty(srcRes, "id", rtnObj.oid);
+                                            mcTreeDNDHandler.DataSource.setID2About(oid, pfid, undefined, dbtype);
+                                            mcTreeDNDHandler.DataSource.setID2About(rtnObj.oid, dst_fid, srcRes.Value, dst_dbtype);
+                                            mcTreeDNDHandler.changeNodeStyle(srcRes);
+                                        }
+                                    } else {
+                                        mcTreeDNDHandler.DataSource.addItem(mcTreeDNDHandler.Database.makeObjectToItem(rtnObj), dstRes.Value, -1, dst_dbtype);
+                                    }
+                                    mcTreeDNDHandler.DataSource.flush();
+                                    mcTreeCssService.init();
+                                    mcController.rebuildLocal();
+                                }
+                                window.top.bitsTreeListService.reload(mcTreeDNDHandler.originalTarget.ownerDocument);
+                                mcTreeDNDHandler.originalTarget = null;
+                            } catch (e) {
+                                _dump2(e);
+                            }
+                        }, 0);
+                    }
+                } else {
+                    state = mcTreeDNDHandler.capture(XferData.data, row, orient);
+                }
+            }
+//			}catch(ex){_dump2("onDrop():"+ex);}
+            mcController.rebuildLocal();
+            window.top.bitsScrapPartyAddonService.builderViewObserver.onDrop(row, orient, mcTreeHandler.TREE, XferDataSet, state);
+        },
+        onToggleOpenState: function(aRow) {
+        },
+        onCycleHeader: function() {
+        },
+        onSelectionChanged: function() {
+        },
+        onCycleCell: function(aRow, pColID) {
+        },
+        isEditable: function() {
+        },
+        onSetCellText: function() {
+        },
+        onPerformAction: function() {
+        },
+        onPerformActionOnRow: function() {
+        },
+        onPerformActionOnCell: function(aAction, aRow, aColID) {
+        },
+    },
+    getModifiers: function(aEvent) {
+        this.modAlt = aEvent.altKey;
+        this.modShift = aEvent.shiftKey;
+        this.modCtrl = aEvent.ctrlKey;
+        this.modMeta = aEvent.metaKey;
+    },
+    setDataTransfer: function(aEvent) {
+        try {
+            if (aEvent.dataTransfer)
+                this._dataTransfer = aEvent.dataTransfer;
+        } catch (e) {
+        }
+    },
+    onMousedown: function(aEvent) {
+        try {
+            mcTreeDNDHandler.rangeParent = aEvent.rangeParent;
+        } catch (ex) {
+        }
+        try {
+            mcTreeDNDHandler.originalTarget = aEvent.originalTarget;
+        } catch (ex) {
+        }
+    },
+    init: function() {
+        this.gBrowser.addEventListener("mousedown", this.onMousedown, false);
+    },
+    quit: function() {
+        try {
+            this.gBrowser.removeEventListener("mousedown", this.onMousedown, false);
+        } catch (ex) {
+        }
+    },
+    move: function(aRow, aOrient) {
+        this.row = aRow;
+        this.orient = aOrient;
+        this.rowRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(aRow);
+        (mcTreeHandler.TREE.view.selection.count == 1) ? this.moveSingle() : this.moveMultiple();
+    },
+    moveSingle: function() {
+        var curIdx = mcTreeHandler.TREE.currentIndex;
+        var curRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+
+        var id = this.DataSource.getProperty(curRes, "id");
+        var dbtype = this.DataSource.getProperty(curRes, "dbtype");
+        var pfid = this.DataSource.getProperty(curRes, "pfid");
+        var about = this.DataSource.getID2About(id, pfid, dbtype);
+        var curRes = mcTreeDNDHandler.Common.RDF.GetResource(about);
+        var curPar = this.DataSource.findParentResource(curRes);
+        var tarRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(this.row);
+        var tarPar = (this.orient == 0) ? tarRes : mcTreeHandler.getParentResource(this.row);
+        this.moveAfterChecking(curRes, curPar, tarRes, tarPar);
+        window.top.bitsObjectMng.DataSource.flush();
+    },
+    moveMultiple: function() {
+        var idxList = mcTreeHandler.getSelection(false, 2);
+        if (mcTreeHandler.validateMultipleSelection(idxList) == false)
+            return;
+        var i = 0;
+        var curResList = [];
+        var curParList = [];
+        var tarResList = [];
+        var tarParList = [];
+        for (i = 0; i < idxList.length; i++) {
+            curResList.push(mcTreeHandler.TREE.builderView.getResourceAtIndex(idxList[i]));
+            curParList.push(mcTreeHandler.getParentResource(idxList[i]));
+            tarResList.push(mcTreeHandler.TREE.builderView.getResourceAtIndex(this.row));
+            tarParList.push((this.orient == 0) ? tarResList[i] : mcTreeHandler.getParentResource(this.row));
+        }
+        if (this.orient == 1) {
+            for (i = idxList.length - 1; i >= 0; i--) {
+                this.moveAfterChecking(curResList[i], curParList[i], tarResList[i], tarParList[i]);
+            }
+        } else {
+            for (i = 0; i < idxList.length; i++) {
+                this.moveAfterChecking(curResList[i], curParList[i], tarResList[i], tarParList[i]);
+            }
+        }
+        window.top.bitsObjectMng.DataSource.flush();
+    },
+    moveAfterChecking: function(curRes, curPar, tarRes, tarPar) {
+        var curAbsIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(curRes);
+        var curRelIdx = this.DataSource.getRelativeIndex(curPar, curRes);
+        var tarRelIdx = this.DataSource.getRelativeIndex(tarPar, tarRes);
+        if (this.orient == 0) {
+            if (curAbsIdx == this.row)
+                return;
+        } else {
+            if (this.orient == 1)
+                tarRelIdx++;
+            if (curPar.Value == tarPar.Value && tarRelIdx > curRelIdx)
+                tarRelIdx--;
+            if (this.orient == 1 &&
+                    mcTreeHandler.TREE.view.isContainer(this.row) &&
+                    mcTreeHandler.TREE.view.isContainerOpen(this.row) &&
+                    mcTreeHandler.TREE.view.isContainerEmpty(this.row) == false) {
+                if (curAbsIdx == this.row)
+                    return;
+                tarPar = tarRes;
+                tarRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(this.row + 1);
+                tarRelIdx = 1;
+            }
+            if (curPar.Value == tarPar.Value && curRelIdx == tarRelIdx)
+                return;
+        }
+        if (curAbsIdx >= 0 && mcTreeHandler.TREE.view.isContainer(curAbsIdx)) {
+            var tmpIdx = this.row;
+            var tmpRes = tarRes;
+            while (tmpRes.Value != mcTreeHandler.TREE.ref && tmpIdx != -1) {
+                tmpRes = mcTreeHandler.getParentResource(tmpIdx);
+                tmpIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(tmpRes);
+                if (tmpRes.Value == curRes.Value)
+                    return;
+            }
+        }
+        var rtn = false;
+        var tar_pfid = this.DataSource.getProperty(tarPar, "id");
+        var tar_dbtype = this.DataSource.getProperty(tarPar, "dbtype");
+        var cur_dbtype = this.DataSource.getProperty(curRes, "dbtype");
+        var cur_pfid = this.DataSource.getProperty(curRes, "pfid");
+        var rtnFolder = null;
+        var rtnObject = null;
+        var pfid_order = 0;
+        if (this.DataSource.isContainer(this.rowRes)) {
+            var tmp_fid = this.DataSource.getProperty(this.rowRes, "id");
+            rtnFolder = this.Database.getFolderFormID(tmp_fid, tar_dbtype);
+            if (rtnFolder && rtnFolder.length)
+                pfid_order = rtnFolder[0].pfid_order;
+        } else {
+            var tmp_oid = this.DataSource.getProperty(this.rowRes, "id");
+            rtnObject = this.Database.getObject({oid: tmp_oid, pfid: tar_pfid}, tar_dbtype);
+            if (rtnObject && rtnObject.length)
+                pfid_order = rtnObject[0].pfid_order;
+        }
+        if (this.orient >= 0)
+            pfid_order = parseFloat(parseFloat(pfid_order) + parseFloat(this.orient));
+        if (curAbsIdx >= 0 && mcTreeHandler.TREE.view.isContainer(curAbsIdx)) {
+            var fid = this.DataSource.getProperty(curRes, "id");
+            if (cur_dbtype == tar_dbtype) {
+                rtn = this.Database.updateFolder({fid: fid, pfid: tar_pfid, pfid_order: pfid_order}, tar_dbtype);
+                if (rtn) {
+                    this.DataSource.setProperty(curRes, "pfid", tar_pfid);
+                    this.DataSource.setProperty(curRes, "pfid_order", pfid_order);
+                    this.DataSource.setID2About(fid, cur_pfid, undefined, cur_dbtype);
+                    this.DataSource.setID2About(fid, tar_pfid, curRes.Value, tar_dbtype);
+                }
+            } else {
+                this.moveFolder(curRes, curPar, tarPar, tarRelIdx);
+                return;
+            }
+        } else {
+            var oid = this.DataSource.getProperty(curRes, "id");
+            if (tar_pfid != cur_pfid) {
+                rtn = !this.Database.existsObject({oid: oid, pfid: tar_pfid}, tar_dbtype);
+            } else {
+                rtn = true;
+            }
+            if (!rtn) {
+                rtn = this.Common.confirm(mcMainService.STRING.getString("CONFIRM_COPYOBJECT_OVERWRITE"));
+                if (rtn) {
+                    var contResList = this.DataSource.flattenResources(tarPar, 2, false);
+                    var i;
+                    for (i = 0; i < contResList.length; i++) {
+                        if (contResList[i].Value == curRes.Value)
+                            continue;
+                        var del_oid = this.DataSource.getProperty(contResList[i], "id");
+                        if (del_oid != oid)
+                            continue;
+                        mcTreeHandler.remove(undefined, contResList[i], true, false);
+                    }
+                }
+            }
+            if (rtn) {
+                if (cur_dbtype == tar_dbtype) {
+                    if (cur_pfid != tar_pfid) {
+                        rtn = this.Database.updateObject({oid: oid, pfid: tar_pfid, pfid_old: cur_pfid, pfid_order: pfid_order}, tar_dbtype);
+                        if (rtn) {
+                            this.DataSource.setProperty(curRes, "pfid", tar_pfid);
+                            this.DataSource.setProperty(curRes, "pfid_order", pfid_order);
+                            this.DataSource.setID2About(oid, cur_pfid, undefined, cur_dbtype);
+                            this.DataSource.setID2About(oid, tar_pfid, curRes.Value, tar_dbtype);
+                        }
+                    }
+                } else {
+                    this.moveObject(curRes, curPar, tarPar, tarRelIdx);
+                    return;
+                }
+            }
+        }
+        if (rtn) {
+            rtn = this.DataSource.moveItem(curRes, curPar, tarPar, tarRelIdx);
+            if (rtn) {
+                if (this.DataSource.isContainer(this.Common.RDF.GetResource(curRes.Value))) {
+                } else {
+                    mcTreeDNDHandler.changeNodeStyle(curRes);
+                }
+                window.top.bitsMarkingCollection.reOrder(tarPar);
+                var selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(this.Common.RDF.GetResource(curRes.Value));
+                if (selectIdx >= 0) {
+                    mcTreeHandler.TREE.currentIndex = selectIdx;
+                    if (!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex))
+                        mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+                    mcTreeHandler.TREE.focus();
+                    mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(selectIdx);
+                    mcPropertyView.dispProperty(mcTreeHandler.object);
+                }
+            } else {
+                mcTreeViewModeService.rebuild();
+            }
+        }
+    },
+    moveFolder: function(curRes, curPar, tarPar, tarRelIdx) {
+        var rtn = false;
+        var modShift = this.modShift;
+        var tar_dbtype = this.DataSource.getProperty(tarPar, "dbtype");
+        var cur_dbtype = this.DataSource.getProperty(curPar, "dbtype");
+        var aTransaction = true;
+        if (!aTransaction) {
+            this.Database.beginTransaction(tar_dbtype);
+            this.Database.beginTransaction(cur_dbtype);
+        }
+        var addPar;
+        var moveRes = null;
+        var moveFids = [];
+        var fid2newfid = [];
+        var moveID = parseInt(this.DataSource.identify(this.Common.getTimeStamp()));
+        var i, j;
+        var fldResList = this.DataSource.flattenResources(curRes, 1, true);
+        for (i = 0; i < fldResList.length; i++) {
+            addParAbout = null;
+            var tmp_fid = this.DataSource.getProperty(fldResList[i], "id");
+            if (this.Database._idExists(tar_dbtype, tmp_fid, aTransaction)) {
+                fid2newfid["" + tmp_fid] = "" + moveID;
+                moveID = parseInt(moveID) + 1;
+            } else {
+                fid2newfid["" + tmp_fid] = "" + tmp_fid;
+            }
+            var tmp_dbtype = this.DataSource.getProperty(fldResList[i], "dbtype");
+            var moveFolder = this.Database.getFolderFormID(tmp_fid, tmp_dbtype, aTransaction);
+            if (!moveFolder || moveFolder.length == 0)
+                break;
+            moveFolder = moveFolder[0];
+            delete moveFolder.dbtype;
+            if (fid2newfid["" + moveFolder.fid])
+                moveFolder.fid = fid2newfid["" + moveFolder.fid];
+            moveFids.push(moveFolder);
+            if (curRes.Value == fldResList[i].Value) {
+                moveFolder.pfid = this.DataSource.getProperty(tarPar, "id");
+                addParAbout = tarPar.Value;
+            } else if (fid2newfid["" + moveFolder.pfid]) {
+                moveFolder.pfid = fid2newfid["" + moveFolder.pfid];
+            }
+            rtn = this.Database.addFolder(moveFolder, tar_dbtype, aTransaction);
+            if (rtn) {
+                if (!addParAbout) {
+                    var fid = moveFolder.pfid;
+                    var f_pfid = undefined;
+                    var rtnFolder = this.Database.getFolder({fid: moveFolder.pfid}, tar_dbtype);
+                    if (rtnFolder && rtnFolder.length)
+                        f_pfid = rtnFolder[0].pfid;
+                    rtnFolder = undefined;
+                    addParAbout = this.DataSource.getID2About(moveFolder.pfid, f_pfid, tar_dbtype);
+                }
+                var newItem = this.Common.newItem();
+                newItem.id = moveFolder.fid;
+                newItem.about = this.DataSource.getAbout(moveFolder.fid, moveFolder.pfid, tar_dbtype);
+                newItem.pfid = moveFolder.pfid;
+                newItem.title = moveFolder.fid_title;
+                newItem.type = "folder";
+                newItem.style = moveFolder.fid_style;
+                newItem.source = "";
+                newItem.cssrule = 'css_' + tar_dbtype + '_' + moveFolder.fid;
+                newItem.dbtype = tar_dbtype;
+                newItem.editmode = moveFolder.fid_mode;
+                newItem.icon = this.DataSource.getProperty(fldResList[i], "icon");
+                newItem.addon_id = this.DataSource.getProperty(fldResList[i], "addon_id");
+                var tarRelIdx = -1;
+                try {
+                    var cont = this.DataSource.getContainer(addParAbout, false);
+                    tarRelIdx = cont.GetCount();
+                } catch (ex) {
+                }
+                var newRes = this.DataSource.addItem(newItem, addParAbout, tarRelIdx, tar_dbtype);
+                if (newRes && newRes.Value) {
+                    this.DataSource.createEmptySeq(newRes.Value);
+                    if (!moveRes)
+                        moveRes = newRes;
+                }
+            } else {//å€±æããå Žå
+                if (moveRes)
+                    mcTreeHandler._removeFolder(moveRes);
+                break;
+            }
+        }
+        if (mcItemView.isChecked) {
+            var objResList = [];
+            if (rtn) {
+                var tmp_fid = this.DataSource.getProperty(curRes, "id");
+                var tmp_dbtype = this.DataSource.getProperty(curRes, "dbtype");
+                objResList = window.top.bitsTreeExportService._getAllObject({fid: tmp_fid, dbtype: tmp_dbtype});
+                for (i = 0; i < objResList.length; i++) {
+                    var moveObject = objResList[i];
+                    var folder = {
+                        fid: fid2newfid["" + moveObject.pfid],
+                        dbtype: tar_dbtype
+                    };
+                    rtn = bitsItemView._moveObject(folder, moveObject, modShift);
+                    if (!rtn) {
+                        if (moveRes)
+                            mcTreeHandler._removeFolder(moveRes);
+                        break;
+                    }
+                }
+            }
+        } else {
+            var objResList = this.DataSource.flattenResources(curRes, 2, true);
+            if (rtn) {
+                for (i = 0; i < objResList.length; i++) {
+                    var tmp_oid = this.DataSource.getProperty(objResList[i], "id");
+                    var tmp_dbtype = this.DataSource.getProperty(objResList[i], "dbtype");
+                    var moveObject = null;
+                    var moveObjects = this.Database.getObjectFormID(tmp_oid, tmp_dbtype, aTransaction);
+                    if (!moveObjects || moveObjects.length == 0)
+                        break;
+                    for (j = 0; j < moveObjects.length; j++) {
+                        if (fid2newfid["" + moveObjects[j].pfid] == undefined)
+                            continue;
+                        moveObject = moveObjects[j];
+                    }
+                    if (!moveObject)
+                        continue;
+                    delete moveObject.dbtype;
+                    delete moveObject.fid_style;
+                    delete moveObject.fid_title;
+                    delete moveObject.folder_order;
+                    if (this.Database._idExists(tar_dbtype, moveObject.oid, aTransaction)) {
+                        moveObject.oid = "" + moveID;
+                        moveID = parseInt(moveID) + 1;
+                    }
+                    if (fid2newfid["" + moveObject.pfid])
+                        moveObject.pfid = fid2newfid["" + moveObject.pfid];
+                    rtn = this.Database.addObject(moveObject, tar_dbtype, aTransaction);
+                    if (rtn) {
+                        var objAddParAbout = null;
+                        if (!objAddParAbout) {
+                            var fid = moveFolder.pfid;
+                            var f_pfid = undefined;
+                            var rtnFolder = this.Database.getFolder({fid: moveObject.pfid}, tar_dbtype);
+                            if (rtnFolder && rtnFolder.length)
+                                f_pfid = rtnFolder[0].pfid;
+                            rtnFolder = undefined;
+                            objAddParAbout = this.DataSource.getID2About(moveObject.pfid, f_pfid, tar_dbtype);
+                        }
+                        var newItem = this.Common.newItem();
+                        newItem.id = moveObject.oid;
+                        newItem.about = this.DataSource.getAbout(moveObject.oid, moveObject.pfid, tar_dbtype);
+                        newItem.pfid = moveObject.pfid;
+                        newItem.type = "item";
+                        newItem.source = this.DataSource.getProperty(objResList[i], "source");
+                        newItem.title = moveObject.oid_title;
+                        newItem.editmode = moveObject.oid_mode;
+                        newItem.uri = moveObject.doc_url;
+                        newItem.dbtype = tar_dbtype;
+                        newItem.icon = this.DataSource.getProperty(objResList[i], "icon");
+                        var tarRelIdx = -1;
+                        try {
+                            var cont = this.DataSource.getContainer(objAddParAbout, false);
+                            tarRelIdx = cont.GetCount();
+                        } catch (ex) {
+                        }
+                        var newRes = this.DataSource.addItem(newItem, objAddParAbout, tarRelIdx, tar_dbtype);
+                    } else {//å€±æããå Žå
+                        if (moveRes)
+                            mcTreeHandler._removeFolder(moveRes);
+                        break;
+                    }
+                }
+            }
+            if (rtn && modShift) {
+                rtn = true;
+                if (rtn) {
+                    //Shiftã­ãŒãæŒãããŠããå Žåãç§»åå
+ã®DBããããŒã¿ãåé€
+                    for (i = objResList.length - 1; i >= 0; i--) {
+                        var tmp_oid = this.DataSource.getProperty(objResList[i], "id");
+                        var tmp_dbtype = this.DataSource.getProperty(objResList[i], "dbtype");
+                        var tmp_pfid = this.DataSource.getProperty(objResList[i], "pfid");
+                        rtn = this.Database.removeObject({oid: tmp_oid, pfid: tmp_pfid}, tmp_dbtype, aTransaction);
+                        if (!rtn)
+                            break;
+                        this.DataSource.deleteItem(objResList[i]);
+                        this.DataSource.setID2About(tmp_oid, tmp_pfid, undefined, tmp_dbtype);
+                    }
+                    if (rtn) {
+                        for (i = fldResList.length - 1; i >= 0; i--) {
+                            var tmp_fid = this.DataSource.getProperty(fldResList[i], "id");
+                            var tmp_dbtype = this.DataSource.getProperty(fldResList[i], "dbtype");
+                            var tmp_pfid = this.DataSource.getProperty(fldResList[i], "pfid");
+                            rtn = this.Database.removeFolder(tmp_fid, tmp_dbtype, aTransaction);
+                            if (!rtn)
+                                break;
+                            this.DataSource.deleteItem(fldResList[i]);
+                            this.DataSource.setID2About(tmp_fid, tmp_pfid, undefined, tmp_dbtype);
+                        }
+                    }
+                }
+            }
+        }
+        if (!aTransaction) {
+            this.Database.endTransaction(tar_dbtype);
+            this.Database.endTransaction(cur_dbtype);
+        }
+        if (tarPar)
+            window.top.bitsMarkingCollection.reOrder(tarPar);
+        this.DataSource.flush();
+        mcTreeCssService.init();
+        mcController.rebuildLocal();
+    },
+    moveObject: function(curRes, curPar, tarPar, tarRelIdx) {
+        var rtn = false;
+        var modShift = this.modShift;
+        var tar_fid = this.DataSource.getProperty(tarPar, "id");
+        var tar_dbtype = this.DataSource.getProperty(tarPar, "dbtype");
+        var moveRes = null;
+        var moveFids = [];
+        var moveID = parseInt(this.DataSource.identify(this.Common.getTimeStamp()));
+        var i;
+        var cur_oid = this.DataSource.getProperty(curRes, "id");
+        var cur_dbtype = this.DataSource.getProperty(curRes, "dbtype");
+        var cur_pfid = this.DataSource.getProperty(curRes, "pfid");
+        var moveObject = this.Database.getObjectWithProperty({oid: cur_oid, pfid: cur_pfid}, cur_dbtype);
+        if (!moveObject || moveObject.length == 0) {
+            this.DataSource.flush();
+            mcTreeCssService.init();
+            mcController.rebuildLocal();
+            return;
+        }
+        var blob = this.Database.getObjectBLOB(cur_oid, cur_dbtype);
+        moveObject = moveObject[0];
+        delete moveObject.dbtype;
+        delete moveObject.fid_style;
+        if (!modShift) {
+            moveObject.oid = "" + moveID;
+            moveID = parseInt(moveID) + 1;
+            moveObject.pfid = this.DataSource.getProperty(tarPar, "id");
+        }
+        if (cur_dbtype == window.top.bitsMarkingCollection._uncategorized.dbtype || tar_dbtype == window.top.bitsMarkingCollection._uncategorized.dbtype) {
+            moveObject.pfid = tar_fid;
+        }
+        rtn = this.Database.addObject(moveObject, tar_dbtype);
+        if (rtn) {
+            if (blob)
+                this.Database.updateObjectBLOB(moveObject.oid, blob[0], tar_dbtype);
+            if (!modShift) {
+                var newItem = this.Common.newItem();
+                newItem.id = moveObject.oid;
+                newItem.about = this.DataSource.getAbout(moveObject.oid, moveObject.pfid, tar_dbtype);
+                newItem.pfid = moveObject.pfid;
+                newItem.type = "item";
+                newItem.source = this.DataSource.getProperty(curRes, "source");
+                newItem.title = moveObject.oid_title;
+                newItem.editmode = moveObject.oid_mode;
+                newItem.uri = moveObject.doc_url;
+                newItem.dbtype = tar_dbtype;
+                newItem.icon = this.DataSource.getProperty(curRes, "icon");
+                var tarRelIdx = -1;
+                try {
+                    var cont = this.DataSource.getContainer(tarPar.Value, false);
+                    tarRelIdx = cont.GetCount();
+                } catch (ex) {
+                }
+                var newRes = this.DataSource.addItem(newItem, tarPar.Value, tarRelIdx, tar_dbtype);
+            }
+        }
+        if (rtn && modShift) {
+            var f_pfid = undefined;
+            var rtnFolder = this.Database.getFolder({fid: cur_pfid}, cur_dbtype);
+            if (rtnFolder && rtnFolder.length)
+                f_pfid = rtnFolder[0].pfid;
+            rtnFolder = undefined;
+            var curPar = this.Common.RDF.GetResource(this.DataSource.getID2About(cur_pfid, f_pfid, cur_dbtype));
+            var contResList = this.DataSource.flattenResources(curPar, 2, false);
+            var i;
+            for (var i = 0; i < contResList.length; i++) {
+                if (contResList[i].Value == curRes.Value)
+                    continue;
+                var oid = this.DataSource.getProperty(contResList[i], "id");
+                if (oid != cur_oid)
+                    continue;
+                curRes = contResList[i];
+                break;
+            }
+            rtn = this.DataSource.moveItem(curRes, curPar, tarPar, tarRelIdx);
+            if (rtn)
+                rtn = this.Database.removeObject({oid: cur_oid, pfid: cur_pfid}, cur_dbtype);
+            if (rtn) {
+                this.DataSource.setProperty(curRes, "dbtype", tar_dbtype);
+                this.DataSource.setProperty(curRes, "pfid", tar_fid);
+                this.DataSource.setProperty(curRes, "id", moveObject.oid);
+                this.DataSource.setID2About(cur_oid, cur_pfid, undefined, cur_dbtype);
+                this.DataSource.setID2About(moveObject.oid, tar_fid, curRes.Value, tar_dbtype);
+            }
+            mcTreeDNDHandler.changeNodeStyle(curRes);
+        }
+        if (tarPar)
+            window.top.bitsMarkingCollection.reOrder(tarPar);
+        this.DataSource.flush();
+        mcTreeCssService.init();
+        mcController.rebuildLocal();
+    },
+    copy: function(aRow, aOrient) {
+        this.row = aRow;
+        this.orient = aOrient;
+        this.rowRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(aRow);
+        (mcTreeHandler.TREE.view.selection.count == 1) ? this.copySingle() : this.copyMultiple();
+    },
+    copySingle: function() {
+        var curIdx = mcTreeHandler.TREE.currentIndex;
+        var curRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+        var curPar = mcTreeHandler.getParentResource(curIdx);
+        var tarRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(this.row);
+        var tarPar = (this.orient == 0) ? tarRes : mcTreeHandler.getParentResource(this.row);
+        this.copyAfterChecking(curRes, curPar, tarRes, tarPar);
+        this.DataSource.flush();
+        mcController.rebuildLocal();
+    },
+    copyMultiple: function() {
+        var idxList = mcTreeHandler.getSelection(false, 2);
+        if (mcTreeHandler.validateMultipleSelection(idxList) == false)
+            return;
+        var i = 0;
+        var curResList = [];
+        var curParList = [];
+        var tarResList = [];
+        var tarParList = [];
+        for (i = 0; i < idxList.length; i++) {
+            curResList.push(mcTreeHandler.TREE.builderView.getResourceAtIndex(idxList[i]));
+            curParList.push(mcTreeHandler.getParentResource(idxList[i]));
+            tarResList.push(mcTreeHandler.TREE.builderView.getResourceAtIndex(this.row));
+            tarParList.push((this.orient == 0) ? tarResList[i] : mcTreeHandler.getParentResource(this.row));
+        }
+        if (this.orient == 1) {
+            for (i = idxList.length - 1; i >= 0; i--) {
+                this.copyAfterChecking(curResList[i], curParList[i], tarResList[i], tarParList[i]);
+            }
+        } else {
+            for (i = 0; i < idxList.length; i++) {
+                this.copyAfterChecking(curResList[i], curParList[i], tarResList[i], tarParList[i]);
+            }
+        }
+        this.DataSource.flush();
+        mcController.rebuildLocal();
+    },
+    copyAfterChecking: function(curRes, curPar, tarRes, tarPar) {
+        var curAbsIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(curRes);
+        var curRelIdx = window.top.bitsObjectMng.DataSource.getRelativeIndex(curPar, curRes);
+        var tarRelIdx = window.top.bitsObjectMng.DataSource.getRelativeIndex(tarPar, tarRes);
+        var tar_dbtype = this.DataSource.getProperty(tarPar, "dbtype");
+        var cur_dbtype = this.DataSource.getProperty(curPar, "dbtype");
+        if (cur_dbtype != tar_dbtype) {
+            if (mcTreeHandler.TREE.view.isContainer(curAbsIdx)) {
+                this.moveFolder(curRes, curPar, tarPar, tarRelIdx);
+            } else {
+                this.moveObject(curRes, curPar, tarPar, tarRelIdx);
+            }
+            return;
+        }
+        if (mcTreeHandler.TREE.view.isContainer(curAbsIdx))
+            return;
+        if (this.orient == 0) {
+            if (curAbsIdx == this.row)
+                return;
+        } else {
+            if (this.orient == 1)
+                tarRelIdx++;
+            if (curPar.Value == tarPar.Value && tarRelIdx > curRelIdx)
+                tarRelIdx--;
+            if (this.orient == 1 &&
+                    mcTreeHandler.TREE.view.isContainer(this.row) &&
+                    mcTreeHandler.TREE.view.isContainerOpen(this.row) &&
+                    mcTreeHandler.TREE.view.isContainerEmpty(this.row) == false) {
+                if (curAbsIdx == this.row)
+                    return;
+                tarPar = tarRes;
+                tarRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(this.row + 1);
+                tarRelIdx = 1;
+            }
+            if (curPar.Value == tarPar.Value && curRelIdx == tarRelIdx)
+                return;
+        }
+        if (mcTreeHandler.TREE.view.isContainer(curAbsIdx)) {
+            var tmpIdx = this.row;
+            var tmpRes = tarRes;
+            while (tmpRes.Value != mcTreeHandler.TREE.ref && tmpIdx != -1) {
+                tmpRes = mcTreeHandler.getParentResource(tmpIdx);
+                tmpIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(tmpRes);
+                if (tmpRes.Value == curRes.Value)
+                    return;
+            }
+        }
+        var rtn = false;
+        var pfid = this.DataSource.getProperty(tarPar, "id");
+        var dbtype = this.DataSource.getProperty(tarPar, "dbtype");
+        var oid = this.DataSource.getProperty(curRes, "id");
+        rtn = this.Database.existsObject({oid: oid, pfid: pfid}, dbtype);
+        if (rtn) {
+            this.Common.alert(mcMainService.STRING.getString("ALERT_COPYOBJECT_EXISTS"));
+            return;
+        }
+        var newDCitem = this.Common.newItem();
+        newDCitem.id = oid;
+        newDCitem.about = this.DataSource.getAbout(oid, pfid, this.DataSource.getProperty(curRes, "dbtype"));
+        newDCitem.pfid = pfid;
+        newDCitem.type = this.DataSource.getProperty(curRes, "type");
+        newDCitem.source = this.DataSource.getProperty(curRes, "source");
+        newDCitem.title = this.DataSource.getProperty(curRes, "title");
+        newDCitem.editmode = this.DataSource.getProperty(curRes, "editmode");
+        newDCitem.uri = this.DataSource.getProperty(curRes, "uri");
+        newDCitem.source = this.DataSource.getProperty(curRes, "source");
+        newDCitem.dbtype = this.DataSource.getProperty(curRes, "dbtype");
+        var pfid_order = 0;
+        if (this.DataSource.isContainer(this.rowRes)) {
+            var tmp_fid = this.DataSource.getProperty(this.rowRes, "id");
+            var rtnFolder = mcTreeDNDHandler.Database.getFolderFormID(tmp_fid, newDCitem.dbtype);
+            if (rtnFolder && rtnFolder.length)
+                pfid_order = rtnFolder[0].pfid_order;
+        } else {
+            var tmp_oid = this.DataSource.getProperty(this.rowRes, "id");
+            var rtnObject = mcTreeDNDHandler.Database.getObject({oid: tmp_oid, pfid: pfid}, newDCitem.dbtype);
+            if (rtnObject && rtnObject.length)
+                pfid_order = rtnObject[0].pfid_order;
+        }
+        if (this.orient >= 0)
+            pfid_order = parseFloat(parseFloat(pfid_order) + parseFloat(this.orient));
+        rtn = mcTreeDNDHandler.Database.addLink({oid: oid, pfid: pfid, pfid_order: pfid_order}, newDCitem.dbtype);
+        if (rtn) {
+            var newRes = this.DataSource.addItem(newDCitem, tarPar.Value, tarRelIdx, newDCitem.dbtype);
+            if (newRes) {
+                this.DataSource.setProperty(newRes, "id", oid); //Treeã«è¿œå åŸãidãå€æŽããã
+                this.DataSource.flush();
+            }
+            var selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(newRes);
+            if (selectIdx >= 0) {
+                mcTreeHandler.TREE.currentIndex = selectIdx;
+                if (!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex))
+                    mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+                mcTreeHandler.TREE.focus();
+                mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(selectIdx);
+                mcPropertyView.dispProperty(mcTreeHandler.object);
+            }
+        } else {
+            mcTreeViewModeService.rebuild();
+        }
+    },
+    capture: function(aXferString, aRow, aOrient) {
+        var aXferStringArr = aXferString.split("\n");
+        var url = aXferStringArr[0];
+        var url_title = aXferStringArr[1];
+        if (!url_title || url == url_title)
+            url_title = "";
+        var basedir = window.top.bitsTreeListService.getBaseDir();
+        var res_uri = this.Common.convertFilePathToURL(basedir.path);
+        if (url.indexOf(res_uri) >= 0)
+            return;
+        if (this.originalTarget && this.originalTarget.nodeName == "IMG" && this.originalTarget.hasAttribute('oid') && this.originalTarget.hasAttribute('dbtype'))
+            return;
+        var win = window.top.bitsObjectMng.Common.getFocusedWindow();
+        var sel = win.getSelection();
+        var isSelected = false;
+        try {
+            isSelected = (sel.anchorNode === sel.focusNode && sel.anchorOffset == sel.focusOffset) ? false : true;
+            if (isSelected && aXferStringArr.length != 1)
+                isSelected = false;
+            if (isSelected && win.document.contentType == "application/pdf")
+                isSelected = false;
+        } catch (ex) {
+        }
+        var isEntire = (url == top.window._content.location.href);
+        var res = (aRow == -1) ? [mcTreeHandler.TREE.ref, 0] : this.getTarget(aRow, aOrient);
+        var newResArr;
+        if (this.modAlt && isEntire) {
+        } else if (isSelected) {
+            newResArr = window.top.bitsMarkingCollection.addSelectedText(res[0], res[1], aRow);
+        } else {
+            if (url.indexOf("http://") == 0 ||
+                    url.indexOf("https://") == 0 ||
+                    url.indexOf("ftp://") == 0 ||
+                    url.indexOf("file://") == 0) {
+                var importFlag = false;
+                var splitFileName = this.Common.splitFileName(url);
+                if (splitFileName[1].toLowerCase() == "xml" || splitFileName[1].toLowerCase() == "zip")
+                    importFlag = mcXmlImportService.loadFile(res[0], res[1], aRow, url);
+                if (!importFlag && !mcXmlImportService.isExportFile) {
+                    if (this.originalTarget) {
+                        //æ¢ã«Targetãèš­å®ãããŠããå Žåãã«ã¬ã³ãã®ãã­ã¥ã¡ã³ãã®ãã®ãããã§ãã¯
+                        if (this.originalTarget.ownerDocument != this.gBrowser.contentDocument) {
+                            var win = this.gBrowser.contentWindow;
+                            if (win.frames != null) {
+                                var i;
+                                for (i = 0; i < win.frames.length; i++) {
+                                    if (this.originalTarget.ownerDocument == win.frames[i].document)
+                                        break;
+                                }
+                                if (i >= win.frames.length)
+                                    this.originalTarget = null;
+                            } else {
+                                this.originalTarget = null;
+                            }
+                        }
+                    }
+                    var tmpOriginalTarget = this.originalTarget;
+                    while (tmpOriginalTarget && (tmpOriginalTarget.nodeName != "A" && tmpOriginalTarget.nodeName != "IMG")) {
+                        tmpOriginalTarget = tmpOriginalTarget.parentNode;
+                    }
+                    if (tmpOriginalTarget)
+                        this.originalTarget = tmpOriginalTarget;
+                    newResArr = window.top.bitsMarkingCollection.addURLText(res[0], res[1], aRow, aXferString, this.originalTarget);
+                }
+            } else {
+                isSelected = false;
+                try {
+                    isSelected = (sel.anchorNode === sel.focusNode && sel.anchorOffset == sel.focusOffset) ? false : true;
+                } catch (ex) {
+                }
+                if (isSelected && win.document.contentType == "application/pdf")
+                    isSelected = false;
+                if (isSelected) {
+                    newResArr = window.top.bitsMarkingCollection.addSelectedText(res[0], res[1], aRow);
+                } else {
+                    setTimeout(function() {
+                        var rtn = window.top.bitsMarkingCollection.addPDFText(res[0], res[1], aRow, aXferString);
+                        if (!rtn)
+                            window.top.bitsMarkingCollection.Common.alert(mcMainService.STRING.getString("ERROR_INVALID_URL") + "\n" + url);
+                    }, 0);
+                }
+            }
+        }
+        return {isSelected: isSelected, resArr: newResArr};
+    },
+    loadHTML: function(aEvent) {
+        var doc = window.top.bitsMarkingCollection.BROWSER.contentDocument;
+        var url = mcTreeDNDHandler.Common.getURLStringFromDocument(doc);
+        var title = doc.title;
+        var icon = "";
+        var links = doc.getElementsByTagName("link");
+        if (links && links.length > 0) {
+            for (var i = 0; i < links.length; i++) {
+                if (links[i].rel.toLowerCase() == "shortcut icon" || links[i].rel.toLowerCase() == "icon") {
+                    icon = links[i].href;
+                    break;
+                }
+            }
+        }
+        if (icon == "" && (url.indexOf("http://") == 0 || url.indexOf("https://") == 0)) {
+            var root = mcTreeDNDHandler.Common.getRootHref(url);
+            root += "/favicon.ico";
+            var xmlhttp = new XMLHttpRequest();
+            if (xmlhttp) {
+                xmlhttp.open("GET", root, false);
+                xmlhttp.send(null);
+                if (xmlhttp.status == 200)
+                    icon = root;
+            }
+        }
+        if (title)
+            mcTreeDNDHandler.DataSource.setProperty(mcTreeDNDHandler._oRes, "title", title);
+        if (icon)
+            mcTreeDNDHandler.DataSource.setProperty(mcTreeDNDHandler._oRes, "icon", icon);
+        if (title || icon) {
+            mcTreeDNDHandler.DataSource.flush();
+            mcTreeHandler.TREE.builder.rebuild();
+            var dbtype = mcTreeDNDHandler.DataSource.getProperty(mcTreeDNDHandler._oRes, "dbtype");
+            var oid_property = "";
+            var obj = mcTreeDNDHandler.Database.getObjectFormID(mcTreeDNDHandler._oID, dbtype);
+            if (obj && obj.length > 0)
+                oid_property = obj[0].oid_property;
+            if (icon)
+                oid_property += "<ICON>" + icon + "</ICON>";
+            mcTreeDNDHandler.Database.updateObject({oid: mcTreeDNDHandler._oID, oid_title: title, oid_property: oid_property}, dbtype);
+        }
+        window.top.bitsMarkingCollection.BROWSER.removeEventListener("load", mcTreeDNDHandler.loadHTML, true);
+        window.top.bitsMarkingCollection.BROWSER.loadURI("about:blank");
+        if (title || icon)
+            mcTreeViewModeService.rebuild();
+    },
+    getIconFromURL: function(aUrl, aRes) {
+        var uri = aUrl;
+        var xmlhttp = null;
+        xmlhttp = new XMLHttpRequest();
+        if (xmlhttp) {
+            xmlhttp.onreadystatechange = function() {
+                if (xmlhttp.readyState == 4) {
+                    if (xmlhttp.status == 200) {
+                        var contentType = xmlhttp.getResponseHeader("Content-Type");
+                        var id = mcTreeDNDHandler.DataSource.getProperty(aRes, "id");
+                        var dbtype = mcTreeDNDHandler.DataSource.getProperty(aRes, "id");
+                        var type = "url";
+                        var ext = "txt";
+                        if (contentType.match(/^image\/(\S+)/)) {
+                            type = "image";
+                            ext = RegExp.$1;
+                        } else if (contentType.match(/^text\/(\S+)/)) {
+                            ext = RegExp.$1;
+                            ext = ext.replace(/[^A-Za-z0-9]+$/mg, "");
+                        }
+                        mcTreeDNDHandler.Database.updateObject({oid: id, oid_txt: ext}, dbtype);
+                        var bytes = [];
+                        var filestream = xmlhttp.responseText;
+                        for (var i = 0; i < filestream.length; i++) {
+                            bytes[i] = filestream.charCodeAt(i) & 0xff;
+                        }
+                        var file = window.top.bitsMarkingCollection.getExtensionDir().clone();
+                        file.append("data");
+                        if (!file.exists())
+                            file.create(file.DIRECTORY_TYPE, 0700);
+                        file.append(id + "." + ext);
+                        if (type == "image") {
+                            if (file.exists())
+                                file.remove(false);
+                            file.create(file.NORMAL_FILE_TYPE, 0666);
+                            var ostream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
+                            ostream.init(file, 2, 0x200, false);
+                            ostream.write(String.fromCharCode.apply(String, bytes), bytes.length);
+                            ostream.close();
+                            mcTreeDNDHandler.DataSource.setProperty(aRes, "icon", mcTreeDNDHandler.Common.convertFilePathToURL(file.path));
+                            mcTreeDNDHandler.DataSource.flush();
+                            mcTreeHandler.TREE.builder.rebuild();
+                            mcTreeDNDHandler.Database.updateObjectBLOB(id, bytes, dbtype);
+                        }
+                    } else {
+                        _dump("mcTreeDNDHandler.getIconFromURL():status=[" + xmlhttp.status + "]");
+                    }
+                }
+            };
+            xmlhttp.open("GET", uri, true);
+            xmlhttp.overrideMimeType('text/plain; charset=x-user-defined');
+            xmlhttp.send(null);
+        }
+    },
+    parseHTML: function(text) {
+        try {
+            var createHTMLDocument = function() {
+                var xsl = (new DOMParser()).parseFromString(
+                        ['<?xml version="1.0"?>',
+                            '<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">',
+                            '<output method="html"/>',
+                            '</stylesheet>'].join("\n"), "text/xml");
+                var xsltp = new XSLTProcessor();
+                xsltp.importStylesheet(xsl);
+                var doc = xsltp.transformToDocument(document.implementation.createDocument("", "", null));
+                return doc;
+            };
+            var doc = createHTMLDocument();
+            var range = doc.createRange();
+            doc.appendChild(doc.createElement("html"));
+            range.selectNodeContents(doc.documentElement);
+            doc.documentElement.appendChild(range.createContextualFragment(text));
+            return doc;
+        } catch (ex) {
+            _dump("mcTreeDNDHandler.parseHTML():" + ex);
+            return null;
+        }
+    },
+    changeNodeStyle: function(pRes) {
+        var id = this.DataSource.getProperty(pRes, "id");
+        var pfid = this.DataSource.getProperty(pRes, "pfid");
+        var dbtype = this.DataSource.getProperty(pRes, "dbtype");
+        var source = this.DataSource.getProperty(pRes, "source");
+        if (!source)
+            source = bitsMarker.id_key + dbtype + id;
+        var parentRes = this.DataSource.findParentResource(pRes);
+        var style = this.DataSource.getProperty(parentRes, "style");
+        this.Common.changeNodeStyleFromID(source, style, pfid, id, dbtype);
+        this.DataSource.setProperty(pRes, "source", bitsMarker.id_key + dbtype + id);
+    },
+    getTarget: function(aRow, aOrient) {
+        var tarRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(aRow);
+        var tarPar = (aOrient == 0) ? tarRes : mcTreeHandler.getParentResource(aRow);
+        var tarRelIdx = window.top.bitsObjectMng.DataSource.getRelativeIndex(tarPar, tarRes);
+        if (aOrient == 1)
+            tarRelIdx++;
+        if (aOrient == 1 &&
+                mcTreeHandler.TREE.view.isContainer(aRow) &&
+                mcTreeHandler.TREE.view.isContainerOpen(aRow) &&
+                mcTreeHandler.TREE.view.isContainerEmpty(aRow) == false) {
+            tarPar = tarRes;
+            tarRelIdx = 1;
+        }
+        return [tarPar.Value, tarRelIdx];
+    },
+};
+
+/////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////
+var mcTreeCssService = {
+    get DataSource() {
+        return window.top.bitsObjectMng.DataSource;
+    },
+    get Common() {
+        return window.top.bitsObjectMng.Common;
+    },
+    get XPath() {
+        return window.top.bitsObjectMng.XPath;
+    },
+    get Database() {
+        return window.top.bitsObjectMng.Database;
+    },
+    get gBrowser() {
+        return window.top.bitsObjectMng.getBrowser();
+    },
+    init: function() {
+        try {
+            if (document.styleSheets.length <= 1)
+                return;
+            mcTreeHandler.TREE.treeBoxObject.clearStyleAndImageCaches();
+            var styleSheet = document.styleSheets[1];
+            for (var i = styleSheet.cssRules.length - 1; i >= 0; i--) {
+                styleSheet.deleteRule(i);
+            }
+            var useid = {};
+            var i;
+            var listRes = this.DataSource.flattenResources(this.Common.RDF.GetResource(this.DataSource.ABOUT_ROOT), 1, true);
+            for (i = 0; i < listRes.length; i++) {
+                if (listRes[i].Value == this.DataSource.ABOUT_ROOT)
+                    continue;
+                var id = this.DataSource.getProperty(listRes[i], "id");
+                var dbtype = this.DataSource.getProperty(listRes[i], "dbtype");
+                var style = this.DataSource.getProperty(listRes[i], "style");
+                var style_id = 'css_' + dbtype + '_' + id;
+                this.DataSource.setProperty(listRes[i], "cssrule", style_id);
+                if (useid[style_id])
+                    continue;
+                useid[style_id] = style;
+                styleSheet.insertRule("treechildren::-moz-tree-cell(" + style_id + "){ " + style + " }", styleSheet.cssRules.length);
+                styleSheet.insertRule("treechildren::-moz-tree-cell-text(" + style_id + "){ " + style + " }", styleSheet.cssRules.length);
+            }
+            listRes = undefined;
+            window.top.bitsContextMenu.rebuildCSS();
+        } catch (ex) {
+            _dump("mcTreeCssService.init():" + ex);
+        }
+    },
+};
+
+/////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////
+var mcTreeMultiDocumentService = {
+    get BUTTON() {
+        return document.getElementById("mcToolbarMultiDocumentButton");
+    },
+    get DataSource() {
+        return window.top.bitsObjectMng.DataSource;
+    },
+    get Common() {
+        return window.top.bitsObjectMng.Common;
+    },
+    get Database() {
+        return window.top.bitsObjectMng.Database;
+    },
+    get gBrowser() {
+        return window.top.bitsObjectMng.getBrowser();
+    },
+    init: function() {
+        var multidocument = nsPreferences.getBoolPref("wiredmarker.multidocument", false);
+        if (this.BUTTON)
+            this.BUTTON.setAttribute("checked", multidocument);
+    },
+    onClick: function(aEvent) {
+        var multidocument = this.BUTTON.getAttribute("checked");
+        if (!multidocument || multidocument == "false") {
+            multidocument = true;
+        } else {
+            multidocument = false;
+        }
+        this.BUTTON.setAttribute("checked", multidocument);
+        nsPreferences.setBoolPref("wiredmarker.multidocument", multidocument);
+        mcPropertyView.dispProperty(mcTreeHandler.object);
+        aEvent.stopPropagation();
+    },
+};
+
+/////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////
+var mcTreeViewModeService = {
+    _select: false,
+    _openlist: [],
+    dbupdateTimer: null,
+    get BUTTON() {
+        return document.getElementById("mcToolbarViewModeButton");
+    },
+    get SINGLE() {
+        return document.getElementById("mcToolbarViewModeItemSingle");
+    },
+    get ALL() {
+        return document.getElementById("mcToolbarViewModeItemAll");
+    },
+    get EACH() {
+        return document.getElementById("mcToolbarViewModeItemEach");
+    },
+    get TITLE() {
+        return window.top.document.getElementById("sidebar-title");
+    },
+    get PROGRESS() {
+        return document.getElementById("mcToolbarProgressmeter");
+    },
+    get DataSource() {
+        return window.top.bitsObjectMng.DataSource;
+    },
+    get Common() {
+        return window.top.bitsObjectMng.Common;
+    },
+    get Database() {
+        return window.top.bitsObjectMng.Database;
+    },
+    get gBrowser() {
+        return window.top.bitsObjectMng.getBrowser();
+    },
+    get viewmode() {
+        var viewmode = "all";
+        if (mcTreeViewModeService.EACH && mcTreeViewModeService.EACH.getAttribute("checked")) {
+            viewmode = "each";
+        } else if (mcTreeViewModeService.SINGLE && mcTreeViewModeService.SINGLE.getAttribute("checked")) {
+            viewmode = "single";
+        } else if (!mcTreeViewModeService.ALL) {
+            viewmode = nsPreferences.copyUnicharPref("wiredmarker.viewmode", "all");
+        }
+        return viewmode;
+    },
+    init: function() {
+        var viewmode = nsPreferences.copyUnicharPref("wiredmarker.viewmode", "all");
+        switch (viewmode) {
+            case "each" :
+                this.EACH.setAttribute("checked", true);
+                break;
+            case "single" :
+                this.SINGLE.setAttribute("checked", true);
+                break;
+            default :
+                this.ALL.setAttribute("checked", true);
+                break;
+        }
+        this.gBrowser.addEventListener("pageshow", this.pageshow, false);
+        this.gBrowser.addEventListener("select", this.select, false);
+        this.gBrowser.addEventListener("click", this.click, false);
+        if (this.dbupdateTimer)
+            clearTimeout(this.dbupdateTimer);
+    },
+    done: function() {
+        this.gBrowser.removeEventListener("pageshow", this.pageshow, false);
+        this.gBrowser.removeEventListener("select", this.select, false);
+        this.gBrowser.removeEventListener("click", this.click, false);
+        var viewmode = this.viewmode;
+        if (viewmode == "each")
+            viewmode = "all";
+        nsPreferences.setUnicharPref("wiredmarker.viewmode", viewmode);
+        if (this.dbupdateTimer)
+            clearTimeout(this.dbupdateTimer);
+    },
+    pageshow: function(aEvent) {
+        try {
+            if (mcTreeViewModeService.gBrowser.contentDocument == aEvent.target) {
+                var pageshow_url = mcTreeViewModeService.Common.getURLStringFromDocument(aEvent.target);
+                if (mcTreeViewModeService._openlist[pageshow_url] == undefined && mcTreeViewModeService.viewmode == "single") {
+                    mcTreeViewModeService.rebuild();
+                }
+            }
+        } catch (e) {
+        }
+    },
+    select: function(aEvent) {
+        try {
+            if (!mcTreeViewModeService)
+                return;
+            if (!mcTreeViewModeService._select) {
+                mcTreeViewModeService._select = true;
+                return;
+            }
+            var url = mcTreeViewModeService.Common.getURLStringFromDocument(mcTreeViewModeService.gBrowser.contentDocument);
+            if (url.indexOf("chrome:") < 0 && url.indexOf("about:") < 0 && mcTreeViewModeService._openlist[url] == undefined) {
+                if (mcTreeViewModeService.viewmode == "single")
+                    mcTreeViewModeService.rebuild();
+            }
+            mcTreeViewModeService._select = false;
+        } catch (ex) {
+        }
+    },
+    dbupdate: function() {
+        if (mcTreeViewModeService.dbupdateTimer)
+            clearTimeout(mcTreeViewModeService.dbupdateTimer);
+        var rtnUpdate = false;
+        if (!rtnUpdate)
+            rtnUpdate = mcTreeViewModeService.Database._updateCheck(mcTreeViewModeService.Database._defaultMode);
+        if (rtnUpdate)
+            mcTreeViewModeService.rebuild();
+        mcTreeViewModeService.dbupdateTimer = setTimeout(mcTreeViewModeService.dbupdate, 1000)
+    },
+    click: function(aEvent) {
+        var parent = aEvent.rangeParent;
+        var offset = aEvent.rangeOffset;
+        try {
+            if (!bitsMarker)
+                return;
+        } catch (ex) {
+            return;
+        }
+        var match_exp = new RegExp("^" + bitsMarker.id_key + "\\D+(\\d+)$", "m");
+        var click_oid = "";
+        while (parent) {
+            if (parent.id && parent.id.match(match_exp)) {
+                var dbtype = parent.getAttribute("dbtype");
+                match_exp = new RegExp("^" + bitsMarker.id_key + dbtype + "(\\d+)$", "m");
+                if (match_exp.test(parent.id)) {
+                    click_oid = RegExp.$1;
+                    break;
+                }
+            }
+            parent = parent.parentNode;
+        }
+        if (!parent || click_oid == "")
+            return;
+        mcTreeViewModeService.selectTreeObject(click_oid, parent.getAttribute("dbtype"), parent.getAttribute("pfid"));
+    },
+    selectTreeObject: function(aOID, aDBTYPE, aPFID) {
+        var click_oid = aOID;
+        var click_dbtype = aDBTYPE;
+        var click_pfid = aPFID;
+        if (mcItemView.isChecked) {
+            var f_pfid = undefined;
+            var rtnFolder = this.Database.getFolder({fid: click_pfid}, click_dbtype);
+            if (rtnFolder && rtnFolder.length)
+                f_pfid = rtnFolder[0].pfid;
+            rtnFolder = undefined;
+            var About = this.DataSource.getID2About(click_pfid, f_pfid, click_dbtype);
+            try {
+                var searchRes = this.Common.RDF.GetResource(About);
+                if (searchRes) {
+                    var resArr = [];
+                    var parentRes = searchRes;
+                    do {
+                        parentRes = this.DataSource.findParentResource(parentRes);
+                        if (parentRes)
+                            resArr.push(parentRes);
+                    } while (parentRes && parentRes.Value != this.DataSource.ABOUT_ROOT);
+                    for (var i = resArr.length - 1; i >= 0; i--) {
+                        var selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(resArr[i]);
+                        if (selectIdx >= 0 && !mcTreeHandler.TREE.view.isContainerOpen(selectIdx))
+                            mcTreeHandler.TREE.view.toggleOpenState(selectIdx);
+                    }
+                    var selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(searchRes);
+                    if (selectIdx >= 0) {
+                        mcTreeHandler.TREE.currentIndex = selectIdx;
+                        if (!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex))
+                            mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+                        mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(selectIdx);
+                        if (bitsTreeDate && bitsTreeDate.isChecked) {
+                            bitsTreeDate.onSelect({
+                                oid: click_oid,
+                                dbtype: click_dbtype
+                            });
+                        } else {
+                            mcItemView.onTreeClick();
+                        }
+                        setTimeout(function() {
+                            mcItemView.setSelection(click_oid, click_dbtype);
+                        }, 0);
+                    }
+                }
+            } catch (e) {
+            }
+        } else {
+            var searchIdx = -1;
+            var searchRes = null;
+            var searchRes1 = null;
+            var listRes2 = this.DataSource.flattenResources(this.Common.RDF.GetResource(this.DataSource.ABOUT_ROOT), 2, true);
+            for (var j = 0; j < listRes2.length; j++) {
+                var id = this.DataSource.getProperty(listRes2[j], "id");
+                if (id == click_oid) {
+                    if (!searchRes1)
+                        searchRes1 = listRes2[j];
+                    searchIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(listRes2[j]);
+                    if ((mcTreeHandler.TREE.currentIndex > -1 && mcTreeHandler.TREE.currentIndex < searchIdx) || searchIdx < 0) {
+                        searchRes = listRes2[j];
+                        break;
+                    }
+                }
+            }
+            if (!searchRes && searchRes1)
+                searchRes = searchRes1;
+            if (searchRes) {
+                var resArr = [];
+                var parentRes = searchRes;
+                do {
+                    parentRes = this.DataSource.findParentResource(parentRes);
+                    if (parentRes)
+                        resArr.push(parentRes);
+                } while (parentRes && parentRes.Value != this.DataSource.ABOUT_ROOT);
+                var i;
+                for (i = resArr.length - 1; i >= 0; i--) {
+                    var selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(resArr[i]);
+                    if (selectIdx >= 0 && !mcTreeHandler.TREE.view.isContainerOpen(selectIdx))
+                        mcTreeHandler.TREE.view.toggleOpenState(selectIdx);
+                }
+                var selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(searchRes);
+                if (selectIdx >= 0) {
+                    mcTreeHandler.TREE.currentIndex = selectIdx;
+                    if (!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex))
+                        mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+                    mcTreeHandler.TREE.focus();
+                    mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(selectIdx);
+                    mcPropertyView.dispProperty(mcTreeHandler.object);
+                }
+            }
+        }
+        var doc = this.gBrowser.contentDocument;
+        var selection = doc.defaultView.getSelection();
+        if (selection) {
+            if (selection.rangeCount) {
+                var range = selection.getRangeAt(0);
+                if (range.startContainer != range.endContainer || range.startOffset != range.endOffset) {
+                    doc.defaultView.focus();
+                }
+            }
+        }
+    },
+    changeTitle: function() {
+        var label = "";
+        var viewmode = mcTreeViewModeService.viewmode;
+        switch (viewmode) {
+            case "each" :
+                label = this.EACH.getAttribute("label");
+                break;
+            case "single" :
+                label = this.SINGLE.getAttribute("label");
+                break;
+            default :
+                label = this.ALL.getAttribute("label");
+                break;
+        }
+        var rootfolder = nsPreferences.copyUnicharPref("wiredmarker.rootfolder", "");
+        var title = "";
+        var foldres;
+        if (rootfolder && rootfolder != "")
+            foldres = this.Database.getFolderFormID(rootfolder);
+        if (foldres)
+            title = foldres[0].fid_title;
+        if (title == "")
+            title = mcMainService.STRING.getString("DEFAULT_FOLDER");
+        var button_title = mcMainService.STRING.getString("APP_DISP_TITLE");
+
+        // DASISH modification
+        // this.TITLE.setAttribute("value",button_title + " [ " + title + " ]");
+        this.TITLE.setAttribute("value", "My Annotations");
+        this.TITLE.setAttribute("style", "font-size: 1.2em; text-align: center; margin: 2pt 28pt 2pt 0;");
+
+        this.BUTTON.setAttribute("label", label + " ");
+    },
+    onClick: function(aEvent) {
+        var viewmode = aEvent.target.value;
+        if (mcTreeViewModeService.dbupdateTimer)
+            clearTimeout(mcTreeViewModeService.dbupdateTimer);
+        if (viewmode == "each")
+            mcTreeHandler.TREE.setAttribute("ref", this.DataSource.ABOUT_ROOT); //æ«å®åŠç
+        this.rebuild();
+        if (viewmode == "each")
+            mcTreeHandler.openAllFolders();
+        aEvent.stopPropagation();
+    },
+    rebuild: function() {
+        try {
+            var currentTreeIndex = mcTreeHandler.TREE.currentIndex;
+            var currentTreeRes = null;
+            if (currentTreeIndex >= 0)
+                currentTreeRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(currentTreeIndex);
+            var firstVisibleRow = mcTreeHandler.TREE.treeBoxObject.getFirstVisibleRow();
+            var lastVisibleRow = mcTreeHandler.TREE.treeBoxObject.getLastVisibleRow();
+            this.changeTitle();
+            var resEnum = this.DataSource.data.GetAllResources();
+            while (resEnum.hasMoreElements()) {
+                var aRes = resEnum.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+                if (aRes.Value != this.DataSource.ABOUT_ROOT)
+                    this.DataSource.removeResource(aRes);
+            }
+            var dsEnum = mcTreeHandler.TREE.database.GetDataSources();
+            while (dsEnum.hasMoreElements()) {
+                var ds = dsEnum.getNext().QueryInterface(Components.interfaces.nsIRDFDataSource);
+                mcTreeHandler.TREE.database.RemoveDataSource(ds);
+            }
+            mcTreeHandler.TREE.treeBoxObject.clearStyleAndImageCaches();
+            mcTreeHandler.TREE.builder.rebuild();
+            if (mcTreeViewModeService.viewmode == "each") {
+                window.top.bitsMarkingCollection.rebuildRdf(mcTreeViewModeService.rebuildCallback);
+            } else {
+                try {
+                    window.top.bitsMarkingCollection.rebuildRdf();
+                } catch (ex) {
+                    _dump("mcTreeViewModeService.rebuild(1):" + ex);
+                }
+                this.DataSource.refresh();
+                mcTreeCssService.init();
+                mcTreeHandler.TREE.database.AddDataSource(this.DataSource.data);
+                mcTreeHandler.TREE.builder.rebuild();
+                mcTreeRootFolder.rebuild();
+                if (currentTreeIndex < 0)
+                    currentTreeIndex = 0;
+                try {
+                    var selectRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(currentTreeIndex);
+                } catch (ex2) {
+                    selectRes = null;
+                }
+                if (!selectRes)
+                    currentTreeIndex = 0;
+                if (firstVisibleRow <= currentTreeIndex && currentTreeIndex <= lastVisibleRow && currentTreeRes) {
+                    var idx = mcTreeHandler.TREE.builderView.getIndexOfResource(currentTreeRes);
+                    if (idx >= 0)
+                        mcTreeHandler.TREE.currentIndex = idx;
+                }
+                if (!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex))
+                    mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+                mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(currentTreeIndex);
+                if (firstVisibleRow >= 0)
+                    mcTreeHandler.TREE.treeBoxObject.scrollToRow(firstVisibleRow);
+                mcPropertyView.dispProperty(mcTreeHandler.object);
+                this.showShortcutKey();
+                setTimeout(function() {
+                    mcTreeRdfRebuildItem.init();
+                }, 0);
+                return;
+            }
+        } catch (ex) {
+            _dump("mcTreeViewModeService.rebuild():" + ex);
+        }
+    },
+    showShortcutKey: function() {
+        var elem = document.getElementById("mcTreeColShortcut");
+        var show_shortcut = nsPreferences.getBoolPref("wiredmarker.shortcut.tree_disp", true);
+        if (show_shortcut) {
+            if (elem)
+                elem.removeAttribute("hidden");
+            var resAllFolder = this.DataSource.flattenResources(this.Common.RDF.GetResource(this.DataSource.ABOUT_ROOT), 1, true);
+            var rcnt;
+            for (rcnt = 0; rcnt < resAllFolder.length; rcnt++) {
+                var fRes = resAllFolder[rcnt];
+                if (fRes.Value == this.DataSource.ABOUT_ROOT)
+                    continue;
+                var fid = this.DataSource.getProperty(fRes, "id");
+                var dbtype = this.DataSource.getProperty(fRes, "dbtype");
+                var type = this.DataSource.getProperty(fRes, "type");
+                if (!fid || !dbtype || type == "localfolder")
+                    continue;
+                var acceltext = window.top.bitsShortcutService.getAcceltext(fid, dbtype);
+                if (!acceltext)
+                    acceltext = "";
+                this.DataSource.setProperty(fRes, "shortcut", acceltext);
+            }
+            this.DataSource.flush();
+        } else {
+            if (elem)
+                elem.setAttribute("hidden", "true");
+        }
+    },
+    rebuildCallback: function(aStatus) {
+        switch (aStatus.status) {
+            case 0:
+                mcTreeViewModeService.PROGRESS.setAttribute("value", "0%");
+                mcTreeViewModeService.PROGRESS.removeAttribute("hidden");
+                break;
+            case 1:
+            case 2:
+            case 3:
+                mcTreeViewModeService.PROGRESS.removeAttribute("hidden");
+                mcTreeViewModeService.PROGRESS.setAttribute("value", aStatus.value + "%");
+                break;
+            case 4:
+                var dsEnum = mcTreeHandler.TREE.database.GetDataSources();
+                while (dsEnum.hasMoreElements()) {
+                    var ds = dsEnum.getNext().QueryInterface(Components.interfaces.nsIRDFDataSource);
+                    mcTreeHandler.TREE.database.RemoveDataSource(ds);
+                }
+                mcTreeViewModeService.DataSource.refresh();
+                mcTreeHandler.TREE.database.AddDataSource(mcTreeViewModeService.DataSource.data);
+                mcTreeCssService.init();
+                mcTreeHandler.TREE.builder.rebuild();
+                mcTreeRootFolder.rebuild();
+                mcPropertyView.dispProperty(mcTreeHandler.object);
+                mcTreeHandler.openAllFolders();
+                mcTreeViewModeService.PROGRESS.setAttribute("hidden", "true");
+                break;
+            default:
+                break;
+        }
+    },
+};
+
+/////////////////////////////////////////////////////////////////////
+var mcTreeImageTooltip = {
+    get tooltipRow() {
+        return window.top.bitsImageTooltip.tooltipRow;
+    },
+    init: function() {
+        window.top.bitsImageTooltip.init();
+    },
+    done: function() {
+        window.top.bitsImageTooltip.done();
+    },
+    onMousedown: function(aEvent) {
+        window.top.bitsImageTooltip.onMousedown(aEvent);
+    },
+    onMouseout: function(aEvent) {
+        window.top.bitsImageTooltip.onMouseout(aEvent);
+    },
+    hidePopup: function() {
+        window.top.bitsImageTooltip.hidePopup();
+    },
+    onMousemove: function(aEvent, aParam) {
+        window.top.bitsImageTooltip.onMousemove(aEvent, aParam);
+    },
+};
+
+/////////////////////////////////////////////////////////////////////
+var mcTreeRdfRebuildItem = {
+    _init: false,
+    timerid: null,
+    rdfdoc: null,
+    nsResolver: null,
+    xmlNode: null,
+    progressWindow: null,
+    folderFilterHash: {},
+    resOpenFolder: [],
+    resLoadFolder: [],
+    resAllFolder: [],
+    itemObjects: [],
+    viewmode: "",
+    get DataSource() {
+        return window.top.bitsObjectMng.DataSource;
+    },
+    get Common() {
+        return window.top.bitsObjectMng.Common;
+    },
+    get Database() {
+        return window.top.bitsObjectMng.Database;
+    },
+    get gBrowser() {
+        return window.top.bitsObjectMng.getBrowser();
+    },
+    get uriRDF() {
+        return "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+    },
+    get uriNS1() {
+        return "http://www.bits.cc/Wired-Marker/wiredmarker-rdf#";
+    },
+    init: function() {
+        try {
+            this.unsetTreeEvent();
+            if (mcItemView.isChecked) {
+                this.setTreeEvent();
+                if (bitsTreeDate.isChecked) {
+                    bitsTreeDate.onSelectTab();
+                } else {
+                    mcItemView.onTreeClick();
+                }
+                return;
+                ;
+            }
+            this._init = true;
+            if (this.timerid)
+                clearTimeout(this.timerid);
+            this.timerid = null;
+            this.viewmode = mcTreeViewModeService.viewmode;
+            this.doc_url = this.Common.getURLStringFromDocument(this.gBrowser.contentDocument);
+            if (this.progressWindow && !this.progressWindow.closed)
+                this.progressWindow.close();
+            this.progressWindow = null;
+            if (!this.progressWindow) {
+                var x = screen.width;
+                var y = screen.height;
+            }
+            var i;
+            this.rdfdoc = null;
+            this.nsResolver = null;
+            this.xmlNode = null;
+            var aRdfFile = this.DataSource.file.clone();
+            var rdf = this.Common.convertToUnicode(this.Common.readFile(aRdfFile), "UTF-8");
+            if (rdf && rdf != "") {
+                var parser = new DOMParser();
+                this.rdfdoc = parser.parseFromString(rdf, "text/xml");
+                parser = undefined;
+                if (this.rdfdoc)
+                    this.nsResolver = this.rdfdoc.createNSResolver(this.rdfdoc.ownerDocument == null ? this.rdfdoc.documentElement : this.rdfdoc.ownerDocument.documentElement);
+                rdf = undefined;
+            }
+            this.resOpenFolder.length = 0;
+            this.resLoadFolder = [];
+            this.resAllFolder.length = 0;
+            this.itemObjects.length = 0;
+            if (mcTreeHandler.TREE.view) {
+                for (i = 0; i < mcTreeHandler.TREE.view.rowCount; i++) {
+                    if (mcTreeHandler.TREE.view.isContainer(i) && mcTreeHandler.TREE.view.isContainerOpen(i)) {
+                        var res = mcTreeHandler.TREE.builderView.getResourceAtIndex(i);
+                        this.resOpenFolder.push(res);
+                    }
+                }
+            }
+            this.resAllFolder = this.DataSource.flattenResources(this.Common.RDF.GetResource(this.DataSource.ABOUT_ROOT), 1, true);
+            this.timerid = setTimeout(function() {
+                mcTreeRdfRebuildItem.exec();
+            }, 0);
+            this.folderFilterHash = {};
+            var tmpFolderFilter = nsPreferences.copyUnicharPref("wiredmarker.filter.folder", "");
+            var tmpFolderFilterArr = tmpFolderFilter.split("\t");
+            var i;
+            for (i = 0; i < tmpFolderFilterArr.length; i++) {
+                if (!tmpFolderFilterArr[i].match(/^(\d+):(\d+):(.+)$/))
+                    continue;
+                var filter_fid = RegExp.$1;
+                var filter_casesensitive = RegExp.$2;
+                var filter_keyword = RegExp.$3;
+                this.folderFilterHash[filter_fid] = new RegExp(filter_keyword, (filter_casesensitive == 1) ? "mg" : "img");
+            }
+            tmpFolderFilterArr = undefined;
+            tmpFolderFilter = undefined;
+            if (this.progressWindow && !this.progressWindow.closed) {
+                if (this.resOpenFolder.length > 0 || this.resAllFolder.length > 0) {
+                    if (this.progressWindow.setStatus)
+                        this.progressWindow.setStatus(mcMainService.STRING.getString("MSG_LOADING_SCRAP") + "... [ " + (this.resOpenFolder.length + this.resAllFolder.length) + " ]");
+                } else {
+                    if (this.progressWindow && !this.progressWindow.closed)
+                        this.progressWindow.close();
+                    this.progressWindow = null;
+                }
+            }
+        } catch (e) {
+            _dump("mcTreeRdfRebuildItem.init():" + e);
+        }
+    },
+    exec: function() {
+        try {
+            var fRes = null;
+            if (this.resOpenFolder.length > 0) {
+                fRes = this.resOpenFolder.shift();
+            } else if (this.resAllFolder.length > 0) {
+                fRes = this.resAllFolder.shift();
+            }
+            if (this.progressWindow && !this.progressWindow.closed) {
+                if (fRes) {
+                    var title = this.DataSource.getProperty(fRes, "title");
+                    if (this.progressWindow.setStatus)
+                        this.progressWindow.setStatus(mcMainService.STRING.getString("MSG_LOADING_SCRAP") + "... [ " + (this.resOpenFolder.length + this.resAllFolder.length + 1) + " ]");
+                }
+            }
+            if (!fRes) {
+                this.done();
+                return;
+            }
+            if (this.itemObjects)
+                this.itemObjects.length = 0;
+            this.itemObjects = [];
+            if (this.resLoadFolder[fRes.Value] == undefined) {
+                var j;
+                var fid = this.DataSource.getProperty(fRes, "id");
+                var dbtype = this.DataSource.getProperty(fRes, "dbtype");
+                if (fid && dbtype) {
+                    if (this.viewmode == "all") {
+                        this.itemObjects = this.Database.getObjectFormPID(fid, dbtype);
+                    } else {
+                        this.itemObjects = this.Database.getObject({pfid: fid, doc_url: this.doc_url}, dbtype);
+                    }
+                }
+                if (this.itemObjects && this.itemObjects.length > 0 && this.folderFilterHash[fid]) {
+                    var newObj = [];
+                    for (j = 0; j < this.itemObjects.length; j++) {
+                        var obj = this.itemObjects[j];
+                        if (this.folderFilterHash[obj.pfid] && !obj.oid_title.match(this.folderFilterHash[obj.pfid]))
+                            continue;
+                        newObj.push(obj);
+                    }
+                    this.itemObjects = newObj;
+                }
+                if (this.itemObjects && this.itemObjects.length > 0) {
+                    this.xmlNode = null;
+                    if (this.rdfdoc && this.nsResolver) {
+                        var xPathXML = this.rdfdoc.evaluate('//RDF:Seq[@RDF:about="' + fRes.Value + '"]', this.rdfdoc, this.nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
+                        if (xPathXML && xPathXML.singleNodeValue)
+                            this.xmlNode = xPathXML.singleNodeValue;
+                    }
+                    if (this.xmlNode) {
+                        this.timerid = setTimeout(function() {
+                            mcTreeRdfRebuildItem.execItem(fRes);
+                        }, 0);
+                        return;
+                    }
+                } else {
+                    if (!this.itemObjects)
+                        this.itemObjects = [];
+                }
+                this.resLoadFolder[fRes.Value] = "";
+            }
+            this.timerid = setTimeout(function() {
+                mcTreeRdfRebuildItem.exec();
+            }, 0);
+        } catch (e) {
+            _dump("mcTreeRdfRebuildItem.exec():" + e);
+        }
+    },
+    execItem: function(fRes) {
+        try {
+            if (!this.itemObjects || this.itemObjects.length == 0) {
+                if (this.DataSource.file.exists()) {
+                    var s = new XMLSerializer();
+                    var rdfstr = s.serializeToString(this.rdfdoc);
+                    this.Common.writeFile(this.DataSource.file.clone(), rdfstr + "\n", "UTF-8");
+                    this.DataSource.refresh();
+                } else {
+                    this.done();
+                    return;
+                }
+                this.resLoadFolder[fRes.Value] = "";
+                this.timerid = setTimeout(function() {
+                    mcTreeRdfRebuildItem.exec();
+                }, 0);
+                return;
+            }
+            var EXECNUM = 10;
+            var i;
+            for (i = 0; i < EXECNUM && this.itemObjects.length > 0; i++) {
+                var item = this.Database.makeObjectToItem(this.itemObjects.shift());
+                var itemKey;
+                var xmlItem = this.rdfdoc.createElementNS(this.uriRDF, "RDF:Description");
+                for (itemKey in item) {
+                    if (itemKey == "about") {
+                        xmlItem.setAttributeNS(this.uriRDF, "RDF:" + itemKey, item[itemKey]);
+                    } else if (itemKey == "list") {
+                        continue;
+                    } else {
+                        xmlItem.setAttributeNS(this.uriNS1, "NS1:" + itemKey, item[itemKey]);
+                    }
+                }
+                this.xmlNode.appendChild(this.rdfdoc.createTextNode("  "));
+                var xmlList = this.rdfdoc.createElementNS(this.uriRDF, "RDF:li");
+                xmlList.setAttributeNS(this.uriRDF, "RDF:resource", item.about);
+                this.xmlNode.appendChild(xmlList);
+                this.xmlNode.appendChild(this.rdfdoc.createTextNode("\n  "));
+                this.rdfdoc.documentElement.appendChild(this.rdfdoc.createTextNode("  "));
+                this.rdfdoc.documentElement.appendChild(xmlItem);
+                this.rdfdoc.documentElement.appendChild(this.rdfdoc.createTextNode("\n"));
+            }
+            this.timerid = setTimeout(function() {
+                mcTreeRdfRebuildItem.execItem(fRes);
+            }, 0);
+        } catch (e) {
+            _dump("mcTreeRdfRebuildItem.execItem():" + e);
+        }
+    },
+    done: function() {
+        try {
+            if (this.DataSource.file.exists()) {
+                var box = mcTreeHandler.TREE.boxObject;
+                box.QueryInterface(Components.interfaces.nsITreeBoxObject);
+                var fvRow = box.getFirstVisibleRow();
+                try {
+                    var fvRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(fvRow);
+                    var resEnum = this.DataSource.data.GetAllResources();
+                    while (resEnum.hasMoreElements()) {
+                        var aRes = resEnum.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+                        if (aRes.Value != this.DataSource.ABOUT_ROOT)
+                            this.DataSource.removeResource(aRes);
+                    }
+                    var dsEnum = mcTreeHandler.TREE.database.GetDataSources();
+                    while (dsEnum.hasMoreElements()) {
+                        var ds = dsEnum.getNext().QueryInterface(Components.interfaces.nsIRDFDataSource);
+                        mcTreeHandler.TREE.database.RemoveDataSource(ds);
+                    }
+                    mcTreeHandler.TREE.treeBoxObject.clearStyleAndImageCaches();
+                    mcTreeHandler.TREE.builder.rebuild();
+                    var s = new XMLSerializer();
+                    var rdfstr = s.serializeToString(this.rdfdoc);
+                    this.Common.writeFile(this.DataSource.file.clone(), rdfstr + "\n", "UTF-8");
+                    this.DataSource.refresh();
+                    mcTreeCssService.init();
+                    mcTreeHandler.TREE.database.AddDataSource(this.DataSource.data);
+                    mcTreeHandler.TREE.builder.rebuild();
+                    mcTreeRootFolder.rebuild();
+                    fvRow = mcTreeHandler.TREE.builderView.getIndexOfResource(this.Common.RDF.GetResource(fvRes.Value));
+                    box.scrollToRow(fvRow);
+                } catch (e) {
+                }
+                this.setTreeEvent();
+            }
+        } catch (ex) {
+            _dump("mcTreeRdfRebuildItem.done():" + ex);
+        }
+        if (this.progressWindow && !this.progressWindow.closed)
+            this.progressWindow.close();
+        this.progressWindow = null;
+        if (this.timerid)
+            clearTimeout(this.timerid);
+        this.timerid = null;
+        this.rdfdoc = null;
+        this.nsResolver = null;
+        this.xmlNode = null;
+        this.resOpenFolder.length = 0;
+        this.resLoadFolder = [];
+        this.resAllFolder.length = 0;
+        this.itemObjects.length = 0;
+    },
+    setTreeEvent: function() {
+        mcTreeHandler.TREE.onmousedown = function(e) {
+            mcTreeHandler.onMousedown(e);
+        }
+        mcTreeHandler.TREE.onmouseup = function(e) {
+            mcTreeHandler.onMouseup(e);
+        }
+        mcTreeHandler.TREE.onmousemove = function(e) {
+            mcTreeHandler.onMousemove(e);
+        }
+        mcTreeHandler.TREE.onmouseout = function(e) {
+            mcTreeHandler.onMouseout(e);
+        }
+        mcTreeHandler.TREE.ondblclick = function(e) {
+            mcTreeHandler.onDblClick(e);
+        }
+        mcTreeHandler.TREE.onkeydown = function(e) {
+            mcTreeHandler.onKeyDown(e);
+        }
+        mcTreeHandler.TREE.onkeyup = function(e) {
+            mcTreeHandler.onKeyUp(e);
+        }
+        mcTreeHandler.TREE.onkeypress = function(e) {
+            mcTreeHandler.onKeyPress(e);
+        }
+        mcTreeHandler.TREE.onclick = function(e) {
+            mcTreeRdfRebuildItem.onclick(e);
+        }
+        var info = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
+        var app_version = parseFloat(info.version);
+        if (app_version < 3.1) {
+            mcTreeHandler.TREE.addEventListener("draggesture", mcTreeRdfRebuildItem.onOldDraggesture, false);
+            mcTreeHandler.TREE.addEventListener("dragover", mcTreeRdfRebuildItem.onOldDragover, false);
+            mcTreeHandler.TREE.addEventListener("dragdrop", mcTreeRdfRebuildItem.onOldDragdrop, false);
+            mcTreeHandler.TREE.addEventListener("dragexit", mcTreeRdfRebuildItem.onOldDragexit, false);
+        } else {
+            mcTreeHandler.TREE.addEventListener("dragstart", mcTreeRdfRebuildItem.onDragEvents, false);
+            mcTreeHandler.TREE.addEventListener("drag", mcTreeRdfRebuildItem.onDragEvents, false);
+            mcTreeHandler.TREE.addEventListener("dragend", mcTreeRdfRebuildItem.onDragEvents, false);
+            mcTreeHandler.TREE.addEventListener("dragenter", mcTreeRdfRebuildItem.onDropEvents, false);
+            mcTreeHandler.TREE.addEventListener("dragover", mcTreeRdfRebuildItem.onDropEvents, false);
+            mcTreeHandler.TREE.addEventListener("dragleave", mcTreeRdfRebuildItem.onDropEvents, false);
+            mcTreeHandler.TREE.addEventListener("drop", mcTreeRdfRebuildItem.onDropEvents, false);
+        }
+    },
+    unsetTreeEvent: function() {
+        mcTreeHandler.TREE.onmousedown = null;
+        mcTreeHandler.TREE.onmouseup = null;
+        mcTreeHandler.TREE.onmousemove = null;
+        mcTreeHandler.TREE.onmouseout = null;
+        mcTreeHandler.TREE.ondblclick = null;
+        mcTreeHandler.TREE.onkeydown = null;
+        mcTreeHandler.TREE.onkeyup = null;
+        mcTreeHandler.TREE.onkeypress = null;
+        mcTreeHandler.TREE.onclick = null;
+        var info = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
+        var app_version = parseFloat(info.version);
+        if (app_version < 3.1) {
+            mcTreeHandler.TREE.removeEventListener("draggesture", mcTreeRdfRebuildItem.onOldDraggesture, false);
+            mcTreeHandler.TREE.removeEventListener("dragover", mcTreeRdfRebuildItem.onOldDragover, false);
+            mcTreeHandler.TREE.removeEventListener("dragdrop", mcTreeRdfRebuildItem.onOldDragdrop, false);
+            mcTreeHandler.TREE.removeEventListener("dragexit", mcTreeRdfRebuildItem.onOldDragexit, false);
+        } else {
+            mcTreeHandler.TREE.removeEventListener("dragstart", mcTreeRdfRebuildItem.onDragEvents, false);
+            mcTreeHandler.TREE.removeEventListener("drag", mcTreeRdfRebuildItem.onDragEvents, false);
+            mcTreeHandler.TREE.removeEventListener("dragend", mcTreeRdfRebuildItem.onDragEvents, false);
+            mcTreeHandler.TREE.removeEventListener("dragenter", mcTreeRdfRebuildItem.onDropEvents, false);
+            mcTreeHandler.TREE.removeEventListener("dragover", mcTreeRdfRebuildItem.onDropEvents, false);
+            mcTreeHandler.TREE.removeEventListener("dragleave", mcTreeRdfRebuildItem.onDropEvents, false);
+            mcTreeHandler.TREE.removeEventListener("drop", mcTreeRdfRebuildItem.onDropEvents, false);
+        }
+    },
+    onclick: function(e) {
+        mcTreeHandler.onClick(e, 2);
+    },
+/////////////////////////////////////////////////////////////////////
+// Drag & Drop Old Callback functions
+/////////////////////////////////////////////////////////////////////
+    onOldDraggesture: function(e) {
+        mcTreeDNDHandler.getModifiers(e);
+        nsDragAndDrop.startDrag(e, mcTreeDNDHandler.dragDropObserver);
+        e.stopPropagation();
+    },
+    onOldDragover: function(e) {
+        nsDragAndDrop.dragOver(e, mcTreeDNDHandler.dragDropObserver);
+        e.stopPropagation();
+    },
+    onOldDragdrop: function(e) {
+        mcTreeDNDHandler.setDataTransfer(e);
+        nsDragAndDrop.drop(e, mcTreeDNDHandler.dragDropObserver);
+        e.stopPropagation();
+    },
+    onOldDragexit: function(e) {
+        nsDragAndDrop.dragExit(e, mcTreeDNDHandler.dragDropObserver);
+        e.stopPropagation();
+    },
+/////////////////////////////////////////////////////////////////////
+// Drag & Drop New Callback functions
+/////////////////////////////////////////////////////////////////////
+    onDragEvents: function(aEvent) {
+        switch (aEvent.type) {
+            case "dragstart":
+                mcTreeRdfRebuildItem.onDragStart(aEvent);
+                break;
+            case "drag":
+                break;
+            case "dragend":
+                break;
+        }
+    },
+    onDragStart: function(aEvent) {
+        try {
+            mcTreeImageTooltip.hidePopup()
+        } catch (ex) {
+        }
+        try {
+            if (aEvent.originalTarget.localName != "treechildren")
+                return;
+            mcTreeDNDHandler.getModifiers(aEvent);
+            var curIdx = mcTreeHandler.TREE.currentIndex;
+            var res = mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+            var curPar = mcTreeHandler.getParentResource(curIdx);
+            var p_source = window.top.bitsObjectMng.DataSource.getProperty(curPar, "source");
+            var transferData = aEvent.dataTransfer;
+            transferData.setData("moz/rdfitem", res.Value);
+        } catch (ex) {
+            _dump("mcTreeRdfRebuildItem.onDragStart():" + ex);
+        }
+    },
+    onDropEvents: function(aEvent) {
+        switch (aEvent.type) {
+            case "dragenter":
+            case "dragover":
+                aEvent.preventDefault();
+                break;
+            case "drop":
+                mcTreeDNDHandler.setDataTransfer(aEvent);
+                aEvent.preventDefault();
+                break;
+        }
+    },
+};
+
+/////////////////////////////////////////////////////////////////////
+var mcItemView = {
+    get _bitsItemView() {
+        return bitsItemView;
+    },
+    get _bitsItemViewToolbar() {
+        return document.getElementById("bitsItemViewToolbar");
+    },
+    get modAlt() {
+        return this._bitsItemView.modAlt;
+    },
+    get modShift() {
+        return this._bitsItemView.modShift;
+    },
+    get modCtrl() {
+        return this._bitsItemView.modCtrl;
+    },
+    get modMeta() {
+        return this._bitsItemView.modMeta;
+    },
+    get isChecked() {
+        return this._bitsItemView.isChecked;
+    },
+    get object() {
+        return this._bitsItemView.object;
+    },
+    get TREE() {
+        return this._bitsItemView.TREE;
+    },
+    get POPUP() {
+        return document.getElementById("mcPopupFolder");
+    },
+    get CONTEXTMENU() {
+        return document.getElementById("mcPopupFolderItemViewMenu");
+    },
+    get FAVICON_POPUP() {
+        return document.getElementById("mcPopupFolderItemViewFaviconMenupopup");
+    },
+    get ITEM_POPUP() {
+        return document.getElementById("mcPopupFolderItemViewItemMenupopup");
+    },
+    get idMENUITEM() {
+        return "mcPopupFolderItem_";
+    },
+    init: function(aEvent) {
+        this._bitsItemView.init(aEvent);
+        if (this._bitsItemView.isChecked) {
+            this.CONTEXTMENU.removeAttribute("hidden");
+            if (this._bitsItemViewToolbar && mcTreeViewModeService.BUTTON)
+                this._bitsItemViewToolbar.appendChild(mcTreeViewModeService.BUTTON);
+            this.initMenu(aEvent);
+            var contextmenu_mode = nsPreferences.copyUnicharPref("wiredmarker.contextmenu.mode");
+            if (contextmenu_mode != "legacy") {
+                this.POPUP.addEventListener("popupshowing", this.popupMenu, false);
+                this.FAVICON_POPUP.addEventListener("command", this.commandMenuFavicon, false);
+                this.ITEM_POPUP.addEventListener("command", this.commandMenuItem, false);
+            }
+        } else {
+            this.CONTEXTMENU.setAttribute("hidden", "true");
+        }
+    },
+    initMenu: function(aEvent) {
+        var contextmenu_mode = nsPreferences.copyUnicharPref("wiredmarker.contextmenu.mode");
+        if (contextmenu_mode == "legacy") {
+            if (this._bitsItemView.VTTB)
+                this._bitsItemView.VTTB.removeAttribute("hidden");
+        } else {
+            if (this._bitsItemView.VTTB)
+                this._bitsItemView.VTTB.setAttribute("hidden", "true");
+            if (this._bitsItemView.VTTB && this.FAVICON_POPUP && !this.FAVICON_POPUP.hasChildNodes()) {
+                var menuitems = this._bitsItemView.VTTB.getElementsByTagName("menuitem");
+                for (var i = 0; i < menuitems.length; i++) {
+                    var menuitem = document.createElement("menuitem");
+                    menuitem.setAttribute("type", "radio");
+                    menuitem.setAttribute("label", menuitems[i].getAttribute("label"));
+                    menuitem.setAttribute("id", this.idMENUITEM + menuitems[i].id);
+                    menuitem.setAttribute("target_id", menuitems[i].id);
+                    this.FAVICON_POPUP.appendChild(menuitem);
+                }
+            }
+            if (this._bitsItemView.TREE && this.ITEM_POPUP && !this.ITEM_POPUP.hasChildNodes()) {
+                var treecols = this._bitsItemView.TREE.getElementsByTagName("treecol");
+                for (var i = 0; i < treecols.length; i++) {
+                    if (treecols[i].hasAttribute("ignoreincolumnpicker") && treecols[i].getAttribute("ignoreincolumnpicker") == "true")
+                        continue;
+                    var menuitem = document.createElement("menuitem");
+                    menuitem.setAttribute("type", "checkbox");
+                    menuitem.setAttribute("label", treecols[i].getAttribute("label"));
+                    menuitem.setAttribute("id", this.idMENUITEM + treecols[i].id);
+                    menuitem.setAttribute("target_id", treecols[i].id);
+                    this.ITEM_POPUP.appendChild(menuitem);
+                }
+            }
+        }
+    },
+    getElementById: function(id) {
+        return document.getElementById(this.idMENUITEM + id);
+    },
+    popupMenu: function(aEvent) {
+        mcItemView._popupMenu(aEvent);
+    },
+    _popupMenu: function(aEvent) {
+        if (this._bitsItemView.VTTB && this.FAVICON_POPUP && this.FAVICON_POPUP.hasChildNodes()) {
+            var menuitems = this._bitsItemView.VTTB.getElementsByTagName("menuitem");
+            for (var i = 0; i < menuitems.length; i++) {
+                if (!menuitems[i].hasAttribute("checked") || menuitems[i].getAttribute("checked") == "false")
+                    continue;
+                try {
+                    this.getElementById(menuitems[i].id).setAttribute("checked", "true");
+                } catch (e) {
+                }
+                break;
+            }
+        }
+        if (this._bitsItemView.TREE && this.ITEM_POPUP && this.ITEM_POPUP.hasChildNodes()) {
+            var treecols = this._bitsItemView.TREE.getElementsByTagName("treecol");
+            for (var i = 0; i < treecols.length; i++) {
+                try {
+                    if (treecols[i].hasAttribute("hidden") && treecols[i].getAttribute("hidden") == "true") {
+                        this.getElementById(treecols[i].id).removeAttribute("checked");
+                    } else {
+                        this.getElementById(treecols[i].id).setAttribute("checked", "true");
+                    }
+                } catch (e) {
+                }
+            }
+        }
+    },
+    commandMenuFavicon: function(aEvent) {
+        mcItemView._commandMenuFavicon(aEvent);
+    },
+    _commandMenuFavicon: function(aEvent) {
+        if (!aEvent.target.id.match(new RegExp("^" + this.idMENUITEM + "(.+$)")))
+            return;
+        var id = aEvent.target.getAttribute("target_id");
+        var menuitem = this._bitsItemView.VTTB.ownerDocument.getElementById(id);
+        if (menuitem) {
+            menuitem.setAttribute("checked", "true");
+            this._bitsItemView.onViewTypePopupCommand({target: menuitem});
+        }
+    },
+    commandMenuItem: function(aEvent) {
+        mcItemView._commandMenuItem(aEvent);
+    },
+    _commandMenuItem: function(aEvent) {
+        if (!aEvent.target.id.match(new RegExp("^" + this.idMENUITEM + "(.+$)")))
+            return;
+        var id = aEvent.target.getAttribute("target_id");
+        var treecol = this._bitsItemView.TREE.ownerDocument.getElementById(id);
+        if (treecol) {
+            if (aEvent.target.hasAttribute("checked")) {
+                treecol.removeAttribute("hidden");
+            } else {
+                treecol.setAttribute("hidden", "true");
+            }
+        }
+    },
+    done: function(aEvent) {
+        this._bitsItemView.done(aEvent);
+        if (this._bitsItemView.isChecked) {
+            var contextmenu_mode = nsPreferences.copyUnicharPref("wiredmarker.contextmenu.mode");
+            if (contextmenu_mode != "legacy") {
+                this.POPUP.removeEventListener("popupshowing", this.popupMenu, false);
+                this.FAVICON_POPUP.removeEventListener("command", this.commandMenuFavicon, false);
+                this.ITEM_POPUP.removeEventListener("command", this.commandMenuItem, false);
+            }
+        }
+    },
+    disp: function() {
+        this._bitsItemView.disp();
+    },
+    onButtonClick: function(aEvent) {
+        this._bitsItemView.onButtonClick(aEvent);
+    },
+    onTreeClick: function(aEvent) {
+        var aRes = mcTreeHandler.resource;
+        if (aRes) {
+            var fid = mcTreeHandler.DataSource.getProperty(aRes, "id");
+            var dbtype = mcTreeHandler.DataSource.getProperty(aRes, "dbtype");
+            var viewmode = mcTreeViewModeService.viewmode;
+            this._bitsItemView.onTreeClick({viewmode: viewmode, fid: fid, dbtype: dbtype, res: aRes});
+        } else {
+            this._bitsItemView.onTreeClick();
+        }
+    },
+    setSelection: function(aOID, aDBTYPE) {
+        this._bitsItemView.setSelection(aOID, aDBTYPE);
+    },
+    mergeObject: function(srcRes, dstRes) {
+        var src_title;
+        var dst_title;
+        if (srcRes)
+            src_title = mcTreeHandler.DataSource.getProperty(srcRes, "title");
+        if (dstRes)
+            dst_title = mcTreeHandler.DataSource.getProperty(dstRes, "title");
+        if (src_title != dst_title)
+            return 0;
+        var fid = mcTreeHandler.DataSource.getProperty(dstRes, "id");
+        var dbtype = mcTreeHandler.DataSource.getProperty(dstRes, "dbtype");
+        return this._bitsItemView.mergeObject({fid: fid, dbtype: dbtype});
+    },
+    copyObject: function(aRes) {
+        var fid = mcTreeHandler.DataSource.getProperty(aRes, "id");
+        var dbtype = mcTreeHandler.DataSource.getProperty(aRes, "dbtype");
+        var style = mcTreeHandler.DataSource.getProperty(aRes, "style");
+        this._bitsItemView.copyObject({fid: fid, dbtype: dbtype, fid_style: style});
+
+    },
+    moveObject: function(aRes, aModShift) {
+        var srcRes = mcTreeHandler.resource;
+        var fid = mcTreeHandler.DataSource.getProperty(aRes, "id");
+        var dbtype = mcTreeHandler.DataSource.getProperty(aRes, "dbtype");
+        var style = mcTreeHandler.DataSource.getProperty(aRes, "style");
+        var rtn = this._bitsItemView.moveObject({fid: fid, dbtype: dbtype, fid_style: style}, aModShift);
+        if (srcRes) {
+            setTimeout(function() {
+                var fid = mcTreeHandler.DataSource.getProperty(srcRes, "id");
+                var dbtype = mcTreeHandler.DataSource.getProperty(srcRes, "dbtype");
+                var viewmode = mcTreeViewModeService.viewmode;
+                mcItemView._bitsItemView.onTreeClick({viewmode: viewmode, fid: fid, dbtype: dbtype, res: srcRes});
+            }, 0);
+        }
+
+    },
+    refresh: function() {
+        this._bitsItemView.refresh();
+    }
+};
+
+
+/////////////////////////////////////////////////////////////////////
+var mcDatabaseUpdate = {
+    _rebuild_time: 0,
+    _rebuild: false,
+    get gBrowser() {
+        return window.top.bitsObjectMng.getBrowser();
+    },
+    init: function(aEvent) {
+        mcDatabaseUpdate._rebuild_time = parseInt(window.top.bitsObjectMng.Common.getTimeStamp());
+        mcDatabaseUpdate._rebuild = false;
+    },
+    rebuild: function(aEvent) {
+        if (!mcDatabaseUpdate._rebuild)
+            return;
+        mcTreeViewModeService.rebuild();
+//		mcDatabaseUpdate.gBrowser.reload();
+        mcDatabaseUpdate._rebuild = false;
+    },
+};
+
+/////////////////////////////////////////////////////////////////////
+var mcDatabaseObserver = {
+    timerid: null,
+    domain: 'wiredmarker', //"objectmng.xxx"ãšããååã®èš­å®ãå€æŽãããå Žåå
+šãŠã§åŠçãè¡ã
+    observe: function(aSubject, aTopic, aPrefstring) {
+        try {
+            if (aTopic == 'nsPref:changed') {
+                switch (aPrefstring) {
+                    case "wiredmarker.last_update":
+                        var inittime = window.top.bitsObjectMng.DataSource.inittime;
+                        var value = nsPreferences.copyUnicharPref(aPrefstring, "");
+                        var arr = value.split("\t");
+                        if (inittime != arr[2]) {
+                            if (mcDatabaseObserver.timerid)
+                                clearTimeout(mcDatabaseObserver.timerid);
+                            mcDatabaseObserver.timerid = setTimeout(function() {
+                                mcDatabaseObserver.timerid = null;
+                                mcDatabaseUpdate._rebuild = true;
+                            }, 1000);
+                        }
+                        window.top.bitsAutocacheService.refresh();
+                        bitsTreeDate.refresh();
+                        window.top.bitsTreeListService.reload();
+                        setTimeout(function() {
+                            bitsSearchAcross.search();
+                        }, 1000);
+                        break;
+                    case "wiredmarker.rebuild_addon_msg":
+                        setTimeout(
+                                function() {
+                                    if (!mcDatabaseUpdate._rebuild) {
+                                        mcDatabaseUpdate._rebuild = true;
+                                        mcDatabaseUpdate.rebuild();
+                                    }
+                                    if (mcItemView.isChecked)
+                                        mcItemView.refresh();
+                                }, 0);
+                        window.top.bitsAutocacheService.refresh();
+                        break;
+                    case "wiredmarker.shortcut.tree_disp":
+                        mcTreeViewModeService.showShortcutKey();
+                        break;
+                    case "wiredmarker.contextmenu.mode":
+                        mcItemView.initMenu();
+                        break;
+                    default:
+                        break;
+                }
+            }
+        } catch (ex) {
+            window.top.bitsObjectMng.Common.alert("mcDatabaseObserver:" + ex);
+        }
+    }
+};
+
+/////////////////////////////////////////////////////////////////////
+function showConsole() {
+    window.open("chrome://global/content/console.xul", "_blank", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar");
+}
+
+/////////////////////////////////////////////////////////////////////
+// JavaScript ã³ã³ãœãŒã«ã«ãã­ã¹ããè¡šç€ºãã
+/////////////////////////////////////////////////////////////////////
+function _dump(aString) {
+    if (nsPreferences.getBoolPref("wiredmarker.debug", false))
+        window.dump(aString + "\n");
+}
+function _dump2(aString) {
+    if (!nsPreferences.getBoolPref("wiredmarker.debug", false))
+        return;
+    var dumpString = new String(aString);
+    var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
+    aConsoleService.logStringMessage(dumpString);
+    window.dump(aString + "\n");
+}
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeContextmenu.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeContextmenu.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeContextmenu.js	(revision 5703)
@@ -0,0 +1,25 @@
+var bitsTreeContextmenu = {
+/////////////////////////////////////////////////////////////////////
+	init  : function(aEvent){
+		var contextmenu_mode = nsPreferences.copyUnicharPref("wiredmarker.contextmenu.mode");
+		if(contextmenu_mode == null){
+			setTimeout(function(){
+				bitsTreeContextmenu.confirm();
+			},500);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done  : function(aEvent){
+	},
+
+/////////////////////////////////////////////////////////////////////
+	confirm : function(){
+		window.openDialog("chrome://markingcollection/content/treeContextmenuDialog.xul", "", "chrome,centerscreen,modal,dialog,close=no");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeContextmenuDialog.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeContextmenuDialog.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeContextmenuDialog.xul	(revision 5703)
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<?xul-overlay href="chrome://markingcollection/content/treeContextmenuDialogOverlay.xul"?>
+<!DOCTYPE dialog [
+<!ENTITY % markingcollectionDTD SYSTEM "chrome://markingcollection/locale/markingcollection.dtd" >
+%markingcollectionDTD;
+<!ENTITY % metaDTD SYSTEM "chrome://markingcollection/locale/marker.dtd" >
+%metaDTD;
+]>
+<dialog
+	id="bitsTreeContextmenuDialog"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	title="&markingcollection.app.title;"
+	buttons="accept"
+	buttonpack="center"
+	buttondisabledaccept="true"
+	>
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript">
+	<![CDATA[
+		var _bitsTreeContextmenuDialogObserver = {
+			timerid : null,
+			domain  : 'wiredmarker', //"objectmng.xxx"ãšããååã®èš­å®ãå€æŽãããå Žåå
+šãŠã§åŠçãè¡ã
+			observe : function(aSubject, aTopic, aPrefstring) {
+				try{
+					if (aTopic == 'nsPref:changed') {
+						switch (aPrefstring){
+							case "wiredmarker.contextmenu.mode":
+								document.getElementById("bitsTreeContextmenuDialog").removeAttribute("buttondisabledaccept");
+								break;
+							case "wiredmarker.contextmenu.init":
+								//ä»ã®ãŠã£ã³ããŠã®åæèš­å®ãã€ã¢ã­ã°ãã¯ã­ãŒãºãããå Žå
+								window.close();
+								break;
+							default:
+								break;
+						}
+					}
+				}catch(ex){
+				}
+			}
+		};
+
+		function addPrefListener(aObserver){
+			try {
+				var pbi = Components.classes['@mozilla.org/preferences;1'].getService(Components.interfaces.nsIPrefBranchInternal);
+				pbi.addObserver(aObserver.domain, aObserver, false);
+			} catch(e) {}
+		}
+
+		function removePrefListener(aObserver) {
+			try {
+				var pbi = Components.classes['@mozilla.org/preferences;1'].getService(Components.interfaces.nsIPrefBranchInternal);
+				pbi.removeObserver(aObserver.domain, aObserver);
+			} catch(e) {}
+		}
+
+		function _bitsTreeContextmenuDialogInit(aEvent){
+
+			addPrefListener(_bitsTreeContextmenuDialogObserver);
+			setTimeout(function(){nsPreferences.setUnicharPref("wiredmarker.contextmenu.mode", "");},500);
+			window.sizeToContent();
+		}
+		function _bitsTreeContextmenuDialogDone(aEvent){
+			removePrefListener(_bitsTreeContextmenuDialogObserver);
+		}
+		function _bitsTreeContextmenuDialogAccept(aEvent){
+			nsPreferences.setBoolPref("wiredmarker.contextmenu.init", true);
+		}
+
+		window.addEventListener("load", _bitsTreeContextmenuDialogInit, false);
+		window.addEventListener("unload", _bitsTreeContextmenuDialogDone, false);
+		window.addEventListener("dialogaccept", _bitsTreeContextmenuDialogAccept, false);
+	]]>
+	</script>
+	<dialogheader title="&markingcollection.contextmenu.type;" hidden="true"/>
+	<groupbox>
+		<caption label="&markingcollection.contextmenu.type;"/>
+		<vbox id="mcMenuContextmenuVBox"/>
+	</groupbox>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeContextmenuDialogOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeContextmenuDialogOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeContextmenuDialogOverlay.xul	(revision 5703)
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+	id="treeContextmenuDialogOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript">
+	<![CDATA[
+		var _bitsTreeContextmenuDialogOverlayObserver = {
+			timerid : null,
+			domain  : 'wiredmarker', //"objectmng.xxx"ãšããååã®èš­å®ãå€æŽãããå Žåå
+šãŠã§åŠçãè¡ã
+			observe : function(aSubject, aTopic, aPrefstring) {
+				try{
+					if (aTopic == 'nsPref:changed') {
+						switch (aPrefstring){
+							case "wiredmarker.contextmenu.mode":
+								document.getElementById("mcMenuContextmenu").disabled = true;
+								var contextmenu_mode = nsPreferences.copyUnicharPref("wiredmarker.contextmenu.mode");
+								if(contextmenu_mode == "legacy"){
+									document.getElementById("mcMenuContextmenu").disabled = false;
+									document.getElementById("mcMenuContextmenuMode").selectedItem = document.getElementById("mcMenuContextmenuModeLegacy");
+								}else if(contextmenu_mode != null){
+									document.getElementById("mcMenuContextmenuMode").selectedItem = document.getElementById("mcMenuContextmenuModeNormal");
+								}else{
+									document.getElementById("mcMenuContextmenuMode").selectedItem = null;
+								}
+								break;
+							case "wiredmarker.contextmenu.type":
+								var contextmenu_type = nsPreferences.copyUnicharPref("wiredmarker.contextmenu.type","");
+								switch(contextmenu_type){
+									case "simple":
+										document.getElementById("mcMenuContextmenuSimple").setAttribute("selected","true");
+										document.getElementById("mcMenuContextmenuFull").removeAttribute("selected");
+										break;
+									default:
+										document.getElementById("mcMenuContextmenuSimple").removeAttribute("selected");
+										document.getElementById("mcMenuContextmenuFull").setAttribute("selected","true");
+										break;
+								}
+								break;
+							default:
+								break;
+						}
+					}
+				}catch(ex){
+				}
+			}
+		};
+
+		function addPrefListener(aObserver){
+			try {
+				var pbi = Components.classes['@mozilla.org/preferences;1'].getService(Components.interfaces.nsIPrefBranchInternal);
+				pbi.addObserver(aObserver.domain, aObserver, false);
+			} catch(e) {}
+		}
+
+		function removePrefListener(aObserver) {
+			try {
+				var pbi = Components.classes['@mozilla.org/preferences;1'].getService(Components.interfaces.nsIPrefBranchInternal);
+				pbi.removeObserver(aObserver.domain, aObserver);
+			} catch(e) {}
+		}
+
+		function _treeContextmenuDialogOverlayInit(aEvent){
+			addPrefListener(_bitsTreeContextmenuDialogOverlayObserver);
+			var contextmenu_type = nsPreferences.copyUnicharPref("wiredmarker.contextmenu.type","");
+			switch(contextmenu_type){
+				case "simple":
+					document.getElementById("mcMenuContextmenuSimple").setAttribute("selected","true");
+					document.getElementById("mcMenuContextmenuFull").removeAttribute("selected");
+					break;
+				default:
+					document.getElementById("mcMenuContextmenuSimple").removeAttribute("selected");
+					document.getElementById("mcMenuContextmenuFull").setAttribute("selected","true");
+					break;
+			}
+			document.getElementById("mcMenuContextmenu").disabled = true;
+			var contextmenu_mode = nsPreferences.copyUnicharPref("wiredmarker.contextmenu.mode");
+			if(contextmenu_mode == "legacy"){
+				document.getElementById("mcMenuContextmenu").disabled = false;
+				document.getElementById("mcMenuContextmenuMode").selectedItem = document.getElementById("mcMenuContextmenuModeLegacy");
+			}else if(contextmenu_mode != null){
+				document.getElementById("mcMenuContextmenuMode").selectedItem = document.getElementById("mcMenuContextmenuModeNormal");
+			}else{
+				document.getElementById("mcMenuContextmenuMode").selectedItem = null;
+			}
+		}
+		function _treeContextmenuDialogOverlayDone(aEvent){
+			removePrefListener(_bitsTreeContextmenuDialogOverlayObserver);
+		}
+
+		function _contextmenuModeCommand(aEvent){
+			if(aEvent.target.id == "mcMenuContextmenuModeLegacy"){
+				nsPreferences.setUnicharPref("wiredmarker.contextmenu.mode", "legacy");
+				document.getElementById("mcMenuContextmenu").disabled = false;
+			}else{
+				nsPreferences.setUnicharPref("wiredmarker.contextmenu.mode", "");
+				document.getElementById("mcMenuContextmenu").disabled = true;
+			}
+		}
+
+		function _contextmenuCommand(aEvent){
+			nsPreferences.setUnicharPref("wiredmarker.contextmenu.type", aEvent.target.value);
+		}
+
+		window.addEventListener("load", _treeContextmenuDialogOverlayInit, false);
+		window.addEventListener("unload", _treeContextmenuDialogOverlayDone, false);
+	]]>
+	</script>
+	<vbox id="mcMenuContextmenuVBox">
+		<radiogroup id="mcMenuContextmenuMode" oncommand="_contextmenuModeCommand(event)">
+			<radio id="mcMenuContextmenuModeNormal" label="Standard Mode"/>
+			<radio id="mcMenuContextmenuModeLegacy" label="Legacy Mode"/>
+		</radiogroup>
+		<radiogroup id="mcMenuContextmenu" oncommand="_contextmenuCommand(event)" style="padding-left:1em;">
+			<radio id="mcMenuContextmenuFull"   value="full"   label="&markingcollection.contextmenu.type.full;"/>
+			<radio id="mcMenuContextmenuSimple" value="simple" label="&markingcollection.contextmenu.type.simple;"/>
+		</radiogroup>
+	</vbox>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeContextmenuSidebarOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeContextmenuSidebarOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeContextmenuSidebarOverlay.xul	(revision 5703)
@@ -0,0 +1,434 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE overlay [
+<!ENTITY % markingcollectionDTD SYSTEM "chrome://markingcollection/locale/markingcollection.dtd" >
+%markingcollectionDTD;
+<!ENTITY % metaDTD SYSTEM "chrome://markingcollection/locale/meta.dtd" >
+%metaDTD;
+<!ENTITY % treecontextmenuDTD SYSTEM "chrome://markingcollection/locale/treecontextmenu.dtd" >
+%treecontextmenuDTD;
+]>
+<overlay
+	id="treeContextmenuSidebarOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://markingcollection/content/treeContextmenu.js"/>
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _treeContextmenuSidebarOverlayInit(aEvent){
+			bitsTreeContextmenu.init(aEvent);
+		}
+		function _treeContextmenuSidebarOverlayDone(aEvent){
+			bitsTreeContextmenu.done(aEvent);
+		}
+		window.addEventListener("load", _treeContextmenuSidebarOverlayInit, false);
+		window.addEventListener("unload", _treeContextmenuSidebarOverlayDone, false);
+	]]>
+	</script>
+	<popupset id="mcPopupSet">
+		<menupopup
+			id="mcPopupFolder"
+			onpopupshowing="mcController.onPopupShowing(event);"
+			onpopuphiding="mcController.onPopupHiding(event);">
+			<menu
+				id="mcPopupFolderFolderMenu"
+				class="menu-iconic"
+				image="chrome://markingcollection/skin/folder.png"
+				label="&treecontextmenu.folder;">
+				<menupopup>
+					<menuitem
+						id="mcPopupFolderCreateContents"
+						class="menuitem-iconic"
+						label="&treecontextmenu.folder.new;..."
+						image="chrome://markingcollection/skin/folder-add.png"
+						oncommand="mcTreeHandler.create(mcTreeHandler.TREE.currentIndex);event.stopPropagation();"/>
+					<menuseparator observes="mcPopupFolderTemplateFolder"/>
+					<menu
+						id="mcPopupFolderTemplateFolder"
+						class="menu-iconic"
+						image="chrome://markingcollection/skin/add-template-folder.png"
+						label="&markingcollection.templateFolder;"
+						onpopupshowing="mcTreeTemplateFolder.onPopupShowingMng(event);">
+						<menupopup>
+							<menu
+								id="mcPopupFolderCreates"
+								class="menu-iconic"
+								label="&treecontextmenu.folder.template.new;"
+								image="chrome://markingcollection/skin/folder-add.png"
+								onmouseover="event.stopPropagation();">
+								<menupopup
+									id="mcPopupFolderCreatesMenu"
+									onpopupshowing="mcTreeTemplateFolder.onPopupShowing(event);"
+									onpopuphiding="mcTreeTemplateFolder.onPopupHiding(event);"
+									oncommand="mcTreeTemplateFolder.onCommand(event,mcTreeHandler.TREE.currentIndex);"/>
+							</menu>
+							<menuitem
+								id="mcPopupFolderTemplateFolderCreate"
+								class="menuitem-iconic"
+								label="&treecontextmenu.folder.template.create;..."
+								image="chrome://markingcollection/skin/add.png"
+								oncommand="mcTreeTemplateFolder.onClick(event,mcTreeHandler.TREE.currentIndex);" />
+							<menuitem
+								id="mcPopupFolderTemplateFolderRemove"
+								class="menuitem-iconic"
+								label="&treecontextmenu.folder.template.remove;..."
+								image="chrome://markingcollection/skin/delete.png"
+								oncommand="mcTreeTemplateFolder.onRemove(event);" />
+						</menupopup>
+					</menu>
+					<menuseparator observes="mcPopupFolderRemoves"/>
+					<menu
+						id="mcPopupFolderRemoves"
+						class="menu-iconic"
+						label="&markingcollection.remove;"
+						image="chrome://markingcollection/skin/delete.png"
+						onmouseover="event.stopPropagation();">
+						<menupopup id="mcPopupFolderRemovesMenu">
+							<menuitem
+								id="mcPopupFolderRemoveFolder"
+								class="menuitem-iconic"
+								label="&markingcollection.remove.folder;"
+								image="chrome://markingcollection/skin/folder-delete.png"
+								oncommand="setTimeout(function(){mcTreeHandler.removeFolder(event);},0);" />
+							<menuitem
+								id="mcPopupFolderRemoveAllFolder"
+								class="menuitem-iconic"
+								label="&markingcollection.remove.folderall;"
+								image="chrome://markingcollection/skin/folders-delete.png"
+								oncommand="setTimeout(function(){mcTreeHandler.removeAllFolder(event);},0);"/>
+							<menuitem
+								id="mcPopupFolderRemoveAllContents"
+								class="menuitem-iconic"
+								label="&markingcollection.remove.itemall;"
+								image="chrome://markingcollection/skin/folder-items-delete.png"
+								oncommand="setTimeout(function(){mcTreeHandler.removeAll(event);},0);" />
+						</menupopup>
+					</menu>
+				</menupopup>
+			</menu>
+			<menu
+				id="mcPopupFolderViewMenu"
+				class="menu-iconic"
+				image="chrome://markingcollection/skin/view.png"
+				label="&treecontextmenu.view;">
+				<menupopup>
+					<menuitem
+						id="mcPopupFolderListView"
+						class="menuitem-iconic"
+						label="&treecontextmenu.view.list;"
+						image="chrome://markingcollection/skin/list.png"
+						oncommand="window.top.bitsTreeListService.dispList(event,'chrome://markingcollection/content/listview_drag.xsl');"/>
+					<menu
+						id="mcPopupFolderTreeListViewMenu"
+						class="menu-iconic"
+						label="&markingcollection.treelistview;"
+						image="chrome://markingcollection/skin/toolbar_listview.png">
+						<menupopup
+							id="mcPopupFolderTreeListViewMenuPopup"
+							onpopupshowing="window.top.bitsTreeListService.onPopupShowing(event);"
+							onpopuphiding="window.top.bitsTreeListService.onPopupHiding(event);"
+							oncommand="window.top.bitsTreeListService.onCommand(event);">
+							<menuitem
+								id="mcPopupFolderTreeListView"
+								class="menuitem-iconic"
+								label="&markingcollection.treelistview.defaults;"
+								image="chrome://markingcollection/skin/stylesheet.png"
+								oncommand="window.top.bitsTreeListService.dispList(event);"/>
+							<menuseparator observes="mcPopupFolderTreeListViewSeparator"/>
+						</menupopup>
+					</menu>
+					<menuseparator id="mcPopupFolderItemViewSeparator" observes="mcPopupFolderItemViewMenu"/>
+					<menu
+						id="mcPopupFolderItemViewMenu"
+						class="menu-iconic"
+						label="&treecontextmenu.view.itemviewstyle;"
+						image="chrome://markingcollection/skin/itemview.png">
+						<menupopup>
+							<menu
+								id="mcPopupFolderItemViewFaviconMenu"
+								class="menu-iconic"
+								label="&treecontextmenu.view.itemviewstyle.favicon;"
+								image="chrome://markingcollection/skin/defaultFavicon.png">
+								<menupopup id="mcPopupFolderItemViewFaviconMenupopup"/>
+							</menu>
+							<menu
+								id="mcPopupFolderItemViewItemMenu"
+								class="menu-iconic"
+								label="&treecontextmenu.view.itemviewstyle.items;"
+								image="chrome://markingcollection/skin/itemview.png">
+								<menupopup id="mcPopupFolderItemViewItemMenupopup"/>
+							</menu>
+						</menupopup>
+					</menu>
+					<menuseparator id="mcPopupFolderFilterSeparator"/>
+					<menuitem
+						id="mcPopupFolderFilter"
+						class="menuitem-iconic"
+						label="&treecontextmenu.view.filter;..."
+						image="chrome://markingcollection/skin/filter.png"
+						oncommand="mcTreeFolderFilterService.onCommand(event)"/>
+				</menupopup>
+			</menu>
+			<menu
+				id="mcPopupFolderImportMenu"
+				class="menu-iconic"
+				image="chrome://markingcollection/skin/import.png"
+				label="&treecontextmenu.import;">
+				<menupopup>
+					<menu
+						id="mcPopupFolderCapture"
+						class="menu-iconic"
+						label="&treecontextmenu.import.capture;"
+						image="chrome://markingcollection/skin/capture.png">
+						<menupopup>
+							<menuitem
+								class="menuitem-iconic"
+								label="&markingcollection.capture.document;"
+								image="chrome://markingcollection/skin/document.png"
+								oncommand="mcCapture.commandCaptureFromDocument(event);" />
+							<menuitem
+								class="menuitem-iconic"
+								label="&markingcollection.capture.clipboard;"
+								image="chrome://markingcollection/skin/clipboard.png"
+								oncommand="mcCapture.commandCaptureFromClipboard(event);" />
+						</menupopup>
+					</menu>
+					<menuseparator observes="mcPopupFolderImportTag"/>
+					<menuitem
+						id="mcPopupFolderImportTag"
+						class="menuitem-iconic"
+						label="&treecontextmenu.import.tag;..."
+						image="chrome://markingcollection/skin/import-tag.png"
+						oncommand="window.top.bitsImportTagService.dispList(event);"/>
+					<menuseparator observes="mcPopupFolderProjectDocumentsMenu"/>
+					<menu
+						id="mcPopupFolderProjectDocumentsMenu"
+						class="menu-iconic"
+						label="&treecontextmenu.import.localfile;"
+						image="chrome://markingcollection/skin/documents.png">
+						<menupopup id="mcPopupFolderProjectDocumentsMenupopup">
+							<menuitem
+								label="&markingcollection.project.documents.select.folder;..."
+								class="menuitem-iconic"
+								image="chrome://markingcollection/skin/toolbar_folder.png"
+								oncommand="window.top.bitsTreeProjectService.readDocumentFromFolder(event);" />
+							<menuitem
+								label="&markingcollection.project.documents.select.file;..."
+								class="menuitem-iconic"
+								image="chrome://markingcollection/skin/documents.png"
+								oncommand="window.top.bitsTreeProjectService.readDocumentFromFile(event);" />
+						</menupopup>
+					</menu>
+				</menupopup>
+			</menu>
+			<menu
+				id="mcPopupFolderExportMenu"
+				class="menu-iconic"
+				image="chrome://markingcollection/skin/export.png"
+				label="&treecontextmenu.export;">
+				<menupopup>
+					<menuitem
+						id="mcPopupFolderExport"
+						class="menuitem-iconic"
+						label="&treecontextmenu.export.export;..."
+						image="chrome://markingcollection/skin/zip.png"
+						oncommand="window.top.bitsTreeExportService.saveFile(event)"
+						disabled="false"/>
+					<menuseparator
+						id="mcPopupFolderTagOutputMenuseparator"
+						observes="mcPopupFolderTagOutput"/>
+					<menuitem
+						id="mcPopupFolderTagOutput"
+						class="menuitem-iconic"
+						label="&treecontextmenu.export.tagoutput;..."
+						image="chrome://markingcollection/skin/tag_save.png"
+						oncommand="window.top.bitsTagOutputService.onTagOutputRdfCommand({event:event});"/>
+				</menupopup>
+			</menu>
+			<menu
+				id="mcPopupFolderAutoMarkingMenu"
+				class="menu-iconic"
+				image="chrome://markingcollection/skin/automarker.png"
+				label="&treecontextmenu.automarking;">
+				<menupopup>
+					<menu id="mcPopupFolderProjectIndexMenu" class="menu-iconic" label="&markingcollection.project.index.menu.caption;" image="chrome://markingcollection/skin/index_list.png">
+						<menupopup id="mcPopupFolderProjectIndexMenupopup">
+							<menu
+								class="menu-iconic"
+								label="&markingcollection.project.index.menu.display;"
+								image="chrome://markingcollection/skin/index_list.png">
+								<menupopup>
+									<menuitem
+										id="mcPopupFolderProjectIndexOutputMenuitem"
+										class="menuitem-iconic"
+										label="&markingcollection.project.index.menu.display.normal;..."
+										image="chrome://markingcollection/skin/stylesheet.png"
+										oncommand="window.top.bitsTreeProjectService.displayIndex(event,'chrome://markingcollection/content/treeindex_standard.xsl');"/>
+									<menuitem
+										id="mcPopupFolderProjectIndexOutputMenuitem"
+										class="menuitem-iconic"
+										label="&markingcollection.project.index.menu.display.url;..."
+										image="chrome://markingcollection/skin/stylesheet.png"
+										oncommand="window.top.bitsTreeProjectService.displayIndex(event,'chrome://markingcollection/content/treeindex_url.xsl');"/>
+								</menupopup>
+							</menu>
+							<menuitem
+								id="mcPopupFolderCreateProjectContents1"
+								class="menuitem-iconic"
+								label="&markingcollection.project.index.menu.save;..."
+								image="chrome://markingcollection/skin/index_save.png"
+								oncommand="window.top.bitsTreeProjectService.saveIndex(event);"/>
+						</menupopup>
+					</menu>
+					<menuseparator
+						observes="mcPopupFolderProjectDictionaryMenu"/>
+					<menu
+						id="mcPopupFolderProjectDictionaryMenu"
+						class="menu-iconic"
+						label="&treecontextmenu.automarking.dictionary;"
+						image="chrome://markingcollection/skin/dictionary.png">
+						<menupopup id="mcPopupFolderProjectDictionaryMenupopup">
+							<menuitem
+								label="&markingcollection.project.dictionary.apply;"
+								class="menuitem-iconic"
+								image="chrome://markingcollection/skin/dictionary_apply.png"
+								oncommand="window.top.bitsTreeProjectService.applyDictionary(event)" />
+							<menuseparator/>
+							<menuitem
+								label="&markingcollection.project.dictionary.edit;"
+								class="menuitem-iconic"
+								image="chrome://markingcollection/skin/dictionary_edit.png"
+								oncommand="window.top.bitsTreeProjectService.makeDictionary(event)" />
+							<menuseparator/>
+							<menuitem
+								label="&markingcollection.project.dictionary.read;..."
+								class="menuitem-iconic"
+								image="chrome://markingcollection/skin/toolbar_folder.png"
+								oncommand="window.top.bitsTreeProjectService.readDictionary(event)" />
+							<menuitem
+								label="&markingcollection.project.dictionary.save;..."
+								class="menuitem-iconic"
+								image="chrome://markingcollection/skin/dictionary_save.png"
+								oncommand="window.top.bitsTreeProjectService.saveDictionary(event)" />
+							<menuitem
+								label="&markingcollection.project.dictionary.management;..."
+								class="menuitem-iconic"
+								image="chrome://markingcollection/skin/management.png"
+								oncommand="window.top.bitsTreeProjectService.mngDictionary(event)" />
+						</menupopup>
+					</menu>
+					<menuseparator observes="mcPopupFolderEditReplacedURL"/>
+					<menuitem
+						id="mcPopupFolderEditReplacedURL"
+						class="menuitem-iconic"
+						label="&markingcollection.edit.replacedURL;..."
+						image="chrome://markingcollection/skin/edit.png"
+						oncommand="mcTreeHandler.replacedURL(event);"/>
+				</menupopup>
+			</menu>
+			<menuseparator observes="mcPopupFolderProperty"/>
+			<menuitem
+				id="mcPopupFolderProperty"
+				class="menuitem-iconic"
+				label="&markingcollection.property;"
+				image="chrome://markingcollection/skin/menu_property.png"
+				oncommand="mcController.property(null);" />
+		</menupopup>
+		<menupopup id="mcPopupObject">
+			<menuitem
+				id="mcPopupObjectOpen"
+				label="&markingcollection.open;"
+				oncommand="mcController.open(null,false);"
+				nodelay="true"
+				default="true"/>
+			<menuitem
+				id="mcPopupObjectOpenNewTab"
+				label="&markingcollection.open.newtab;"
+				oncommand="mcController.open(null,true);"
+				nodelay="true"/>
+			<menuseparator id="mcPopupObjectHyperAnchorCopyToClipboardMenuseparator" observes="mcPopupHyperAnchorCopyToClipboard"/>
+			<menu
+				id="mcPopupObjectHyperAnchorCopyToClipboard"
+				label="&markingcollection.hyperanchor.sidebar_copy_to_clipboard;"
+				class="menu-iconic"
+				image="chrome://markingcollection/skin/marker_copy.png">
+				<menupopup>
+					<menuitem
+						label="&meta.menuitem.hyperanchor.copy_to_clipboard;"
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/marker_copy.png"
+						oncommand="mcController.copy('copy');"/>
+					<menuitem
+						label="&meta.menuitem.hyperanchor.copytitle_to_clipboard;"
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/marker_copytext.png"
+						oncommand="mcController.copy('title');"/>
+					<menuitem
+						label="&meta.menuitem.hyperanchor.copynote_to_clipboard;"
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/marker_copytext.png"
+						oncommand="mcController.copy('note');"/>
+					<menuitem
+						label="&meta.menuitem.hyperanchor.copymeta_to_clipboard;"
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/marker_copytext.png"
+						oncommand="mcController.copy('pagetitle');"/>
+				</menupopup>
+			</menu>
+			<menuitem
+				id="mcPopupObjectHyperAnchorCopyFormatToClipboard"
+				label="&meta.menuitem.hyperanchor.copyformat_to_clipboard;"
+				class="menuitem-iconic"
+				image="chrome://markingcollection/skin/marker_copy.png"
+				oncommand="mcController.copy('format');" />
+			<menuitem
+				id="mcPopupObjectHyperAnchorCopyFormatSetting"
+				label="&meta.menuitem.hyperanchor.copyformatsetting;..."
+				class="menuitem-iconic"
+				image="chrome://markingcollection/skin/marker_copy.png"
+				oncommand="mcController.copy('setting');"/>
+			<menuseparator observes="mcPopupObjectCache"/>
+			<menu id="mcPopupObjectCache" class="menu-iconic" label="&markingcollection.autocache.cache;" image="chrome://markingcollection/skin/autocache.png">
+				<menupopup>
+					<menuitem
+						id="mcPopupObjectCacheOpen"
+						label="&markingcollection.autocache.open;"
+						observes="mcPopupObjectOpenSeparator"
+						oncommand="window.top.bitsAutocacheService.openCache(event);"/>
+					<menuitem
+						id="mcPopupObjectCacheOpenNewtab"
+						label="&markingcollection.autocache.open.newtab;"
+						observes="mcPopupObjectOpenSeparator"
+						oncommand="window.top.bitsAutocacheService.openCache(event,true);"/>
+					<menuseparator observes="mcPopupObjectCachePast"/>
+					<menuitem
+						id="mcPopupObjectCachePast"
+						label="&markingcollection.autocache.past;..."
+						oncommand="window.top.bitsAutocacheService.pastCache(event);" hidden="true"/>
+				</menupopup>
+			</menu>
+			<menuseparator
+				id="mcPopupObjectTagOutputMenuseparator"
+				observes="mcPopupObjectTagOutput"/>
+			<menuitem
+				id="mcPopupObjectTagOutput"
+				class="menuitem-iconic"
+				label="&markingcollection.tagoutput.menu.title;..."
+				image="chrome://markingcollection/skin/tag_save.png"
+				oncommand="window.top.bitsTagOutputService.onTagOutputRdfCommand({event:event});"/>
+			<menuseparator observes="mcPopupObjectRemoveContents"/>
+			<menuitem
+				id="mcPopupObjectRemoveContents"
+				class="menuitem-iconic"
+				label="&markingcollection.remove;"
+				image="chrome://markingcollection/skin/menu_remove.png"
+				oncommand="setTimeout(function(){mcTreeHandler.remove(event);},0);" />
+			<menuseparator observes="mcPopupObjectProperty"/>
+			<menuitem
+				id="mcPopupObjectProperty"
+				class="menuitem-iconic"
+				label="&markingcollection.property;"
+				image="chrome://markingcollection/skin/menu_property.png"
+				oncommand="mcController.property(null);" />
+		</menupopup>
+	</popupset>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treedate.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treedate.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treedate.js	(revision 5703)
@@ -0,0 +1,781 @@
+var bitsTreeDate = {
+	_init        : false,
+	_xmlfilename : 'treedate.xml',
+	_xmlfolder   : null,
+	_xmlfile     : null,
+	_xmldoc      : null,
+	_namespace   : 'http://www.bits.cc/Wired-Marker/',
+	_ns_alias    : 'WM',
+
+	_refresh_timer : null,
+
+	get APPCONT()  { return document.getElementById("appcontent"); },
+	get TREE()     { return document.getElementById("bitsTreeDate"); },
+
+	get idTREE_IDATE()     { return "bitsTreeDateTreecolDate"; },
+	get idTREE_TAB()       { return "mcTreeTabDate"; },
+	get idTREE_TABS()      { return "mcTreeTabs"; },
+
+	get TREE_IDATE()       { return document.getElementById(this.idTREE_IDATE); },
+	get TREE_TABS()        { return document.getElementById(this.idTREE_TABS); },
+
+	get POPUP()            { return document.getElementById("mcPopupDateFolder"); },
+
+	get SIDEBAR_BOX()      { return document.getElementById("bitsSidebarBox"); },
+	get SIDEBAR_TREEVBOX(){ return document.getElementById("mcTreeVBox"); },
+	get SIDEBAR_TREETBOX(){ return document.getElementById("mcTreeTabbox"); },
+	get SIDEBAR_TREE()     { return document.getElementById("mcTree"); },
+
+	get SIDEBAR()     { return window.top.document.getElementById("sidebar"); },
+	get SIDEBAR_DOC(){try{return this.SIDEBAR.contentDocument;}catch(e){return undefined;}},
+
+	get BROADCASTER(){ return window.top.document.getElementById("viewMarkingCollection"); },
+
+	get STRING()     { return window.top.document.getElementById("MarkingCollectionOverlayString"); },
+	get DataSource(){ return window.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.top.bitsObjectMng.Database;   },
+	get XML()        { return window.top.bitsObjectMng.XML;   },
+	get gBrowser()   { return window.top.bitsObjectMng.getBrowser();},
+	get dbinfo()     { return window.top.bitsMarkingCollection.dbinfo; },
+	get localfolder(){ return window.top.bitsMarkingCollection.localfolder; },
+
+	get object(){return (this.TREE.currentIndex>=0 ? this.getRowObject(this.TREE.currentIndex) : undefined);},
+
+	get xmldoc()   { return this._xmldoc; },
+	get xmlfile()  { return this._xmlfile; },
+	get namespace(){ return this._namespace; },
+	get ns_alias(){ return this._ns_alias; },
+
+	get isChecked(){ return (this.SIDEBAR_TREETBOX.hidden == false && this.TREE_TABS.selectedItem.id == this.idTREE_TAB)?true:false; },
+
+/////////////////////////////////////////////////////////////////////
+	progressListener : {
+		QueryInterface : function(aIID){
+			if(aIID.equals(Components.interfaces.nsIWebProgressListener) || aIID.equals(Components.interfaces.nsISupportsWeakReference) || aIID.equals(Components.interfaces.nsISupports)) return this;
+			throw Components.results.NS_NOINTERFACE;
+		},
+		onLocationChange : function(webProgress, aRequest, aURI){
+			if(webProgress.isLoadingDocument) return;
+			bitsTreeDate.pageshow(webProgress.DOMWindow.document);
+		},
+		onStateChange : function(webProgress, request, stateFlags, status){
+			if(webProgress.isLoadingDocument) return;
+			bitsTreeDate.pageshow(webProgress.DOMWindow.document);
+		},
+		onProgressChange : function(){},
+		onStatusChange : function(){},
+		onSecurityChange : function(){},
+		onLinkIconAvailable : function(){}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	loadxml : function(){
+		try{
+			var extensionDir = this.Common.getExtensionDir().clone();
+			if(extensionDir){
+				this._xmlfolder = extensionDir;
+				this._xmlfile = extensionDir.clone();
+				this._xmlfile.append(this._xmlfilename);
+				if(!this._xmlfile.exists()){
+					var aContent = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
+					aContent += '<!DOCTYPE TREEDATES>\n';
+					aContent += '<TREEDATES xmlns:WM="'+this.namespace+'"/>\n';
+					this.Common.writeFile(this._xmlfile,aContent,"UTF-8");
+				}
+				if(this._xmlfile.exists()){
+					function _loadXMLDocument(pUri){
+						if(pUri == undefined) return undefined;
+						var xmlDocument = window.top.bitsMarkingCollection.loadXMLDocument(pUri);
+						if(xmlDocument){
+							return xmlDocument.documentElement;
+						}else{
+							return undefined;
+						}
+					}
+					function _createXMLDocument(aXMLFile){
+						if(!aXMLFile) return undefined;
+						try{
+							return _loadXMLDocument(bitsTreeDate.Common.IO.newFileURI(aXMLFile).spec);
+						}catch(ex){
+							bitsTreeDate._dump("bitsTreeDate._createXMLDocument():"+ ex);
+							return undefined;
+						}
+					}
+					this._xmldoc = _createXMLDocument(this._xmlfile);
+					if(this._xmldoc){
+						var nodes =  this.evaluateArray('//TREEDATE[@dbtype]');
+						for(var i=nodes.length-1;i>=0;i--){
+							nodes[i].parentNode.removeChild(nodes[i]);
+						}
+					}
+				}
+			}
+		}catch(e){
+			this._dump("bitsTreeDate.loadxml():"+e);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	xmlflash : function(aTimeout){
+		try{
+			if(!aTimeout) aTimeout = 0;
+			var self = this;
+			setTimeout(function(){ self._xmlflash(); },aTimeout);
+		}catch(e){
+			this._dump("bitsTreeDate.xmlflash():"+e);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_xmlflash : function(aTimeout){
+		try{
+			if(!this.xmldoc || !this.xmlfile) return;
+			var s = new XMLSerializer();
+			var xml = s.serializeToString(this.xmldoc);
+			this.Common.writeFile(this.xmlfile, xml+"\n","UTF-8");
+		}catch(e){
+			this._dump("bitsTreeDate._xmlflash():"+e);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	evaluateArray : function(aExpr){
+		return this.XPath.evaluateArray(aExpr,this.xmldoc);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	init : function(aEvent){
+		try{
+			if(!this._init){
+				var itemview_disp = nsPreferences.getBoolPref("wiredmarker.itemview.disp");
+				if(itemview_disp == undefined) itemview_disp = true;
+				if(!itemview_disp){
+					this.SIDEBAR_TREETBOX.hidden = true;
+					this.SIDEBAR_TREEVBOX.appendChild(this.SIDEBAR_TREE);
+				}
+				if(this.SIDEBAR_TREE.builderView) this.SIDEBAR_TREE.builderView.addObserver(mcTreeDNDHandler.builderObserver);
+				this.loadxml();
+				this._init = true;
+				this.rebuild();
+			}
+		}catch(e){
+			alert(e);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	disp : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(aEvent){
+		if(this.SIDEBAR_TREE.builderView) this.SIDEBAR_TREE.builderView.removeObserver(mcTreeDNDHandler.builderObserver);
+		this._init = false;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	treeDispChange : function(){},
+
+/////////////////////////////////////////////////////////////////////
+	onChangeListStyle : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	onViewTypePopupCommand : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	onSearchButtonCommand : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+// TREE è¡šç€ºå¶åŸ¡é¢é£
+/////////////////////////////////////////////////////////////////////
+	get rowCount(){
+		return (this.itemObjects?this.itemObjects.length:0);
+	},
+	getRowObject : function(row){
+		return (row>=0 && this.itemObjects && this.itemObjects.length>row ? this.itemObjects[row] : undefined);
+	},
+	getCellText : function(row,column){
+		if(!this.itemObjects || !this.itemObjects[row]) return null;
+		return this.itemObjects[row].text;
+	},
+	setTree: function(treebox){ this.treebox = treebox; },
+	isContainer: function(row){
+		try{
+			return this.itemObjects[row].container;
+		}catch(e){
+			return false;
+		}
+	},
+	isContainerOpen: function(row){
+		return this.itemObjects[row].open;
+	},
+	isContainerEmpty: function(row){
+		return this.itemObjects[row].empty;
+	},
+	toggleOpenState: function(row){
+		this.itemObjects[row].open = !this.itemObjects[row].open;
+		var elems =  this.evaluateArray('//TREEDATE[@id="'+this.itemObjects[row].id+'"]');
+		if(elems && elems.length){
+			elems[0].setAttribute('open',this.itemObjects[row].open);
+			this.xmlflash();
+		}
+		if(this.itemObjects[row].open){
+			var splice_pos = row;
+			var len = this.itemObjects[row].childlen.length;
+			for(var i=0;i<len;i++){
+				splice_pos++;
+				this.itemObjects.splice(splice_pos,0,this.itemObjects[row].childlen[i]);
+				if(this.itemObjects[row].childlen[i].open){
+					for(var j=0;j<this.itemObjects[row].childlen[i].childlen.length;j++){
+						splice_pos++
+						this.itemObjects.splice(splice_pos,0,this.itemObjects[row].childlen[i].childlen[j]);
+						if(this.itemObjects[row].childlen[i].childlen[j].open){
+							for(var k=0;k<this.itemObjects[row].childlen[i].childlen[j].childlen.length;k++){
+								splice_pos++
+								this.itemObjects.splice(splice_pos,0,this.itemObjects[row].childlen[i].childlen[j].childlen[k]);
+							}
+						}
+					}
+				}
+			}
+		}else{
+			var len = 0;
+			for(var i=row+1;i<this.itemObjects.length;i++){
+				if(this.itemObjects[row].level >= this.itemObjects[i].level) break;
+				len++;
+			}
+			var remove_arr = this.itemObjects.splice(row+1, len);
+		}
+		this.TREE.view = this;
+	},
+  getParentIndex: function(row){
+		try{
+			return this.itemObjects[row].parentIndex;
+		}catch(e){
+			return -1;
+		}
+	},
+	hasNextSibling: function(row,afterRow){
+this._dump("hasNextSibling("+row+","+afterRow+")");
+		return this.itemObjects[row].hasNext;
+	},
+	isSeparator: function(row){ return false; },
+	isSorted: function(){ return true; },
+	getLevel: function(row){
+		try{
+			return this.itemObjects[row].level;
+		}catch(e){
+			return -1;
+		}
+	},
+	getImageSrc: function(row,column){
+		if(!this.itemObjects) return undefined;
+		if(!this.itemObjects[row]) return undefined;
+		return this.itemObjects[row].icon;
+	},
+	getRowProperties: function(row,prop){},
+	getCellProperties: function(row, column, prop){
+		if(row<this.itemObjects.length){
+			var aserv=Components.classes["@mozilla.org/atom-service;1"].getService(Components.interfaces.nsIAtomService);
+			prop.AppendElement(aserv.getAtom("folder"));
+		}
+	},
+	getColumnProperties: function(column, element, prop){},
+	cycleHeader : function(col){},
+	isEditable : function(row,column){ return column.editable; },
+	setCellText : function(row,column,text){},
+	setCellValue : function(row,column,text){},
+	canDrop : function(index, orient){ return false; },
+	onDrop : function(row, orient){},
+	drop : function(row, orient){},
+
+/////////////////////////////////////////////////////////////////////
+// Drag & Drop Old Callback functions
+/////////////////////////////////////////////////////////////////////
+	onOldDraggesture: function(aEvent){
+		aEvent.stopPropagation();
+	},
+	onOldDragover: function(aEvent){
+		aEvent.stopPropagation();
+	},
+	onOldDragdrop: function(aEvent){
+		aEvent.stopPropagation();
+	},
+	onOldDragexit: function(aEvent){
+		aEvent.stopPropagation();
+	},
+
+/////////////////////////////////////////////////////////////////////
+// Drag & Drop New Callback functions
+/////////////////////////////////////////////////////////////////////
+	onDragEvents: function(aEvent){},
+
+	onDragStart : function(event){},
+
+	onDropEvents: function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	onBrowserMousedown : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	capture : function(aXferString, aRow, aOrient){},
+
+/////////////////////////////////////////////////////////////////////
+	getObjectFromID : function(aID){
+		if(this.itemObjects){
+			var objects = this.itemObjects.filter(
+				function(element, index, array) {
+					return element.id == (aID=='0'?'all':aID);
+				}
+			);
+			if(objects && objects.length>0) return objects[0];
+		}
+		return undefined;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	refresh : function(){
+		if(this._refresh_timer) clearTimeout(this._refresh_timer);
+		this._refresh_timer = setTimeout(function(){ bitsTreeDate._refresh(); },100);
+	},
+
+	_refresh : function(){
+		var idx = this.TREE.currentIndex;
+		var rows = this.getSelection();
+		this.rebuild();
+		try{this.TREE.currentIndex=idx;}catch(e){}
+		if(!this.itemObjects) return;
+		try{
+			var i;
+			for(i=0;i<rows.length;i++){
+				if(!this.TREE.view.selection.isSelected(rows[i])) this.TREE.view.selection.select(rows[i]);
+			}
+		}catch(e){}
+		bitsItemView.refresh();
+	},
+
+	rebuild : function(){
+		if(!this._init) return;
+		try{this.TREE.currentIndex = -1;}catch(e){}
+		try{this.TREE.view.selection.clearSelection();}catch(e){}
+		if(this.itemObjects){
+			this.itemObjects.length = 0;
+		}else{
+			this.itemObjects = [];
+		}
+		var flash_flag = false;
+		var elem_id = 'all';
+		var obj_db = {
+			id : elem_id,
+			text : 'All',
+			container : true,
+			open : true,
+			empty : false,
+			level : 0,
+			parentIndex : -1,
+			hasNext : false,
+			childlen : []
+		};
+		var elems =  this.evaluateArray('//TREEDATE[@id="'+elem_id+'"]');
+		if(elems && elems.length){
+			obj_db.open = (elems[0].getAttribute("open")==="true");
+		}else{
+			var elem = this.xmldoc.ownerDocument.createElement('TREEDATE');
+			elem.setAttribute('id',elem_id);
+			elem.setAttribute('open',true);
+			this.xmldoc.appendChild(elem);
+			flash_flag = true;
+		}
+		this.itemObjects.push(obj_db);
+		var dbtype_pos = this.itemObjects.length-1;
+		var objects_year = this.Database.getObjectYear();
+		if(objects_year){
+			for(var i=0;i<objects_year.length;i++){
+				var objects_month = this.Database.getObjectMonthFromYear(objects_year[i]);
+				var elem_id = objects_year[i];
+				var obj_year = {
+					id : elem_id,
+					text : objects_year[i],
+					date : {
+						year : objects_year[i]
+					},
+					container : true,
+					open : false,
+					empty : false,
+					level : 1,
+					parentIndex : dbtype_pos,
+					hasNext : (i<objects_year.length-1)?true:false,
+					childlen : []
+				};
+				var elems =  this.evaluateArray('//TREEDATE[@id="'+elem_id+'"]');
+				if(elems && elems.length){
+					obj_year.open = (elems[0].getAttribute("open")==="true");
+				}else{
+					var elem = this.xmldoc.ownerDocument.createElement('TREEDATE');
+					elem.setAttribute('id',elem_id);
+					elem.setAttribute('open',false);
+					this.xmldoc.appendChild(elem);
+					flash_flag = true;
+				}
+				if(obj_db.open) this.itemObjects.push(obj_year);
+				var len = this.itemObjects.length-1;
+				for(var j=0;j<objects_month.length;j++){
+					var month_text = (new Date(objects_year[i],objects_month[j]-1,1)).toDateString().replace(/^\w+\s+(\w+)\s+\d+\s+\d+$/,"$1").toUpperCase();
+					var elem_id = objects_year[i]+objects_month[j];
+					var obj_month = {
+						id : elem_id,
+						text : month_text,
+						date : {
+							year  : objects_year[i],
+							month : objects_month[j]
+						},
+						container : true,
+						open : false,
+						empty : false,
+						level : 2,
+						parentIndex : i,
+						hasNext : (j<objects_month.length-1)?true:false,
+						childlen : []
+					};
+					var elems =  this.evaluateArray('//TREEDATE[@id="'+elem_id+'"]');
+					if(elems && elems.length){
+						obj_month.open = (elems[0].getAttribute("open")==="true");
+					}else{
+						var elem = this.xmldoc.ownerDocument.createElement('TREEDATE');
+						elem.setAttribute('id',elem_id);
+						elem.setAttribute('open',false);
+						this.xmldoc.appendChild(elem);
+						flash_flag = true;
+					}
+				if(obj_db.open && obj_year.open) this.itemObjects.push(obj_month);
+					var objects_day = this.Database.getObjectDayFromYearMonth(objects_year[i],objects_month[j]);
+					if(objects_day){
+						for(var k=0;k<objects_day.length;k++){
+							var dat_text = objects_day[k];
+							var elem_id = objects_year[i]+objects_month[j]+objects_day[k];
+							var obj_day = {
+								id : elem_id,
+								text : dat_text,
+								date : {
+									year  : objects_year[i],
+									month : objects_month[j],
+									day   : objects_day[k]
+								},
+								container : true,
+								open : false,
+								empty : true,
+								level : 3,
+								parentIndex : j,
+								hasNext : (k<objects_day.length-1)?true:false,
+								childlen : []
+							};
+							var elems =  this.evaluateArray('//TREEDATE[@id="'+elem_id+'"]');
+							if(elems && elems.length){
+								obj_day.open = (elems[0].getAttribute("open")==="true");
+							}else{
+								var elem = this.xmldoc.ownerDocument.createElement('TREEDATE');
+								elem.setAttribute('id',elem_id);
+								elem.setAttribute('open',false);
+								this.xmldoc.appendChild(elem);
+								flash_flag = true;
+							}
+							obj_month.childlen.push(obj_day);
+							if(obj_db.open && obj_year.open && obj_month.open) this.itemObjects.push(obj_day);
+						}
+					}
+					obj_year.childlen.push(obj_month);
+				}
+				this.itemObjects[dbtype_pos].childlen.push(obj_year);
+			}
+		}
+		if(flash_flag) this.xmlflash();
+		this.TREE.view = this;
+	},
+
+/////////////////////////////////////////////////////////////////////
+// TREE ã€ãã³ãé¢é£
+/////////////////////////////////////////////////////////////////////
+	onMousedown : function(aEvent){
+		this.TREE.removeAttribute("contextmenu");
+		if(aEvent.button == 2){	//å³ã¯ãªãã¯
+			var row = {};
+			var col = {};
+			var obj = {};
+			this.TREE.treeBoxObject.getCellAt(aEvent.clientX, aEvent.clientY, row, col, obj);
+			if(row.value>=0) this.TREE.setAttribute("contextmenu",this.POPUP.id);
+		}
+	},
+
+	onMousemove : function(aEvent){},
+
+	onMouseout : function(aEvent){},
+
+	onClick : function(aEvent){
+		var row = {};
+		var col = {};
+		var obj = {};
+		this.TREE.treeBoxObject.getCellAt(aEvent.clientX, aEvent.clientY, row, col, obj);
+		if(row.value<0){
+			this.TREE.view.selection.clearSelection();
+			return;
+		}
+		if(this.itemObjects && this.itemObjects[row.value]){
+			var viewmode = mcTreeViewModeService.viewmode;
+			var param = {
+				viewmode : viewmode,
+				dbtype : this.itemObjects[row.value].dbtype,
+				where    : []
+			};
+			if(window.top.bitsMarkingCollection._uncategorized.use){
+				param.res = this.Common.RDF.GetResource(this.DataSource.getID2About("0",undefined,window.top.bitsMarkingCollection._uncategorized.dbtype));
+			}
+			if(this.itemObjects[row.value].date){
+				param.where.push({
+					key : "substr(om_object.oid_date,7,4)",
+					val : this.itemObjects[row.value].date.year
+				});
+				if(this.itemObjects[row.value].date.month){
+					param.where.push({
+						key : "substr(om_object.oid_date,1,2)",
+						val : this.itemObjects[row.value].date.month
+					});
+					if(this.itemObjects[row.value].date.day){
+						param.where.push({
+							key : "substr(om_object.oid_date,4,2)",
+							val : this.itemObjects[row.value].date.day
+						});
+					}
+				}
+			}
+			bitsItemView.onTreeDateClick(param);
+			bitsItemView.TREE.currentIndex = 0;
+			try{
+				if(!bitsItemView.TREE.view.selection.isSelected(bitsItemView.TREE.currentIndex)) bitsItemView.TREE.view.selection.select(bitsItemView.TREE.currentIndex);
+				if(bitsItemView.itemObjects && bitsItemView.itemObjects[bitsItemView.TREE.currentIndex]){
+					var objs = bitsItemView.Database.getObject({oid:bitsItemView.itemObjects[bitsItemView.TREE.currentIndex].oid}, bitsItemView.itemObjects[bitsItemView.TREE.currentIndex].dbtype);
+					if(objs && objs.length>0) mcPropertyView.dispProperty(objs[0]);
+				}
+			}catch(e){
+				this._dump("bitsTreeDate.onClick():"+e);
+				setTimeout(function(){
+					if(bitsItemView.TREE.view && !bitsItemView.TREE.view.selection.isSelected(bitsItemView.TREE.currentIndex)) bitsItemView.TREE.view.selection.select(bitsItemView.TREE.currentIndex);
+					if(bitsItemView.itemObjects && bitsItemView.itemObjects[bitsItemView.TREE.currentIndex]){
+						var objs = bitsItemView.Database.getObject({oid:bitsItemView.itemObjects[bitsItemView.TREE.currentIndex].oid}, bitsItemView.itemObjects[bitsItemView.TREE.currentIndex].dbtype);
+						if(objs && objs.length>0) mcPropertyView.dispProperty(objs[0]);
+					}
+				},1000);
+			}
+		}
+
+		//ããŸããªã
+		this.TREE.blur();
+		this.TREE.focus();
+	},
+
+	onDblClick : function(aEvent){},
+
+	onKeyPress : function(aEvent){},
+
+	onKeyDown : function(aEvent){},
+
+	onSelectTab : function(aObject){
+		if(!this._init) return;
+		if(bitsItemView.TREE_IFOLDER.hidden) bitsItemView.TREE_IFOLDER.hidden = false;
+		if(bitsItemView.TREE_IFOLDERSTYLE.hidden) bitsItemView.TREE_IFOLDERSTYLE.hidden = false;
+		var dbtype = undefined;
+		if(this.itemObjects && aObject){
+			dbtype = aObject.dbtype;
+			delete aObject.dbtype;
+			var objects = this.Database.getObject(aObject, dbtype);
+			if(objects && objects.length>0){
+				var year = objects[0].oid_date.substr(6,4);
+				var month = objects[0].oid_date.substr(0,2);
+				var day = objects[0].oid_date.substr(3,2);
+				var len = this.itemObjects.length;
+				var exists = false;
+				var target_id = year+month+day;
+				var id = year+month+day;
+				var selectIdx = -1;
+				for(var i=0;i<len;i++){
+					if(this.itemObjects[i].id != id) continue;
+					exists = true;
+					selectIdx = i;
+					break;
+				}
+				if(!exists){
+					id = year+month;
+					for(var i=0;i<len;i++){
+						if(this.itemObjects[i].id != id) continue;
+						exists = true;
+						selectIdx = i;
+						break;
+					}
+				}
+				if(!exists){
+					id = year;
+					for(var i=0;i<len;i++){
+						if(this.itemObjects[i].id != id) continue;
+						exists = true;
+						selectIdx = i;
+						break;
+					}
+				}
+				if(selectIdx>=0){
+					if(this.isContainer(selectIdx) && !this.isContainerOpen(selectIdx)) this.toggleOpenState(selectIdx);
+					if(target_id != id){
+						aObject.dbtype = dbtype;
+						setTimeout(function(){ bitsTreeDate.onSelectTab(aObject); },100);
+						return;
+					}else{
+						this.TREE.currentIndex = selectIdx;
+						if(!this.TREE.view.selection.isSelected(this.TREE.currentIndex)) this.TREE.view.selection.select(this.TREE.currentIndex);
+					}
+				}
+			}
+		}
+		var idx = this.TREE.currentIndex;
+		var rows = this.getSelection();
+		if(rows && rows.length && rows[0]<this.rowCount){
+			var row = {value:rows[0]};
+			var viewmode = mcTreeViewModeService.viewmode;
+			var param = {
+				viewmode : viewmode,
+				dbtype   : this.itemObjects[row.value].dbtype,
+				where    : [],
+			};
+			if(window.top.bitsMarkingCollection._uncategorized.use){
+				param.res = this.Common.RDF.GetResource(this.DataSource.getID2About("0",undefined,window.top.bitsMarkingCollection._uncategorized.dbtype));
+			}
+			if(this.itemObjects && this.itemObjects[row.value]){
+				if(this.itemObjects[row.value].date){
+					param.where.push({
+						key : "substr(om_object.oid_date,7,4)",
+						val : this.itemObjects[row.value].date.year
+					});
+					if(this.itemObjects[row.value].date.month){
+						param.where.push({
+							key : "substr(om_object.oid_date,1,2)",
+							val : this.itemObjects[row.value].date.month
+						});
+						if(this.itemObjects[row.value].date.day){
+							param.where.push({
+								key : "substr(om_object.oid_date,4,2)",
+								val : this.itemObjects[row.value].date.day
+							});
+						}
+					}
+				}
+			}
+			bitsItemView.onTreeDateClick(param);
+		}else{
+			bitsItemView.onTreeDateClick();
+		}
+		if(aObject && aObject.oid){
+			setTimeout(function(){ mcItemView.setSelection(aObject.oid,dbtype); },0);
+		}else{
+			setTimeout(function(){
+				if(!bitsItemView.TREE.view) return;
+				bitsItemView.TREE.currentIndex = 0;
+				if(!bitsItemView.TREE.view.selection.isSelected(bitsItemView.TREE.currentIndex)) bitsItemView.TREE.view.selection.select(bitsItemView.TREE.currentIndex);
+				if(bitsItemView.itemObjects && bitsItemView.itemObjects[bitsItemView.TREE.currentIndex]){
+					var objs = bitsItemView.Database.getObject({oid:bitsItemView.itemObjects[bitsItemView.TREE.currentIndex].oid}, bitsItemView.itemObjects[bitsItemView.TREE.currentIndex].dbtype);
+					if(objs && objs.length>0) mcPropertyView.dispProperty(objs[0]);
+				}
+			},0);
+		}
+	},
+
+	onSelectTabs : function(aEvent){
+		if(!this._init) return;
+		mcPropertyView.dispProperty();
+		if(aEvent.target.selectedItem.id == this.idTREE_TAB){
+			this.onSelectTab();
+		}else{
+			mcItemView.onTreeClick();
+			mcPropertyView.dispProperty(mcTreeHandler.object);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+// TREE é¢é£
+/////////////////////////////////////////////////////////////////////
+	copy : function(aMode){},
+
+	open : function(tabbed){},
+
+	confirmRemovingFor : function(){},
+
+	setSelection : function(aOID,aDBTYPE){},
+
+	getSelection : function(){
+		if(!this.TREE || !this.TREE.view) return undefined;
+		var ret = [];
+		var rc;
+		var i;
+		for(rc=0;rc<this.TREE.view.selection.getRangeCount();rc++){
+			var start = {}, end = {};
+			this.TREE.view.selection.getRangeAt(rc, start, end);
+			for(i=start.value;i<= end.value;i++){
+				if(!this.TREE.view.selection.isSelected(i)) continue;
+				ret.push(i);
+			}
+		}
+		return ret;
+	},
+
+	validateMultipleSelection : function(aIdxList){},
+
+	mergeObject : function(aFolder){},
+
+	copyObject : function(aFolder){},
+
+	moveObject : function(aFolder,aModShift){},
+
+	remove : function(aEvent){},
+
+	pageshow : function(aDoc){},
+
+	getElemOffsetHeight : function(elem,height){},
+
+	getElementById : function(pElemId){},
+
+	doTopElement : function(pElemId,aStyle,aID,aDBType){},
+
+	doTopElementIMG : function(aID,aDBType){},
+
+	changeNodeStyleFromID : function(aID,aStyle,pPfid){},
+
+	property : function(){},
+
+////////////////////////////////////////////////////////////////////
+// TREE ãã©ãã°ã€ãã³ãé¢é£
+/////////////////////////////////////////////////////////////////////
+	getModifiers : function(aEvent){},
+
+	dragDropObserver : {
+		onDragStart : function(event, transferData, action){},
+		getSupportedFlavours : function(){},
+		onDragOver : function(event, flavour, session){},
+		onDragExit : function(event, session){},
+		onDrop     : function(event, transferData, session){}
+	},
+
+/////////////////////////////////////////////////////////////////////
+// Popup ã€ãã³ãé¢é£
+/////////////////////////////////////////////////////////////////////
+	onPopupShowing : function(aEvent){},
+
+	onPopupHiding : function(aEvent){},
+
+	onPopupCommand : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	onSearchKeyPress : function(aEvent){},
+
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treedateSidebarOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treedateSidebarOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treedateSidebarOverlay.xul	(revision 5703)
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/sidebar.css" type="text/css"?>
+<!DOCTYPE overlay [
+<!ENTITY % markingcollectionDTD SYSTEM "chrome://markingcollection/locale/markingcollection.dtd" >
+%markingcollectionDTD;
+<!ENTITY % metaDTD SYSTEM "chrome://markingcollection/locale/meta.dtd" >
+%metaDTD;
+<!ENTITY % treecontextmenuDTD SYSTEM "chrome://markingcollection/locale/treecontextmenu.dtd" >
+%treecontextmenuDTD;
+]>
+<overlay
+	id="treedateOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://global/content/nsJSSupportsUtils.js"/>
+	<script type="application/x-javascript" src="chrome://global/content/nsJSComponentManager.js"/>
+	<script type="application/x-javascript" src="chrome://markingcollection/content/treedate.js"/>
+	<script type="application/x-javascript">
+	<![CDATA[
+	]]>
+	</script>
+	<box id="bitsSidebarBox">
+		<vbox id="bitsSidebarVBox">
+			<vbox id="mcTreeVBox">
+				<tabbox id="mcTreeTabbox">
+					<tabs id="mcTreeTabs" onselect="bitsTreeDate.onSelectTabs(event);">
+						<tab id="mcTreeTabDate" label="Date"/>
+					</tabs>
+					<tabpanels id="mcTreeTabpanels">
+						<tabpanel id="mcTreeTabpanelDate">
+							<tree
+								id="bitsTreeDate"
+								onclick="bitsTreeDate.onClick(event);"
+								onmousedown="bitsTreeDate.onMousedown(event);"
+								seltype="single"
+								editable="false"
+								hidecolumnpicker="true"
+								contextmenu="mcPopupDateFolder"
+								class="plain"
+								flex="1">
+								<treecols>
+									<treecol id="bitsTreeDateTreecolDate" hideheader="true" ignoreincolumnpicker="true" primary="true" flex="1"/>
+								</treecols>
+								<treechildren/>
+							</tree>
+						</tabpanel>
+					</tabpanels>
+				</tabbox>
+			</vbox>
+		</vbox>
+	</box>
+	<popupset id="mcPopupSet">
+		<popup
+			id="mcPopupDateFolder"
+			onpopupshowing="bitsTreeDate.onPopupShowing(event);"
+			onpopuphiding="bitsTreeDate.onPopupHiding(event);">
+			<menu
+				id="mcPopupDateFolderViewMenu"
+				class="menu-iconic"
+				image="chrome://markingcollection/skin/view.png"
+				label="&treecontextmenu.view;">
+				<menupopup>
+					<menuitem
+						id="mcPopupDateFolderListView"
+						class="menuitem-iconic"
+						label="&treecontextmenu.view.list;"
+						image="chrome://markingcollection/skin/list.png"
+						oncommand="window.top.bitsTreeListService.dispList(event,'chrome://markingcollection/content/listview_drag.xsl');"/>
+					<menu
+						id="mcPopupDateFolderTreeListViewMenu"
+						class="menu-iconic"
+						label="&markingcollection.treelistview;"
+						image="chrome://markingcollection/skin/toolbar_listview.png">
+						<menupopup
+							id="mcPopupDateFolderTreeListViewMenuPopup"
+							onpopupshowing="window.top.bitsTreeListService.onPopupShowing(event);"
+							onpopuphiding="window.top.bitsTreeListService.onPopupHiding(event);"
+							oncommand="window.top.bitsTreeListService.onCommand(event);">
+							<menuitem
+								id="mcPopupDateFolderTreeListView"
+								class="menuitem-iconic"
+								label="&markingcollection.treelistview.defaults;"
+								image="chrome://markingcollection/skin/stylesheet.png"
+								oncommand="window.top.bitsTreeListService.dispList(event);"/>
+							<menuseparator observes="mcPopupDateFolderTreeListViewSeparator"/>
+						</menupopup>
+					</menu>
+				</menupopup>
+			</menu>
+		</popup>
+	</popupset>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeexport.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeexport.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeexport.js	(revision 5703)
@@ -0,0 +1,763 @@
+var bitsTreeExportService = {
+	_openurl : "",
+	_doc     : null,
+	_loaddoc : null,
+	_url     : "",
+	_fileid  : "",
+	_savehtml : [],
+	appDataDir  : null,
+	appDataURL  : "",
+	appDataSTRING : "",
+	appDataURLExp : null,
+	zipApp : null,
+	zipAppScript : null,
+
+/////////////////////////////////////////////////////////////////////
+	get STRING() { return document.getElementById("MarkingCollectionOverlayString"); },
+
+	get DataSource() { return window.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.top.bitsObjectMng.Common;     },
+	get Database()   { return window.top.bitsObjectMng.Database;   },
+	get XML()        { return window.top.bitsObjectMng.XML;        },
+	get gBrowser()   { return window.top.bitsObjectMng.getBrowser();},
+
+	get xmldoc(){ return this._xmldoc; },
+
+	get appDataAddSTRING(){ return ".cache_files"; },
+
+/////////////////////////////////////////////////////////////////////
+	init : function(){
+		try{
+			this.appDataDir = window.top.bitsMarkingCollection.getExtensionDir().clone();
+			this.appDataURL = this.Common.convertFilePathToURL(this.appDataDir.path);
+			this.appDataURL = this.appDataURL.replace(/\/$/mg,"");
+			this.appDataSTRING = "";
+			this.appDataURLExp = new RegExp("^"+this.appDataURL);
+			var paths;
+			var zipapp;
+			var env_path = this.Common.ENV.get("PATH");
+			if(navigator.platform == "Win32"){
+//				paths = env_path.split(';');
+//				zipapp = "CScript.exe";
+			}else{
+				paths = env_path.split(':');
+				zipapp = "zip";
+			}
+			if(paths){
+				var i;
+				for(i=0;i<paths.length;i++) {
+					try {
+					  var zfile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
+						zfile.initWithPath(paths[i]);
+						zfile.append(zipapp);
+						if(zfile.exists()){
+							this.zipApp = zfile.clone();
+							if(navigator.platform == "Win32"){
+								var zipAppScript = window.top.bitsMarkingCollection.getExtInstDir().clone();
+								if(zipAppScript){
+									zipAppScript.append("bin");
+									zipAppScript.append("makeZIP.vbs");
+									if(zipAppScript.exists()) this.zipAppScript = zipAppScript.clone();
+									zipAppScript = undefined;
+								}
+							}
+							break;
+						}
+					}
+					catch(ex2) {}
+					zfile = undefined;
+				}
+			}
+		}catch(ex){
+			this._dump("bitsTreeExportService.init():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(){},
+
+/////////////////////////////////////////////////////////////////////
+	load : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	unload : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	click : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	blur : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	onPopupShowing : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	onPopupHiding : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	onCommand : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	validateFileName : function(aFileName){
+		var re = /[\/]+/g;
+		if (navigator.appVersion.indexOf("Windows") != -1) {
+			re = /[\\\/\|]+/g;
+			aFileName = aFileName.replace(/[\"]+/g, "'");
+			aFileName = aFileName.replace(/[\*\:\?]+/g, " ");
+			aFileName = aFileName.replace(/[\<]+/g, "(");
+			aFileName = aFileName.replace(/[\>]+/g, ")");
+			aFileName = aFileName.replace(/[\"\?!~`]+/g, "");
+			aFileName = aFileName.replace(/[\*\&]+/g, "+");
+			aFileName = aFileName.replace(/[\\\/\|\:;]+/g, "-");
+			aFileName = aFileName.replace(/[\<]+/g, "(");
+			aFileName = aFileName.replace(/[\>]+/g, ")");
+			aFileName = aFileName.replace(/[\s]+/g, "_");
+			aFileName = aFileName.replace(/[%]+/g, "@");
+		}else if (navigator.appVersion.indexOf("Macintosh") != -1)
+			re = /[\:\/]+/g;
+		return aFileName.replace(re, "_");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getSaveFile : function (aTitle){
+		var picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
+		var result = null;
+		try{
+			picker.init(window, "Selected Save File ["+aTitle+"]", picker.modeSave);
+			if(aTitle) picker.defaultString  = aTitle + ".xml";
+			picker.defaultExtension = ".xml";
+			picker.appendFilter("XML (*.xml)","*.xml");
+			picker.appendFilter("All Files (*.*)","*.xml");
+			var showResult = picker.show();
+			if(showResult == picker.returnOK){
+				result = picker.file;
+			}else if(showResult == picker.returnReplace){
+				if(picker.file.exists()) picker.file.remove(false);
+				result = picker.file;
+			}
+		}catch(e){
+			result = null;
+			this.Common.alert(e);
+		}
+		return result;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getSaveFolder : function (aTitle){
+		var picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
+		var result = null;
+		try{
+			picker.init(window, "Selected Exports Folder ["+aTitle+"]", picker.modeGetFolder);
+			if(aTitle) picker.defaultString  = aTitle;
+			var showResult = picker.show();
+			if(showResult == picker.returnOK){
+				result = picker.file;
+			}else if(showResult == picker.returnReplace){
+				if(picker.file.exists()) picker.file.remove(false);
+				result = picker.file;
+			}
+		}catch(e){
+			result = null;
+			this.Common.alert(e);
+		}
+		return result;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getTemplateDir : function(){},
+
+/////////////////////////////////////////////////////////////////////
+	createMenu : function(aParentNode,aEntry){},
+
+/////////////////////////////////////////////////////////////////////
+	loadText : function(aURI){},
+
+/////////////////////////////////////////////////////////////////////
+	_getZipEntry : function(aZipEntry){
+		return escape(aZipEntry);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	addEntryDirectory : function(aZipWriter,aDir,aParentPath){
+		var entries = aDir.directoryEntries;
+		while(entries.hasMoreElements()){
+			var pDir = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+			if(!pDir.isDirectory()) continue;
+			var entryName = (aParentPath?aParentPath+"/":"") + pDir.leafName;
+			if(!aZipWriter.hasEntry(this._getZipEntry(entryName))) aZipWriter.addEntryDirectory(this._getZipEntry(entryName), pDir.lastModifiedTime, false);
+			this.addEntryDirectory(aZipWriter, pDir, entryName);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	addEntryFile : function(aZipWriter,aDir,aParentPath){
+		var entries = aDir.directoryEntries;
+		while(entries.hasMoreElements()){
+			var pDir = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+			var entryName = (aParentPath?aParentPath+"/":"") + pDir.leafName;
+			if(pDir.isDirectory()){
+				this.addEntryFile(aZipWriter, pDir, entryName);
+			}else{
+				if(!aZipWriter.hasEntry(this._getZipEntry(entryName))) aZipWriter.addEntryFile(this._getZipEntry(entryName), Components.interfaces.nsIZipWriter.COMPRESSION_FASTEST, pDir, false);
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	saveFile : function(aEvent){
+		try{
+			aEvent.preventDefault();
+			aEvent.stopPropagation();
+			this._savehtml.length = 0;
+			this._savehtml = [];
+			var contentWindow = null;
+			var mcTreeHandler = null;
+			if(bitsMarkingCollection._contentWindow) contentWindow = bitsMarkingCollection._contentWindow;
+			if(contentWindow && contentWindow.mcTreeHandler) mcTreeHandler = contentWindow.mcTreeHandler;
+			if(!mcTreeHandler) return;
+			var curIdx = mcTreeHandler.TREE.currentIndex;
+			if(curIdx<0) return;
+			var aRes = null;
+			if(!mcTreeHandler.TREE.view.isContainer(curIdx)) return;
+			aRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+			var fid = this.DataSource.getProperty(aRes,"id");
+			var dbtype = this.DataSource.getProperty(aRes,"dbtype");
+			if(fid != "0"){
+				var foldres = this.Database.getFolderFormID(fid,dbtype);
+				if(foldres) this._saveFile(foldres[0]);
+			}else{
+				this._saveFile({fid:fid,dbtype:dbtype,fid_title:this.DataSource.getProperty(aRes,"title"),fid_property:""});
+			}
+		}catch(ex){
+			this.Common.alert("bitsTreeExportService.saveFile():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createXMLDoc : function(aContent){
+		var parser = new DOMParser();
+		this._xmldoc = parser.parseFromString(aContent, "text/xml");
+		parser = undefined;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	xmlSerializer : function(){
+		var s = new XMLSerializer();
+		var aContent = s.serializeToString(this.xmldoc);
+		s = undefined;
+		return aContent;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_saveFile : function(aFolder){
+		try{
+			var prompts = this.Common.PROMPT;
+			var title = this.STRING.getString("APP_DISP_TITLE");
+			var flags = prompts.BUTTON_POS_0 * prompts.BUTTON_TITLE_YES +
+			            prompts.BUTTON_POS_1 * prompts.BUTTON_TITLE_NO +
+			            prompts.BUTTON_POS_0_DEFAULT;
+			var checkMsg = this.STRING.getString("CHECK_EXPORT_IN_CACHE_DOCUMENT");
+			var checkState = {value: false};
+			var button = prompts.confirmEx(
+										window,
+										title,
+										this.STRING.getString("CONFIRM_EXPORT"),
+										flags, "", "", "", checkMsg, checkState);
+			if(button!=0) return;
+			var cache_export = checkState.value;
+			var saveFolder = this.getSaveFolder(aFolder.fid_title);
+			if(!saveFolder) return;
+			var tmpDir = window.top.bitsMarkingCollection.getTmpDir().clone();
+			tmpDir.append(this.STRING.getString("APP_TITLE"));
+			tmpDir.createUnique(tmpDir.DIRECTORY_TYPE, 0777);
+			tmpDir.append(this._getZipEntry(this.validateFileName(aFolder.fid_title)));
+			if(tmpDir.exists()) tmpDir.remove(true);
+			if(!tmpDir.exists()) tmpDir.create(tmpDir.DIRECTORY_TYPE, 0777);
+			var file = tmpDir.clone();
+			file.append(this._getZipEntry(this.validateFileName(aFolder.fid_title))+".xml");
+			var leafName = unescape(file.leafName);
+			var filename = this.Common.splitFileName(leafName)[0];
+			this.appDataSTRING = this.appDataAddSTRING;
+			var aContent = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
+			var aURL = this.Common.convertURLToObject("chrome://markingcollection/content/treeexport.xsl");
+			var stylesheet = bitsTreeListService.loadText(aURL);
+			if(stylesheet && stylesheet != ""){
+				var type = "xsl";
+				aContent += '<?xml-stylesheet type="text/'+type+'" href="#treeexport"?>\n';
+			}
+			aContent += '<!DOCTYPE LIST';
+			aContent += '[\n';
+			aContent += '  <!ATTLIST xsl:stylesheet id ID #REQUIRED>\n';
+			aContent += ']';
+			aContent += '>\n<LIST title="'+ this.xmlEncode(aFolder.fid_title) +'">\n';
+			if(stylesheet && stylesheet != "") aContent += stylesheet+'\n';
+			aContent += "</LIST>\n";
+			this.createXMLDoc(aContent);
+			bitsTreeExportService.createID2OBJ(aFolder);
+			bitsTreeExportService.createXML(aFolder,this.xmldoc.documentElement);
+			if(cache_export){
+				var urlhash = {};
+				var oid;
+				for(oid in this.id2obj){
+					if(urlhash[this.id2obj[oid].uri]) continue;
+					urlhash[this.id2obj[oid].uri] = true;
+					var histdbs = window.top.bitsAutocacheService._selectHistoryDB({uid_url:this.id2obj[oid].uri});
+					if(!histdbs) continue;
+					var histcnt;
+					for(histcnt=0;histcnt<histdbs.length;histcnt++){
+						var cacheDir = window.top.bitsAutocacheService.getURLCacheDirFromTimeStamp(histdbs[histcnt].uid_url,histdbs[histcnt].hid_date);
+						if(!cacheDir || !cacheDir.exists()) continue;
+						this._savehtml.push(cacheDir.clone());
+					}
+				}
+				urlhash = undefined;
+			}
+			aContent = this.xmlSerializer();
+			this.Common.writeFile(file, aContent, "UTF-8");
+			try{
+				var nsIZipWriter = Components.interfaces.nsIZipWriter;
+				var zipWriter = Components.classes["@mozilla.org/zipwriter;1"].createInstance(nsIZipWriter);
+			}catch(e){}
+			var zipFile;
+			if(zipWriter){
+				var parent = tmpDir.parent.clone();
+				zipFile = saveFolder.clone();
+				zipFile.append(filename+".zip");
+				if(zipFile.exists()){
+					var filecnt;
+					for(filecnt=1;;filecnt++){
+						zipFile = saveFolder.clone();
+						zipFile.append(filename+"("+filecnt+")"+".zip");
+						if(!zipFile.exists()) break;
+					}
+				}
+				if(!zipFile.exists()) zipFile.create(zipFile.NORMAL_FILE_TYPE, 0664);
+				zipWriter.open(zipFile, 0x04 | 0x08 | 0x20);
+				this.addEntryDirectory(zipWriter, parent);
+				this.addEntryFile(zipWriter, parent);
+			}
+			var savePath = null;
+			if(this._savehtml.length>0){
+				var i;
+				if(zipWriter){
+					for(i=0;i<this._savehtml.length;i++){
+						var cachedir = this._savehtml[i].clone();
+						if(!cachedir.exists()) continue;
+						var parentPath = tmpDir.leafName + "/" + this.appDataSTRING + "/" + cachedir.parent.leafName + "/" + cachedir.leafName;
+						this.addEntryDirectory(zipWriter,cachedir,parentPath);
+						this.addEntryFile(zipWriter,cachedir,parentPath);
+					}
+				}else{
+					savePath = file.parent.clone();
+					savePath.append(this.appDataSTRING);
+					if(savePath.exists()) savePath.remove(true);
+					savePath.create(savePath.DIRECTORY_TYPE, 0777);
+					for(i=0;i<this._savehtml.length;i++){
+						var cachedir = this._savehtml[i].clone();
+						if(!cachedir.exists()) continue;
+						var sevaCachePath = savePath.clone();
+						sevaCachePath.append(cachedir.parent.leafName);
+						if(!sevaCachePath.exists()) sevaCachePath.create(sevaCachePath.DIRECTORY_TYPE, 0777);
+						var copypath = sevaCachePath.clone();
+						copypath.append(cachedir.leafName);
+						if(copypath.exists()) copypath.remove(true);
+						try{
+							cachedir.copyTo(sevaCachePath,cachedir.leafName);
+						}catch(e){
+							this._dump("bitsTreeExportService.saveFile():"+e);
+							if(!copypath.exists()) copypath.create(copypath.DIRECTORY_TYPE, 0777);
+							this.Common.copyDirChilds(cachedir,copypath);
+						}
+					}
+				}
+			}
+			var zipFile;
+			if(zipWriter){
+				var parent = tmpDir.parent.clone();
+				zipWriter.close();
+				if(parent.exists()) parent.remove(true);
+			}else if(this.zipApp){
+				try{
+					var LANG = this.Common.getLang();
+					var args = [];
+					if(this.zipAppScript) args.push(this.Common.convertFormUnicode(this.zipAppScript.path,LANG));
+					if(navigator.platform == "Win32") args.push("//Nologo");
+					zipFile = saveFolder.clone();
+					zipFile.append(filename+".zip");
+					if(zipFile.exists()){
+						var filecnt;
+						for(filecnt=1;;filecnt++){
+							zipFile = saveFolder.clone();
+							zipFile.append(filename+"("+filecnt+")"+".zip");
+							if(!zipFile.exists()) break;
+						}
+					}
+					args.push(this.Common.convertFormUnicode(zipFile.path,LANG));
+					if(navigator.platform == "Win32"){
+						args.push(this.Common.convertFormUnicode(tmpDir.path,LANG));
+					}else{
+						args.push("-r");
+						args.push(this.Common.convertFormUnicode(tmpDir.path,LANG));
+					}
+					var proc = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
+					proc.init(this.zipApp);
+					proc.run(true, args, args.length);
+					if(tmpDir.parent.exists()) tmpDir.parent.remove(true);
+				}catch(ex2){
+					this.Common.alert("bitsTreeExportService._saveFile():"+ex2);
+					if(zipFile && zipFile.exists()) zipFile.remove(true);
+					var parent = tmpDir.parent.clone();
+					zipFile = saveFolder.clone();
+					zipFile.append(tmpDir.leafName);
+					if(zipFile.exists()){
+						var filecnt;
+						for(filecnt=1;;filecnt++){
+							zipFile = saveFolder.clone();
+							zipFile.append(tmpDir.leafName+"("+filecnt+")");
+							if(!zipFile.exists()) break;
+						}
+					}
+					tmpDir.moveTo(saveFolder,zipFile.leafName);
+					if(parent.exists()) parent.remove(true);
+				}
+			}else{
+				var parent = tmpDir.parent.clone();
+				zipFile = saveFolder.clone();
+				zipFile.append(unescape(tmpDir.leafName));
+				if(zipFile.exists()){
+					var filecnt;
+					for(filecnt=1;;filecnt++){
+						zipFile = saveFolder.clone();
+						zipFile.append(unescape(tmpDir.leafName)+"("+filecnt+")");
+						if(!zipFile.exists()) break;
+					}
+				}
+				tmpDir.moveTo(saveFolder,zipFile.leafName);
+				if(parent.exists()) parent.remove(true);
+			}
+			var msg = this.STRING.getString("SUCCEEDED_EXPORT") + "\n";
+			if(zipFile && zipFile.exists()){
+				msg += zipFile.path;
+			}else{
+				msg += saveFolder.path;
+			}
+			var prompts = this.Common.PROMPT;
+			var flags = prompts.BUTTON_TITLE_OK + prompts.BUTTON_POS_0_DEFAULT;
+			var button = prompts.confirmEx(window, bitsTreeExportService.STRING.getString("APP_TITLE"), msg, flags, "", "", "", null, {});
+		}catch(ex){
+			this.Common.alert("bitsTreeExportService._saveFile():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getBaseDir : function(){
+		var dir  = window.top.bitsMarkingCollection.getExtensionDir().clone();
+		dir.append("treelist");
+		if(!dir.exists()) dir.create(dir.DIRECTORY_TYPE, 0700);
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getTreeListDir : function(){
+		var dir  = this.getBaseDir().clone();
+		dir.append(this._fileid);
+		if(!dir.exists()) dir.create(dir.DIRECTORY_TYPE, 0700);
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	xmlEncode : function(aString){
+		return aString.replace(/&/mg,"&amp;").replace(/</mg,"&lt;").replace(/>/mg,"&gt;").replace(/\"/mg,"&quot;");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_getAllObject : function(aFolder){
+		var rtn = [];
+		var Foldres = this.Database.getFolderFormPID(aFolder.fid,aFolder.dbtype,false);
+		if(Foldres){
+			var aocnt;
+			for(aocnt=0;aocnt<Foldres.length;aocnt++){
+				rtn = rtn.concat(this._getAllObject(Foldres[aocnt]));
+			}
+		}
+		var Objects = this.Database.getObjectFormPID(aFolder.fid,aFolder.dbtype,false);
+		if(Objects) rtn = rtn.concat(Objects);
+		return rtn;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_getAllFolder : function(aFolder){
+		var rtn = [];
+		var Foldres = this.Database.getFolderFormPID(aFolder.fid,aFolder.dbtype,false);
+		if(Foldres){
+			var aocnt;
+			for(aocnt=0;aocnt<Foldres.length;aocnt++){
+				rtn.push(Foldres[aocnt]);
+				rtn = rtn.concat(this._getAllFolder(Foldres[aocnt]));
+			}
+		}
+		return rtn;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_getAllChild : function(aFolder){
+		var rtn = [];
+		var Foldres = this.Database.getFolderFormPID(aFolder.fid,aFolder.dbtype,false);
+		if(Foldres){
+			Foldres.sort(function(a,b){ return a.pfid_order - b.pfid_order; });
+			rtn = rtn.concat(Foldres);
+		}
+		var Objects = this.Database.getObjectFormPID(aFolder.fid,aFolder.dbtype,false);
+		if(Objects){
+			Objects.sort(function(a,b){ return a.pfid_order - b.pfid_order; });
+			rtn = rtn.concat(Objects);
+		}
+		return rtn;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createID2OBJ : function(aFolder){
+		var id2obj = {};
+		var fid2style = {};
+		var contResList = this._getAllObject(aFolder);
+		if(contResList.length>0){
+			var ocnt;
+			for(ocnt=0;ocnt<contResList.length;ocnt++){
+				var oid = contResList[ocnt].oid;
+				if(id2obj[oid] != undefined) continue;
+				var dbtype = contResList[ocnt].dbtype;
+				var objects = this.Database.getObjectWithProperty({oid:oid},dbtype);
+				if(!objects) continue;
+				id2obj[oid] = {};
+				var i=0;
+				if(objects[i].oid_type.match(/^image\/(.+)$/)){
+					var blob = this.Database.getObjectBLOB(objects[i].oid,dbtype);
+					if(blob && blob.length>0 && blob[0].length>0){
+						var images = String.fromCharCode.apply(String, blob[0]);
+						var image_b64 = btoa(images); // base64 encoding
+						image_b64 = 'data:' + objects[i].oid_type + ';base64,' + image_b64;
+						id2obj[oid].img  = image_b64;
+						/* ã·ã¹ãã ã§ç®¡çããŠããã€ã¡ãŒãžã®å Žå */
+						var blobFile = this.Database.getObjectBLOBFile(objects[i].oid,dbtype);
+						var blobUrl = this.Common.convertFilePathToURL(blobFile.path);
+						if(objects[i].doc_url == blobUrl) objects[i].doc_url = image_b64;
+						if(objects[i].con_url == blobUrl) objects[i].con_url = image_b64;
+					}
+				}
+				id2obj[oid].text = objects[i].oid_txt;
+				id2obj[oid].uri = objects[i].doc_url;
+				id2obj[oid].uri_title = objects[i].doc_title;
+				id2obj[oid].con_url = objects[i].con_url;
+				id2obj[oid].type = objects[i].oid_type;
+				id2obj[oid].st = objects[i].bgn_dom;
+				id2obj[oid].en = objects[i].end_dom;
+				if(objects[i].oid_property && objects[i].oid_property != "") id2obj[oid].property = objects[i].oid_property;
+				id2obj[oid].dbtype = objects[i].dbtype;
+				id2obj[oid].date = objects[i].oid_date;
+				id2obj[oid].mode = objects[i].oid_mode;
+				if(fid2style[objects[i].pfid] == undefined){
+					var folders = this.Database.getFolderFormID(objects[i].pfid,dbtype);
+					if(folders && folders.length>0) fid2style[objects[i].pfid] = folders[0].fid_style.replace(/([:;\(,])\s+/mg,"$1");
+				}
+				if(fid2style[objects[i].pfid] != undefined) id2obj[oid].style = fid2style[objects[i].pfid];
+			}
+		}
+		contResList = undefined;
+		this.id2obj = id2obj;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createTextNode : function(aString,aParentNode){
+		if(aString && aString != ""){
+			var elemS = this.xmldoc.createTextNode(aString);
+			if(elemS) aParentNode.appendChild(elemS);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createElement : function(aTagName,aString,aParentNode,aTab){
+		if(!aTagName || !aParentNode) return;
+		if(aTab && aTab != ""){
+			var elemT = this.xmldoc.createTextNode(aTab);
+			if(elemT) aParentNode.appendChild(elemT);
+		}
+		var elem = this.xmldoc.createElement(aTagName);
+		if(elem){
+			if(aString){
+				if(aString != ""){
+					var elemS = this.xmldoc.createTextNode(aString);
+					if(elemS) elem.appendChild(elemS);
+				}
+			}else{
+				var elemR = this.xmldoc.createTextNode("\n");
+				if(elemR) elem.appendChild(elemR);
+			}
+			aParentNode.appendChild(elem)
+			var elemR = this.xmldoc.createTextNode("\n");
+			if(elemR) aParentNode.appendChild(elemR);
+		}
+		return elem;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createXML : function(aFolder,aParentNode,aDepth){
+		if(aDepth == undefined) aDepth = 0;
+		var aTab = "";
+		var i;
+		for(i=0;i<=aDepth;i++){
+			aTab += "  ";
+		}
+		var fNode = this.createElement("FOLDER",undefined,aParentNode,aTab);
+		this.createElement("FID_TITLE",aFolder.fid_title,fNode,aTab+"  ");
+		var fid_note = aFolder.fid_property;
+		if(fid_note && fid_note != ""){
+			var parser = new DOMParser();
+			var xmldoc = parser.parseFromString(fid_note, "text/xml");
+			parser = undefined;
+			if(xmldoc){
+				var elem = xmldoc.getElementsByTagName("NOTE")[0];
+				if(!elem) this.createElement("FID_NOTE",fid_note,fNode,aTab+"  ");
+				xmldoc = undefined;
+			}
+		}
+		if(aFolder.fid_mode) this.createElement("FID_MODE",aFolder.fid_mode,fNode,aTab+"  ");
+		if(aFolder.fid_property && aFolder.fid_property != ""){
+			var fid_property = aFolder.fid_property;
+			var xmldic = bitsTreeProjectService._getDictionaryXML(aFolder.fid,aFolder.dbtype);
+			if(xmldic){
+				var parser = new DOMParser();
+				var xmldoc = parser.parseFromString(fid_property, "text/xml");
+				if(xmldoc && xmldoc.documentElement.nodeName == "parsererror"){
+					xmldoc = undefined;
+					xmldoc = parser.parseFromString("<PROPERTY/>", "text/xml");
+					if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+				}
+				parser = undefined;
+				if(xmldoc){
+					var clone = xmldic.documentElement.cloneNode(true);
+					xmldoc.documentElement.appendChild(clone);
+					var s = new XMLSerializer();
+					fid_property = s.serializeToString(xmldoc);
+					s = undefined;
+				}
+			}
+			this.createElement("FID_PROPERTY",fid_property,fNode,aTab+"  ");
+		}
+		if(aFolder.fid_style && aFolder.fid_style != "") this.createElement("FID_STYLE",aFolder.fid_style,fNode,aTab+"  ");
+		if(aFolder.dbtype && aFolder.dbtype != "") this.createElement("FID_DBTYPE",aFolder.dbtype,fNode,aTab+"  ");
+		var contResList = this._getAllChild(aFolder);
+		var i;
+		for(i=0;i<contResList.length;i++){
+			if(contResList[i].fid != undefined){
+				bitsTreeExportService.createXML(contResList[i],fNode,aDepth+1);
+			}else{
+				bitsTreeExportService.createXMLObject(contResList[i],fNode,aDepth);
+			}
+		}
+		this.createTextNode(aTab,fNode);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createXMLObject : function(aObject,aParentNode,aDepth){
+		var id2obj = this.id2obj;
+		if(aDepth == undefined) aDepth = 0;
+		var aTab = "";
+		for(var i=0;i<=aDepth;i++){
+			aTab += "  ";
+		}
+		var oid = aObject.oid;
+		var alink = "";
+		var structure = "";
+		var hyperAnchor = "";
+		var disp_image_size_x = "";
+		var disp_image_size_y = "";
+		var disp_image_size = "";
+		var out_property = [];
+		var xmldoc;
+		var structureElem;
+		if(aObject.oid_property && aObject.oid_property != ""){
+			try{
+				var parser = new DOMParser();
+				xmldoc = parser.parseFromString(aObject.oid_property, "text/xml");
+				parser = undefined;
+			}catch(ex){}
+			if(xmldoc && xmldoc.documentElement.nodeName == "parsererror"){
+				id2obj[oid].property = "";
+				xmldoc = undefined;
+			}
+			if(xmldoc){
+				var xmlnode = xmldoc.getElementsByTagName("LINK")[0];
+				if(xmlnode) alink = xmlnode.textContent;
+				/* STRUCTUREå
+ã®ããŒã¿ã¯xhtmlã§æ ŒçŽãããŠããçºããã®ãŸãŸåºåãã */
+				xmlnode = xmldoc.getElementsByTagName("STRUCTURE")[0];
+				if(xmlnode && xmlnode.hasChildNodes()){
+					structureElem = xmlnode.cloneNode(true);
+				}
+				xmlnode = xmldoc.getElementsByTagName("IMG_LIST_DISP_SIZE")[0];
+				if(xmlnode){
+					disp_image_size = xmlnode.textContent;
+					if(disp_image_size.match(/^(\d+),(\d+)$/mg)){
+						disp_image_size_x = RegExp.$1;
+						disp_image_size_y = RegExp.$2;
+					}
+				}
+				xmlnode = xmldoc.getElementsByTagName("NOTE")[0];
+				if(xmlnode){
+					out_property["NOTE"] = {};
+					out_property["NOTE"].type  = "text";
+					out_property["NOTE"].value = xmlnode.textContent;
+				}
+				xmlnode = xmldoc.getElementsByTagName("HYPER_ANCHOR")[0];
+				if(xmlnode) hyperAnchor = xmlnode.textContent;
+			}
+		}
+		var oNode = this.createElement("OBJECT",undefined,aParentNode,aTab+"  ");
+		this.createElement("OID_TITLE",aObject.oid_title,oNode,aTab+"    ");
+		if(out_property["NOTE"]) this.createElement("OID_NOTE",out_property["NOTE"].value,oNode,aTab+"    ");
+		var tag;
+		for(tag in out_property){
+			if(typeof out_property[tag] == "function") continue;
+			this.createElement("OID_PROPERTY_"+ tag,out_property[tag].value,oNode,aTab+"    ");
+		}
+		if(disp_image_size_x && disp_image_size_y){
+			this.createElement("OID_IMG_DISP_WIDTH",disp_image_size_x,oNode,aTab+"    ");
+			this.createElement("OID_IMG_DISP_HEIGHT",disp_image_size_x,oNode,aTab+"    ");
+		}
+		if(id2obj[oid].img) this.createElement("OID_IMG",id2obj[oid].img,oNode,aTab+"    ");
+		if(id2obj[oid].uri) this.createElement("DOC_URL",id2obj[oid].uri,oNode,aTab+"    ");
+		if(id2obj[oid].uri_title) this.createElement("DOC_TITLE",id2obj[oid].uri_title,oNode,aTab+"    ");
+		if(id2obj[oid].st) this.createElement("BGN_DOM",id2obj[oid].st,oNode,aTab+"    ");
+		if(id2obj[oid].en) this.createElement("END_DOM",id2obj[oid].en,oNode,aTab+"    ");
+		if(id2obj[oid].con_url) this.createElement("CON_URL",id2obj[oid].con_url,oNode,aTab+"    ");
+		if(id2obj[oid].type) this.createElement("OID_TYPE",id2obj[oid].type,oNode,aTab+"    ");
+		if(id2obj[oid].date) this.createElement("OID_DATE",id2obj[oid].date,oNode,aTab+"    ");
+		if(id2obj[oid].mode) this.createElement("OID_MODE",id2obj[oid].mode,oNode,aTab+"    ");
+		if(alink != "") this.createElement("OID_LINK",alink,oNode,aTab+"    ");
+		if(structureElem){
+			var elem = this.createElement("OID_STRUCTURE","",oNode,aTab+"    ");
+			var i;
+			for(i=0;i<structureElem.childNodes.length;i++){
+				elem.appendChild(structureElem.childNodes[i].cloneNode(true));
+			}
+		}
+		if(id2obj[oid].text) this.createElement("OID_TXT",id2obj[oid].text,oNode,aTab+"    ");
+		if(id2obj[oid].property) this.createElement("OID_PROPERTY",id2obj[oid].property,oNode,aTab+"    ");
+		if(id2obj[oid].dbtype) this.createElement("OID_DBTYPE",id2obj[oid].dbtype,oNode,aTab+"    ");
+		if(hyperAnchor != ""){
+			this.createElement("HYPER_ANCHOR",hyperAnchor,oNode,aTab+"    ");
+		}else if(id2obj[oid].con_url && id2obj[oid].st){
+			var text = id2obj[oid].con_url + '#hyperanchor:' + this.xmlEncode(id2obj[oid].st);
+			if(id2obj[oid].en) text += "&" + this.xmlEncode(id2obj[oid].en);
+			if(id2obj[oid].style) text += "&" + this.xmlEncode(id2obj[oid].style);
+			this.createElement("HYPER_ANCHOR",text,oNode,aTab+"    ");
+		}
+		this.createTextNode(aTab+"  ",oNode);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeexport.xsl
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeexport.xsl	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeexport.xsl	(revision 5703)
@@ -0,0 +1,150 @@
+<xsl:stylesheet id="treeexport" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <xsl:template match="/">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="LIST">
+    <html>
+      <head>
+        <title><xsl:value-of select="@title" /></title>
+        <script type="text/javascript">
+        <![CDATA[
+          function load(aEvent){
+            var regexp_png = new RegExp("^data:image/\\w+;base64,");
+            var nodeWalker = document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,false);
+            for(var txtNode=nodeWalker.nextNode();txtNode;txtNode = nodeWalker.nextNode()){
+              try{if(txtNode.parentNode.nodeName == "TEXTAREA") continue;}catch(e){}
+              try{if(regexp_png.test(txtNode.nodeValue)){ txtNode.nodeValue = "data:image/png;base64,"; }}catch(e){}
+              try{txtNode.nodeValue = txtNode.nodeValue.replace(/([\/&\?])(\w)/mg,"$1 $2");}catch(e){}
+            }
+          }
+        ]]>
+        </script>
+      </head>
+      <body style="margin: 0.25em;" onload="load(event);">
+        <xsl:apply-templates/>
+      </body>
+    </html>
+  </xsl:template>
+
+  <xsl:template match="FOLDER">
+    <xsl:choose>
+      <xsl:when test="position() = 2">
+        <div style="margin-left: 0.25em;">
+          <table style="padding:0px;border:1px solid #fc6;" width="100%">
+            <tr><td style="background-color: #fc6;font-weight: bold;">
+              <xsl:value-of select="FID_TITLE" />
+            </td></tr>
+            <tr><td>
+              <xsl:apply-templates />
+            </td></tr>
+          </table>
+        </div>
+      </xsl:when>
+      <xsl:otherwise>
+        <div style="margin-left: 1em;">
+          <table style="padding:0px;border-left:1px solid #fc6;border-top:1px solid #fc6;" width="100%">
+            <tr><td style="background-color: #fc6;font-weight: bold;">
+              <xsl:value-of select="FID_TITLE" />
+            </td></tr>
+            <tr><td>
+              <xsl:apply-templates />
+            </td></tr>
+          </table>
+        </div>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="FOLDER/FID_TITLE" />
+  <xsl:template match="FOLDER/FID_NOTE" />
+  <xsl:template match="FOLDER/FID_STYLE" />
+  <xsl:template match="FOLDER/FID_MODE" />
+  <xsl:template match="FOLDER/FID_PROPERTY" />
+  <xsl:template match="FOLDER/FID_DBTYPE" />
+  <xsl:template match="BASENAME" />
+
+
+
+
+  <xsl:template match="OBJECT">
+    <div style="margin-left: 1em;">
+      <table style="padding:0px;border-left:1px solid #fc6;border-top:1px solid #fc6;" width="100%">
+        <thead>
+          <tr>
+            <td colspan="3" style="background-color: #ffc;font-weight: bold;">
+              <label>
+                <xsl:value-of select="OID_TITLE" />
+              </label>
+            </td>
+          </tr>
+        </thead>
+        <tbody>
+          <tr>
+            <th width="10" style="background-color: #e6e6e6;">Note</th>
+             <xsl:choose>
+               <xsl:when test="OID_IMG!=''">
+                  <td width="" style="font-family:serif;">
+                    <label>
+                      <xsl:value-of select="OID_PROPERTY_NOTE" />
+                    </label>
+                  </td>
+                  <td rowspan="4" align="right" valign="top">
+                    <img style="border-left:1px solid #ff9;">
+                      <xsl:attribute name="src"><xsl:value-of select="OID_IMG" /></xsl:attribute>
+                      <xsl:attribute name="width"><xsl:value-of select="OID_IMG_DISP_WIDTH" /></xsl:attribute>
+                      <xsl:attribute name="height"><xsl:value-of select="OID_IMG_DISP_HEIGHT" /></xsl:attribute>
+                    </img>
+                  </td>
+               </xsl:when>
+               <xsl:when test="OID_STRUCTURE!=''">
+                  <td width="" style="font-family:serif;">
+                    <label>
+                      <xsl:value-of select="OID_PROPERTY_NOTE" />
+                    </label>
+                  </td>
+                  <td rowspan="4" align="" valign="top" style="border-left:1px solid #ff9;">
+                    <xsl:copy-of select="OID_STRUCTURE" />
+                  </td>
+               </xsl:when>
+               <xsl:otherwise>
+                  <td width="400" style="font-family:serif;">
+                    <label>
+                      <xsl:value-of select="OID_PROPERTY_NOTE" />
+                    </label>
+                  </td>
+               </xsl:otherwise>
+             </xsl:choose>
+          </tr>
+          <tr>
+            <th width="10" style="background-color: #e6e6e6;">URL</th>
+            <td>
+              <a>
+                <xsl:attribute name="href">
+                  <xsl:value-of select="DOC_URL" />
+                </xsl:attribute>
+                <xsl:value-of select="DOC_URL" />
+              </a>
+            </td>
+          </tr>
+          <tr>
+            <th width="10" style="background-color: #e6e6e6;font-size:0.9em;white-space:nowrap;">
+              <a href="http://www.hyper-anchor.org/" target="_hyperanchor" title="HYPER-ANCHOR Homepage">HYPER-ANCHOR</a>
+            </th>
+            <td>
+              <textarea rows="1" wrap="soft" readonly="true" style="width:100%;-moz-appearance: none !important;border: none;background:white  !important;" onfocus="this.select();"><xsl:value-of select="HYPER_ANCHOR"/></textarea>
+            </td>
+          </tr>
+          <tr>
+            <th width="10" style="background-color: #e6e6e6;">Contents</th>
+            <td>
+              <xsl:value-of select="OID_TXT" />
+            </td>
+          </tr>
+        </tbody>
+      </table>
+    </div>
+  </xsl:template>
+  <xsl:template match="xsl:stylesheet">
+    <!-- ignore -->
+  </xsl:template>
+</xsl:stylesheet>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treefavoritefolder.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treefavoritefolder.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treefavoritefolder.js	(revision 5703)
@@ -0,0 +1,194 @@
+/////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////
+var mcTreeFavoriteFolder = {
+	get idMENU()        { return "mcToolbarFavoriteFolderButton"; },
+	get idMENU_SELECT(){ return "bitsFavoriteFolderSelectMenuitem"; },
+	get idMENU_POPUP()  { return "mcToolbarFavoriteFolderPopup"; },
+	get idMENU_ALL()    { return "bitsFavoriteFolderAllMenuitem"; },
+	get MENU()          { return document.getElementById(this.idMENU); },
+	get MENU_SELECT()   { return document.getElementById(this.idMENU_SELECT); },
+	get MENU_POPUP()    { return document.getElementById(this.idMENU_POPUP); },
+	get MENU_ALL()      { return document.getElementById(this.idMENU_ALL); },
+	get TITLE()         { return window.top.document.getElementById("sidebar-title"); },
+
+	get STRING()     { return window.top.document.getElementById("MarkingCollectionOverlayString"); },
+
+	get DataSource(){ return window.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.top.bitsObjectMng.Database;   },
+	get gBrowser()   { return window.top.bitsObjectMng.getBrowser();},
+
+	baseURL  : "",
+	shouldRebuild : false,
+
+	init : function(){
+		this.MENU.setAttribute("datasources",window.top.bitsFavoriteFolder.xmlurl);
+	},
+
+	done : function(){},
+
+	rebuild : function(){},
+
+	onPopupShowing : function(aEvent, aPopupRoot){
+		var res = mcTreeHandler.resource;
+		try{
+			if(!res){
+				mcTreeFavoriteFolder.MENU_SELECT.setAttribute("disabled","true");
+			}else{
+				var editmode = this.DataSource.getProperty(res, "editmode");
+				if((editmode & 0x1000)||(editmode == 4)){
+					mcTreeFavoriteFolder.MENU_SELECT.setAttribute("disabled","true");
+				}else{
+					mcTreeFavoriteFolder.MENU_SELECT.removeAttribute("disabled");
+				}
+			}
+		}catch(e){
+			mcTreeFavoriteFolder.MENU_SELECT.setAttribute("disabled","true");
+		}
+		var r_fid = nsPreferences.copyUnicharPref("wiredmarker.rootfolder");
+		var r_dbtype = nsPreferences.copyUnicharPref("wiredmarker.rootfolder_dbtype");
+		if(!r_fid || !r_dbtype){
+			this.MENU_ALL.setAttribute("disabled","true");
+		}else{
+			this.MENU_ALL.removeAttribute("disabled");
+		}
+		var results = this.XPath.evaluateArray('//folder[@fid and @dbtype]',window.top.bitsFavoriteFolder.xmldoc);
+		if(results.length){
+			var osString = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS;
+			var parser = new DOMParser();
+			var i;
+			for(i=0;i<results.length;i++){
+				try{
+					var attr = results[i].attributes;
+					var j;
+					if(osString != "Darwin"){
+						var elemMenuitem = top.document.createElement("menuitem");
+						for(j=0;j<attr.length;j++){
+							elemMenuitem.setAttribute(attr[j].name,attr[j].value);
+						}
+						elemMenuitem.setAttribute("label",results[i].getAttribute("title"));
+						elemMenuitem.setAttribute("contextmenu","mcPopupFavorite");
+						elemMenuitem.setAttribute("class","menuitem-iconic");
+						elemMenuitem.setAttribute("image","chrome://markingcollection/skin/folder.png");
+						var folders = this.Database.getFolderFormID(results[i].getAttribute("fid"),results[i].getAttribute("dbtype"));
+						if(folders && folders[0].fid_property){
+							var xmldoc = parser.parseFromString(folders[0].fid_property, "text/xml");
+							if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+							if(xmldoc){
+								var elems = xmldoc.getElementsByTagName("ICON");
+								if(elems && elems.length>0) elemMenuitem.setAttribute("image",elems[0].textContent);
+								elems = undefined;
+								xmldoc = undefined;
+							}
+						}
+						aPopupRoot.appendChild(elemMenuitem);
+					}else{
+						var elemMenu = top.document.createElement("menu");
+						for(j=0;j<attr.length;j++){
+							elemMenu.setAttribute(attr[j].name,attr[j].value);
+						}
+						elemMenu.setAttribute("label",results[i].getAttribute("title"));
+						elemMenu.setAttribute("class","menu-iconic");
+						elemMenu.setAttribute("image","chrome://markingcollection/skin/folder.png");
+						var folders = this.Database.getFolderFormID(results[i].getAttribute("fid"),results[i].getAttribute("dbtype"));
+						if(folders && folders[0].fid_property){
+							var xmldoc = parser.parseFromString(folders[0].fid_property, "text/xml");
+							if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+							if(xmldoc){
+								var elems = xmldoc.getElementsByTagName("ICON");
+								if(elems && elems.length>0) elemMenu.setAttribute("image",elems[0].textContent);
+								elems = undefined;
+								xmldoc = undefined;
+							}
+						}
+						var elemMenupopup = top.document.createElement("menupopup");
+						elemMenu.appendChild(elemMenupopup);
+						elemMenupopup.addEventListener("popupshowing", function(aEvent){aEvent.stopPropagation();}, false);
+						elemMenupopup.addEventListener("popuphiding", function(aEvent){aEvent.stopPropagation();}, false);
+						var elemMenuitemSel = top.document.createElement("menuitem");
+						elemMenuitemSel.setAttribute("label",this.STRING.getString("FAVORITEFOLDER_SELECT"));
+						for(j=0;j<attr.length;j++){
+							elemMenuitemSel.setAttribute(attr[j].name,attr[j].value);
+						}
+						elemMenuitemSel.setAttribute("class","menuitem-iconic");
+						elemMenuitemSel.setAttribute("image","chrome://markingcollection/skin/folder.png");
+						var folders = this.Database.getFolderFormID(results[i].getAttribute("fid"),results[i].getAttribute("dbtype"));
+						if(folders && folders[0].fid_property){
+							var xmldoc = parser.parseFromString(folders[0].fid_property, "text/xml");
+							if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+							if(xmldoc){
+								var elems = xmldoc.getElementsByTagName("ICON");
+								if(elems && elems.length>0) elemMenuitemSel.setAttribute("image",elems[0].textContent);
+								elems = undefined;
+								xmldoc = undefined;
+							}
+						}
+						elemMenupopup.appendChild(elemMenuitemSel);
+						var elemMenuitemDel = top.document.createElement("menuitem");
+						elemMenuitemDel.setAttribute("label",this.STRING.getString("FAVORITEFOLDER_DELETE"));
+						for(j=0;j<attr.length;j++){
+							elemMenuitemDel.setAttribute(attr[j].name,attr[j].value);
+						}
+						elemMenuitemDel.setAttribute("class","menuitem-iconic");
+						elemMenuitemDel.setAttribute("image","chrome://markingcollection/skin/menu_remove.png");
+						var folders = this.Database.getFolderFormID(results[i].getAttribute("fid"),results[i].getAttribute("dbtype"));
+						if(folders && folders[0].fid_property){
+							var xmldoc = parser.parseFromString(folders[0].fid_property, "text/xml");
+							if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+							if(xmldoc){
+								var elems = xmldoc.getElementsByTagName("ICON");
+								if(elems && elems.length>0) elemMenuitemDel.setAttribute("image",elems[0].textContent);
+								elems = undefined;
+								xmldoc = undefined;
+							}
+						}
+						elemMenuitemDel.addEventListener("command", function(aEvent){
+							aEvent.stopPropagation();
+							mcTreeFavoriteFolder._explicitOriginalTarget = aEvent.target;
+							mcTreeFavoriteFolder.removeFavoriteFolder(aEvent);
+						}, false);
+						elemMenupopup.appendChild(elemMenuitemDel);
+						aPopupRoot.appendChild(elemMenu);
+					}
+				}catch(e){}
+			}
+			parser = undefined;
+		}
+	},
+
+	onPopupHiding : function(aEvent, aPopupRoot){
+		var i;
+		for(i=this.MENU_POPUP.childNodes.length-1;i>=0;i--){
+			var elem = this.MENU_POPUP.childNodes[i];
+			if(elem.id) continue;
+			this.MENU_POPUP.removeChild(elem);
+		}
+	},
+
+	onClick : function(aEvent){
+		window.top.bitsFavoriteFolder.onClick(aEvent);
+	},
+
+	onPopupFShowing : function(aEvent){
+		this._explicitOriginalTarget = aEvent.explicitOriginalTarget;
+	},
+
+	removeFavoriteFolder : function(aEvent){
+		var xmldoc = window.top.bitsFavoriteFolder.xmldoc;
+		if(!xmldoc || !this._explicitOriginalTarget) return;
+		if(!window.top.bitsFavoriteFolder._confirmRemovingFor()) return;
+		var fid = this._explicitOriginalTarget.getAttribute("fid");
+		var dbtype = this._explicitOriginalTarget.getAttribute("dbtype");
+		var results = this.XPath.evaluateArray('//folder[@fid="'+fid+'" and @dbtype="'+dbtype+'"]',xmldoc);
+		if(results.length){
+			var i;
+			for(i=results.length-1;i>=0;i--){
+				results[i].parentNode.removeChild(results[i]);
+			}
+			window.top.bitsFavoriteFolder.xmlflash();
+		}
+		this._explicitOriginalTarget = undefined;
+	},
+};
+
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treefolderfilter.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treefolderfilter.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treefolderfilter.js	(revision 5703)
@@ -0,0 +1,157 @@
+var mcTreeFolderFilterService = {
+	item     : null,
+
+	get KEYWORD() { return document.getElementById("mcTreeFolderFilterKeyword"); },
+	get AVAILABLENESS() { return document.getElementById("mcTreeFolderFilterAvailableness"); },
+	get INVALIDATION() { return document.getElementById("mcTreeFolderFilterInvalidation"); },
+	get CASESENSITIVE() { return document.getElementById("mcTreeFolderFilterCasesensitive"); },
+
+	get DataSource() { try{return window.opener.top.bitsObjectMng.DataSource;}catch(ex){return window.top.bitsObjectMng.DataSource;} },
+	get Common()     { try{return window.opener.top.bitsObjectMng.Common;}catch(ex){return null;}     },
+	get XPath()      { try{return window.opener.top.bitsObjectMng.XPath;}catch(ex){return null;}      },
+	get Database()   { try{return window.opener.top.bitsObjectMng.Database;}catch(ex){return null;}   },
+	get gBrowser()   { try{return window.opener.top.bitsObjectMng.getBrowser();}catch(ex){return null;}},
+
+	init : function(){
+		try {
+			this.item = window.arguments[0];
+		}catch(ex){
+		}
+		if(!this.item) return;
+		try {
+			document.title += " [" + this.item.title + "]";
+			var i;
+			var folder = nsPreferences.copyUnicharPref("wiredmarker.filter.folder","");
+			var folderArr = folder.split("\t");
+			var folderHash = [];
+			var folderCasesensitive = [];
+			for(i=0;i<folderArr.length;i++){
+				if(!folderArr[i].match(/^(\d+):(\d+):(.+)$/)) continue;
+				folderHash[RegExp.$1] = RegExp.$3
+				folderCasesensitive[RegExp.$1] = RegExp.$2
+			}
+			var keyword = nsPreferences.copyUnicharPref("wiredmarker.filter.keyword","");
+			var keywordArr = keyword.split("\t");
+			if(keywordArr.length>0){
+				for(i=0;i<keywordArr.length&&i<10;i++){
+					this.KEYWORD.appendItem(keywordArr[i],keywordArr[i]);
+					if(folderHash[this.item.id] && folderHash[this.item.id] == keywordArr[i]) this.KEYWORD.selectedIndex = i;
+				}
+			}
+			if(folderHash[this.item.id]){
+				this.INVALIDATION.removeAttribute("selected");
+				this.AVAILABLENESS.setAttribute("selected",true);
+				this.KEYWORD.removeAttribute("disabled");
+				this.CASESENSITIVE.removeAttribute("disabled");
+				this.CASESENSITIVE.setAttribute("checked",folderCasesensitive[this.item.id]!=0);
+			}else{
+				this.AVAILABLENESS.removeAttribute("selected");
+				this.INVALIDATION.setAttribute("selected",true);
+				this.KEYWORD.setAttribute("disabled",true);
+				this.CASESENSITIVE.setAttribute("disabled",true);
+			}
+		}catch(ex){
+			this._dump(ex);
+		}
+		return;
+	},
+
+	done : function(){},
+
+	accept : function(){
+		var disabled = this.KEYWORD.getAttribute("disabled");
+		var newVals = {
+			keyword   : !disabled?this.KEYWORD.value:"",
+		};
+		var props;
+		for(props in newVals){
+			window.arguments[0][props] = newVals[props];
+			window.arguments[0].accept = true;
+			if(props != "keyword") continue;
+			var i;
+			var keyword = nsPreferences.copyUnicharPref("wiredmarker.filter.keyword","");
+			var keywordArr = keyword.split("\t");
+			var newArr = [];
+			newArr.unshift(newVals[props]);
+			for(i=0;i<keywordArr.length;i++){
+				if(keywordArr[i] == newVals[props] || keywordArr[i] == "") continue;
+				newArr.push(keywordArr[i]);
+			}
+			nsPreferences.setUnicharPref("wiredmarker.filter.keyword", newArr.join("\t"));
+			var folder = nsPreferences.copyUnicharPref("wiredmarker.filter.folder","");
+			var folderArr = folder.split("\t");
+			var folderHash = [];
+			var folderCasesensitive = [];
+			for(i=0;i<folderArr.length;i++){
+				if(!folderArr[i].match(/^(\d+):(\d+):(.+)$/)) continue;
+				folderHash[RegExp.$1] = RegExp.$3;
+				folderCasesensitive[RegExp.$1] = RegExp.$2;
+			}
+			if(newVals[props] != ""){
+				folderHash[this.item.id] = newVals[props];
+				folderCasesensitive[this.item.id] = this.CASESENSITIVE.checked?1:0;
+			}else{
+				delete folderHash[this.item.id];
+			}
+			newArr = [];
+			var key;
+			for(key in folderHash){
+				if(typeof folderHash[key] == "function") continue;
+				newArr.push(key+":"+folderCasesensitive[key]+":"+folderHash[key]);
+			}
+			nsPreferences.setUnicharPref("wiredmarker.filter.folder", newArr.join("\t"));
+		}
+	},
+
+	cancel : function(){
+		if(window.arguments[0]) window.arguments[0].accept = false;
+	},
+
+	radio : function(aEvent){
+		mcTreeFolderFilterService._dump(aEvent.target.id);
+		if(this.AVAILABLENESS == aEvent.target){
+			this.KEYWORD.removeAttribute("disabled");
+			this.CASESENSITIVE.removeAttribute("disabled");
+		}else{
+			this.KEYWORD.setAttribute("disabled",true);
+			this.CASESENSITIVE.setAttribute("disabled",true);
+		}
+	},
+
+	checkbox : function(aEvent){},
+
+	onCommand : function(aEvent){
+		var rtn = false;
+		var curIdx = mcTreeHandler.TREE.currentIndex;
+		if(curIdx<0) return;
+		if(!mcTreeHandler.TREE.view.isContainer(curIdx)) return;
+		var aRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+		var fid = window.top.bitsObjectMng.DataSource.getProperty(aRes,"id");
+		var result = {};
+		result.title = window.top.bitsObjectMng.DataSource.getProperty(aRes,"title");
+		result.id = fid;
+		result.keyword = "";
+		result.accept = true;
+		window.openDialog("chrome://markingcollection/content/treefolderfilter.xul", "", "chrome,centerscreen,modal", result);
+		if(!result.accept) return;
+		this._dump("result.keyword=["+result.keyword+"]")
+		mcTreeViewModeService.rebuild();
+	},
+
+	isUseFilter : function(aRes){
+		var fid = this.DataSource.getProperty(aRes,"id");
+		var i;
+		var folder = nsPreferences.copyUnicharPref("wiredmarker.filter.folder","");
+		var folderArr = folder.split("\t");
+		var folderHash = [];
+		for(i=0;i<folderArr.length;i++){
+			if(!folderArr[i].match(/^(\d+):(.+)$/)) continue;
+			folderHash[RegExp.$1] = RegExp.$2
+		}
+		return (folderHash[fid] != undefined);
+	},
+
+	_dump : function(aString){
+		try{ window.opener.top.bitsMarkingCollection._dump(aString); } catch(e){}
+	},
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treefolderfilter.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treefolderfilter.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treefolderfilter.xul	(revision 5703)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/property.css" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/setting.css" type="text/css" ?>
+<!DOCTYPE wizard [
+<!ENTITY % overlayDTD   SYSTEM "chrome://markingcollection/locale/markingcollection.dtd" >
+%overlayDTD;
+<!ENTITY % markerCustomDTD SYSTEM "chrome://markingcollection/locale/markerCustom.dtd" >
+%markerCustomDTD;
+]>
+<dialog
+	id="mcTreeFolderFilterDialog"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	title="&markingcollection.filter;"
+	buttons="accept,cancel"
+	onload="mcTreeFolderFilterService.init();"
+	onunload="mcTreeFolderFilterService.done();"
+	ondialogaccept="mcTreeFolderFilterService.accept();"
+	ondialogcancel="mcTreeFolderFilterService.cancel();">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/treefolderfilter.js"/>
+	<stringbundleset id="mcStringBundles">
+		<stringbundle id="mcTreeFolderFilteString" src="chrome://markingcollection/locale/markingcollection.properties" />
+	</stringbundleset>
+	<hbox flex="1">
+		<radiogroup oncommand="mcTreeFolderFilterService.radio(event);">
+			<radio id="mcTreeFolderFilterInvalidation" label="&markingcollection.filter.invalidation;"/>
+			<radio id="mcTreeFolderFilterAvailableness" label="&markingcollection.filter.availableness;"/>
+		</radiogroup>
+		<vbox flex="1">
+			<groupbox id="mcTreeFolderFilterGroup" flex="1">
+				<caption label="&markingcollection.filter.keyword;" />
+				<menulist id="mcTreeFolderFilterKeyword" editable="true">
+					<menupopup>
+					</menupopup>
+				</menulist>
+				<checkbox id="mcTreeFolderFilterCasesensitive" checked="true" label="&markingcollection.filter.casesensitive;" oncommand="mcTreeFolderFilterService.checkbox(event);"/>
+			</groupbox>
+		</vbox>
+	</hbox>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeindex.xsl
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeindex.xsl	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeindex.xsl	(revision 5703)
@@ -0,0 +1,129 @@
+<xsl:stylesheet id="treeindex" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="html" version="4.01" encoding="UTF-8" indent="yes"/>
+  <xsl:template match="/">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="WM_INDEX_LIST">
+    <html>
+      <head>
+        <title><xsl:value-of select="@title"/></title>
+        <script type="text/javascript">
+        <![CDATA[
+          function twisty(elem){
+            var cur_twisty = (elem.src.indexOf("fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII")>=0)?true:false;
+            var sibling = elem.nextSibling;
+            while(sibling){
+              if(sibling.nodeName.toUpperCase() == 'DIV'){
+                sibling.style.display = cur_twisty?'none':'';
+                break;
+              }
+              sibling = sibling.nextSibling;
+            }
+            if(!sibling) return;
+            elem.src = cur_twisty ?
+              "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAChSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAMcGU//z5E4wZGRnhbBgACCAWGOPbt28M6Gx2dnYwDRBAYEX//v1jEBISgiuCsf/+/QumAQIIrOjr168MV69eBQtoa2vD2SBxEAAIIBaY8V++fIGbBGPDrAUIILCiHz9+MIiLi4MFHjx4AFcMEgcBgAACKZpdW/MITzAxzAYIMADnOV3STeCBBwAAAABJRU5ErkJggg==" :
+              "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAACNSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAscCU//z5E8MIdnZ2MA0QQHBF3759w6kIIIDAiv79+8cgJCSEoejv379gGiCAwIq+fv3KcPXqVQxFIHEQAAggFphVX758wVAEcwJAAIEV/fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII=";
+          }
+          function load(aEvent){
+            var regexp_png = new RegExp("^data:image/\\w+;base64,");
+            var nodeWalker = document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,false);
+            for(var txtNode=nodeWalker.nextNode();txtNode;txtNode = nodeWalker.nextNode()){
+              try{if(txtNode.parentNode.nodeName == "TEXTAREA") continue;}catch(e){}
+              try{if(regexp_png.test(txtNode.nodeValue)){ txtNode.nodeValue = "data:image/png;base64,"; }}catch(e){}
+              try{txtNode.nodeValue = txtNode.nodeValue.replace(/([\/&\?])(\w)/mg,"$1 $2");}catch(e){}
+            }
+          }
+        ]]>
+        </script>
+        <style>
+          img.twisty {
+            margin-right: 4px;
+          }
+          img.twisty:hover {
+            cursor : pointer;
+          }
+        </style>
+      </head>
+      <body style="margin: 0.25em;" onload="load(event);">
+        <xsl:apply-templates/>
+      </body>
+    </html>
+  </xsl:template>
+
+  <xsl:template match="INDEX">
+    <div style="margin-left: 0.25em;margin-bottom: 2px;">
+      <table style="padding:0px;border:1px solid #fc6;" width="100%">
+        <tr><td style="background-color: #ffc;font-weight: bold;">
+          <xsl:value-of select="TITLE"/>
+        </td></tr>
+        <tr><td>
+          <xsl:apply-templates/>
+        </td></tr>
+      </table>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="INDEX/TITLE"/>
+  <xsl:template match="INDEX/URLS/URL/DOCUMENT_URL"/>
+  <xsl:template match="INDEX/URLS/URL/FAVICON"/>
+  <xsl:template match="INDEX/URLS/URL/DOCUMENT_TITLE"/>
+
+
+
+
+  <xsl:template match="OBJECTS">
+    <div style="margin-left: 1em;">
+      <table style="" width="100%">
+        <tbody>
+          <tr>
+            <td>
+              <xsl:apply-templates/>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="OBJECT">
+    <div style="float:left;padding-right:0.3em;">
+      <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAChSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAMcGU//z5E4wZGRnhbBgACCAWGOPbt28M6Gx2dnYwDRBAYEX//v1jEBISgiuCsf/+/QumAQIIrOjr168MV69eBQtoa2vD2SBxEAAIIBaY8V++fIGbBGPDrAUIILCiHz9+MIiLi4MFHjx4AFcMEgcBgAACKZpdW/MITzAxzAYIMADnOV3STeCBBwAAAABJRU5ErkJggg==" valign="top" class="twisty" onclick="twisty(this)">
+      </img>
+      <a>
+        <xsl:attribute name="href">
+          <xsl:value-of select="HYPER_ANCHOR" />
+        </xsl:attribute>
+        <img border="0">
+          <xsl:attribute name="src">
+            <xsl:value-of select="ICON" />
+          </xsl:attribute>
+        </img>
+      </a>
+      <div style="display:none;">
+        <table style="padding:0px;border:1px solid #fc6;border-top:1px solid #fc6;" width="100%">
+          <tbody>
+            <tr>
+              <th style="background-color: #e6e6e6;font-size:0.9em;">URL</th>
+              <td>
+                <a>
+                  <xsl:attribute name="href">
+                    <xsl:value-of select="DOC_URL" />
+                  </xsl:attribute>
+                  <xsl:value-of select="DOC_URL" />
+                </a>
+              </td>
+            </tr>
+            <tr>
+              <th style="background-color: #e6e6e6;font-size:0.9em;">NOTE</th>
+              <td><xsl:value-of select="NOTE" /></td>
+            </tr>
+          </tbody>
+        </table>
+      </div>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="xsl:stylesheet">
+    <!-- ignore -->
+  </xsl:template>
+</xsl:stylesheet>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeindex_standard.xsl
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeindex_standard.xsl	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeindex_standard.xsl	(revision 5703)
@@ -0,0 +1,116 @@
+<xsl:stylesheet id="treeindex" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="html" version="4.01" encoding="UTF-8" indent="yes"/>
+  <xsl:template match="/">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="WM_INDEX_LIST">
+    <html>
+      <head>
+        <title><xsl:value-of select="@title"/></title>
+        <script type="text/javascript">
+        <![CDATA[
+          function twisty(elem){
+            var cur_twisty = (elem.src.indexOf("fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII")>=0)?true:false;
+            var sibling = elem.nextSibling;
+            while(sibling){
+              if(sibling.nodeName.toUpperCase() == 'DIV'){
+                sibling.style.display = cur_twisty?'none':'';
+                break;
+              }
+              sibling = sibling.nextSibling;
+            }
+            if(!sibling) return;
+            elem.src = cur_twisty ?
+              "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAChSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAMcGU//z5E4wZGRnhbBgACCAWGOPbt28M6Gx2dnYwDRBAYEX//v1jEBISgiuCsf/+/QumAQIIrOjr168MV69eBQtoa2vD2SBxEAAIIBaY8V++fIGbBGPDrAUIILCiHz9+MIiLi4MFHjx4AFcMEgcBgAACKZpdW/MITzAxzAYIMADnOV3STeCBBwAAAABJRU5ErkJggg==" :
+              "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAACNSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAscCU//z5E8MIdnZ2MA0QQHBF3759w6kIIIDAiv79+8cgJCSEoejv379gGiCAwIq+fv3KcPXqVQxFIHEQAAggFphVX758wVAEcwJAAIEV/fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII=";
+          }
+          function load(aEvent){
+            return;
+            var regexp_png = new RegExp("^data:image/\\w+;base64,");
+            var nodeWalker = document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,false);
+            for(var txtNode=nodeWalker.nextNode();txtNode;txtNode = nodeWalker.nextNode()){
+              try{if(txtNode.parentNode.nodeName == "TEXTAREA") continue;}catch(e){}
+              try{if(regexp_png.test(txtNode.nodeValue)){ txtNode.nodeValue = "data:image/png;base64,"; }}catch(e){}
+              try{txtNode.nodeValue = txtNode.nodeValue.replace(/([\/&\?])(\w)/mg,"$1 $2");}catch(e){}
+            }
+          }
+        ]]>
+        </script>
+        <style>
+          a {
+            color : rgb(0,0,238);
+          }
+          a:hover {
+            color : #f90;
+          }
+          img.twisty {
+            margin-right: 4px;
+          }
+          img.twisty:hover {
+            cursor : pointer;
+          }
+        </style>
+      </head>
+      <body style="margin: 0.25em;" onload="load(event);">
+        <xsl:apply-templates/>
+      </body>
+    </html>
+  </xsl:template>
+
+  <xsl:template match="INDEX">
+    <div style="margin-left: 0.25em;margin-bottom: 2px;">
+      <table style="padding:0px;border:1px solid #fc6;" width="100%">
+        <tr><td style="background-color: #ffc;font-weight: bold;">
+          <xsl:value-of select="TITLE"/>
+        </td></tr>
+        <tr><td>
+          <xsl:apply-templates/>
+        </td></tr>
+      </table>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="INDEX/TITLE"/>
+
+  <xsl:template match="OBJECT">
+    <div style="margin-left: 1em;">
+      <table width="100%">
+        <tbody>
+          <tr>
+            <td>
+              <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAChSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAMcGU//z5E4wZGRnhbBgACCAWGOPbt28M6Gx2dnYwDRBAYEX//v1jEBISgiuCsf/+/QumAQIIrOjr168MV69eBQtoa2vD2SBxEAAIIBaY8V++fIGbBGPDrAUIILCiHz9+MIiLi4MFHjx4AFcMEgcBgAACKZpdW/MITzAxzAYIMADnOV3STeCBBwAAAABJRU5ErkJggg==" valign="top" class="twisty" onclick="twisty(this)">
+              </img>
+              <a>
+                <xsl:attribute name="href">
+                  <xsl:value-of select="HYPER_ANCHOR" />
+                </xsl:attribute>
+                <xsl:attribute name="title">
+                  <xsl:value-of select="DOC_URL" />
+                </xsl:attribute>
+                <xsl:value-of select="DOC_TITLE" />
+              </a>
+              <div style="display:none;">
+                <table style="padding:0px;border:1px solid #fc6;border-top:1px solid #fc6;" width="100%">
+                  <tbody>
+                    <tr>
+                      <th style="background-color: #e6e6e6;font-size:0.9em;width:4em;">Note</th><td><xsl:value-of select="NOTE"/></td>
+                    </tr>
+                  </tbody>
+                </table>
+              </div>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+    </div>
+  </xsl:template>
+
+
+  <xsl:template match="INDEX/URLS/URL/DOCUMENT_URL"/>
+  <xsl:template match="INDEX/URLS/URL/FAVICON"/>
+  <xsl:template match="INDEX/URLS/URL/DOCUMENT_TITLE"/>
+
+  <xsl:template match="xsl:stylesheet">
+    <!-- ignore -->
+  </xsl:template>
+</xsl:stylesheet>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeindex_url.xsl
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeindex_url.xsl	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeindex_url.xsl	(revision 5703)
@@ -0,0 +1,133 @@
+<xsl:stylesheet id="treeindex" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="html" version="4.01" encoding="UTF-8" indent="yes"/>
+  <xsl:template match="/">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="WM_INDEX_LIST">
+    <html>
+      <head>
+        <title><xsl:value-of select="@title"/></title>
+        <script type="text/javascript">
+        <![CDATA[
+          function twisty(elem){
+            var cur_twisty = (elem.src.indexOf("fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII")>=0)?true:false;
+            var sibling = elem.nextSibling;
+            while(sibling){
+              if(sibling.nodeName.toUpperCase() == 'DIV'){
+                sibling.style.display = cur_twisty?'none':'';
+                break;
+              }
+              sibling = sibling.nextSibling;
+            }
+            if(!sibling) return;
+            elem.src = cur_twisty ?
+              "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAChSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAMcGU//z5E4wZGRnhbBgACCAWGOPbt28M6Gx2dnYwDRBAYEX//v1jEBISgiuCsf/+/QumAQIIrOjr168MV69eBQtoa2vD2SBxEAAIIBaY8V++fIGbBGPDrAUIILCiHz9+MIiLi4MFHjx4AFcMEgcBgAACKZpdW/MITzAxzAYIMADnOV3STeCBBwAAAABJRU5ErkJggg==" :
+              "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAACNSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAscCU//z5E8MIdnZ2MA0QQHBF3759w6kIIIDAiv79+8cgJCSEoejv379gGiCAwIq+fv3KcPXqVQxFIHEQAAggFphVX758wVAEcwJAAIEV/fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII=";
+          }
+          function load(aEvent){
+            return;
+            var regexp_png = new RegExp("^data:image/\\w+;base64,");
+            var nodeWalker = document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,false);
+            for(var txtNode=nodeWalker.nextNode();txtNode;txtNode = nodeWalker.nextNode()){
+              try{if(txtNode.parentNode.nodeName == "TEXTAREA") continue;}catch(e){}
+              try{if(regexp_png.test(txtNode.nodeValue)){ txtNode.nodeValue = "data:image/png;base64,"; }}catch(e){}
+              try{txtNode.nodeValue = txtNode.nodeValue.replace(/([\/&\?])(\w)/mg,"$1 $2");}catch(e){}
+            }
+          }
+        ]]>
+        </script>
+        <style>
+          a {
+            color : rgb(0,0,238);
+          }
+          a:hover {
+            color : #f90;
+          }
+          img.twisty {
+            margin-right: 4px;
+          }
+          img.twisty:hover {
+            cursor : pointer;
+          }
+        </style>
+      </head>
+      <body style="margin: 0.25em;" onload="load(event);">
+        <xsl:apply-templates/>
+      </body>
+    </html>
+  </xsl:template>
+
+  <xsl:template match="INDEX">
+    <div style="margin-left: 0.25em;margin-bottom: 2px;">
+      <table style="padding:0px;border:1px solid #fc6;" width="100%">
+        <tr><td style="background-color: #ffc;font-weight: bold;">
+          <xsl:value-of select="TITLE"/>
+        </td></tr>
+        <tr><td>
+          <xsl:apply-templates/>
+        </td></tr>
+      </table>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="INDEX/TITLE"/>
+
+
+
+
+  <xsl:template match="URL">
+    <div style="margin-left: 1em;">
+      <table width="100%">
+        <tbody>
+          <tr>
+            <td>
+              <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAACNSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAscCU//z5E8MIdnZ2MA0QQHBF3759w6kIIIDAiv79+8cgJCSEoejv379gGiCAwIq+fv3KcPXqVQxFIHEQAAggFphVX758wVAEcwJAAIEV/fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII=" valign="top" class="twisty" onclick="twisty(this)">
+              </img>
+              <a>
+                <xsl:attribute name="href">
+                  <xsl:value-of select="DOCUMENT_URL" />
+                </xsl:attribute>
+                <xsl:attribute name="title">
+                  <xsl:value-of select="DOCUMENT_TITLE" />
+                </xsl:attribute>
+                <xsl:value-of select="DOCUMENT_URL" />
+              </a>
+              <xsl:apply-templates/>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="OBJECTS">
+    <div style="">
+      <table style="padding:0px;border:1px solid #fc6;border-top:1px solid #fc6;" width="100%">
+        <tbody>
+          <xsl:apply-templates/>
+        </tbody>
+      </table>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="OBJECT">
+    <tr style="">
+      <th style="background-color: #e6e6e6;font-size:0.9em;width:4em;">Note</th><td style="border-bottom:1px solid #ffe5b1;"><xsl:value-of select="NOTE"/></td>
+      <td style="width:1em;border-left:1px solid #ffe5b1;border-bottom:1px solid #ffe5b1;">
+        <a style="font-size:0.8em;">
+          <xsl:attribute name="href">
+            <xsl:value-of select="HYPER_ANCHOR" />
+          </xsl:attribute>Link
+        </a>
+      </td>
+    </tr>
+  </xsl:template>
+
+  <xsl:template match="INDEX/URLS/URL/DOCUMENT_URL"/>
+  <xsl:template match="INDEX/URLS/URL/FAVICON"/>
+  <xsl:template match="INDEX/URLS/URL/DOCUMENT_TITLE"/>
+
+  <xsl:template match="xsl:stylesheet">
+    <!-- ignore -->
+  </xsl:template>
+</xsl:stylesheet>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treelist.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treelist.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treelist.js	(revision 5703)
@@ -0,0 +1,1832 @@
+var bitsTreeListService = {
+	_openurl : "",
+	_doc     : null,
+	_loaddoc : null,
+	_url     : "",
+	_fileid  : "",
+	_click_oid : "",
+	_click_dbtype : "",
+	_timerid : null,
+	_reload_timer : null,
+	_listview_drag : 'chrome://markingcollection/content/listview_drag.xsl',
+
+/////////////////////////////////////////////////////////////////////
+	get CLASS_POPUP() { return window.top.document.getElementById("bitsTreeListContextmenu"); },
+
+/////////////////////////////////////////////////////////////////////
+	get STRING() { return document.getElementById("MarkingCollectionOverlayString"); },
+
+	get DataSource() { return window.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.top.bitsObjectMng.Common;     },
+	get Database()   { return window.top.bitsObjectMng.Database;   },
+	get XML()        { return window.top.bitsObjectMng.XML;        },
+	get XPath()      { return bitsObjectMng.XPath;      },
+	get gBrowser()   { return window.top.bitsObjectMng.getBrowser();},
+
+	get SIDEBAR() { return window.top.document.getElementById("sidebar"); },
+	get SIDEBAR_WIN() {try{return this.SIDEBAR.contentWindow;}catch(e){return undefined;}},
+	get mcTreeHandler() {try{return this.SIDEBAR_WIN.mcTreeHandler;}catch(e){return undefined;}},
+	get mcPropertyView() {try{return this.SIDEBAR_WIN.mcPropertyView;}catch(e){return undefined;}},
+	get bitsTreeDate() {try{return this.SIDEBAR_WIN.bitsTreeDate;}catch(e){return undefined;}},
+
+/////////////////////////////////////////////////////////////////////
+	init : function(){
+		this.gBrowser.addEventListener("pageshow", this.load, true);
+		this.gBrowser.addEventListener("pagehide", this.unload, true);
+		if(this._fileid == "") this._fileid = this.Common.getTimeStamp();
+		if(this.gBrowser.browsers.length>0){
+			var i;
+			for(i=0;i<this.gBrowser.browsers.length;i++){
+				var doc = this.gBrowser.browsers[i].contentDocument;
+				doc.defaultView.addEventListener("click", bitsTreeListService.click, false);
+			}
+		}
+		//å€ããªã¹ãè¡šç€ºçšã®StyleSheetãåé€
+		try{
+			var sendDir  = this.getTemplateDir();
+			var dir = this.getDefaultTemplateDir();
+			if(dir.exists()){
+				var entries = dir.directoryEntries;
+				while(entries.hasMoreElements()){
+					var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+					if(!entry.isFile()) continue;
+					var sendFile = sendDir.clone();
+					sendFile.append(entry.leafName);
+					if(sendFile.exists() && sendFile.lastModifiedTime > entry.lastModifiedTime) continue;
+					if(sendFile.exists()) sendFile.remove(false);
+				}
+			}
+		}catch(ex){
+			this._dump("bitsTreeListService.init():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(){
+		try{
+			var cur_uri = this.Common.getURLStringFromDocument(this.gBrowser.contentDocument);
+			var basedir = this.getBaseDir();
+			var res_uri = this.Common.convertFilePathToURL(basedir.path);
+			this.gBrowser.removeEventListener("pageshow", this.load, true);
+			this.gBrowser.removeEventListener("pagehide", this.unload, true);
+			if(this.gBrowser.browsers.length>0){
+				var i;
+				for(i=0;i<this.gBrowser.browsers.length;i++){
+					var doc = this.gBrowser.browsers[i].contentDocument;
+					if(!doc) continue;
+					try{ doc.defaultView.removeEventListener("click", bitsTreeListService.click, false); }catch(e){}
+					if(this._click_oid){
+						var elemid = "divIMG"+this._click_oid;
+						var divElem = doc.getElementById(elemid);
+						if(divElem){
+							divElem.style.display = "none";
+							divElem.parentNode.removeChild(divElem);
+						}
+					}
+					var cur_uri = this.Common.getURLStringFromDocument(doc);
+					if(cur_uri.indexOf(res_uri)>=0) this.gBrowser.removeTab(this.gBrowser.tabContainer.getItemAtIndex(i));
+				}
+			}
+		}catch(e){}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	load : function(aEvent){
+		var url = bitsTreeListService.Common.getURLStringFromDocument(aEvent.target);
+		if(url.indexOf(bitsTreeListService._openurl) < 0) return;
+		aEvent.target.defaultView.addEventListener("click", bitsTreeListService.click, false);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	unload : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	removeClass : function(aEvent){
+		if(!this._classEditNode) return;
+		var fid = this._classEditNode.getAttribute("fid");
+		var oid = this._classEditNode.getAttribute("oid");
+		var dbtype = this._classEditNode.getAttribute("dbtype");
+		if(fid && fid == '') fid = undefined;
+		if(oid && oid == '') oid = undefined;
+		if(dbtype && dbtype == '') dbtype = undefined;
+		if(!fid || !oid || !dbtype) return;
+
+		var contentWindow = null;
+		var bitsItemView = null;
+		var mcTreeDNDHandler = null;
+		var mcTreeCssService = null;
+		var mcController = null;
+		if(bitsMarkingCollection._contentWindow) contentWindow = bitsMarkingCollection._contentWindow;
+		if(contentWindow && contentWindow.bitsItemView) bitsItemView = contentWindow.bitsItemView;
+		if(contentWindow && contentWindow.mcTreeDNDHandler) mcTreeDNDHandler = contentWindow.mcTreeDNDHandler;
+		if(contentWindow && contentWindow.mcTreeCssService) mcTreeCssService = contentWindow.mcTreeCssService;
+		if(contentWindow && contentWindow.mcController) mcController = contentWindow.mcController;
+
+		var rtn = this.Database.removeLink({oid:oid,pfid:fid},dbtype);
+		var rtnObj = this.Database.getObject({oid:oid},dbtype);
+		if(rtnObj && rtnObj.length == 1 && !rtnObj[0].pfid){
+			var aObject = undefined;
+			var objs = this.Database.getObjectWithProperty({oid:oid},dbtype);
+			if(objs && objs.length>0) aObject = objs[0];
+			if(aObject){
+				var blobs =this.Database.getObjectBLOB(aObject.oid,aObject.dbtype);
+				var addObj = this.Database.newObject(aObject.oid,bitsMarkingCollection._uncategorized.dbtype);
+				var key;
+				for(key in aObject){
+					if(key == "oid") continue;
+					addObj[key] = aObject[key];
+				}
+				var pfid = "0";
+				var pfid_order = this.Database.getMaxOrderFormPID(pfid,bitsMarkingCollection._uncategorized.dbtype);
+				addObj.pfid = pfid;
+				addObj.pfid_order = ++pfid_order;
+				delete addObj.dbtype;
+				delete addObj.fid_style;
+				rtn = this.Database.addObject(addObj,bitsMarkingCollection._uncategorized.dbtype);
+				if(rtn && blobs && blobs.length>0){
+					this.Database.updateObjectBLOB(addObj.oid,blobs[0],bitsMarkingCollection._uncategorized.dbtype);
+				}
+				if(rtn) rtn = this.Database.removeObject({oid:oid},dbtype);
+
+				if(rtn){
+					if(bitsItemView && bitsItemView.isChecked){
+						var source = bitsMarker.id_key+dbtype+oid;
+						this.Common.changeNodeStyleFromID(source,bitsMarkingCollection._uncategorized.style,0,addObj.oid,bitsMarkingCollection._uncategorized.dbtype);
+					}else{
+						var f_pfid = undefined;
+						var rtnFolder = this.Database.getFolder({fid:fid},dbtype);
+						if(rtnFolder && rtnFolder.length) f_pfid = rtnFolder[0].pfid;
+						rtnFolder = undefined;
+						var dst_fid = pfid;
+						var dst_dbtype = bitsMarkingCollection._uncategorized.dbtype;
+						var dstAbout = this.DataSource.getID2About(dst_fid,undefined,dst_dbtype);
+						var dstRes = this.Common.RDF.GetResource(dstAbout);
+						var srcPRes = this.Common.RDF.GetResource(this.DataSource.getID2About(fid,f_pfid,dbtype));
+						var srcAbout = this.DataSource.getID2About(oid,fid,dbtype);
+						var srcRes = this.Common.RDF.GetResource(srcAbout);
+						if(this.DataSource.moveItem(srcRes, srcPRes, dstRes, -1)){
+							this.DataSource.setProperty(srcRes, "dbtype", dst_dbtype);
+							this.DataSource.setProperty(srcRes, "pfid", dst_fid);
+							this.DataSource.setProperty(srcRes, "id", addObj.oid);
+							this.DataSource.setID2About(oid,pfid,undefined,dbtype);
+							this.DataSource.setID2About(addObj.oid,dst_fid,srcAbout,dst_dbtype);
+							if(mcTreeDNDHandler) mcTreeDNDHandler.changeNodeStyle(srcRes);
+							this.DataSource.flush();
+							if(mcTreeCssService) mcTreeCssService.init();
+							if(mcController) mcController.rebuildLocal();
+						}
+					}
+				}
+			}
+		}else if(rtnObj && rtnObj.length>0 && (bitsItemView && !bitsItemView.isChecked)){
+			var srcAbout = this.DataSource.getID2About(oid,fid,dbtype);
+			var srcRes = this.Common.RDF.GetResource(srcAbout);
+			if(srcRes && this.DataSource.deleteItem(srcRes)){
+				if(mcTreeDNDHandler) mcTreeDNDHandler.changeNodeStyle(srcRes);
+				this.DataSource.flush();
+				if(mcTreeCssService) mcTreeCssService.init();
+				if(mcController) mcController.rebuildLocal();
+			}
+		}
+		if(bitsItemView && bitsItemView.isChecked) bitsItemView.refresh();
+		this.reload(this._classEditNode.ownerDocument);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	reload : function(aDocument){
+		if(bitsTreeListService._reload_timer) clearTimeout(bitsTreeListService._reload_timer);
+		if(aDocument){
+			bitsTreeListService._reload_timer = setTimeout(function(){ bitsTreeListService._reload(aDocument);} ,500);
+		}else{
+			bitsTreeListService._reload(aDocument);
+		}
+	},
+	_reload : function(aDocument){
+		if(!aDocument){
+			var basedir = this.getBaseDir();
+			var res_uri = this.Common.convertFilePathToURL(basedir.path);
+			for(var i=0;i<this.gBrowser.browsers.length;i++){
+				var doc = this.gBrowser.browsers[i].contentDocument;
+				var cur_uri = this.Common.getURLStringFromDocument(doc);
+				if(cur_uri.indexOf(res_uri)>=0) this.reload(doc);
+			}
+			return;
+		}
+		var param = null;
+		var xslpath = undefined;
+		var _fileid = undefined;
+		var xPathResult = this.XPath.evaluate('//meta[@name]',aDocument);
+		for(var k=0;k<xPathResult.snapshotLength;k++){
+			var node = xPathResult.snapshotItem(k);
+			var name = node.getAttribute('name');
+			if(name == 'fid'){
+				var content = node.getAttribute('content');
+				if(content != "0"){
+					if(content.length<=8){
+						var year = content.substr(0,4);
+						var month = content.substr(4,2);
+						var day = content.substr(6,2);
+						if(year){
+							if(!param) param = {};
+							param.date = {};
+							param.date.year = year;
+						}
+						if(year && month) param.date.month = month;
+						if(year && month && day) param.date.day = day;
+					}else if(content.match(/^\d+$/) && content.length==14){
+						if(!param) param = {};
+						param.fid = content;
+					}
+				}
+			}else if(name == 'dbtype'){
+				var dbtype = node.getAttribute('content');
+				if(dbtype && dbtype != ''){
+					if(!param) param = {};
+					param.dbtype = node.getAttribute('content');
+				}
+			}else if(name == 'xslpath'){
+				xslpath = node.getAttribute('content');
+				if(xslpath && xslpath == '') xslpath = undefined;
+			}else if(name == '_fileid'){
+				_fileid = node.getAttribute('content');
+			}
+		}
+		if(param){
+			if(xslpath != bitsTreeListService._listview_drag && !param.fid && param.dbtype) param.fid = "0";
+			if(param.fid){
+				param.fid_title = aDocument.title;
+				window.top.bitsTreeListService.dispList_proc(param,xslpath,_fileid);
+			}else{
+				param.text = aDocument.title;
+				window.top.bitsTreeListService.dispTreeDateList(param,xslpath,_fileid);
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	click : function(aEvent){
+		try{
+			var cur_uri = bitsTreeListService.Common.getURLStringFromDocument(aEvent.target.ownerDocument);
+			var basedir = bitsTreeListService.getBaseDir();
+			var res_uri = bitsTreeListService.Common.convertFilePathToURL(basedir.path);
+			if(cur_uri.indexOf(res_uri)<0) return;
+		}catch(e){
+			bitsTreeListService._dump("bitsTreeListService.click():"+e);
+			return;
+		}
+		bitsTreeListService._classEditNode = null;
+		if(
+			aEvent.target.className == "class" &&
+			(aEvent.target.nodeName == "SPAN" || aEvent.target.nodeName == "DIV") &&
+			aEvent.target.hasAttribute("fid") &&
+			aEvent.target.hasAttribute("oid") &&
+			aEvent.target.hasAttribute("dbtype")
+		){
+			var xPathResult = bitsTreeListService.XPath.evaluate('//meta[@name="xslpath"]', aEvent.target.ownerDocument);
+			if(xPathResult && xPathResult.snapshotLength>0){
+				var node = xPathResult.snapshotItem(0);
+				if(node.getAttribute('content') == bitsTreeListService._listview_drag) bitsTreeListService._classEditNode = aEvent.target;
+			}
+			xPathResult = undefined;
+		}
+		if(bitsTreeListService._classEditNode){
+			if(bitsTreeListService.CLASS_POPUP.openPopupAtScreen){
+				bitsTreeListService.CLASS_POPUP.openPopupAtScreen(aEvent.screenX,aEvent.screenY,true);
+			}else{
+				var elem = document.getElementById("content");
+				bitsTreeListService.CLASS_POPUP.showPopup(elem,aEvent.layerX+elem.boxObject.x,aEvent.layerY+6,"context","topleft","bottomright");
+			}
+			return;
+		}else{
+			bitsTreeListService.CLASS_POPUP.hidePopup();
+		}
+		var elem = aEvent.target;
+		var edit = elem.getAttribute("edit");
+		var select = elem.getAttribute("select");
+		var edit_text = "";
+		var edit_elem = undefined;
+		var select_elem = undefined;
+		if((!select || select != "true") && elem.firstChild){
+			var cElem = elem.firstChild;
+			for(;cElem;cElem = cElem.nextSibling){
+				if(!cElem || !cElem.getAttribute) continue;
+				select = cElem.getAttribute("select");
+				if(select != "true") continue;
+				select_elem = cElem;
+				break;
+			}
+		}else{
+			select_elem = elem;
+		}
+		if((!edit || edit != "true") && elem.firstChild){
+			var cElem = elem.firstChild;
+			for(;cElem;cElem = cElem.nextSibling){
+				if(!cElem || !cElem.getAttribute) continue;
+				edit = cElem.getAttribute("edit");
+				if(edit != "true") continue;
+				edit_elem = cElem;
+				break;
+			}
+		}else{
+			edit_elem = elem;
+		}
+		if(!edit_elem && !select_elem){
+			var targetWindow = bitsTreeListService.Common.getFocusedWindow();
+			var selection = targetWindow.getSelection();
+			selection.removeAllRanges();
+			return;
+		}
+		var oid = edit_elem.getAttribute("oid");
+		var dbcolumn = edit_elem.getAttribute("dbcolumn");
+		if(!dbcolumn) dbcolumn = edit_elem.getAttribute("type");
+		var dbtype = edit_elem.getAttribute("dbtype");
+		if(select == "true" && select_elem){
+			var value = edit_elem.getAttribute("value");
+			if(!value || value == ""){
+				var pfid = edit_elem.getAttribute("pfid");
+				value = bitsTreeListService.DataSource.getID2About(oid,pfid,dbtype);
+			}
+			var res = bitsTreeListService.Common.RDF.GetResource(value);
+			var resArr = [];
+			var parentRes = res;
+			do{
+				parentRes = bitsTreeListService.DataSource.findParentResource(parentRes);
+				if(parentRes) resArr.push(parentRes);
+			}while(parentRes && parentRes.Value != bitsTreeListService.DataSource.ABOUT_ROOT);
+			var mcTreeHandler = this.mcTreeHandler;
+			if(mcTreeHandler){
+				for(var i=resArr.length-1;i>=0;i--){
+					var selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(resArr[i]);
+					if(selectIdx>=0 && !mcTreeHandler.TREE.view.isContainerOpen(selectIdx)) mcTreeHandler.TREE.view.toggleOpenState(selectIdx);
+				}
+				var idx = mcTreeHandler.TREE.builderView.getIndexOfResource(res);
+				if(idx>=0){
+					mcTreeHandler.TREE.currentIndex = idx;
+					if(!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex)) mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+					mcTreeHandler.TREE.focus();
+					mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(idx);
+					this.mcPropertyView.dispProperty(mcTreeHandler.object);
+				}
+			}
+		}
+		if(edit != "true" || !edit_elem) return;
+		if(edit_elem.nodeName == "IMG"){
+			var elemid = "image"+oid;
+			edit_elem.setAttribute("id", elemid); 
+			var orgIMG = new Image();
+			if(!orgIMG) return;
+			orgIMG.src = edit_elem.src;
+			orgIMG.onload = function(){
+				var elemid = "divIMG"+oid;
+				var divElem = elem.ownerDocument.getElementById(elemid);
+				if(!divElem){
+					divElem = elem.ownerDocument.createElement("div");
+					if(divElem){
+						divElem.setAttribute("id",elemid);
+						divElem.addEventListener("mouseout", bitsTreeListService.mouseoutIMG, false);
+						edit_elem.parentNode.appendChild(divElem);
+					}
+				}
+				if(!divElem) return;
+				var style = "position:absolute;left:"+edit_elem.x+"px;top:"+edit_elem.y+"px;width:"+ edit_elem.width +"px;height:"+ edit_elem.height +"px;"
+				style += "border:1px solid blue;";
+				divElem.setAttribute("style", style); 
+				var btn1id = "btn1IMG"+oid;
+				var btn1Elem = elem.ownerDocument.getElementById(btn1id);
+				if(!btn1Elem){
+					btn1Elem = elem.ownerDocument.createElement("img");
+					if(btn1Elem){
+						btn1Elem.setAttribute("id",btn1id);
+						btn1Elem.setAttribute("oid", oid);
+						btn1Elem.setAttribute("dbtype", dbtype);
+						btn1Elem.src = "chrome://markingcollection/skin/twisty-clsd.png";
+						btn1Elem.addEventListener("click", bitsTreeListService.resizeIMG_P, false);
+						divElem.appendChild(btn1Elem);
+					}
+				}
+				if(!btn1Elem) return;
+				var style = "position:absolute;left:2px;top:1px;"
+				if(edit_elem.width>=orgIMG.width && edit_elem.height>=orgIMG.height){
+					style += "opacity:0.3;";
+				}else{
+					style += "cursor:pointer;";
+				}
+				btn1Elem.setAttribute("style", style);
+				var btn2id = "btn2IMG"+oid;
+				var btn2Elem = elem.ownerDocument.getElementById(btn2id);
+				if(!btn2Elem){
+					btn2Elem = elem.ownerDocument.createElement("img");
+					if(btn2Elem){
+						btn2Elem.setAttribute("id",btn2id);
+						btn2Elem.setAttribute("oid", oid);
+						btn2Elem.setAttribute("dbtype", dbtype);
+						btn2Elem.src = "chrome://markingcollection/skin/twisty-open.png";
+						btn2Elem.addEventListener("click", bitsTreeListService.resizeIMG_M, false);
+						divElem.appendChild(btn2Elem);
+					}
+				}
+				if(!btn2Elem) return;
+				var style = "position:absolute;left:13px;top:1px;"
+				if(edit_elem.width<=100 && edit_elem.height<=100){
+					style += "opacity:0.3;";
+				}else{
+					style += "cursor:pointer;";
+				}
+				btn2Elem.setAttribute("style", style); 
+				if(bitsTreeListService._click_oid != "" && bitsTreeListService._click_oid != oid){
+					var elemid = "divIMG"+bitsTreeListService._click_oid;
+					var oldElem = elem.ownerDocument.getElementById(elemid);
+					if(oldElem) oldElem.style.display = "none";
+				}
+				bitsTreeListService._click_oid = oid;
+				bitsTreeListService._click_dbtype = dbtype;
+				divElem.style.display = "";
+			}
+			return;
+		}
+		var nodeWalker = edit_elem.ownerDocument.createTreeWalker(edit_elem,NodeFilter.SHOW_TEXT,null,false);
+		var txtNode=nodeWalker.nextNode(); 
+		for(;txtNode;txtNode = nodeWalker.nextNode()){
+			edit_text += txtNode.nodeValue;
+		}
+		var elemid = dbcolumn+oid;
+		var textElem = elem.ownerDocument.getElementById(elemid);
+		if(!textElem) textElem = elem.ownerDocument.createElement("textarea");
+		if(!textElem) return;
+		textElem.setAttribute("id",elemid);
+		textElem.setAttribute("wrap","soft");
+		textElem.setAttribute("style","font-family:arial;font-size:0.9em;width:"+(edit_elem.parentNode.offsetWidth-3)+"px;height:"+(edit_elem.parentNode.offsetHeight-3)+"px;min-height:3em;");
+		textElem.setAttribute("oid",oid);
+		textElem.setAttribute("dbcolumn",dbcolumn);
+		textElem.setAttribute("dbtype",dbtype);
+		textElem.defaultValue = edit_text;
+		textElem.value = edit_text;
+		edit_elem.parentNode.insertBefore(textElem,edit_elem);
+		edit_elem.style.display = "none";
+		textElem.focus();
+		textElem.select();
+		textElem.addEventListener("blur", bitsTreeListService.blur, false);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	mouseoutIMG : function(aEvent){
+		try{
+			var elem = aEvent.target;
+			if(elem.nodeName != "DIV") return;
+			if(elem.offsetLeft <= aEvent.pageX && aEvent.pageX < (elem.offsetLeft+elem.offsetWidth) &&
+				 elem.offsetTop  <= aEvent.pageY && aEvent.pageY < (elem.offsetTop +elem.offsetHeight)) return;
+			elem.style.display = "none";
+			bitsTreeListService._click_oid = "";
+			bitsTreeListService._click_dbtype = "";
+		}catch(ex){
+			elem.style.display = "none";
+			try{
+				bitsTreeListService._click_oid = "";
+				bitsTreeListService._click_dbtype = "";
+			}catch(ex2){}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	resizeIMG_P : function(aEvent){
+		try{
+			var elem = aEvent.target;
+			var oid = elem.getAttribute("oid");
+			var dbtype = elem.getAttribute("dbtype");
+			var elemid = "image"+oid;
+			var imgElem = elem.ownerDocument.getElementById(elemid);
+			if(!imgElem) return;
+			var orgIMG = new Image();
+			if(!orgIMG) return;
+			orgIMG.src = imgElem.src;
+			orgIMG.onload = function(){
+				var elemid = "divIMG"+oid;
+				var divElem = elem.ownerDocument.getElementById(elemid);
+				if(!divElem) return;
+				var width = parseInt(divElem.offsetWidth * 1.1);
+				var height = parseInt(divElem.offsetHeight * 1.1);
+				if(orgIMG.width>0 && width>orgIMG.width) width = orgIMG.width;
+				if(orgIMG.height>0 && height>orgIMG.height) height = orgIMG.height;
+				divElem.style.width = width + "px";
+				divElem.style.height = height + "px";
+				if(bitsTreeListService._timerid) clearTimeout(bitsTreeListService._timerid);
+				bitsTreeListService._timerid = setTimeout(bitsTreeListService.updateDBImageSize,1000,elem.ownerDocument,oid,dbtype,width,height);
+			}
+		}catch(ex){
+			bitsTreeListService._dump("bitsTreeListService.resizeIMG_P():"+ex);
+		}
+		aEvent.stopPropagation();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	resizeIMG_M : function(aEvent){
+		try{
+			var elem = aEvent.target;
+			var oid = elem.getAttribute("oid");
+			var dbtype = elem.getAttribute("dbtype");
+			var elemid = "divIMG"+oid;
+			var divElem = elem.ownerDocument.getElementById(elemid);
+			if(!divElem) return;
+			var width = parseInt(divElem.offsetWidth * 0.9);
+			var height = parseInt(divElem.offsetHeight * 0.9);
+			if(width<100 && height<100){
+			}else{
+				divElem.style.width = width + "px";
+				divElem.style.height = height + "px";
+			}
+			if(bitsTreeListService._timerid) clearTimeout(bitsTreeListService._timerid);
+			bitsTreeListService._timerid = setTimeout(bitsTreeListService.updateDBImageSize,1000,elem.ownerDocument,oid,dbtype,width,height);
+		}catch(ex){
+			bitsTreeListService._dump("bitsTreeListService.resizeIMG_M():"+ex);
+		}
+		aEvent.stopPropagation();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	updateDBImageSize : function(aDoc,oid,dbtype,width,height){
+		try{
+			if(bitsTreeListService._timerid){
+				clearTimeout(bitsTreeListService._timerid);
+				bitsTreeListService._timerid = null;
+			}
+			var elemid = "image"+oid;
+			var imgElem = aDoc.getElementById(elemid);
+			if(!imgElem) return;
+			var orgIMG = new Image();
+			if(!orgIMG) return;
+			var elemid = "divIMG"+oid;
+			var divElem = aDoc.getElementById(elemid);
+			if(!divElem) return;
+			divElem.style.display = "none";
+			orgIMG.src = imgElem.src;
+			orgIMG.onload = function(){
+				if(width<100 && height<100){
+					if(orgIMG.width>width && orgIMG.height>height){
+						if(orgIMG.width>orgIMG.height){
+							width  = 100;
+							height = parseInt((orgIMG.height*100)/orgIMG.width);
+						}else{
+							width = parseInt((orgIMG.width*100)/orgIMG.height);
+							height  = 100;
+						}
+						imgElem.style.maxWidth = width + "px";
+						imgElem.style.maxHeight = height + "px";
+						imgElem.width = width;
+						imgElem.height = height;
+					}else{
+						imgElem.style.maxWidth = "100px";
+						imgElem.style.maxHeight = "100px";
+					}
+				}else{
+					imgElem.style.maxWidth = width + "px";
+					imgElem.style.maxHeight = height + "px";
+					imgElem.width = width;
+					imgElem.height = height;
+				}
+				var rtnObj = bitsTreeListService.Database.getObject({oid:oid},dbtype);
+				if(rtnObj){
+					var value = imgElem.width.toString() + "," + imgElem.height.toString();
+					var newObj = {oid:rtnObj[0].oid};
+					newObj.oid_property = rtnObj[0].oid_property;
+					newObj.oid_property = newObj.oid_property.replace(/[\r\n\t]/mg," __BR__ ");
+					if(newObj.oid_property.match(/^(.*<IMG_LIST_DISP_SIZE>)(.*?)(<\/IMG_LIST_DISP_SIZE>.*)$/m)){
+						newObj.oid_property = RegExp.$1 + value + RegExp.$3;
+					}else if(newObj.oid_property.match(/^(<PROPERTY>)(.*<\/PROPERTY>)$/m)){
+						newObj.oid_property = RegExp.$1 + "<IMG_LIST_DISP_SIZE>" + value + "</IMG_LIST_DISP_SIZE>" + RegExp.$2;
+					}else{
+						newObj.oid_property = "<PROPERTY><IMG_LIST_DISP_SIZE>" + value + "</IMG_LIST_DISP_SIZE></PROPERTY>";
+					}
+					newObj.oid_property = newObj.oid_property.replace(/ __BR__ /mg,"\n");
+					bitsTreeListService.Database.updateObject(newObj,dbtype);
+				}
+				var elemid = "divIMG"+oid;
+				var divElem = aDoc.getElementById(elemid);
+				if(divElem){
+					var style = "position:absolute;left:"+imgElem.x+"px;top:"+imgElem.y+"px;width:"+ imgElem.width +"px;height:"+ imgElem.height +"px;"
+					style += "border:1px solid blue;";
+					divElem.setAttribute("style", style); 
+					var btn1id = "btn1IMG"+oid;
+					var btn1Elem = aDoc.getElementById(btn1id);
+					if(btn1Elem){
+						var style = "position:absolute;left:2px;top:1px;"
+						if(imgElem.width>=orgIMG.width && imgElem.height>=orgIMG.height){
+							style += "opacity:0.3;";
+						}else{
+							style += "cursor:pointer;";
+						}
+						btn1Elem.setAttribute("style", style);
+					}
+					var btn2id = "btn2IMG"+oid;
+					var btn2Elem = aDoc.getElementById(btn2id);
+					if(btn2Elem){
+						var style = "position:absolute;left:13px;top:1px;"
+						if(imgElem.width<=100 && imgElem.height<=100){
+							style += "opacity:0.3;";
+						}else{
+							style += "cursor:pointer;";
+						}
+						btn2Elem.setAttribute("style", style); 
+					}
+					divElem.style.display = "";
+				}
+			};
+		}catch(ex){
+			bitsTreeListService._dump("bitsTreeListService.updateDBImageSize():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	blur : function(aEvent){
+		var textElem = aEvent.target;
+		var nextElem = textElem.nextSibling;
+		try{
+			var dbcolumn = textElem.getAttribute("dbcolumn");
+			if(!dbcolumn) dbcolumn = textElem.getAttribute("type");
+			if(dbcolumn && dbcolumn == "title"){
+				var value = textElem.value;
+				value = value.replace(/^\s+/g,"").replace(/\s+$/g,"");
+				if(value == ""){
+					bitsTreeListService.Common.alert(bitsTreeListService.STRING.getString("ERROR_NOT_ENTER_TITLE"));
+					textElem.value = textElem.defaultValue;
+					if(aEvent.cancelable){
+						aEvent.preventDefault();
+						aEvent.stopPropagation();
+						setTimeout(function(){
+							textElem.focus();
+							textElem.select();
+						},0);
+						return;
+					}
+				}
+			}
+		}catch(e){}
+		if(textElem.value != textElem.defaultValue){
+			nextElem.innerHTML = textElem.value;
+			var oid = textElem.getAttribute("oid");
+			var dbtype = textElem.getAttribute("dbtype");
+			var rtnObj = bitsTreeListService.Database.getObject({oid:oid},dbtype);
+			if(rtnObj){
+				var newObj = {oid:rtnObj[0].oid};
+				var dbcolumn = textElem.getAttribute("dbcolumn");
+				if(!dbcolumn) dbcolumn = textElem.getAttribute("type");
+				dbcolumn = dbcolumn.toLowerCase();
+				if(dbcolumn == "title" || dbcolumn == "note" || dbcolumn.match(/^property::.+/im)){
+					if(dbcolumn == "title"){
+						newObj.oid_title = textElem.value;
+					}else if(dbcolumn == "note"){
+						newObj.oid_property = rtnObj[0].oid_property;
+						newObj.oid_property = newObj.oid_property.replace(/[\r\n\t]/mg," __BR__ ");
+						if(newObj.oid_property.match(/^(.*<NOTE>)(.*?)(<\/NOTE>.*)$/m)){
+							newObj.oid_property = RegExp.$1 + textElem.value + RegExp.$3;
+						}else if(newObj.oid_property.match(/^(<PROPERTY>)(.*<\/PROPERTY>)$/m)){
+							newObj.oid_property = RegExp.$1 + "<NOTE>" + textElem.value + "</NOTE>" + RegExp.$2;
+						}else{
+							newObj.oid_property = "<PROPERTY><NOTE>" + textElem.value + "</NOTE></PROPERTY>";
+						}
+						newObj.oid_property = newObj.oid_property.replace(/ __BR__ /mg,"\n");
+					}else if(dbcolumn.match(/^property::(.+)$/im)){
+						var tag = RegExp.$1;
+						tag = tag.toUpperCase();
+						var oid_property = rtnObj[0].oid_property;
+						oid_property = oid_property.replace(/[\r\n\t]/mg," __BR__ ");
+						var re1 = new RegExp("^(.*<" + tag + ">)(.*?)(</" + tag + ">.*)$","m");
+						if(oid_property.match(re1)){
+							oid_property = RegExp.$1 + textElem.value + RegExp.$3;
+						}else if(oid_property.match(/^(<PROPERTY>)(.*<\/PROPERTY>)$/m)){
+							oid_property = RegExp.$1 + "<" + tag + ">" + textElem.value + "</" + tag + ">" + RegExp.$2;
+						}else{
+							oid_property = "<PROPERTY><" + tag + ">" + textElem.value + "</" + tag + "></PROPERTY>";
+						}
+						newObj.oid_property = oid_property.replace(/ __BR__ /mg,"\n");
+					}
+					bitsTreeListService.Database.updateObject(newObj,dbtype);
+					var contentWindow = null;
+					var mcTreeViewModeService = null;
+					var bitsItemView = null;
+					if(bitsMarkingCollection._contentWindow) contentWindow = bitsMarkingCollection._contentWindow;
+					if(contentWindow && contentWindow.mcTreeViewModeService) mcTreeViewModeService = contentWindow.mcTreeViewModeService;
+					if(contentWindow && contentWindow.bitsItemView) bitsItemView = contentWindow.bitsItemView;
+					if(bitsItemView){
+						if(bitsItemView.isChecked){
+							bitsItemView.refresh();
+						}else{
+							if(mcTreeViewModeService) mcTreeViewModeService.rebuild();
+						}
+					}
+				}
+			}
+		}
+		textElem.style.width = "0px";
+		textElem.style.height = "0px";
+		textElem.style.display = "none";
+		nextElem.style.display = "";
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onPopupShowing : function(aEvent){
+		try{
+			if(
+				aEvent.target.id != "mcPopupTreeListViewMenuPopup" &&
+				aEvent.target.id != "mcPopupFolderTreeListViewMenuPopup" &&
+				aEvent.target.id != "mcPopupDateFolderTreeListViewMenuPopup"
+			) return;
+			var self = bitsTreeListService;
+			var dir = self.getDefaultTemplateDir();
+			if(dir.exists()){
+				var entries = dir.directoryEntries;
+				while(entries.hasMoreElements()){
+					var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+					self.createMenu(aEvent.target,entry);
+				}
+			}
+			if(aEvent.target.lastChild.nodeName.toLowerCase() != "menuseparator"){
+				var elemMenuseparator = aEvent.target.ownerDocument.createElement("menuseparator");
+				if(elemMenuseparator) aEvent.target.insertBefore(elemMenuseparator,elemMenuitem);
+			}
+			var dir  = self.getTemplateDir();
+			if(dir.exists()){
+				var entries = dir.directoryEntries;
+				while(entries.hasMoreElements()){
+					var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+					self.createMenu(aEvent.target,entry);
+				}
+			}
+			var disabled = false;
+			if(aEvent.target.lastChild.nodeName.toLowerCase() != "menuseparator"){
+				var elemMenuseparator = aEvent.target.ownerDocument.createElement("menuseparator");
+				if(elemMenuseparator) aEvent.target.appendChild(elemMenuseparator);
+			}else{
+				disabled = true;
+			}
+			var elemMenuSub = top.document.createElement("menu");
+			var elemMenuSubpopup = top.document.createElement("menupopup");
+			if(elemMenuSub && elemMenuSubpopup){
+				var label = self.STRING.getString("STYLESHEET");
+				elemMenuSub.setAttribute("label",label);
+				elemMenuSub.setAttribute("class","menu-iconic");
+				elemMenuSub.setAttribute("image","chrome://markingcollection/skin/icon_option.gif");
+				elemMenuSub.appendChild(elemMenuSubpopup);
+				aEvent.target.appendChild(elemMenuSub);
+				var label = self.STRING.getString("ADD_STYLESHEET");
+				var elemMenuitem = aEvent.target.ownerDocument.createElement("menuitem");
+				if(elemMenuitem){
+					elemMenuitem.setAttribute("id","mcPopupTreeListViewAddStyleSheet");
+					elemMenuitem.setAttribute("label",label+"...");
+					elemMenuitem.setAttribute("image","chrome://markingcollection/skin/add_stylesheet.png");
+					elemMenuitem.setAttribute("class","menuitem-iconic");
+					elemMenuSubpopup.appendChild(elemMenuitem);
+				}
+				var label = self.STRING.getString("DEL_STYLESHEET");
+				var elemMenuitem = aEvent.target.ownerDocument.createElement("menuitem");
+				if(elemMenuitem){
+					elemMenuitem.setAttribute("id","mcPopupTreeListViewDelStyleSheet");
+					elemMenuitem.setAttribute("label",label+"...");
+					elemMenuitem.setAttribute("image","chrome://markingcollection/skin/remove_stylesheet.png");
+					elemMenuitem.setAttribute("class","menuitem-iconic");
+					if(disabled) elemMenuitem.setAttribute("disabled","true");
+					elemMenuSubpopup.appendChild(elemMenuitem);
+				}
+			}
+		}catch(ex){
+			self._dump("bitsTreeListService.onPopupShowing():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onPopupHiding : function(aEvent){
+		if(
+			aEvent.target.id != "mcPopupTreeListViewMenuPopup" &&
+			aEvent.target.id != "mcPopupFolderTreeListViewMenuPopup" &&
+			aEvent.target.id != "mcPopupDateFolderTreeListViewMenuPopup"
+		) return;
+		var elem = aEvent.target.lastChild;
+		for(var i=aEvent.target.childNodes.length-1;i>=2;i--){
+			aEvent.target.removeChild(aEvent.target.childNodes[i]);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onPopupFShowing : function(aEvent){
+		this._explicitOriginalTarget = aEvent.explicitOriginalTarget;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onCommand : function(aEvent){
+		switch(aEvent.target.id){
+			case "mcPopupTreeListViewAddStyleSheet":
+				bitsTreeListService.getStyleSheetFile();
+				break;
+			case "mcPopupTreeListViewDelStyleSheet":
+				bitsTreeListService.removeStyleSheetFile();
+				break;
+			default:
+				bitsTreeListService.dispList(aEvent,aEvent.target.id);
+				break;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getStyleSheetFile : function (){
+		var picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
+		var result = false;
+		try{
+			picker.init(window, "Selected Stylesheet File", picker.modeOpen);
+			picker.appendFilter("XSL Stylesheet","*.xsl");
+			picker.filterIndex = 0;
+			var showResult = picker.show();
+			if(showResult == picker.returnOK){
+				var dir = bitsTreeListService.getTemplateDir().clone();
+				var aFile = dir.clone();
+				aFile.append(picker.file.leafName);
+				if(aFile.exists() && this.Common.confirm(this.STRING.getString("CONFIRM_UPDATE_STYLESHEET"))) aFile.remove(false);
+				if(!aFile.exists()){
+					picker.file.copyTo(dir,picker.file.leafName);
+					result = true;
+				}
+			}
+		}catch(e){
+			result = false;
+			this.Common.alert(e);
+		}
+		return result;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	removeStyleSheetFile : function (){
+		var result = {
+			accept : false,
+			list   : [],
+			title  : this.STRING.getString("STYLESHEET") + this.STRING.getString("DEL_STYLESHEET"),
+		};
+		var dir  = this.getTemplateDir();
+		var entries = dir.directoryEntries;
+		while(entries.hasMoreElements()){
+			var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+			if(entry.isFile()){
+				result.list.push(entry);
+			}else if(entry.isDirectory()){
+			}
+		}
+		window.openDialog("chrome://markingcollection/content/removeDialog.xul", "", "chrome,centerscreen,modal", result);
+		if(result.accept){
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getDefaultTemplateDir : function(){
+		var dir  = window.top.bitsMarkingCollection.getExtInstDir().clone();
+		dir.append("stylesheet");
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getTemplateDir : function(){
+		var dir  = window.top.bitsMarkingCollection.getExtensionDir().clone();
+		dir.append("stylesheet");
+		if(!dir.exists()) dir.create(dir.DIRECTORY_TYPE, 0700);
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createMenu : function(aParentNode,aEntry){
+		if(aEntry.isFile() && aEntry.leafName.match(/^(.+)\.xsl$/m)){
+			var label = RegExp.$1;
+			var elemMenuitem = top.document.createElement("menuitem");
+			if(elemMenuitem){
+				elemMenuitem.setAttribute("id",this.Common.convertFilePathToURL(aEntry.path));
+				elemMenuitem.setAttribute("label",label);
+				elemMenuitem.setAttribute("image","chrome://markingcollection/skin/stylesheet.png");
+				elemMenuitem.setAttribute("class","menuitem-iconic");
+				aParentNode.appendChild(elemMenuitem);
+			}
+		}else if(aEntry.isDirectory()){
+			var elemMenuSub = top.document.createElement("menu");
+			var elemMenuSubpopup = top.document.createElement("menupopup");
+			if(!elemMenuSub || !elemMenuSubpopup) return;
+			elemMenuSub.setAttribute("label",unescape(aEntry.leafName));
+			elemMenuSub.setAttribute("class","menu-iconic");
+			elemMenuSub.setAttribute("image","chrome://markingcollection/skin/treefolder.png");
+			elemMenuSubpopup.setAttribute("id",this.Common.convertFilePathToURL(aEntry.path));
+			elemMenuSub.appendChild(elemMenuSubpopup);
+			aParentNode.appendChild(elemMenuSub);
+			var entries = aEntry.directoryEntries;
+			while(entries.hasMoreElements()){
+				var entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+				this.createMenu(elemMenuSubpopup,entry);
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	loadText : function(aURI){
+		try {
+			var channel = this.Common.IO.newChannelFromURI(aURI);
+			var stream  = channel.open();
+			var scriptableStream = Components.classes['@mozilla.org/scriptableinputstream;1'].createInstance(Components.interfaces.nsIScriptableInputStream);
+			scriptableStream.init(stream);
+			var fileContents = scriptableStream.read(scriptableStream.available());
+			scriptableStream.close();
+			stream.close();
+			return fileContents;
+		}
+	  catch(e){ }
+	  return null;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	xmlEncode : function(aString){
+		return aString.replace(/&nbsp;/mg," ").replace(/&/mg,"&amp;").replace(/</mg,"&lt;").replace(/>/mg,"&gt;").replace(/\"/mg,"&quot;");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	dispList : function(aEvent,aXSLPath){
+		aEvent.preventDefault();
+		aEvent.stopPropagation();
+		var contentWindow = null;
+		var mcTreeHandler = null;
+		var bitsTreeDate = null;
+		var mcTreeViewModeService = null;
+		if(bitsMarkingCollection._contentWindow) contentWindow = bitsMarkingCollection._contentWindow;
+		if(contentWindow && contentWindow.mcTreeHandler) mcTreeHandler = contentWindow.mcTreeHandler;
+		if(contentWindow && contentWindow.bitsTreeDate) bitsTreeDate = contentWindow.bitsTreeDate;
+		if(!mcTreeHandler || !bitsTreeDate) return;
+		this._viewmode = nsPreferences.copyUnicharPref("wiredmarker.viewmode","all");
+		if(contentWindow && contentWindow.mcTreeViewModeService) mcTreeViewModeService = contentWindow.mcTreeViewModeService;
+		if(mcTreeViewModeService) this._viewmode = mcTreeViewModeService.viewmode;
+		if(bitsTreeDate.isChecked){
+			var curIdx = bitsTreeDate.TREE.currentIndex;
+			if(curIdx<0) return;
+			var obj = bitsTreeDate.getRowObject(curIdx);
+			if(obj) this.dispTreeDateList(obj,aXSLPath);
+		}else{
+			var curIdx = mcTreeHandler.TREE.currentIndex;
+			if(curIdx<0) return;
+			var aRes = null;
+			if(!mcTreeHandler.TREE.view.isContainer(curIdx)) return;
+			aRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+			if(aRes){
+				var fid = this.DataSource.getProperty(aRes,"id");
+				var dbtype = this.DataSource.getProperty(aRes,"dbtype");
+				if(fid != "0"){
+					var aFolder = this.Database.getFolderFormID(fid,dbtype);
+					if(aFolder) this.dispList_proc(aFolder[0],aXSLPath);
+				}else{
+					this.dispList_proc({fid:fid,dbtype:dbtype,fid_title:this.DataSource.getProperty(aRes,"title")},aXSLPath);
+				}
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	initLocalParam : function(aFileid){
+		this.id2img = {};
+		this.id2icon = {};
+		this.id2type = {};
+		this.id2text = {};
+		this.id2uri = {};
+		this.id2uri_content = {};
+		this.id2st = {};
+		this.id2en = {};
+		this.id2property = {};
+		this.id2dbtype = {};
+		this.id2style = {};
+		this.id2pfid = {};
+		this.id2fid_title = {};
+		this.id2folder = {};
+		this.id2Value = {};
+		this.id2date = {};
+		this.id2exists = {};
+		this._fileid = (aFileid?aFileid:this.Common.getTimeStamp());
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getObjectKey : function(aObject){
+		return aObject.dbtype + '_' + aObject.oid;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	setLocalParam : function(aObject){
+		var oid_key = this.getObjectKey(aObject);
+		if(aObject.oid_type.match(/^image\/(.+)$/)){
+			var blob = this.Database.getObjectBLOB(aObject.oid,aObject.dbtype);
+			if(blob && blob.length>0 && blob[0].length>0){
+				var images = String.fromCharCode.apply(String, blob[0]);
+				var image_b64 = btoa(images); // base64 encoding
+				image_b64 = 'data:' + aObject.oid_type + ';base64,' + image_b64;
+				this.id2img[oid_key] = image_b64;
+				this.id2icon[oid_key] = image_b64;
+				var blobFile = this.Database.getObjectBLOBFile(aObject.oid,aObject.dbtype);
+				var blobUrl = this.Common.convertFilePathToURL(blobFile.path);
+				if(aObject.doc_url == blobUrl){
+					aObject.doc_url = image_b64;
+					this.id2uri[oid_key] = aObject.doc_url;
+				}
+				if(aObject.con_url == blobUrl){
+					aObject.con_url = image_b64;
+					this.id2uri_content[oid_key] = aObject.con_url;
+				}
+			}
+			this.id2text[oid_key] = aObject.oid_txt;
+		}else if(aObject.oid_type == "text"){
+			this.id2text[oid_key] = aObject.oid_txt;
+		}else if(aObject.oid_type == "url"){
+			this.id2text[oid_key] = aObject.oid_txt;
+			var icon = this.Database.getFavicon(aObject.oid_txt,aObject.dbtype);
+			if(!icon) icon = this.Database.getFavicon(aObject.doc_url,aObject.dbtype);
+			if(icon) this.id2icon[oid_key] = icon;
+		}
+		if(!this.id2icon[oid_key] && aObject.oid_property){
+			var parser = new DOMParser();
+			var xmldoc = parser.parseFromString(aObject.oid_property, "text/xml");
+			parser = undefined;
+			var icon=null;
+			if(xmldoc){
+				var xmlnode = xmldoc.getElementsByTagName("ICON")[0];
+				if(xmlnode) icon = xmlnode.textContent;
+			}else{
+				if(aObject.oid_property.match(/^.*<ICON>(.+?)<\/ICON>.*$/m)){
+					icon = RegExp.$1;
+				}
+			}
+			if(icon && icon != ""){
+				var url = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURL);
+				url.spec = icon;
+				if(url.scheme == "file"){
+					var file = bitsObjectMng.Common.convertURLToFile(icon)
+					if(!file.exists()) icon = undefined;
+				}else if(url.scheme == "chrome"){
+					var val = this.existsIcon(url);
+					if(!val) icon = undefined;
+				}
+			}
+			if(!icon) icon = this.Database.getFavicon(aObject.doc_url,aObject.dbtype);
+			if(!icon) icon = this.Common.getChromeImageURI(this.Common.convertURLToObject('chrome://markingcollection/skin/defaultFavicon.png'));
+			if(icon) this.id2icon[oid_key] = icon;
+		}
+		this.id2uri[oid_key] = aObject.doc_url;
+		this.id2uri_content[oid_key] = aObject.con_url;
+		this.id2date[oid_key] = aObject.oid_date.replace(/(\d{2}\/\d{2})\/(\d{4})/,"$2/$1");
+		this.id2type[oid_key] = aObject.oid_type;
+		this.id2st[oid_key] = aObject.bgn_dom;
+		this.id2en[oid_key] = aObject.end_dom;
+		if(aObject.oid_property && aObject.oid_property != "") this.id2property[oid_key] = aObject.oid_property;
+		this.id2dbtype[oid_key] = aObject.dbtype;
+		if(!this.id2folder[oid_key]) this.id2folder[oid_key] = [];
+		this.id2folder[oid_key].push({
+			fid       : aObject.pfid,
+			fid_title : aObject.fid_title,
+			fid_style : aObject.fid_style.replace(/([:;\(,])\s+/mg,"$1")
+		});
+		if(!this.id2style[oid_key] && aObject.fid_style != undefined && aObject.fid_style != "") this.id2style[oid_key] = aObject.fid_style.replace(/([:;\(,])\s+/mg,"$1");
+		if(!this.id2fid_title[oid_key] && aObject.fid_title != undefined && aObject.fid_title != "") this.id2fid_title[oid_key] = aObject.fid_title;
+		if(!this.id2pfid[oid_key] && aObject.pfid != undefined && aObject.pfid != "") this.id2pfid[oid_key] = aObject.pfid;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createBaseXML : function(aFID,aDBType,aTitle,aXSLPath){
+		var aContent = '<?xml version="1.0" encoding="utf-8"?>\n';
+		var note = "";
+		var aURL = null;
+		if(!aXSLPath) aXSLPath = "chrome://markingcollection/content/treelistview.xsl";
+		if(aXSLPath && aXSLPath.match(/^file:/)){
+			note = this.Common.readFile(this.Common.convertURLToFile(aXSLPath));
+		}else if(aXSLPath && aXSLPath.match(/^chrome:/)){
+			note = this.loadText(this.Common.convertURLToObject(aXSLPath));
+		}
+		if(note && note != ""){
+			var type = "xsl";
+			var typefile  = bitsTreeListService.getTreeListDir();
+			typefile.append(aFID+"."+type);
+			if(typefile.exists()) typefile.remove(false);
+			typefile.create(typefile.NORMAL_FILE_TYPE, 0666);
+			var typefile_ostream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
+			typefile_ostream.init(typefile, 2, 0x200, false);
+			this.Common.UNICODE.charset = "UTF-8";
+			note = this.Common.UNICODE.ConvertFromUnicode(note);
+			typefile_ostream.write(note, note.length);
+			typefile_ostream.close();
+			aContent += '<?xml-stylesheet type="text/'+type+'" href="'+aFID+'.'+type+'"?>\n';
+		}
+		if(!aTitle) aTitle = "";
+		if(!aDBType) aDBType = "";
+		if(!aFID) aFID = "";
+		aContent += '<!DOCTYPE LIST>\n<LIST title="'+aTitle+'" fid="'+aFID+'" dbtype="'+aDBType+'" xslpath="'+aXSLPath+'" _fileid="'+this._fileid+'">\n';
+		aContent += "</LIST>\n";
+		bitsTreeExportService.createXMLDoc(aContent);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	loadURL : function(aURL,aFileid){
+		var cur_uri = this.Common.getURLStringFromDocument(this.gBrowser.contentDocument);
+		var basedir = this.getBaseDir();
+		if(aFileid) basedir.append(aFileid);
+		var res_uri = this.Common.convertFilePathToURL(basedir.path);
+		if(cur_uri.indexOf(res_uri)>=0) this._doc = this.gBrowser.contentDocument;
+		var loadFlag = false;
+		if(this.gBrowser.browsers.length == 1 && res_uri != "" && cur_uri.indexOf(res_uri)<0){
+			loadFlag = true;
+		}else if(cur_uri.indexOf(res_uri)>=0){
+			loadFlag = false;
+		}else{
+			loadFlag = true;
+			for(var i=0;i<this.gBrowser.browsers.length;i++){
+				var doc = this.gBrowser.browsers[i].contentDocument;
+				var cur_uri = this.Common.getURLStringFromDocument(doc);
+				if(cur_uri.indexOf(res_uri)>=0){
+					loadFlag = false;
+					if(!aFileid) this.gBrowser.tabContainer.selectedIndex = i;
+					break;
+				}
+			}
+		}
+		var self = this;
+		setTimeout(function(){ self._loadURL(aURL,aFileid,loadFlag); },0);
+	},
+	_loadURL : function(aURL,aFileid,loadFlag){
+		var win = this.Common.WINDOW.getMostRecentWindow("navigator:browser");
+		var browser = win.document.getElementById("content");
+		if(aFileid && !loadFlag){
+			var basedir = this.getBaseDir();
+			if(aFileid) basedir.append(aFileid);
+			var res_uri = this.Common.convertFilePathToURL(basedir.path);
+			for(var i=0;i<this.gBrowser.browsers.length;i++){
+				var doc = this.gBrowser.browsers[i].contentDocument;
+				var cur_uri = this.Common.getURLStringFromDocument(this.gBrowser.browsers[i].contentDocument);
+				if(cur_uri.indexOf(res_uri)>=0){
+					this.gBrowser.browsers[i].reloadWithFlags(nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE);
+					break;
+				}
+			}
+		}else{
+			var flags = nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY;
+			if(loadFlag){
+				browser.selectedTab = browser.addTab('about:blank');
+				flags = nsIWebNavigation.LOAD_FLAGS_NONE;
+			}
+			browser.loadURIWithFlags(aURL,flags);
+		}
+		this._openurl = aURL;
+		if(this._openurl != ""){
+			var remove_dir = this.Common.convertURLToFile(this.Common.getBaseHref(this._openurl));
+			window.top.bitsMarkingCollection._removefile.push(remove_dir);
+			var contentWindow = null;
+			var mcTreeViewModeService = null;
+			if(bitsMarkingCollection._contentWindow) contentWindow = bitsMarkingCollection._contentWindow;
+			if(contentWindow && contentWindow.mcTreeViewModeService) mcTreeViewModeService = contentWindow.mcTreeViewModeService;
+			if(mcTreeViewModeService) mcTreeViewModeService._openlist[aURL] = loadFlag;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	dispTreeDateList : function(aObject,aXSLPath,aFileid){
+		this.initLocalParam(aFileid);
+		var fid = "";
+		var param = {};
+		var title = "";
+		if(aObject.date){
+			if(aObject.date.year){
+				param["substr(om_object.oid_date,7,4)"] = aObject.date.year;
+				fid += aObject.date.year;
+				title += aObject.date.year;
+				if(aObject.date.month){
+					param["substr(om_object.oid_date,1,2)"] = aObject.date.month;
+					fid += aObject.date.month;
+					title += '/' + aObject.date.month;
+					if(aObject.date.day){
+						param["substr(om_object.oid_date,4,2)"] = aObject.date.day;
+						fid += aObject.date.day;
+						title += '/' + aObject.date.day;
+					}
+				}
+			}
+		}else{
+			fid = "0";
+			title = aObject.text;
+		}
+		if(aXSLPath != bitsTreeListService._listview_drag && !aObject.childlen && this.bitsTreeDate){
+			var itemObject = this.bitsTreeDate.getObjectFromID(fid);
+			if(itemObject) aObject = itemObject;
+		}
+		if(this._viewmode == "single") param.doc_url = this.Common.getURLStringFromDocument(this.gBrowser.contentDocument);
+		var objects = this.Database.getObject(param, aObject.dbtype);
+		if(objects && objects.length>0){
+			objects.sort(function(a,b){
+				var a_date = Date.parse(a.oid_date);
+				var b_date = Date.parse(b.oid_date);
+				if(a_date < b_date) return -1;
+				if(a_date > b_date) return 1;
+				return 0;
+			});
+			var i=0;
+			for(i=0;i<objects.length;i++){
+				this.setLocalParam(objects[i]);
+			}
+			if(aXSLPath == this._listview_drag){
+				this.id2folder = {};
+				for(i=0;i<objects.length;i++){
+					var oid_key = this.getObjectKey(objects[i]);
+					if(this.id2folder[oid_key]) continue;
+					this.id2folder[oid_key] = [];
+					var temp_objects = this.Database.getObject({oid:objects[i].oid},objects[i].dbtype);
+					if(!temp_objects || temp_objects.length==0) continue;
+					temp_objects.sort(function(a,b){
+						var a_order = parseInt(a.folder_order);
+						var b_order = parseInt(b.folder_order);
+						if(a_order < b_order) return -1;
+						if(a_order > b_order) return 1;
+						return 0;
+					});
+					for(var j=0;j<temp_objects.length;j++){
+						if(temp_objects[j].dbtype == bitsMarkingCollection._uncategorized.dbtype) continue;
+						this.id2folder[oid_key].push({
+							fid       : temp_objects[j].pfid,
+							fid_title : temp_objects[j].fid_title,
+							oid       : temp_objects[j].oid,
+							dbtype    : temp_objects[j].dbtype,
+							fid_style : temp_objects[j].fid_style.replace(/([:;\(,])\s+/mg,"$1")
+						});
+					}
+				}
+			}
+		}
+		var file  = this.getTreeListDir();
+		file.append(fid+".xml");
+		if(file.exists()) file.remove(false);
+		this.createBaseXML(fid,aObject.dbtype,title,aXSLPath);
+		this.createTreeDateXML(aObject, bitsTreeExportService.xmldoc.documentElement, aXSLPath);
+		var aContent = bitsTreeExportService.xmlSerializer();
+		file.create(file.NORMAL_FILE_TYPE, 0666);
+		var ostream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
+		ostream.init(file, 2, 0x200, false);
+		this.Common.UNICODE.charset = "UTF-8";
+		aContent = this.Common.UNICODE.ConvertFromUnicode(aContent);
+		ostream.write(aContent, aContent.length);
+		ostream.close();
+		this.loadURL(this.Common.convertFilePathToURL(file.path),aFileid);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	dispList_proc : function(aFolder,aXSLPath,aFileid){
+		
+		var fid = aFolder.fid;
+		var dbtype = aFolder.dbtype;
+		var title = aFolder.fid_title;
+		title = this.xmlEncode(title);
+		var property = aFolder.fid_property;
+		var note = "";
+		if(property && property != ""){
+			if(property.match(/^(.*<NOTE>)(.*)?(<\/NOTE>.*)$/m)){
+				var _property = [];
+				_property[0] = RegExp.$1;
+				_property[1] = RegExp.$2;
+				_property[2] = RegExp.$3;
+				_property[1] = this.xmlEncode(_property[1]);
+				property = _property.join("");
+			}
+			if(this.XML.parseFromString(property)){
+				var rtnNode = this.XML.getItem("PROPERTY","NOTE");
+				if(rtnNode) note = rtnNode[0].textContent;
+				if(!rtnNode && note == ""){
+					rtnNode = this.XML.getItem("NOTE");
+					if(rtnNode) note = rtnNode[0].textContent;
+				}
+				if(!rtnNode && note == ""){
+					var txt = property.replace(/[\r\n\t]/mg," __BR__ ");
+					if(txt.match(/<PROPERTY>(.*?)<\/PROPERTY>/m)){
+						note = unescape(RegExp.$1);
+					}
+				}
+				if(!rtnNode && note == "") note = property;
+			}else{
+				note = property;
+			}
+		}
+		note = note.replace(/ __BR__ /mg,"\n");
+		this.initLocalParam(aFileid);
+		var folderResList = bitsTreeExportService._getAllFolder(aFolder);
+		folderResList.push(aFolder);
+		var f_dbtype = dbtype;
+		if(folderResList.length>0){
+			var fcnt;
+			for(fcnt=0;fcnt<folderResList.length;fcnt++){
+				var fid = folderResList[fcnt].fid;
+				var objects = undefined;
+				if(this._viewmode == "all"){
+					objects = this.Database.getObjectFormPID(fid, f_dbtype);
+				}else{
+					var doc_url = this.Common.getURLStringFromDocument(this.gBrowser.contentDocument);
+					objects = this.Database.getObject({pfid:fid,doc_url:doc_url}, f_dbtype);
+				}
+				if(objects && objects.length>0){
+					var i=0;
+					for(i=0;i<objects.length;i++){
+						this.setLocalParam(objects[i]);
+					}
+					if(aXSLPath == this._listview_drag){
+						this.id2folder = {};
+						for(i=0;i<objects.length;i++){
+							var oid_key = this.getObjectKey(objects[i]);
+							if(this.id2folder[oid_key]) continue;
+							this.id2folder[oid_key] = [];
+							var temp_objects = this.Database.getObject({oid:objects[i].oid},objects[i].dbtype);
+							if(!temp_objects || temp_objects.length==0) continue;
+							temp_objects.sort(function(a,b){
+								var a_order = parseInt(a.folder_order);
+								var b_order = parseInt(b.folder_order);
+								if(a_order < b_order) return -1;
+								if(a_order > b_order) return 1;
+								return 0;
+							});
+							for(var j=0;j<temp_objects.length;j++){
+								if(temp_objects[j].dbtype == bitsMarkingCollection._uncategorized.dbtype) continue;
+								this.id2folder[oid_key].push({
+									fid       : temp_objects[j].pfid,
+									fid_title : temp_objects[j].fid_title,
+									oid       : temp_objects[j].oid,
+									dbtype    : temp_objects[j].dbtype,
+									fid_style : temp_objects[j].fid_style.replace(/([:;\(,])\s+/mg,"$1")
+								});
+							}
+						}
+					}
+				}
+			}
+		}
+		var file  = this.getTreeListDir();
+		file.append(fid+".xml");
+		if(file.exists()){
+			try{
+				file.remove(true);
+			}catch(e){
+				this._dump("bitsTreeListService.dispList_proc():"+e);
+			}
+		}
+		if(!file.exists()){
+			this.createBaseXML(fid,f_dbtype,title,aXSLPath);
+			this.createXML(aFolder, bitsTreeExportService.xmldoc.documentElement, aXSLPath);
+			var aContent = bitsTreeExportService.xmlSerializer();
+			file.create(file.NORMAL_FILE_TYPE, 0666);
+			var ostream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
+			ostream.init(file, 2, 0x200, false);
+			this.Common.UNICODE.charset = "UTF-8";
+			aContent = this.Common.UNICODE.ConvertFromUnicode(aContent);
+			ostream.write(aContent, aContent.length);
+			ostream.close();
+			this.loadURL(this.Common.convertFilePathToURL(file.path),aFileid);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getBaseDir : function(){
+		var dir  = window.top.bitsMarkingCollection.getExtensionDir().clone();
+		dir.append("treelist");
+		if(!dir.exists()) dir.create(dir.DIRECTORY_TYPE, 0700);
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getTreeListDir : function(){
+		var dir  = this.getBaseDir().clone();
+		dir.append(this._fileid);
+		if(!dir.exists()) dir.create(dir.DIRECTORY_TYPE, 0700);
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createXML : function(aFolder, aParentNode, aXSLPath, aDepth){
+		var pfid = aFolder.fid;
+		var title = aFolder.fid_title;
+		var oidArr = [];
+		var contResList;
+		var f_dbtype = aFolder.dbtype;
+		var objects = undefined;
+		if(this._viewmode == "all"){
+			objects = this.Database.getObjectFormPID(pfid, f_dbtype);
+		}else{
+			var doc_url = this.Common.getURLStringFromDocument(this.gBrowser.contentDocument);
+			objects = this.Database.getObject({pfid:pfid,doc_url:doc_url}, f_dbtype);
+		}
+		if(objects){
+			var i=0;
+			for(i=0;i<objects.length;i++){
+				oidArr.push(objects[i].oid);
+			}
+		}
+		var contResList = this.Database.getFolderFormPID(aFolder.fid,aFolder.dbtype,false);
+		if(contResList){
+			var fcnt;
+			for(fcnt=0;fcnt<contResList.length;fcnt++){
+				oidArr.push(contResList[fcnt].fid);
+			}
+		}
+		if(aDepth == undefined) aDepth = 0;
+		var aTab = "";
+		var i;
+		for(i=0;i<=aDepth;i++){
+			aTab += "  ";
+		}
+		var fNode = bitsTreeExportService.createElement("FOLDER",undefined,aParentNode,aTab);
+		if(title != "") bitsTreeExportService.createElement("FID_TITLE",title,fNode,aTab+'  ');
+		if(pfid != "") bitsTreeExportService.createElement("ID",aFolder.fid,fNode,aTab+'  ');
+		if(oidArr.length>0) bitsTreeExportService.createElement("CHILDID",oidArr.join(","),fNode,aTab+'  ');
+		if(contResList && contResList.length>0){
+			var fcnt;
+			for(fcnt=0;fcnt<contResList.length;fcnt++){
+				this.createXML(contResList[fcnt], fNode, aXSLPath, aDepth+1);
+			}
+		}
+		if(objects){
+			var i;
+			for(i=0;i<objects.length;i++){
+				this.createXMLObject(objects[i], fNode, aXSLPath, aDepth);
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createXMLFolder : function(aFolder, aParentNode, aDepth, oidArr){
+		if(aDepth == undefined) aDepth = 0;
+		var aTab = "";
+		var i;
+		for(i=0;i<=aDepth;i++){
+			aTab += "  ";
+		}
+		var fNode = bitsTreeExportService.createElement("FOLDER",undefined,aParentNode,aTab);
+		if(aFolder.fid_title != "") bitsTreeExportService.createElement("FID_TITLE",aFolder.fid_title,fNode,aTab+'  ');
+		if(aFolder.fid != "") bitsTreeExportService.createElement("ID",aFolder.fid,fNode,aTab+'  ');
+		if(oidArr && oidArr.length>0) bitsTreeExportService.createElement("CHILDID",oidArr.join(","),fNode,aTab+'  ');
+		return fNode;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createTreeDateXML : function(aObject, aParentNode, aXSLPath, aDepth){
+		var oidArr = [];
+		var contResList = undefined;
+		var f_dbtype = aObject.dbtype;
+		var objects = undefined;
+		if(aXSLPath == this._listview_drag){
+			var param = {};
+			if(this._viewmode != "all") param.doc_url = this.Common.getURLStringFromDocument(this.gBrowser.contentDocument);
+			if(aObject.date && aObject.date.year){
+				param["substr(om_object.oid_date,7,4)"] = aObject.date.year;
+				if(aObject.date.month){
+					param["substr(om_object.oid_date,1,2)"] = aObject.date.month;
+					if(aObject.date.day) param["substr(om_object.oid_date,4,2)"] = aObject.date.day;
+				}
+			}
+			objects = this.Database.getObject(param, aObject.dbtype);
+		}else{
+			contResList = aObject.childlen;
+			if(aObject.date && aObject.date.year && aObject.date.month && aObject.date.day){
+				var param = {};
+				param["substr(om_object.oid_date,7,4)"] = aObject.date.year;
+				param["substr(om_object.oid_date,1,2)"] = aObject.date.month;
+				param["substr(om_object.oid_date,4,2)"] = aObject.date.day;
+				if(this._viewmode != "all") param.doc_url = this.Common.getURLStringFromDocument(this.gBrowser.contentDocument);
+				objects = this.Database.getObject(param, aObject.dbtype);
+			}
+		}
+		if(objects){
+			objects.sort(function(a,b){
+				var a_date = Date.parse(a.oid_date);
+				var b_date = Date.parse(b.oid_date);
+				if(a_date < b_date) return -1;
+				if(a_date > b_date) return 1;
+				return 0;
+			});
+			var i=0;
+			for(i=0;i<objects.length;i++){
+				oidArr.push(objects[i].oid);
+			}
+		}
+		if(contResList && contResList.length>0){
+			var fid = "";
+			var fcnt;
+			for(fcnt=0;fcnt<contResList.length;fcnt++){
+				if(!contResList[fcnt].date) continue;
+				fid = "";
+				if(contResList[fcnt].date.year){
+					fid += contResList[fcnt].date.year;
+					if(contResList[fcnt].date.month){
+						fid += contResList[fcnt].date.month;
+						if(contResList[fcnt].date.day) fid += contResList[fcnt].date.day;
+					}
+				}
+				oidArr.push(fid);
+			}
+		}
+		var aFolder = {
+			fid       : "",
+			fid_title : "",
+		};
+		if(aObject.date){
+			if(aObject.date.year){
+				aFolder.fid += aObject.date.year;
+				aFolder.fid_title += aObject.date.year;
+				if(aObject.date.month){
+					aFolder.fid += aObject.date.month;
+					aFolder.fid_title += '/'+aObject.date.month;
+					if(aObject.date.day){
+						aFolder.fid += aObject.date.day;
+						aFolder.fid_title += '/'+aObject.date.day;
+					}
+				}
+			}
+		}else{
+			aFolder.fid="0";
+			aFolder.fid_title=aObject.text;
+		}
+		if(aDepth == undefined) aDepth = 0;
+		var fNode = this.createXMLFolder(aFolder,aParentNode,aDepth,oidArr);
+		if(contResList && contResList.length>0){
+			var fcnt;
+			for(fcnt=0;fcnt<contResList.length;fcnt++){
+				this.createTreeDateXML(contResList[fcnt], fNode, aXSLPath, aDepth+1);
+			}
+		}
+		if(objects){
+			var i;
+			for(i=0;i<objects.length;i++){
+				var oid_key = this.getObjectKey(objects[i]);
+				if(this.id2exists[oid_key]) continue;
+				this.id2exists[oid_key] = true;
+				this.createXMLObject(objects[i], fNode, aXSLPath, aDepth);
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createXMLObject : function(aObject, aParentNode, aXSLPath, aDepth){
+		var oid_key = this.getObjectKey(aObject);
+		var id2img = this.id2img;
+		var id2type = this.id2type;
+		var id2text = this.id2text;
+		var id2uri = this.id2uri;
+		var id2uri_content = this.id2uri_content;
+		var id2st = this.id2st;
+		var id2en = this.id2en;
+		var id2date = this.id2date;
+		var id2property = this.id2property;
+		var id2dbtype = this.id2dbtype;
+		var id2style = this.id2style;
+		var id2Value = this.id2Value;
+		var id2fid_title = this.id2fid_title;
+		var id2pfid = this.id2pfid;
+		if(aDepth == undefined) aDepth = 0;
+		var aTab = "";
+		var i;
+		for(i=0;i<=aDepth;i++){
+			aTab += "  ";
+		}
+		var aContent = "";
+		var oid = aObject.oid;
+		var title = aObject.oid_title;
+		var alink = "";
+		var note = "";
+		var structure = "";
+		var hyperAnchor = "";
+		var location_hash = "";
+		var disp_image_size_x = "";
+		var disp_image_size_y = "";
+		var disp_image_size = "";
+		var out_property = [];
+		var xmldoc;
+		var structureElem;
+		if(id2property[oid_key]){
+			try{
+				var parser = new DOMParser();
+				xmldoc = parser.parseFromString(id2property[oid_key], "text/xml");
+				parser = undefined;
+			}catch(ex){}
+			if(xmldoc && xmldoc.documentElement.nodeName == "parsererror"){
+				id2property[oid_key] = "";
+				xmldoc = undefined;
+			}
+			if(xmldoc){
+				var xmlnode = xmldoc.getElementsByTagName("LINK")[0];
+				if(xmlnode) alink = this.xmlEncode(xmlnode.textContent);
+				xmlnode = xmldoc.getElementsByTagName("STRUCTURE")[0];
+				if(xmlnode && xmlnode.hasChildNodes()){
+					structureElem = xmlnode.cloneNode(true);
+				}
+				xmlnode = xmldoc.getElementsByTagName("IMG_LIST_DISP_SIZE")[0];
+				if(xmlnode){
+					disp_image_size = this.xmlEncode(xmlnode.textContent);
+					if(disp_image_size.match(/^(\d+),(\d+)$/mg)){
+						disp_image_size_x = RegExp.$1;
+						disp_image_size_y = RegExp.$2;
+					}
+				}
+				xmlnode = xmldoc.getElementsByTagName("NOTE")[0];
+				if(xmlnode){
+					out_property["NOTE"] = {};
+					out_property["NOTE"].type  = "text";
+					out_property["NOTE"].value = xmlnode.textContent;
+				}
+				xmlnode = xmldoc.getElementsByTagName("HYPER_ANCHOR")[0];
+				if(xmlnode) hyperAnchor = xmlnode.textContent;
+				xmlnode = xmldoc.getElementsByTagName("LOCATION_HASH")[0];
+				if(xmlnode) location_hash = xmlnode.textContent;
+			}
+		}
+		var oNode = bitsTreeExportService.createElement("OBJECT",undefined,aParentNode,aTab+"  ");
+		if(title != "") bitsTreeExportService.createElement("OID_TITLE",title,oNode,aTab+"    ");
+		if(oid != ""){
+			bitsTreeExportService.createElement("ID",oid,oNode,aTab+"    ");
+			oNode.setAttribute("oid",oid);
+		}
+		var tag;
+		for(tag in out_property){
+			if(typeof out_property[tag] == "function") continue;
+			var elem = bitsTreeExportService.createElement("OID_PROPERTY_"+tag,out_property[tag].value,oNode,aTab+"    ");
+			elem.setAttribute("type",out_property[tag].type);
+			if(id2dbtype[oid_key]) elem.setAttribute("dbtype",id2dbtype[oid_key]);
+			if(tag.toLowerCase() == "note") bitsTreeExportService.createElement("OID_NOTE",out_property[tag].value,oNode,aTab+"    ");
+		}
+		if(id2img[oid_key]) bitsTreeExportService.createElement("OID_IMG",id2img[oid_key],oNode,aTab+"    ");
+		if(aXSLPath && disp_image_size_x && disp_image_size_y){
+			bitsTreeExportService.createElement("OID_IMG_DISP_WIDTH",disp_image_size_x,oNode,aTab+"    ");
+			bitsTreeExportService.createElement("OID_IMG_DISP_HEIGHT",disp_image_size_y,oNode,aTab+"    ");
+		}
+		if(alink != ""){
+			bitsTreeExportService.createElement("OID_TXT",alink,oNode,aTab+"    ");
+		}else if(id2text[oid_key]){
+			bitsTreeExportService.createElement("OID_TXT",id2text[oid_key],oNode,aTab+"    ");
+		}
+		if(id2uri[oid_key]) bitsTreeExportService.createElement("DOC_URL",id2uri[oid_key],oNode,aTab+"    ");
+		if(id2uri_content[oid_key]) bitsTreeExportService.createElement("CON_URL",id2uri_content[oid_key],oNode,aTab+"    ");
+		if(id2st[oid_key]) bitsTreeExportService.createElement("BGN_DOM",id2st[oid_key],oNode,aTab+"    ");
+		if(id2en[oid_key]) bitsTreeExportService.createElement("END_DOM",id2en[oid_key],oNode,aTab+"    ");
+		if(id2date[oid_key]) bitsTreeExportService.createElement("OID_DATE",id2date[oid_key],oNode,aTab+"    ");
+		if(hyperAnchor != ""){
+			if(location_hash != "") hyperAnchor = hyperAnchor.replace(/(#hyperanchor)/,'#'+location_hash+"$1");
+			bitsTreeExportService.createElement("HYPER_ANCHOR",hyperAnchor,oNode,aTab+"    ");
+		}else if(id2uri_content[oid_key] && id2st[oid_key]){
+			var text = id2uri_content[oid_key] + '#hyperanchor:' + this.xmlEncode(id2st[oid_key]);
+			if(location_hash != "") text += '#' + location_hash;
+			text += '#hyperanchor:' + this.xmlEncode(id2st[oid_key]);
+			if(id2en[oid_key]) text += "&" + this.xmlEncode(id2en[oid_key]);
+			if(id2style[oid_key]) text += "&" + this.xmlEncode(id2style[oid_key]);
+			bitsTreeExportService.createElement("HYPER_ANCHOR",text,oNode,aTab+"    ");
+		}
+		if(this.id2folder[oid_key]){
+			var foldersNode = bitsTreeExportService.createElement("FOLDER_INFOS",undefined,oNode,aTab+"    ");
+			foldersNode.setAttribute("oid",oid);
+			if(id2dbtype[oid_key]) foldersNode.setAttribute("dbtype",id2dbtype[oid_key]);
+			for(var fcnt=0;fcnt<this.id2folder[oid_key].length;fcnt++){
+				var folderNode = bitsTreeExportService.createElement("FOLDER_INFO","",foldersNode,aTab+"      ");
+				folderNode.setAttribute("fid",this.id2folder[oid_key][fcnt].fid);
+				folderNode.setAttribute("fid_title",this.id2folder[oid_key][fcnt].fid_title);
+				folderNode.setAttribute("fid_style",this.id2folder[oid_key][fcnt].fid_style);
+				folderNode.setAttribute("oid",this.id2folder[oid_key][fcnt].oid);
+				folderNode.setAttribute("dbtype",this.id2folder[oid_key][fcnt].dbtype);
+			}
+		}else{
+			if(id2style[oid_key]) bitsTreeExportService.createElement("FID_STYLE",id2style[oid_key],oNode,aTab+"    ");
+			if(id2fid_title[oid_key]) bitsTreeExportService.createElement("FID_TITLE",id2fid_title[oid_key],oNode,aTab+"    ");
+		}
+		if(id2pfid[oid_key]) bitsTreeExportService.createElement("PFID",id2pfid[oid_key],oNode,aTab+"    ");
+		if(structureElem){
+			var elem = bitsTreeExportService.createElement("OID_STRUCTURE","",oNode,aTab+"    ");
+			var i;
+			for(i=0;i<structureElem.childNodes.length;i++){
+				elem.appendChild(structureElem.childNodes[i].cloneNode(true));
+			}
+		}
+		if(id2dbtype[oid_key]){
+			bitsTreeExportService.createElement("DBTYPE",id2dbtype[oid_key],oNode,aTab+"    ");
+			oNode.setAttribute("dbtype",id2dbtype[oid_key]);
+		}
+		if(id2Value[oid_key]) bitsTreeExportService.createElement("TREE_VALUE",id2Value[oid_key],oNode,aTab+"    ");
+		if(this.id2icon[oid_key]) bitsTreeExportService.createElement("FAVICON",this.id2icon[oid_key],oNode,aTab+"    ");
+		bitsTreeExportService.createElement("OID",oid,oNode,aTab+"    ");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	mergeObject : function(aFolder,aObject){
+		var mergeRtn = 0;
+		if(aObject.oid_type != "text") return mergeRtn;
+
+		window.top.bitsScrapPartyMergeService._isCancel = false;
+		window.top.bitsScrapPartyMergeService._isSameprocessing = false;
+		window.top.bitsScrapPartyMergeService._isMergeMode = 0;
+		window.top.bitsScrapPartyMergeService._isConfirm = false;
+		var i;
+		var mergeFlag = false;
+		var dstObjects = this.Database.getObject({pfid:aFolder.fid,oid_title:aObject.oid_title}, aFolder.dbtype);
+		if(!dstObjects || dstObjects.length == 0) return mergeRtn;
+		mergeFlag = true;
+		if(!mergeFlag) return mergeRtn;
+		mergeRtn |= window.top.bitsScrapPartyMergeService._merge(aObject,aFolder);
+		if(window.top.bitsScrapPartyMergeService.cancel) return -1;
+		return mergeRtn;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	copyObject : function(aFolder,aObject){
+		var addObj = undefined;
+		var pfid = aFolder.fid;
+		var pdbtype = aFolder.dbtype;
+		var pfid_order = this.Database.getMaxOrderFormPID(aFolder.fid,aFolder.dbtype);
+		var exists = false;
+		var i;
+		var rtn = this.Database.existsObject({oid:aObject.oid,pfid:aFolder.fid},aFolder.dbtype);
+		if(rtn){
+			exists = rtn;
+		}else{
+			if(aObject.dbtype == aFolder.dbtype){
+				rtn = this.Database.addLink({oid:aObject.oid,pfid:aFolder.fid,pfid_order:++pfid_order},aFolder.dbtype);
+				addObj = {};
+				for(var key in aObject){
+					addObj[key] = aObject[key];
+				}
+				addObj.pfid = aFolder.fid;
+				addObj.pfid_order = pfid_order;
+				addObj.dbtype = aFolder.dbtype;
+			}else{
+				var objs = this.Database.getObjectWithProperty({oid:aObject.oid,pfid:aObject.pfid},aObject.dbtype);
+				var blobs =this.Database.getObjectBLOB(aObject.oid,aObject.dbtype);
+				if(objs && objs.length>0) aObject = objs[0];
+				addObj = this.Database.newObject(aObject.oid,aFolder.dbtype);
+				var key;
+				for(key in aObject){
+					if(key == "oid") continue;
+					addObj[key] = aObject[key];
+				}
+				addObj.pfid = aFolder.fid;
+				delete addObj.dbtype;
+				delete addObj.fid_style;
+				rtn = this.Database.addObject(addObj,aFolder.dbtype);
+				if(rtn){
+					if(blobs && blobs.length>0){
+						this.Database.updateObjectBLOB(addObj.oid,blobs[0],aFolder.dbtype);
+					}
+				}
+			}
+		}
+		if(exists) this.Common.alert(this.STRING.getString("ALERT_COPYOBJECT_EXISTS"));
+		return addObj;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	moveObject : function(aFolder,aObject,aModShift){
+		try{
+			if(aModShift == undefined) aModShift = false;
+			var update = false;
+			if(update == false && aObject.dbtype == aFolder.dbtype && this.Database.existsObject({oid:aObject.oid,pfid:aFolder.fid},aFolder.dbtype)){
+				if(this.Common.confirm(this.STRING.getString("CONFIRM_COPYOBJECT_OVERWRITE"))){
+					update = true;
+				}else{
+					return false;
+				}
+			}
+			if(update && aObject.dbtype == aFolder.dbtype && this.Database.existsObject({oid:aObject.oid,pfid:aFolder.fid},aFolder.dbtype)){
+				var rtn = this.Database.removeLink({oid:aObject.oid,pfid:aFolder.fid},aFolder.dbtype);
+			}
+			var addObj = this._moveObject(aFolder,aObject,aModShift);
+			return addObj;
+		}catch(e){
+			this._dump("bitsTreeListService.moveObject():"+e);
+			return undefined;
+		}
+	},
+
+	_moveObject : function(aFolder,aObject,aModShift){
+		var addObj = undefined;
+		var rtn;
+		var pfid_order = this.Database.getMaxOrderFormPID(aFolder.fid,aFolder.dbtype);
+		var old_source = bitsMarker.id_key+aObject.dbtype+aObject.oid;
+		var new_source = bitsMarker.id_key;
+		if(aObject.dbtype == aFolder.dbtype){
+			rtn = this.Database.updateObject({oid:aObject.oid,pfid:aFolder.fid,pfid_old:aObject.pfid,pfid_order:++pfid_order},aFolder.dbtype);
+			new_source += aFolder.dbtype+aObject.oid;
+			addObj = aObject;
+		}else{
+			var objs = this.Database.getObjectWithProperty({oid:aObject.oid,pfid:aObject.pfid},aObject.dbtype);
+			var blobs =this.Database.getObjectBLOB(aObject.oid,aObject.dbtype);
+			if(objs && objs.length>0) aObject = objs[0];
+			addObj = this.Database.newObject(aObject.oid,aFolder.dbtype);
+			var key;
+			for(key in aObject){
+				if(key == "oid") continue;
+				addObj[key] = aObject[key];
+			}
+			addObj.pfid = aFolder.fid;
+			addObj.pfid_order = ++pfid_order;
+			delete addObj.dbtype;
+			delete addObj.fid_style;
+			rtn = this.Database.addObject(addObj,aFolder.dbtype);
+			if(rtn && blobs && blobs.length>0) this.Database.updateObjectBLOB(addObj.oid,blobs[0],aFolder.dbtype);
+			if(rtn && aModShift) rtn = this.Database.removeObject(aObject,aObject.dbtype);
+			new_source += aFolder.dbtype+addObj.oid;
+		}
+		this.Common.changeNodeStyleFromID(old_source,aFolder.fid_style,addObj.pfid,addObj.oid,aFolder.dbtype);
+		return addObj;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treelistOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treelistOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treelistOverlay.xul	(revision 5703)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/treecontextmenu.dtd">
+<overlay
+	id="bitsTreeListOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<popupset id="mainPopupSet">
+		<menupopup id="bitsTreeListContextmenu">
+			<menuitem
+				id="bitsTreeListContextmenuRemoveClass"
+				class="menuitem-iconic"
+				label="&treecontextmenu.view.list.remove;"
+				image="chrome://markingcollection/skin/folder-delete.png"
+				oncommand="window.top.bitsTreeListService.removeClass(event);"/>
+		</menupopup>
+	</popupset>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treelistview.xsl
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treelistview.xsl	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treelistview.xsl	(revision 5703)
@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet id="treelist" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="html" version="4.01" encoding="UTF-8" indent="yes" />
+  <xsl:template match="/">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="LIST">
+    <html>
+      <head>
+        <meta name="fid"><xsl:attribute name="content"><xsl:value-of select="@fid"/></xsl:attribute></meta>
+        <meta name="dbtype"><xsl:attribute name="content"><xsl:value-of select="@dbtype"/></xsl:attribute></meta>
+        <meta name="xslpath"><xsl:attribute name="content"><xsl:value-of select="@xslpath"/></xsl:attribute></meta>
+        <meta name="_fileid"><xsl:attribute name="content"><xsl:value-of select="@_fileid"/></xsl:attribute></meta>
+        <title><xsl:value-of select="@title" /></title>
+        <script type="text/javascript">
+        <![CDATA[
+          function twisty(elem){
+            var cur_twisty = (elem.src.indexOf("fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII")>=0)?true:false;
+            var childid = elem.getAttribute("childid").split(",");
+            for(var i=0;i<childid.length;i++){
+              var child_elem = document.getElementById(childid[i]);
+              if(!child_elem) continue;
+              child_elem.style.display = cur_twisty?'none':'';
+            }
+            elem.src = cur_twisty ?
+              "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAChSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAMcGU//z5E4wZGRnhbBgACCAWGOPbt28M6Gx2dnYwDRBAYEX//v1jEBISgiuCsf/+/QumAQIIrOjr168MV69eBQtoa2vD2SBxEAAIIBaY8V++fIGbBGPDrAUIILCiHz9+MIiLi4MFHjx4AFcMEgcBgAACKZpdW/MITzAxzAYIMADnOV3STeCBBwAAAABJRU5ErkJggg==" :
+              "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAACNSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAscCU//z5E8MIdnZ2MA0QQHBF3759w6kIIIDAiv79+8cgJCSEoejv379gGiCAwIq+fv3KcPXqVQxFIHEQAAggFphVX758wVAEcwJAAIEV/fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII=";
+          }
+          function load(aEvent){
+            var regexp_png = new RegExp("^data:image/\\w+;base64,");
+            var nodeWalker = document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,false);
+            for(var txtNode=nodeWalker.nextNode();txtNode;txtNode = nodeWalker.nextNode()){
+              if(txtNode.parentNode.nodeName == "TEXTAREA") continue;
+              try{
+                if(txtNode.nodeValue.match(/^(data:image\/\w+;base64,).*/img)){ txtNode.nodeValue = RegExp.$1; }
+              }catch(e){
+                if(regexp_png.test(txtNode.nodeValue)){ txtNode.nodeValue = "data:image/png;base64,"; }
+              }
+              txtNode.nodeValue = txtNode.nodeValue.replace(/([\/&\?])([^\/&\?])/mg,"$1 $2");
+            }
+          }
+        ]]>
+        </script>
+      </head>
+      <body style="margin: 1em;" onload="load(event)">
+        <xsl:apply-templates/>
+      </body>
+    </html>
+  </xsl:template>
+
+  <xsl:template match="FOLDER">
+    <xsl:choose>
+      <xsl:when test="position() = 2">
+        <div style="margin-left: 0.25em;">
+          <xsl:attribute name="id">
+            <xsl:value-of select="ID" />
+          </xsl:attribute>
+          <table style="padding:0px;border:1px solid #fc6;" width="100%">
+            <tr><td style="background-color: #fc6;font-weight: bold;">
+              <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAACNSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAscCU//z5E8MIdnZ2MA0QQHBF3759w6kIIIDAiv79+8cgJCSEoejv379gGiCAwIq+fv3KcPXqVQxFIHEQAAggFphVX758wVAEcwJAAIEV/fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII=" valign="center" style="margin-right: 4px;" onclick="twisty(this)">
+                <xsl:attribute name="childid">
+                  <xsl:value-of select="CHILDID" />
+                </xsl:attribute>
+              </img>
+              <xsl:value-of select="FID_TITLE" />
+            </td></tr>
+            <tr><td>
+              <xsl:apply-templates />
+            </td></tr>
+          </table>
+        </div>
+      </xsl:when>
+      <xsl:otherwise>
+        <div style="margin-left: 1em;">
+          <xsl:attribute name="id">
+            <xsl:value-of select="ID" />
+          </xsl:attribute>
+
+          <table style="padding:0px;border-left:1px solid #fc6;border-top:1px solid #fc6;" width="100%">
+            <tr><td style="background-color: #fc6;font-weight: bold;">
+              <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAACNSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAscCU//z5E8MIdnZ2MA0QQHBF3759w6kIIIDAiv79+8cgJCSEoejv379gGiCAwIq+fv3KcPXqVQxFIHEQAAggFphVX758wVAEcwJAAIEV/fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII=" valign="center" style="margin-right: 4px;" onclick="twisty(this)">
+                <xsl:attribute name="childid">
+                  <xsl:value-of select="CHILDID" />
+                </xsl:attribute>
+              </img>
+              <xsl:value-of select="FID_TITLE" />
+            </td></tr>
+            <tr><td>
+              <xsl:apply-templates />
+            </td></tr>
+          </table>
+        </div>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="FOLDER/FID_TITLE" />
+  <xsl:template match="FOLDER/FID_NOTE" />
+  <xsl:template match="FOLDER/FID_STYLE" />
+  <xsl:template match="FOLDER/ID" />
+  <xsl:template match="FOLDER/CHILDID" />
+
+
+
+  <xsl:template match="OBJECT">
+    <div style="margin-left: 1em;">
+      <xsl:attribute name="id">
+        <xsl:value-of select="ID" />
+      </xsl:attribute>
+      <table style="padding:0px;border-left:1px solid #fc6;border-top:1px solid #fc6;" width="100%">
+        <thead>
+          <tr>
+            <td colspan="3" style="background-color: #ffc;font-weight: bold;">
+              <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAACNSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAscCU//z5E8MIdnZ2MA0QQHBF3759w6kIIIDAiv79+8cgJCSEoejv379gGiCAwIq+fv3KcPXqVQxFIHEQAAggFphVX758wVAEcwJAAIEV/fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII=" valign="center" style="margin-right: 4px;" onclick="twisty(this)">
+                <xsl:attribute name="childid"><xsl:value-of select="ID" />child</xsl:attribute>
+              </img>
+              <label edit="true" dbcolumn="title">
+                <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
+                <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
+                <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
+                <xsl:value-of select="OID_TITLE" />
+              </label>
+            </td>
+          </tr>
+        </thead>
+        <tbody>
+          <xsl:attribute name="id"><xsl:value-of select="ID" />child</xsl:attribute>
+          <tr>
+            <th width="10" style="background-color: #e6e6e6;font-size:0.9em;">Note</th>
+             <xsl:choose>
+               <xsl:when test="OID_IMG!=''">
+                  <td width="" style="font-family:serif;">
+                    <label edit="true" dbcolumn="note">
+                      <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
+                      <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
+                      <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
+                      <xsl:value-of select="OID_NOTE" />
+                    </label>
+                  </td>
+                  <td rowspan="4" align="right" valign="top">
+                    <img edit="true" style="border-left:1px solid #ff9;">
+                      <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
+                      <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
+                      <xsl:attribute name="src"><xsl:value-of select="OID_IMG" /></xsl:attribute>
+                      <xsl:attribute name="width"><xsl:value-of select="OID_IMG_DISP_WIDTH" /></xsl:attribute>
+                      <xsl:attribute name="height"><xsl:value-of select="OID_IMG_DISP_HEIGHT" /></xsl:attribute>
+                      <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
+                    </img>
+                  </td>
+               </xsl:when>
+               <xsl:when test="OID_STRUCTURE!=''">
+                  <td width="" style="font-family:serif;">
+                    <label edit="true" dbcolumn="note">
+                      <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
+                      <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
+                      <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
+                      <xsl:value-of select="OID_NOTE" />
+                    </label>
+                  </td>
+                  <td rowspan="4" align="" valign="top" style="border-left:1px solid #ff9;">
+                    <xsl:copy-of select="OID_STRUCTURE" />
+                  </td>
+               </xsl:when>
+               <xsl:otherwise>
+                  <td width="400" style="font-family:serif;">
+                    <label edit="true" dbcolumn="note">
+                      <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
+                      <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
+                      <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
+                      <xsl:value-of select="OID_NOTE" />
+                    </label>
+                  </td>
+               </xsl:otherwise>
+             </xsl:choose>
+          </tr>
+          <tr>
+            <th width="10" style="background-color: #e6e6e6;font-size:0.9em;">URL</th>
+            <td >
+              <a>
+                <xsl:attribute name="href">
+                  <xsl:value-of select="DOC_URL" />
+                </xsl:attribute>
+                <xsl:value-of select="DOC_URL" />
+              </a>
+            </td>
+          </tr>
+          <tr>
+            <th width="10" style="background-color: #e6e6e6;font-size:0.9em;white-space:nowrap;">
+              <a href="http://www.hyper-anchor.org/" target="_hyperanchor" title="HYPER-ANCHOR Homepage">HYPER-ANCHOR</a>
+            </th>
+            <td  style="">
+              <textarea rows="1" wrap="soft" readonly="true" style="width:100%;-moz-appearance: none !important;border: none;background:white  !important;" onfocus="this.select();"><xsl:value-of select="HYPER_ANCHOR"/></textarea>
+            </td>
+          </tr>
+          <tr>
+            <th width="10" style="background-color: #e6e6e6;font-size:0.9em;">Contents</th>
+            <td  style="">
+              <xsl:value-of select="OID_TXT" />
+            </td>
+          </tr>
+
+        </tbody>
+      </table>
+    </div>
+  </xsl:template>
+
+</xsl:stylesheet>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeproject.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeproject.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeproject.js	(revision 5703)
@@ -0,0 +1,2502 @@
+var bitsTreeProjectService = {
+	_openurl : "",
+	_doc     : null,
+	_loaddoc : null,
+	_url     : "",
+	_fileid  : "",
+	_oid     : null,
+	_savehtml : [],
+	_applytimer  : null,
+
+	_caseSensitive_exp : new RegExp("[A-Z]{2,}",""),
+	_marker_exp : new RegExp("^"+bitsMarker.id_key+"\\D+\\d+$",""),
+
+	appDataDir  : null,
+	appDataURL  : "",
+	appDataSTRING : "",
+	appDataURLExp : null,
+	appDataAddSTRING : "_files",
+	zipApp : null,
+	zipAppScript : null,
+	_title2obj : {},
+
+/////////////////////////////////////////////////////////////////////
+	get STRING() { return document.getElementById("MarkingCollectionOverlayString"); },
+
+	get DataSource() { return window.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.top.bitsObjectMng.Common;     },
+	get Database()   { return window.top.bitsObjectMng.Database;   },
+	get XML()        { return window.top.bitsObjectMng.XML;        },
+	get XPath()      { return window.top.bitsObjectMng.XPath;      },
+	get gBrowser()   { return window.top.bitsObjectMng.getBrowser();},
+
+	get MAINWINDOW() { return window.top.document.getElementById("main-window"); },
+	get SIDEBAR() { return window.top.document.getElementById("sidebar"); },
+	get CONTENT() { return window.top.document.getElementById("content"); },
+
+	get SIDEBAR_DOC() {try{return this.SIDEBAR.contentDocument;}catch(e){return undefined;}},
+	get SIDEBAR_WIN() {try{return this.SIDEBAR.contentWindow;}catch(e){return undefined;}},
+	get mcTreeHandler() {try{return this.SIDEBAR_WIN.mcTreeHandler;}catch(e){return undefined;}},
+	get mcMainService() {try{return this.SIDEBAR_WIN.mcMainService;}catch(e){return undefined;}},
+	get mcController() {try{return this.SIDEBAR_WIN.mcController;}catch(e){return undefined;}},
+	get mcPropertyView() {try{return this.SIDEBAR_WIN.mcPropertyView;}catch(e){return undefined;}},
+	get mcTreeViewModeService() {try{return this.SIDEBAR_WIN.mcTreeViewModeService;}catch(e){return undefined;}},
+	get bitsItemView() {try{return this.SIDEBAR_WIN.bitsItemView;}catch(e){return undefined;}},
+
+	get TREE_POPUP(){try{return this.SIDEBAR_DOC.getElementById("mcPopup");}catch(e){return undefined;}},
+	get TREE_LISTVIEWMENU(){try{return this.SIDEBAR_DOC.getElementById("mcPopupViewMenu");}catch(e){return undefined;}},
+	get TREE_INDEXMENU(){try{return this.SIDEBAR_DOC.getElementById("mcPopupProjectIndexMenu");}catch(e){return undefined;}},
+	get TREE_DOCUMENTMENU(){try{return this.SIDEBAR_DOC.getElementById("mcPopupProjectDocumentsMenu");}catch(e){return undefined;}},
+	get TREE_DICTIONARYMENU(){try{return this.SIDEBAR_DOC.getElementById("mcPopupProjectDictionaryMenu");}catch(e){return undefined;}},
+
+	get xmldoc(){ return this._xmldoc; },
+
+/////////////////////////////////////////////////////////////////////
+	init : function(){
+		try{
+			this.gBrowser.addEventListener("pageshow", bitsTreeProjectService.pageshow, false);
+		}catch(ex){
+			this._dump("bitsTreeProjectService.init():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(){
+		try{
+			this.gBrowser.removeEventListener("pageshow", bitsTreeProjectService.pageshow, false);
+		}catch(ex){
+			this._dump("bitsTreeProjectService.done():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	pageshow : function(aEvent){
+		bitsTreeProjectService._pageshow(aEvent);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_pageshow : function(aEvent){
+		var self = this;
+		var doc = aEvent.target;
+		if(doc.location.protcol == "chrome:" || doc.location.protcol == "about:") return;
+		if(!doc.body) return;
+		if(doc.contentType != "text/plain") return;
+		var pre = doc.body.getElementsByTagName("pre")[0];
+		if(!pre || pre.style.cssText != "") return;
+		var textplain_display = nsPreferences.copyUnicharPref("wiredmarker.textplain.display","usually");
+		if(textplain_display == "usually") return;
+		setTimeout(function(){
+			if(textplain_display == "confirm" && !self.Common.confirm(self.STRING.getString("CONFIRM_BROWSER_TO_FIT_TEXT"))) return;
+			var title = doc.title!=""?doc.title:doc.location.toString();
+			var textContent = pre.textContent.replace(/(\x0D\x0A|\x0D|\x0A)/g,"<br>$1");
+			var textContent_Arr = textContent.split("<br>");
+			var cDoc = doc;
+			try{
+				while(cDoc.body.lastChild){ cDoc.body.removeChild(cDoc.body.lastChild); }
+				cDoc.body.appendChild(cDoc.createElement("pre"));
+				if(cDoc.body.lastChild){
+					var span = cDoc.body.lastChild;
+					span.style.whiteSpace = "normal";
+					var backgroundColor = nsPreferences.copyUnicharPref("wiredmarker.textplain.background_color");
+					var fontFamily = nsPreferences.copyUnicharPref("wiredmarker.textplain.font.name");
+					var fontSize = nsPreferences.getIntPref("wiredmarker.textplain.font.size");
+					if(backgroundColor) span.style.backgroundColor = backgroundColor;
+					if(fontFamily) span.style.fontFamily = fontFamily;
+					if(fontSize) span.style.fontSize = fontSize+'pt';
+					var i;
+					for(i=0;i<textContent_Arr.length;i++){
+						span.appendChild(cDoc.createTextNode(textContent_Arr[i]));
+						var elem_br = cDoc.createElement("br");
+						elem_br.setAttribute("id",bitsMarker.id_key+"dummy_br");
+						span.appendChild(elem_br);
+					}
+				}
+				var urlString = self.Common.getURLStringFromDocument(cDoc);
+				var info = bitsAutocacheService.getSaveCacheInfo(urlString);
+				var rtn = bitsMarkingCollection.marking(cDoc,(info?info.URL:undefined));
+			}catch(e){
+				self.Common.alert(e);
+			}
+		},0);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	load : function(aEvent){
+		var popup = this.TREE_POPUP;
+		if(!popup) return;
+		popup.addEventListener("popupshowing",this.popupshowing_tree, false);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	unload : function(aEvent){
+		var popup = this.TREE_POPUP;
+		if(!popup) return;
+		popup.removeEventListener("popupshowing",this.popupshowing_tree, false);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	popupshowing_tree : function(aEvent){
+		bitsTreeProjectService._popupshowing_tree(aEvent);
+	},
+
+	_popupshowing_tree : function(aEvent){
+		var aRes = null;
+		var type = null;
+		if(this.mcTreeHandler && this.mcTreeHandler.resource) aRes = this.mcTreeHandler.resource;
+		if(aRes) type = this.DataSource.getProperty(aRes,"type");
+		var contextmenu_type = nsPreferences.copyUnicharPref("wiredmarker.contextmenu.type","");
+		if(this.TREE_LISTVIEWMENU.hasAttribute("hidden") || contextmenu_type == "simple"){
+			this.TREE_INDEXMENU.setAttribute("hidden","true");
+			this.TREE_DOCUMENTMENU.setAttribute("hidden","true");
+			this.TREE_DICTIONARYMENU.setAttribute("hidden","true");
+		}else if(type && type == "localfolder"){
+			this.TREE_DOCUMENTMENU.setAttribute("hidden","true");
+			this.TREE_DICTIONARYMENU.setAttribute("hidden","true");
+		}else{
+			this.TREE_INDEXMENU.removeAttribute("hidden");
+			this.TREE_DOCUMENTMENU.removeAttribute("hidden");
+			this.TREE_DICTIONARYMENU.removeAttribute("hidden");
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	click : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	blur : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	onPopupShowing : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	onPopupHiding : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	onCommand : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	setWaitCursor : function(aValue){
+		var menu_MainBits = window.top.document.getElementById("bitsExtensionsMainMenu");
+		var menu_ToolsBits = window.top.document.getElementById("bitsExtensionsToolsMenu");
+		var menu_BookmarksBits = window.top.document.getElementById("bitsExtensionsBookmarksMenu");
+		var elems = this.SIDEBAR_DOC.getElementsByTagName("*");
+		var i;
+		if(aValue){
+			if(menu_MainBits) menu_MainBits.setAttribute("disabled","true");
+			if(menu_ToolsBits) menu_ToolsBits.setAttribute("disabled","true");
+			if(menu_BookmarksBits) menu_BookmarksBits.setAttribute("disabled","true");
+			for(i=0;i<elems.length;i++){
+				try{
+					if(elems[i].hasAttribute("disabled") && elems[i].disabled){
+						elems[i].setAttribute("disabled_prev","true");
+					}else{
+						elems[i].setAttribute("disabled","true");
+					}
+				}catch(e){this._dump("setWaitCursor("+aValue+"):"+e);}
+				try{elems[i].setAttribute("wait-cursor","true");}catch(e){this._dump("setWaitCursor("+aValue+"):"+e);}
+			}
+		}else{
+			if(menu_MainBits) menu_MainBits.removeAttribute("disabled");
+			if(menu_ToolsBits) menu_ToolsBits.removeAttribute("disabled");
+			if(menu_BookmarksBits) menu_BookmarksBits.removeAttribute("disabled");
+			for(i=0;i<elems.length;i++){
+				try{elems[i].removeAttribute("wait-cursor");}catch(e){this._dump("setWaitCursor("+aValue+"):"+e);}
+				try{
+					if(elems[i].hasAttribute("disabled_prev")){
+						elems[i].removeAttribute("disabled_prev");
+					}else{
+						elems[i].removeAttribute("disabled");
+					}
+				}catch(e){this._dump("setWaitCursor("+aValue+"):"+e);}
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	updateFolderProperty : function(aRes,aProperty,aOptions){
+		var changed = false;
+		var fid = this.DataSource.getProperty(aRes,"id");
+		var dbtype = this.DataSource.getProperty(aRes,"dbtype");
+		var folders = this.Database.getFolderFormID(fid, dbtype);
+		if(folders && folders.length>0){
+			if(aProperty != undefined){
+				var parser = new DOMParser();
+				var xmldoc;
+				if(folders[0].fid_property){
+					xmldoc = parser.parseFromString(folders[0].fid_property, "text/xml");
+				}
+				if(!xmldoc) xmldoc = parser.parseFromString("<PROPERTY/>", "text/xml");
+				parser = undefined;
+				if(aProperty.icon != undefined){
+					var icon_elem;
+					this.DataSource.setProperty(aRes,"icon",aProperty.icon);
+					icon_elem = xmldoc.getElementsByTagName("ICON")[0];
+					if(icon_elem){
+						while(icon_elem.hasChildNodes()){ icon_elem.removeChild(icon_elem.lastChild); }
+					}else{
+						icon_elem = xmldoc.createElement("ICON");
+						xmldoc.documentElement.appendChild(icon_elem);
+					}
+					icon_elem.appendChild(xmldoc.createTextNode(aProperty.icon));
+				}
+				if(aProperty.contextmenu != undefined){
+					var contextmenu_elem;
+					this.DataSource.setProperty(aRes,"contextmenu",aProperty.contextmenu);
+					contextmenu_elem = xmldoc.getElementsByTagName("CONTEXTMENU")[0];
+					if(contextmenu_elem){
+						while(contextmenu_elem.hasChildNodes()){ contextmenu_elem.removeChild(contextmenu_elem.lastChild); }
+					}else{
+						contextmenu_elem = xmldoc.createElement("CONTEXTMENU");
+						xmldoc.documentElement.appendChild(contextmenu_elem);
+					}
+					contextmenu_elem.appendChild(xmldoc.createTextNode(aProperty.contextmenu));
+				}
+				if(aProperty.propertyOverlay != undefined){
+					var propertyOverlay_elem;
+					propertyOverlay_elem = xmldoc.getElementsByTagName("PROPERTYOVERLAY")[0];
+					if(propertyOverlay_elem){
+						while(propertyOverlay_elem.hasChildNodes()){ propertyOverlay_elem.removeChild(propertyOverlay_elem.lastChild); }
+					}else{
+						propertyOverlay_elem = xmldoc.createElement("PROPERTYOVERLAY");
+						xmldoc.documentElement.appendChild(propertyOverlay_elem);
+					}
+					propertyOverlay_elem.appendChild(xmldoc.createTextNode(aProperty.propertyOverlay));
+				}
+				var s = new XMLSerializer();
+				folders[0].fid_property = s.serializeToString(xmldoc);
+				s = undefined;
+			}
+			if(aOptions != undefined){
+				if(aOptions.fid_style != undefined)  folders[0].fid_style  = aOptions.fid_style;
+				if(aOptions.fid_mode != undefined)  folders[0].fid_mode  = aOptions.fid_mode;
+				if(aOptions.pfid_order != undefined) folders[0].pfid_order = aOptions.pfid_order;
+			}
+			delete folders[0].dbtype;
+			changed = this.Database.updateFolder(folders[0],dbtype);
+		}
+		return changed;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createFolders : function(aEvent){
+		var curIdx = this.mcTreeHandler.TREE.currentIndex;
+		var curRes = null;
+		if(curIdx>=0){
+			if(!this.mcTreeHandler.TREE.view.isContainer(curIdx)) return;
+			curRes = this.mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+			if(!this.mcTreeHandler.TREE.view.isContainerOpen(curIdx)) this.mcTreeHandler.TREE.view.toggleOpenState(curIdx);
+		}else{
+			curRes = this.Common.RDF.GetResource(this.mcTreeHandler.TREE.ref);
+		}
+		var title = this.DataSource.getProperty(curRes,"title");
+		var style = this.DataSource.getProperty(curRes,"style");
+		var editmode = "0";
+		if(title != ""){
+			title = "New Project Folder ["+title+"]";
+		}else{
+			title = "New Project Folder";
+		}
+		if(editmode == "") editmode = "0";
+		if(!style || style==""){
+			var styleIdx = nsPreferences.getIntPref("wiredmarker.folderstyleindex",1);
+			if(styleIdx>8) styleIdx = 1;
+			style = bitsMarker.PRESET_STYLES[styleIdx];
+			nsPreferences.setIntPref("wiredmarker.folderstyleindex",styleIdx);
+		}
+		//ãã­ãžã§ã¯ããã©ã«ã
+		var newRes = this.mcMainService.createGroupFolder(title,curRes.Value,undefined,"","",editmode);
+		this.mcController.rebuildLocal();
+		bitsMarkingCollection.reOrder(curRes);
+		var newIdx = this.mcTreeHandler.TREE.builderView.getIndexOfResource(newRes);
+		this.mcTreeHandler.TREE.view.selection.select(newIdx);
+		this.mcTreeHandler.TREE.focus();
+		if(!this.mcTreeHandler.TREE.view.isContainerOpen(newIdx)) this.mcTreeHandler.TREE.view.toggleOpenState(newIdx);
+		var fid_mode = 0x0002;
+		this.updateFolderProperty(newRes,{icon:"chrome://markingcollection/skin/project.png",contextmenu:"mcPopupProjectMainMenu"},{fid_mode : fid_mode });
+		this.DataSource.setProperty(newRes,"editmode",fid_mode.toString());
+		//ãã­ã¥ã¡ã³ããã©ã«ã
+		var newRes_Docs = this.mcMainService.createGroupFolder("Documents",newRes.Value,undefined,"","",editmode);
+		this.mcController.rebuildLocal();
+		bitsMarkingCollection.reOrder(newRes);
+		fid_mode = 0x0002;
+		this.updateFolderProperty(newRes_Docs,{icon:"chrome://markingcollection/skin/documents.png",contextmenu:"mcPopupProjectDocumentsMenu"},{fid_mode : fid_mode});
+		this.DataSource.setProperty(newRes_Docs,"editmode",fid_mode.toString());
+		//èŸæžãã©ã«ã
+		var newRes_Dic = this.mcMainService.createGroupFolder("Dictionary",newRes.Value,undefined,"","",editmode);
+		this.mcController.rebuildLocal();
+		bitsMarkingCollection.reOrder(newRes);
+		fid_mode = 0x0002;
+		this.updateFolderProperty(newRes_Dic,{icon:"chrome://markingcollection/skin/dictionary.png",contextmenu:"mcPopupProjectDictionaryMenu"},{fid_mode : fid_mode});
+		this.DataSource.setProperty(newRes_Dic,"editmode",fid_mode.toString());
+		//HAãã©ã«ã
+		var newRes_Anchor = this.mcMainService.createGroupFolder("Anchor",newRes.Value,undefined,style,"",editmode);
+		this.mcController.rebuildLocal();
+		bitsMarkingCollection.reOrder(newRes);
+		fid_mode = 0x0000;
+		this.updateFolderProperty(newRes_Anchor,{icon:"chrome://markingcollection/skin/hyperanchor.png",contextmenu:"mcPopupProjectAnchorMenu"});
+		this.DataSource.setProperty(newRes_Anchor,"editmode",fid_mode.toString());
+		var result = this.mcController.property(newRes);
+		if(result){
+			bitsMarkingCollection.reOrder(curRes);
+		}else{
+			this.mcTreeHandler.remove(undefined,undefined,true);
+		}
+		var newIdx = this.mcTreeHandler.TREE.builderView.getIndexOfResource(newRes);
+		this.mcController.rebuildLocal();
+		var selectIdx = newIdx;
+		if(selectIdx<0) selectIdx = curIdx;
+		this.mcTreeHandler.TREE.currentIndex = selectIdx;
+		if(!this.mcTreeHandler.TREE.view.selection.isSelected(this.mcTreeHandler.TREE.currentIndex)) this.mcTreeHandler.TREE.view.selection.select(this.mcTreeHandler.TREE.currentIndex);
+		this.mcTreeHandler.TREE.focus();
+		this.mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(selectIdx);
+		this.mcPropertyView.dispProperty(this.mcTreeHandler.object);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createDocumentsFolder : function(aEvent){
+		var curIdx = this.mcTreeHandler.TREE.currentIndex;
+		var curRes = null;
+		if(curIdx>=0){
+			if(!this.mcTreeHandler.TREE.view.isContainer(curIdx)) return;
+			curRes = this.mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+			if(!this.mcTreeHandler.TREE.view.isContainerOpen(curIdx)) this.mcTreeHandler.TREE.view.toggleOpenState(curIdx);
+		}else{
+			curRes = this.Common.RDF.GetResource(this.mcTreeHandler.TREE.ref);
+		}
+		var title = this.DataSource.getProperty(curRes,"title");
+		var style = this.DataSource.getProperty(curRes,"style");
+		var editmode = "0";
+		if(title != ""){
+			title = "New Documents Folder ["+title+"]";
+		}else{
+			title = "New Documents Folder";
+		}
+		if(editmode == "") editmode = "0";
+		var fid_mode = 0x0002;
+		//ãã­ã¥ã¡ã³ããã©ã«ã
+		var newRes = this.mcMainService.createGroupFolder(title,curRes.Value,undefined,"","",editmode);
+		this.mcController.rebuildLocal();
+		bitsMarkingCollection.reOrder(newRes);
+		var newIdx = this.mcTreeHandler.TREE.builderView.getIndexOfResource(newRes);
+		this.mcTreeHandler.TREE.view.selection.select(newIdx);
+		this.mcTreeHandler.TREE.focus();
+		if(!this.mcTreeHandler.TREE.view.isContainerOpen(newIdx)) this.mcTreeHandler.TREE.view.toggleOpenState(newIdx);
+		this.updateFolderProperty(newRes,
+			{
+				icon        : "chrome://markingcollection/skin/documents.png",
+				contextmenu : "mcPopupProjectDocumentsMenu"
+			},
+			{ fid_mode : fid_mode }
+		);
+		this.DataSource.setProperty(newRes,"editmode",fid_mode.toString());
+		var result = this.mcController.property(newRes);
+		if(result){
+			bitsMarkingCollection.reOrder(curRes);
+		}else{
+			this.mcTreeHandler.remove(undefined,undefined,true);
+		}
+		var newIdx = this.mcTreeHandler.TREE.builderView.getIndexOfResource(newRes);
+		this.mcController.rebuildLocal();
+		var selectIdx = newIdx;
+		if(selectIdx<0) selectIdx = curIdx;
+		this.mcTreeHandler.TREE.currentIndex = selectIdx;
+		if(!this.mcTreeHandler.TREE.view.selection.isSelected(this.mcTreeHandler.TREE.currentIndex)) this.mcTreeHandler.TREE.view.selection.select(this.mcTreeHandler.TREE.currentIndex);
+		this.mcTreeHandler.TREE.focus();
+		this.mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(selectIdx);
+		this.mcPropertyView.dispProperty(this.mcTreeHandler.object);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createDictionaryFolder : function(aEvent){
+		var curIdx = this.mcTreeHandler.TREE.currentIndex;
+		var curRes = null;
+		if(curIdx>=0){
+			if(!this.mcTreeHandler.TREE.view.isContainer(curIdx)) return;
+			curRes = this.mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+			if(!this.mcTreeHandler.TREE.view.isContainerOpen(curIdx)) this.mcTreeHandler.TREE.view.toggleOpenState(curIdx);
+		}else{
+			curRes = this.Common.RDF.GetResource(this.mcTreeHandler.TREE.ref);
+		}
+		var title = this.DataSource.getProperty(curRes,"title");
+		var style = this.DataSource.getProperty(curRes,"style");
+		var editmode = "0";
+		if(title != ""){
+			title = "New Dictionary Folder ["+title+"]";
+		}else{
+			title = "New Dictionary Folder";
+		}
+		if(editmode == "") editmode = "0";
+		if(!style || style==""){
+			var styleIdx = nsPreferences.getIntPref("wiredmarker.folderstyleindex",1);
+			if(styleIdx>8) styleIdx = 1;
+			style = bitsMarker.PRESET_STYLES[styleIdx];
+			nsPreferences.setIntPref("wiredmarker.folderstyleindex",styleIdx);
+		}
+		var fid_mode = 0x0000;
+		//èŸæžãã©ã«ã
+		var newRes = this.mcMainService.createGroupFolder(title,curRes.Value,undefined,style,"",editmode);
+		this.mcController.rebuildLocal();
+		bitsMarkingCollection.reOrder(newRes);
+		var newIdx = this.mcTreeHandler.TREE.builderView.getIndexOfResource(newRes);
+		this.mcTreeHandler.TREE.view.selection.select(newIdx);
+		this.mcTreeHandler.TREE.focus();
+		if(!this.mcTreeHandler.TREE.view.isContainerOpen(newIdx)) this.mcTreeHandler.TREE.view.toggleOpenState(newIdx);
+		this.updateFolderProperty(newRes,
+			{
+				icon            : "chrome://markingcollection/skin/dictionary.png",
+				contextmenu     : "mcPopupProjectDictionaryMenu",
+			},
+			{fid_mode : fid_mode}
+		);
+		this.DataSource.setProperty(newRes,"editmode",fid_mode.toString());
+		var result = this.mcController.property(newRes);
+		if(result){
+			bitsMarkingCollection.reOrder(curRes);
+		}else{
+			this.mcTreeHandler.remove(undefined,undefined,true);
+		}
+		var newIdx = this.mcTreeHandler.TREE.builderView.getIndexOfResource(newRes);
+		this.mcController.rebuildLocal();
+		var selectIdx = newIdx;
+		if(selectIdx<0) selectIdx = curIdx;
+		this.mcTreeHandler.TREE.currentIndex = selectIdx;
+		if(!this.mcTreeHandler.TREE.view.selection.isSelected(this.mcTreeHandler.TREE.currentIndex)) this.mcTreeHandler.TREE.view.selection.select(this.mcTreeHandler.TREE.currentIndex);
+		this.mcTreeHandler.TREE.focus();
+		this.mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(selectIdx);
+		this.mcPropertyView.dispProperty(this.mcTreeHandler.object);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	readDocumentFromFolder : function(aEvent){
+		try{
+			var mcTreeHandler = null;
+			if(this.mcTreeHandler) mcTreeHandler = this.mcTreeHandler;
+			if(!mcTreeHandler) return;
+			var aRes = mcTreeHandler.resource;
+			if(!aRes) return;
+			this.readDocuments(this.getReadFolder());
+		}catch(e){
+			this._dump("bitsTreeProjectService.readDocumentFromFolder():"+e);
+			if(this._progressWindow && !this._progressWindow.closed) this._progressWindow.close();
+			this._progressWindow = null;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	readDocumentFromFile : function(aEvent){
+		try{
+			var mcTreeHandler = null;
+			if(this.mcTreeHandler) mcTreeHandler = this.mcTreeHandler;
+			if(!mcTreeHandler) return;
+			var aRes = mcTreeHandler.resource;
+			if(!aRes) return;
+			this.readDocuments(this.getReadFiles());
+		}catch(e){
+			this._dump("bitsTreeProjectService.readDocumentFromFile():"+e);
+			if(this._progressWindow && !this._progressWindow.closed) this._progressWindow.close();
+			this._progressWindow = null;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	readDocuments : function(urls){
+		try{
+			if(!urls || urls.length==0) return;
+			var curIdx = this.mcTreeHandler.TREE.currentIndex;
+			var aRes =  this.mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+			if(!this.mcTreeHandler.TREE.view.isContainerOpen(curIdx)) this.mcTreeHandler.TREE.view.toggleOpenState(curIdx);
+			var fid = this.DataSource.getProperty(aRes, "id");
+			var fid_style = this.DataSource.getProperty(aRes, "style");
+			var dbtype = this.DataSource.getProperty(aRes, "dbtype");
+			var pfid = this.DataSource.getProperty(aRes, "pfid");
+			var param = {
+				fid       : fid,
+				fid_style : fid_style,
+				dbtype    : dbtype,
+				resource  : aRes,
+				pfid      : pfid
+			};
+			if(!this._progressWindow){
+				var x = screen.width;
+				var y = screen.height;
+				this._progressWindow = window.openDialog(
+					"chrome://markingcollection/content/progress.xul",
+					"myProgress", "chrome,centerscreen,alwaysRaised,dependent=yes,left="+x+",top="+y, 
+					{status: this.STRING.getString("MSG_READING_DOCUMENTS") + "... [ "+ urls.length + " ]"});
+			}
+			if(this._progressWindow && !this._progressWindow.closed) this._progressWindow.focus();
+			var self = this;
+			setTimeout(function(){ self._readDocuments(param,urls); },100);
+			bitsAutocacheService._refreshFlag = false;
+			if(this.bitsItemView && this.bitsItemView.isChecked) this.bitsItemView._refreshFlag = false;
+			bitsArticleNavigation.stopObserver();
+			this.setWaitCursor(true);
+		}catch(e){
+			this._dump("bitsTreeProjectService.readDocuments():"+e);
+			if(this._progressWindow && !this._progressWindow.closed) this._progressWindow.close();
+			this._progressWindow = null;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_readDocuments : function(aParam,aUrls){
+		try{
+			var i;
+			for(i=0;i<10 && aUrls.length>0;i++){
+				var url = aUrls.shift();
+				this._addURLText(aParam,url);
+			}
+			if(aUrls.length>0){
+				var self = this;
+				setTimeout(function(){ self._readDocuments(aParam,aUrls); },100);
+				if(this._progressWindow && !this._progressWindow.closed && this._progressWindow.setStatus) this._progressWindow.setStatus(this.STRING.getString("MSG_READING_DOCUMENTS") + "... [ "+ aUrls.length + " ]");
+			}else{
+				if(this._progressWindow && !this._progressWindow.closed) this._progressWindow.close();
+				this._progressWindow = null;
+				bitsAutocacheService._refreshFlag = true;
+				bitsAutocacheService.refresh();
+				if(this.bitsItemView && this.bitsItemView.isChecked){
+					this.bitsItemView._refreshFlag = true;
+					this.bitsItemView.refresh();
+				}else if(this.mcTreeViewModeService){
+					this.DataSource.flush();
+				}
+				bitsArticleNavigation.startObserver();
+				this.setWaitCursor(false);
+			}
+		}catch(e){
+			this._dump("bitsTreeProjectService._readDocuments():"+e);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_addURLText : function(aParam, aURLString){
+		try{
+			var rtn = false;
+			var url = aURLString;
+			var doc_url = url;
+			var con_url = url;
+			var parentID = aParam.fid;
+			var style = aParam.fid_style;
+			var dbtype = aParam.dbtype;
+			var resource = aParam.resource;
+			var pfid_order = this.Database.getMaxOrderFormPID(parentID);
+			var rObj = this.Database.newObject(undefined,dbtype);
+			if(rObj){
+				rObj.pfid = parentID;
+				rObj.doc_url = bitsAutocacheService.convertCacheURLToOriginalURL(doc_url);
+				rObj.doc_title = rObj.doc_url;
+				rObj.con_url = bitsAutocacheService.convertCacheURLToOriginalURL(con_url);
+				rObj.oid_title = decodeURIComponent(this.Common.getFileName(url));
+				if(rObj.oid_title == "") rObj.oid_title = decodeURIComponent(url);
+				rObj.doc_title = rObj.oid_title;
+				rObj.oid_mode = "0";
+				try{ rObj.oid_type = this.Common.MIME.getTypeFromURI(this.Common.convertURLToObject(url)); }catch(e){ rObj.oid_type=null; }
+				if(!rObj.oid_type) rObj.oid_type = "url";
+				rObj.oid_txt = bitsAutocacheService.convertCacheURLToOriginalURL(url);
+				rObj.oid_date = bitsAutocacheService.getURLTimeStampFormatDate(doc_url);
+				rObj.pfid_order = ++pfid_order;
+				rtn = this.Database.addObject(rObj,dbtype);
+				if(rtn){
+					if(this.bitsItemView && this.bitsItemView.isChecked){
+					}else if(this.mcTreeViewModeService){
+						var newDCitem = this.Common.newItem();
+						newDCitem.id = rObj.oid;
+						newDCitem.about = this.DataSource.getAbout(rObj.oid,rObj.pfid,dbtype);
+						newDCitem.pfid = rObj.pfid;
+						newDCitem.type = "item";
+						newDCitem.title = rObj.oid_title;
+						newDCitem.editmode = rObj.oid_mode;
+						newDCitem.uri = rObj.doc_url;
+						newDCitem.date = rObj.oid_date;
+						newDCitem.dbtype = dbtype;
+						if(url.indexOf("file://") == 0){
+							newDCitem.title = rObj.oid_title;
+						}else{
+							newDCitem.icon = this.Database.getFavicon(rObj.doc_url,dbtype);
+						}
+						var aParName = this.DataSource.getID2About(parentID,aParam.pfid,dbtype);
+						var newRes = this.DataSource.addItem(newDCitem, aParName, -1, dbtype);
+					}
+				}
+				rObj = undefined;
+			}
+		}catch(ex){
+			bitsMarkingCollection._dump("bitsMarkingCollection.addURLText():"+ex);
+		}
+		return rtn;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_getDictionaryDir : function(aDBtype){
+		if(aDBtype == undefined) return undefined;
+		var dir = this.Common.getExtensionDir().clone();
+		dir.append("dictionary");
+		dir.append(aDBtype);
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_getDictionaryFile : function(aID,aDBtype){
+		bitsMarkingCollection._dump("CALLED _getDictionaryFile():");
+		if(aID == undefined || aDBtype == undefined) return undefined;
+		var file = this._getDictionaryDir(aDBtype);
+		if(!file) return undefined;
+		file.append(aID+".xml");
+		return file;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_createDictionaryXML : function(){
+		var parser = new DOMParser();
+		var xmldoc = parser.parseFromString("<DICTIONARY/>", "text/xml");
+		parser = undefined;
+		if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+		return xmldoc;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_getDictionaryXML : function(aID,aDBtype){
+		if(aID == undefined || aDBtype == undefined) return undefined;
+		var file = this._getDictionaryFile(aID,aDBtype);
+		var content = this.readFile(file);
+		if(!content || content == "") return undefined;
+		var parser = new DOMParser();
+		var xmldoc = parser.parseFromString(content, "text/xml");
+		parser = undefined;
+		if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+		return xmldoc;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_putDictionaryXML : function(aID,aDBtype,aXMLDoc){
+		if(aID == undefined || aDBtype == undefined || aXMLDoc == undefined) return undefined;
+		var file = this._getDictionaryFile(aID,aDBtype);
+		var s = new XMLSerializer();
+		var content = s.serializeToString(aXMLDoc);
+		s = undefined;
+		return this.writeFile(file,content);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	makeDictionary : function(aEvent){
+		var mcTreeHandler = null;
+		if(this.mcTreeHandler) mcTreeHandler = this.mcTreeHandler;
+		if(!mcTreeHandler) return undefined;
+		var aRes = mcTreeHandler.resource;
+		if(!aRes) return undefined;
+		if(this._makeDictionary(aRes)){
+			this.Common.alert(this.STRING.getString("SUCCEEDED_DICTIONARY_UPDATE"));
+		}else{
+			this.Common.alert(this.STRING.getString("ALERT_DICTIONARY_UPDATE"));
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_makeDictionary : function(aRes){
+		var fid = this.DataSource.getProperty(aRes, "id");
+		var dbtype = this.DataSource.getProperty(aRes, "dbtype");
+		var fid_title = this.DataSource.getProperty(aRes, "title");
+		var fid_style = this.DataSource.getProperty(aRes, "style");
+		var fid_note = "";
+		var folders = this.Database.getFolder({fid:fid},dbtype);
+		if(folders){
+			if(folders[0].fid_property && folders[0].fid_property != ""){
+				try{
+					var parser = new DOMParser();
+					var xmldoc = parser.parseFromString(folders[0].fid_property, "text/xml");
+					parser = undefined;
+				}catch(ex){}
+				if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+				if(xmldoc){
+					var elems = xmldoc.getElementsByTagName("TAG");
+					if(elems && elems.length>0) fid_title = elems[0].textContent;
+					elems = undefined;
+					elems = xmldoc.getElementsByTagName("NOTE");
+					if(elems && elems.length>0) fid_note = elems[0].textContent;
+					elems = undefined;
+					xmldoc = undefined;
+				}
+			}
+		}
+		var xmldoc = this._getDictionaryXML(fid,dbtype);
+		if(!xmldoc) xmldoc = this._createDictionaryXML();
+		if(!xmldoc) return undefined;
+		/* TITLEãšã¬ã¡ã³ãäœæ */
+		var titleElem = xmldoc.createTextNode(fid_title);
+		var elems = xmldoc.documentElement.getElementsByTagName("TITLE");
+		if(elems && elems.length > 0){
+			if(elems[0].hasChildNodes()){
+				elems[0].replaceChild(titleElem,elems[0].firstChild);
+			}else{
+				elems[0].appendChild(titleElem);
+			}
+		}else{
+			var elem = xmldoc.createElement("TITLE");
+			if(elem){
+				elem.appendChild(titleElem);
+				xmldoc.documentElement.appendChild(elem);
+			}
+		}
+		/* NOTEãšã¬ã¡ã³ãäœæ */
+		var noteElem = xmldoc.createTextNode(fid_note);
+		var elems = xmldoc.documentElement.getElementsByTagName("NOTE");
+		if(elems && elems.length > 0){
+			if(elems[0].hasChildNodes()){
+				elems[0].replaceChild(noteElem,elems[0].firstChild);
+			}else{
+				elems[0].appendChild(noteElem);
+			}
+		}else{
+			var elem = xmldoc.createElement("NOTE");
+			if(elem){
+				elem.appendChild(noteElem);
+				xmldoc.documentElement.appendChild(elem);
+			}
+		}
+		/* STYLEãšã¬ã¡ã³ãäœæ */
+		var styleElem = xmldoc.createTextNode(fid_style);
+		var elems = xmldoc.documentElement.getElementsByTagName("STYLE");
+		if(elems && elems.length > 0){
+			if(elems[0].hasChildNodes()){
+				elems[0].replaceChild(styleElem,elems[0].firstChild);
+			}else{
+				elems[0].appendChild(styleElem);
+			}
+		}else{
+			var elem = xmldoc.createElement("STYLE");
+			if(elem){
+				elem.appendChild(styleElem);
+				xmldoc.documentElement.appendChild(elem);
+			}
+		}
+		/* TERMSãšã¬ã¡ã³ãäœæ */
+		var terms;
+		var elems = xmldoc.documentElement.getElementsByTagName("TERMS");
+		if(elems && elems.length > 0){
+			terms = elems[0];
+		}else{
+			terms = xmldoc.createElement("TERMS");
+			if(terms) xmldoc.documentElement.appendChild(terms);
+		}
+		if(!terms) return undefined;
+		var i;
+		var termhash = {};
+		var elems = terms.getElementsByTagName("TERM");
+		for(i=0;i<elems.length;i++){
+			if(!elems[i].textContent) continue;
+			termhash[elems[i].textContent.toLowerCase()] = i;
+		}
+		var objs = this.Database.getObject({pfid:fid},dbtype);
+		if(objs){
+			for(i=0;i<objs.length;i++){
+				var term = objs[i].oid_title.replace(/^\s*/mg,"").replace(/\s*$/mg,"");
+				var key = term.toLowerCase();
+				if(termhash[key] != undefined) continue;
+				termhash[key] = i;
+				var elem = xmldoc.createElement("TERM");
+				if(!this._caseSensitive_exp.test(term)) term = term.toLowerCase();
+				var termElem = xmldoc.createTextNode(term);
+				if(!elem || !termElem) continue;
+				elem.setAttribute("date",objs[i].oid_date);
+				terms.appendChild(elem);
+				elem.appendChild(termElem);
+			}
+		}
+		if(this._putDictionaryXML(fid,dbtype,xmldoc)){
+			return xmldoc;
+		}else{
+			return undefined;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	applyDictionary : function(aEvent){
+		var mcTreeHandler = null;
+		if(this.mcTreeHandler) mcTreeHandler = this.mcTreeHandler;
+		if(!mcTreeHandler) return;
+		var aRes = mcTreeHandler.resource;
+		if(!aRes) return;
+
+		var doc = this.gBrowser.contentDocument;
+		var doc_url = this.Common.getURLStringFromDocument(doc);
+		if(!bitsAutocacheService.isMarking(doc_url)) return undefined;
+
+		var dbtype = this.DataSource.getProperty(aRes, "dbtype");
+		this._oid = this.Database._oidIdentify(dbtype,bitsObjectMng.Common.getTimeStamp());
+
+		if(!this._progressWindow){
+			var x = screen.width;
+			var y = screen.height;
+			this._progressWindow = window.openDialog(
+				"chrome://markingcollection/content/progress_determined.xul",
+				"myProgress", "chrome,centerscreen,alwaysRaised,dependent=yes,left="+x+",top="+y, 
+				{status: "Loading Dictionary..."});
+		}
+		if(this._progressWindow && !this._progressWindow.closed){
+			if(this._progressWindow.setStatus) this._progressWindow.setStatus("Loading Dictionary...");
+			this._progressWindow.focus();
+		}
+		var self = this;
+		if(this._applytimer) clearTimeout(this._applytimer);
+		this._applytimer = setTimeout(function(){ self._applyDictionaryReadingXMLDictionary(doc,aRes); },1000);
+		this.setWaitCursor(true);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_applyDictionaryReadingXMLDictionary : function(doc,aRes){
+		var xmldocs = [];
+		var i,j;
+		var foldResList = this.DataSource.flattenResources(aRes, 1, true);
+		for(i=0;i<foldResList.length;i++){
+			var fid = this.DataSource.getProperty(foldResList[i], "id");
+			var style = this.DataSource.getProperty(foldResList[i], "style");
+			var dbtype = this.DataSource.getProperty(foldResList[i], "dbtype");
+			var xmldoc = this._getDictionaryXML(fid,dbtype);
+			if(!xmldoc){
+				var title = this.DataSource.getProperty(foldResList[i], "title");
+				if(this.Common.confirm("[ "+title+" ]\n"+this.STRING.getString("CONFIRM_DICTIONARY_UPDATE"))) xmldoc = this._makeDictionary(foldResList[i]);
+			}
+			if(xmldoc) xmldocs.push({doc:xmldoc,fid:fid,dbtype:dbtype,style:style});
+		}
+		var selection = doc.defaultView.getSelection();
+		if(!selection) return;
+		selection.removeAllRanges();
+		if(this._progressWindow && !this._progressWindow.closed){
+			if(this._progressWindow.setStatus) this._progressWindow.setStatus("Sort Dictionary...");
+			this._progressWindow.focus();
+		}
+		var self = this;
+		this._applytimer = setTimeout(function(){ self._applyDictionaryLoadingDictionary(doc,xmldocs); },1000);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_applyDictionaryLoadingDictionary : function(doc,xmldocs){
+		var rangeCount = 0;
+		var termhash = {};
+		var termarray = [];
+		var j;
+		while(xmldocs && xmldocs.length>0){
+			var xmldocobj = xmldocs.shift();
+			var xmldoc = xmldocobj.doc;
+			/* TERMSãšã¬ã¡ã³ãäœæ */
+			var terms = xmldoc.documentElement.getElementsByTagName("TERMS")[0];
+			if(!terms){
+				terms = xmldoc.createElement("TERMS");
+				if(terms) xmldoc.documentElement.appendChild(terms);
+			}
+			if(!terms) continue;
+			var elems = terms.getElementsByTagName("TERM");
+			if(elems.length == 0) continue;
+			for(j=0;j<elems.length;j++){
+				if(!elems[j].textContent) continue;
+				if(elems[j].hasAttribute("delete")) continue;
+				if(elems[j].hasAttribute("exception")) continue;
+				var key = elems[j].textContent.toLowerCase();
+				if(termhash[key] != undefined) continue;
+				termhash[key] = j;
+				termarray.push({
+					term : elems[j].textContent,
+					obj  : xmldocobj,
+				});
+			}
+		}
+		termhash = undefined;
+		if(termarray.length>0){
+			termarray.sort(
+				function(a,b){
+					if(a.term.length>b.term.length) return -1;
+					if(a.term.length<b.term.length) return 1;
+					return 0;
+				}
+			);
+			if(this._progressWindow && !this._progressWindow.closed){
+				if(this._progressWindow.setProgress) this._progressWindow.setProgress(0);
+				if(this._progressWindow.setStatus) this._progressWindow.setStatus(this.STRING.getString("MSG_DOCUMENTATION_TO_MATCH_THE_DICTIONARY") + "... [ 0% ], Remaining term:[ "+ termarray.length + " ], Meet term:[ "+ rangeCount + " ]");
+				if(this._progressWindow.setCallback) this._progressWindow.setCallback(this._applyDictionaryCancel);
+				this._progressWindow.focus();
+			}
+			var self = this;
+			this._applytimer = setTimeout(function(){ self._applyDictionary(doc,termarray,termarray.length); },100);
+			bitsAutocacheService._refreshFlag = false;
+			if(this.bitsItemView && this.bitsItemView.isChecked) this.bitsItemView._refreshFlag = false;
+			bitsArticleNavigation.stopObserver();
+		}else{
+			if(this._progressWindow && !this._progressWindow.closed) this._progressWindow.close();
+			this._progressWindow = null;
+			this.setWaitCursor(false);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_applyDictionaryCancel : function(aEvent){
+		var self = bitsTreeProjectService;
+		if(self._applytimer) clearTimeout(self._applytimer);
+		self._applytimer = null;
+		if(self._progressWindow && !self._progressWindow.closed) self._progressWindow.close();
+		self._progressWindow = null;
+		bitsAutocacheService._refreshFlag = true;
+		bitsAutocacheService.refresh();
+		if(self.bitsItemView && self.bitsItemView.isChecked){
+			self.bitsItemView._refreshFlag = true;
+			self.bitsItemView.refresh();
+		}else if(self.mcTreeViewModeService){
+			self.mcTreeViewModeService.rebuild();
+		}
+		bitsArticleNavigation.startObserver();
+		self.setWaitCursor(false);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_applyDictionary : function(aDoc,aTermArray,aMaxTerm,aRangeCount){
+		var self = this;
+		if(aRangeCount == undefined) aRangeCount = 0;
+		if(aTermArray.length == 0 || !this._applytimer){
+			if(this._progressWindow && !this._progressWindow.closed) this._progressWindow.close();
+			this._progressWindow = null;
+			setTimeout(function(){
+				self.Common.alert("Term has [ "+ aRangeCount + " ] matches.");
+				if(self.bitsItemView && self.bitsItemView.isChecked){
+					self.bitsItemView._refreshFlag = true;
+					self.bitsItemView.refresh();
+				}else if(self.mcTreeViewModeService){
+					bitsMarkingCollection._dump("bitsTreeProjectService._applyDictionary(1)");
+					self.mcTreeViewModeService.rebuild();
+					bitsMarkingCollection._dump("bitsTreeProjectService._applyDictionary(2)");
+				}
+			},100);
+			bitsAutocacheService._refreshFlag = true;
+			bitsAutocacheService.refresh();
+			var url = this.Common.getURLStringFromDocument(aDoc);
+			setTimeout(function(){
+				var rtn= bitsAutocacheService.selectRowFromURL(url);
+				if(!rtn) setTimeout(function(){ bitsAutocacheService.selectRowFromURL(url); },2000);
+			},500);
+			bitsArticleNavigation.startObserver();
+			this.setWaitCursor(false);
+			return;
+		}
+		var maxcnt = aMaxTerm>=20 ? parseInt(aMaxTerm/20) : aMaxTerm;
+		if(maxcnt>100) maxcnt = 100;
+		var doc = aDoc;
+		var findRange = this._getFindRange();
+		var j;
+		for(j=0;j<maxcnt && aTermArray.length>0;j++){
+			var termobj = aTermArray.shift();
+			var findtext = termobj.term;
+			findRange.caseSensitive = this._caseSensitive_exp.test(findtext);
+			var docRange = doc.createRange();
+			docRange.selectNode(doc.body);
+			var startRange = docRange.cloneRange();
+			var stopRange = docRange.cloneRange();
+			startRange.collapse(true);
+			stopRange.collapse(false);
+			var rangeCount = 0;
+			var result;
+			while((result = findRange.Find(findtext, docRange, startRange, stopRange))){
+				if(result.endContainer != null &&
+					 result.startContainer != null &&
+					 result.endContainer.nodeType == Node.TEXT_NODE &&
+					 result.startContainer.nodeType == Node.TEXT_NODE &&
+					 !this._isNodeInputNodeOrChildOf(result.startContainer) &&
+					 !this._isNodeInputNodeOrChildOf(result.endContainer)) {
+					var startChar = null;
+					if(result.startOffset > 0) startChar = result.startContainer.nodeValue.charAt(result.startOffset - 1);
+					var endChar = result.endContainer.nodeValue.charAt(result.endOffset);
+					if(!this._isWordCharacter(startChar) && !this._isWordCharacter(endChar)){
+						if(!((result.startContainer.parentNode && this._marker_exp.test(result.startContainer.parentNode.id)) || (result.endContainer.parentNode && this._marker_exp.test(result.endContainer.parentNode.id)))){
+							var rtn = this._addSelectedText(
+								aDoc,
+								{
+									fid       : termobj.obj.fid,
+									fid_style : termobj.obj.style,
+									dbtype    : termobj.obj.dbtype
+								},result);
+							if(rtn && rtn[0].id){
+								var elem = aDoc.getElementById(rtn[0].id);
+								if(elem){
+									result.selectNode(elem);
+									rangeCount++;
+								}
+							}
+						}else{
+						}
+					}else{
+					}
+				}
+				startRange = result;
+				startRange.collapse(false);
+			}
+			if(rangeCount>0){
+				aRangeCount += rangeCount;
+				break;
+			}
+		}
+		this._applytimer = setTimeout(function(){ self._applyDictionary(aDoc,aTermArray,aMaxTerm,aRangeCount); },100);
+		if(this._progressWindow && !this._progressWindow.closed){
+			var p = (aMaxTerm-aTermArray.length)/aMaxTerm;
+			if(this._progressWindow.setProgress) this._progressWindow.setProgress( parseInt(p*100) );
+			if(this._progressWindow.setStatus) this._progressWindow.setStatus(this.STRING.getString("MSG_DOCUMENTATION_TO_MATCH_THE_DICTIONARY") + "... [ "+ parseInt(p*100) + "% ], Remaining term:[ "+ aTermArray.length + " ], Meet term:[ "+ aRangeCount + " ]");
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_addSelectedText : function(aDoc, aParName, aRange){
+		try{
+			var parentID = aParName.fid;
+			var style = aParName.fid_style;
+			var dbtype = aParName.dbtype;
+			var pfid_order = this.Database.getMaxOrderFormPID(parentID);
+			var doc_url = this.Common.getURLStringFromDocument(aDoc);
+			bitsAutocacheService.createCache(doc_url);
+			var rtnContent = null;
+			var parser = new DOMParser();
+			var rtnNewObj = [];
+			var r;
+			var range = aRange.cloneRange();
+			if(range.startContainer.nodeType != range.startContainer.TEXT_NODE || range.endContainer.nodeType != range.endContainer.TEXT_NODE){
+				var docRange = range.cloneRange();
+				var startRange = range.cloneRange();
+				var stopRange = range.cloneRange();
+				startRange.collapse(true)
+				stopRange.collapse(false)
+				var xContext = range.toString().replace(/^\s*/g,"").replace(/\s*$/g,"");
+				var findRange = bitsMarker._getFindRange();
+				var result = findRange.Find(xContext, docRange, startRange, stopRange);
+				if(result) range = result.cloneRange();
+			}
+			var context = range.toString();
+			var startContainer = range.startContainer;
+			var startOffset = range.startOffset;
+			var endContainer = range.endContainer;
+			var endOffset = range.endOffset;
+			var stXPath = this.XPath.getOffsetFromParentNode(startContainer,startOffset);
+			var enXPath = this.XPath.getOffsetFromParentNode(endContainer,endOffset);
+			try{
+				var hyperAnchor = bitsHyperAnchor._getAnchorURL({node:startContainer,offset:startOffset,style:style,prefix:"b",contents:range.toString()},{node:endContainer,offset:endOffset,prefix:"e",contents:range.toString()});
+			}catch(ex3){
+				try{
+					var hyperAnchor = bitsHyperAnchorDummy._getAnchorURL({node:startContainer,offset:startOffset,style:style,prefix:"b",contents:range.toString()},{node:endContainer,offset:endOffset,prefix:"e",contents:range.toString()});
+				}catch(ex3){ hyperAnchor = null; }
+			}
+			if(hyperAnchor) hyperAnchor = bitsAutocacheService.convertCacheURLToOriginalURL(hyperAnchor);
+			var con_url = this.Common.getURLStringFromDocument(stXPath.node.ownerDocument);
+			var rObj = {};
+			rObj.pfid = parentID;
+			rObj.doc_url = bitsAutocacheService.convertCacheURLToOriginalURL(doc_url);
+			rObj.con_url = bitsAutocacheService.convertCacheURLToOriginalURL(con_url);
+			rObj.doc_title = this.gBrowser.contentDocument.title?this.gBrowser.contentDocument.title:rObj.doc_url;
+			rObj.bgn_dom = stXPath.xpath + "("+stXPath.offset+")" + "("+stXPath.type+")";
+			rObj.end_dom = enXPath.xpath + "("+enXPath.offset+")" + "("+enXPath.type+")";
+			rObj.oid_title = this.Common.exceptCode(context.replace(/[\r\n\t]+/mg," ").replace(/\s{2,}/mg," "));
+			rObj.oid_txt = this.Common.exceptCode(context.replace(/\s+$/mg,"").replace(/^\s+/mg,""));
+			rObj.oid_date = bitsAutocacheService.getURLTimeStampFormatDate(doc_url);
+			rObj.oid_mode = "0";
+			rObj.con_doc = stXPath.node.ownerDocument;
+			var frame_name;
+			if(doc_url != con_url){
+				var win = this.gBrowser.contentWindow;
+				if(win.frames != null){
+					var i;
+					for(i=0;i<win.frames.length;i++){
+						if(this.Common.getURLStringFromDocument(win.frames[i].document) != con_url) continue;
+						frame_name = win.frames[i].name;
+						break;
+					}
+				}
+			}
+			rObj.oid_type = "text";
+			if(hyperAnchor || frame_name){
+				var xmldoc = parser.parseFromString("<PROPERTY/>","text/xml");
+				if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+				if(xmldoc){
+					if(xmldoc.documentElement){
+						if(frame_name){
+							var xmlnode = xmldoc.createElement("FRAME_NAME");
+							if(xmlnode){
+								xmlnode.appendChild(xmldoc.createTextNode(frame_name));
+								xmldoc.documentElement.appendChild(xmlnode);
+							}
+						}
+						if(hyperAnchor){
+							var xmlnode = xmldoc.createElement("HYPER_ANCHOR");
+							if(xmlnode){
+								xmlnode.appendChild(xmldoc.createTextNode(hyperAnchor));
+								xmldoc.documentElement.appendChild(xmlnode);
+							}
+						}
+					}
+					var s = new XMLSerializer();
+					rObj.oid_property = s.serializeToString(xmldoc);
+					s = undefined;
+				}
+			}
+			rtnNewObj.unshift(rObj);
+			parser = undefined;
+			for(r=0;r<rtnNewObj.length;r++){
+				var rObj = this.Database.newObject(this._oid);
+				for(var key in rtnNewObj[r]){
+					if(key == "oid") continue;
+					if(key == "con_doc") continue;
+					rObj[key] = rtnNewObj[r][key];
+				}
+				rObj.pfid_order = ++pfid_order;
+				this._oid = parseInt(rObj.oid)-1;
+				var rtn = this.Database.addObject(rObj,dbtype);
+				if(!rtn) rObj = undefined;
+				if(!rObj) continue;
+				try{
+					rtnContent = bitsMarker.xPathMarker(
+						rtnNewObj[r].con_doc,
+						{
+							start   : rObj.bgn_dom,
+							end     : rObj.end_dom,
+							context : rObj.oid_txt,
+							con_url : this.Common.getURLStringFromDocument(rtnNewObj[r].con_doc)
+						},
+						{
+							id     : rObj.oid,
+							dbtype : dbtype,
+							pfid   : rObj.pfid,
+							style  : style
+						}
+					);
+					if(!rtnContent){
+						var rtn = this.Database.removeObject(rObj,dbtype);
+					}
+				}catch(ex2){
+					bitsMarkingCollection._dump("bitsTreeProjectService._addSelectedText():"+ex2);
+					rtnContent = null;
+				}
+			}
+		}catch(e){
+			bitsMarkingCollection._dump("bitsTreeProjectService._addSelectedText():"+e);
+			rtnContent = null;
+		}
+		return rtnContent;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_getFindRange : function(){
+		var findRange = Components.classes["@mozilla.org/embedcomp/rangefind;1"].createInstance();
+		if(!findRange || !(findRange instanceof Components.interfaces.nsIFind)) return undefined;
+		findRange.caseSensitive = false;
+		findRange.findBackwards = false;
+		return findRange;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_isWordCharacter : function(ch){
+		if(ch == null ||  typeof ch != "string" || ch.length != 1) return false;
+		var code = ch.charCodeAt(0);
+		return code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 138 && code <= 142 || code >= 154 && code <= 159 || code >= 192 && code <= 255;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_isNodeInputNodeOrChildOf : function(node){
+		if(node.nodeName.toUpperCase() == "INPUT") return true;
+		if(node.parentNode != null) return this._isNodeInputNodeOrChildOf(node.parentNode);
+		return false;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	readDictionary : function(aEvent){
+		try{
+			var mcTreeHandler = null;
+			if(this.mcTreeHandler) mcTreeHandler = this.mcTreeHandler;
+			if(!mcTreeHandler) return;
+			var aRes = mcTreeHandler.resource;
+			if(!aRes) return;
+			var file = this.getReadFile();
+			if(file){
+				var text_content = null;
+				var r_xmldoc = null;
+				try{ var mimetype = this.Common.MIME.getTypeFromFile(file); }catch(e){ mimetype=null; }
+				if(mimetype == "text/plain"){
+					text_content = this.readFile(file);
+				}else if(mimetype == "text/xml"){
+					text_content = this.readFile(file);
+					var parser = new DOMParser();
+					r_xmldoc = parser.parseFromString(text_content, "text/xml");
+					parser = undefined;
+					if(r_xmldoc && r_xmldoc.documentElement.nodeName == "parsererror") r_xmldoc = undefined;
+					if(!r_xmldoc){
+						this.Common.alert("Read Error!!["+file.path+"]");
+						return;
+					}
+				}else{
+					this.Common.alert("Unknown MIME Type!");
+					return;
+				}
+				var fid = this.DataSource.getProperty(aRes, "id");
+				var fid_style = this.DataSource.getProperty(aRes, "style");
+				var dbtype = this.DataSource.getProperty(aRes, "dbtype");
+				var xmldoc = this._getDictionaryXML(fid,dbtype);
+				if(!xmldoc) xmldoc = this._createDictionaryXML();
+				if(!xmldoc) return;
+				var terms = xmldoc.documentElement.getElementsByTagName("TERMS")[0];
+				if(!terms){
+					terms = xmldoc.createElement("TERMS");
+					if(terms) xmldoc.documentElement.appendChild(terms);
+				}
+				var elems = terms.getElementsByTagName("TERM");
+				if(r_xmldoc){
+				}else if(text_content){
+					var dd = new Date;
+					dd.setTime(file.lastModifiedTime);
+					var y = dd.getFullYear();
+					var m = dd.getMonth() + 1; if(m < 10) m = "0" + m;
+					var d = dd.getDate();      if(d < 10) d = "0" + d;
+					var h = dd.getHours();     if(h < 10) h = "0" + h;
+					var i = dd.getMinutes();   if(i < 10) i = "0" + i;
+					var s = dd.getSeconds();   if(s < 10) s = "0" + s;
+					var date =  m.toString() + "/" + d.toString() + "/" + y.toString() + " " + h.toString() + ":" + i.toString() + ":" + s.toString();
+					var text_arr = text_content.replace(/\x0D\x0A|\x0D|\x0A/g,"\n").split("\n");
+					if(!this._progressWindow){
+						var x = screen.width;
+						var y = screen.height;
+						this._progressWindow = window.openDialog(
+							"chrome://markingcollection/content/progress_determined.xul",
+							"myProgress", "chrome,centerscreen,alwaysRaised,dependent=yes,left="+x+",top="+y, 
+							{
+								status   : this.STRING.getString("MSG_READING_DICTIONARY") + "...",
+								progress : 0,
+								callback : function(aEvent){ self._readDictionaryCancel(aRes,xmldoc);}
+							});
+					}
+					var self = this;
+					if(this._progressWindow && !this._progressWindow.closed) this._progressWindow.focus();
+					if(this._applytimer) clearTimeout(this._applytimer);
+					this._applytimer = setTimeout(function(){ self._readDictionaryLoadXMLDictionary(aRes,xmldoc,elems,text_arr,date); },0);
+					this.setWaitCursor(true);
+				}
+			}
+		}catch(e){
+			this._dump("bitsTreeProjectService.readDictionary():"+e);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_readDictionaryCancel : function(aRes,aXMLDoc){
+		var self = bitsTreeProjectService;
+		if(self._applytimer) clearTimeout(self._applytimer);
+		self._applytimer = null;
+		var fid = self.DataSource.getProperty(aRes, "id");
+		var dbtype = self.DataSource.getProperty(aRes, "dbtype");
+		self._putDictionaryXML(fid,dbtype,aXMLDoc);
+		if(self._progressWindow && !self._progressWindow.closed) self._progressWindow.close();
+		self._progressWindow = null;
+		this.setWaitCursor(false);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_readDictionaryLoadXMLDictionary : function(aRes,aXMLDoc,aTermElems,aTermArray,aDateString,aTermHash,aIndex){
+		var self = this;
+		if(aXMLDoc == undefined) return;
+		if(aTermHash == undefined) aTermHash = {};
+		if(aIndex == undefined) aIndex = 0;
+		var i = aIndex;
+		for(;i<aIndex+50 && i<aTermElems.length;i++){
+			if(!aTermElems[i].textContent) continue;
+			if(this._caseSensitive_exp.test(aTermElems[i].textContent)){
+				aTermHash[aTermElems[i].textContent] = i+1;
+			}else{
+				aTermHash[aTermElems[i].textContent.toLowerCase()] = i+1;
+			}
+		}
+		aIndex = i;
+		if(aIndex<aTermElems.length){
+			this._applytimer = setTimeout(function(){ self._readDictionaryLoadXMLDictionary(aRes,aXMLDoc,aTermElems,aTermArray,aDateString,aTermHash,aIndex); },0);
+			return;
+		}else{
+			if(this._progressWindow && !this._progressWindow.closed){
+				if(this._progressWindow.setStatus) this._progressWindow.setStatus(this.STRING.getString("MSG_READING_DICTIONARY") + "... [ 0% ][ "+ aTermArray.length + " ]");
+			}
+			this._applytimer = setTimeout(function(){ self._readDictionary(aTermArray,aTermHash,aDateString,aRes,aXMLDoc,aTermArray.length); },0);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_readDictionary : function(aTermArray,aTermHash,aDateString,aRes,aXMLDoc,aMaxTerm){
+		var terms = aXMLDoc.documentElement.getElementsByTagName("TERMS")[0];
+		if(!terms) return;
+		var i,j;
+		for(i=0,j=0;i<50 && j<250 && aTermArray.length>0;j++){
+			var term = aTermArray.shift();
+			term = term.replace(/^\s*/mg,"").replace(/\s*$/mg,"");
+			var key;
+			if(this._caseSensitive_exp.test(term)){
+				key = term;
+			}else{
+				key = term.toLowerCase();
+			}
+			if(aTermHash[key] != undefined) continue;
+			i++;
+			aTermHash[key] = i;
+			var elem = aXMLDoc.createElement("TERM");
+			if(!this._caseSensitive_exp.test(term)) term = term.toLowerCase();
+			var termElem = aXMLDoc.createTextNode(term);
+			if(!elem || !termElem) continue;
+			elem.setAttribute("date",aDateString);
+			terms.appendChild(elem);
+			elem.appendChild(termElem);
+		}
+		var self = this;
+		if(aTermArray.length == 0){
+			var fid = this.DataSource.getProperty(aRes, "id");
+			var dbtype = this.DataSource.getProperty(aRes, "dbtype");
+			this._putDictionaryXML(fid,dbtype,aXMLDoc);
+			if(this._progressWindow && !this._progressWindow.closed) this._progressWindow.close();
+			this._progressWindow = null;
+			setTimeout(function(){ self.Common.alert(self.STRING.getString("SUCCEEDED_READING_DICTIONARY")); },100);
+			this.setWaitCursor(false);
+			return;
+		}
+		this._applytimer = setTimeout(function(){ self._readDictionary(aTermArray,aTermHash,aDateString,aRes,aXMLDoc,aMaxTerm); },0);
+		if(this._progressWindow && !this._progressWindow.closed){
+			var p = (aMaxTerm-aTermArray.length)/aMaxTerm;
+			if(this._progressWindow.setProgress) this._progressWindow.setProgress( parseInt(p*100) );
+			if(this._progressWindow.setStatus) this._progressWindow.setStatus(this.STRING.getString("MSG_READING_DICTIONARY") + "... [ "+ parseInt(p*100) + "% ][ "+ aTermArray.length + " ]");
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	saveDictionary : function(aEvent){
+		var mcTreeHandler = null;
+		if(this.mcTreeHandler) mcTreeHandler = this.mcTreeHandler;
+		if(!mcTreeHandler) return;
+		var aRes = mcTreeHandler.resource;
+		if(!aRes) return;
+		var fid = this.DataSource.getProperty(aRes, "id");
+		var title = this.DataSource.getProperty(aRes, "title");
+		var dbtype = this.DataSource.getProperty(aRes, "dbtype");
+		var xmldoc = this._getDictionaryXML(fid,dbtype);
+		if(!xmldoc){
+			var title = this.DataSource.getProperty(aRes, "title");
+			if(this.Common.confirm("[ "+title+" ]\n"+this.STRING.getString("CONFIRM_DICTIONARY_UPDATE"))) xmldoc = this._makeDictionary(aRes);
+		}
+		if(!xmldoc) return;
+		var dataArray = null;
+		var terms = xmldoc.documentElement.getElementsByTagName("TERMS")[0];
+		if(terms){
+			var i;
+			var termhash = {};
+			var elems = terms.getElementsByTagName("TERM");
+			if(elems.length>0) dataArray = [];
+			for(i=0;i<elems.length;i++){
+				if(elems[i].hasAttribute("exception")) continue;
+				if(!elems[i].textContent) continue;
+				if(termhash[elems[i].textContent]) continue;
+				termhash[elems[i].textContent] = true;
+				dataArray.push(elems[i].textContent);
+			}
+		}
+		if(dataArray){
+			var file = this.getSaveFile(title);
+			if(file){
+				this.writeFile(file,dataArray.join("\n")+"\n");
+				this.Common.alert(this.STRING.getString("SUCCEEDED_DICTIONARY_SAVE"));
+			}
+			dataArray = undefined;
+		}else{
+			this.Common.alert(this.STRING.getString("ALERT_DICTIONARY_NO_TERMS"));
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	mngDictionary : function(aEvent){
+		var mcTreeHandler = null;
+		if(this.mcTreeHandler) mcTreeHandler = this.mcTreeHandler;
+		if(!mcTreeHandler) return;
+		var aRes = mcTreeHandler.resource;
+		if(!aRes) return;
+		var fid = this.DataSource.getProperty(aRes, "id");
+		var style = this.DataSource.getProperty(aRes, "style");
+		var title = this.DataSource.getProperty(aRes, "title");
+		var dbtype = this.DataSource.getProperty(aRes, "dbtype");
+		var xmldoc = this._getDictionaryXML(fid,dbtype);
+		if(!xmldoc && this.Common.confirm("[ "+title+" ]\n"+this.STRING.getString("CONFIRM_DICTIONARY_UPDATE"))) xmldoc = this._makeDictionary(aRes);
+		if(!xmldoc){
+			this.Common.alert(this.STRING.getString("ALERT_DICTIONARY_UPDATE"));
+			return;
+		}
+		var result = {
+			accept    : false,
+			fid       : fid,
+			fid_style : style,
+			fid_title : title,
+			dbtype    : dbtype,
+			xmldoc    : xmldoc,
+		};
+		window.openDialog("chrome://markingcollection/content/treeprojectDicMngDialog.xul", "", "chrome,centerscreen,modal", result);
+		if(result.accept){
+			this._putDictionaryXML(fid,dbtype,result.xmldoc);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getFolder : function(){
+		if(!this.mcTreeHandler) return undefined;
+		var curIdx = this.mcTreeHandler.TREE.currentIndex;
+		if(curIdx<0) return undefined;
+		if(!this.mcTreeHandler.TREE.view.isContainer(curIdx)) return undefined;
+		var aRes = this.mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+		var fid = this.DataSource.getProperty(aRes,"id");
+		var dbtype = this.DataSource.getProperty(aRes,"dbtype");
+		var folder;
+		if(fid != "0"){
+			var foldres = this.Database.getFolderFormID(fid,dbtype);
+			if(foldres) folder = foldres[0];
+		}else{
+			folder = {fid:fid,dbtype:dbtype,fid_title:this.DataSource.getProperty(aRes,"title"),fid_property:""};
+		}
+		return folder;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	displayIndex : function(aEvent,aXSLPath){
+	bitsMarkingCollection._dump("CALLED displayIndex():");
+		aEvent.stopPropagation();
+		var xmlContent = this.createXML(aXSLPath);
+		if(!xmlContent) return;
+		bitsTreeListService._fileid = this.Common.getTimeStamp();
+		var file = bitsTreeListService.getTreeListDir();
+		file.append(bitsTreeListService._fileid+".xml");
+		if(file.exists()) file.remove(false);
+		file.create(file.NORMAL_FILE_TYPE, 0666);
+		var ostream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
+		ostream.init(file, 2, 0x200, false);
+		this.Common.UNICODE.charset = "UTF-8";
+		xmlContent = this.Common.UNICODE.ConvertFromUnicode(xmlContent);
+		ostream.write(xmlContent, xmlContent.length);
+		ostream.close();
+		var cur_uri = this.Common.getURLStringFromDocument(this.gBrowser.contentDocument);
+		var basedir = bitsTreeListService.getBaseDir();
+		var res_uri = this.Common.convertFilePathToURL(basedir.path);
+		if(cur_uri.indexOf(res_uri)>=0) bitsTreeListService._doc = this.gBrowser.contentDocument;
+		var url = this.Common.convertFilePathToURL(file.path);
+		var loadFlag = false;
+		if(this.gBrowser.browsers.length == 1 && res_uri != "" && cur_uri != res_uri){
+			loadFlag = true;
+		}else if(cur_uri == res_uri){
+			loadFlag = false;
+		}else{
+			loadFlag = true;
+			for(var i=0;i<this.gBrowser.browsers.length;i++){
+				var doc = this.gBrowser.browsers[i].contentDocument;
+				var cur_uri = this.Common.getURLStringFromDocument(doc);
+				if(cur_uri.indexOf(res_uri)>=0){
+					loadFlag = false;
+					this.gBrowser.tabContainer.selectedIndex = i;
+					break;
+				}
+			}
+		}
+		this.Common.loadURL(url,loadFlag);
+		bitsTreeListService._openurl = url;
+		if(bitsTreeListService._openurl != ""){
+			var remove_dir = this.Common.convertURLToFile(this.Common.getBaseHref(bitsTreeListService._openurl));
+			window.top.bitsMarkingCollection._removefile.push(remove_dir);
+			if(this.mcTreeViewModeService) this.mcTreeViewModeService._openlist[url] = loadFlag;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	saveIndex : function(aEvent){
+	bitsMarkingCollection._dump("CALLED saveIndex():");
+		aEvent.stopPropagation();
+		var savedir = this.getSaveFolder();
+		if(!savedir) return;
+		var xmlContent =this.createXML();
+		if(!xmlContent) return;
+		if(!this._folder) return;
+		var file = savedir.clone();
+		file.append(this._folder.fid_title+".xml");
+		if(file.exists()){
+			var filecnt;
+			for(filecnt=1;;filecnt++){
+				file = savedir.clone();
+				file.append(this._folder.fid_title+"("+filecnt+")"+".xml");
+				if(!file.exists()) break;
+			}
+		}
+		file.create(file.NORMAL_FILE_TYPE, 0666);
+		var ostream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
+		ostream.init(file, 2, 0x200, false);
+		this.Common.UNICODE.charset = "UTF-8";
+		xmlContent = this.Common.UNICODE.ConvertFromUnicode(xmlContent);
+		ostream.write(xmlContent, xmlContent.length);
+		ostream.close();
+		var msg = this.STRING.getString("SUCCEEDED_INDEX") + "\n";
+		msg += file.path;
+		var prompts = this.Common.PROMPT;
+		var flags = prompts.BUTTON_TITLE_OK + prompts.BUTTON_POS_0_DEFAULT;
+		var button = prompts.confirmEx(window, this.STRING.getString("APP_TITLE"), msg, flags, "", "", "", null, {});
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createXML : function(aXSLPath){
+		this._folder = undefined;
+		var folder = this.getFolder();
+		if(!folder) return;
+		this._folder = folder;
+		this.createTITLE2OBJ(folder);
+		if(!this._title2obj) return "";
+		var aContent = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
+		var stylesheet;
+		if(aXSLPath && aXSLPath.match(/^file:/)){
+			stylesheet = this.Common.readFile(this.Common.convertURLToFile(aXSLPath));
+		}else if(aXSLPath && aXSLPath.match(/^chrome:\/\/markingcollection\/content\//)){
+			var xslURL = this.Common.convertURLToObject(aXSLPath);
+			stylesheet = bitsTreeListService.loadText(xslURL);
+		}else{
+			var xslURL = this.Common.convertURLToObject("chrome://markingcollection/content/treeindex_standard.xsl");
+			stylesheet = bitsTreeListService.loadText(xslURL);
+		}
+		if(stylesheet && stylesheet != ""){
+			var type = "xsl";
+			aContent += '<?xml-stylesheet type="text/'+type+'" href="#treeindex"?>\n';
+		}
+		aContent += '<!DOCTYPE WM_INDEX_LIST';
+		aContent += '[\n';
+		aContent += '  <!ATTLIST xsl:stylesheet id ID #REQUIRED>\n';
+		aContent += ']';
+		aContent += '>\n<WM_INDEX_LIST>\n';
+		if(stylesheet && stylesheet != "") aContent += stylesheet+'\n';
+		aContent += "</WM_INDEX_LIST>\n";
+		if(!this.createXMLDoc(aContent)) return "";
+		this._xmldoc.documentElement.setAttribute("title",folder.fid_title);
+		var url2icon = {};
+		var title_arr = [];
+		var title;
+		var tcnt;
+		var ocnt;
+		var kcnt;
+		for(title in this._title2obj){
+			title_arr.push(title);
+		}
+		title_arr.sort(function(a,b){
+			if(a.toUpperCase() == b.toUpperCase()) return 0;
+			if(a.toUpperCase() >  b.toUpperCase()) return 1;
+			if(a.toUpperCase() <  b.toUpperCase()) return -1;
+		});
+		try{
+			var indexsnode = this._xmldoc.createElement("INDEXS");
+			this._xmldoc.documentElement.appendChild(indexsnode);
+		}catch(e){}
+		for(tcnt=0;tcnt<title_arr.length;tcnt++){
+			title = title_arr[tcnt];
+			try{
+				indexsnode.appendChild(this._xmldoc.createTextNode("\n  "));
+			}catch(e){}
+			try{
+				var indexnode = this._xmldoc.createElement("INDEX");
+				indexsnode.appendChild(indexnode);
+			}catch(e){}
+			try{
+				indexnode.appendChild(this._xmldoc.createTextNode("\n    "));
+				var titlenode = this._xmldoc.createElement("TITLE");
+				titlenode.appendChild(this._xmldoc.createTextNode(title));
+				indexnode.appendChild(titlenode);
+			}catch(e){}
+			var urlhash = {};
+			for(ocnt=0;ocnt<this._title2obj[title].length;ocnt++){
+				try{
+					var obj = this._title2obj[title][ocnt];
+					var objkey;
+					if(obj && obj.oid_property){
+						try{
+							var parser = new DOMParser();
+							var xmldoc = parser.parseFromString(obj.oid_property, "text/xml");
+							parser = undefined;
+							if(this._xmldoc && this._xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+							if(xmldoc){
+								var objkeys = ["NOTE","HYPER_ANCHOR"];
+								for(kcnt=0;kcnt<objkeys.length;kcnt++){
+									objkey = objkeys[kcnt].toUpperCase();
+									var elem = xmldoc.getElementsByTagName(objkey)[0];
+									if(!elem) continue;
+									obj[objkey] = elem.textContent;
+								}
+							}
+						}catch(e){}
+					}
+					if(obj && obj.doc_url){
+						if(urlhash[obj.doc_url] == undefined) urlhash[obj.doc_url] = [];
+						urlhash[obj.doc_url].push(obj);
+					}
+				}catch(e){}
+			}
+			var urlarr = [];
+			var url;
+			for(url in urlhash){
+				urlarr.push(url);
+			}
+			if(urlarr.length>0){
+				try{
+					indexnode.appendChild(this._xmldoc.createTextNode("\n    "));
+					var urlsnode = this._xmldoc.createElement("URLS");
+					indexnode.appendChild(urlsnode);
+					urlarr.sort(function(a,b){
+						if(a.toUpperCase() == b.toUpperCase()) return 0;
+						if(a.toUpperCase() >  b.toUpperCase()) return 1;
+						if(a.toUpperCase() <  b.toUpperCase()) return -1;
+					});
+					for(ocnt=0;ocnt<urlarr.length;ocnt++){
+						url = urlarr[ocnt];
+						urlsnode.appendChild(this._xmldoc.createTextNode("\n      "));
+						var urlnode = this._xmldoc.createElement("URL");
+						urlsnode.appendChild(urlnode);
+						urlnode.appendChild(this._xmldoc.createTextNode("\n        "));
+						var docurlnode = this._xmldoc.createElement("DOCUMENT_URL");
+						docurlnode.appendChild(this._xmldoc.createTextNode(url));
+						urlnode.appendChild(docurlnode);
+						if(url2icon[url]){
+							urlnode.appendChild(this._xmldoc.createTextNode("\n        "));
+							var iconnode = this._xmldoc.createElement("FAVICON");
+							iconnode.appendChild(this._xmldoc.createTextNode(url2icon[url]));
+							urlnode.appendChild(iconnode);
+						}
+						urlnode.appendChild(this._xmldoc.createTextNode("\n        "));
+						var objsnode = this._xmldoc.createElement("OBJECTS");
+						urlnode.appendChild(objsnode);
+						for(kcnt=0;kcnt<urlhash[url].length;kcnt++){
+							var obj = urlhash[url][kcnt];
+							if(kcnt == 0){
+								urlnode.appendChild(this._xmldoc.createTextNode("\n        "));
+								var docurlnode = this._xmldoc.createElement("DOCUMENT_TITLE");
+								docurlnode.appendChild(this._xmldoc.createTextNode(obj.doc_title));
+								urlnode.appendChild(docurlnode);
+							}
+							objsnode.appendChild(this._xmldoc.createTextNode("\n          "));
+							var objnode = this._xmldoc.createElement("OBJECT");
+							objsnode.appendChild(objnode);
+							for(objkey in obj){
+								objnode.appendChild(this._xmldoc.createTextNode("\n            "));
+								var keynode = this._xmldoc.createElement(objkey.toUpperCase());
+								keynode.appendChild(this._xmldoc.createTextNode(obj[objkey]));
+								objnode.appendChild(keynode);
+							}
+							if(obj && obj.doc_url){
+								if(url2icon[obj.doc_url]){
+									objnode.appendChild(this._xmldoc.createTextNode("\n            "));
+									var iconnode = this._xmldoc.createElement("ICON");
+									iconnode.appendChild(this._xmldoc.createTextNode(url2icon[obj.doc_url]));
+									objnode.appendChild(iconnode);
+								}
+							}
+							objnode.appendChild(this._xmldoc.createTextNode("\n          "));
+						}
+						objsnode.appendChild(this._xmldoc.createTextNode("\n        "));
+						urlnode.appendChild(this._xmldoc.createTextNode("\n      "));
+					}
+					urlsnode.appendChild(this._xmldoc.createTextNode("\n    "));
+				}catch(e){}
+			}
+			try{
+				indexnode.appendChild(this._xmldoc.createTextNode("\n  "));
+			}catch(e){}
+		}
+		try{
+			indexsnode.appendChild(this._xmldoc.createTextNode("\n"));
+			this._xmldoc.documentElement.appendChild(this._xmldoc.createTextNode("\n"));
+		}catch(e){}
+		return this.xmlSerializer();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createTITLE2OBJ : function(aFolder){
+		this._title2obj = undefined;
+		var title2obj = {};
+		var pos = 0;
+		var key;
+		var object;
+		var fid2style = {};
+		var contResList = this._getAllObject(aFolder);
+		if(contResList.length>0){
+			var ocnt;
+			for(ocnt=0;ocnt<contResList.length;ocnt++){
+				if(!contResList[ocnt].bgn_dom) continue;
+				var title = contResList[ocnt].oid_title;
+				title = title.replace(/^\s+/mg,"").replace(/\s+$/mg,"");
+				var oid = contResList[ocnt].oid;
+				var dbtype = contResList[ocnt].dbtype;
+				var pfid = contResList[ocnt].pfid;
+				var objects = this.Database.getObjectWithProperty({oid:oid},dbtype);
+				if(!objects) continue;
+				object = objects[0];
+				if(title2obj[title] == undefined) title2obj[title] = [];
+				pos = title2obj[title].length;
+				title2obj[title][pos] = {};
+				for(key in object){
+					title2obj[title][pos][key] = object[key];
+				}
+				var i=0;
+				if(object.oid_type.match(/^image\/(.+)$/)){
+					var blob = this.Database.getObjectBLOB(object.oid,dbtype);
+					if(blob && blob.length>0 && blob[0].length>0){
+						var images = String.fromCharCode.apply(String, blob[0]);
+						var image_b64 = btoa(images); // base64 encoding
+						image_b64 = 'data:' + object.oid_type + ';base64,' + image_b64;
+						title2obj[title][pos].oid_img  = image_b64;
+						/* ã·ã¹ãã ã§ç®¡çããŠããã€ã¡ãŒãžã®å Žå */
+						var blobFile = this.Database.getObjectBLOBFile(object.oid,dbtype);
+						var blobUrl = this.Common.convertFilePathToURL(blobFile.path);
+						if(object.doc_url == blobUrl) title2obj[title][pos].doc_url = image_b64;
+						if(object.con_url == blobUrl) title2obj[title][pos].con_url = image_b64;
+					}
+				}
+				if(fid2style[pfid] == undefined){
+					var folders = this.Database.getFolderFormID(pfid,dbtype);
+					if(folders && folders.length>0) fid2style[pfid] = folders[0].fid_style.replace(/([:;\(,])\s+/mg,"$1");
+				}
+				if(fid2style[pfid] != undefined) title2obj[title][pos].fid_style = fid2style[pfid];
+			}
+		}
+		contResList = undefined;
+		this._title2obj = title2obj;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	readFile : function(aFile){
+		if(!aFile || !aFile.exists()) return undefined;
+		try {
+			var istream = Components.classes['@mozilla.org/network/file-input-stream;1'].createInstance(Components.interfaces.nsIFileInputStream);
+			istream.init(aFile, 1, 0, false);
+			var sstream = Components.classes['@mozilla.org/scriptableinputstream;1'].createInstance(Components.interfaces.nsIScriptableInputStream);
+			sstream.init(istream);
+			var content = sstream.read(sstream.available());
+			sstream.close();
+			istream.close();
+			content = this.Common.convertToUnicode(content,"UTF-8");
+			return content;
+		}catch(ex){
+			this._dump("bitsTreeProjectService ERROR: readFile():" + ex);
+			return undefined;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	writeFile : function(aFile, aContent){
+		try {
+			if(!aFile.parent.exists()) aFile.parent.create(aFile.DIRECTORY_TYPE, 0777);
+			if(aFile.exists()) aFile.remove(false);
+			aFile.create(aFile.NORMAL_FILE_TYPE, 0666);
+			var content = this.Common.convertFormUnicode(aContent,"UTF-8");
+			var ostream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
+			ostream.init(aFile, 2, 0x200, false);
+			ostream.write(content, content.length);
+			ostream.close();
+			return true;
+		}catch(ex){
+			this._dump("bitsTreeProjectService ERROR: Failed to write file: " + aFile.path + "["+ ex + "]");
+			return false;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createXMLDoc : function(aContent){
+		var parser = new DOMParser();
+		this._xmldoc = parser.parseFromString(aContent, "text/xml");
+		parser = undefined;
+		if(this._xmldoc && this._xmldoc.documentElement.nodeName == "parsererror"){
+			this._xmldoc = undefined;
+		}
+		return this._xmldoc;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	xmlSerializer : function(){
+		if(!this._xmldoc) return "";
+		var s = new XMLSerializer();
+		var aContent = s.serializeToString(this._xmldoc);
+		s = undefined;
+		return aContent;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	validateFileName : function(aFileName){
+		var re = /[\/]+/g;
+		if (navigator.appVersion.indexOf("Windows") != -1) {
+			re = /[\\\/\|]+/g;
+			aFileName = aFileName.replace(/[\"]+/g, "'");
+			aFileName = aFileName.replace(/[\*\:\?]+/g, " ");
+			aFileName = aFileName.replace(/[\<]+/g, "(");
+			aFileName = aFileName.replace(/[\>]+/g, ")");
+			aFileName = aFileName.replace(/[\"\?!~`]+/g, "");
+			aFileName = aFileName.replace(/[\*\&]+/g, "+");
+			aFileName = aFileName.replace(/[\\\/\|\:;]+/g, "-");
+			aFileName = aFileName.replace(/[\<]+/g, "(");
+			aFileName = aFileName.replace(/[\>]+/g, ")");
+			aFileName = aFileName.replace(/[\s]+/g, "_");
+			aFileName = aFileName.replace(/[%]+/g, "@");
+		}else if (navigator.appVersion.indexOf("Macintosh") != -1)
+			re = /[\:\/]+/g;
+		return aFileName.replace(re, "_");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getReadFileFromFolder : function (aFolder){
+		var result = [];
+		try{
+			var entries = aFolder.directoryEntries;
+			while(entries.hasMoreElements()){
+				var entry = entries.getNext();
+				entry.QueryInterface(Components.interfaces.nsIFile);
+				if(entry.isDirectory()){
+					result = result.concat(this.getReadFileFromFolder(entry));
+				}else{
+					try{ var mimetype = this.Common.MIME.getTypeFromFile(entry); }catch(e){ mimetype = undefined; }
+					if(!mimetype) continue;
+					if(mimetype != "text/plain" && mimetype != "text/html" && mimetype != "application/pdf") continue;
+					var arg = this.Common.convertFilePathToURL(entry.QueryInterface(Components.interfaces.nsILocalFile).path);
+					result.push(arg);
+				}
+			}
+		}catch(e){
+			this._dump("bitsTreeProjectService.getReadFileFromFolder():aFolder=["+aFolder+"]");
+			this._dump("bitsTreeProjectService.getReadFileFromFolder():"+e);
+		}
+		return result;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getReadFolder : function (aDefaultFolder){
+		var result = undefined;
+		try{
+			var picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
+			picker.init(window, "Selected Folder", picker.modeGetFolder);
+			if(aDefaultFolder) picker.displayDirectory = aDefaultFolder;
+			var showResult = picker.show();
+			if(showResult == picker.returnOK) result = this.getReadFileFromFolder(picker.file);
+		}catch(e){
+			result = undefined;
+			this._dump("bitsTreeProjectService.getReadFolder():"+e);
+		}
+		return result;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getReadFiles : function (){
+		var result = undefined;
+		try{
+			var picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
+			picker.init(window, "Selected Files", picker.modeOpenMultiple);
+			picker.appendFilter("HTML File or Text File or PDF File","*.htm; *.html; *.txt; *.pdf");
+			picker.appendFilters(picker.filterHTML | picker.filterText);
+			picker.appendFilter("PDF File","*.pdf");
+			picker.filterIndex = 0;
+			var showResult = picker.show();
+			if(showResult == picker.returnOK){
+				var files = picker.files;
+				result = [];
+				while (files.hasMoreElements()){
+					var arg = this.Common.convertFilePathToURL(files.getNext().QueryInterface(Components.interfaces.nsILocalFile).path);
+					result.push(arg);
+				}
+			}
+		}catch(e){
+			result = undefined;
+			this._dump("bitsTreeProjectService.getReadFiles():"+e);
+			if(e.message=="Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsIFilePicker.show]"){
+				if(this.Common.confirm(this.STRING.getString("CONFIRM_READING_DOCUMENTS_SELECT_OVER"))) result = this.getReadFolder((picker&&picker.displayDirectory?picker.displayDirectory:undefined));
+			}
+		}
+		return result;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getReadFile : function (){
+		var picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
+		var result = undefined;
+		try{
+			picker.init(window, "Selected File", picker.modeOpen);
+			picker.appendFilters(picker.filterText);
+			picker.filterIndex = 0;
+			var showResult = picker.show();
+			if(showResult == picker.returnOK || showResult == picker.returnReplace) result = picker.file;
+		}catch(e){
+			result = undefined;
+			this.Common.alert(e);
+		}
+		return result;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getSaveFile : function (aTitle){
+		var picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
+		var result = null;
+		try{
+			var title = "Selected Save File";
+			if(aTitle) title += " ["+aTitle+"]";
+			picker.init(window, title, picker.modeSave);
+			picker.defaultExtension = ".txt";
+			if(aTitle) picker.defaultString  = aTitle + picker.defaultExtension;
+			picker.appendFilters(picker.filterText);
+			var showResult = picker.show();
+			if(showResult == picker.returnOK){
+				result = picker.file;
+			}else if(showResult == picker.returnReplace){
+				if(picker.file.exists()) picker.file.remove(false);
+				result = picker.file;
+			}
+		}catch(e){
+			result = null;
+			this.Common.alert(e);
+		}
+		return result;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getSaveFolder : function (aTitle){
+		var picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
+		var result = null;
+		try{
+			var title = "Selected Save Folder";
+			if(aTitle) title += " ["+aTitle+"]";
+			picker.init(window, title, picker.modeGetFolder);
+			if(aTitle) picker.defaultString  = aTitle;
+			var showResult = picker.show();
+			if(showResult == picker.returnOK){
+				result = picker.file;
+			}else if(showResult == picker.returnReplace){
+				if(picker.file.exists()) picker.file.remove(false);
+				result = picker.file;
+			}
+		}catch(e){
+			result = null;
+			this.Common.alert(e);
+		}
+		return result;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getTemplateDir : function(){},
+
+/////////////////////////////////////////////////////////////////////
+	createMenu : function(aParentNode,aEntry){},
+
+/////////////////////////////////////////////////////////////////////
+	loadText : function(aURI){},
+
+/////////////////////////////////////////////////////////////////////
+	_getZipEntry : function(aZipEntry){
+		return escape(aZipEntry);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	addEntryDirectory : function(aZipWriter,aDir,aParentPath){
+		var LANG = this.Common.getLang();
+		var entries = aDir.directoryEntries;
+		while(entries.hasMoreElements()){
+			var pDir = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+			if(!pDir.isDirectory()) continue;
+			var entryName = (aParentPath?aParentPath+"/":"") + pDir.leafName;
+			aZipWriter.addEntryDirectory(this._getZipEntry(entryName), pDir.lastModifiedTime, false);
+			this.addEntryDirectory(aZipWriter, pDir, entryName);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	addEntryFile : function(aZipWriter,aDir,aParentPath){
+		var entries = aDir.directoryEntries;
+		while(entries.hasMoreElements()){
+			var pDir = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+			var entryName = (aParentPath?aParentPath+"/":"") + pDir.leafName;
+			if(pDir.isDirectory()){
+				this.addEntryFile(aZipWriter, pDir, entryName);
+			}else{
+				aZipWriter.addEntryFile(this._getZipEntry(entryName), Components.interfaces.nsIZipWriter.COMPRESSION_DEFAULT, pDir, false);
+			}
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	saveFile : function(aEvent){
+		try{
+			aEvent.preventDefault();
+			aEvent.stopPropagation();
+			this._savehtml.length = 0;
+			this._savehtml = [];
+			var contentWindow = null;
+			var mcTreeHandler = null;
+			if(bitsMarkingCollection._contentWindow) contentWindow = bitsMarkingCollection._contentWindow;
+			if(contentWindow && contentWindow.mcTreeHandler) mcTreeHandler = contentWindow.mcTreeHandler;
+			if(!mcTreeHandler) return;
+			var curIdx = mcTreeHandler.TREE.currentIndex;
+			if(curIdx<0) return;
+			var aRes = null;
+			if(!mcTreeHandler.TREE.view.isContainer(curIdx)) return;
+			aRes = mcTreeHandler.TREE.builderView.getResourceAtIndex(curIdx);
+			var fid = this.DataSource.getProperty(aRes,"id");
+			var dbtype = this.DataSource.getProperty(aRes,"dbtype");
+			if(fid != "0"){
+				var foldres = this.Database.getFolderFormID(fid,dbtype);
+				if(foldres) this._saveFile(foldres[0]);
+			}else{
+				this._saveFile({fid:fid,dbtype:dbtype,fid_title:this.DataSource.getProperty(aRes,"title"),fid_property:""});
+			}
+		}catch(ex){
+			this.Common.alert("bitsTreeProjectService.saveFile():"+ex);
+		}
+	},
+
+
+/////////////////////////////////////////////////////////////////////
+	_saveFile : function(aFolder){
+	bitsMarkingCollection._dump("CALLED _saveFile():");
+		try{
+			var saveFolder = this.getSaveFolder(aFolder.fid_title);
+			if(!saveFolder) return;
+			var tmpDir = window.top.bitsMarkingCollection.getTmpDir().clone();
+			tmpDir.append(this.STRING.getString("APP_TITLE"));
+			tmpDir.createUnique(tmpDir.DIRECTORY_TYPE, 0777);
+			tmpDir.append(this._getZipEntry(this.validateFileName(aFolder.fid_title)));
+			if(tmpDir.exists()) tmpDir.remove(true);
+			if(!tmpDir.exists()) tmpDir.create(tmpDir.DIRECTORY_TYPE, 0777);
+			var file = tmpDir.clone();
+			file.append(this._getZipEntry(this.validateFileName(aFolder.fid_title))+".xml");
+			var leafName = unescape(file.leafName);
+			var filename = this.Common.splitFileName(leafName)[0];
+			this.appDataSTRING = this.appDataAddSTRING;
+			var aContent = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
+			var aURL = this.Common.convertURLToObject("chrome://markingcollection/content/treeexport.xsl");
+			var stylesheet = bitsTreeListService.loadText(aURL);
+			if(stylesheet && stylesheet != ""){
+				var type = "xsl";
+				aContent += '<?xml-stylesheet type="text/'+type+'" href="#treeexport"?>\n';
+			}
+			aContent += '<!DOCTYPE LIST';
+			aContent += '[\n';
+			aContent += '  <!ATTLIST xsl:stylesheet id ID #REQUIRED>\n';
+			aContent += ']';
+			aContent += '>\n<LIST title="'+ this.xmlEncode(aFolder.fid_title) +'">\n';
+			if(stylesheet && stylesheet != "") aContent += stylesheet+'\n';
+			aContent += "</LIST>\n";
+			this.createXMLDoc(aContent);
+			bitsTreeProjectService.createID2OBJ(aFolder);
+			bitsTreeProjectService.createXML(aFolder,this.xmldoc.documentElement);
+			aContent = "";
+			if(this._savehtml.length>0){
+				var elem = this.xmldoc.createElement("BASENAME");
+				var elemT = this.xmldoc.createTextNode(filename);
+				if(elem && elemT){
+					elem.appendChild(elemT);
+					this.xmldoc.documentElement.appendChild(elem)
+				}
+			}
+			aContent = this.xmlSerializer();
+			this.Common.writeFile(file, aContent, "UTF-8");
+			var savePath = null;
+			if(this._savehtml.length>0){
+				savePath = file.parent.clone();
+				savePath.append(this.appDataSTRING);
+				if(savePath.exists()) savePath.remove(true);
+				savePath.create(savePath.DIRECTORY_TYPE, 0777);
+				var i;
+				for(i=0;i<this._savehtml.length;i++){
+					var htmlfile = this.Common.convertURLToFile(this._savehtml[i]);
+					if(!htmlfile.exists()) continue;
+					var htmlpath2 = htmlfile.parent.clone();
+					var htmlpath1 = htmlpath2.parent.clone();
+					var copypath1 = savePath.clone();
+					copypath1.append(htmlpath1.leafName);
+					if(!copypath1.exists()) copypath1.create(copypath1.DIRECTORY_TYPE, 0777);
+					var copyfile1 = copypath1.clone();
+					copyfile1.append(".info");
+					if(!copyfile1.exists()){
+						var htmlfile1 = htmlpath1.clone();
+						htmlfile1.append(".info");
+						if(htmlfile1.exists()) htmlfile1.copyTo(copypath1,htmlfile1.leafName);
+						htmlfile1 = undefined;
+					}
+					copyfile1 = undefined;
+					var copypath2 = copypath1.clone();
+					copypath2.append(htmlpath2.leafName);
+					if(copypath2.exists()) continue;
+					htmlpath2.copyTo(copypath1,htmlpath2.leafName);
+					var urlinfo = copypath2.clone();
+					urlinfo.append(".urlinfo");
+					if(urlinfo.exists()){
+						var content = this.Common.readFile(urlinfo);
+						if(content && content != ""){
+							var content_arr = content.split("\n");
+							var j,k;
+							for(j=0;j<content_arr.length;j++){
+								var url_arr = content_arr[j].split("\t");
+								for(k=0;k<url_arr.length;k++){
+									if(url_arr[k].match(this.appDataURLExp)) url_arr[k] = url_arr[k].replace(this.appDataURLExp, this.appDataSTRING);
+								}
+								content_arr[j] = url_arr.join("\t");
+							}
+							content = content_arr.join("\n");
+							this.Common.writeFile(urlinfo, content, "UTF-8");
+						}
+					}
+					urlinfo = undefined;
+					htmlfile = undefined;
+					htmlpath2 = undefined;
+					htmlpath2 = undefined;
+					copypath1 = undefined;
+					copypath2 = undefined;
+				}
+			}
+			try{
+				var nsIZipWriter = Components.interfaces.nsIZipWriter;
+				var zipWriter = Components.classes["@mozilla.org/zipwriter;1"].createInstance(nsIZipWriter);
+			}catch(e){}
+			var zipFile;
+			if(zipWriter){
+				var parent = tmpDir.parent.clone();
+				zipFile = saveFolder.clone();
+				zipFile.append(filename+".zip");
+				if(zipFile.exists()){
+					var filecnt;
+					for(filecnt=1;;filecnt++){
+						zipFile = saveFolder.clone();
+						zipFile.append(filename+"("+filecnt+")"+".zip");
+						if(!zipFile.exists()) break;
+					}
+				}
+				if(!zipFile.exists()) zipFile.create(zipFile.NORMAL_FILE_TYPE, 0664);
+				zipWriter.open(zipFile, 0x04 | 0x08 | 0x20);
+				this.addEntryDirectory(zipWriter, parent);
+				this.addEntryFile(zipWriter, parent);
+				zipWriter.close();
+				if(parent.exists()) parent.remove(true);
+			}else if(this.zipApp){
+				try{
+					var LANG = this.Common.getLang();
+					var args = [];
+					if(this.zipAppScript) args.push(this.Common.convertFormUnicode(this.zipAppScript.path,LANG));
+					if(navigator.platform == "Win32") args.push("//Nologo");
+					zipFile = saveFolder.clone();
+					zipFile.append(filename+".zip");
+					if(zipFile.exists()){
+						var filecnt;
+						for(filecnt=1;;filecnt++){
+							zipFile = saveFolder.clone();
+							zipFile.append(filename+"("+filecnt+")"+".zip");
+							if(!zipFile.exists()) break;
+						}
+					}
+					args.push(this.Common.convertFormUnicode(zipFile.path,LANG));
+					if(navigator.platform == "Win32"){
+						args.push(this.Common.convertFormUnicode(tmpDir.path,LANG));
+					}else{
+						args.push("-r");
+						args.push(this.Common.convertFormUnicode(tmpDir.path,LANG));
+					}
+					var proc = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
+					proc.init(this.zipApp);
+					proc.run(true, args, args.length);
+					if(tmpDir.parent.exists()) tmpDir.parent.remove(true);
+				}catch(ex2){
+					this.Common.alert("bitsTreeProjectService._saveFile():"+ex2);
+					if(zipFile && zipFile.exists()) zipFile.remove(true);
+					var parent = tmpDir.parent.clone();
+					zipFile = saveFolder.clone();
+					zipFile.append(tmpDir.leafName);
+					if(zipFile.exists()){
+						var filecnt;
+						for(filecnt=1;;filecnt++){
+							zipFile = saveFolder.clone();
+							zipFile.append(tmpDir.leafName+"("+filecnt+")");
+							if(!zipFile.exists()) break;
+						}
+					}
+					tmpDir.moveTo(saveFolder,zipFile.leafName);
+					if(parent.exists()) parent.remove(true);
+				}
+			}else{
+				var parent = tmpDir.parent.clone();
+				zipFile = saveFolder.clone();
+				zipFile.append(unescape(tmpDir.leafName));
+				if(zipFile.exists()){
+					var filecnt;
+					for(filecnt=1;;filecnt++){
+						zipFile = saveFolder.clone();
+						zipFile.append(unescape(tmpDir.leafName)+"("+filecnt+")");
+						if(!zipFile.exists()) break;
+					}
+				}
+				tmpDir.moveTo(saveFolder,zipFile.leafName);
+				if(parent.exists()) parent.remove(true);
+			}
+			var msg = this.STRING.getString("SUCCEEDED_EXPORT") + "\n";
+			if(zipFile && zipFile.exists()){
+				msg += zipFile.path;
+			}else{
+				msg += saveFolder.path;
+			}
+			var prompts = this.Common.PROMPT;
+			var flags = prompts.BUTTON_TITLE_OK + prompts.BUTTON_POS_0_DEFAULT;
+			var button = prompts.confirmEx(window, bitsTreeProjectService.STRING.getString("APP_TITLE"), msg, flags, "", "", "", null, {});
+		}catch(ex){
+			this.Common.alert("bitsTreeProjectService._saveFile():"+ex);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getBaseDir : function(){
+		var dir  = window.top.bitsMarkingCollection.getExtensionDir().clone();
+		dir.append("treelist");
+		if(!dir.exists()) dir.create(dir.DIRECTORY_TYPE, 0700);
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	getTreeListDir : function(){
+		var dir  = this.getBaseDir().clone();
+		dir.append(this._fileid);
+		if(!dir.exists()) dir.create(dir.DIRECTORY_TYPE, 0700);
+		return dir;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	xmlEncode : function(aString){
+		return aString.replace(/&/mg,"&amp;").replace(/</mg,"&lt;").replace(/>/mg,"&gt;").replace(/\"/mg,"&quot;");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_getAllObject : function(aFolder){
+		var rtn = [];
+		var Foldres = this.Database.getFolderFormPID(aFolder.fid,aFolder.dbtype,false);
+		if(Foldres){
+			var aocnt;
+			for(aocnt=0;aocnt<Foldres.length;aocnt++){
+				rtn = rtn.concat(this._getAllObject(Foldres[aocnt]));
+			}
+		}
+		var Objects = this.Database.getObjectFormPID(aFolder.fid,aFolder.dbtype,false);
+		if(Objects) rtn = rtn.concat(Objects);
+		return rtn;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_getAllFolder : function(aFolder){
+		var rtn = [];
+		var Foldres = this.Database.getFolderFormPID(aFolder.fid,aFolder.dbtype,false);
+		if(Foldres){
+			var aocnt;
+			for(aocnt=0;aocnt<Foldres.length;aocnt++){
+				rtn.push(Foldres[aocnt]);
+				rtn = rtn.concat(this._getAllFolder(Foldres[aocnt]));
+			}
+		}
+		return rtn;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_getAllChild : function(aFolder){
+		var rtn = [];
+		var Foldres = this.Database.getFolderFormPID(aFolder.fid,aFolder.dbtype,false);
+		if(Foldres){
+			Foldres.sort(function(a,b){ return a.pfid_order - b.pfid_order; });
+			rtn = rtn.concat(Foldres);
+		}
+		var Objects = this.Database.getObjectFormPID(aFolder.fid,aFolder.dbtype,false);
+		if(Objects){
+			Objects.sort(function(a,b){ return a.pfid_order - b.pfid_order; });
+			rtn = rtn.concat(Objects);
+		}
+		return rtn;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createID2OBJ : function(aFolder){
+		var title2obj = {};
+		var fid2style = {};
+		var contResList = this._getAllObject(aFolder);
+		if(contResList.length>0){
+			var ocnt;
+			for(ocnt=0;ocnt<contResList.length;ocnt++){
+				var oid = contResList[ocnt].oid;
+				if(title2obj[title] != undefined) continue;
+				var dbtype = contResList[ocnt].dbtype;
+				var objects = this.Database.getObjectWithProperty({oid:oid},dbtype);
+				if(!objects) continue;
+				title2obj[title] = {};
+				var i=0;
+				if(objects[i].oid_type.match(/^image\/(.+)$/)){
+					var blob = this.Database.getObjectBLOB(objects[i].oid,dbtype);
+					if(blob && blob.length>0 && blob[0].length>0){
+						var images = String.fromCharCode.apply(String, blob[0]);
+						var image_b64 = btoa(images); // base64 encoding
+						image_b64 = 'data:' + objects[i].oid_type + ';base64,' + image_b64;
+						title2obj[title].img  = image_b64;
+						/* ã·ã¹ãã ã§ç®¡çããŠããã€ã¡ãŒãžã®å Žå */
+						var blobFile = this.Database.getObjectBLOBFile(objects[i].oid,dbtype);
+						var blobUrl = this.Common.convertFilePathToURL(blobFile.path);
+						if(objects[i].doc_url == blobUrl) objects[i].doc_url = image_b64;
+						if(objects[i].con_url == blobUrl) objects[i].con_url = image_b64;
+					}
+				}
+				if(window.top.bitsScrapPartySaveService){
+					if(objects[i].doc_url.match(this.appDataURLExp)){
+						this._savehtml.push(objects[i].doc_url);
+						objects[i].doc_url = objects[i].doc_url.replace(this.appDataURLExp, this.appDataSTRING);
+					}
+					if(objects[i].con_url.match(this.appDataURLExp)){
+						objects[i].con_url = objects[i].con_url.replace(this.appDataURLExp, this.appDataSTRING);
+					}
+				}
+				title2obj[title].text = objects[i].oid_txt;
+				title2obj[title].uri = objects[i].doc_url;
+				title2obj[title].uri_title = objects[i].doc_title;
+				title2obj[title].con_url = objects[i].con_url;
+				title2obj[title].type = objects[i].oid_type;
+				title2obj[title].st = objects[i].bgn_dom;
+				title2obj[title].en = objects[i].end_dom;
+				if(objects[i].oid_property && objects[i].oid_property != "") title2obj[title].property = objects[i].oid_property;
+				title2obj[title].dbtype = objects[i].dbtype;
+				title2obj[title].date = objects[i].oid_date;
+				title2obj[title].mode = objects[i].oid_mode;
+				if(fid2style[objects[i].pfid] == undefined){
+					var folders = this.Database.getFolderFormID(objects[i].pfid,dbtype);
+					if(folders && folders.length>0) fid2style[objects[i].pfid] = folders[0].fid_style.replace(/([:;\(,])\s+/mg,"$1");
+				}
+				if(fid2style[objects[i].pfid] != undefined) title2obj[title].style = fid2style[objects[i].pfid];
+			}
+		}
+		contResList = undefined;
+		this.title2obj = title2obj;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createTextNode : function(aString,aParentNode){
+		if(aString && aString != ""){
+			var elemS = this.xmldoc.createTextNode(aString);
+			if(elemS) aParentNode.appendChild(elemS);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createElement : function(aTagName,aString,aParentNode,aTab){
+		if(!aTagName || !aParentNode) return;
+		if(aTab && aTab != ""){
+			var elemT = this.xmldoc.createTextNode(aTab);
+			if(elemT) aParentNode.appendChild(elemT);
+		}
+		var elem = this.xmldoc.createElement(aTagName);
+		if(elem){
+			if(aString){
+				if(aString != ""){
+					var elemS = this.xmldoc.createTextNode(aString);
+					if(elemS) elem.appendChild(elemS);
+				}
+			}else{
+				var elemR = this.xmldoc.createTextNode("\n");
+				if(elemR) elem.appendChild(elemR);
+			}
+			aParentNode.appendChild(elem)
+			var elemR = this.xmldoc.createTextNode("\n");
+			if(elemR) aParentNode.appendChild(elemR);
+		}
+		return elem;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	createXMLObject : function(aObject,aParentNode,aDepth){
+		var title2obj = this.title2obj;
+		if(aDepth == undefined) aDepth = 0;
+		var aTab = "";
+		for(var i=0;i<=aDepth;i++){
+			aTab += "  ";
+		}
+		var oid = aObject.oid;
+		var alink = "";
+		var structure = "";
+		var hyperAnchor = "";
+		var disp_image_size_x = "";
+		var disp_image_size_y = "";
+		var disp_image_size = "";
+		var out_property = [];
+		var xmldoc;
+		var structureElem;
+		if(aObject.oid_property && aObject.oid_property != ""){
+			try{
+				var parser = new DOMParser();
+				xmldoc = parser.parseFromString(aObject.oid_property, "text/xml");
+				parser = undefined;
+			}catch(ex){}
+			if(xmldoc && xmldoc.documentElement.nodeName == "parsererror"){
+				title2obj[title].property = "";
+				xmldoc = undefined;
+			}
+			if(xmldoc){
+				var xmlnode = xmldoc.getElementsByTagName("LINK")[0];
+				if(xmlnode) alink = xmlnode.textContent;
+				/* STRUCTUREå
+ã®ããŒã¿ã¯xhtmlã§æ ŒçŽãããŠããçºããã®ãŸãŸåºåãã */
+				xmlnode = xmldoc.getElementsByTagName("STRUCTURE")[0];
+				if(xmlnode && xmlnode.hasChildNodes()){
+					structureElem = xmlnode.cloneNode(true);
+				}
+				xmlnode = xmldoc.getElementsByTagName("IMG_LIST_DISP_SIZE")[0];
+				if(xmlnode){
+					disp_image_size = xmlnode.textContent;
+					if(disp_image_size.match(/^(\d+),(\d+)$/mg)){
+						disp_image_size_x = RegExp.$1;
+						disp_image_size_y = RegExp.$2;
+					}
+				}
+				xmlnode = xmldoc.getElementsByTagName("NOTE")[0];
+				if(xmlnode){
+					out_property["NOTE"] = {};
+					out_property["NOTE"].type  = "text";
+					out_property["NOTE"].value = xmlnode.textContent;
+				}
+				xmlnode = xmldoc.getElementsByTagName("HYPER_ANCHOR")[0];
+				if(xmlnode) hyperAnchor = xmlnode.textContent;
+			}
+		}
+		var oNode = this.createElement("OBJECT",undefined,aParentNode,aTab+"  ");
+		this.createElement("OID_TITLE",aObject.oid_title,oNode,aTab+"    ");
+		if(out_property["NOTE"]) this.createElement("OID_NOTE",out_property["NOTE"].value,oNode,aTab+"    ");
+		var tag;
+		for(tag in out_property){
+			if(typeof out_property[tag] == "function") continue;
+			this.createElement("OID_PROPERTY_"+ tag,out_property[tag].value,oNode,aTab+"    ");
+		}
+		if(disp_image_size_x && disp_image_size_y){
+			this.createElement("OID_IMG_DISP_WIDTH",disp_image_size_x,oNode,aTab+"    ");
+			this.createElement("OID_IMG_DISP_HEIGHT",disp_image_size_x,oNode,aTab+"    ");
+		}
+		if(title2obj[title].img) this.createElement("OID_IMG",title2obj[title].img,oNode,aTab+"    ");
+		if(title2obj[title].uri) this.createElement("DOC_URL",title2obj[title].uri,oNode,aTab+"    ");
+		if(title2obj[title].uri_title) this.createElement("DOC_TITLE",title2obj[title].uri_title,oNode,aTab+"    ");
+		if(title2obj[title].st) this.createElement("BGN_DOM",title2obj[title].st,oNode,aTab+"    ");
+		if(title2obj[title].en) this.createElement("END_DOM",title2obj[title].en,oNode,aTab+"    ");
+		if(title2obj[title].con_url) this.createElement("CON_URL",title2obj[title].con_url,oNode,aTab+"    ");
+		if(title2obj[title].type) this.createElement("OID_TYPE",title2obj[title].type,oNode,aTab+"    ");
+		if(title2obj[title].date) this.createElement("OID_DATE",title2obj[title].date,oNode,aTab+"    ");
+		if(title2obj[title].mode) this.createElement("OID_MODE",title2obj[title].mode,oNode,aTab+"    ");
+		if(alink != "") this.createElement("OID_LINK",alink,oNode,aTab+"    ");
+		if(structureElem){
+			var elem = this.createElement("OID_STRUCTURE","",oNode,aTab+"    ");
+			var i;
+			for(i=0;i<structureElem.childNodes.length;i++){
+				elem.appendChild(structureElem.childNodes[i].cloneNode(true));
+			}
+		}
+		if(title2obj[title].text) this.createElement("OID_TXT",title2obj[title].text,oNode,aTab+"    ");
+		if(title2obj[title].property) this.createElement("OID_PROPERTY",title2obj[title].property,oNode,aTab+"    ");
+		if(title2obj[title].dbtype) this.createElement("OID_DBTYPE",title2obj[title].dbtype,oNode,aTab+"    ");
+		if(hyperAnchor != ""){
+			this.createElement("HYPER_ANCHOR",hyperAnchor,oNode,aTab+"    ");
+		}else if(title2obj[title].con_url && title2obj[title].st){
+			var text = title2obj[title].con_url + '#hyperanchor:' + this.xmlEncode(title2obj[title].st);
+			if(title2obj[title].en) text += "&" + this.xmlEncode(title2obj[title].en);
+			if(title2obj[title].style) text += "&" + this.xmlEncode(title2obj[title].style);
+			this.createElement("HYPER_ANCHOR",text,oNode,aTab+"    ");
+		}
+		this.createTextNode(aTab+"  ",oNode);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeprojectDialogOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeprojectDialogOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeprojectDialogOverlay.xul	(revision 5703)
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE prefwindow SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+	id="treeprojectDialogOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://mozapps/content/preferences/fontbuilder.js"/>
+	<script type="application/x-javascript">
+	<![CDATA[
+		var defLanguageGroup;
+		var defFontFamily;
+		var defFontSize;
+		var defBackgroundColor;
+
+		function STRING() { return document.getElementById("bitsSelectDisplayTextPlainStringbundle"); }
+
+		function _treeprojectDialogOverlayInit(aEvent){
+			var textplain_display = nsPreferences.copyUnicharPref("wiredmarker.textplain.display","usually");
+			switch(textplain_display){
+				case "confirm":
+					document.getElementById("bitsSelectDisplayTextPlainUsually").removeAttribute("selected");
+					document.getElementById("bitsSelectDisplayTextPlainConfirm").setAttribute("selected","true");
+					document.getElementById("bitsSelectDisplayTextPlainWrapping").removeAttribute("selected");
+					break;
+				case "wrapping":
+					document.getElementById("bitsSelectDisplayTextPlainUsually").removeAttribute("selected");
+					document.getElementById("bitsSelectDisplayTextPlainConfirm").removeAttribute("selected");
+					document.getElementById("bitsSelectDisplayTextPlainWrapping").setAttribute("selected","true");
+					break;
+				default:
+					document.getElementById("bitsSelectDisplayTextPlainUsually").setAttribute("selected","true");
+					document.getElementById("bitsSelectDisplayTextPlainConfirm").removeAttribute("selected");
+					document.getElementById("bitsSelectDisplayTextPlainWrapping").removeAttribute("selected");
+					break;
+			}
+
+			_rebuildFonts();
+			_rebuildColor();
+		}
+
+		function _treeprojectDialogOverlayDone(aEvent){
+		}
+
+		function _SelectTextPlainCommand(aEvent){
+			nsPreferences.setUnicharPref("wiredmarker.textplain.display", aEvent.target.value);
+		}
+
+		function _commandTextPlainFontFamily(aEvent){
+			const prefKey = "wiredmarker.textplain.font.name";
+			if(aEvent.target.value == defFontFamily){
+				var branch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
+				try{branch.clearUserPref(prefKey);}catch(e){}
+			}else{
+				nsPreferences.setUnicharPref(prefKey, aEvent.target.value);
+			}
+		}
+
+		function _changeTextPlainFontSize(aEvent){
+			const prefKey = "wiredmarker.textplain.font.size";
+			if(aEvent.target.value == defFontSize){
+				var branch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
+				try{branch.clearUserPref(prefKey);}catch(e){}
+			}else{
+				if(aEvent.target.value>72) aEvent.target.value=72;
+				if(aEvent.target.value<9) aEvent.target.value=9;
+				nsPreferences.setIntPref(prefKey, aEvent.target.value);
+			}
+		}
+
+		function _changeTextPlainBackgroundColor(aEvent){
+			const prefKey = "wiredmarker.textplain.background_color";
+			if(aEvent.target.color == defBackgroundColor){
+				var branch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
+				try{branch.clearUserPref(prefKey);}catch(e){}
+			}else{
+				nsPreferences.setUnicharPref(prefKey, aEvent.target.color);
+			}
+		}
+
+		function _rebuildColor(){
+			if(!defBackgroundColor) defBackgroundColor = nsPreferences.copyUnicharPref("browser.display.background_color");
+			var backgroundColor = nsPreferences.copyUnicharPref("wiredmarker.textplain.background_color",defBackgroundColor);
+			document.getElementById("bitsSelectDisplayTextPlainAttrBackgroundColor").color = backgroundColor;
+		}
+
+		function _rebuildFonts(){
+			const kFontNameFmtMonospace = "font.name.monospace.%LANG%";
+			const kFontSizeFmtMonospace = "font.size.fixed.%LANG%";
+
+			defLanguageGroup = STRING().getString("font.language.group");
+
+			if(!defFontFamily) defFontFamily = nsPreferences.copyUnicharPref(kFontNameFmtMonospace.replace(/%LANG%/, defLanguageGroup));
+			var fontFamily = nsPreferences.copyUnicharPref("wiredmarker.textplain.font.name",defFontFamily);
+
+			if(!defFontSize) defFontSize = nsPreferences.getIntPref(kFontSizeFmtMonospace.replace(/%LANG%/, defLanguageGroup));
+			var fontSize = nsPreferences.getIntPref("wiredmarker.textplain.font.size",defFontSize);
+
+			var element = document.getElementById("bitsSelectDisplayTextPlainAttrFontFamily");
+			if(element){
+				FontBuilder.buildFontList(defLanguageGroup, "monospace", element);
+				element.value = fontFamily;
+			}
+			var elementSize = document.getElementById("bitsSelectDisplayTextPlainAttrFontSize");
+			if(elementSize){
+				elementSize.value = fontSize;
+			}
+		}
+
+		function _dump2(aString){
+			var dumpString = new String(aString);
+			var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
+			aConsoleService.logStringMessage(dumpString);
+			window.dump(aString+"\n");
+		}
+
+		window.addEventListener("load", _treeprojectDialogOverlayInit, false);
+		window.addEventListener("unload", _treeprojectDialogOverlayDone, false);
+	]]>
+	</script>
+	<stringbundleset id="mcSettingStringbundleset">
+		<stringbundle id="bitsSelectDisplayTextPlainStringbundle" src="chrome://global/locale/intl.properties" />
+	</stringbundleset>
+	<tabbox id="mcSettingTabbox">
+		<tabpanels id="mcSettingTabPanels">
+			<tabbox id="mcMenuTabbox">
+				<tabpanels id="mcMenuTabPanels">
+					<tabpanel id="mcMenuTabPanel" orient="vertical" flex="1">
+						<hbox>
+							<groupbox id="bitsSelectDisplayTextPlain" insertafter="mcMenuTabPanelRow3">
+								<caption label="&markingcollection.textplain;" style="background-color:#fff;"/>
+								<radiogroup id="" oncommand="_SelectTextPlainCommand(event)">
+									<radio id="bitsSelectDisplayTextPlainUsually"  value="usually"  label="&markingcollection.textplain.usually;"/>
+									<radio id="bitsSelectDisplayTextPlainConfirm"  value="confirm"  label="&markingcollection.textplain.confirm;"/>
+									<radio id="bitsSelectDisplayTextPlainWrapping" value="wrapping" label="&markingcollection.textplain.wrapping;"/>
+								</radiogroup>
+								<groupbox id="bitsSelectDisplayTextPlainAttr" insertafter="" orient="horizontal" align="center">
+									<caption label="&markingcollection.textplain.attr;" style="background-color:#fff;"/>
+									<hbox>
+										<grid>
+											<columns>
+												<column pack="end"/>
+												<column pack="start" flex="1"/>
+											</columns>
+											<rows>
+												<row align="center">
+													<hbox align="center"  pack="end">
+														<label value="&markingcollection.textplain.font-family;:" control="bitsSelectDisplayTextPlainAttrFontFamily"/>
+													</hbox>
+													<menulist id="bitsSelectDisplayTextPlainAttrFontFamily" oncommand="_commandTextPlainFontFamily(event)"/>
+												</row>
+												<row align="center">
+													<hbox align="center"  pack="end">
+														<label value="&markingcollection.textplain.font-size;:" control="bitsSelectDisplayTextPlainAttrFontSize"/>
+													</hbox>
+													<hbox align="center">
+														<textbox id="bitsSelectDisplayTextPlainAttrFontSize" maxlength="2" min="9" max="72" size="1" type="number" wraparound="false" onchange="_changeTextPlainFontSize(event)"/>
+														<label value="&markingcollection.textplain.background-color;:" control="bitsSelectDisplayTextPlainAttrBackgroundColor"/>
+														<colorpicker id="bitsSelectDisplayTextPlainAttrBackgroundColor" type="button" onchange="_changeTextPlainBackgroundColor(event)"/>
+													</hbox>
+												</row>
+											</rows>
+										</grid>
+									</hbox>
+								</groupbox>
+							</groupbox>
+						</hbox>
+					</tabpanel>
+				</tabpanels>
+			</tabbox>
+		</tabpanels>
+	</tabbox>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeprojectDicMngDialog.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeprojectDicMngDialog.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeprojectDicMngDialog.js	(revision 5703)
@@ -0,0 +1,537 @@
+var bitsTreeProjectDicMngService = {
+
+	_treeid  : "mcDicMngTree",
+	_checkid : "treecheckbox",
+	_termid  : "treeterm",
+	_dateid  : "treedate",
+	_deleteid : "treedelete",
+	_dataArray : null,
+	_dataArrayOrg : null,
+	_resource : null,
+	_xmldoc : null,
+	_keyword : null,
+
+	get DataSource() { return window.opener.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.opener.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.opener.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.opener.top.bitsObjectMng.Database;   },
+	get XML()        { return window.opener.top.bitsObjectMng.XML;        },
+	get gBrowser()   { return window.opener.top.bitsObjectMng.getBrowser();},
+
+	get DIALOG() { return document.getElementById("mcDicMngDialog"); },
+	get TREE() { return document.getElementById(this._treeid); },
+	get VSB()  { return document.getElementById("mcDicMngSearchButton");},
+	get VSM()  { return document.getElementById("mcDicMngSearchTextbox");},
+	get VSC_CASE(){ return document.getElementById("mcDicMngSearchCaseSensitiveCheckbox");},
+	get DEL()  { return document.getElementById("mcDicMngItemDel");},
+	get DECK() { return document.getElementById("mcDicMngDeck");},
+	get DECK0(){ return document.getElementById("mcDicMngDeck0");},
+	get DECK1(){ return document.getElementById("mcDicMngDeck1");},
+	get TOOLBAR(){ return document.getElementById("mcDicMngToolbar");},
+	get TERM() { return document.getElementById("mcDicTermTextbox");},
+	get OKBTN() { return document.getElementById("mcDicMngOKButton");},
+
+	get TREE_EXCEPTION() { return document.getElementById(this._checkid); },
+	get TREE_DELETE() { return document.getElementById(this._deleteid); },
+
+	init : function(aEvent){
+		if(window.arguments[0]) this._xmldoc = window.arguments[0].xmldoc;
+		if(!this._xmldoc) return;
+		var title = window.arguments[0].fid_title;
+		var fid = window.arguments[0].fid;
+		var dbtype = window.arguments[0].dbtype;
+		document.title = title;
+		this.DIALOG.setAttribute("wait-cursor","true");
+		var self = this;
+		setTimeout(function(){
+			/* TERMSãšã¬ã¡ã³ãååŸ */
+			var terms;
+			var elems = self._xmldoc.documentElement.getElementsByTagName("TERMS");
+			if(elems && elems.length > 0){
+				terms = elems[0];
+			}else{
+				terms = self._xmldoc.createElement("TERMS");
+				if(terms) self._xmldoc.documentElement.appendChild(terms);
+			}
+			if(terms){
+				var i;
+				var termhash = {};
+				var elems = terms.getElementsByTagName("TERM");
+				if(elems.length>0) self._dataArrayOrg = [];
+				for(i=0;i<elems.length;i++){
+					if(!elems[i].textContent) continue;
+					self._dataArrayOrg.push(elems[i]);
+				}
+			}
+			self.rebuild();
+			self.DIALOG.removeAttribute("wait-cursor");
+			self.OKBTN.focus();
+		},100);
+	},
+
+	accept : function(aEvent){
+		if(window.arguments[0]) window.arguments[0].accept = true;
+		return true;
+	},
+
+	cancel : function(aEvent){
+		if(window.arguments[0]) window.arguments[0].accept = false;
+		return true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+// TREE è¡šç€ºå¶åŸ¡é¢é£
+/////////////////////////////////////////////////////////////////////
+	get rowCount(){
+		return (this._dataArray?this._dataArray.length:0);
+	},
+	getCellText : function(row,column){
+		if(column.id == this._checkid){
+			return this._dataArray[row].hasAttribute("exception");
+		}else if(column.id == this._termid){
+			return this._dataArray[row].textContent;
+		}else if(column.id == this._dateid){
+			var date = this._dataArray[row].getAttribute("date");
+			if(date && date.match(/^(\d{2})\/(\d{2})\/(\d{4})\s+(\d{2}):(\d{2}):(\d{2})$/)) date = RegExp.$3 + "/" + RegExp.$1 + "/" + RegExp.$2 + " " + RegExp.$4 + ":" + RegExp.$5 + ":" + RegExp.$6;
+			return date;
+		}else{
+		}
+		return null;
+	},
+	getCellValue : function(row,column){
+		if(column.id == this._checkid){
+			return this._dataArray[row].hasAttribute("exception");
+		}else if(column.id == this._deleteid){
+			return this._dataArray[row].hasAttribute("delete");
+		}
+		return true;
+	},
+	setCellValue : function(row,column,value){
+		if(column.id == this._checkid){
+			if(value=="true"){
+				this._dataArray[row].setAttribute("exception","true");
+			}else{
+				this._dataArray[row].removeAttribute("exception");
+			}
+		}else if(column.id == this._deleteid){
+			if(value=="true"){
+				this._dataArray[row].setAttribute("delete","true");
+			}else{
+				this._dataArray[row].removeAttribute("delete");
+			}
+		}
+		var box = this.TREE.boxObject;
+		if(box) box.invalidateRow(row);
+		return;
+	},
+	setTree: function(treebox){ this.treebox = treebox; },
+	isContainer: function(row){ return false; },
+	isSeparator: function(row){ return false; },
+	isSorted: function(){ return true; },
+	getLevel: function(row){ return 0; },
+	getImageSrc: function(row,column){
+		var icon;
+		return icon;
+	},
+	getRowProperties: function(row,prop){
+		if(this._dataArray[row].hasAttribute("delete")){
+			var aserv=Components.classes["@mozilla.org/atom-service;1"].getService(Components.interfaces.nsIAtomService);
+			prop.AppendElement(aserv.getAtom("delete"));
+		}else if(this._dataArray[row].hasAttribute("exception")){
+			var aserv=Components.classes["@mozilla.org/atom-service;1"].getService(Components.interfaces.nsIAtomService);
+			prop.AppendElement(aserv.getAtom("exception"));
+		}
+	},
+	getCellProperties: function(row, column, prop) {},
+	getColumnProperties: function(column, element, prop) {},
+	cycleHeader : function(col){},
+	setCellText : function(row,column,text){
+		text = text.replace(/^\s*/mg,"").replace(/\s*$/mg,"");
+		var caseSensitive_exp = new RegExp("[A-Z]{2,}","");
+		if(!caseSensitive_exp.test(text)) text = text.toLowerCase();
+		if(column.id == this._termid){
+			this._dataArray[row].textContent = text;
+			this._dataArray[row].setAttribute("date",this.Common.getFormatDate());
+		}
+	},
+  getParentIndex: function(idx) { return -1; },
+	isEditable : function(row,column){
+		if(
+			column.id == this._checkid ||
+			column.id == this._termid  ||
+			column.id == this._deleteid
+		){
+			return true;
+		}else{
+			return false;
+		}
+	},
+	isSelectable : function(row,column){
+		return true;
+	},
+
+	canDrop : function(index, orient){
+		bitsTreeProjectDicMngService._dump("canDrop():["+index+"]["+orient+"]");
+		return true;
+	},
+	onDrop : function(row, orient){
+		bitsTreeProjectDicMngService._dump("onDrop()");
+	},
+	drop : function(row, orient){
+		bitsTreeProjectDicMngService._dump("drop()");
+	},
+	getSelectIndex : function(){
+		var indexlist = [];
+		var i,c;
+		var rangeCount = this.TREE.view.selection.getRangeCount();
+		for(i=0;i<rangeCount;i++){
+			var start = {};
+			var end = {};
+			this.TREE.view.selection.getRangeAt(i, start, end);
+			for(c=start.value;c<=end.value;c++){
+				indexlist.push(c);
+			}
+		}
+		return indexlist;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	refresh : function(){
+		var index = this.TREE.currentIndex;
+		var box = this.TREE.boxObject;
+		box.QueryInterface(Components.interfaces.nsITreeBoxObject);
+		var fvRow = box.getFirstVisibleRow();
+		this.rebuild();
+		box.scrollToRow(fvRow);
+		this.TREE.currentIndex = index;
+	},
+
+	rebuild : function(){
+		if(!this.TREE) return;
+		try{this._dataArray = this._dataArrayOrg.concat([]);}catch(e){ this._dataArray = null; }
+		if(this._dataArray){
+			if(this.VSB.checked && this.VSM.value != ""){
+				var flag = "i";
+				if(this.VSC_CASE.checked) flag = "";
+				var regexp = new RegExp(this.VSM.value,flag);
+				this._dataArray = this._dataArray.filter(
+					function(element, index, array) {
+						return regexp.test(element.textContent);
+					}
+				);
+			}
+			if(this.TREE_EXCEPTION.hidden){
+				this._dataArray = this._dataArray.filter(
+					function(element, index, array) {
+						return !element.hasAttribute("exception");
+					}
+				);
+			}
+			if(this.TREE_DELETE && this.TREE_DELETE.hidden){
+				this._dataArray = this._dataArray.filter(
+					function(element, index, array) {
+						return !element.hasAttribute("delete");
+					}
+				);
+			}
+			if(document.getElementById(this._checkid).hasAttribute("sortDirection")){
+				var direction = document.getElementById(this._checkid).getAttribute("sortDirection");
+				this._dataArray.sort(
+					function(a,b){
+						if(direction == "ascending"){
+							if( a.hasAttribute("exception") && !b.hasAttribute("exception")) return -1;
+							if(!a.hasAttribute("exception") &&  b.hasAttribute("exception")) return 1;
+						}else if(direction == "descending"){
+							if( a.hasAttribute("exception") && !b.hasAttribute("exception")) return 1;
+							if(!a.hasAttribute("exception") &&  b.hasAttribute("exception")) return -1;
+						}
+						return 0;
+					}
+				);
+			}else if(document.getElementById(this._termid).hasAttribute("sortDirection")){
+				var direction = document.getElementById(this._termid).getAttribute("sortDirection");
+				this._dataArray.sort(
+					function(a,b){
+						var a_term = a.textContent.toLowerCase();
+						var b_term = b.textContent.toLowerCase();
+						if(direction == "ascending"){
+							if(a_term < b_term) return -1;
+							if(a_term > b_term) return 1;
+						}else if(direction == "descending"){
+							if(a_term < b_term) return 1;
+							if(a_term > b_term) return -1;
+						}
+						return 0;
+					}
+				);
+			}else if(document.getElementById(this._dateid).hasAttribute("sortDirection")){
+				var direction = document.getElementById(this._dateid).getAttribute("sortDirection");
+				this._dataArray.sort(
+					function(a,b){
+						var a_term = a.getAttribute("date");
+						var b_term = b.getAttribute("date");
+						if(direction == "ascending"){
+							if(a_term < b_term) return -1;
+							if(a_term > b_term) return 1;
+						}else if(direction == "descending"){
+							if(a_term < b_term) return 1;
+							if(a_term > b_term) return -1;
+						}
+						return 0;
+					}
+				);
+			}else if(this.TREE_DELETE && this.TREE_DELETE.hasAttribute("sortDirection")){
+				var direction = this.TREE_DELETE.getAttribute("sortDirection");
+				this._dataArray.sort(
+					function(a,b){
+						if(direction == "ascending"){
+							if( a.hasAttribute("delete") && !b.hasAttribute("delete")) return -1;
+							if(!a.hasAttribute("delete") &&  b.hasAttribute("delete")) return 1;
+						}else if(direction == "descending"){
+							if( a.hasAttribute("delete") && !b.hasAttribute("delete")) return 1;
+							if(!a.hasAttribute("delete") &&  b.hasAttribute("delete")) return -1;
+						}
+						return 0;
+					}
+				);
+			}else{
+				this._dataArray.sort(
+					function(a,b){
+						var a_term = a.textContent.toLowerCase();
+						var b_term = b.textContent.toLowerCase();
+						if(a_term > b_term){
+							return 1;
+						}else if(a_term < b_term){
+							return -1;
+						}
+						return 0;
+					}
+				);
+			}
+		}
+		this.TREE.view = this;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onclick : function(aEvent){
+		if(aEvent.button != 0) return;
+		if(aEvent.altKey || aEvent.shiftKey || aEvent.ctrlKey) return;
+		if(aEvent.target.id && aEvent.target.id.match(/^tree/)){
+			if(aEvent.target.id != this._checkid)  document.getElementById(this._checkid).removeAttribute("sortDirection");
+			if(aEvent.target.id != this._termid)   document.getElementById(this._termid).removeAttribute("sortDirection");
+			if(aEvent.target.id != this._dateid)   document.getElementById(this._dateid).removeAttribute("sortDirection");
+			if(aEvent.target.id != this._deleteid) this.TREE_DELETE.removeAttribute("sortDirection");
+			if(!aEvent.target.hasAttribute("sortDirection")){
+				aEvent.target.setAttribute("sortDirection","ascending");
+			}else if(aEvent.target.getAttribute("sortDirection") == "ascending"){
+				aEvent.target.setAttribute("sortDirection","descending");
+			}else{
+				aEvent.target.removeAttribute("sortDirection");
+			}
+			this.DIALOG.setAttribute("wait-cursor","true");
+			var self = this;
+			setTimeout(function(){
+				self.rebuild();
+				self.DIALOG.removeAttribute("wait-cursor");
+			},100);
+			return;
+		}
+		var self = this;
+		var exception_hidden = self.TREE_EXCEPTION.hidden;
+		var delete_hidden = (self.TREE_DELETE ? self.TREE_DELETE.hidden : true);
+		setTimeout(function(){
+			if((self.TREE_DELETE ? self.TREE_DELETE.hidden : true) == delete_hidden && self.TREE_EXCEPTION.hidden == exception_hidden) return;
+			self.DIALOG.setAttribute("wait-cursor","true");
+			setTimeout(function(){
+				self.rebuild();
+				self.DIALOG.removeAttribute("wait-cursor");
+			},100);
+		},0);
+		try {
+			var row = {};
+			var col = {};
+			var childElt = {};
+			this.TREE.treeBoxObject.getCellAt(aEvent.clientX, aEvent.clientY, row, col, childElt);
+			if(row.value == undefined || col.value == undefined) return;
+		} catch(e){
+			bitsTreeProjectDicMngService._dump("bitsTreeProjectDicMngService.onclick():["+e+"]");
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onSelectTree : function(aEvent){
+		if(this.DEL.hasAttribute("disabled")) this.DEL.removeAttribute("disabled");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onTreeKeyPress : function(aEvent){
+		switch ( aEvent.keyCode ){
+			case aEvent.DOM_VK_RETURN :
+			case aEvent.DOM_VK_ESCAPE :
+				if(this.TREE.editingRow>=0){
+					aEvent.preventDefault();
+					aEvent.stopPropagation();
+				}
+				break;
+			case aEvent.DOM_VK_F2 :
+				if(this.TREE.currentIndex<0) return;
+				this.TREE.startEditing(this.TREE.currentIndex,this.TREE.columns.getNamedColumn(this._termid));
+				break;
+			default:
+				break;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onTreeKeyDown : function(aEvent){
+		switch ( aEvent.keyCode ){
+			case aEvent.DOM_VK_A :
+				if(aEvent.ctrlKey){
+					this.TREE.view.selection.selectAll();
+					aEvent.preventDefault();
+					aEvent.stopPropagation();
+				}
+				break;
+			default:
+				break;
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onItemAddCommand : function(aEvent){
+		this.DECK.selectedIndex = 1;
+		this.TOOLBAR.hidden = true;
+		this.TREE.hidden = true;
+		this.TERM.focus();
+		window.sizeToContent();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onItemAddOK : function(aEvent){
+		var self = this;
+//		var result = this.Common.prompt("Input new Term");
+		var result = {
+			input : this.TERM.value
+		};
+		if(result && result.input){
+			var terms;
+			var elems = this._xmldoc.documentElement.getElementsByTagName("TERMS");
+			if(elems && elems.length > 0){
+				terms = elems[0];
+			}else{
+				terms = this._xmldoc.createElement("TERMS");
+				if(terms) this._xmldoc.documentElement.appendChild(terms);
+			}
+			if(terms){
+				result.input = result.input.replace(/^\s*/mg,"").replace(/\s*$/mg,"");
+				var caseSensitive_exp = new RegExp("[A-Z]{2,}","");
+				if(!caseSensitive_exp.test(result.input)) result.input = result.input.toLowerCase();
+				var term = this._xmldoc.createElement("TERM");
+				var text = this._xmldoc.createTextNode(result.input);
+				if(term && text){
+					term.setAttribute("date",this.Common.getFormatDate());
+					term.appendChild(text);
+					terms.appendChild(term);
+					if(!this._dataArrayOrg) this._dataArrayOrg = [];
+					this._dataArrayOrg.push(term);
+					this.DIALOG.setAttribute("wait-cursor","true");
+					setTimeout(function(){
+							self.rebuild();
+							self.DIALOG.removeAttribute("wait-cursor");
+						},100);
+				}
+			}
+		}
+		this.onItemAddCancel(aEvent);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onItemAddCancel : function(aEvent){
+		this.DECK.selectedIndex = 0;
+		this.TOOLBAR.hidden = false;
+		this.TREE.hidden = false;
+		window.sizeToContent();
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onItemDelCommand : function(aEvent){
+		var indexlist = this.getSelectIndex();
+		if(!indexlist || indexlist.length == 0) return;
+		indexlist.sort(function(a,b){ return (parseInt(a)-parseInt(b));});
+		var box = this.TREE.boxObject;
+		var i;
+		for(i=indexlist.length-1;i>=0;i--){
+			var elem = this._dataArray[indexlist[i]];
+			if(elem) elem.setAttribute("exception","true")
+			if(box) box.invalidateRow(indexlist[i]);
+		}
+		if(!this.TREE_EXCEPTION.hidden) return;
+		var self = this;
+		self.DIALOG.setAttribute("wait-cursor","true");
+		setTimeout(function(){
+			self.rebuild();
+			self.DIALOG.removeAttribute("wait-cursor");
+		},100);
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onSearchButtonCommand : function(aEvent){
+		var self = this;
+		var checked = this.VSB.hasAttribute("checked");
+		if(checked){
+			this.VSM.removeAttribute("disabled");
+			this.VSC_CASE.removeAttribute("disabled");
+			if(!this.VSM.value){
+				setTimeout(function(){
+						self.VSM.focus();
+					},0);
+			}else{
+				this._keyword = this.VSM.value;
+				this.DIALOG.setAttribute("wait-cursor","true");
+				setTimeout(function(){
+						self.VSM.focus();
+						self.rebuild();
+						self.DIALOG.removeAttribute("wait-cursor");
+					},100);
+			}
+		}else{
+			this.VSM.blur();
+			this.VSM.setAttribute("disabled","true");
+			this.VSC_CASE.setAttribute("disabled","true");
+			if(!this._keyword) return;
+			this._keyword = null;
+			this.DIALOG.setAttribute("wait-cursor","true");
+			setTimeout(function(){
+					self.rebuild();
+					self.DIALOG.removeAttribute("wait-cursor");
+				},100);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	onSearchKeyPress : function(aEvent){
+		var self = this;
+		switch ( aEvent.keyCode ){
+			case aEvent.DOM_VK_RETURN :
+				this._keyword = this.VSM.value;
+				this.DIALOG.setAttribute("wait-cursor","true");
+				setTimeout(function(){
+						self.rebuild();
+						self.DIALOG.removeAttribute("wait-cursor");
+					},100);
+				aEvent.preventDefault();
+				aEvent.stopPropagation();
+				break;
+			default:
+				break;
+		}
+	},
+/////////////////////////////////////////////////////////////////////
+	onSearchInput : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.opener.top.bitsMarkingCollection._dump(aString);
+	},
+};
+
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeprojectDicMngDialog.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeprojectDicMngDialog.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeprojectDicMngDialog.xul	(revision 5703)
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/property.css" type="text/css" ?>
+<?xml-stylesheet href="chrome://markingcollection/skin/treeprojectDicMngDialog.css" type="text/css" ?>
+<!DOCTYPE dialog SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<dialog
+	id="mcDicMngDialog"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	buttons=","
+	onload="bitsTreeProjectDicMngService.init(event);"
+	ondialogaccept="bitsTreeProjectDicMngService.accept(event);"
+	ondialogcancel="bitsTreeProjectDicMngService.cancel(event);">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://markingcollection/content/treeprojectDicMngDialog.js" />
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _mcDicMngDialogDialogOK(aEvent){
+			document.getElementById("mcDicMngDialog").acceptDialog();
+		}
+		function _mcDicMngDialogDialogCancel(aEvent){
+			document.getElementById("mcDicMngDialog").cancelDialog();
+		}
+	]]>
+	</script>
+	<stringbundleset id="mcStringBundles">
+		<stringbundle id="mcDicMngString" src="chrome://markingcollection/locale/markingcollection.properties" />
+	</stringbundleset>
+	<deck id="mcDicMngDeck" selectedIndex="0">
+		<vbox id="mcDicMngDeck0" flex="1">
+			<toolbox id="mcDicMngToolbox">
+				<toolbar id="mcDicMngToolbar">
+					<toolbarbutton
+						id="mcDicMngItemAdd"
+						label="&markingcollection.project.dictionary.item.add;..."
+						image="chrome://markingcollection/skin/menu_create.png"
+						oncommand="bitsTreeProjectDicMngService.onItemAddCommand(event)"/>
+					<toolbarbutton
+						id="mcDicMngItemDel"
+						label="&markingcollection.project.dictionary.item.del;"
+						image="chrome://markingcollection/skin/menu_remove.png"
+						disabled="true"
+						oncommand="bitsTreeProjectDicMngService.onItemDelCommand(event)"/>
+					<spacer flex="1"/>
+					<toolbarbutton
+						id="mcDicMngSearchButton"
+						class="search-go-button"
+						tooltiptext="&markingcollection.project.dictionary.item.search;"
+						type="checkbox"
+						autoCheck="true"
+						oncommand="bitsTreeProjectDicMngService.onSearchButtonCommand(event)"/>
+					<textbox
+						id="mcDicMngSearchTextbox"
+						editable="true"
+						flex="1"
+						disabled="true"
+						emptytext="keyword"
+						placeholder="keyword"
+						style="font-size:0.9em;-moz-appearance: none !important;border: none;"
+						oninput="bitsTreeProjectDicMngService.onSearchInput(event)"
+						onkeypress="bitsTreeProjectDicMngService.onSearchKeyPress(event)"/>
+					<checkbox
+						id="mcDicMngSearchCaseSensitiveCheckbox"
+						label="case-sensitive"
+						disabled="true"
+						oncommand="bitsTreeProjectDicMngService.onSearchButtonCommand(event)"/>
+				</toolbar>
+			</toolbox>
+			<tree
+				id="mcDicMngTree"
+				flex="1"
+				seltype="multiple"
+				hidecolumnpicker="false"
+				class="plain"
+				editable="true"
+				enableColumnDrag="true"
+				rows="20"
+				onclick="bitsTreeProjectDicMngService.onclick(event)"
+				onselect="bitsTreeProjectDicMngService.onSelectTree(event)"
+				onkeypress="bitsTreeProjectDicMngService.onTreeKeyPress(event);"
+				onkeydown="bitsTreeProjectDicMngService.onTreeKeyDown(event);"
+			>
+				<treecols>
+					<treecol id="treecheckbox" type="checkbox" label="Exception" editable="true" persist="hidden,width"/>
+					<splitter class="tree-splitter"/>
+					<treecol id="treeterm" flex="2" label="Term" persist="hidden,width"/>
+					<splitter class="tree-splitter"/>
+					<treecol id="treedate" flex="1" label="Date" persist="hidden,width"/>
+				</treecols>
+				<treechildren class="gridlines"/>
+			</tree>
+			<bbox pack="end">
+				<button label="OK" oncommand="_mcDicMngDialogDialogOK(event);" id="mcDicMngOKButton"/>
+				<button label="Cancel" oncommand="_mcDicMngDialogDialogCancel(event);"/>
+			</bbox>
+		</vbox>
+		<vbox id="mcDicMngDeck1" flex="1">
+			<vbox flex="1">
+				<label value="Input new Term"/>
+				<textbox id="mcDicTermTextbox" value="" flex="1"/>
+			</vbox>
+			<bbox pack="center">
+				<button label="OK" oncommand="bitsTreeProjectDicMngService.onItemAddOK(event);"/>
+				<button label="Cancel" oncommand="bitsTreeProjectDicMngService.onItemAddCancel(event);"/>
+			</bbox>
+		</vbox>
+	</deck>
+</dialog>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeprojectDicPropOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeprojectDicPropOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeprojectDicPropOverlay.xul	(revision 5703)
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://browser/skin/searchbar.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/content/places/places.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://markingcollection/skin/sidebar.css" type="text/css"?>
+<?xml-stylesheet href="chrome://markingcollection/skin/overlay.css" type="text/css"?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+	id="treeprojectDicPropOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _treeprojectDicPropOverlayInit(aEvent){
+			var elem = document.getElementById("mcPropTagTextbox");
+			if(elem){
+				var parser = new DOMParser();
+				var xmldoc;
+				if(mcPropService.property != "") xmldoc = parser.parseFromString(mcPropService.property, "text/xml");
+				parser = undefined;
+				if(xmldoc){
+					var tag_elem = xmldoc.getElementsByTagName("DICTIONARY_TAG")[0];
+					if(tag_elem && tag_elem.textContent != ""){
+						var textContent = tag_elem.textContent.replace(/^\s*/g,"").replace(/\s*$/g,"");
+						if(textContent != "") elem.value = textContent;
+					}
+				}
+			}else{
+				window.setTimeout(_treeprojectDicPropOverlayInit,500);
+			}
+		}
+		function _treeprojectDicPropOverlayDone(aEvent){
+			var elem = document.getElementById("mcPropTagTextbox");
+			if(!elem) return;
+
+			var parser = new DOMParser();
+			var xmldoc;
+			if(mcPropService.property != "") xmldoc = parser.parseFromString(mcPropService.property, "text/xml");
+			if(!xmldoc) xmldoc = parser.parseFromString("<PROPERTY/>", "text/xml");
+			parser = undefined;
+			var tag_elem = xmldoc.getElementsByTagName("DICTIONARY_TAG")[0];
+
+			var tag = elem.value.replace(/[\r\n]/mg, " ");
+			tag = tag.replace(/\t/mg,"        ");
+			tag = tag.replace(/[\cA\cB\cC\cD\cE\cF\cG\cH\cI\cJ\cK\cL\cM\cN\cO\cP\cQ\cR\cS\cT\cU\cV\cW\cX\cY\cZ\c[\c\\\c]\c^\c_]/mg," ");
+			tag = tag.replace(/[\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f]/mg," ");
+			tag = tag.replace(/[\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f]/mg," ");
+			tag = tag.replace(/[\x7f]/mg," ");
+			tag = tag.replace(/^\s*/g,"").replace(/\s*$/g,"");
+
+			if(tag != ""){
+				if(!tag_elem || tag_elem.textContent != tag){
+					if(!tag_elem){
+						tag_elem = xmldoc.createElement("DICTIONARY_TAG");
+						xmldoc.documentElement.appendChild(tag_elem);
+					}
+					while(tag_elem.hasChildNodes()){ tag_elem.removeChild(tag_elem.lastChild); }
+					tag_elem.appendChild(xmldoc.createTextNode(tag));
+				}
+			}else if(tag_elem){
+				tag_elem.parentNode.removeChild(tag_elem);
+			}
+
+			var s = new XMLSerializer();
+			mcPropService.property = s.serializeToString(xmldoc);
+			s = undefined;
+
+			var dbitem = {};
+			dbitem.fid = mcPropService.id;
+			dbitem.fid_property = mcPropService.property;
+
+			var changed = mcPropService.Database.updateFolder(dbitem,mcPropService.dbtype);
+		}
+//		window.addEventListener("load", _treeprojectDicPropOverlayInit, false);
+		window.addEventListener("dialogaccept", _treeprojectDicPropOverlayDone, false);
+		window.setTimeout(_treeprojectDicPropOverlayInit,0);
+	]]>
+	</script>
+	<tabbox id="mcPropTabbox">
+		<tabpanels id="mcPropTabpanels">
+			<tabpanel id="mcPropGeneralTabpanel">
+				<groupbox id="mcPropTagGroup" flex="1">
+					<caption label="&markingcollection.prop.tag;" />
+					<textbox
+						id="mcPropTagTextbox"
+						flex="1"
+						emptytext="&markingcollection.prop.tag.emptytext;"
+						placeholder="&markingcollection.prop.tag.emptytext;"
+						newlines="replacewithspaces"
+						onfocus="this.select()"
+						onchange=""/>
+				</groupbox>
+			</tabpanel>
+		</tabpanels>
+	</tabbox>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeprojectSidebarOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeprojectSidebarOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeprojectSidebarOverlay.xul	(revision 5703)
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://browser/skin/searchbar.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/content/places/places.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://markingcollection/skin/sidebar.css" type="text/css"?>
+<?xml-stylesheet href="chrome://markingcollection/skin/overlay.css" type="text/css"?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+	id="treeprojectOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _treeprojectMainInit(aEvent){
+			window.top.bitsTreeProjectService.load(aEvent);
+		}
+		function _treeprojectMainDone(aEvent){
+			window.top.bitsTreeProjectService.unload(aEvent);
+		}
+		window.addEventListener("load", _treeprojectMainInit, false);
+		window.addEventListener("unload", _treeprojectMainDone, false);
+	]]>
+	</script>
+	<popupset id="mcPopupSet">
+		<menupopup id="mcPopup">
+			<menu id="mcPopupProjectIndexMenu" class="menu-iconic" label="&markingcollection.project.index.menu.caption;" image="chrome://markingcollection/skin/index_list.png" insertafter="mcPopupViewMenu">
+				<menupopup id="mcPopupProjectIndexMenupopup">
+					<menu
+						class="menu-iconic"
+						label="&markingcollection.project.index.menu.display;"
+						image="chrome://markingcollection/skin/index_list.png">
+						<menupopup>
+							<menuitem
+								id="mcPopupProjectIndexOutputMenuitem"
+								class="menuitem-iconic"
+								label="&markingcollection.project.index.menu.display.normal;..."
+								image="chrome://markingcollection/skin/stylesheet.png"
+								oncommand="window.top.bitsTreeProjectService.displayIndex(event,'chrome://markingcollection/content/treeindex_standard.xsl');"/>
+							<menuitem
+								id="mcPopupProjectIndexOutputMenuitem"
+								class="menuitem-iconic"
+								label="&markingcollection.project.index.menu.display.url;..."
+								image="chrome://markingcollection/skin/stylesheet.png"
+								oncommand="window.top.bitsTreeProjectService.displayIndex(event,'chrome://markingcollection/content/treeindex_url.xsl');"/>
+						</menupopup>
+					</menu>
+					<menuitem
+						id="mcPopupCreateProjectContents1"
+						class="menuitem-iconic"
+						label="&markingcollection.project.index.menu.save;..."
+						image="chrome://markingcollection/skin/index_save.png"
+						oncommand="window.top.bitsTreeProjectService.saveIndex(event);"/>
+				</menupopup>
+			</menu>
+			<menu
+				id="mcPopupProjectMainMenu"
+				class="menu-iconic"
+				label="&markingcollection.menu.project;"
+				image="chrome://markingcollection/skin/project.png"
+				insertbefore="mcPopupOpen"
+				hidden="true">
+				<menupopup id="mcPopupProjectMainMenupopup">
+					<menuitem
+						label="&markingcollection.open;"
+						oncommand="alert('cmd_project_make_dictionary')" />
+					<menuitem
+						id="bitsTreeProjectPopupOpenNewTab"
+						label="&markingcollection.open.newtab;"/>
+					<menuseparator observes="bitsTreeProjectPopupOpen"/>
+					<menuitem
+						id="bitsTreeProjectPopupRemove"
+						class="menuitem-iconic"
+						label="&markingcollection.remove;"
+						image="chrome://markingcollection/skin/menu_remove.png"/>
+					<menuseparator observes="bitsTreeProjectPopupRemove"/>
+					<menuitem
+						id="bitsTreeProjectPopupProperty"
+						class="menuitem-iconic"
+						label="&markingcollection.property;"
+						image="chrome://markingcollection/skin/menu_property.png"/>
+				</menupopup>
+			</menu>
+			<menuseparator observes="mcPopupProjectMainMenu" insertbefore="mcPopupOpen"/>
+			<menuseparator
+				observes="mcPopupProjectDocumentsMenu"
+				insertbefore="mcPopupImportTagMenuSeparator"/>
+			<menu
+				id="mcPopupProjectDocumentsMenu"
+				class="menu-iconic"
+				label="&markingcollection.menu.documents;"
+				image="chrome://markingcollection/skin/documents.png"
+				insertbefore="mcPopupImportTagMenuSeparator">
+				<menupopup id="mcPopupProjectDocumentsMenupopup">
+					<menuitem
+						label="&markingcollection.project.documents.select.folder;..."
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/toolbar_folder.png"
+						oncommand="window.top.bitsTreeProjectService.readDocumentFromFolder(event);" />
+					<menuitem
+						label="&markingcollection.project.documents.select.file;..."
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/documents.png"
+						oncommand="window.top.bitsTreeProjectService.readDocumentFromFile(event);" />
+				</menupopup>
+			</menu>
+			<menuseparator
+				observes="mcPopupProjectDictionaryMenu"
+				insertbefore="mcPopupImportTagMenuSeparator"/>
+			<menu
+				id="mcPopupProjectDictionaryMenu"
+				class="menu-iconic"
+				label="&markingcollection.menu.dictionary;"
+				image="chrome://markingcollection/skin/dictionary.png"
+				insertbefore="mcPopupImportTagMenuSeparator">
+				<menupopup id="mcPopupProjectDictionaryMenupopup">
+					<menuitem
+						label="&markingcollection.project.dictionary.apply;"
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/dictionary_apply.png"
+						oncommand="window.top.bitsTreeProjectService.applyDictionary(event)" />
+					<menuseparator/>
+					<menuitem
+						label="&markingcollection.project.dictionary.edit;"
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/dictionary_edit.png"
+						oncommand="window.top.bitsTreeProjectService.makeDictionary(event)" />
+					<menuseparator/>
+					<menuitem
+						label="&markingcollection.project.dictionary.read;..."
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/toolbar_folder.png"
+						oncommand="window.top.bitsTreeProjectService.readDictionary(event)" />
+					<menuitem
+						label="&markingcollection.project.dictionary.save;..."
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/dictionary_save.png"
+						oncommand="window.top.bitsTreeProjectService.saveDictionary(event)" />
+					<menuitem
+						label="&markingcollection.project.dictionary.management;..."
+						class="menuitem-iconic"
+						image="chrome://markingcollection/skin/management.png"
+						oncommand="window.top.bitsTreeProjectService.mngDictionary(event)" />
+				</menupopup>
+			</menu>
+			<menu id="mcPopupProjectAnchorMenu" class="menu-iconic" label="&markingcollection.menu.anchor;" image="chrome://markingcollection/skin/hyperanchor.png" insertbefore="mcPopupOpen" hidden="true">
+				<menupopup id="mcPopupProjectAnchorMenupopup">
+					<menuitem
+						label="&markingcollection.open;"
+						oncommand="alert('cmd_project_make_dictionary')" />
+				</menupopup>
+			</menu>
+			<menuseparator observes="mcPopupProjectAnchorMenu" insertbefore="mcPopupOpen"/>
+		</menupopup>
+	</popupset>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeproperty.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeproperty.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treeproperty.js	(revision 5703)
@@ -0,0 +1,470 @@
+/////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////
+var mcPropertyView = {
+	_dispID : "",
+	_dispObj : null,
+
+	get BUTTON()   { return document.getElementById("mcToolbarPropertyViewButton"); },
+	get VBOX()     { return document.getElementById("mcPropertyViewVBox"); },
+	get SPLITTER() { return document.getElementById("mcPropertyViewSplitter"); },
+	get TITLE()    { return document.getElementById("mcPropTitleTextbox"); },
+	get NOTE()     { return document.getElementById("mcPropNoteTextbox"); },
+	get SAMPLE()   { return document.getElementById("mcPropSampleLabel"); },
+	get MARKER_G() { return document.getElementById("mcPropMarkerGroup"); },
+	get MARKER_C() { return document.getElementById("mcPropMarkerCustomButton"); },
+	get BUTTON_U() { return document.getElementById("mcPropMarkerUpdateButton"); },
+
+	get EXTENDED_MESSAGE() { return document.getElementById("mcPropertyExtendedMessageVBox"); },
+	get LOGICAL_PAGE()     { return document.getElementById("mcPropExtendedMessageLogicalPageTextbox"); },
+	get PHYSICAL_PAGE()    { return document.getElementById("mcPropExtendedMessagePhysicalPageTextbox"); },
+
+	get MEDLINE_MESSAGE() { return document.getElementById("mcPropertyExtendedMessageMedlineVBox"); },
+	get MEDLINE_PMCID()   { return document.getElementById("mcPropertyExtendedMessageMedlinePMCIDTextbox"); },
+	get MEDLINE_PMID()    { return document.getElementById("mcPropertyExtendedMessageMedlinePMIDTextbox"); },
+	get MEDLINE_SO()      { return document.getElementById("mcPropertyExtendedMessageMedlineSOTextbox"); },
+
+	get URL_BOX()  { return document.getElementById("mcPropertyURLVBox"); },
+	get URL()      { return document.getElementById("mcPropURLTextbox"); },
+
+	get METACAPTURE_BOX() { return document.getElementById("mcPropertyMetaCaptureVBox"); },
+	get METACAPTURE() { return document.getElementById("mcPropertyMetaCaptureTextbox"); },
+
+	get DataSource() { return window.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.top.bitsObjectMng.Common;     },
+	get Database()   { return window.top.bitsObjectMng.Database;   },
+	get XML()        { return window.top.bitsObjectMng.XML;   },
+	get gBrowser()   { return window.top.bitsObjectMng.getBrowser();},
+
+	get isChecked() {
+		var checked = this.BUTTON.getAttribute("checked");
+		if(!checked || checked == "false"){
+			checked = false;
+		}else{
+			checked = true;
+		}
+		return checked;
+	},
+
+	clear : function(){
+		this.TITLE.value = "";
+		this.NOTE.value = "";
+		this.URL.value = "";
+		this.BUTTON_U.setAttribute("disabled",true);
+		this._resource = null;;
+		this._title = "";
+		this._note = "";
+		this._property = "";
+		this._url = "";
+		this._index = "";
+		this._style = "";
+		this._editmode = "";
+		this._extended_message = null;
+		this._logical_page = "";
+		this._physical_page = "";
+	},
+
+	init : function(){
+		this._dispID = "";
+		this.clear();
+		var propertyview = nsPreferences.getBoolPref("wiredmarker.propertyview", false);
+		this.BUTTON.setAttribute("checked",propertyview);
+		this.VBOX.setAttribute("hidden",!propertyview);
+		if(this.SPLITTER) this.SPLITTER.setAttribute("hidden",!propertyview);
+		this.dispProperty();
+	},
+
+	done : function(){
+		this.VBOX.setAttribute("hidden",true);
+		if(this.SPLITTER) this.SPLITTER.setAttribute("hidden",true);
+		this.BUTTON.setAttribute("checked",false);
+		this.clear();
+	},
+
+	onClick : function(aEvent){
+		var checked = this.isChecked;
+		if(!checked){
+			checked = true;
+		}else{
+			checked = false;
+		}
+		this.BUTTON.setAttribute("checked",checked);
+		this.VBOX.setAttribute("hidden",!checked);
+		if(this.SPLITTER) this.SPLITTER.setAttribute("hidden",!checked);
+		nsPreferences.setBoolPref("wiredmarker.propertyview",checked);
+		aEvent.stopPropagation();
+	},
+
+	xmlEncode : function(aString){
+		return aString.replace(/&/mg,"&amp;").replace(/</mg,"&lt;").replace(/>/mg,"&gt;").replace(/\"/mg,"&quot;");
+	},
+
+	dispProperty : function(aDispItem){
+		var rtn = false;
+		var checked = this.isChecked;
+		this._dispObj = aDispItem;
+		if(aDispItem){
+			this._resource = null;
+			this._id = (aDispItem.fid!=undefined?aDispItem.fid:aDispItem.oid);
+			this._pfid = aDispItem.pfid;
+			this._dbtype = aDispItem.dbtype;
+			this._editmode = (aDispItem.fid_mode!=undefined?aDispItem.fid_mode:aDispItem.oid_mode);
+			this._style = null;
+			var rValue = [aDispItem];
+			if(rValue[0]){
+				if(rValue[0].fid_style){
+					this._style = rValue[0].fid_style.replace(/([:;\(,])\s+/mg,"$1")
+				}else if(rValue[0].pfid != undefined){
+					var folders = this.Database.getFolderFormID(rValue[0].pfid,this._dbtype);
+					if(folders) this._style = folders[0].fid_style.replace(/([:;\(,])\s+/mg,"$1")
+				}
+			}
+			if(rValue){
+				this._url = "";
+				this._metacapture = "";
+				if(aDispItem.fid!=undefined){
+					this._title = rValue[0].fid_title;
+					this._property = rValue[0].fid_property;
+					this._extended_message = null;
+				}else{
+					this._title = rValue[0].oid_title;
+					this._url = rValue[0].con_url;
+					this._metacapture = rValue[0].doc_title;
+					this._property = rValue[0].oid_property;
+					this._extended_message = (rValue[0].oid_type == "application/pdf" ? true : null);
+				}
+				this._note = "";
+				this._logical_page = "";
+				this._physical_page = "";
+				this._medline = {
+					PMCID : "",
+					PMID  : "",
+					SO    : ""
+				};
+				if(this._property != ""){
+					try{
+						var parser = new DOMParser();
+						var xmldoc = parser.parseFromString(this._property,"text/xml");
+						parser = undefined;
+						var xmlnode = xmldoc.getElementsByTagName("NOTE")[0];
+						if(xmlnode) this._note = xmlnode.textContent;
+						var xmlnode = xmldoc.getElementsByTagName("HYPER_ANCHOR")[0];
+						if(xmlnode) this._url = xmlnode.textContent;
+						var xmlnode = xmldoc.getElementsByTagName("LOGICAL_PAGE")[0];
+						if(xmlnode) this._logical_page = xmlnode.textContent;
+						var xmlnode = xmldoc.getElementsByTagName("PHYSICAL_PAGE")[0];
+						if(xmlnode) this._physical_page = xmlnode.textContent;
+						var xmlnode = xmldoc.getElementsByTagName("PMCID")[0];
+						if(xmlnode) this._medline.PMCID = xmlnode.textContent;
+						var xmlnode = xmldoc.getElementsByTagName("PMID")[0];
+						if(xmlnode) this._medline.PMID = xmlnode.textContent;
+						var xmlnode = xmldoc.getElementsByTagName("SO")[0];
+						if(xmlnode) this._medline.SO = xmlnode.textContent;
+						var xmlnode = xmldoc.getElementsByTagName("METACAPTURE")[0];
+						if(xmlnode) this._metacapture = xmlnode.getAttribute("content");
+					}catch(ex3){
+					}
+				}
+				if(this._url == "" && rValue[0].con_url && rValue[0].bgn_dom){
+					this._url = rValue[0].con_url;
+					if(rValue[0].bgn_dom) this._url += "#hyperanchor:"+this.xmlEncode(rValue[0].bgn_dom);
+					if(rValue[0].end_dom) this._url += "&"+this.xmlEncode(rValue[0].end_dom);
+					if(this._style) this._url += "&"+this.xmlEncode(this._style);
+				}
+			}else{
+				this._title = "";
+				this._note = "";
+				this._url = "";
+				this._metacapture = "";
+			}
+			this.TITLE.value = this._title;
+			this.TITLE.defaultValue = this._title;
+			this.NOTE.value = this._note;
+			this.URL.value = this._url;
+			this.METACAPTURE.value = this._metacapture;
+			if(this._extended_message){
+				this.EXTENDED_MESSAGE.removeAttribute("hidden");
+				this.LOGICAL_PAGE.value = this._logical_page;
+				this.PHYSICAL_PAGE.value = this._physical_page;
+			}else{
+				this.EXTENDED_MESSAGE.setAttribute("hidden","true");
+			}
+			if(this._medline.PMCID || this._medline.PMID || this._medline.SO){
+				this.MEDLINE_MESSAGE.removeAttribute("hidden");
+				this.MEDLINE_PMCID.value = this._medline.PMCID;
+				this.MEDLINE_PMID.value = this._medline.PMID;
+				this.MEDLINE_SO.value = this._medline.SO;
+			}else{
+				this.MEDLINE_MESSAGE.setAttribute("hidden","true");
+			}
+			if(this._url){
+				this.URL_BOX.removeAttribute("hidden");
+			}else{
+				this.URL_BOX.setAttribute("hidden","true");
+			}
+			if(this._metacapture){
+				this.METACAPTURE_BOX.removeAttribute("hidden");
+			}else{
+				this.METACAPTURE_BOX.setAttribute("hidden","true");
+			}
+			this.SAMPLE.setAttribute("style", this._style);
+			if(this._editmode && (parseInt(this._editmode) & 0xFFFF)){
+				if((parseInt(this._editmode) & 0x0001)){
+					this.MARKER_C.setAttribute("disabled",true);
+				}else{
+					this.MARKER_C.removeAttribute("disabled");
+				}
+				if((parseInt(this._editmode) & 0x0002)){
+					this.MARKER_G.setAttribute("hidden",true);
+				}else{
+					this.MARKER_G.removeAttribute("hidden");
+				}
+				if(parseInt(this._editmode) & 0x00F0){
+					this.TITLE.setAttribute("readonly",true);
+				}else{
+					this.TITLE.removeAttribute("readonly");
+				}
+				if(parseInt(this._editmode) & 0x0F00){
+					this.NOTE.setAttribute("readonly",true);
+				}else{
+					this.NOTE.removeAttribute("readonly");
+				}
+			}else{
+				this.TITLE.removeAttribute("readonly");
+				this.NOTE.removeAttribute("readonly");
+				if(this._resource && !this.DataSource.isContainer(this._resource)){
+					this.MARKER_G.setAttribute("hidden",true);
+				}else{
+					this.MARKER_C.removeAttribute("disabled");
+					this.MARKER_G.removeAttribute("hidden");
+				}
+			}
+		}else{
+			this.clear();
+			this.TITLE.setAttribute("readonly",true);
+			this.NOTE.setAttribute("readonly",true);
+			this.MARKER_C.setAttribute("disabled",true);
+			this.EXTENDED_MESSAGE.hidden = true;
+			this.MEDLINE_MESSAGE.hidden = true;
+			this.METACAPTURE_BOX.hidden = true;
+		}
+		this.BUTTON_U.setAttribute("disabled",true);
+		this.MARKER_G.setAttribute("hidden",true);
+		if(this._dispID != this._id){
+			try{this.TITLE.editor.transactionManager.clear();}catch(ex2){}
+			try{this.NOTE.editor.transactionManager.clear();}catch(ex2){}
+			this._dispID = this._id;
+		}
+		return rtn;
+	},
+
+	openDialog : function(){
+		var result = {
+			accept : false,
+			style  : this._style,
+		};
+		if(!this._index) this._index = -1;
+		window.openDialog('chrome://markingcollection/content/markerCustom.xul', '', 'modal,centerscreen,chrome',this._index,result);
+		if(result.accept){
+			this._style = result.style;
+			this.SAMPLE.setAttribute("style",this._style);
+			this.DataSource.setProperty(this._resource,"style",this._style);
+		}
+	},
+
+	updateTitle : function(aValue){
+		this.BUTTON_U.removeAttribute("disabled");
+	},
+
+	updateNote : function(aValue){
+		this.BUTTON_U.removeAttribute("disabled");
+	},
+
+	undoTitle : function(){
+		try{
+			while(this.TITLE.editor.transactionManager.numberOfUndoItems>0){
+				this.TITLE.editor.undo(1);
+				var title = this.TITLE.value;
+				title = title.replace(/\t/mg,"        ");
+				title = this.Common.exceptCode(title);
+				title = title.replace(/[\r\n]/mg, " ").replace(/^\s*/img,"").replace(/\s*$/img,"");
+				if(title != "") break;
+			}
+		}catch(ex2){_dump(ex2);}
+		setTimeout(function(){mcPropertyView.TITLE.focus();},100);
+	},
+
+	update : function(aEvent,aElem){
+		var title = this.TITLE.value;
+		var note = this.NOTE.value;
+		note = note.replace(/\t/mg,"        ");
+		note = note.replace(/\x0D\x0A|\x0D|\x0A/g," __BR__ ");
+		note = this.Common.exceptCode(note);
+		note = note.replace(/ __BR__ /mg,"\n");
+		title = title.replace(/\t/mg,"        ");
+		title = this.Common.exceptCode(title);
+		var logical_page = null;
+		var physical_page = null;
+		if(this._extended_message){
+			logical_page = this.LOGICAL_PAGE.value;
+			logical_page = logical_page.replace(/\t/mg,"        ");
+			logical_page = this.Common.exceptCode(logical_page);
+			physical_page = this.PHYSICAL_PAGE.value;
+			physical_page = physical_page.replace(/\t/mg,"        ");
+			physical_page = this.Common.exceptCode(physical_page);
+		}
+		if(this._dispObj && this._title != title){
+			var chkTitle = title.replace(/[\r\n]/g, " ").replace(/^\s*/g,"").replace(/\s*$/g,"");
+			if(chkTitle == ""){
+				this.Common.alert(mcMainService.STRING.getString("ERROR_NOT_ENTER_TITLE"));
+//				this.undoTitle();
+				this.TITLE.value = this.TITLE.defaultValue;
+				aEvent.preventDefault();
+				aEvent.stopPropagation();
+				var self = this;
+				setTimeout(function(){ self.TITLE.focus(); },0);
+				return false;
+			}
+			if(this._dispObj.fid != undefined){
+				var i;
+				var listTitle = "";
+				var listRes = this.Database.getFolderFormPID(this._dispObj.pfid,this._dispObj.dbtype);
+				if(listRes){
+					for(i=0;i<listRes.length;i++){
+						if(listRes[i].fid == this._dispObj.fid) continue;
+						listTitle = listRes[i].fid_title;
+						listTitle = listTitle.replace(/^\s*/img,"").replace(/\s*$/img,"");
+						if(listTitle == chkTitle) break;
+					}
+					if(listTitle == chkTitle){
+						this.Common.alert(mcMainService.STRING.getString("ERROR_INVALID_TITLE") + "[ " + chkTitle + " ]");
+//						this.undoTitle();
+						this.TITLE.value = this.TITLE.defaultValue;
+						aEvent.preventDefault();
+						aEvent.stopPropagation();
+						var self = this;
+						setTimeout(function(){ self.TITLE.focus(); },0);
+						return false;
+					}
+				}else{
+					return;
+				}
+			}
+		}
+		if(this._title != title || this._note != note || (this._extended_message && (this._logical_page != logical_page || this._physical_page != physical_page))){
+			if(this._note != note || (this._extended_message && (this._logical_page != logical_page || this._physical_page != physical_page))){
+				if(!this._property || this._property == "") this._property = "<PROPERTY/>";
+				try{
+					var parser = new DOMParser();
+					var xmldoc = parser.parseFromString(this._property,"text/xml");
+					parser = undefined;
+					if(this._note != note){
+						var xmlnode = xmldoc.getElementsByTagName("NOTE")[0];
+						if(!xmlnode){
+							xmlnode = xmldoc.createElement("NOTE");
+							xmldoc.documentElement.appendChild(xmlnode);
+						}
+						while(xmlnode.hasChildNodes()) xmlnode.removeChild(xmlnode.lastChild);
+						var elemS = xmldoc.createTextNode(note);
+						if(elemS) xmlnode.appendChild(elemS);
+					}
+					if(this._extended_message && (this._logical_page != logical_page || this._physical_page != physical_page)){
+						var extras_msg = xmldoc.getElementsByTagName("EXTENDED_MESSAGE")[0];
+						if(!extras_msg){
+							extras_msg = xmldoc.createElement("EXTENDED_MESSAGE");
+							xmldoc.documentElement.appendChild(extras_msg);
+						}
+						var xmlnode = xmldoc.getElementsByTagName("LOGICAL_PAGE")[0];
+						if(!xmlnode){
+							xmlnode = xmldoc.createElement("LOGICAL_PAGE");
+							extras_msg.appendChild(xmlnode);
+						}
+						if(xmlnode){
+							while(xmlnode.hasChildNodes()){ xmlnode.removeChild(xmlnode.lastChild); }
+							if(logical_page) xmlnode.appendChild(xmldoc.createTextNode(logical_page));
+						}
+						var xmlnode = xmldoc.getElementsByTagName("PHYSICAL_PAGE")[0];
+						if(!xmlnode){
+							xmlnode = xmldoc.createElement("PHYSICAL_PAGE");
+							extras_msg.appendChild(xmlnode);
+						}
+						if(xmlnode){
+							while(xmlnode.hasChildNodes()){ xmlnode.removeChild(xmlnode.lastChild); }
+							if(physical_page) xmlnode.appendChild(xmldoc.createTextNode(physical_page));
+						}
+					}
+					var s = new XMLSerializer();
+					this._property = s.serializeToString(xmldoc);
+					s = undefined;
+				}catch(ex3){
+				}
+				try{
+					var parser = new DOMParser();
+					var xmldoc = parser.parseFromString(this._property,"text/xml");
+					if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+					if(!xmldoc){
+						this.Common.alert("Read Error!!");
+						return false;
+					}
+				}catch(ex3){
+					alert(ex3);
+				}
+			}
+			var rtn = false;
+			if(this._dispObj.fid != undefined){
+				rtn = this.Database.updateFolder({fid:this._id, fid_title:title, fid_property:this._property},this._dbtype);
+				if(rtn){
+					this._dispObj.fid_title = title;
+					this._dispObj.fid_property = this._property;
+				}
+			}else{
+				rtn = this.Database.updateObject({oid:this._id, oid_title:title, oid_property:this._property},this._dbtype);
+				if(rtn){
+					this._dispObj.oid_title = title;
+					this._dispObj.oid_property = this._property;
+				}
+			}
+			if(rtn){
+				var About = this.DataSource.getID2About(this._id,this._pfid,this._dbtype);
+				if(About && this._title != title){
+					var res = this.Common.RDF.GetResource(About);
+					if(this.DataSource.isContainer(res)){
+						this.DataSource.setProperty(res,"title",title);
+					}else{
+						var contResList = this.DataSource.flattenResources(this.Common.RDF.GetResource(this.DataSource.ABOUT_ROOT), 2, true);
+						var i;
+						for(i=0;i<contResList.length;i++){
+							var id = this.DataSource.getProperty(contResList[i],"id");
+							var dbtype = this.DataSource.getProperty(contResList[i],"dbtype");
+							if(this._id != id || this._dbtype != dbtype) continue;
+							this.DataSource.setProperty(contResList[i],"title",title);
+						}
+					}
+					this.DataSource.flush();
+				}
+				if(mcItemView.isChecked) mcItemView.refresh();
+			}
+			this._title = title;
+			this._note = note;
+			if(this._extended_message){
+				this._logical_page = logical_page;
+				this._physical_page = physical_page;
+			}
+		}
+		if(this.NOTE.value != note) this.NOTE.value = note;
+		if(this.TITLE.value != title) this.TITLE.value = title;
+		if(this._extended_message){
+			if(this.LOGICAL_PAGE.value != logical_page) this.LOGICAL_PAGE.value = logical_page;
+			if(this.PHYSICAL_PAGE.value != physical_page) this.PHYSICAL_PAGE.value = physical_page;
+		}
+		return true;
+	},
+
+};
+function _dump2(aString){
+	if(!nsPreferences.getBoolPref("wiredmarker.debug", false)) return;
+	var dumpString = new String(aString);
+	var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"]
+	                      .getService(Components.interfaces.nsIConsoleService);
+	aConsoleService.logStringMessage(dumpString);
+	window.dump(aString+"\n");
+}
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treepropertySidebarOverlay.xul
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treepropertySidebarOverlay.xul	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treepropertySidebarOverlay.xul	(revision 5703)
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
+<!DOCTYPE overlay SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
+<overlay
+	id="propertyOverlay"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+	xmlns:html="http://www.w3.org/1999/xhtml">
+	<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
+	<script type="application/x-javascript" src="chrome://global/content/nsJSSupportsUtils.js"/>
+	<script type="application/x-javascript" src="chrome://global/content/nsJSComponentManager.js"/>
+	<script type="application/x-javascript" src="chrome://markingcollection/content/treeproperty.js"/>
+	<script type="application/x-javascript">
+	<![CDATA[
+		function _propertyOverlayInit(){
+			mcPropertyView.init();
+		}
+		function _propertyOverlayDone(){
+			mcPropertyView.done();
+		}
+		window.addEventListener("load", _propertyOverlayInit, false);
+		window.addEventListener("unload", _propertyOverlayDone, false);
+	]]>
+	</script>
+	<splitter id="mcPropertyViewSplitter" class="chromeclass-extrachrome" hidden="true" />
+	<vbox id="mcPropertyViewVBox" hidden="true" persist="height" style="height:300px;" flex="1">
+		<toolbox class="plain">
+			<toolbar id="MarkingCollectionListHeader" class="plain">
+				<label id="MarkingCollectionListLabel" value="&markingcollection.property;" flex="1" crop="end" />
+				<spacer flex="1" />
+				<toolbarbutton class="tabs-closebutton" oncommand="mcPropertyView.onClick(event);" />
+			</toolbar>
+		</toolbox>
+		<vbox style="overflow:auto;" flex="1">
+			<vbox style="background:white;">
+				<groupbox >
+					<caption label="&markingcollection.prop.title;" style="background:white;" />
+					<textbox
+						id="mcPropTitleTextbox"
+						multiline="true"
+						rows="2"
+						readonly="true"
+						oninput="mcPropertyView.updateTitle(this.value);"
+						onfocus="this.select();"
+						onchange="mcPropertyView.update(event,this);"/>
+				</groupbox>
+			</vbox>
+			<vbox  style="background:white;">
+				<groupbox >
+					<caption label="&markingcollection.prop.note;" style="background:white;" />
+					<textbox
+						id="mcPropNoteTextbox"
+						multiline="true"
+						rows="2"
+						readonly="true"
+						oninput="mcPropertyView.updateNote(this.value);"
+						onfocus="this.select();"
+						onchange="mcPropertyView.update(event,this);"/>
+				</groupbox>
+			</vbox>
+			<vbox id="mcPropertyExtendedMessageVBox" style="background:white;" hidden="true">
+				<groupbox id="mcPropertyExtendedMessageGBox">
+					<caption label="&markingcollection.prop.extended_message;" style="background:white;" />
+					<grid>
+						<columns>
+							<column />
+							<column />
+						</columns>
+						<rows>
+							<row align="center">
+								<hbox flex="1" pack="end">
+									<label value="Logical Page:" />
+								</hbox>
+								<textbox id="mcPropExtendedMessageLogicalPageTextbox" size="1"   onfocus="this.select();" onblur="mcPropertyView.update(event,this);"/>
+							</row>
+							<row align="center">
+								<hbox flex="1" pack="end">
+									<label value="Physical Page:" />
+								</hbox>
+								<textbox id="mcPropExtendedMessagePhysicalPageTextbox" size="1"  onfocus="this.select();" onblur="mcPropertyView.update(event,this);"/>
+							</row>
+						</rows>
+					</grid>
+				</groupbox>
+			</vbox>
+			<vbox id="mcPropertyExtendedMessageMedlineVBox" style="background:white;" hidden="true">
+				<groupbox id="mcPropertyExtendedMessageMedlineGBox">
+					<caption label="PubMed Central" style="background:white;" align="center" flex="1">
+						<label value="PubMed Central"/>
+						<hbox align="center" pack="end" flex="1">
+							<label value="PMCID:" hidden="false"/>
+							<textbox
+								id="mcPropertyExtendedMessageMedlinePMCIDTextbox"
+								size="1"
+								flex="1"
+								style="-moz-appearance:none !important;border:none;background:white !important;" onfocus="this.select();"
+								readonly="true"/>
+						</hbox>
+					</caption>
+					<grid>
+						<columns>
+							<column pack="end" />
+							<column pack="start" flex="1"/>
+						</columns>
+						<rows>
+							<row align="center">
+								<hbox flex="1" pack="end">
+									<label value="PubMed ID:" />
+								</hbox>
+								<textbox
+									id="mcPropertyExtendedMessageMedlinePMIDTextbox"
+									size="1"
+									style="-moz-appearance:none !important;border:none;background:white !important;"
+									onfocus="this.select();"
+									readonly="true"/>
+							</row>
+							<row align="start">
+								<hbox flex="1" pack="end">
+									<label value="Source:"/>
+								</hbox>
+								<textbox
+									id="mcPropertyExtendedMessageMedlineSOTextbox"
+									rows="2"
+									multiline="true"
+									style="-moz-appearance:none !important;border:none;background:white !important;" onfocus="this.select();"
+									readonly="true"/>
+							</row>
+						</rows>
+					</grid>
+				</groupbox>
+			</vbox>
+			<vbox style="background:white;">
+				<groupbox id="mcPropMarkerGroup" flex="1">
+					<caption label="&markingcollection.marker;" style="background:white;" />
+						<vbox flex="1" style="background:white;padding:10px;border:1px solid ThreeDShadow;text-align:center;" align="center">
+							<label id="mcPropSampleLabel" value="Firefox, rediscover the web" />
+						</vbox>
+						<vbox >
+							<hbox flex="1">
+								<spacer flex="1" />
+								<button id="mcPropMarkerCustomButton" label="&markingcollection.button.customize;..." oncommand="mcPropertyView.openDialog();" />
+							</hbox>
+						</vbox>
+				</groupbox>
+			</vbox>
+			<vbox id="mcPropertyURLVBox" style="background:white;" hidden="true">
+				<groupbox>
+					<caption label="HYPER-ANCHOR Code" style="background:white;"/>
+					<textbox
+						id="mcPropURLTextbox"
+						multiline="true"
+						style="-moz-appearance:none !important;border:none;background:white !important;"
+						onfocus="this.select();"
+						readonly="true"/>
+				</groupbox>
+			</vbox>
+			<vbox id="mcPropertyMetaCaptureVBox" style="background:white;" hidden="true">
+				<groupbox id="mcPropertyMetaCaptureGBox">
+					<caption label="&markingcollection.prop.metacapture;" style="background:white;" />
+					<textbox
+						id="mcPropertyMetaCaptureTextbox"
+						multiline="true"
+						style="-moz-appearance:none !important;border:none;background:white !important;"
+						onfocus="this.select();"
+						readonly="true"/>
+				</groupbox>
+			</vbox>
+			<vbox flex="1" style="background:white;">
+				<hbox flex="1">
+					<spacer flex="1" />
+					<button
+						id="mcPropMarkerUpdateButton"
+						label="&markingcollection.button.update;"
+						oncommand="mcPropertyView.update();"
+						disabled="true"
+						hidden="true" />
+				</hbox>
+			</vbox>
+		</vbox>
+	</vbox>
+</overlay>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treerootfolder.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treerootfolder.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treerootfolder.js	(revision 5703)
@@ -0,0 +1,105 @@
+/////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////
+var mcTreeRootFolder = {
+
+	get idMENU()        { return "mcToolbarRootFolderButton"; },
+	get idMENU_ALL()    { return "mcMenuRootFolderAll"; },
+	get idMENU_SELECT() { return "mcMenuRootFolderSelect"; },
+	get idMENU_ROOT()   { return "mcPopupRootFolder"; },
+	get idMENU_POPUP()  { return "mcMenuRootFolderPopup"; },
+	get MENU()          { return document.getElementById(this.idMENU); },
+	get MENU_ALL()      { return document.getElementById(this.idMENU_ALL); },
+	get MENU_SELECT()   { return document.getElementById(this.idMENU_SELECT); },
+	get MENU_ROOT()     { return document.getElementById(this.idMENU_ROOT); },
+	get MENU_POPUP()    { return document.getElementById(this.idMENU_POPUP); },
+	get TITLE()         { return window.top.document.getElementById("sidebar-title"); },
+
+	get DataSource() { return window.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.top.bitsObjectMng.Common;     },
+	get XPath()      { return window.top.bitsObjectMng.XPath;      },
+	get Database()   { return window.top.bitsObjectMng.Database;   },
+	get gBrowser() { return window.top.bitsObjectMng.getBrowser();},
+
+	baseURL  : "",
+	shouldRebuild : false,
+
+	init : function(){
+		if(mcItemView.isChecked){
+			mcTreeRootFolder.MENU_ROOT.setAttribute("hidden","true");
+		}else{
+			mcTreeRootFolder.MENU_ROOT.removeAttribute("hidden");
+		}
+	},
+
+	rebuild : function(){},
+
+	onPopupShowing : function(aEvent, aPopupRoot){
+		var res = mcTreeHandler.resource;
+		try{
+			if(!res){
+				mcTreeRootFolder.MENU_SELECT.setAttribute("disabled","true");
+			}else{
+				if(mcTreeHandler.TREE.view.isContainerEmpty(mcTreeHandler.TREE.currentIndex))
+					mcTreeRootFolder.MENU_SELECT.setAttribute("disabled","true");
+				else
+					mcTreeRootFolder.MENU_SELECT.removeAttribute("disabled");
+			}
+		}catch(e){
+			mcTreeRootFolder.MENU_SELECT.setAttribute("disabled","true");
+		}
+	},
+
+	onClick : function(aEvent){
+		if(aEvent.target.id == mcTreeRootFolder.idMENU){
+			return;
+		}else if(aEvent.target.id == mcTreeRootFolder.idMENU_ALL){
+			nsPreferences.setUnicharPref("wiredmarker.rootfolder", "");
+			nsPreferences.setUnicharPref("wiredmarker.rootfolder_dbtype", "");
+			mcTreeViewModeService.rebuild();
+		}else if(aEvent.target.id == mcTreeRootFolder.idMENU_SELECT){
+			var res = mcTreeHandler.resource;
+			if(!res) return;
+			var baseID = this.DataSource.getProperty(res, "id");
+			var dbtype = this.DataSource.getProperty(res, "dbtype");
+			var title = this.DataSource.getProperty(res, "title");
+			nsPreferences.setUnicharPref("wiredmarker.rootfolder", baseID);
+			nsPreferences.setUnicharPref("wiredmarker.rootfolder_dbtype", dbtype);
+			mcTreeViewModeService.rebuild();
+		}else{
+			var disabled = aEvent.target.getAttribute("disabled");
+			if(disabled == "true") return;
+			var res = this.Common.RDF.GetResource(aEvent.target.id)
+			var baseID = this.DataSource.getProperty(res, "id");
+			var dbtype = this.DataSource.getProperty(res, "dbtype");
+			var title = this.DataSource.getProperty(res, "title");
+			nsPreferences.setUnicharPref("wiredmarker.rootfolder", baseID);
+			nsPreferences.setUnicharPref("wiredmarker.rootfolder_dbtype", dbtype);
+			mcTreeViewModeService.rebuild();
+			this.MENU_POPUP.hidePopup();
+		}
+		aEvent.stopPropagation();
+	},
+
+	_changeTitle : function(aTitle){
+		var label = "";
+		var viewmode = mcTreeViewModeService.viewmode;
+		switch (viewmode){
+			case "each" :
+				label = mcTreeViewModeService.EACH.getAttribute("label");
+				break;
+			case "single" :
+				label = mcTreeViewModeService.SINGLE.getAttribute("label");
+				break;
+			default :
+				label = mcTreeViewModeService.ALL.getAttribute("label");
+				break;
+		}
+		var title = aTitle;
+		if(!title) title = mcMainService.STRING.getString("DEFAULT_FOLDER");
+		var button_title = mcMainService.STRING.getString("APP_DISP_TITLE");
+		button_title += " [ " + label + " ]" + " [ " + title + " ]";
+		this.TITLE.setAttribute("value",button_title);
+	},
+
+};
+
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/xmlimport.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/xmlimport.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/xmlimport.js	(revision 5703)
@@ -0,0 +1,484 @@
+var mcXmlImportService = {
+	_openurl : "",
+	_doc     : null,
+	_loaddoc : null,
+	_url     : "",
+	_fileid  : "",
+
+	_isExportFile : false,
+
+/////////////////////////////////////////////////////////////////////
+	get STRING() { return document.getElementById("mcMainString"); },
+
+	get DataSource() { return window.top.bitsObjectMng.DataSource; },
+	get Common()     { return window.top.bitsObjectMng.Common;     },
+	get Database()   { return window.top.bitsObjectMng.Database;   },
+	get XML()        { return window.top.bitsObjectMng.XML;        },
+	get gBrowser()   { return window.top.bitsObjectMng.getBrowser();},
+
+	get FileSearch() { return Components.classes['@mozilla.org/inspector/search;1?type=file'].getService(Components.interfaces.inIFileSearch); },
+
+
+	get isExportFile(){ return this._isExportFile; },
+
+/////////////////////////////////////////////////////////////////////
+	init : function(){},
+
+/////////////////////////////////////////////////////////////////////
+	done : function(){},
+
+/////////////////////////////////////////////////////////////////////
+	load : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	unload : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	click : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	blur : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	onPopupShowing : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	onPopupHiding : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	onCommand : function(aEvent){},
+
+/////////////////////////////////////////////////////////////////////
+	getTemplateDir : function(){},
+
+/////////////////////////////////////////////////////////////////////
+	createMenu : function(aParentNode,aEntry){},
+
+/////////////////////////////////////////////////////////////////////
+	loadText : function(aURI){},
+
+/////////////////////////////////////////////////////////////////////
+	loadXMLDocument : function(aUri){
+		var xmlDocument = window.top.bitsMarkingCollection.loadXMLDocument(aUri);
+		return xmlDocument;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	loadFile : function(aParName, aIdx, aRow, aUri){
+		this._isExportFile = false;
+		var uri = aUri;
+		var splitFileName = this.Common.splitFileName(uri);
+		if(splitFileName[1].toLowerCase() == "zip"){
+			var tmpDir = window.top.bitsMarkingCollection.getTmpDir().clone();
+			tmpDir.append(this.STRING.getString("APP_TITLE"));
+			tmpDir.createUnique(tmpDir.DIRECTORY_TYPE, 0777);
+			var zipFile = this.Common.convertURLToFile(uri);
+			try {
+				var zipReader = Components.classes["@mozilla.org/libjar/zip-reader;1"].createInstance(Components.interfaces.nsIZipReader);
+				if(zipReader.init){
+					zipReader.init(zipFile);
+					zipReader.open();
+				}else{
+					zipReader.open(zipFile);
+				}
+			} catch (e) {
+				mcXmlImportService._dump("mcXmlImportService.loadFile():"+e);
+				zipReader.close();
+				return false;
+			}
+			var entries = zipReader.findEntries("*/");
+			while((entries.hasMoreElements?entries.hasMoreElements:entries.hasMore)()){
+				try{
+					var entry = entries.getNext();
+					if(typeof entry != "string"){
+						entry = entry.QueryInterface(Components.interfaces.nsIZipEntry);
+						entry = entry.name;
+					}
+					var patharr = entry.split("/");
+				}catch(e){
+					continue;
+				}
+				var unzipDir = tmpDir.clone();
+				while(patharr.length>0) unzipDir.append(patharr.shift());
+				if(!unzipDir.exists()) unzipDir.create(unzipDir.DIRECTORY_TYPE, 0777);
+			}
+			if(zipReader.init){
+				entries = zipReader.findEntries("*");
+			}else{
+				entries = zipReader.findEntries(null);
+			}
+			while((entries.hasMoreElements?entries.hasMoreElements:entries.hasMore)()){
+				try{
+					var entry = entries.getNext();
+					if(typeof entry != "string"){
+						entry = entry.QueryInterface(Components.interfaces.nsIZipEntry);
+						entry = entry.name;
+					}
+					var patharr = entry.split("/");
+				}catch(e){
+					continue;
+				}
+				var unzipTarget = tmpDir.clone();
+				while(patharr.length>0) unzipTarget.append(patharr.shift());
+				if(unzipTarget.exists()) continue;
+				try{ unzipTarget.create(unzipTarget.NORMAL_FILE_TYPE, 0777); } catch(e){}
+				zipReader.extract(entry, unzipTarget);
+			}
+			var inXML = false;
+			var rtn = false;
+			entries = zipReader.findEntries("*.xml");
+			while((entries.hasMoreElements?entries.hasMoreElements:entries.hasMore)()){
+				try{
+					var entry = entries.getNext();
+					if(typeof entry != "string"){
+						entry = entry.QueryInterface(Components.interfaces.nsIZipEntry);
+						entry = entry.name;
+					}
+					var patharr = entry.split("/");
+					inXML = true;
+				}catch(e){
+					continue;
+				}
+				var xmlTarget = tmpDir.clone();
+				while(patharr.length>0) xmlTarget.append(patharr.shift());
+				if(!xmlTarget.exists()) continue;
+				if(!xmlTarget.isFile()){
+					if(inXML){
+						this.Common.alert(this.STRING.getString("ERROR_ZIP_ANALYSIS"));
+						rtn = true;
+					}
+					continue;
+				}
+				var url = this.Common.convertFilePathToURL(xmlTarget.path);
+				rtn |= this._loadFile(aParName, aIdx, aRow, url);
+			}
+			if(tmpDir.exists()) tmpDir.remove(true);
+			zipReader.close();
+			return rtn;
+		}else{
+			return this._loadFile(aParName, aIdx, aRow, aUri);
+		}
+	},
+
+/////////////////////////////////////////////////////////////////////
+	xmlEncode : function(aString){
+		return aString.replace(/&/mg,"&amp;").replace(/</mg,"&lt;").replace(/>/mg,"&gt;").replace(/\"/mg,"&quot;");
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_loadFile : function(aParName, aIdx, aRow, aUri){
+		var uri = aUri;
+		var aRes = this.Common.RDF.GetResource(aParName);
+		var import_pfid = this.DataSource.getProperty(aRes,"id");
+		var dbtype = this.DataSource.getProperty(aRes,"dbtype");
+		var xmldoc = this.loadXMLDocument(uri);
+		if(!xmldoc) return false;
+		var xmlfile = this.Common.convertURLToFile(uri);
+		var saveDataDir = null;
+		var elemLIST = xmldoc.getElementsByTagName("LIST");
+		if(!elemLIST) return false;
+		var cache_dirs = [];
+		var cache_dir = xmlfile.parent.clone();
+		cache_dir.append(window.top.bitsTreeExportService.appDataAddSTRING);
+		if(cache_dir.exists()){
+			var entries = cache_dir.directoryEntries;
+			while(entries.hasMoreElements()){
+				var pDir = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+				if(!pDir.isDirectory()) continue;
+				cache_dirs.push(pDir.clone());
+			}
+		}
+		this._isExportFile = true;
+		var prompts = this.Common.PROMPT;
+		var title = this.STRING.getString("APP_DISP_TITLE");
+		var flags = prompts.BUTTON_POS_0 * prompts.BUTTON_TITLE_YES +
+		            prompts.BUTTON_POS_1 * prompts.BUTTON_TITLE_NO +
+		            prompts.BUTTON_POS_0_DEFAULT;
+		var checkMsg = (cache_dirs.length>0 ? this.STRING.getString("CHECK_XML_IMPOER_CACHE_DOCUMENT") : null);
+		var checkState = {value: false};
+		var button = prompts.confirmEx(
+									window,
+									title,
+									this.STRING.getString("CONFIRM_XML_IMPOER"),
+									flags, "", "", "", checkMsg, checkState);
+		if(button!=0) return false;
+		if(checkState.value){
+			var i;
+			for(i=0;i<cache_dirs.length;i++){
+				var copy_dir = window.top.bitsAutocacheService.cachedir.clone();
+				copy_dir.append(cache_dirs[i].leafName);
+				if(!copy_dir.exists()) copy_dir.create(copy_dir.DIRECTORY_TYPE, 0777);
+				var entries = cache_dirs[i].directoryEntries;
+				while(entries.hasMoreElements()){
+					var pDir = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+					if(!pDir.isDirectory()) continue;
+					var chkdir = copy_dir.clone();
+					chkdir.append(pDir.leafName);
+					if(!chkdir.exists()) pDir.copyTo(copy_dir,pDir.leafName);
+				}
+			}
+			window.top.bitsAutocacheService._insertInitDB();
+		}
+		var aTransaction = false;
+		if(!aTransaction) this.Database.beginTransaction(dbtype);
+		var dbid = parseInt(this.Database._oidIdentify(dbtype,this.Common.getTimeStamp(),aTransaction));
+		var maxOrder = this.Database.getMaxOrderFormPID(import_pfid,dbtype,aTransaction);
+		var attrs_folder = ["fid_title","fid_note","fid_style","fid_property","fid_dbtype"];
+		var attrs_object = ["oid_type","doc_title","doc_url","con_url","bgn_dom","end_dom","oid_title","oid_note","oid_structure","oid_link","oid_mode","oid_txt","oid_date","oid_property","oid_dbtype"];
+		var folders = [];
+		var folders_name = [];
+		var objects = [];
+		var i,j,k;
+		var listID;
+		var listTitle;
+		var listRes = this.DataSource.flattenResources(aRes,1,false);
+		for(i=0;i<listRes.length;i++){
+			if(listRes[i].Value == aRes.Value) continue;
+			listTitle = this.DataSource.getProperty(listRes[i],"title");
+			listTitle = listTitle.replace(/^\s*/img,"").replace(/\s*$/img,"");
+			var chkid = import_pfid.toString() + "\t" + listTitle;
+			if(!folders_name[chkid]) folders_name[chkid] = [];
+			folders_name[chkid].push(listID);
+		}
+		var regexp_png = new RegExp("^data:image/\\w+;base64,");
+		for(i=0;i<elemLIST.length;i++){
+			elemLIST[i].setAttribute("id",import_pfid);
+			var elemFOLDER = elemLIST[i].getElementsByTagName("*");
+			for(j=0;j<elemFOLDER.length;j++){
+				if(!(elemFOLDER[j].nodeName == "FOLDER" || elemFOLDER[j].nodeName == "OBJECT")) continue;
+				var id = dbid.toString();
+				elemFOLDER[j].setAttribute("id",id);
+				var pfid = elemFOLDER[j].parentNode.getAttribute("id");
+				if(elemFOLDER[j].nodeName == "FOLDER"){
+					folders[id] = this.Database.newFolder(id,dbtype,aTransaction);
+					folders[id].pfid = pfid;
+					folders[id].pfid_order = ++maxOrder;
+				}else if(elemFOLDER[j].nodeName == "OBJECT"){
+					objects[id] = this.Database.newObject(id,dbtype,aTransaction);
+					objects[id].pfid = pfid;
+					objects[id].pfid_order = ++maxOrder;
+				}
+				dbid++;
+			}
+			for(j=0;j<attrs_folder.length;j++){
+				var elemAttr = elemLIST[i].getElementsByTagName(attrs_folder[j].toUpperCase());
+				for(k=0;k<elemAttr.length;k++){
+					var id = elemAttr[k].parentNode.getAttribute("id");
+					if(!folders[id]) continue;
+					var textContent = elemAttr[k].textContent;
+					if(!textContent || textContent == "") continue;
+					if(attrs_folder[j] == "fid_note"){
+						folders[id].fid_property = "<PROPERTY><NOTE>" + textContent + "</NOTE></PROPERTY>";
+					}else if(attrs_folder[j] == "fid_title"){
+						var chkid = folders[id].pfid.toString() + "\t" + textContent;
+						if(!folders_name[chkid]) folders_name[chkid] = [];
+						folders_name[chkid].push(id);
+						folders[id].fid_title = textContent;
+					}else{
+						folders[id][attrs_folder[j]] = textContent;
+					}
+				}
+			}
+			for(j=0;j<attrs_object.length;j++){
+				var elemAttr = elemLIST[i].getElementsByTagName(attrs_object[j].toUpperCase());
+				for(k=0;k<elemAttr.length;k++){
+					var id = elemAttr[k].parentNode.getAttribute("id");
+					if(!objects[id]) continue;
+					var textContent = elemAttr[k].textContent;
+					if(!textContent || textContent == "") continue;
+					if(attrs_object[j] == "oid_note"){
+						var property = objects[id].oid_property.replace(/[\r\n\t]/mg," __BR__ ");
+						if(property.match(/^(.*<NOTE>)(.*?)(<\/NOTE>.*)$/m)){
+							property = RegExp.$1 + textContent + RegExp.$3;
+						}else if(property.match(/^(<PROPERTY>)(.*<\/PROPERTY>)$/m)){
+							property = RegExp.$1 + "<NOTE>" + textContent + "</NOTE>" + RegExp.$2;
+						}else{
+							property = "<PROPERTY><NOTE>" + textContent + "</NOTE></PROPERTY>";
+						}
+						objects[id].oid_property = property.replace(/ __BR__ /mg,"\n");
+					}else if(attrs_object[j] == "oid_structure"){
+						var property = objects[id].oid_property.replace(/[\r\n\t]/mg," __BR__ ");
+						if(property.match(/^(.*<STRUCTURE>)(.*?)(<\/STRUCTURE>.*)$/m)){
+							property = RegExp.$1 + textContent + RegExp.$3;
+						}else if(property.match(/^(<PROPERTY>)(.*<\/PROPERTY>)$/m)){
+							property = RegExp.$1 + "<STRUCTURE>" + textContent + "</STRUCTURE>" + RegExp.$2;
+						}else{
+							property = "<PROPERTY><STRUCTURE>" + textContent + "</STRUCTURE></PROPERTY>";
+						}
+						objects[id].oid_property = property.replace(/ __BR__ /mg,"\n");
+					}else if(attrs_object[j] == "oid_link"){
+						var property = objects[id].oid_property.replace(/[\r\n\t]/mg," __BR__ ");
+						if(property.match(/^(.*<LINK>)(.*?)(<\/LINK>.*)$/m)){
+							property = RegExp.$1 + textContent + RegExp.$3;
+						}else if(property.match(/^(<PROPERTY>)(.*<\/PROPERTY>)$/m)){
+							property = RegExp.$1 + "<LINK>" + textContent + "</LINK>" + RegExp.$2;
+						}else{
+							property = "<PROPERTY><LINK>" + textContent + "</LINK></PROPERTY>";
+						}
+						objects[id].oid_property = property.replace(/ __BR__ /mg,"\n");
+					}else if((attrs_object[j] == "doc_url" || attrs_object[j] == "con_url") && regexp_png.test(textContent)){
+							var blobFile = this.Database.getObjectBLOBFile(id,dbtype);
+							objects[id][attrs_object[j]] = this.Common.convertFilePathToURL(blobFile.path);
+					}else if(attrs_object[j] == "oid_property"){
+						objects[id][attrs_object[j]] = textContent;
+					}else{
+						objects[id][attrs_object[j]] = textContent;
+					}
+				}
+			}
+		}
+		var newAddRes;
+		var key;
+		for(key in folders){
+			if(typeof folders[key] == "function") continue;
+			var fid_dbtype = dbtype;
+			var folder = folders[key];
+			if(folder.fid_dbtype) delete folder.fid_dbtype;
+			var chkid = folder.pfid.toString() + "\t" + folder.fid_title;
+			if(folders_name[chkid] && folders_name[chkid].length>1){
+				var cnt;
+				var folders_name_arr = folders_name[chkid];
+				for(cnt=0;cnt<folders_name_arr.length;cnt++){
+					if(folders_name_arr[cnt] != folder.fid) continue;
+					var chkid = folder.pfid.toString() + "\t" + folder.fid_title + " (" + (cnt+1).toString() + ")";
+					while(folders_name[chkid]){
+						cnt++;
+						chkid = folder.pfid.toString() + "\t" + folder.fid_title + " (" + (cnt+1).toString() + ")";
+					}
+					folder.fid_title += " (" + (cnt+1).toString() + ")";
+					folders_name[chkid] = [];
+					folders_name[chkid].push(folder.fid);
+					break;
+				}
+			}
+			if(folder.fid_property){
+				try{
+					var parser = new DOMParser();
+					var xmldoc = parser.parseFromString(folder.fid_property, "text/xml");
+					if(xmldoc && xmldoc.documentElement.nodeName == "parsererror") xmldoc = undefined;
+					if(xmldoc){
+						var elem = xmldoc.getElementsByTagName("DICTIONARY")[0];
+						if(elem){
+							var xmldic = parser.parseFromString("<DICTIONARY/>", "text/xml");
+							if(xmldic && xmldic.documentElement.nodeName == "parsererror") xmldic = undefined;
+							if(xmldic){
+								var nodecnt;
+								for(nodecnt=0;nodecnt<elem.childNodes.length;nodecnt++){
+									xmldic.documentElement.appendChild(elem.childNodes[nodecnt].cloneNode(true));
+								}
+								window.top.bitsTreeProjectService._putDictionaryXML(folder.fid,fid_dbtype,xmldic);
+								xmldic = undefined;
+							}
+							var parentNode = elem.parentNode;
+							parentNode.removeChild(elem);
+							parentNode.normalize();
+						}
+						var s = new XMLSerializer();
+						folder.fid_property = s.serializeToString(xmldoc);
+						s = undefined;
+						xmldoc = undefined;
+					}
+					parser = undefined;
+				}catch(e){
+					mcXmlImportService._dump("mcXmlImportService.loadFile():"+e);
+				}
+			}
+			var rtn = this.Database.addFolder(folder,fid_dbtype,aTransaction);
+			if(rtn){
+				var newItem = this.Common.newItem();
+				newItem.id = folder.fid;
+				newItem.about = this.DataSource.getAbout(folder.fid,folder.pfid,fid_dbtype);
+				newItem.pfid = folder.pfid;
+				newItem.title = folder.fid_title;
+				newItem.type = "folder";
+				newItem.style = folder.fid_style;
+				newItem.cssrule = 'css_'+fid_dbtype+'_'+newItem.fid;
+				newItem.dbtype = fid_dbtype;
+				newItem.editmode = folder.fid_mode;
+				var tarResName, tarRelIdx;
+				if(folders[folder.pfid]){
+					tarResName = this.DataSource.getID2About(folders[folder.pfid].fid,folders[folder.pfid].pfid,fid_dbtype);
+				}else{
+					tarResName = aParName;
+				}
+				try{
+					var cont = this.DataSource.getContainer(tarResName, false);
+					tarRelIdx  = cont.GetCount();
+				}catch(ex){
+					tarRelIdx = -1;
+				}
+				var newRes = this.DataSource.addItem(newItem, tarResName, tarRelIdx, fid_dbtype);
+				if(newRes && newRes.Value){
+					this.DataSource.createEmptySeq(newRes.Value);
+					if(!newAddRes) newAddRes = newRes;
+				}
+			}
+		}
+
+		var tarResName;
+		for(key in objects){
+			if(typeof objects[key] == "function") continue;
+			var oid_dbtype = dbtype;
+			var object = objects[key];
+			if(object.oid_dbtype) delete object.oid_dbtype;
+			var rtn = this.Database.addObject(object,oid_dbtype,aTransaction);
+			if(rtn && !(mcItemView && mcItemView.isChecked)){
+				if(folders[object.pfid]){
+					tarResName = this.DataSource.getID2About(folders[object.pfid].fid,folders[object.pfid].pfid,oid_dbtype);
+				}else{
+					tarResName = aParName;
+				}
+				this.DataSource.addItem(this.Database.makeObjectToItem(object),tarResName,-1,oid_dbtype);
+			}
+		}
+		var regexp_png = new RegExp("^data:image/\\w+;base64,");
+		var attr = "oid_img";
+		for(i=0;i<elemLIST.length;i++){
+			var elemAttr = elemLIST[i].getElementsByTagName(attr.toUpperCase());
+			for(k=0;k<elemAttr.length;k++){
+				var id = elemAttr[k].parentNode.getAttribute("id");
+				var oid_dbtype = dbtype;
+				var textContent = elemAttr[k].textContent;
+				if(regexp_png.test(textContent)) this.Database.updateObjectBLOB(id,textContent,oid_dbtype,aTransaction);
+			}
+		}
+		regexp_png = undefined;
+		if(!aTransaction) this.Database.endTransaction(dbtype);
+
+		this.DataSource.flush();
+		mcTreeCssService.init();
+		if(mcTreeHandler){
+			var selectIdx;
+			var resArr = [aRes];
+			var parentRes = aRes;
+			do{
+				parentRes = this.DataSource.findParentResource(parentRes);
+				if(parentRes) resArr.unshift(parentRes);
+			}while(parentRes && parentRes.Value != this.DataSource.ABOUT_ROOT);
+			for(var i=0;i<resArr.length;i++){
+				selectIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(resArr[i]);
+				if(selectIdx>=0 && !mcTreeHandler.TREE.view.isContainerOpen(selectIdx)) mcTreeHandler.TREE.view.toggleOpenState(selectIdx);
+			}
+			if(newAddRes){
+				setTimeout(function(){
+					var newIdx = mcTreeHandler.TREE.builderView.getIndexOfResource(newAddRes);
+					if(newIdx>=0){
+						mcTreeHandler.TREE.currentIndex = newIdx;
+						if(!mcTreeHandler.TREE.view.selection.isSelected(mcTreeHandler.TREE.currentIndex)) mcTreeHandler.TREE.view.selection.select(mcTreeHandler.TREE.currentIndex);
+						mcTreeHandler.TREE.focus();
+						mcTreeHandler.TREE.treeBoxObject.ensureRowIsVisible(newIdx);
+						if(mcPropertyView) mcPropertyView.dispProperty(mcTreeHandler.object);
+						if(mcItemView && mcItemView.isChecked) mcItemView.onTreeClick();
+					}
+				},500);
+			}
+		}
+		return true;
+	},
+
+/////////////////////////////////////////////////////////////////////
+	_dump : function(aString){
+		window.top.bitsMarkingCollection._dump(aString);
+	},
+
+};
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/about.properties
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/about.properties	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/about.properties	(revision 5703)
@@ -0,0 +1,5 @@
+# extensions.{e36db930-f18d-4449-b45f-e286cfb9e03a}.description=Put permanent marker line on web pages in many colors and shapes / option.
+# extensions.{e36db930-f18d-4449-b45f-e286cfb9e03a}.description=Annotate fragments of web documents with tags, colors and text notes.
+# extensions.webannotator@dasish.eu.description=Annotate web documents with text notes, colors and tags.
+extensions.webannotator@dasish.eu.description=Annotate web documents with text notes, titles and colours.
+
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/articlenavigation.properties
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/articlenavigation.properties	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/articlenavigation.properties	(revision 5703)
@@ -0,0 +1,3 @@
+APP_TITLE=DWAN
+# APP_TITLE=WiredMarker
+APP_DISP_TITLE=Wired-Marker
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/marker.dtd
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/marker.dtd	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/marker.dtd	(revision 5703)
@@ -0,0 +1,16 @@
+<!ENTITY marker.initdata.overlay.groupbox.caption       "Initial input of marker">
+<!ENTITY marker.initdata.overlay.title.groupbox.caption "Title">
+<!-- <!ENTITY marker.initdata.overlay.note.groupbox.caption  "Note"> -->
+<!ENTITY marker.initdata.overlay.note.groupbox.caption  "Annotation">
+<!ENTITY marker.initdata.overlay.radio.label.text       "Selected Text">
+<!ENTITY marker.initdata.overlay.radio.label.title      "Page Title">
+<!ENTITY marker.initdata.overlay.radio.label.date       "Date">
+<!ENTITY marker.initdata.overlay.radio.label.format     "Specify Format">
+<!ENTITY marker.initdata.overlay.radio.label.none       "None">
+<!ENTITY marker.initdata.overlay.checkbox.edit          "Edit when registering a marker">
+
+<!ENTITY marker.initdata.dialog.title       "Edit Marker information">
+<!ENTITY marker.initdata.dialog.label.title "Title">
+<!-- <!ENTITY marker.initdata.dialog.label.note  "Note"> -->
+<!ENTITY marker.initdata.dialog.label.note  "Annotation">
+<!ENTITY marker.initdata.dialog.emptytext.title "Please make sure to specify a title">
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/markerCustom.dtd
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/markerCustom.dtd	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/markerCustom.dtd	(revision 5703)
@@ -0,0 +1,27 @@
+<!ENTITY markingcollection.markerCustom.preset "Preset style">
+<!ENTITY markingcollection.markerCustom.background "Background">
+<!ENTITY markingcollection.markerCustom.color "Color">
+<!ENTITY markingcollection.markerCustom.text "Text">
+<!ENTITY markingcollection.markerCustom.bold "Bold">
+<!ENTITY markingcollection.markerCustom.italic "Italic">
+<!ENTITY markingcollection.markerCustom.line "Strike through">
+<!ENTITY markingcollection.markerCustom.border "Border">
+<!ENTITY markingcollection.markerCustom.type "Type">
+<!ENTITY markingcollection.markerCustom.box "Box">
+<!ENTITY markingcollection.markerCustom.underline "Underline">
+<!ENTITY markingcollection.markerCustom.style "Style">
+<!ENTITY markingcollection.markerCustom.solid "Solid">
+<!ENTITY markingcollection.markerCustom.dotted "Dotted">
+<!ENTITY markingcollection.markerCustom.dashed "Dashed">
+<!ENTITY markingcollection.markerCustom.double "Double">
+<!ENTITY markingcollection.markerCustom.groove "Groove">
+<!ENTITY markingcollection.markerCustom.ridge "Ridge">
+<!ENTITY markingcollection.markerCustom.inset "Inset">
+<!ENTITY markingcollection.markerCustom.outset "Outset">
+
+<!ENTITY markingcollection.markerCustom.width "Width">
+<!ENTITY markingcollection.markerCustom.thin "Thin">
+<!ENTITY markingcollection.markerCustom.medium "Medium">
+<!ENTITY markingcollection.markerCustom.thick "Thick">
+
+<!ENTITY markingcollection.markerCustom.enabled "Enabled">
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/markingcollection.dtd
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/markingcollection.dtd	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/markingcollection.dtd	(revision 5703)
@@ -0,0 +1,315 @@
+<!ENTITY markingcollection.app.menu.title "BITS">
+<!-- <!ENTITY markingcollection.app.title "Wired-Marker"> -->
+<!ENTITY markingcollection.app.title "DASISH Web Annotator">
+
+<!ENTITY markingcollection.general "General">
+<!ENTITY markingcollection.concordance "Concordance">
+<!ENTITY markingcollection.concordance.sidebar "Link with sidebar">
+<!ENTITY markingcollection.concordance.display "Always display">
+<!ENTITY markingcollection.concordance.none "Do not display">
+
+<!ENTITY markingcollection.display.style "Sidebar Layout (*Requires Firefox restart)">
+<!ENTITY markingcollection.display.itemview      "Layout style for folders and objects">
+<!ENTITY markingcollection.display.itemview.lr   "right and left">
+<!ENTITY markingcollection.display.itemview.tb   "up and down">
+<!ENTITY markingcollection.display.itemview.none "together">
+
+<!ENTITY markingcollection.contextmenu.type "Contextmenu Layout">
+<!ENTITY markingcollection.contextmenu.type.full   "Normal Menu">
+<!ENTITY markingcollection.contextmenu.type.simple "Simple Menu">
+
+<!ENTITY markingcollection.menu "Menu">
+<!ENTITY markingcollection.menu.title "BITS">
+<!ENTITY markingcollection.menu.addon "Add-ons">
+<!ENTITY markingcollection.menu.option "Option">
+<!ENTITY markingcollection.menu.disptopmenu "Show Wired-Marker menu on the top menu">
+<!ENTITY markingcollection.menu.project "Document Index">
+<!ENTITY markingcollection.menu.documents "Block registration">
+<!ENTITY markingcollection.menu.dictionary "Dictionary">
+<!ENTITY markingcollection.menu.anchor "Anchor">
+<!ENTITY markingcollection.menu.caption "Position menu">
+<!ENTITY markingcollection.menu.appmenu "App menu">
+<!ENTITY markingcollection.menu.topmenu "Top menu">
+<!ENTITY markingcollection.menu.bookmarks "Bookmarks menu">
+<!ENTITY markingcollection.menu.tools "Tools menu">
+
+<!ENTITY markingcollection.new.folder "New folder">
+<!ENTITY markingcollection.new.defaultFolder "Empty folder">
+<!ENTITY markingcollection.new.templateFolder "Template folder">
+<!ENTITY markingcollection.new.projectFolder "Project folder">
+<!ENTITY markingcollection.new.dictionaryFolder "Dictionary folder">
+<!ENTITY markingcollection.new.documentsFolder "Documents folder">
+
+<!ENTITY markingcollection.toggle.all "Open/close all the folders">
+<!ENTITY markingcollection.tools.settings "Settings">
+<!ENTITY markingcollection.tools.label.accept "Close">
+<!ENTITY markingcollection.tools.key.accept "C">
+
+<!ENTITY markingcollection.open "Open">
+<!ENTITY markingcollection.open.newtab "Open in a new tab">
+
+<!ENTITY markingcollection.export "Export">
+<!ENTITY markingcollection.remove "Delete">
+<!ENTITY markingcollection.remove.folder "Folder">
+<!ENTITY markingcollection.remove.folderall "All folders below">
+<!ENTITY markingcollection.remove.itemall "All objects below">
+
+<!ENTITY markingcollection.edit.replacedURL "Replace URL">
+<!ENTITY markingcollection.edit.searched "Search">
+<!ENTITY markingcollection.edit.replaced "Replace">
+<!ENTITY markingcollection.edit.getURL "Acquire URL">
+<!ENTITY markingcollection.edit.displayURL "Acquire current page URL">
+<!ENTITY markingcollection.edit.folderURL "Acquire URL from a folder">
+<!ENTITY markingcollection.edit.replacedTarget "Replacement target">
+<!ENTITY markingcollection.edit.replacedTarget.directory "Directory">
+<!ENTITY markingcollection.edit.replacedTarget.file "File">
+
+<!ENTITY markingcollection.property "Properties">
+<!ENTITY markingcollection.itemview "Item view">
+<!ENTITY markingcollection.listview "List view">
+<!ENTITY markingcollection.treelistview "Tree list view">
+<!ENTITY markingcollection.treelistview.defaults "Defaults">
+<!ENTITY markingcollection.addon "Add-ons">
+
+<!ENTITY markingcollection.prop.title "Title">
+<!-- <!ENTITY markingcollection.prop.note "Note"> -->
+<!ENTITY markingcollection.prop.note "Annotation">
+<!ENTITY markingcollection.prop.general "Brief overview">
+<!ENTITY markingcollection.prop.tag "Tag">
+<!ENTITY markingcollection.prop.tag.emptytext "Same title">
+<!ENTITY markingcollection.prop.extended_message "Extended message">
+<!ENTITY markingcollection.prop.metacapture "Page title">
+
+<!ENTITY markingcollection.folder.openall "Open all in tabs">
+
+
+<!ENTITY markingcollection.defaultFolder "All view">
+<!ENTITY markingcollection.rootFolder "Display folders below this">
+<!ENTITY markingcollection.rootTree "Tree">
+<!ENTITY markingcollection.rootSelectFolder "Display below selected folders">
+
+<!ENTITY markingcollection.templateFolder "Template">
+<!ENTITY markingcollection.templateFolder.create "Make">
+<!ENTITY markingcollection.templateFolder.remove "Delete">
+<!ENTITY markingcollection.filter "Filter">
+<!ENTITY markingcollection.import "Import">
+<!ENTITY markingcollection.importTagAll "Automatic object collection">
+<!ENTITY markingcollection.export "Export">
+<!ENTITY markingcollection.sharedFolder "Change location of shared folder">
+<!ENTITY markingcollection.mergeFolder "Change merge folder location">
+<!ENTITY markingcollection.folderAutoOpen "Do not expand a folder after dropping a object">
+
+<!ENTITY markingcollection.repository "Repository">
+<!ENTITY markingcollection.repository.folder "Folder">
+<!ENTITY markingcollection.repository.user "User">
+<!ENTITY markingcollection.repository.merge "Merge">
+<!ENTITY markingcollection.repository.settings "Settings">
+<!ENTITY markingcollection.repository.folderall "All folders below">
+<!ENTITY markingcollection.repository.itemall "All objects below">
+<!ENTITY markingcollection.repository.import "import">
+
+<!ENTITY markingcollection.viewMode "View mode">
+<!ENTITY markingcollection.viewMode.single "Single">
+<!ENTITY markingcollection.viewMode.all "All">
+<!ENTITY markingcollection.viewMode.each "Each">
+
+<!ENTITY markingcollection.analyze "Automated recognition">
+
+<!ENTITY markingcollection.newDatabase "New database">
+<!ENTITY markingcollection.newDatabase.newLocalDatabase "Local database">
+
+
+<!ENTITY markingcollection.pref.edit "Edit">
+<!ENTITY markingcollection.button.customize "Customize">
+<!ENTITY markingcollection.button.update "Update">
+
+<!ENTITY markingcollection.marker "Marker">
+<!-- <!ENTITY markingcollection.marker.remove "Clear this marker"> -->
+<!ENTITY markingcollection.marker.remove "Clear this annotation">
+<!-- <!ENTITY markingcollection.marker.remove.all "Clear all markers of this page"> -->
+<!ENTITY markingcollection.marker.remove.all "Clear all annotations on this page">
+<!-- <!ENTITY markingcollection.marker.remarker "Alter marking range to selected range"> -->
+<!ENTITY markingcollection.marker.remarker "Alter annotation range to selected range">
+<!ENTITY markingcollection.marker.uncategorized 'Register in "Uncategorized"'>
+
+<!ENTITY markingcollection.icon_size "Icon size">
+<!ENTITY markingcollection.icon_size.large "Large">
+<!ENTITY markingcollection.icon_size.small "Small">
+
+<!ENTITY markingcollection.shortcut "Shortcut">
+
+<!ENTITY markingcollection.database "Database">
+<!ENTITY markingcollection.database.vacuum "Vacuum">
+<!ENTITY markingcollection.database.name "Title">
+<!ENTITY markingcollection.database.filename "Filename">
+<!ENTITY markingcollection.database.comment "Comment">
+<!ENTITY markingcollection.database.status "Status">
+<!ENTITY markingcollection.database.add "Add">
+<!ENTITY markingcollection.database.set "Set">
+<!ENTITY markingcollection.database.del "Remove from list">
+<!ENTITY markingcollection.database.dis "Use/Unuse">
+<!ENTITY markingcollection.database.startupalldbunused "Unuse all on start-up">
+<!ENTITY markingcollection.database.use "Use">
+<!ENTITY markingcollection.database.contextmenu "Display on context menu">
+<!ENTITY markingcollection.database.default "Default">
+
+<!ENTITY markingcollection.server.tab "Server">
+<!ENTITY markingcollection.server.groupbox.caption "Select the back-end server for the annotation client">
+<!ENTITY markingcollection.server.rest.default "Default">
+<!ENTITY markingcollection.server.rest.userdefined "User-specified">
+
+<!ENTITY markingcollection.key.sidebar "X">
+<!ENTITY markingcollection.key.menubar "M">
+
+
+<!ENTITY markingcollection.filter "Filter">
+<!ENTITY markingcollection.filter.availableness "ON">
+<!ENTITY markingcollection.filter.invalidation "OFF">
+<!ENTITY markingcollection.filter.keyword "Keyword">
+<!ENTITY markingcollection.filter.casesensitive "Case sensitive">
+
+<!ENTITY markingcollection.capture "Capture">
+<!ENTITY markingcollection.capture.all "All document">
+<!ENTITY markingcollection.capture.cut "Cutout">
+<!ENTITY markingcollection.capture.document "Document">
+<!ENTITY markingcollection.capture.clipboard "Clipboard">
+<!ENTITY markingcollection.capture.title "Title">
+<!ENTITY markingcollection.capture.document_link "Link with the current document">
+<!ENTITY markingcollection.capture.all_select "Select All">
+
+<!ENTITY markingcollection.hyperanchor.icon_caption "When hyperlink of HYPER-ANCHOR format exists in the web page">
+<!ENTITY markingcollection.hyperanchor.icon_display_left "Always display icons to the left of each hyperlink">
+<!ENTITY markingcollection.hyperanchor.icon_display_right "Always display icons to the right of each hyperlink">
+<!ENTITY markingcollection.hyperanchor.icon_display_left_popup "Display an icon to the left of the hyperlink on mouse over">
+<!ENTITY markingcollection.hyperanchor.icon_display_right_popup "Display an icon to the right of the hyperlink on mouse over">
+<!ENTITY markingcollection.hyperanchor.icon_none "Do nothing">
+<!ENTITY markingcollection.hyperanchor.icon_attention "*If a web page is already opened, changes will not be applied. Please reload to apply the changes.">
+
+<!ENTITY markingcollection.hyperanchor.alignment_caption "If the marker position is staggering due to the update of document">
+<!ENTITY markingcollection.hyperanchor.alignment_length "Search, for specified number of characters, the characters around to find the correct position marker">
+<!ENTITY markingcollection.hyperanchor.alignment_attention "*If the number is 0, no correction will be made.">
+
+<!ENTITY markingcollection.hyperanchor.copy_to_clipboard "Copy the location marker(HYPER-ANCHOR Format)">
+<!ENTITY markingcollection.hyperanchor.sidebar_copy_to_clipboard "Copy">
+
+<!ENTITY markingcollection.favorite "Folder">
+<!ENTITY markingcollection.favorite.add "Add this folder as a working folder">
+<!ENTITY markingcollection.favorite.select_folder_add "Add the selected folder">
+
+<!ENTITY markingcollection.substitutiontree.add  "Add">
+<!ENTITY markingcollection.substitutiontree.edit "Edit">
+<!ENTITY markingcollection.substitutiontree.del  "Del">
+<!ENTITY markingcollection.substitutiontree.src  "File name">
+<!ENTITY markingcollection.substitutiontree.alt  "Substitute text">
+<!ENTITY markingcollection.substitutiontree.table  "Substitution table">
+<!ENTITY markingcollection.substitutiontree.confirm  "Check in cases when image file does not exist on substitution table.">
+
+<!ENTITY markingcollection.selectimportimage  "How to process images in the selected area.">
+<!ENTITY markingcollection.selectimportimage.none  "No processing">
+<!ENTITY markingcollection.selectimportimage.alt  "Substitute with the text of ALT attribute">
+<!ENTITY markingcollection.selectimportimage.substitution  "Use substitution table">
+<!ENTITY markingcollection.selectimportimage.substitution_alt  "Use substitution table or substitute with the text of ALT attribute (*Priority for substitution table)">
+<!ENTITY markingcollection.selectimportimage.alt_substitution  "Substitute with the text of ALT attribute or use substitution table (*Priority for ALT attribute)">
+
+<!ENTITY markingcollection.project.documents.select.folder  "Specify a folder">
+<!ENTITY markingcollection.project.documents.select.file  "Specify files">
+<!ENTITY markingcollection.project.dictionary.read "Read in the dictionary">
+<!ENTITY markingcollection.project.dictionary.save "Write the dictionary">
+<!ENTITY markingcollection.project.dictionary.management "Management dictionary">
+<!ENTITY markingcollection.project.dictionary.apply "Apply the dictionary">
+<!ENTITY markingcollection.project.dictionary.edit "Add to dictionary">
+<!ENTITY markingcollection.project.dictionary.item.add "Add">
+<!ENTITY markingcollection.project.dictionary.item.del "Invalidity">
+<!ENTITY markingcollection.project.dictionary.item.search "Search">
+<!ENTITY markingcollection.project.index.menu.caption "Subject Index">
+<!ENTITY markingcollection.project.index.menu.display "Display">
+<!ENTITY markingcollection.project.index.menu.save "Save">
+<!ENTITY markingcollection.project.index.menu.display.normal "Default">
+<!ENTITY markingcollection.project.index.menu.display.url "URL display">
+
+<!ENTITY markingcollection.tagoutput.menu.title "Output with the tag">
+<!ENTITY markingcollection.tagoutput.menu.save "Save">
+<!ENTITY markingcollection.tagoutput.menu.with_style "Save(With the style)">
+<!ENTITY markingcollection.tagoutput.output.caption "Output form of the tag">
+<!ENTITY markingcollection.tagoutput.style.caption "Style sheet of the tag">
+<!ENTITY markingcollection.tagoutput.style.no_style "No style">
+<!ENTITY markingcollection.tagoutput.style.with_style "With style">
+<!ENTITY markingcollection.tagoutput.visibility.caption "When a reference in your browser">
+<!ENTITY markingcollection.tagoutput.visibility.visible "Tag to appear">
+<!ENTITY markingcollection.tagoutput.visibility.hidden "Hide tags">
+<!ENTITY markingcollection.tagoutput.visibility.description1 "Warning : Tag does not hide">
+<!ENTITY markingcollection.tagoutput.visibility.description2 "Start with an alphabetic letter.">
+<!ENTITY markingcollection.tagoutput.format.caption "Output file format">
+<!ENTITY markingcollection.tagoutput.html.caption "If the target file in HTML format">
+<!ENTITY markingcollection.tagoutput.html.path "Convert relative path to absolute path for images and links.">
+
+<!ENTITY markingcollection.textplain "MIME type (text / plain) Format">
+<!ENTITY markingcollection.textplain.usually  "Usually (No wrapping)">
+<!ENTITY markingcollection.textplain.confirm  "When the wrapping area to be searched for">
+<!ENTITY markingcollection.textplain.wrapping "Always display in the browser to fit within an area of the wrapping">
+<!ENTITY markingcollection.textplain.attr             "An indication attribute after the automatic new line">
+<!ENTITY markingcollection.textplain.background-color "Background color">
+<!ENTITY markingcollection.textplain.font-family      "Font">
+<!ENTITY markingcollection.textplain.font-size        "Font size">
+
+<!ENTITY markingcollection.autocache.tab "Auto-caching">
+<!ENTITY markingcollection.autocache.caption "Auto-caching">
+<!ENTITY markingcollection.autocache.tooltiptext "Caching">
+<!-- <!ENTITY markingcollection.autocache.open "Open cache"> -->
+<!ENTITY markingcollection.autocache.open "Open local cache">
+<!-- <!ENTITY markingcollection.autocache.open.newtab "Open a new tab"> -->
+<!ENTITY markingcollection.autocache.open.newtab "Open local cache in new tab">
+<!ENTITY markingcollection.autocache.open.remote "Open remote cache">
+<!ENTITY markingcollection.autocache.open.remotenewtab "Open remote cache in new tab">
+<!ENTITY markingcollection.autocache.past "Cache list">
+<!ENTITY markingcollection.autocache.disabled "Disabled">
+<!ENTITY markingcollection.autocache.switching "Manually">
+<!ENTITY markingcollection.autocache.valid "Enable">
+<!ENTITY markingcollection.autocache.marking "Marking the cached document">
+<!ENTITY markingcollection.autocache.marking.disabled "Prohibit">
+<!ENTITY markingcollection.autocache.marking.confirm "Confirm when marking">
+<!ENTITY markingcollection.autocache.marking.valid "Enable">
+<!ENTITY markingcollection.autocache.manually.caption "Run manually">
+<!ENTITY markingcollection.autocache.manually.confirm "Check on runtime">
+<!-- <!ENTITY markingcollection.autocache.cache "Local Cache"> -->
+<!ENTITY markingcollection.autocache.cache "Cached Representations">
+<!ENTITY markingcollection.autocache.list "Cache list">
+<!ENTITY markingcollection.autocache.list.open "Open">
+<!ENTITY markingcollection.autocache.list.close "Close">
+<!ENTITY markingcollection.autocache.remove "Delete Cache">
+<!ENTITY markingcollection.autocache.timestamp "Cache time">
+<!ENTITY markingcollection.autocache.filesize "Size">
+<!ENTITY markingcollection.autocache.open.all "Open all of this cache">
+<!ENTITY markingcollection.autocache.remove.all "Delete all of this cache">
+<!ENTITY markingcollection.autocache.view "Cache List">
+<!ENTITY markingcollection.autocache.view.tooltiptext "Cache List (Show / Hide)">
+<!ENTITY markingcollection.autocache.save.folder "Saving location">
+<!ENTITY markingcollection.autocache.save.user "User-specified">
+<!ENTITY markingcollection.autocache.save.default "Default">
+<!ENTITY markingcollection.autocache.topmenu.caption "Top menu">
+<!ENTITY markingcollection.autocache.topmenu.display "Display">
+<!ENTITY markingcollection.autocache.topmenu.number "Display number">
+<!ENTITY markingcollection.autocache.topmenu.attention "*If the number is 0, all of the cache will be displayed.">
+
+<!ENTITY markingcollection.shortcut.tab "Shortcut">
+<!ENTITY markingcollection.shortcut.add  "Add">
+<!ENTITY markingcollection.shortcut.edit "Edit">
+<!ENTITY markingcollection.shortcut.del  "Del">
+<!ENTITY markingcollection.shortcut.disptree  "Display the shortcut key to the folder on tree">
+<!ENTITY markingcollection.shortcut.attention1 "*For shortcut to the folder, set from properties screen of each folder.">
+<!ENTITY markingcollection.shortcut.attention2 "*Use the definition above if a duplicate of shortcut key.">
+<!ENTITY markingcollection.shortcut.attention_modifiers "*Press the modifier key and any selected key to specify.">
+
+<!ENTITY markingcollection.setting.view "View">
+<!ENTITY markingcollection.setting.marker "Marker">
+<!ENTITY markingcollection.setting.markerinitdata "Initial input of marker">
+<!ENTITY markingcollection.setting.imagecapture "Image capture">
+<!ENTITY markingcollection.setting.pubmedcentral "PubMed Central">
+<!ENTITY markingcollection.setting.uncategorized "Uncategorized folder">
+<!ENTITY markingcollection.setting.uncategorized.use "Use">
+<!ENTITY markingcollection.setting.protocol "Protocol">
+<!ENTITY markingcollection.setting.marker.mouseover "When mouse over on marker">
+<!ENTITY markingcollection.setting.marker.mouseover.disptooltip "Display object information">
+<!ENTITY markingcollection.setting.marker.mouseover.title "Title">
+<!-- <!ENTITY markingcollection.setting.marker.mouseover.note "Note"> -->
+<!ENTITY markingcollection.setting.marker.mouseover.note "Annotation">
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/markingcollection.properties
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/markingcollection.properties	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/markingcollection.properties	(revision 5703)
@@ -0,0 +1,145 @@
+APP_TITLE=DWAN
+# APP_TITLE=WiredMarker
+# APP_DISP_TITLE=Wired-Marker
+APP_DISP_TITLE=DASISH Web Annotator
+# APP_ID={e36db930-f18d-4449-b45f-e286cfb9e03a}
+APP_ID=webannotator@dasish.eu
+APP_SHORTCUT_TITLE=Wired-Marker start shortcut
+
+MARKER_FOLDER=Marker
+LOCAL_FOLDER=Local folder
+SHARED_FOLDER=Shared folder
+MERGE_FOLDER=Merge folder
+# UN_FOLDER=Uncategorized
+UN_FOLDER=Incoming
+UN_FOLDER_STYLE=border:thin dotted rgb(255,204,0);background-color:rgb(255,255,204);color:rgb(0,0,0);
+DEFAULT_FOLDER=All view
+SELECT_DISP_FOLDER=Display folders below this
+ROOT_FOLDER=Root folder
+ERROR_INVALID_URL=Error: Invalid URL.
+ERROR_INVALID_TITLE=Error: Same title exists.
+ERROR_NOT_ENTER_TITLE=error: Title not entered
+WARNING_NOT_BEGIN_ENGLISH_TAG=Warning: Can not work with implantation tag if tag does not start with alphabetical letter.
+
+CONFIRM_DELETE=Do you really want to delete?
+CONFIRM_DELETE_ALL=Do you really want to clear all markers?
+CONFIRM_REPOSITORY_MERGE=Do you really want to merge the repository and data?
+CONFIRM_REPOSITORY_IMPOER=Do you really want to take in data from the repository?
+CONFIRM_REPOSITORY_DELETE_FOLDER=Do you really want to delete lower folders in the repository?
+CONFIRM_REPOSITORY_DELETE_OBJECT=Do you really want to delete objects in the repository?
+CONFIRM_REPOSITORY_ADD_FOLDER=Do you really want to add a folder in the repository?
+CONFIRM_REPOSITORY_ADD_OBJECT=Do you really want to add an object in the repository?
+CONFIRM_REPOSITORY_UPDATE_FOLDER=Do you really want to update folder(s) in the repository?
+CONFIRM_REPOSITORY_UPDATE_OBJECT=Do you really want to update object(s) in the repository?
+
+CONFIRM_MERGE=Do you want to merge objects in the folder?
+
+
+CONFIRM_UPDATE_FOLDER=Do you really want to update a folder?
+CONFIRM_UPDATE_OBJECT=Do you really want to update an object?
+
+SELECTED_SHARED_FOLDER=Please select a shared folder.
+SELECTED_MERGE_FOLDER=Please select a merge folder.
+SELECTED_REPOSITORY_FOLDER=Please select a folder to use as a repository.
+
+BUSY_REPOSITORY=As the repository is busy now, the operation is unable to execute.
+
+CONFIRM_TEMPLATE_UPDATE=There is a same title template. Do you really want to overwrite it?
+TEMPLATE_MARKER_FOLDER_COMMENT=Default folder template
+TEMPLATE_MARKER_TITLE=Folder template
+DEL_TEMPLATE_MARKER=Delete folder template
+
+ADD_STYLESHEET=Add
+CONFIRM_UPDATE_STYLESHEET=There is a same name style sheet. Do you really want to overwrite it?
+DEL_STYLESHEET=Delete
+STYLESHEET=Style sheet
+
+CONFIRM_XML_IMPOER=Do you want to take in data from XML file?
+CHECK_XML_IMPOER_CACHE_DOCUMENT=Cache of captured documents
+ERROR_ZIP_ANALYSIS=Failed in the analysis of the zip file. \nAfter development a zip file, drop an XML file directly.
+
+CONFIRM_AUTO_ANALYZE=Do you really want to perform automatic recognition again?
+
+CAPTURE_CLIPBOARD_NO_IMAGE=There is no imagedata in a clipboard.
+
+CONFIRM_ADDON_FOLDER_ATTR_CHANGE=Do you really want to change to the attribute of the add-on?
+
+CONFIRM_COPYOBJECT_OVERWRITE=Copy object exists in the destination folder. Do you really want to overwrite?
+ALERT_COPYOBJECT_EXISTS=A copy object already exists in the copy destination folder.
+
+CONFIRM_EXPORT=Ready to export folders?
+CHECK_EXPORT_IN_CACHE_DOCUMENT=Export cache document as well
+SUCCEEDED_EXPORT=The folder was exported successfully.
+
+REPLACED_URL=Replace URL
+CONFIRM_REPLACED_URL= object(s) will be replaced. Do you really want to replace URLs?
+ALERT_REPLACED_URL=There is no replaceable object.
+MSG_REPLACED_URL=Reflecting the changed contents.
+CONFIRM_REPLACED_TARGET=Do you really want to replace all of the lower layer objects of the folder?
+CONFIRM_REPLACED_TITLE=URL substitution
+
+MSG_DATABASE_USE=In use
+MSG_USE_TITLE=Item in use
+MSG_DATAFILE=Data file
+MSG_ADD_DATAFILE=Add data file
+CONFIRM_NEW_DATAFILE=Do you want to make a new data file?
+ERROR_ADD_DATAFILE_3=Specified file is already used.\nDo you want to specify again?
+MSG_EXISTING_DATABASE=No, use the existing data file.
+
+MSG_LOADING_SCRAP=Loading Wired-Marker data.
+
+MARKER_CUSTOM_1=background-color: rgb(253,  49,  31); color: rgb(0, 0, 0);
+MARKER_CUSTOM_2=background-color: rgb( 44, 254,  81); color: rgb(0, 0, 0);
+MARKER_CUSTOM_3=background-color: rgb(206,  56, 200); color: rgb(0, 0, 0);
+MARKER_CUSTOM_4=background-color: rgb(  0,  55, 153); color: rgb(255, 255, 255);
+MARKER_CUSTOM_5=background-color: rgb(  0, 154, 156); color: rgb(0, 0, 0);
+MARKER_CUSTOM_6=background-color: rgb( 51, 205,  52); color: rgb(0, 0, 0);
+MARKER_CUSTOM_7=background-color: rgb(255, 205,  54); color: rgb(0, 0, 0);
+MARKER_CUSTOM_8=background-color: rgb(255, 100,  31); color: rgb(0, 0, 0);
+
+CONFIRM_SETTING_CHANGE_RESTART_APP=Your changes will be applied after restarting Firefox. Do you want to restart now?
+
+CONFIRM_REGISTERED_FAVORITE_FOLDER=Specified folder is already registered.\nDo you want to add?
+
+ALERT_REGISTERED=Already registered
+
+CONFIRM_SUBSTITUTION_TABLE_NONE=Alternating text of selected image does not exist on the substituting table.\nDo you want to add?
+
+MSG_SUBSTITUTION_ADD=ADD
+MSG_SUBSTITUTION_EDIT=EDIT
+MSG_SUBSTITUTION_FILENAME=Filename
+MSG_SUBSTITUTION_INPUT_FILENAME=Please input a filename
+MSG_SUBSTITUTION_INPUT_SUBSTITUTE_TEXT=Please input a substitute text
+
+MSG_IMPORT_TAG=Busy
+MSG_READING_DOCUMENTS=Reading document
+MSG_READING_DICTIONARY=Reading dictionary
+SUCCEEDED_READING_DICTIONARY=Read in the dictionary has been completed.
+CONFIRM_READING_DOCUMENTS_SELECT_OVER=Error occurred due to too many files being specified.\nDo you wan to register a file by specifying a folder?
+
+CONFIRM_BROWSER_TO_FIT_TEXT=Do you want to view displayed contents on browser with auto linefeed mode so that the content will fit on the screen?
+
+CONFIRM_CACHEPAGE_MARKING=This document is cached document. Marking may not reflect on the original document.\nIs that OK?
+ALERT_CACHEPAGE_MARKING=Due to a cached document, no marking possible.
+BUTTON_CACHEPAGE_MARKING=Open the original document
+CONFIRM_AUTOCACHE_MANUALLY_LAST=Time of last cached
+CONFIRM_AUTOCACHE_MANUALLY_EXEC=Cache documents?
+BUTTON_CACHEPAGE_OPEN=Open cached documents
+MSG_CACHEPAGE_NONE=There are no cached documents
+
+SUCCEEDED_INDEX=Successful in saving the [Subject Index].
+
+SUCCEEDED_DICTIONARY_UPDATE=Succeeded to update the dictionary.
+ALERT_DICTIONARY_UPDATE=For whatever reason has failed to update the dictionary.
+CONFIRM_DICTIONARY_UPDATE=The dictionary has not been created. Are you sure you want to create?
+MSG_DOCUMENTATION_TO_MATCH_THE_DICTIONARY=Verification of dictionary and document
+SUCCEEDED_DICTIONARY_SAVE=Successful in writing the dictionary.
+ALERT_DICTIONARY_NO_TERMS=The term does not exist in the dictionary.
+
+MSG_FILE_FORMAT_ORIGINAL=HTML or TEXT file formats
+MSG_FILE_FORMAT_HTML=HTML file format
+
+FAVORITEFOLDER_SELECT=Select
+FAVORITEFOLDER_DELETE=Delete
+
+CONFIRM_FILE_OVERWRITE=There are files in the folder specified. Overwrite?
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/meta.dtd
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/meta.dtd	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/meta.dtd	(revision 5703)
@@ -0,0 +1,23 @@
+<!ENTITY meta.dialog.capture.groupbox.caption          "Capture the metadata from documents">
+<!ENTITY meta.dialog.capture.groupbox.checkbox.confirm "Not to capture metadata at the marker">
+<!ENTITY meta.dialog.capture.tag.groupbox.caption      "Tags that capture">
+
+<!ENTITY meta.menuitem.hyperanchor.copy_to_clipboard       "HYPER-ANCHOR Code">
+<!ENTITY meta.menuitem.hyperanchor.copyformat_to_clipboard "Copy (User format)">
+<!ENTITY meta.menuitem.hyperanchor.copytitle_to_clipboard  "Title">
+<!ENTITY meta.menuitem.hyperanchor.copynote_to_clipboard   "Note">
+<!ENTITY meta.menuitem.hyperanchor.copymeta_to_clipboard   "Page Title">
+<!ENTITY meta.menuitem.hyperanchor.copyformatsetting       "Copy format settings">
+
+<!ENTITY meta.dialog.copyformat.checkbox.hyperanchor "Anchor tag">
+<!ENTITY meta.dialog.copyformat.checkbox.title       "Title">
+<!ENTITY meta.dialog.copyformat.checkbox.note        "Note">
+<!ENTITY meta.dialog.copyformat.checkbox.meta        "Page title">
+<!ENTITY meta.dialog.copyformat.checkbox.hash        "HYPER-ANCHOR Code to include the information to anchor the page (URL string after the #)">
+
+<!ENTITY meta.dialog.copyformat.radio.tag     "With tag">
+<!ENTITY meta.dialog.copyformat.radio.nonetag "No Tags">
+
+<!ENTITY meta.dialog.pubmedcentral.pdf.groupbox.caption              "When processing the document of PubMed Central">
+<!ENTITY meta.dialog.pubmedcentral.pdf.capture.checkbox.confirm      "Retrieve MEDLINE information from NCBI">
+<!ENTITY meta.dialog.pubmedcentral.pdf.substitution.checkbox.confirm "Replace the page title with the retrieved MEDLINE information">
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/objectmng.properties
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/objectmng.properties	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/objectmng.properties	(revision 5703)
@@ -0,0 +1,9 @@
+APP_TITLE=DWAN
+# APP_TITLE=WiredMarker
+APP_DISP_TITLE=Wired-Marker
+MARKER_FOLDER=Marker
+LOCAL_FOLDER=Local folder
+SHARED_FOLDER=Shared folder
+CONFIRM_DELETE=May I really delete it?
+CONVERT_DATABASE=Convert a database.
+CONVERT_END_DATABASE=The conversion of the database was finished. Reboot.
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/pdf.dtd
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/pdf.dtd	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/pdf.dtd	(revision 5703)
@@ -0,0 +1,8 @@
+<!ENTITY pdf.addtext.dialog.title  "Registration">
+<!ENTITY pdf.addtext.dialog.msg    "Is not marker, or to register the following information?">
+<!ENTITY pdf.addtext.caption.title "Title">
+<!ENTITY pdf.addtext.caption.url   "URL">
+<!-- <!ENTITY pdf.addtext.caption.note  "Note"> -->
+<!ENTITY pdf.addtext.caption.note  "Annotation">
+<!ENTITY pdf.addtext.caption.pageinfo  "Page info">
+<!ENTITY pdf.addtext.caption.pagetitle "Page title">
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/remap.dtd
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/remap.dtd	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/remap.dtd	(revision 5703)
@@ -0,0 +1,1 @@
+<!ENTITY remap.menuitem "Remap">
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/remap.properties
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/remap.properties	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/remap.properties	(revision 5703)
@@ -0,0 +1,3 @@
+CONFIRM_FIND_RESULTS=There are multiple intended strings. Do you want to remap?
+ALERT_FIND_RESULT=Intended string is not found.
+ALERT_MAP_RESULT=Remapping has been completed.
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/scrappartymerge.dtd
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/scrappartymerge.dtd	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/scrappartymerge.dtd	(revision 5703)
@@ -0,0 +1,28 @@
+<!ENTITY scrappartymerge.app.menu.title "BITS">
+<!ENTITY scrappartymerge.app.title "Merge">
+
+<!ENTITY scrappartymerge.menu.title "BITS">
+<!ENTITY scrappartymerge.menu.addon "Add-ons">
+<!ENTITY scrappartymerge.menu.option "Option">
+
+<!ENTITY scrappartymerge.marker.start.label "When the start position of the marker is the same">
+<!ENTITY scrappartymerge.marker.start.value "1">
+<!ENTITY scrappartymerge.marker.end.label   "When the end position of the marker is the same">
+<!ENTITY scrappartymerge.marker.end.value   "2">
+<!ENTITY scrappartymerge.marker.all.label   "When the range of the marker is the same">
+<!ENTITY scrappartymerge.marker.all.value   "0">
+
+<!ENTITY scrappartymerge.condition     "Condition">
+<!ENTITY scrappartymerge.confirm       "Confirm">
+<!ENTITY scrappartymerge.confirm.merge "Confirm when merging.">
+
+<!ENTITY scrappartymerge.mergemode             "Merge Mode">
+<!ENTITY scrappartymerge.mergemode.merge       "Merge">
+<!ENTITY scrappartymerge.mergemode.overwrite   "Overwrite">
+<!ENTITY scrappartymerge.mergemode.destruction "Destroy">
+
+<!ENTITY scrappartymerge.confirm.title "Processing mode confirmation">
+<!ENTITY scrappartymerge.confirm.mergeobject "Merge target object">
+<!ENTITY scrappartymerge.confirm.dropobject  "Dropped object">
+
+<!ENTITY scrappartymerge.confirm.same_processing "Apply same processing to subsequent objects.">
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/scrappartymerge.properties
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/scrappartymerge.properties	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/scrappartymerge.properties	(revision 5703)
@@ -0,0 +1,8 @@
+APP_TITLE=DWAN
+# APP_TITLE=WiredMarker
+APP_DISP_TITLE=Wired-Marker
+
+CONFIRM=Confirmation
+CONFIRM_MERGE=Do you really want to merge?
+CONFIRM_SKIP=Skip
+MOT_CONFIRM_NEXT_TIME=Do not confirm from the next time.
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/searchacross.dtd
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/searchacross.dtd	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/searchacross.dtd	(revision 5703)
@@ -0,0 +1,1 @@
+<!ENTITY searchacross.search.textbox.emptytext "Enter a search string">
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/treecontextmenu.dtd
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/treecontextmenu.dtd	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/en-US/markingcollection/treecontextmenu.dtd	(revision 5703)
@@ -0,0 +1,25 @@
+<!ENTITY treecontextmenu.folder                 "Folder">
+<!ENTITY treecontextmenu.folder.new             "Create an empty folder">
+<!ENTITY treecontextmenu.folder.template.new    "Create folders using the template">
+<!ENTITY treecontextmenu.folder.template.create "Create a template">
+<!ENTITY treecontextmenu.folder.template.remove "Delete Template">
+
+<!ENTITY treecontextmenu.view       "View">
+<!ENTITY treecontextmenu.view.list  "List view">
+<!ENTITY treecontextmenu.view.list.remove "Remove">
+<!ENTITY treecontextmenu.view.itemviewstyle         "Item view style">
+<!ENTITY treecontextmenu.view.itemviewstyle.favicon "Icon size">
+<!ENTITY treecontextmenu.view.itemviewstyle.items   "View item">
+<!ENTITY treecontextmenu.view.filter  "Folder filter">
+
+<!ENTITY treecontextmenu.import           "Import">
+<!ENTITY treecontextmenu.import.capture   "Capture image">
+<!ENTITY treecontextmenu.import.tag       "Retrieve by specifying HTML tag">
+<!ENTITY treecontextmenu.import.localfile "Block registration of local files">
+
+<!ENTITY treecontextmenu.export           "Export">
+<!ENTITY treecontextmenu.export.export    "Export in Wired-Marker format">
+<!ENTITY treecontextmenu.export.tagoutput "Output folder contents with tags">
+
+<!ENTITY treecontextmenu.automarking            "Auto marking">
+<!ENTITY treecontextmenu.automarking.dictionary "Dictionary">
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/about.properties
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/about.properties	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/about.properties	(revision 5703)
@@ -0,0 +1,2 @@
+# extensions.{e36db930-f18d-4449-b45f-e286cfb9e03a}.description=WebããŒãžã«åŒããæ¶ããªãããŒã«ãŒãã§ãã
+extensions.webannotator@dasish.eu.description=WebããŒãžã«åŒããæ¶ããªãããŒã«ãŒãã§ãã
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/articlenavigation.properties
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/articlenavigation.properties	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/articlenavigation.properties	(revision 5703)
@@ -0,0 +1,3 @@
+APP_TITLE=DWAN
+# APP_TITLE=WiredMarker
+APP_DISP_TITLE=Wired-Marker
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/marker.dtd
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/marker.dtd	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/marker.dtd	(revision 5703)
@@ -0,0 +1,18 @@
+<!ENTITY marker.initdata.overlay.groupbox.caption       "ããŒã«ãŒåæå
+¥åããŒã¿">
+<!ENTITY marker.initdata.overlay.title.groupbox.caption "ã¿ã€ãã«">
+<!ENTITY marker.initdata.overlay.note.groupbox.caption  "ããŒã">
+<!ENTITY marker.initdata.overlay.radio.label.text       "ããŒã¯æ">
+<!ENTITY marker.initdata.overlay.radio.label.title      "ããŒãžã¿ã€ãã«">
+<!ENTITY marker.initdata.overlay.radio.label.date       "æ¥ä»">
+<!ENTITY marker.initdata.overlay.radio.label.format     "ãã©ãŒãããæå®">
+<!ENTITY marker.initdata.overlay.radio.label.none       "æªå
+¥å">
+<!ENTITY marker.initdata.overlay.checkbox.edit          "ããŒã«ãŒç»é²æã«ç·šéãã">
+
+<!ENTITY marker.initdata.dialog.title       "ããŒã«ãŒæ
+å ±ç·šé">
+<!ENTITY marker.initdata.dialog.label.title "ã¿ã€ãã«">
+<!ENTITY marker.initdata.dialog.label.note  "ããŒã">
+<!ENTITY marker.initdata.dialog.emptytext.title "ã¿ã€ãã«ã¯å¿
+ãæå®ããŠäžãã">
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/markerCustom.dtd
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/markerCustom.dtd	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/markerCustom.dtd	(revision 5703)
@@ -0,0 +1,28 @@
+<!ENTITY markingcollection.markerCustom.preset "ããªã»ããã¹ã¿ã€ã«">
+<!ENTITY markingcollection.markerCustom.background "èæ¯">
+<!ENTITY markingcollection.markerCustom.color "è²">
+<!ENTITY markingcollection.markerCustom.text "æå­">
+<!ENTITY markingcollection.markerCustom.bold "å€ªå­">
+<!ENTITY markingcollection.markerCustom.italic "æäœ">
+<!ENTITY markingcollection.markerCustom.line "åãæ¶ãç·">
+<!ENTITY markingcollection.markerCustom.border "æ ">
+<!ENTITY markingcollection.markerCustom.type "çš®é¡">
+<!ENTITY markingcollection.markerCustom.box "å²ã¿ç·">
+<!ENTITY markingcollection.markerCustom.underline "äžç·">
+<!ENTITY markingcollection.markerCustom.style "åœ¢åŒ">
+<!ENTITY markingcollection.markerCustom.solid "å®ç· (Solid)">
+<!ENTITY markingcollection.markerCustom.dotted "ç¹ç· (Dotted)">
+<!ENTITY markingcollection.markerCustom.dashed "ç Žç· (Dashed)">
+<!ENTITY markingcollection.markerCustom.double "äºéç· (Double)">
+<!ENTITY markingcollection.markerCustom.groove "è°·ç· (Groove)">
+<!ENTITY markingcollection.markerCustom.ridge "å±±ç· (Ridge)">
+<!ENTITY markingcollection.markerCustom.inset "å
+ç· (Inset)">
+<!ENTITY markingcollection.markerCustom.outset "å€ç· (Outset)">
+
+<!ENTITY markingcollection.markerCustom.width "å€ªã">
+<!ENTITY markingcollection.markerCustom.thin "çŽ°ã">
+<!ENTITY markingcollection.markerCustom.medium "äž­">
+<!ENTITY markingcollection.markerCustom.thick "å€ªã">
+
+<!ENTITY markingcollection.markerCustom.enabled "äœ¿çšå¯èœ">
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/markingcollection.dtd
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/markingcollection.dtd	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/markingcollection.dtd	(revision 5703)
@@ -0,0 +1,329 @@
+<!ENTITY markingcollection.app.menu.title "BITS">
+<!ENTITY markingcollection.app.title "Wired-Marker">
+
+<!ENTITY markingcollection.general "äžè¬">
+<!ENTITY markingcollection.concordance "ã³ã³ã³ãŒãã³ã¹">
+<!ENTITY markingcollection.concordance.sidebar "ãµã€ãããŒãšé£åããã">
+<!ENTITY markingcollection.concordance.display "åžžã«è¡šç€ºãã">
+<!ENTITY markingcollection.concordance.none "è¡šç€ºããªã">
+
+<!ENTITY markingcollection.display.style "ãµã€ãããŒè¡šç€ºåœ¢åŒïŒâ»èŠåèµ·åïŒ">
+<!ENTITY markingcollection.display.itemview      "ãã©ã«ããšãªããžã§ã¯ãã®è¡šç€º">
+<!ENTITY markingcollection.display.itemview.lr   "å·Šå³ã«è¡šç€º">
+<!ENTITY markingcollection.display.itemview.tb   "äžäžã«è¡šç€º">
+<!ENTITY markingcollection.display.itemview.none "äžç·ã«è¡šç€º">
+
+<!ENTITY markingcollection.contextmenu.type "ã³ã³ãã­ã¹ãã¡ãã¥ãŒè¡šç€ºåœ¢åŒ">
+<!ENTITY markingcollection.contextmenu.type.full   "æšæºã¡ãã¥ãŒ">
+<!ENTITY markingcollection.contextmenu.type.simple "ç°¡æã¡ãã¥ãŒ">
+
+<!ENTITY markingcollection.menu "ã¡ãã¥ãŒ">
+<!ENTITY markingcollection.menu.title "BITS">
+<!ENTITY markingcollection.menu.addon "ã¢ããªã³">
+<!ENTITY markingcollection.menu.option "ãªãã·ã§ã³">
+<!ENTITY markingcollection.menu.disptopmenu "Wired-Markerã¡ãã¥ãŒããããã¡ãã¥ãŒã«è¡šç€ºãã">
+<!ENTITY markingcollection.menu.project "ãã­ã¥ã¡ã³ãã€ã³ããã¯ã¹">
+<!ENTITY markingcollection.menu.documents "ãã¡ã€ã«äžæ¬ç»é²">
+<!ENTITY markingcollection.menu.dictionary "èŸæžã¡ãã¥ãŒ">
+<!ENTITY markingcollection.menu.anchor "ã¢ã³ã«ãŒã¡ãã¥ãŒ">
+<!ENTITY markingcollection.menu.caption "ã¡ãã¥ãŒè¡šç€ºäœçœ®">
+<!ENTITY markingcollection.menu.appmenu "ã¢ããªã¡ãã¥ãŒ">
+<!ENTITY markingcollection.menu.topmenu "ãããã¡ãã¥ãŒ">
+<!ENTITY markingcollection.menu.bookmarks "ããã¯ããŒã¯ã¡ãã¥ãŒ">
+<!ENTITY markingcollection.menu.tools "ããŒã«ã¡ãã¥ãŒ">
+
+<!ENTITY markingcollection.new.folder "æ°èŠäœæ">
+<!ENTITY markingcollection.new.defaultFolder "ç©ºãã©ã«ã">
+<!ENTITY markingcollection.new.templateFolder "ãã³ãã¬ãŒã">
+<!ENTITY markingcollection.new.projectFolder "ãã­ãžã§ã¯ããã©ã«ã">
+<!ENTITY markingcollection.new.dictionaryFolder "èŸæžãã©ã«ã">
+<!ENTITY markingcollection.new.documentsFolder "ãã­ã¥ã¡ã³ããã©ã«ã">
+
+<!ENTITY markingcollection.toggle.all "ãã¹ãŠã®ãã©ã«ããåºããïŒããã">
+<!ENTITY markingcollection.tools.settings "èš­å®">
+<!ENTITY markingcollection.tools.label.accept "éãã">
+<!ENTITY markingcollection.tools.key.accept "C">
+
+<!ENTITY markingcollection.open "éã">
+<!ENTITY markingcollection.open.newtab "æ°ããã¿ãã§éã">
+
+<!ENTITY markingcollection.export "ãšã¯ã¹ããŒã">
+<!ENTITY markingcollection.remove "åé€">
+<!ENTITY markingcollection.remove.folder "ãã©ã«ã">
+<!ENTITY markingcollection.remove.folderall "é
+äžã®å
+šãã©ã«ã">
+<!ENTITY markingcollection.remove.itemall "é
+äžã®å
+šãªããžã§ã¯ã">
+
+<!ENTITY markingcollection.edit.replacedURL "URLçœ®æ">
+<!ENTITY markingcollection.edit.searched "æ€çŽ¢">
+<!ENTITY markingcollection.edit.replaced "çœ®æ">
+<!ENTITY markingcollection.edit.getURL "URLååŸ">
+<!ENTITY markingcollection.edit.displayURL "è¡šç€ºäž­ã®URLãååŸ">
+<!ENTITY markingcollection.edit.folderURL "ãã©ã«ãã®URLãååŸ">
+<!ENTITY markingcollection.edit.replacedTarget "çœ®æå¯Ÿè±¡">
+<!ENTITY markingcollection.edit.replacedTarget.directory "ãã£ã¬ã¯ããª">
+<!ENTITY markingcollection.edit.replacedTarget.file "ãã¡ã€ã«">
+
+<!ENTITY markingcollection.property "ãã­ããã£">
+<!ENTITY markingcollection.itemview "ã¢ã€ãã ãã¥ãŒ">
+<!ENTITY markingcollection.listview "ãªã¹ããã¥ãŒ">
+<!ENTITY markingcollection.treelistview "éå±€ãªã¹ããã¥ãŒ">
+<!ENTITY markingcollection.treelistview.defaults "ããã©ã«ã">
+<!ENTITY markingcollection.addon "ã¢ããªã³">
+
+<!ENTITY markingcollection.prop.title "ã¿ã€ãã«">
+<!ENTITY markingcollection.prop.note "ããŒã">
+<!ENTITY markingcollection.prop.general "æŠèŠ">
+<!ENTITY markingcollection.prop.tag "ã¿ã°">
+<!ENTITY markingcollection.prop.tag.emptytext "ã¿ã€ãã«ãšåã">
+<!ENTITY markingcollection.prop.extended_message "æ¡åŒµã¡ãã»ãŒãž">
+<!ENTITY markingcollection.prop.metacapture "ããŒãžã¿ã€ãã«">
+
+<!ENTITY markingcollection.folder.openall "ãã¹ãŠã¿ãã§éã">
+
+
+<!ENTITY markingcollection.defaultFolder "å
+šè¡šç€º">
+<!ENTITY markingcollection.rootFolder "ãã®ãã©ã«ãä»¥äžãè¡šç€º">
+<!ENTITY markingcollection.rootTree "Tree">
+<!ENTITY markingcollection.rootSelectFolder "éžæãã©ã«ãä»¥äžãè¡šç€º">
+
+<!ENTITY markingcollection.templateFolder "ãã³ãã¬ãŒã">
+<!ENTITY markingcollection.templateFolder.create "äœæ">
+<!ENTITY markingcollection.templateFolder.remove "åé€">
+<!ENTITY markingcollection.filter "ãã£ã«ã¿ãŒ">
+<!ENTITY markingcollection.import "ã€ã³ããŒã">
+<!ENTITY markingcollection.importTagAll "æå®ã¿ã°å
+šåèŸŒ">
+<!ENTITY markingcollection.export "ãšã¯ã¹ããŒã">
+<!ENTITY markingcollection.sharedFolder "å
+±æå
+ãã©ã«ãå€æŽ">
+<!ENTITY markingcollection.mergeFolder "ããŒãžãã©ã«ãå€æŽ">
+<!ENTITY markingcollection.folderAutoOpen "ãã­ããæã«ãã©ã«ããéããªã">
+
+<!ENTITY markingcollection.repository "ãªããžããª">
+<!ENTITY markingcollection.repository.folder "ãã©ã«ã">
+<!ENTITY markingcollection.repository.user "ãŠãŒã¶">
+<!ENTITY markingcollection.repository.merge "ããŒãž">
+<!ENTITY markingcollection.repository.settings "èš­å®">
+<!ENTITY markingcollection.repository.folderall "é
+äžã®å
+šãã©ã«ã">
+<!ENTITY markingcollection.repository.itemall "é
+äžã®å
+šãªããžã§ã¯ã">
+<!ENTITY markingcollection.repository.import "åãèŸŒã¿">
+
+<!ENTITY markingcollection.viewMode "è¡šç€ºã¢ãŒã">
+<!ENTITY markingcollection.viewMode.single "Single">
+<!ENTITY markingcollection.viewMode.all "All">
+<!ENTITY markingcollection.viewMode.each "Each">
+
+<!ENTITY markingcollection.analyze "èªåèªè­">
+
+<!ENTITY markingcollection.newDatabase "æ°èŠããŒã¿ããŒã¹">
+<!ENTITY markingcollection.newDatabase.newLocalDatabase "ã­ãŒã«ã«ããŒã¿ããŒã¹">
+
+
+<!ENTITY markingcollection.pref.edit "ç·šéæ©èœ">
+<!ENTITY markingcollection.button.customize "ã«ã¹ã¿ãã€ãº">
+<!ENTITY markingcollection.button.update "æŽæ°">
+
+<!ENTITY markingcollection.marker "ããŒã«ãŒ">
+<!ENTITY markingcollection.marker.remove "ãã®ããŒã«ãŒãã¯ãªã¢">
+<!ENTITY markingcollection.marker.remove.all "ãã®ããŒãžã®å
+šãŠã®ããŒã«ãŒãã¯ãªã¢">
+<!ENTITY markingcollection.marker.remarker "ããŒã«ãŒã®ç¯å²ãéžæç¯å²ã«å€æŽãã">
+<!ENTITY markingcollection.marker.uncategorized "æªåé¡ã§ç»é²">
+
+<!ENTITY markingcollection.icon_size "ã¢ã€ã³ã³ãµã€ãº">
+<!ENTITY markingcollection.icon_size.large "Large">
+<!ENTITY markingcollection.icon_size.small "Small">
+
+<!ENTITY markingcollection.shortcut "ã·ã§ãŒãã«ãã">
+
+<!ENTITY markingcollection.database "ããŒã¿ãã¡ã€ã«">
+<!ENTITY markingcollection.database.vacuum "æé©å">
+<!ENTITY markingcollection.database.name "ã¿ã€ãã«">
+<!ENTITY markingcollection.database.filename "ãã¡ã€ã«åå">
+<!ENTITY markingcollection.database.comment "ã³ã¡ã³ã">
+<!ENTITY markingcollection.database.status "ç¶æ³">
+<!ENTITY markingcollection.database.add "è¿œå ">
+<!ENTITY markingcollection.database.set "èš­å®">
+<!ENTITY markingcollection.database.del "ãªã¹ãããåé€">
+<!ENTITY markingcollection.database.dis "äœ¿çšïŒæªäœ¿çš">
+<!ENTITY markingcollection.database.startupalldbunused "èµ·åæã«å
+šãŠæªäœ¿çšã«ãã">
+<!ENTITY markingcollection.database.use "äœ¿çšãã">
+<!ENTITY markingcollection.database.contextmenu "ã³ã³ãã­ã¹ãã¡ãã¥ãŒã«è¡šç€ºãã">
+<!ENTITY markingcollection.database.default "ããã©ã«ãã«ãã">
+
+<!ENTITY markingcollection.key.sidebar "X">
+<!ENTITY markingcollection.key.menubar "M">
+
+
+<!ENTITY markingcollection.filter "ãã£ã«ã¿ãŒ">
+<!ENTITY markingcollection.filter.availableness "æå¹">
+<!ENTITY markingcollection.filter.invalidation "ç¡å¹">
+<!ENTITY markingcollection.filter.keyword "ã­ãŒã¯ãŒã">
+<!ENTITY markingcollection.filter.casesensitive "å€§æå­ãšå°æå­ãåºå¥ãã">
+
+<!ENTITY markingcollection.capture "ã­ã£ããã£">
+<!ENTITY markingcollection.capture.all "å
+šãã­ã¥ã¡ã³ã">
+<!ENTITY markingcollection.capture.cut "åãåºã">
+<!ENTITY markingcollection.capture.document "ãã­ã¥ã¡ã³ã">
+<!ENTITY markingcollection.capture.clipboard "ã¯ãªããããŒã">
+<!ENTITY markingcollection.capture.title "ã¿ã€ãã«">
+<!ENTITY markingcollection.capture.document_link "ã«ã¬ã³ãã®ãã­ã¥ã¡ã³ããšãªã³ã¯ãã">
+<!ENTITY markingcollection.capture.all_select "å
+šãŠéžæ">
+
+<!ENTITY markingcollection.hyperanchor.icon_caption "HYPER-ANCHORåœ¢åŒã®ãªã³ã¯ããã­ã¥ã¡ã³ãäž­ã«å­åšããå Žå">
+<!ENTITY markingcollection.hyperanchor.icon_display_left "åžžã«ã¢ã€ã³ã³ããªã³ã¯ã®å·ŠåŽã«è¡šç€ºãã">
+<!ENTITY markingcollection.hyperanchor.icon_display_right "åžžã«ã¢ã€ã³ã³ããªã³ã¯ã®å³åŽã«è¡šç€ºãã">
+<!ENTITY markingcollection.hyperanchor.icon_display_left_popup "ããŠã¹ãªãŒããŒã§ã¢ã€ã³ã³ããªã³ã¯ã®å·ŠåŽã«è¡šç€ºãã">
+<!ENTITY markingcollection.hyperanchor.icon_display_right_popup "ããŠã¹ãªãŒããŒã§ã¢ã€ã³ã³ããªã³ã¯ã®å³åŽã«è¡šç€ºãã">
+<!ENTITY markingcollection.hyperanchor.icon_none "äœãããªã">
+<!ENTITY markingcollection.hyperanchor.icon_attention "â»æ¢ã«ãã­ã¥ã¡ã³ããéããŠããå Žåãå€æŽããå
+å®¹ã¯åæ ãããŸããããªã­ãŒãããŠäžããã">
+
+<!ENTITY markingcollection.hyperanchor.alignment_caption "ãã­ã¥ã¡ã³ãã®æŽæ°ã«ãããããŒã«ãŒã®äœçœ®ããããå Žå">
+<!ENTITY markingcollection.hyperanchor.alignment_length "æå®æå­æ°ä»¥å
+ãããŒã¯ã¢ããäœçœ®ãè£æ­£ããŸã">
+<!ENTITY markingcollection.hyperanchor.alignment_attention "â»ïŒæå­ã®å Žåãäœçœ®ã®è£æ­£ã¯è¡ããŸããã">
+
+<!ENTITY markingcollection.hyperanchor.copy_to_clipboard "ããŒã«ãŒäœçœ®ãã³ããŒ(HYPER-ANCHORåœ¢åŒ)">
+<!ENTITY markingcollection.hyperanchor.sidebar_copy_to_clipboard "ã³ããŒ">
+
+<!ENTITY markingcollection.favorite "ãã©ã«ã">
+<!ENTITY markingcollection.favorite.add "ãã©ã«ãã«è¿œå ">
+<!ENTITY markingcollection.favorite.select_folder_add "éžæãã©ã«ããè¿œå ">
+
+<!ENTITY markingcollection.substitutiontree.add  "è¿œå ">
+<!ENTITY markingcollection.substitutiontree.edit "ç·šé">
+<!ENTITY markingcollection.substitutiontree.del  "åé€">
+<!ENTITY markingcollection.substitutiontree.src  "ãã¡ã€ã«å">
+<!ENTITY markingcollection.substitutiontree.alt  "ä»£æ¿ãã­ã¹ã">
+<!ENTITY markingcollection.substitutiontree.table  "çœ®æè¡š">
+<!ENTITY markingcollection.substitutiontree.confirm  "çœ®æè¡šã«å­åšããªãå Žåã¯ç¢ºèªãã">
+
+<!ENTITY markingcollection.selectimportimage  "éžæç¯å²ã®åèŸŒæã®ç»åã®æ±ã">
+<!ENTITY markingcollection.selectimportimage.none  "ç¡èŠ">
+<!ENTITY markingcollection.selectimportimage.alt  "ALTå±æ§ããä»£æ¿ãã­ã¹ããååŸ">
+<!ENTITY markingcollection.selectimportimage.substitution  "çœ®æè¡šããä»£æ¿ãã­ã¹ããååŸ">
+<!ENTITY markingcollection.selectimportimage.substitution_alt  "çœ®æè¡šãšALTå±æ§ããä»£æ¿ãã­ã¹ããååŸïŒâ»çœ®æè¡šåªå
+ïŒ">
+<!ENTITY markingcollection.selectimportimage.alt_substitution  "ALTå±æ§ãšçœ®æè¡šããä»£æ¿ãã­ã¹ããååŸïŒâ»ALTå±æ§åªå
+ïŒ">
+
+<!ENTITY markingcollection.project.documents.select.folder  "ãã©ã«ãæå®">
+<!ENTITY markingcollection.project.documents.select.file  "ãã¡ã€ã«æå®">
+<!ENTITY markingcollection.project.dictionary.read "èŸæžèª­ã¿èŸŒã¿">
+<!ENTITY markingcollection.project.dictionary.save "èŸæžæžãåºã">
+<!ENTITY markingcollection.project.dictionary.management "èŸæžç®¡ç">
+<!ENTITY markingcollection.project.dictionary.apply "èŸæžãåœãŠã">
+<!ENTITY markingcollection.project.dictionary.edit "èŸæžã«å
+¥ãã">
+<!ENTITY markingcollection.project.dictionary.item.add "è¿œå ">
+<!ENTITY markingcollection.project.dictionary.item.del "ç¡å¹">
+<!ENTITY markingcollection.project.dictionary.item.search "æ€çŽ¢">
+<!ENTITY markingcollection.project.index.menu.caption "çŽ¢åŒè¡šç€º">
+<!ENTITY markingcollection.project.index.menu.display "è¡šç€º">
+<!ENTITY markingcollection.project.index.menu.save "ä¿å­">
+<!ENTITY markingcollection.project.index.menu.display.normal "ããã©ã«ã">
+<!ENTITY markingcollection.project.index.menu.display.url "URLè¡šç€º">
+
+<!ENTITY markingcollection.tagoutput.menu.title "ã¿ã°ä»ãåºå">
+<!ENTITY markingcollection.tagoutput.menu.save "åºå">
+<!ENTITY markingcollection.tagoutput.menu.with_style "åºå(ã¹ã¿ã€ã«ä»ã)">
+<!ENTITY markingcollection.tagoutput.output.caption "ã¿ã°ã®åºååœ¢åŒ">
+<!ENTITY markingcollection.tagoutput.style.caption "ã¿ã°ã®ã¹ã¿ã€ã«ã·ãŒã">
+<!ENTITY markingcollection.tagoutput.style.no_style "ã¹ã¿ã€ã«ãªã">
+<!ENTITY markingcollection.tagoutput.style.with_style "ã¹ã¿ã€ã«ä»ã">
+<!ENTITY markingcollection.tagoutput.visibility.caption "ãã©ãŠã¶ã§ã®åç
+§æ">
+<!ENTITY markingcollection.tagoutput.visibility.visible "ã¿ã°ãèŠããããã«ãã">
+<!ENTITY markingcollection.tagoutput.visibility.hidden "ã¿ã°ãé ã">
+<!ENTITY markingcollection.tagoutput.visibility.description1 "ã¿ã°åãè±å­ä»¥å€ããå§ãŸã£ãŠããå Žåã">
+<!ENTITY markingcollection.tagoutput.visibility.description2 "ã¿ã°ã¯é ããŸããã®ã§ãæ³šæãã ããã">
+<!ENTITY markingcollection.tagoutput.format.caption "ãã¡ã€ã«åºååœ¢åŒ">
+<!ENTITY markingcollection.tagoutput.html.caption "å¯Ÿè±¡ãã¡ã€ã«ãHTMLåœ¢åŒã®å Žå">
+<!ENTITY markingcollection.tagoutput.html.path "ç»åããªã³ã¯å
+ã®çžå¯Ÿãã¹ãçµ¶å¯Ÿãã¹ã«å€æãã">
+
+<!ENTITY markingcollection.textplain "MIMEã¿ã€ã(text/plain)è¡šç€ºåœ¢åŒ">
+<!ENTITY markingcollection.textplain.usually  "éåžžåœ¢åŒ (èªåæ¹è¡ãªã)">
+<!ENTITY markingcollection.textplain.confirm  "è¡šç€ºæã«èªåæ¹è¡è¡šç€ºãããç¢ºèªãã">
+<!ENTITY markingcollection.textplain.wrapping "åžžã«ãã©ãŠã¶å
+ã®è¡šç€ºé åå
+ã«çŽãŸãããã«èªåæ¹è¡ãã">
+<!ENTITY markingcollection.textplain.attr             "èªåæ¹è¡åŸã®è¡šç€ºå±æ§">
+<!ENTITY markingcollection.textplain.background-color "èæ¯è²">
+<!ENTITY markingcollection.textplain.font-family      "ãã©ã³ã">
+<!ENTITY markingcollection.textplain.font-size        "ãµã€ãº">
+
+<!ENTITY markingcollection.autocache.tab "ãªãŒãã­ã£ãã·ã¥">
+<!ENTITY markingcollection.autocache.caption "ãªãŒãã­ã£ãã·ã¥æ©èœ">
+<!ENTITY markingcollection.autocache.tooltiptext "ã­ã£ãã·ã¥äœæ">
+<!ENTITY markingcollection.autocache.open "éã">
+<!ENTITY markingcollection.autocache.open.newtab "æ°ããã¿ãã§éã">
+<!ENTITY markingcollection.autocache.past "ã­ã£ãã·ã¥äžèŠ§">
+<!ENTITY markingcollection.autocache.disabled "ç¡å¹">
+<!ENTITY markingcollection.autocache.switching "æåã§å®è¡">
+<!ENTITY markingcollection.autocache.valid "æå¹">
+<!ENTITY markingcollection.autocache.marking "ã­ã£ãã·ã¥ãã­ã¥ã¡ã³ããžã®ããŒã­ã³ã°">
+<!ENTITY markingcollection.autocache.marking.disabled "çŠæ­¢ãã">
+<!ENTITY markingcollection.autocache.marking.confirm "ããŒã­ã³ã°æã«ç¢ºèªãã">
+<!ENTITY markingcollection.autocache.marking.valid "æå¹ã«ãã">
+<!ENTITY markingcollection.autocache.manually.caption "æåã§å®è¡ãã">
+<!ENTITY markingcollection.autocache.manually.confirm "å®è¡æã«ç¢ºèªãã">
+<!ENTITY markingcollection.autocache.cache "ã­ã£ãã·ã¥">
+<!ENTITY markingcollection.autocache.list "ã­ã£ãã·ã¥äžèŠ§">
+<!ENTITY markingcollection.autocache.list.open "éã">
+<!ENTITY markingcollection.autocache.list.close "éãã">
+<!ENTITY markingcollection.autocache.remove "ã­ã£ãã·ã¥ãåé€">
+<!ENTITY markingcollection.autocache.timestamp "ã­ã£ãã·ã¥æ¥æ">
+<!ENTITY markingcollection.autocache.filesize "ãµã€ãº">
+<!ENTITY markingcollection.autocache.open.all "ãã®ã­ã£ãã·ã¥ãå
+šãŠéã">
+<!ENTITY markingcollection.autocache.remove.all "ãã®ã­ã£ãã·ã¥ãå
+šãŠåé€">
+<!ENTITY markingcollection.autocache.view "ã­ã£ãã·ã¥ãªã¹ã">
+<!ENTITY markingcollection.autocache.view.tooltiptext "ã­ã£ãã·ã¥ãªã¹ã (è¡šç€º/éè¡šç€º)">
+<!ENTITY markingcollection.autocache.save.folder "ä¿å­å Žæ">
+<!ENTITY markingcollection.autocache.save.user "ãŠãŒã¶æå®">
+<!ENTITY markingcollection.autocache.save.default "ããã©ã«ã">
+<!ENTITY markingcollection.autocache.topmenu.caption "ãããã¡ãã¥ãŒ">
+<!ENTITY markingcollection.autocache.topmenu.display "è¡šç€ºãã">
+<!ENTITY markingcollection.autocache.topmenu.number "è¡šç€ºä»¶æ°">
+<!ENTITY markingcollection.autocache.topmenu.attention "â»ä»¶æ°ïŒã®å Žåãå
+šãŠã®ã­ã£ãã·ã¥ãè¡šç€ºããŸãã">
+
+<!ENTITY markingcollection.shortcut.tab "ã·ã§ãŒãã«ãã">
+<!ENTITY markingcollection.shortcut.add  "è¿œå ">
+<!ENTITY markingcollection.shortcut.edit "ç·šé">
+<!ENTITY markingcollection.shortcut.del  "åé€">
+<!ENTITY markingcollection.shortcut.disptree  "ãã©ã«ããžã®ã·ã§ãŒãã«ããã­ãŒãããªãŒã«è¡šç€ºãã">
+<!ENTITY markingcollection.shortcut.attention1 "â»ãã©ã«ããžã®ã·ã§ãŒãã«ããã¯ãåãã©ã«ãã®ãã­ããã£ç»é¢ããèš­å®ããŠäžãã">
+<!ENTITY markingcollection.shortcut.attention2 "â»ã·ã§ãŒãã«ããã­ãŒãéè€ããå Žåãäžäœã®å®çŸ©ãäœ¿çšããŸã">
+<!ENTITY markingcollection.shortcut.attention_modifiers "â»ä¿®é£Ÿ (modifier) ã­ãŒãšä»»æã®ã­ãŒãæŒããŠæå®ããŠäžãã">
+
+<!ENTITY markingcollection.setting.view "è¡šç€º">
+<!ENTITY markingcollection.setting.marker "ããŒã«ãŒ">
+<!ENTITY markingcollection.setting.markerinitdata "ããŒã«ãŒåæå
+¥åããŒã¿">
+<!ENTITY markingcollection.setting.imagecapture "ç»ååèŸŒ">
+<!ENTITY markingcollection.setting.pubmedcentral "PubMed Central">
+<!ENTITY markingcollection.setting.uncategorized "æªåé¡ãã©ã«ã">
+<!ENTITY markingcollection.setting.uncategorized.use "äœ¿çšãã">
+<!ENTITY markingcollection.setting.protocol "ãã­ãã³ã«">
+<!ENTITY markingcollection.setting.marker.mouseover "ããŒã«ãŒãžã®ããŠã¹ãªãŒããŒæ">
+<!ENTITY markingcollection.setting.marker.mouseover.disptooltip "ãªããžã§ã¯ãæ
+å ±ãè¡šç€ºãã">
+<!ENTITY markingcollection.setting.marker.mouseover.title "ã¿ã€ãã«">
+<!ENTITY markingcollection.setting.marker.mouseover.note "ããŒã">
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/markingcollection.properties
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/markingcollection.properties	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/markingcollection.properties	(revision 5703)
@@ -0,0 +1,143 @@
+APP_TITLE=DWAN
+# APP_TITLE=WiredMarker
+APP_DISP_TITLE=Wired-Marker
+# APP_ID={e36db930-f18d-4449-b45f-e286cfb9e03a}
+APP_ID=webannotator@dasish.eu
+APP_SHORTCUT_TITLE=Wired-Marker\u00e8\u00b5\u00b7\u00e5\u008b\u0095\u00e3\u0082\u00b7\u00e3\u0083\u00a7\u00e3\u0083\u00bc\u00e3\u0083\u0088\u00e3\u0082\u00ab\u00e3\u0083\u0083\u00e3\u0083\u0088
+
+MARKER_FOLDER=\u00e3\u0083\u009e\u00e3\u0083\u00bc\u00e3\u0082\u00ab\u00e3\u0083\u00bc
+LOCAL_FOLDER=\u00e3\u0083\u00ad\u00e3\u0083\u00bc\u00e3\u0082\u00ab\u00e3\u0083\u00ab\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080
+SHARED_FOLDER=\u00e5\u0085\u00b1\u00e6\u009c\u0089\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080
+MERGE_FOLDER=\u00e3\u0083\u009e\u00e3\u0083\u00bc\u00e3\u0082\u00b8\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080
+UN_FOLDER=\u00e6\u009c\u00aa\u00e5\u0088\u0086\u00e9\u00a1\u009e
+UN_FOLDER_STYLE=border:thin dotted rgb(255,204,0);background-color:rgb(255,255,204);color:rgb(0,0,0);
+DEFAULT_FOLDER=\u00e5\u0085\u00a8\u00e8\u00a1\u00a8\u00e7\u00a4\u00ba
+SELECT_DISP_FOLDER=\u00e3\u0081\u0093\u00e3\u0081\u00ae\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080\u00e4\u00bb\u00a5\u00e4\u00b8\u008b\u00e3\u0082\u0092\u00e8\u00a1\u00a8\u00e7\u00a4\u00ba\u00e3\u0081\u0099\u00e3\u0082\u008b
+ROOT_FOLDER=\u00e3\u0083\u00ab\u00e3\u0083\u00bc\u00e3\u0083\u0088\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080
+ERROR_INVALID_URL=\u00e3\u0082\u00a8\u00e3\u0083\u00a9\u00e3\u0083\u00bc: \u00e7\u0084\u00a1\u00e5\u008a\u00b9\u00e3\u0081\u00aaURL\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0080\u0082
+ERROR_INVALID_TITLE=\u00e3\u0082\u00a8\u00e3\u0083\u00a9\u00e3\u0083\u00bc: \u00e3\u0082\u00bf\u00e3\u0082\u00a4\u00e3\u0083\u0088\u00e3\u0083\u00ab\u00e3\u0081\u008c\u00e9\u0087\u008d\u00e8\u00a4\u0087\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0081\u0084\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0080\u0082
+ERROR_NOT_ENTER_TITLE=\u00e3\u0082\u00a8\u00e3\u0083\u00a9\u00e3\u0083\u00bc: \u00e3\u0082\u00bf\u00e3\u0082\u00a4\u00e3\u0083\u0088\u00e3\u0083\u00ab\u00e3\u0081\u008c\u00e6\u009c\u00aa\u00e5\u0085\u00a5\u00e5\u008a\u009b\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0080\u0082
+WARNING_NOT_BEGIN_ENGLISH_TAG=\u00e8\u008b\u00b1\u00e5\u00ad\u0097\u00e4\u00bb\u00a5\u00e5\u00a4\u0096\u00e3\u0081\u00a7\u00e5\u00a7\u008b\u00e3\u0081\u00be\u00e3\u0082\u008b\u00e3\u0082\u00bf\u00e3\u0082\u00b0\u00e3\u0081\u00af\u00e5\u009f\u008b\u00e3\u0082\u0081\u00e8\u00be\u00bc\u00e3\u0081\u00bf\u00e3\u0082\u00bf\u00e3\u0082\u00b0\u00e3\u0081\u00a8\u00e4\u00bd\u00bf\u00e7\u0094\u00a8\u00e3\u0081\u00a7\u00e3\u0081\u008d\u00e3\u0081\u00be\u00e3\u0081\u009b\u00e3\u0082\u0093\u00e3\u0080\u0082\u00e3\u0081\u0094\u00e6\u00b3\u00a8\u00e6\u0084\u008f\u00e3\u0081\u008f\u00e3\u0081\u00a0\u00e3\u0081\u0095\u00e3\u0081\u0084\u00e3\u0080\u0082
+
+CONFIRM_DELETE=\u00e6\u009c\u00ac\u00e5\u00bd\u0093\u00e3\u0081\u00ab\u00e5\u0089\u008a\u00e9\u0099\u00a4\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0082\u0088\u00e3\u0082\u008d\u00e3\u0081\u0097\u00e3\u0081\u0084\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+CONFIRM_DELETE_ALL=\u00e5\u0085\u00a8\u00e3\u0081\u00a6\u00e3\u0081\u00ae\u00e3\u0083\u009e\u00e3\u0083\u00bc\u00e3\u0082\u00ab\u00e3\u0083\u00bc\u00e3\u0082\u0092\u00e3\u0082\u00af\u00e3\u0083\u00aa\u00e3\u0082\u00a2\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0082\u0088\u00e3\u0082\u008d\u00e3\u0081\u0097\u00e3\u0081\u0084\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+CONFIRM_REPOSITORY_MERGE=\u00e3\u0083\u00aa\u00e3\u0083\u009d\u00e3\u0082\u00b8\u00e3\u0083\u0088\u00e3\u0083\u00aa\u00e3\u0081\u00a8\u00e3\u0083\u0087\u00e3\u0083\u00bc\u00e3\u0082\u00bf\u00e3\u0082\u0092\u00e3\u0083\u009e\u00e3\u0083\u00bc\u00e3\u0082\u00b8\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0082\u0088\u00e3\u0082\u008d\u00e3\u0081\u0097\u00e3\u0081\u0084\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+CONFIRM_REPOSITORY_IMPOER=\u00e3\u0083\u00aa\u00e3\u0083\u009d\u00e3\u0082\u00b8\u00e3\u0083\u0088\u00e3\u0083\u00aa\u00e3\u0081\u008b\u00e3\u0082\u0089\u00e3\u0083\u0087\u00e3\u0083\u00bc\u00e3\u0082\u00bf\u00e3\u0082\u0092\u00e5\u008f\u0096\u00e3\u0082\u008a\u00e8\u00be\u00bc\u00e3\u0081\u00bf\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+CONFIRM_REPOSITORY_DELETE_FOLDER=\u00e3\u0083\u00aa\u00e3\u0083\u009d\u00e3\u0082\u00b8\u00e3\u0083\u0088\u00e3\u0083\u00aa\u00e5\u0086\u0085\u00e3\u0081\u00ae\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080\u00e4\u00bb\u00a5\u00e4\u00b8\u008b\u00e3\u0082\u0092\u00e5\u0089\u008a\u00e9\u0099\u00a4\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0082\u0088\u00e3\u0082\u008d\u00e3\u0081\u0097\u00e3\u0081\u0084\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+CONFIRM_REPOSITORY_DELETE_OBJECT=\u00e3\u0083\u00aa\u00e3\u0083\u009d\u00e3\u0082\u00b8\u00e3\u0083\u0088\u00e3\u0083\u00aa\u00e5\u0086\u0085\u00e3\u0081\u00ae\u00e3\u0082\u00aa\u00e3\u0083\u0096\u00e3\u0082\u00b8\u00e3\u0082\u00a7\u00e3\u0082\u00af\u00e3\u0083\u0088\u00e3\u0082\u0092\u00e5\u0089\u008a\u00e9\u0099\u00a4\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0082\u0088\u00e3\u0082\u008d\u00e3\u0081\u0097\u00e3\u0081\u0084\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+CONFIRM_REPOSITORY_ADD_FOLDER=\u00e3\u0083\u00aa\u00e3\u0083\u009d\u00e3\u0082\u00b8\u00e3\u0083\u0088\u00e3\u0083\u00aa\u00e5\u0086\u0085\u00e3\u0081\u00ab\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080\u00e3\u0082\u0092\u00e8\u00bf\u00bd\u00e5\u008a\u00a0\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0082\u0088\u00e3\u0082\u008d\u00e3\u0081\u0097\u00e3\u0081\u0084\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+CONFIRM_REPOSITORY_ADD_OBJECT=\u00e3\u0083\u00aa\u00e3\u0083\u009d\u00e3\u0082\u00b8\u00e3\u0083\u0088\u00e3\u0083\u00aa\u00e5\u0086\u0085\u00e3\u0081\u00ab\u00e3\u0082\u00aa\u00e3\u0083\u0096\u00e3\u0082\u00b8\u00e3\u0082\u00a7\u00e3\u0082\u00af\u00e3\u0083\u0088\u00e3\u0082\u0092\u00e8\u00bf\u00bd\u00e5\u008a\u00a0\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0082\u0088\u00e3\u0082\u008d\u00e3\u0081\u0097\u00e3\u0081\u0084\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+CONFIRM_REPOSITORY_UPDATE_FOLDER=\u00e3\u0083\u00aa\u00e3\u0083\u009d\u00e3\u0082\u00b8\u00e3\u0083\u0088\u00e3\u0083\u00aa\u00e5\u0086\u0085\u00e3\u0081\u00ae\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080\u00e3\u0082\u0092\u00e6\u009b\u00b4\u00e6\u0096\u00b0\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0082\u0088\u00e3\u0082\u008d\u00e3\u0081\u0097\u00e3\u0081\u0084\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+CONFIRM_REPOSITORY_UPDATE_OBJECT=\u00e3\u0083\u00aa\u00e3\u0083\u009d\u00e3\u0082\u00b8\u00e3\u0083\u0088\u00e3\u0083\u00aa\u00e5\u0086\u0085\u00e3\u0081\u00ae\u00e3\u0082\u00aa\u00e3\u0083\u0096\u00e3\u0082\u00b8\u00e3\u0082\u00a7\u00e3\u0082\u00af\u00e3\u0083\u0088\u00e3\u0082\u0092\u00e6\u009b\u00b4\u00e6\u0096\u00b0\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0082\u0088\u00e3\u0082\u008d\u00e3\u0081\u0097\u00e3\u0081\u0084\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+
+CONFIRM_MERGE=\u00e6\u008c\u0087\u00e5\u00ae\u009a\u00e3\u0081\u0097\u00e3\u0081\u009f\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080\u00e3\u0081\u00ae\u00e5\u0086\u0085\u00e5\u00ae\u00b9\u00e3\u0081\u00a8\u00e3\u0083\u009e\u00e3\u0083\u00bc\u00e3\u0082\u00b8\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0082\u0088\u00e3\u0082\u008d\u00e3\u0081\u0097\u00e3\u0081\u0084\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+
+
+CONFIRM_UPDATE_FOLDER=\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080\u00e3\u0082\u0092\u00e6\u009b\u00b4\u00e6\u0096\u00b0\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0082\u0088\u00e3\u0082\u008d\u00e3\u0081\u0097\u00e3\u0081\u0084\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+CONFIRM_UPDATE_OBJECT=\u00e3\u0082\u00aa\u00e3\u0083\u0096\u00e3\u0082\u00b8\u00e3\u0082\u00a7\u00e3\u0082\u00af\u00e3\u0083\u0088\u00e3\u0082\u0092\u00e6\u009b\u00b4\u00e6\u0096\u00b0\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0082\u0088\u00e3\u0082\u008d\u00e3\u0081\u0097\u00e3\u0081\u0084\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+
+SELECTED_SHARED_FOLDER=\u00e5\u0085\u00b1\u00e6\u009c\u0089\u00e3\u0081\u0099\u00e3\u0082\u008b\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080\u00e3\u0082\u0092\u00e9\u0081\u00b8\u00e6\u008a\u009e\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e4\u00b8\u008b\u00e3\u0081\u0095\u00e3\u0081\u0084\u00e3\u0080\u0082
+SELECTED_MERGE_FOLDER=\u00e3\u0083\u009e\u00e3\u0083\u00bc\u00e3\u0082\u00b8\u00e3\u0081\u0099\u00e3\u0082\u008b\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080\u00e3\u0082\u0092\u00e9\u0081\u00b8\u00e6\u008a\u009e\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e4\u00b8\u008b\u00e3\u0081\u0095\u00e3\u0081\u0084\u00e3\u0080\u0082
+SELECTED_REPOSITORY_FOLDER=\u00e3\u0083\u00aa\u00e3\u0083\u009d\u00e3\u0082\u00b8\u00e3\u0083\u0088\u00e3\u0083\u00aa\u00e3\u0081\u00a8\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e4\u00bd\u00bf\u00e7\u0094\u00a8\u00e3\u0081\u0099\u00e3\u0082\u008b\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080\u00e3\u0082\u0092\u00e9\u0081\u00b8\u00e6\u008a\u009e\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e4\u00b8\u008b\u00e3\u0081\u0095\u00e3\u0081\u0084\u00e3\u0080\u0082
+
+BUSY_REPOSITORY=\u00e4\u00bb\u0096\u00e3\u0081\u00ae\u00e3\u0083\u00a6\u00e3\u0083\u00bc\u00e3\u0082\u00b6\u00e3\u0081\u008c\u00e4\u00bd\u00bf\u00e7\u0094\u00a8\u00e4\u00b8\u00ad\u00e3\u0081\u00ae\u00e7\u0082\u00ba\u00e3\u0080\u0081\u00e5\u00ae\u009f\u00e8\u00a1\u008c\u00e3\u0081\u00a7\u00e3\u0081\u008d\u00e3\u0081\u00be\u00e3\u0081\u009b\u00e3\u0082\u0093\u00e3\u0080\u0082
+
+CONFIRM_TEMPLATE_UPDATE=\u00e5\u0090\u008c\u00e3\u0081\u0098\u00e3\u0082\u00bf\u00e3\u0082\u00a4\u00e3\u0083\u0088\u00e3\u0083\u00ab\u00e3\u0081\u00ae\u00e3\u0083\u0086\u00e3\u0083\u00b3\u00e3\u0083\u0097\u00e3\u0083\u00ac\u00e3\u0083\u00bc\u00e3\u0083\u0088\u00e3\u0081\u008c\u00e5\u00ad\u0098\u00e5\u009c\u00a8\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0080\u0082\u00e4\u00b8\u008a\u00e6\u009b\u00b8\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+TEMPLATE_MARKER_FOLDER_COMMENT=\u00e6\u00a8\u0099\u00e6\u00ba\u0096\u00e3\u0081\u00ae\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080\u00e3\u0083\u00bc\u00e3\u0083\u0086\u00e3\u0083\u00b3\u00e3\u0083\u0097\u00e3\u0083\u00ac\u00e3\u0083\u00bc\u00e3\u0083\u0088
+TEMPLATE_MARKER_TITLE=\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080\u00e3\u0083\u00bc\u00e3\u0083\u0086\u00e3\u0083\u00b3\u00e3\u0083\u0097\u00e3\u0083\u00ac\u00e3\u0083\u00bc\u00e3\u0083\u0088
+DEL_TEMPLATE_MARKER=\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080\u00e3\u0083\u00bc\u00e3\u0083\u0086\u00e3\u0083\u00b3\u00e3\u0083\u0097\u00e3\u0083\u00ac\u00e3\u0083\u00bc\u00e3\u0083\u0088\u00e5\u0089\u008a\u00e9\u0099\u00a4
+
+ADD_STYLESHEET=\u00e8\u00bf\u00bd\u00e5\u008a\u00a0
+CONFIRM_UPDATE_STYLESHEET=\u00e5\u0090\u008c\u00e3\u0081\u0098\u00e5\u0090\u008d\u00e5\u0089\u008d\u00e3\u0081\u00ae\u00e3\u0082\u00b9\u00e3\u0082\u00bf\u00e3\u0082\u00a4\u00e3\u0083\u00ab\u00e3\u0082\u00b7\u00e3\u0083\u00bc\u00e3\u0083\u0088\u00e3\u0081\u008c\u00e6\u0097\u00a2\u00e3\u0081\u00ab\u00e3\u0081\u0082\u00e3\u0082\u008a\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0080\u0082\u00e4\u00b8\u008a\u00e6\u009b\u00b8\u00e3\u0081\u008d\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0082\u0088\u00e3\u0082\u008d\u00e3\u0081\u0097\u00e3\u0081\u0084\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+DEL_STYLESHEET=\u00e5\u0089\u008a\u00e9\u0099\u00a4
+STYLESHEET=\u00e3\u0082\u00b9\u00e3\u0082\u00bf\u00e3\u0082\u00a4\u00e3\u0083\u00ab\u00e3\u0082\u00b7\u00e3\u0083\u00bc\u00e3\u0083\u0088
+
+CONFIRM_XML_IMPOER=XML\u00e3\u0083\u0095\u00e3\u0082\u00a1\u00e3\u0082\u00a4\u00e3\u0083\u00ab\u00e3\u0081\u008b\u00e3\u0082\u0089\u00e3\u0083\u0087\u00e3\u0083\u00bc\u00e3\u0082\u00bf\u00e3\u0082\u0092\u00e5\u008f\u0096\u00e3\u0082\u008a\u00e8\u00be\u00bc\u00e3\u0081\u00bf\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+CHECK_XML_IMPOER_CACHE_DOCUMENT=\u00e3\u0082\u00ad\u00e3\u0083\u00a3\u00e3\u0083\u0083\u00e3\u0082\u00b7\u00e3\u0083\u00a5\u00e3\u0083\u0089\u00e3\u0082\u00ad\u00e3\u0083\u00a5\u00e3\u0083\u00a1\u00e3\u0083\u00b3\u00e3\u0083\u0088\u00e3\u0082\u0082\u00e5\u008f\u0096\u00e3\u0082\u008a\u00e8\u00be\u00bc\u00e3\u0082\u0080
+ERROR_ZIP_ANALYSIS=zip\u00e3\u0083\u0095\u00e3\u0082\u00a1\u00e3\u0082\u00a4\u00e3\u0083\u00ab\u00e3\u0081\u00ae\u00e8\u00a7\u00a3\u00e6\u009e\u0090\u00e3\u0081\u00ab\u00e5\u00a4\u00b1\u00e6\u0095\u0097\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0097\u00e3\u0081\u009f\u00e3\u0080\u0082\nzip\u00e3\u0083\u0095\u00e3\u0082\u00a1\u00e3\u0082\u00a4\u00e3\u0083\u00ab\u00e3\u0082\u0092\u00e5\u00b1\u0095\u00e9\u0096\u008b\u00e5\u00be\u008c\u00e3\u0080\u0081XML\u00e3\u0083\u0095\u00e3\u0082\u00a1\u00e3\u0082\u00a4\u00e3\u0083\u00ab\u00e3\u0082\u0092\u00e7\u009b\u00b4\u00e6\u008e\u00a5\u00e3\u0083\u0089\u00e3\u0083\u00ad\u00e3\u0083\u0083\u00e3\u0083\u0097\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e4\u00b8\u008b\u00e3\u0081\u0095\u00e3\u0081\u0084\u00e3\u0080\u0082
+
+CONFIRM_AUTO_ANALYZE=\u00e8\u0087\u00aa\u00e5\u008b\u0095\u00e8\u00aa\u008d\u00e8\u00ad\u0098\u00e3\u0082\u0092\u00e5\u0086\u008d\u00e5\u00ba\u00a6\u00e8\u00a1\u008c\u00e3\u0081\u0084\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+
+CAPTURE_CLIPBOARD_NO_IMAGE=\u00e3\u0082\u00af\u00e3\u0083\u00aa\u00e3\u0083\u0083\u00e3\u0083\u0097\u00e3\u0083\u009c\u00e3\u0083\u00bc\u00e3\u0083\u0089\u00e3\u0081\u00ab\u00e7\u0094\u00bb\u00e5\u0083\u008f\u00e3\u0081\u008c\u00e3\u0081\u0082\u00e3\u0082\u008a\u00e3\u0081\u00be\u00e3\u0081\u009b\u00e3\u0082\u0093\u00e3\u0080\u0082
+
+CONFIRM_ADDON_FOLDER_ATTR_CHANGE=\u00e3\u0082\u00a2\u00e3\u0083\u0089\u00e3\u0082\u00aa\u00e3\u0083\u00b3\u00e3\u0081\u00ae\u00e5\u00b1\u009e\u00e6\u0080\u00a7\u00e3\u0081\u00ab\u00e5\u00a4\u0089\u00e6\u009b\u00b4\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0082\u0088\u00e3\u0082\u008d\u00e3\u0081\u0097\u00e3\u0081\u0084\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+
+CONFIRM_COPYOBJECT_OVERWRITE=\u00e7\u00a7\u00bb\u00e5\u008b\u0095\u00e5\u0085\u0088\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080\u00e3\u0081\u00ab\u00e3\u0082\u00b3\u00e3\u0083\u0094\u00e3\u0083\u00bc\u00e3\u0082\u00aa\u00e3\u0083\u0096\u00e3\u0082\u00b8\u00e3\u0082\u00a7\u00e3\u0082\u00af\u00e3\u0083\u0088\u00e3\u0081\u008c\u00e5\u00ad\u0098\u00e5\u009c\u00a8\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0080\u0082\u00e4\u00b8\u008a\u00e6\u009b\u00b8\u00e3\u0081\u008d\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+ALERT_COPYOBJECT_EXISTS=\u00e3\u0082\u00b3\u00e3\u0083\u0094\u00e3\u0083\u00bc\u00e5\u0085\u0088\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080\u00e3\u0081\u00ab\u00e6\u0097\u00a2\u00e3\u0081\u00ab\u00e3\u0082\u00b3\u00e3\u0083\u0094\u00e3\u0083\u00bc\u00e3\u0082\u00aa\u00e3\u0083\u0096\u00e3\u0082\u00b8\u00e3\u0082\u00a7\u00e3\u0082\u00af\u00e3\u0083\u0088\u00e3\u0081\u008c\u00e5\u00ad\u0098\u00e5\u009c\u00a8\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0080\u0082
+
+CONFIRM_EXPORT=\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080\u00e3\u0082\u0092\u00e3\u0082\u00a8\u00e3\u0082\u00af\u00e3\u0082\u00b9\u00e3\u0083\u009d\u00e3\u0083\u00bc\u00e3\u0083\u0088\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0080\u0082\u00e3\u0082\u0088\u00e3\u0082\u008d\u00e3\u0081\u0097\u00e3\u0081\u0084\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+CHECK_EXPORT_IN_CACHE_DOCUMENT=\u00e3\u0082\u00ad\u00e3\u0083\u00a3\u00e3\u0083\u0083\u00e3\u0082\u00b7\u00e3\u0083\u00a5\u00e3\u0083\u0089\u00e3\u0082\u00ad\u00e3\u0083\u00a5\u00e3\u0083\u00a1\u00e3\u0083\u00b3\u00e3\u0083\u0088\u00e3\u0082\u0082\u00e3\u0082\u00a8\u00e3\u0082\u00af\u00e3\u0082\u00b9\u00e3\u0083\u009d\u00e3\u0083\u00bc\u00e3\u0083\u0088\u00e3\u0081\u0099\u00e3\u0082\u008b
+SUCCEEDED_EXPORT=\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080\u00e3\u0081\u00ae\u00e3\u0082\u00a8\u00e3\u0082\u00af\u00e3\u0082\u00b9\u00e3\u0083\u009d\u00e3\u0083\u00bc\u00e3\u0083\u0088\u00e3\u0081\u00ab\u00e6\u0088\u0090\u00e5\u008a\u009f\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0097\u00e3\u0081\u009f\u00e3\u0080\u0082
+
+REPLACED_URL=URL\u00e7\u00bd\u00ae\u00e6\u008f\u009b
+CONFIRM_REPLACED_URL=\u00e4\u00bb\u00b6\u00e3\u0080\u0081\u00e7\u00bd\u00ae\u00e6\u008f\u009b\u00e5\u00af\u00be\u00e8\u00b1\u00a1\u00e3\u0081\u008c\u00e5\u00ad\u0098\u00e5\u009c\u00a8\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0080\u0082\nURL\u00e3\u0082\u0092\u00e7\u00bd\u00ae\u00e6\u008f\u009b\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+ALERT_REPLACED_URL=\u00e7\u00bd\u00ae\u00e6\u008f\u009b\u00e5\u00af\u00be\u00e8\u00b1\u00a1\u00e3\u0081\u008c\u00e5\u00ad\u0098\u00e5\u009c\u00a8\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u009b\u00e3\u0082\u0093\u00e3\u0080\u0082
+MSG_REPLACED_URL=\u00e5\u00a4\u0089\u00e6\u009b\u00b4\u00e5\u0086\u0085\u00e5\u00ae\u00b9\u00e3\u0082\u0092\u00e5\u008f\u008d\u00e6\u0098\u00a0\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0081\u0084\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0080\u0082
+CONFIRM_REPLACED_TARGET=\u00e9\u0085\u008d\u00e4\u00b8\u008b\u00e3\u0081\u00ae\u00e5\u0085\u00a8\u00e3\u0082\u00aa\u00e3\u0083\u0096\u00e3\u0082\u00b8\u00e3\u0082\u00a7\u00e3\u0082\u00af\u00e3\u0083\u0088\u00e3\u0082\u0092\u00e7\u00bd\u00ae\u00e6\u008f\u009b\u00e5\u00af\u00be\u00e8\u00b1\u00a1\u00e3\u0081\u00ab\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+CONFIRM_REPLACED_TITLE=URL\u00e7\u00bd\u00ae\u00e6\u008f\u009b
+
+MSG_DATABASE_USE=\u00e4\u00bd\u00bf\u00e7\u0094\u00a8\u00e4\u00b8\u00ad
+MSG_USE_TITLE=\u00e4\u00bd\u00bf\u00e7\u0094\u00a8\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0081\u0084\u00e3\u0082\u008b\u00e9\u00a0\u0085\u00e7\u009b\u00ae
+MSG_DATAFILE=\u00e3\u0083\u0087\u00e3\u0083\u00bc\u00e3\u0082\u00bf\u00e3\u0083\u0095\u00e3\u0082\u00a1\u00e3\u0082\u00a4\u00e3\u0083\u00ab
+MSG_ADD_DATAFILE=\u00e3\u0083\u0087\u00e3\u0083\u00bc\u00e3\u0082\u00bf\u00e3\u0083\u0095\u00e3\u0082\u00a1\u00e3\u0082\u00a4\u00e3\u0083\u00ab\u00e8\u00bf\u00bd\u00e5\u008a\u00a0
+CONFIRM_NEW_DATAFILE=\u00e6\u0096\u00b0\u00e8\u00a6\u008f\u00e3\u0081\u00ab\u00e3\u0083\u0087\u00e3\u0083\u00bc\u00e3\u0082\u00bf\u00e3\u0083\u0095\u00e3\u0082\u00a1\u00e3\u0082\u00a4\u00e3\u0083\u00ab\u00e3\u0082\u0092\u00e4\u00bd\u009c\u00e6\u0088\u0090\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+ERROR_ADD_DATAFILE_3=\u00e6\u008c\u0087\u00e5\u00ae\u009a\u00e3\u0081\u0095\u00e3\u0082\u008c\u00e3\u0081\u009f\u00e3\u0083\u0095\u00e3\u0082\u00a1\u00e3\u0082\u00a4\u00e3\u0083\u00ab\u00e3\u0081\u00af\u00e3\u0080\u0081\u00e6\u0097\u00a2\u00e3\u0081\u00ab\u00e4\u00bd\u00bf\u00e7\u0094\u00a8\u00e3\u0081\u0095\u00e3\u0082\u008c\u00e3\u0081\u00a6\u00e3\u0081\u0084\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0080\u0082\n\u00e3\u0082\u0082\u00e3\u0081\u0086\u00e4\u00b8\u0080\u00e5\u00ba\u00a6\u00e6\u008c\u0087\u00e5\u00ae\u009a\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+MSG_EXISTING_DATABASE=\u00e6\u0097\u00a2\u00e5\u00ad\u0098\u00e3\u0081\u00ae\u00e3\u0083\u0087\u00e3\u0083\u00bc\u00e3\u0082\u00bf\u00e3\u0083\u0095\u00e3\u0082\u00a1\u00e3\u0082\u00a4\u00e3\u0083\u00ab\u00e3\u0082\u0092\u00e4\u00bd\u00bf\u00e7\u0094\u00a8\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0080\u0082
+
+MSG_LOADING_SCRAP=Wired-Marker\u00e6\u0083\u0085\u00e5\u00a0\u00b1\u00e3\u0082\u0092\u00e3\u0083\u00ad\u00e3\u0083\u00bc\u00e3\u0083\u0089\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0081\u0084\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0080\u0082
+
+MARKER_CUSTOM_1=background-color: rgb(253,  49,  31); color: rgb(0, 0, 0);
+MARKER_CUSTOM_2=background-color: rgb( 44, 254,  81); color: rgb(0, 0, 0);
+MARKER_CUSTOM_3=background-color: rgb(206,  56, 200); color: rgb(0, 0, 0);
+MARKER_CUSTOM_4=background-color: rgb(  0,  55, 153); color: rgb(255, 255, 255);
+MARKER_CUSTOM_5=background-color: rgb(  0, 154, 156); color: rgb(0, 0, 0);
+MARKER_CUSTOM_6=background-color: rgb( 51, 205,  52); color: rgb(0, 0, 0);
+MARKER_CUSTOM_7=background-color: rgb(255, 205,  54); color: rgb(0, 0, 0);
+MARKER_CUSTOM_8=background-color: rgb(255, 100,  31); color: rgb(0, 0, 0);
+
+CONFIRM_SETTING_CHANGE_RESTART_APP=\u00e5\u00a4\u0089\u00e6\u009b\u00b4\u00e3\u0082\u0092\u00e5\u008f\u008d\u00e6\u0098\u00a0\u00e3\u0081\u0099\u00e3\u0082\u008b\u00e3\u0081\u00ab\u00e3\u0081\u00af\u00e3\u0080\u0081\u00e5\u0086\u008d\u00e8\u00b5\u00b7\u00e5\u008b\u0095\u00e3\u0081\u008c\u00e5\u00bf\u0085\u00e8\u00a6\u0081\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0080\u0082\n\u00e4\u00bb\u008a\u00e3\u0081\u0099\u00e3\u0081\u0090\u00e5\u0086\u008d\u00e8\u00b5\u00b7\u00e5\u008b\u0095\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+
+CONFIRM_REGISTERED_FAVORITE_FOLDER=\u00e6\u008c\u0087\u00e5\u00ae\u009a\u00e3\u0081\u0095\u00e3\u0082\u008c\u00e3\u0081\u009f\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080\u00e3\u0081\u00af\u00e6\u0097\u00a2\u00e3\u0081\u00ab\u00e7\u0099\u00bb\u00e9\u008c\u00b2\u00e3\u0081\u0095\u00e3\u0082\u008c\u00e3\u0081\u00a6\u00e3\u0081\u0084\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0080\u0082\u00e8\u00bf\u00bd\u00e5\u008a\u00a0\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+
+ALERT_REGISTERED=\u00e6\u0097\u00a2\u00e3\u0081\u00ab\u00e7\u0099\u00bb\u00e9\u008c\u00b2\u00e3\u0081\u0095\u00e3\u0082\u008c\u00e3\u0081\u00a6\u00e3\u0081\u0084\u00e3\u0081\u00be\u00e3\u0081\u0099
+
+CONFIRM_SUBSTITUTION_TABLE_NONE=\u00e9\u0081\u00b8\u00e6\u008a\u009e\u00e3\u0081\u0095\u00e3\u0082\u008c\u00e3\u0081\u00a6\u00e3\u0081\u0084\u00e3\u0082\u008b\u00e7\u0094\u00bb\u00e5\u0083\u008f\u00e3\u0081\u00ae\u00e4\u00bb\u00a3\u00e6\u009b\u00bf\u00e3\u0083\u0086\u00e3\u0082\u00ad\u00e3\u0082\u00b9\u00e3\u0083\u0088\u00e3\u0081\u008c\u00e7\u00bd\u00ae\u00e6\u008f\u009b\u00e8\u00a1\u00a8\u00e3\u0081\u00ab\u00e5\u00ad\u0098\u00e5\u009c\u00a8\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u009b\u00e3\u0082\u0093\u00e3\u0080\u0082\n\u00e8\u00bf\u00bd\u00e5\u008a\u00a0\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+
+MSG_SUBSTITUTION_ADD=\u00e8\u00bf\u00bd\u00e5\u008a\u00a0
+MSG_SUBSTITUTION_EDIT=\u00e7\u00b7\u00a8\u00e9\u009b\u0086
+MSG_SUBSTITUTION_FILENAME=\u00e3\u0083\u0095\u00e3\u0082\u00a1\u00e3\u0082\u00a4\u00e3\u0083\u00ab\u00e5\u0090\u008d
+MSG_SUBSTITUTION_INPUT_FILENAME=\u00e3\u0083\u0095\u00e3\u0082\u00a1\u00e3\u0082\u00a4\u00e3\u0083\u00ab\u00e5\u0090\u008d\u00e3\u0082\u0092\u00e5\u0085\u00a5\u00e5\u008a\u009b\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e4\u00b8\u008b\u00e3\u0081\u0095\u00e3\u0081\u0084
+MSG_SUBSTITUTION_INPUT_SUBSTITUTE_TEXT=\u00e4\u00bb\u00a3\u00e6\u009b\u00bf\u00e3\u0083\u0086\u00e3\u0082\u00ad\u00e3\u0082\u00b9\u00e3\u0083\u0088\u00e3\u0082\u0092\u00e5\u0085\u00a5\u00e5\u008a\u009b\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e4\u00b8\u008b\u00e3\u0081\u0095\u00e3\u0081\u0084
+
+MSG_IMPORT_TAG=\u00e5\u008f\u0096\u00e8\u00be\u00bc\u00e4\u00b8\u00ad
+MSG_READING_DOCUMENTS=\u00e3\u0083\u0089\u00e3\u0082\u00ad\u00e3\u0083\u00a5\u00e3\u0083\u00a1\u00e3\u0083\u00b3\u00e3\u0083\u0088\u00e8\u00aa\u00ad\u00e8\u00be\u00bc\u00e4\u00b8\u00ad
+MSG_READING_DICTIONARY=\u00e8\u00be\u009e\u00e6\u009b\u00b8\u00e8\u00aa\u00ad\u00e8\u00be\u00bc\u00e4\u00b8\u00ad
+SUCCEEDED_READING_DICTIONARY=\u00e8\u00be\u009e\u00e6\u009b\u00b8\u00e3\u0081\u00ae\u00e8\u00aa\u00ad\u00e8\u00be\u00bc\u00e3\u0082\u0092\u00e5\u00ae\u008c\u00e4\u00ba\u0086\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0097\u00e3\u0081\u009f\u00e3\u0080\u0082
+CONFIRM_READING_DOCUMENTS_SELECT_OVER=\u00e6\u008c\u0087\u00e5\u00ae\u009a\u00e3\u0083\u0095\u00e3\u0082\u00a1\u00e3\u0082\u00a4\u00e3\u0083\u00ab\u00e6\u0095\u00b0\u00e3\u0081\u008c\u00e5\u00a4\u009a\u00e3\u0081\u0084\u00e7\u0082\u00ba\u00e3\u0080\u0081\u00e3\u0082\u00a8\u00e3\u0083\u00a9\u00e3\u0083\u00bc\u00e7\u0099\u00ba\u00e7\u0094\u009f\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0097\u00e3\u0081\u009f\u00e3\u0080\u0082\n\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080\u00e6\u008c\u0087\u00e5\u00ae\u009a\u00e3\u0081\u00a7\u00e3\u0083\u0095\u00e3\u0082\u00a1\u00e3\u0082\u00a4\u00e3\u0083\u00ab\u00e3\u0082\u0092\u00e7\u0099\u00bb\u00e9\u008c\u00b2\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+
+CONFIRM_BROWSER_TO_FIT_TEXT=\u00e3\u0083\u0096\u00e3\u0083\u00a9\u00e3\u0082\u00a6\u00e3\u0082\u00b6\u00e5\u0086\u0085\u00e3\u0081\u00ae\u00e8\u00a1\u00a8\u00e7\u00a4\u00ba\u00e9\u00a0\u0098\u00e5\u009f\u009f\u00e5\u0086\u0085\u00e3\u0081\u00ab\u00e7\u00b4\u008d\u00e3\u0081\u00be\u00e3\u0082\u008b\u00e3\u0082\u0088\u00e3\u0081\u0086\u00e3\u0081\u00ab\u00e8\u0087\u00aa\u00e5\u008b\u0095\u00e6\u0094\u00b9\u00e8\u00a1\u008c\u00e8\u00a1\u00a8\u00e7\u00a4\u00ba\u00e3\u0081\u00ab\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+
+CONFIRM_CACHEPAGE_MARKING=\u00e3\u0081\u0093\u00e3\u0081\u00ae\u00e3\u0083\u0089\u00e3\u0082\u00ad\u00e3\u0083\u00a5\u00e3\u0083\u00a1\u00e3\u0083\u00b3\u00e3\u0083\u0088\u00e3\u0081\u00af\u00e3\u0082\u00ad\u00e3\u0083\u00a3\u00e3\u0083\u0083\u00e3\u0082\u00b7\u00e3\u0083\u00a5\u00e3\u0081\u0095\u00e3\u0082\u008c\u00e3\u0081\u009f\u00e3\u0083\u0089\u00e3\u0082\u00ad\u00e3\u0083\u00a5\u00e3\u0083\u00a1\u00e3\u0083\u00b3\u00e3\u0083\u0088\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0080\u0082\u00e3\u0082\u00aa\u00e3\u0083\u00aa\u00e3\u0082\u00b8\u00e3\u0083\u008a\u00e3\u0083\u00ab\u00e3\u0081\u00ae\u00e3\u0083\u0089\u00e3\u0082\u00ad\u00e3\u0083\u00a5\u00e3\u0083\u00a1\u00e3\u0083\u00b3\u00e3\u0083\u0088\u00e3\u0081\u00ab\u00e3\u0083\u009e\u00e3\u0083\u00bc\u00e3\u0082\u00ad\u00e3\u0083\u00b3\u00e3\u0082\u00b0\u00e3\u0081\u008c\u00e5\u008f\u008d\u00e6\u0098\u00a0\u00e3\u0081\u0095\u00e3\u0082\u008c\u00e3\u0081\u00aa\u00e3\u0081\u0084\u00e5\u00a0\u00b4\u00e5\u0090\u0088\u00e3\u0081\u008c\u00e3\u0081\u0082\u00e3\u0082\u008a\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0080\u0082\n\u00e3\u0082\u0088\u00e3\u0082\u008d\u00e3\u0081\u0097\u00e3\u0081\u0084\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+ALERT_CACHEPAGE_MARKING=\u00e3\u0081\u0093\u00e3\u0081\u00ae\u00e3\u0083\u0089\u00e3\u0082\u00ad\u00e3\u0083\u00a5\u00e3\u0083\u00a1\u00e3\u0083\u00b3\u00e3\u0083\u0088\u00e3\u0081\u00af\u00e3\u0082\u00ad\u00e3\u0083\u00a3\u00e3\u0083\u0083\u00e3\u0082\u00b7\u00e3\u0083\u00a5\u00e3\u0081\u0095\u00e3\u0082\u008c\u00e3\u0081\u009f\u00e3\u0083\u0089\u00e3\u0082\u00ad\u00e3\u0083\u00a5\u00e3\u0083\u00a1\u00e3\u0083\u00b3\u00e3\u0083\u0088\u00e3\u0081\u00ae\u00e7\u0082\u00ba\u00e3\u0080\u0081\u00e3\u0083\u009e\u00e3\u0083\u00bc\u00e3\u0082\u00ad\u00e3\u0083\u00b3\u00e3\u0082\u00b0\u00e3\u0081\u00a7\u00e3\u0081\u008d\u00e3\u0081\u00be\u00e3\u0081\u009b\u00e3\u0082\u0093\u00e3\u0080\u0082
+BUTTON_CACHEPAGE_MARKING=\u00e3\u0082\u00aa\u00e3\u0083\u00aa\u00e3\u0082\u00b8\u00e3\u0083\u008a\u00e3\u0083\u00ab\u00e3\u0081\u00ae\u00e3\u0083\u0089\u00e3\u0082\u00ad\u00e3\u0083\u00a5\u00e3\u0083\u00a1\u00e3\u0083\u00b3\u00e3\u0083\u0088\u00e3\u0082\u0092\u00e9\u0096\u008b\u00e3\u0081\u008f
+CONFIRM_AUTOCACHE_MANUALLY_LAST=\u00e5\u0089\u008d\u00e5\u009b\u009e\u00e3\u0081\u00ae\u00e3\u0082\u00ad\u00e3\u0083\u00a3\u00e3\u0083\u0083\u00e3\u0082\u00b7\u00e3\u0083\u00a5\u00e6\u0097\u00a5\u00e6\u0099\u0082
+CONFIRM_AUTOCACHE_MANUALLY_EXEC=\u00e3\u0083\u0089\u00e3\u0082\u00ad\u00e3\u0083\u00a5\u00e3\u0083\u00a1\u00e3\u0083\u00b3\u00e3\u0083\u0088\u00e3\u0082\u0092\u00e3\u0082\u00ad\u00e3\u0083\u00a3\u00e3\u0083\u0083\u00e3\u0082\u00b7\u00e3\u0083\u00a5\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+BUTTON_CACHEPAGE_OPEN=\u00e3\u0082\u00ad\u00e3\u0083\u00a3\u00e3\u0083\u0083\u00e3\u0082\u00b7\u00e3\u0083\u00a5\u00e3\u0083\u0089\u00e3\u0082\u00ad\u00e3\u0083\u00a5\u00e3\u0083\u00a1\u00e3\u0083\u00b3\u00e3\u0083\u0088\u00e3\u0082\u0092\u00e9\u0096\u008b\u00e3\u0081\u008f
+MSG_CACHEPAGE_NONE=\u00e3\u0082\u00ad\u00e3\u0083\u00a3\u00e3\u0083\u0083\u00e3\u0082\u00b7\u00e3\u0083\u00a5\u00e3\u0083\u0089\u00e3\u0082\u00ad\u00e3\u0083\u00a5\u00e3\u0083\u00a1\u00e3\u0083\u00b3\u00e3\u0083\u0088\u00e3\u0081\u00af\u00e3\u0081\u0082\u00e3\u0082\u008a\u00e3\u0081\u00be\u00e3\u0081\u009b\u00e3\u0082\u0093
+
+SUCCEEDED_INDEX=\u00e3\u0080\u008c\u00e7\u00b4\u00a2\u00e5\u00bc\u0095\u00e3\u0080\u008d\u00e3\u0081\u00ae\u00e4\u00bf\u009d\u00e5\u00ad\u0098\u00e3\u0081\u00ab\u00e6\u0088\u0090\u00e5\u008a\u009f\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0097\u00e3\u0081\u009f\u00e3\u0080\u0082
+
+SUCCEEDED_DICTIONARY_UPDATE=\u00e8\u00be\u009e\u00e6\u009b\u00b8\u00e3\u0081\u00ae\u00e6\u009b\u00b4\u00e6\u0096\u00b0\u00e3\u0081\u00ab\u00e6\u0088\u0090\u00e5\u008a\u009f\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0097\u00e3\u0081\u009f\u00e3\u0080\u0082
+ALERT_DICTIONARY_UPDATE=\u00e4\u00bd\u0095\u00e3\u0082\u0089\u00e3\u0081\u008b\u00e3\u0081\u00ae\u00e5\u008e\u009f\u00e5\u009b\u00a0\u00e3\u0081\u00a7\u00e8\u00be\u009e\u00e6\u009b\u00b8\u00e3\u0081\u00ae\u00e6\u009b\u00b4\u00e6\u0096\u00b0\u00e3\u0081\u00ab\u00e5\u00a4\u00b1\u00e6\u0095\u0097\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0097\u00e3\u0081\u009f\u00e3\u0080\u0082
+CONFIRM_DICTIONARY_UPDATE=\u00e8\u00be\u009e\u00e6\u009b\u00b8\u00e3\u0081\u008c\u00e4\u00bd\u009c\u00e6\u0088\u0090\u00e3\u0081\u0095\u00e3\u0082\u008c\u00e3\u0081\u00a6\u00e3\u0081\u0084\u00e3\u0081\u00be\u00e3\u0081\u009b\u00e3\u0082\u0093\u00e3\u0080\u0082\u00e4\u00bd\u009c\u00e6\u0088\u0090\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0082\u0088\u00e3\u0082\u008d\u00e3\u0081\u0097\u00e3\u0081\u0084\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+MSG_DOCUMENTATION_TO_MATCH_THE_DICTIONARY=\u00e8\u00be\u009e\u00e6\u009b\u00b8\u00e3\u0081\u00a8\u00e3\u0083\u0089\u00e3\u0082\u00ad\u00e3\u0083\u00a5\u00e3\u0083\u00a1\u00e3\u0083\u00b3\u00e3\u0083\u0088\u00e3\u0082\u0092\u00e7\u0085\u00a7\u00e5\u0090\u0088\u00e4\u00b8\u00ad
+SUCCEEDED_DICTIONARY_SAVE=\u00e8\u00be\u009e\u00e6\u009b\u00b8\u00e3\u0081\u00ae\u00e6\u009b\u00b8\u00e3\u0081\u008d\u00e5\u0087\u00ba\u00e3\u0081\u0097\u00e3\u0081\u00ab\u00e6\u0088\u0090\u00e5\u008a\u009f\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0097\u00e3\u0081\u009f\u00e3\u0080\u0082
+ALERT_DICTIONARY_NO_TERMS=\u00e8\u00be\u009e\u00e6\u009b\u00b8\u00e3\u0081\u00ab\u00e3\u0082\u00bf\u00e3\u0083\u00bc\u00e3\u0083\u00a0\u00e3\u0081\u008c\u00e5\u00ad\u0098\u00e5\u009c\u00a8\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u009b\u00e3\u0082\u0093\u00e3\u0080\u0082
+
+MSG_FILE_FORMAT_ORIGINAL=HTML\u00e3\u0081\u00be\u00e3\u0081\u009f\u00e3\u0081\u00afTEXT\u00e3\u0083\u0095\u00e3\u0082\u00a1\u00e3\u0082\u00a4\u00e3\u0083\u00ab\u00e5\u00bd\u00a2\u00e5\u00bc\u008f
+MSG_FILE_FORMAT_HTML=HTML\u00e3\u0083\u0095\u00e3\u0082\u00a1\u00e3\u0082\u00a4\u00e3\u0083\u00ab\u00e5\u00bd\u00a2\u00e5\u00bc\u008f
+
+FAVORITEFOLDER_SELECT=\u00e9\u0081\u00b8\u00e6\u008a\u009e
+FAVORITEFOLDER_DELETE=\u00e5\u0089\u008a\u00e9\u0099\u00a4
+
+CONFIRM_FILE_OVERWRITE=\u00e6\u008c\u0087\u00e5\u00ae\u009a\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080\u00e3\u0081\u00ab\u00e3\u0083\u0095\u00e3\u0082\u00a1\u00e3\u0082\u00a4\u00e3\u0083\u00ab\u00e3\u0081\u008c\u00e5\u00ad\u0098\u00e5\u009c\u00a8\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0080\u0082\u00e4\u00b8\u008a\u00e6\u009b\u00b8\u00e3\u0081\u008d\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/meta.dtd
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/meta.dtd	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/meta.dtd	(revision 5703)
@@ -0,0 +1,25 @@
+<!ENTITY meta.dialog.capture.groupbox.caption          "ãã­ã¥ã¡ã³ãã®ã¡ã¿ããŒã¿ã®åèŸŒ">
+<!ENTITY meta.dialog.capture.groupbox.checkbox.confirm "ããŒã«ãŒæã«ã¡ã¿ããŒã¿ãåãèŸŒãŸãªã">
+<!ENTITY meta.dialog.capture.tag.groupbox.caption      "åèŸŒå¯Ÿè±¡ã¿ã°">
+
+<!ENTITY meta.menuitem.hyperanchor.copy_to_clipboard       "HYPER-ANCHOR Code">
+<!ENTITY meta.menuitem.hyperanchor.copyformat_to_clipboard "ã³ããŒ (ãŠãŒã¶åœ¢åŒ)">
+<!ENTITY meta.menuitem.hyperanchor.copytitle_to_clipboard  "ã¿ã€ãã«">
+<!ENTITY meta.menuitem.hyperanchor.copynote_to_clipboard   "ããŒã">
+<!ENTITY meta.menuitem.hyperanchor.copymeta_to_clipboard   "ããŒãžã¿ã€ãã«">
+<!ENTITY meta.menuitem.hyperanchor.copyformatsetting       "ã³ããŒåœ¢åŒã®èš­å®">
+
+<!ENTITY meta.dialog.copyformat.checkbox.hyperanchor "ã¢ã³ã«ãŒã¿ã°">
+<!ENTITY meta.dialog.copyformat.checkbox.title       "ã¿ã€ãã«">
+<!ENTITY meta.dialog.copyformat.checkbox.note        "ããŒã">
+<!ENTITY meta.dialog.copyformat.checkbox.meta        "ããŒãžã¿ã€ãã«">
+<!ENTITY meta.dialog.copyformat.checkbox.hash        "HYPER-ANCHOR Codeã«ãªãªãžãã«URLã®ã¢ã³ã«ãŒæ
+å ±ãå«ãã(URLã®#ä»¥éã®æå­å)">
+
+<!ENTITY meta.dialog.copyformat.radio.tag     "ã¿ã°ãã">
+<!ENTITY meta.dialog.copyformat.radio.nonetag "ã¿ã°ãªã">
+
+<!ENTITY meta.dialog.pubmedcentral.pdf.groupbox.caption              "PubMed Centralã®ãã­ã¥ã¡ã³ãåŠçæ">
+<!ENTITY meta.dialog.pubmedcentral.pdf.capture.checkbox.confirm      "NCBIããMEDLINEãååŸãã">
+<!ENTITY meta.dialog.pubmedcentral.pdf.substitution.checkbox.confirm "ååŸããMEDLINEã®æ
+å ±ã§ããŒãžã¿ã€ãã«ãçœ®æãã">
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/objectmng.properties
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/objectmng.properties	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/objectmng.properties	(revision 5703)
@@ -0,0 +1,9 @@
+APP_TITLE=DWAN
+# APP_TITLE=WiredMarker
+APP_DISP_TITLE=Wired-Marker
+MARKER_FOLDER=\u00e3\u0083\u009e\u00e3\u0083\u00bc\u00e3\u0082\u00ab\u00e3\u0083\u00bc
+LOCAL_FOLDER=\u00e3\u0083\u00ad\u00e3\u0083\u00bc\u00e3\u0082\u00ab\u00e3\u0083\u00ab\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080
+SHARED_FOLDER=\u00e5\u0085\u00b1\u00e6\u009c\u0089\u00e3\u0083\u0095\u00e3\u0082\u00a9\u00e3\u0083\u00ab\u00e3\u0083\u0080
+CONFIRM_DELETE=\u00e6\u009c\u00ac\u00e5\u00bd\u0093\u00e3\u0081\u00ab\u00e5\u0089\u008a\u00e9\u0099\u00a4\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0082\u0088\u00e3\u0082\u008d\u00e3\u0081\u0097\u00e3\u0081\u0084\u00e3\u0081\u00a7\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+CONVERT_DATABASE=\u00e3\u0083\u0087\u00e3\u0083\u00bc\u00e3\u0082\u00bf\u00e3\u0083\u0099\u00e3\u0083\u00bc\u00e3\u0082\u00b9\u00e3\u0082\u0092\u00e5\u00a4\u0089\u00e6\u008f\u009b\u00e3\u0081\u0097\u00e3\u0081\u00a6\u00e3\u0081\u0084\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0080\u0082
+CONVERT_END_DATABASE=\u00e3\u0083\u0087\u00e3\u0083\u00bc\u00e3\u0082\u00bf\u00e3\u0083\u0099\u00e3\u0083\u00bc\u00e3\u0082\u00b9\u00e3\u0081\u00ae\u00e5\u00a4\u0089\u00e6\u008f\u009b\u00e3\u0081\u008c\u00e7\u00b5\u0082\u00e4\u00ba\u0086\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0097\u00e3\u0081\u009f\u00e3\u0080\u0082\u00e5\u0086\u008d\u00e8\u00b5\u00b7\u00e5\u008b\u0095\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0080\u0082
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/pdf.dtd
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/pdf.dtd	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/pdf.dtd	(revision 5703)
@@ -0,0 +1,9 @@
+<!ENTITY pdf.addtext.dialog.title  "ç»é²">
+<!ENTITY pdf.addtext.dialog.msg    "ããŒã«ã¯ä»ããŸããããä»¥äžã®æ
+å ±ãç»é²ããŸããïŒ">
+<!ENTITY pdf.addtext.caption.title "ã¿ã€ãã«">
+<!ENTITY pdf.addtext.caption.url   "URL">
+<!ENTITY pdf.addtext.caption.note  "ããŒã">
+<!ENTITY pdf.addtext.caption.pageinfo  "ããŒãžæ
+å ±">
+<!ENTITY pdf.addtext.caption.pagetitle "ããŒãžã¿ã€ãã«">
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/remap.dtd
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/remap.dtd	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/remap.dtd	(revision 5703)
@@ -0,0 +1,1 @@
+<!ENTITY remap.menuitem "åããã">
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/remap.properties
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/remap.properties	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/remap.properties	(revision 5703)
@@ -0,0 +1,3 @@
+CONFIRM_FIND_RESULTS=å¯Ÿè±¡æå­åãè€æ°å­åšããŸããåãããããŸããïŒ
+ALERT_FIND_RESULT=å¯Ÿè±¡æå­åã¯å­åšããŸããã§ããã
+ALERT_MAP_RESULT=åãããããŸããã
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/scrappartymerge.dtd
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/scrappartymerge.dtd	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/scrappartymerge.dtd	(revision 5703)
@@ -0,0 +1,29 @@
+<!ENTITY scrappartymerge.app.menu.title "BITS">
+<!ENTITY scrappartymerge.app.title "ããŒãž">
+
+<!ENTITY scrappartymerge.menu.title "BITS">
+<!ENTITY scrappartymerge.menu.addon "ã¢ããªã³">
+<!ENTITY scrappartymerge.menu.option "ãªãã·ã§ã³">
+
+<!ENTITY scrappartymerge.marker.start.label "ããŒã«ãŒã®éå§äœçœ®ãåãå Žå">
+<!ENTITY scrappartymerge.marker.start.value "1">
+<!ENTITY scrappartymerge.marker.end.label   "ããŒã«ãŒã®çµäºäœçœ®ãåãå Žå">
+<!ENTITY scrappartymerge.marker.end.value   "2">
+<!ENTITY scrappartymerge.marker.all.label   "ããŒã«ãŒã®ç¯å²ãåãå Žå">
+<!ENTITY scrappartymerge.marker.all.value   "0">
+
+<!ENTITY scrappartymerge.condition     "æ¡ä»¶">
+<!ENTITY scrappartymerge.confirm       "ç¢ºèª">
+<!ENTITY scrappartymerge.confirm.merge "ããŒãžæã«ç¢ºèªãã">
+
+<!ENTITY scrappartymerge.mergemode             "ããŒãžã¢ãŒã">
+<!ENTITY scrappartymerge.mergemode.merge       "ããŒãž">
+<!ENTITY scrappartymerge.mergemode.overwrite   "äžæžã">
+<!ENTITY scrappartymerge.mergemode.destruction "ç Žæ£">
+
+<!ENTITY scrappartymerge.confirm.title "å®è¡ã¢ãŒãç¢ºèª">
+<!ENTITY scrappartymerge.confirm.mergeobject "ããŒãžå
+ãªããžã§ã¯ã">
+<!ENTITY scrappartymerge.confirm.dropobject  "ãã­ãããªããžã§ã¯ã">
+
+<!ENTITY scrappartymerge.confirm.same_processing   "åãåŠçãæ¬¡åããé©çš">
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/scrappartymerge.properties
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/scrappartymerge.properties	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/scrappartymerge.properties	(revision 5703)
@@ -0,0 +1,8 @@
+APP_TITLE=DWAN
+# APP_TITLE=WiredMarker
+APP_DISP_TITLE=Wired-Marker
+
+CONFIRM=\u00e7\u00a2\u00ba\u00e8\u00aa\u008d
+CONFIRM_MERGE=\u00e3\u0083\u009e\u00e3\u0083\u00bc\u00e3\u0082\u00b8\u00e3\u0081\u0097\u00e3\u0081\u00be\u00e3\u0081\u0099\u00e3\u0081\u008b\u00ef\u00bc\u009f
+CONFIRM_SKIP=\u00e3\u0082\u00b9\u00e3\u0082\u00ad\u00e3\u0083\u0083\u00e3\u0083\u0097
+MOT_CONFIRM_NEXT_TIME=\u00e6\u00ac\u00a1\u00e5\u009b\u009e\u00e3\u0081\u008b\u00e3\u0082\u0089\u00e7\u00a2\u00ba\u00e8\u00aa\u008d\u00e3\u0081\u0097\u00e3\u0081\u00aa\u00e3\u0081\u0084
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/searchacross.dtd
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/searchacross.dtd	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/searchacross.dtd	(revision 5703)
@@ -0,0 +1,2 @@
+<!ENTITY searchacross.search.textbox.emptytext "æ€çŽ¢ããæå­åãå
+¥åããŠäžãã">
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/treecontextmenu.dtd
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/treecontextmenu.dtd	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/locale/ja-JP/markingcollection/treecontextmenu.dtd	(revision 5703)
@@ -0,0 +1,26 @@
+<!ENTITY treecontextmenu.folder                 "ãã©ã«ã">
+<!ENTITY treecontextmenu.folder.new             "ç©ºãã©ã«ããäœæ">
+<!ENTITY treecontextmenu.folder.template.new    "ãã³ãã¬ãŒããäœ¿çšããŠãã©ã«ããäœæ">
+<!ENTITY treecontextmenu.folder.template.create "ãã³ãã¬ãŒããäœæ">
+<!ENTITY treecontextmenu.folder.template.remove "ãã³ãã¬ãŒããåé€">
+
+<!ENTITY treecontextmenu.view       "è¡šç€º">
+<!ENTITY treecontextmenu.view.list  "ãªã¹ãè¡šç€º">
+<!ENTITY treecontextmenu.view.list.remove "é€ã">
+<!ENTITY treecontextmenu.view.itemviewstyle         "ã¢ã€ãã ãã¥ãŒã¹ã¿ã€ã«">
+<!ENTITY treecontextmenu.view.itemviewstyle.favicon "ã¢ã€ã³ã³ãµã€ãº">
+<!ENTITY treecontextmenu.view.itemviewstyle.items   "è¡šç€ºã¢ã€ãã ">
+<!ENTITY treecontextmenu.view.filter  "ãã©ã«ããã£ã«ã¿">
+
+<!ENTITY treecontextmenu.import       "ã€ã³ããŒã">
+<!ENTITY treecontextmenu.import.capture       "ã€ã¡ãŒãžãã­ã£ããã£">
+<!ENTITY treecontextmenu.import.tag       "HTMLã¿ã°ãæå®ããŠåèŸŒ">
+<!ENTITY treecontextmenu.import.localfile "ã­ãŒã«ã«ãã¡ã€ã«ã®äžæ¬ç»é²">
+
+<!ENTITY treecontextmenu.export           "ãšã¯ã¹ããŒã">
+<!ENTITY treecontextmenu.export.export    "Wired-Markeråœ¢åŒã§ãšã¯ã¹ããŒã">
+<!ENTITY treecontextmenu.export.tagoutput "ãã©ã«ãå
+ã®ã³ã³ãã³ããã¿ã°ä»ãåºå">
+
+<!ENTITY treecontextmenu.automarking            "èªåããŒã­ã³ã°">
+<!ENTITY treecontextmenu.automarking.dictionary "èŸæž">
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/annotator-skin/dasish.css
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/annotator-skin/dasish.css	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/annotator-skin/dasish.css	(revision 5703)
@@ -0,0 +1,20 @@
+/* 
+    Document   : dasish.css
+    Created on : 2013-apr-05, 13:43:15
+    Author     : stephanie
+    Description:
+        Definition of specific styles for DASISH web annotator.
+*/
+
+/* ::::: SERVER DIALOG SETTINGS ::::: */
+caption#selectServerURLCaption {
+    background-color:#fff;
+    padding: 5px;
+    border-top-left-radius: 0.6em;
+    border-top-right-radius: 0.6em;
+}
+
+column#textboxColumn {
+    margin-left: 1em;
+}
+/* ::::: END: SERVER DIALOG SETTINGS ::::: */
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/autocache.css
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/autocache.css	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/autocache.css	(revision 5703)
@@ -0,0 +1,8 @@
+#bitsAutocacheTree treechildren::-moz-tree-checkbox(checked){
+  /* css for checked cells */
+  list-style-image: url("chrome://markingcollection/skin/cbox-check.gif");
+}
+#bitsAutocacheTree treechildren::-moz-tree-checkbox(checked,disabled){
+  /* css for checked cells */
+  list-style-image: url("chrome://markingcollection/skin/cbox-check-dis.gif");
+}
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/contents.rdf
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/contents.rdf	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/contents.rdf	(revision 5703)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+         xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
+
+  <!-- List all the skins being supplied by this theme -->
+  <RDF:Seq RDF:about="urn:mozilla:skin:root">
+    <RDF:li RDF:resource="urn:mozilla:skin:classic/1.0" />
+  </RDF:Seq>
+
+  <!-- classic Information -->
+  <RDF:Description RDF:about="urn:mozilla:skin:classic/1.0">
+    <chrome:packages>
+      <RDF:Seq RDF:about="urn:mozilla:skin:classic/1.0:packages">
+        <RDF:li RDF:resource="urn:mozilla:skin:classic/1.0:markingcollection" />
+      </RDF:Seq>
+    </chrome:packages>
+  </RDF:Description>
+
+  <RDF:Seq RDF:about="urn:mozilla:stylesheets">
+    <RDF:li RDF:resource="chrome://global/content/customizeToolbar.xul" />
+    <RDF:li RDF:resource="chrome://browser/content/browser.xul" />
+  </RDF:Seq>
+
+  <RDF:Seq RDF:about="chrome://global/content/customizeToolbar.xul">
+    <RDF:li>chrome://markingcollection/skin/main.css</RDF:li>
+  </RDF:Seq>
+
+  <RDF:Seq RDF:about="chrome://browser/content/browser.xul">
+    <RDF:li>chrome://markingcollection/skin/main.css</RDF:li>
+  </RDF:Seq>
+
+</RDF:RDF>
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/find_sidebar.css
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/find_sidebar.css	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/find_sidebar.css	(revision 5703)
@@ -0,0 +1,3 @@
+#bitsFindTextbox[disabled="true"] {
+	background-color:#ccc;
+}
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/overlay.css
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/overlay.css	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/overlay.css	(revision 5703)
@@ -0,0 +1,86 @@
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+
+#markingcollection-button {
+  list-style-image: url("chrome://markingcollection/skin/icon_24.gif");
+}
+
+toolbar[iconsize="small"] #markingcollection-button {
+  list-style-image: url("chrome://markingcollection/skin/icon_16.gif");
+}
+
+/*****************************************************************************/
+
+menu[mctype="folder"] #mcToolbarRootFolderButton {
+	list-style-image: url('chrome://markingcollection/skin/treefolder.png') !important;
+}
+
+
+
+/*****************************************************************************/
+menu#MarkingCollectionMenu menuitem {
+	max-width: 250px;
+}
+
+menu#MarkingCollectionMenu menuitem.mc-item {
+	list-style-image: url('chrome://markingcollection/skin/treeitem.png') !important;
+}
+
+menu#MarkingCollectionMenu menuitem.mc-item[sbtype="note"] {
+	list-style-image: url('chrome://markingcollection/skin/treenote.png') !important;
+}
+
+menu#MarkingCollectionMenu menuitem.mc-item[sbtype="marked"] {
+	font-weight: bold;
+}
+
+menu#MarkingCollectionMenu menuitem.mc-item[sbtype="combine"] {
+	color: blue;
+}
+
+menu#MarkingCollectionMenu menuitem.mc-item[sbtype="bookmark"] {
+	color: rgb(32,192,32);
+}
+
+/*****************************************************************************/
+
+/*****************************************************************************/
+.mc-header {
+	color: InfoText;
+	background-color: InfoBackground;
+	border: 1px solid ThreeDShadow;
+	padding: 3px;
+}
+
+.mc-header toolbarbutton {
+	padding: 0px;
+	margin: 0px;
+	-moz-appearance: none;
+}
+
+.mc-header toolbarbutton image {
+	padding: 0px 1px;
+	margin: 0px;
+}
+
+.mc-header-exit {
+	list-style-image: url('chrome://markingcollection/skin/exit.png');
+}
+
+/*****************************************************************************/
+/* ãµã€ãããŒããŠã£ã³ããŠå³åŽã«è¡šç€ºãã  */
+/*
+window > hbox { 
+   direction: rtl; 
+} 
+window > hbox > * { 
+   direction: ltr; 
+}
+*/
+
+.favoritefolder{
+/*
+  list-style-image: url(chrome://markingcollection/skin/folder-item.png);
+  -moz-image-region: rect(0px, 32px, 16px, 16px);
+*/
+  list-style-image: url(chrome://markingcollection/skin/folder-star.png);
+}
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/property.css
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/property.css	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/property.css	(revision 5703)
@@ -0,0 +1,20 @@
+/* ::::: PROPERTIES ::::: */
+
+dialog {
+	width: 450px;
+}
+
+tab {
+	min-width: 80px;
+	text-align: center;
+}
+
+rows#mcPropRows row {
+	min-height: 2.2em;
+	margin-bottom: 3px;
+}
+
+row > textbox[readonly="true"] {
+	-moz-appearance: none !important;
+	border: none;
+}
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/setting.css
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/setting.css	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/setting.css	(revision 5703)
@@ -0,0 +1,93 @@
+/* ::::: SETTING ::::: */
+
+dialog#mcSettingWindow {
+	width: 500px;
+	height: 500px;
+}
+
+tab {
+	min-width: 80px;
+	text-align: center;
+}
+
+tabpanel > vbox {
+	padding-top: 6px;
+	padding-bottom: 6px;
+}
+
+tabpanel > checkbox {
+	margin-top:    5px;
+	margin-bottom: 5px;
+}
+
+groupbox {
+	margin-top: 10px;
+	padding-top: 10px;
+	padding-bottom: 10px;
+}
+
+.notice { color: red; }
+
+.indent { margin-left: 30px; }
+
+#sbPrefDataAlert {
+	margin: 10px 10px 0px 10px;
+}
+
+
+/* ::::: CUSTOMIZE HIGHLIGHTER ::::: */
+
+colorpicker[disabled="true"] {
+	visibility: hidden;
+}
+
+dialog#hlCustomizeDialog groupbox > hbox {
+	margin-bottom: 5px;
+}
+
+
+.iconsize {
+  list-style-image: url("chrome://markingcollection/skin/firefox.png");
+  height : 16px;
+  width  : 16px;
+  max-height : 16px;
+  max-width  : 16px;
+  margin-left   : 32px;
+  margin-right  : 32px;
+  margin-top    : 8px;
+  margin-bottom : 8px;
+}
+.iconsize[iconsize="large"] {
+  list-style-image: url("chrome://markingcollection/skin/firefox_32.png");
+  height : 32px;
+  width  : 32px;
+  max-height : 32px;
+  max-width  : 32px;
+  margin-left   : 24px;
+  margin-right  : 24px;
+  margin-top    : 0px;
+  margin-bottom : 0px;
+}
+
+.search-go-button {
+  padding: 2px;
+  list-style-image: url("chrome://markingcollection/skin/Search-glass.png");
+  -moz-image-region: rect(0px 16px 16px 0px);
+}
+
+.search-go-button[chromedir="rtl"] {
+  list-style-image: url("chrome://markingcollection/skin/Search-glass-rtl.png");
+}
+
+.search-go-button:hover {
+  -moz-image-region: rect(0px 32px 16px 16px);
+}
+
+.search-go-button:hover:active {
+  -moz-image-region: rect(0px, 48px, 16px, 32px);
+}
+
+treechildren::-moz-tree-checkbox(checked){
+  /* css for checked cells */
+  list-style-image: url("chrome://markingcollection/skin/cbox-check.gif");
+}
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/shortcut.css
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/shortcut.css	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/shortcut.css	(revision 5703)
@@ -0,0 +1,4 @@
+#bitsShortcutTree treechildren::-moz-tree-image {
+  list-style-image: url("chrome://markingcollection/skin/folder-item.png") !important;
+  -moz-image-region: rect(0px, 16px, 16px, 0px);
+}
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/sidebar.css
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/sidebar.css	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/sidebar.css	(revision 5703)
@@ -0,0 +1,264 @@
+treechildren::-moz-tree-cell(Marker) { background-color: #ffcccc; border: 1px solid #ffcc00; }
+treechildren::-moz-tree-cell-text(Marker) { color: #0000ff; }
+
+
+#bitsItemTree treechildren::-moz-tree-row {
+  border: 1px solid transparent;
+  border-bottom: 1px solid #e3efff;
+  min-height: 18px;
+}
+
+/* ::::: DASISH LOGIN LABEL ::::: */
+
+#loginInfo {
+    border-top: 1px solid #F89015;
+    border-bottom: 1px solid #F89015;
+}
+
+.notLoggedIn {
+    background-color: #F89015;
+    color: #1B76BC;
+    border-radius: 5px;
+    box-shadow: 0px 0px 2px 2px #aaa;
+    margin: 15px 7px;
+    margin-bottom: 5px;
+    padding: 10px;
+    font-size: 12px;
+    width: auto;
+}
+
+#loginButton, #logoutButton {
+    margin-bottom: 15px;
+    width: 300px;
+}
+
+#loginButton:hover, #logoutButton:hover {
+    cursor: pointer;
+}
+
+.loggedIn {
+    background-color: #1B76BC;
+    color: #ffffff;
+    border-radius: 5px;
+    box-shadow: 0px 0px 2px 2px #aaa;
+    margin: 15px 7px;
+    margin-bottom: 5px;
+    padding: 10px;
+    font-size: 12px;
+    width: auto;
+}
+
+/* ::::: END: DASISH LOGIN LABEL ::::: */
+
+#bitsItemTree treechildren::-moz-tree-row(folder) {
+  border: 1px solid transparent;
+  border-bottom: 1px solid #000000;
+  min-height: 0px;
+  height: 0px;
+}
+#bitsItemTree.bitsItemTree-middleicon treechildren::-moz-tree-row {
+  border: 1px solid transparent;
+  border-bottom: 1px solid #e3efff;
+  height: 36px;
+}
+#bitsItemTree.bitsItemTree-largeicon treechildren::-moz-tree-row {
+  border: 1px solid transparent;
+  border-bottom: 1px solid #e3efff;
+  height: 72px;
+}
+
+
+
+#mcTree treechildren::-moz-tree-image(Name,item) {
+  margin: 0px 2px;
+  list-style-image: url("chrome://markingcollection/skin/folder-item.png") !important;
+  -moz-image-region: rect(0px, 16px, 16px, 0px);
+  height : 16px;
+  width  : 16px;
+}
+
+#mcTree treechildren::-moz-tree-image(Name,folder) {
+  margin: 0px 2px;
+  list-style-image: url("chrome://markingcollection/skin/folder-item.png") !important;
+  -moz-image-region: rect(0px, 32px, 16px, 16px);
+  height : 16px;
+  width  : 16px;
+}
+#mcTree treechildren::-moz-tree-image(Name,_uncategorized) {
+  margin: 0px 2px;
+  list-style-image: url("chrome://markingcollection/skin/folder-item.png") !important;
+  -moz-image-region: rect(0px, 32px, 16px, 16px);
+  height : 16px;
+  width  : 16px;
+}
+
+#mcTree treechildren::-moz-tree-cell-text(Shoutcut) {
+  font-size : 9px;
+}
+
+#bitsItemTree treechildren::-moz-tree-image(ItemView) {
+  margin: 0px 2px;
+  list-style-image: url("chrome://markingcollection/skin/folder-item.png") !important;
+  -moz-image-region: rect(0px, 16px, 16px, 0px);
+  max-height : 16px;
+  max-width  : 16px;
+}
+
+#bitsItemTree treechildren::-moz-tree-image(ItemView,folder) {
+  margin: 0px 2px;
+  list-style-image: url("chrome://markingcollection/skin/folder-item.png") !important;
+  -moz-image-region: rect(0px, 32px, 16px, 16px);
+  max-height : 16px;
+  max-width  : 16px;
+}
+
+#bitsItemTree treechildren::-moz-tree-image(ItemView,ItemViewImage) {
+  margin: 0px 2px;
+  list-style-image: url("chrome://markingcollection/skin/folder-item.png") !important;
+  -moz-image-region: rect(0px, 16px, 16px, 0px);
+  height : 16px;
+  width  : 16px;
+}
+#bitsItemTree treechildren::-moz-tree-image(ItemView,ItemViewImage,folder) {
+  margin: 0px 2px;
+  list-style-image: url("chrome://markingcollection/skin/folder-item.png") !important;
+  -moz-image-region: rect(0px, 32px, 16px, 16px);
+  height : 16px;
+  width  : 16px;
+}
+/*
+#bitsItemTree.bitsItemTree-largeicon treechildren::-moz-tree-image(ItemView) {
+  padding-left : 9px;
+  padding-right: 11px;
+  margin: 0px 2px;
+  list-style-image: url("chrome://markingcollection/skin/folder-item.png") !important;
+  -moz-image-region: rect(0px, 16px, 16px, 0px);
+  height : 16px;
+  width  : 16px;
+}
+*/
+#bitsItemTree.bitsItemTree-middleicon treechildren::-moz-tree-image(ItemView,ItemViewImage) {
+  padding-left : 0px;
+  padding-right: 2px;
+  margin: 0px 2px;
+  list-style-image: url("chrome://markingcollection/skin/folder-item.png") !important;
+  -moz-image-region: rect(0px, 16px, 16px, 0px);
+  height : 32px;
+  width  : 32px;
+}
+#bitsItemTree.bitsItemTree-middleicon treechildren::-moz-tree-image(ItemView,ItemViewImage,folder) {
+  padding-left : 0px;
+  padding-right: 2px;
+  margin: 0px 2px;
+  list-style-image: url("chrome://markingcollection/skin/folder-item.png") !important;
+  -moz-image-region: rect(0px, 32px, 16px, 16px);
+  height : 32px;
+  width  : 32px;
+}
+
+#bitsItemTree.bitsItemTree-largeicon treechildren::-moz-tree-image(ItemView,ItemViewImage) {
+  padding-left : 0px;
+  padding-right: 2px;
+  margin: 0px 2px;
+  list-style-image: url("chrome://markingcollection/skin/folder-item.png") !important;
+  -moz-image-region: rect(0px, 16px, 16px, 0px);
+  height : 68px;
+  width  : 68px;
+}
+#bitsItemTree.bitsItemTree-largeicon treechildren::-moz-tree-image(ItemView,ItemViewImage,folder) {
+  padding-left : 0px;
+  padding-right: 2px;
+  margin: 0px 2px;
+  list-style-image: url("chrome://markingcollection/skin/folder-item.png") !important;
+  -moz-image-region: rect(0px, 32px, 16px, 16px);
+  height : 68px;
+  width  : 68px;
+}
+
+
+#bitsItemTree treechildren::-moz-tree-cell {
+  height: 3.0em;
+  white-space: normal;
+}
+
+#bitsItemTree treechildren::-moz-tree-cell-text {
+  white-space: normal;
+  font-size : 0.9em;
+}
+
+#bitsItemTree treechildren::-moz-tree-cell-text(separator) {
+  color: ThreeDShadow;
+  margin: 0px 5px 0px 5px;
+}
+
+#bitsItemTree treechildren::-moz-tree-cell-text( separator, selected, focus) {
+  color: HighlightText;
+}
+
+
+/* Toolbarbutton */
+#bitsItemViewCloseToolbarbutton.closebutton {
+  list-style-image: url("chrome://markingcollection/skin/yaLR16_07.png");
+  -moz-appearance: none;
+  padding: 4px 2px;
+  margin: 0px;
+  border: none;
+}
+#bitsItemViewCloseToolbarbutton.closebutton:hover {
+  list-style-image: url("chrome://markingcollection/skin/yaNR16_07.png");
+}
+#bitsItemViewCloseToolbarbutton.closebutton:hover:active {
+  list-style-image: url("chrome://markingcollection/skin/yaNR16_08.png");
+}
+
+#bitsItemViewSearchButton  {
+  padding-left: 5px;
+}
+
+.favoritefolder{
+  list-style-image: url("chrome://markingcollection/skin/folder-item.png") !important;
+  -moz-image-region: rect(0px, 32px, 16px, 16px);
+}
+
+#bitsBrowserLeftSplitter:-moz-system-metric(windows-default-theme) {
+  border: 0;
+  -moz-border-end: 1px solid;
+  -moz-border-right-colors: #A9B7C9;
+  -moz-border-left-colors: #A9B7C9;
+  min-width: 0;
+  width: 0px;
+  background-color: transparent;
+/*  -moz-margin-start: -3px;*/
+  position: relative;
+  z-index: 10;
+}
+
+#mcPropertyViewSplitter:-moz-system-metric(windows-default-theme) {
+  border: 0;
+  -moz-border-end: 1px solid;
+  -moz-border-top-colors: #A9B7C9;
+  -moz-border-bottom-colors: #A9B7C9;
+  min-width: 0;
+  height: 1px;
+  background-color: transparent;
+/*  -moz-margin-start: -3px;*/
+  position: relative;
+  z-index: 10;
+}
+
+toolbarbutton#mcToolbarAutocacheButton
+{
+    list-style-image: url("chrome://markingcollection/skin/autocache.png");
+}
+toolbarbutton#mcToolbarAutocacheButton[disabled="true"]
+{
+    list-style-image: url("chrome://markingcollection/skin/autocache-dis.png");
+}
+
+#bitsTreeDate treechildren::-moz-tree-image(folder) {
+  margin: 0px 4px 0px 2px;
+  list-style-image: url("chrome://markingcollection/skin/folder-item.png") !important;
+  -moz-image-region: rect(0px, 32px, 16px, 16px);
+  height : 16px;
+  width  : 16px;
+}
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/treeprojectDicMngDialog.css
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/treeprojectDicMngDialog.css	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/skin/classic/markingcollection/treeprojectDicMngDialog.css	(revision 5703)
@@ -0,0 +1,107 @@
+/* ::::: SETTING ::::: */
+
+dialog#mcSettingWindow {
+	width: 500px;
+	height: 500px;
+}
+
+tab {
+	min-width: 80px;
+	text-align: center;
+}
+
+tabpanel > vbox {
+	padding-top: 6px;
+	padding-bottom: 6px;
+}
+
+tabpanel > checkbox {
+	margin-top:    5px;
+	margin-bottom: 5px;
+}
+
+groupbox {
+	margin-top: 10px;
+	padding-top: 10px;
+	padding-bottom: 10px;
+}
+
+.notice { color: red; }
+
+.indent { margin-left: 30px; }
+
+#sbPrefDataAlert {
+	margin: 10px 10px 0px 10px;
+}
+
+
+/* ::::: CUSTOMIZE HIGHLIGHTER ::::: */
+
+colorpicker[disabled="true"] {
+	visibility: hidden;
+}
+
+dialog#hlCustomizeDialog groupbox > hbox {
+	margin-bottom: 5px;
+}
+
+
+.iconsize {
+  list-style-image: url("chrome://markingcollection/skin/firefox.png");
+  height : 16px;
+  width  : 16px;
+  max-height : 16px;
+  max-width  : 16px;
+  margin-left   : 32px;
+  margin-right  : 32px;
+  margin-top    : 8px;
+  margin-bottom : 8px;
+}
+.iconsize[iconsize="large"] {
+  list-style-image: url("chrome://markingcollection/skin/firefox_32.png");
+  height : 32px;
+  width  : 32px;
+  max-height : 32px;
+  max-width  : 32px;
+  margin-left   : 24px;
+  margin-right  : 24px;
+  margin-top    : 0px;
+  margin-bottom : 0px;
+}
+
+.search-go-button {
+  padding: 2px;
+  list-style-image: url("chrome://markingcollection/skin/Search-glass.png");
+  -moz-image-region: rect(0px 16px 16px 0px);
+}
+
+.search-go-button[chromedir="rtl"] {
+  list-style-image: url("chrome://markingcollection/skin/Search-glass-rtl.png");
+}
+
+.search-go-button:hover {
+  -moz-image-region: rect(0px 32px 16px 16px);
+}
+
+.search-go-button:hover:active {
+  -moz-image-region: rect(0px, 48px, 16px, 32px);
+}
+
+treechildren::-moz-tree-checkbox(checked){
+  list-style-image: url("chrome://markingcollection/skin/cbox-check.gif");
+}
+treechildren::-moz-tree-cell-text{
+  font-size: 0.9em;
+}
+treechildren::-moz-tree-row(delete){
+  background-color: #ffe5e5;
+}
+treechildren::-moz-tree-row(delete,selected){
+  background-color: #ffb2b2;
+}
+treechildren::-moz-tree-row(exception){
+  background-color: #f9dbb3;
+}
+treechildren::-moz-tree-row(exception,selected){
+  background-color: #f9c686;
+}
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/defaults/preferences/markingcollection-prefs.js
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/defaults/preferences/markingcollection-prefs.js	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/defaults/preferences/markingcollection-prefs.js	(revision 5703)
@@ -0,0 +1,2 @@
+// pref("extensions.{e36db930-f18d-4449-b45f-e286cfb9e03a}.description", "chrome://markingcollection/locale/about.properties");
+pref("extensions.webannotator@dasish.eu.description", "chrome://markingcollection/locale/about.properties");
Index: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/install.rdf
===================================================================
--- DASISH/t5.6/client/branches/webannotator-basic-current-xsd/install.rdf	(revision 5703)
+++ DASISH/t5.6/client/branches/webannotator-basic-current-xsd/install.rdf	(revision 5703)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+     xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+    <Description about="urn:mozilla:install-manifest">
+        <!-- Wired-Marker GUID -->
+        <!-- <em:id>{e36db930-f18d-4449-b45f-e286cfb9e03a}</em:id> -->
+        <!-- DASISH (email-style) ID -->
+        <em:id>webannotator@dasish.eu</em:id>
+        <em:unpack>true</em:unpack>
+        <em:localized>
+            <Description>
+                <em:locale>en-US</em:locale>
+                <!-- <em:name>Wired-Marker</em:name> -->
+                <em:name>DASISH Web Annotator</em:name>
+                <!-- <em:description>Put permanent marker line on web pages in many color and shapes / option.</em:description> -->
+                <!-- Hint: add-on description defined in about.properties file -->
+                <em:description>Annotate fragments of web documents with tags, colors and text notes.</em:description>
+            </Description>
+        </em:localized>
+        <!-- no Japanese version -->
+        <!--
+        <em:localized>
+            <Description>
+                <em:locale>ja-JP</em:locale>
+                <em:name>Wired-Marker</em:name>
+                <em:description>WebããŒãžã«åŒããæ¶ããªãããŒã«ãŒãã§ãã</em:description>
+            </Description>
+        </em:localized>
+        -->
+        <!-- <em:name>Wired-Marker</em:name> -->
+        <em:name>DASISH Web Annotator</em:name>
+        <!-- <em:description>Put permanent marker line on web pages in many color and shapes / option.</em:description> -->
+        <em:description>Annotate web documents with text notes, titles and colours.</em:description>
+        <!-- <em:version>4.0.11120600</em:version> -->
+        <!-- DASISH prototype 3.0 -->
+        <em:version>3.0</em:version>
+        <em:creator>BITS Co., Ltd., extended by Swedish National Data Service (SND)</em:creator>
+        <em:developer>Stephanie S. Roth</em:developer>
+        <em:developer>Olof Olsson</em:developer>
+        <!-- <em:homepageURL>http://www.wired-marker.org/</em:homepageURL> -->
+        <em:homepageURL>http://dasish.eu/</em:homepageURL>
+        
+        <em:aboutURL>chrome://markingcollection/content/about.xul</em:aboutURL>
+        <!-- <em:iconURL>chrome://markingcollection/skin/icon_32.png</em:iconURL> -->
+        <!-- Replaced with DASISH icon, needs to be 32x32 -->
+        <em:iconURL>chrome://markingcollection/skin/annotator-skin/alphatransparent/dasish_32_32.png</em:iconURL>
+        <em:optionsURL>chrome://markingcollection/content/settingDialog.xul</em:optionsURL>
+
+        <!-- Firefox -->
+        <em:targetApplication>
+            <Description>
+                <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+                <em:minVersion>2.0</em:minVersion>
+                <!-- <em:maxVersion>10.*</em:maxVersion> -->
+                <!-- Current FF version is 30.0 -->
+                <em:maxVersion>30.*.*</em:maxVersion>
+            </Description>
+        </em:targetApplication>
+    </Description>
+</RDF>
