--- /dev/null
+/*
+ * CTOCWidget.js
+ * $Revision: 1.3 $ $Date: 2003/07/14 06:02:50 $
+ */
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Netscape code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Bob Clary <bclary@netscape.com>
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+function CTOCWidget(domTOCModel, target)
+{
+ if (domTOCModel.documentElement.nodeName != 'toc')
+ {
+ throw 'CTOCWidget called on non toc Document: ' + domTOCModel.nodeName;
+ }
+
+ this.model = domTOCModel;
+ this.target = target;
+ this.view = document.createElement('div');
+ this.view.setAttribute('class', CTOCWidget._classprefix + '_view');
+
+ var modelItems = domTOCModel.documentElement.childNodes;
+ for (var i = 0; i < modelItems.length; i++)
+ {
+ var modelItem = modelItems.item(i);
+ if (modelItem.nodeType == Node.ELEMENT_NODE)
+ {
+ var viewItem = CTOCWidget.createItemView(modelItem, target);
+ this.view.appendChild(viewItem);
+ }
+ }
+}
+
+CTOCWidget._handleImages = { open: '/toolbox/examples/2003/CTOCWidget/minus.gif', closed: '/toolbox/examples/2003/CTOCWidget/plus.gif', height: '12px', width: '16px'};
+CTOCWidget._classprefix = 'CTOCWidget';
+
+CTOCWidget.createItemView = function (modelItem, target)
+{
+ if (modelItem.nodeType != Node.ELEMENT_NODE)
+ {
+ throw 'CTOCWidget.createItemView called on non-Element: ' + modelItem.nodeName;
+ }
+
+ var i;
+
+ var viewItem = document.createElement('div');
+ viewItem.setAttribute('class', CTOCWidget._classprefix + '_item');
+
+ var viewItemHandle = document.createElement('div');
+ viewItemHandle.setAttribute('class', CTOCWidget._classprefix + '_itemhandle');
+ viewItemHandle.style.cursor = 'pointer';
+
+ var viewItemHandleImg = document.createElement('img');
+ viewItemHandleImg.style.height = CTOCWidget._handleImages.height;
+ viewItemHandleImg.style.width = CTOCWidget._handleImages.width;
+ viewItemHandleImg.addEventListener('click', CTOCWidget.toggleHandle, false);
+
+ var viewItemHandleLink;
+ if (!modelItem.getAttribute('url'))
+ {
+ viewItemHandleLink = document.createElement('span');
+ }
+ else
+ {
+ viewItemHandleLink = document.createElement('a');
+ viewItemHandleLink.setAttribute('href', modelItem.getAttribute('url'));
+ viewItemHandleLink.setAttribute('target', target);
+ }
+ viewItemHandleLink.appendChild(document.createTextNode(modelItem.getAttribute('title')));
+
+ viewItemHandle.appendChild(viewItemHandleImg);
+ viewItemHandle.appendChild(viewItemHandleLink);
+ viewItem.appendChild(viewItemHandle);
+
+ if (modelItem.childNodes.length == 0)
+ {
+ viewItemHandleImg.setAttribute('src', CTOCWidget._handleImages.open);
+ }
+ else
+ {
+ viewItemHandleImg.setAttribute('src', CTOCWidget._handleImages.closed);
+
+ var viewItemChildren = document.createElement('div');
+ viewItemChildren.setAttribute('class', CTOCWidget._classprefix + '_itemchildren');
+ viewItemChildren.style.display = 'none';
+ viewItemChildren.style.position = 'relative';
+ viewItemChildren.style.left = '1em';
+
+ for (i = 0; i < modelItem.childNodes.length; i++)
+ {
+ var modelItemChild = modelItem.childNodes.item(i);
+ if (modelItemChild.nodeType == Node.ELEMENT_NODE)
+ {
+ viewItemChildren.appendChild(CTOCWidget.createItemView(modelItemChild, target));
+ }
+ }
+
+ viewItem.appendChild(viewItemChildren);
+ }
+
+ return viewItem;
+};
+
+// fires on img part of the handle
+CTOCWidget.toggleHandle = function(e)
+{
+ switch (e.eventPhase)
+ {
+ case Event.CAPTURING_PHASE:
+ case Event.BUBBLING_PHASE:
+ return true;
+
+ case Event.AT_TARGET:
+
+ e.preventBubble();
+
+ var domHandle = e.target.parentNode;
+ var domChildren = domHandle.nextSibling;
+
+ if (!domChildren)
+ {
+ return true;
+ }
+
+ switch(domChildren.style.display)
+ {
+ case '':
+ case 'block':
+ domChildren.style.display = 'none';
+ e.target.setAttribute('src', CTOCWidget._handleImages.closed);
+ break;
+ case 'none':
+ domChildren.style.display = 'block';
+ e.target.setAttribute('src', CTOCWidget._handleImages.open);
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+
+ default:
+ dump('Unknown Event Phase ' + e.eventPhase);
+ break;
+ }
+
+ return true;
+}
+
-/*\r
-ua.js revision 0.200 2001-12-03\r
-\r
-Contributor(s): Bob Clary, Netscape Communications, Copyright 2001\r
-\r
-Netscape grants you a royalty free license to use, modify and \r
-distribute this software provided that this copyright notice \r
-appears on all copies. This software is provided "AS IS," \r
-without a warranty of any kind.\r
-*/\r
-\r
-function xbDetectBrowser()\r
-{\r
- var oldOnError = window.onerror;\r
- var element = null;\r
-\r
- window.onerror = null;\r
- \r
- // work around bug in xpcdom Mozilla 0.9.1\r
- window.saveNavigator = window.navigator;\r
-\r
- navigator.OS = '';\r
- navigator.version = parseFloat(navigator.appVersion);\r
- navigator.org = '';\r
- navigator.family = '';\r
-\r
- var platform;\r
- if (typeof(window.navigator.platform) != 'undefined')\r
- {\r
- platform = window.navigator.platform.toLowerCase();\r
- if (platform.indexOf('win') != -1)\r
- navigator.OS = 'win';\r
- else if (platform.indexOf('mac') != -1)\r
- navigator.OS = 'mac';\r
- else if (platform.indexOf('unix') != -1 || platform.indexOf('linux') != -1 || platform.indexOf('sun') != -1)\r
- navigator.OS = 'nix';\r
- }\r
-\r
- var i = 0;\r
- var ua = window.navigator.userAgent.toLowerCase();\r
- \r
- if (ua.indexOf('opera') != -1)\r
- {\r
- i = ua.indexOf('opera');\r
- navigator.family = 'opera';\r
- navigator.org = 'opera';\r
- navigator.version = parseFloat('0' + ua.substr(i+6), 10);\r
- }\r
- else if ((i = ua.indexOf('msie')) != -1)\r
- {\r
- navigator.org = 'microsoft';\r
- navigator.version = parseFloat('0' + ua.substr(i+5), 10);\r
- \r
- if (navigator.version < 4)\r
- navigator.family = 'ie3';\r
- else\r
- navigator.family = 'ie4'\r
- }\r
- else if (ua.indexOf('gecko') != -1)\r
- {\r
- navigator.family = 'gecko';\r
- var rvStart = navigator.userAgent.indexOf('rv:') + 3;\r
- var rvEnd = navigator.userAgent.indexOf(')', rvStart);\r
- var rv = navigator.userAgent.substring(rvStart, rvEnd);\r
- var decIndex = rv.indexOf('.');\r
- if (decIndex != -1)\r
- {\r
- rv = rv.replace(/\./g, '')\r
- rv = rv.substring(0, decIndex-1) + '.' + rv.substr(decIndex)\r
- }\r
- navigator.version = parseFloat(rv);\r
-\r
- if (ua.indexOf('netscape') != -1)\r
- navigator.org = 'netscape';\r
- else if (ua.indexOf('compuserve') != -1)\r
- navigator.org = 'compuserve';\r
- else\r
- navigator.org = 'mozilla';\r
- }\r
- else if ((ua.indexOf('mozilla') !=-1) && (ua.indexOf('spoofer')==-1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera')==-1)&& (ua.indexOf('webtv')==-1) && (ua.indexOf('hotjava')==-1))\r
- {\r
- var is_major = parseFloat(navigator.appVersion);\r
- \r
- if (is_major < 4)\r
- navigator.version = is_major;\r
- else\r
- {\r
- i = ua.lastIndexOf('/')\r
- navigator.version = parseFloat('0' + ua.substr(i+1), 10);\r
- }\r
- navigator.org = 'netscape';\r
- navigator.family = 'nn' + parseInt(navigator.appVersion);\r
- }\r
- else if ((i = ua.indexOf('aol')) != -1 )\r
- {\r
- // aol\r
- navigator.family = 'aol';\r
- navigator.org = 'aol';\r
- navigator.version = parseFloat('0' + ua.substr(i+4), 10);\r
- }\r
- else if ((i = ua.indexOf('hotjava')) != -1 )\r
- {\r
- // hotjava\r
- navigator.family = 'hotjava';\r
- navigator.org = 'sun';\r
- navigator.version = parseFloat(navigator.appVersion);\r
- }\r
-\r
- window.onerror = oldOnError;\r
-}\r
-\r
-xbDetectBrowser();\r
-\r
+/*
+ * ua.js
+ * $Revision: 1.2 $ $Date: 2003/02/07 16:04:17 $
+ */
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Netscape code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2001
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Bob Clary <bclary@netscape.com>
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+function xbDetectBrowser()
+{
+ var oldOnError = window.onerror;
+ var element = null;
+
+ window.onerror = null;
+
+ // work around bug in xpcdom Mozilla 0.9.1
+ window.saveNavigator = window.navigator;
+
+ navigator.OS = '';
+ navigator.version = parseFloat(navigator.appVersion);
+ navigator.org = '';
+ navigator.family = '';
+
+ var platform;
+ if (typeof(window.navigator.platform) != 'undefined')
+ {
+ platform = window.navigator.platform.toLowerCase();
+ if (platform.indexOf('win') != -1)
+ navigator.OS = 'win';
+ else if (platform.indexOf('mac') != -1)
+ navigator.OS = 'mac';
+ else if (platform.indexOf('unix') != -1 || platform.indexOf('linux') != -1 || platform.indexOf('sun') != -1)
+ navigator.OS = 'nix';
+ }
+
+ var i = 0;
+ var ua = window.navigator.userAgent.toLowerCase();
+
+ if (ua.indexOf('opera') != -1)
+ {
+ i = ua.indexOf('opera');
+ navigator.family = 'opera';
+ navigator.org = 'opera';
+ navigator.version = parseFloat('0' + ua.substr(i+6), 10);
+ }
+ else if ((i = ua.indexOf('msie')) != -1)
+ {
+ navigator.org = 'microsoft';
+ navigator.version = parseFloat('0' + ua.substr(i+5), 10);
+
+ if (navigator.version < 4)
+ navigator.family = 'ie3';
+ else
+ navigator.family = 'ie4'
+ }
+ else if (ua.indexOf('gecko') != -1)
+ {
+ navigator.family = 'gecko';
+ var rvStart = ua.indexOf('rv:');
+ var rvEnd = ua.indexOf(')', rvStart);
+ var rv = ua.substring(rvStart+3, rvEnd);
+ var rvParts = rv.split('.');
+ var rvValue = 0;
+ var exp = 1;
+
+ for (var i = 0; i < rvParts.length; i++)
+ {
+ var val = parseInt(rvParts[i]);
+ rvValue += val / exp;
+ exp *= 100;
+ }
+ navigator.version = rvValue;
+
+ if (ua.indexOf('netscape') != -1)
+ navigator.org = 'netscape';
+ else if (ua.indexOf('compuserve') != -1)
+ navigator.org = 'compuserve';
+ else
+ navigator.org = 'mozilla';
+ }
+ else if ((ua.indexOf('mozilla') !=-1) && (ua.indexOf('spoofer')==-1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera')==-1)&& (ua.indexOf('webtv')==-1) && (ua.indexOf('hotjava')==-1))
+ {
+ var is_major = parseFloat(navigator.appVersion);
+
+ if (is_major < 4)
+ navigator.version = is_major;
+ else
+ {
+ i = ua.lastIndexOf('/')
+ navigator.version = parseFloat('0' + ua.substr(i+1), 10);
+ }
+ navigator.org = 'netscape';
+ navigator.family = 'nn' + parseInt(navigator.appVersion);
+ }
+ else if ((i = ua.indexOf('aol')) != -1 )
+ {
+ // aol
+ navigator.family = 'aol';
+ navigator.org = 'aol';
+ navigator.version = parseFloat('0' + ua.substr(i+4), 10);
+ }
+ else if ((i = ua.indexOf('hotjava')) != -1 )
+ {
+ // hotjava
+ navigator.family = 'hotjava';
+ navigator.org = 'sun';
+ navigator.version = parseFloat(navigator.appVersion);
+ }
+
+ window.onerror = oldOnError;
+}
+
+xbDetectBrowser();
+
-/*\r
-xbDOM.js v 0.004 2002-03-09\r
-\r
-Contributor(s): Bob Clary, Netscape Communications, Copyright 2001, 2002\r
-\r
-Netscape grants you a royalty free license to use, modify and \r
-distribute this software provided that this copyright notice \r
-appears on all copies. This software is provided "AS IS," \r
-without a warranty of any kind.\r
-\r
-Change Log: \r
-\r
-2002-03-15: v 0.004\r
- bclary -\r
- fix bug in bugfix for 0.003 in xbGetElementsByName \r
- to not confuse elements with length properties with arrays\r
-\r
-2002-03-09: v 0.003\r
- bclary -\r
- fix bug in xbGetElementsByName in Internet Explorer when there is\r
- only one instance of an element with name value.\r
-\r
-2002-01-19: v 0.002\r
- bclary - \r
- nav4FindElementsByName\r
- removed erroneous obj and return\r
- added search of form elements\r
- xbFindElementsByNameAndType\r
- renamed from FindElementsByNameAndType\r
- removed erroneouse obj and return\r
- xbSetInnerHTML\r
- ported over from xbStyle since it is more\r
- appropriate here.\r
-\r
-2001-11-27: v 0.01\r
- bclary - \r
- removed from xbStyle\r
-*/\r
-\r
-function xbToInt(s)\r
-{\r
- var i = parseInt(s, 10);\r
- if (isNaN(i))\r
- i = 0;\r
-\r
- return i;\r
-}\r
-\r
-function xbGetWindowWidth(windowRef)\r
-{\r
- var width = 0;\r
-\r
- if (!windowRef)\r
- windowRef = window;\r
- \r
- if (typeof(windowRef.innerWidth) == 'number')\r
- width = windowRef.innerWidth;\r
- else if (windowRef.document.body && typeof(windowRef.document.body.clientWidth) == 'number')\r
- width = windowRef.document.body.clientWidth; \r
- \r
- return width;\r
-}\r
-\r
-function xbGetWindowHeight(windowRef)\r
-{\r
- var height = 0;\r
- \r
- if (!windowRef)\r
- windowRef = window;\r
-\r
- if (typeof(windowRef.innerWidth) == 'number')\r
- height = windowRef.innerHeight;\r
- else if (windowRef.document.body && typeof(windowRef.document.body.clientWidth) == 'number')\r
- height = windowRef.document.body.clientHeight; \r
-\r
- return height;\r
-}\r
-\r
-function nav4FindLayer(doc, id)\r
-{\r
- var i;\r
- var subdoc;\r
- var obj;\r
- \r
- for (i = 0; i < doc.layers.length; ++i)\r
- {\r
- if (doc.layers[i].id && id == doc.layers[i].id)\r
- return doc.layers[i];\r
- \r
- subdoc = doc.layers[i].document;\r
- obj = nav4FindLayer(subdoc, id);\r
- if (obj != null)\r
- return obj;\r
- }\r
- return null;\r
-}\r
-\r
-function nav4FindElementsByName(doc, name, elmlist)\r
-{\r
- var i;\r
- var j;\r
- var subdoc;\r
-\r
- for (i = 0; i < doc.images.length; ++i)\r
- {\r
- if (doc.images[i].name && name == doc.images[i].name)\r
- elmlist[elmlist.length] = doc.images[i];\r
- }\r
-\r
- for (i = 0; i < doc.forms.length; ++i)\r
- {\r
- for (j = 0; j < doc.forms[i].elements.length; j++)\r
- if (doc.forms[i].elements[j].name && name == doc.forms[i].elements[j].name)\r
- elmlist[elmlist.length] = doc.forms[i].elements[j];\r
-\r
- if (doc.forms[i].name && name == doc.forms[i].name)\r
- elmlist[elmlist.length] = doc.forms[i];\r
- }\r
-\r
- for (i = 0; i < doc.anchors.length; ++i)\r
- {\r
- if (doc.anchors[i].name && name == doc.anchors[i].name)\r
- elmlist[elmlist.length] = doc.anchors[i];\r
- }\r
-\r
- for (i = 0; i < doc.links.length; ++i)\r
- {\r
- if (doc.links[i].name && name == doc.links[i].name)\r
- elmlist[elmlist.length] = doc.links[i];\r
- }\r
-\r
- for (i = 0; i < doc.applets.length; ++i)\r
- {\r
- if (doc.applets[i].name && name == doc.applets[i].name)\r
- elmlist[elmlist.length] = doc.applets[i];\r
- }\r
-\r
- for (i = 0; i < doc.embeds.length; ++i)\r
- {\r
- if (doc.embeds[i].name && name == doc.embeds[i].name)\r
- elmlist[elmlist.length] = doc.embeds[i];\r
- }\r
-\r
- for (i = 0; i < doc.layers.length; ++i)\r
- {\r
- if (doc.layers[i].name && name == doc.layers[i].name)\r
- elmlist[elmlist.length] = doc.layers[i];\r
- \r
- subdoc = doc.layers[i].document;\r
- nav4FindElementsByName(subdoc, name, elmlist);\r
- }\r
-}\r
-\r
-function xbGetElementsByNameAndType(name, type, windowRef)\r
-{\r
- if (!windowRef)\r
- windowRef = window;\r
-\r
- var elmlist = new Array();\r
-\r
- xbFindElementsByNameAndType(windowRef.document, name, type, elmlist);\r
-\r
- return elmlist;\r
-}\r
-\r
-function xbFindElementsByNameAndType(doc, name, type, elmlist)\r
-{\r
- var i;\r
- var subdoc;\r
- \r
- for (i = 0; i < doc[type].length; ++i)\r
- {\r
- if (doc[type][i].name && name == doc[type][i].name)\r
- elmlist[elmlist.length] = doc[type][i];\r
- }\r
-\r
- if (doc.layers)\r
- {\r
- for (i = 0; i < doc.layers.length; ++i)\r
- {\r
- subdoc = doc.layers[i].document;\r
- xbFindElementsByNameAndType(subdoc, name, type, elmlist);\r
- }\r
- }\r
-}\r
-\r
-//alert("layers: " + document.layers + " all: " + document.all);\r
-\r
-if (document.layers)\r
-{\r
- xbGetElementById = function (id, windowRef)\r
- {\r
- if (!windowRef)\r
- windowRef = window;\r
-\r
- return nav4FindLayer(windowRef.document, id);\r
- };\r
-\r
- xbGetElementsByName = function (name, windowRef)\r
- {\r
- if (!windowRef)\r
- windowRef = window;\r
-\r
- var elmlist = new Array();\r
-\r
- nav4FindElementsByName(windowRef.document, name, elmlist);\r
-\r
- return elmlist;\r
- };\r
-\r
-}\r
-else if (document.all)\r
-{\r
- xbGetElementById = function (id, windowRef)\r
- {\r
- if (!windowRef) windowRef = window;\r
- var elm = windowRef.document.all[id];\r
- if (!elm) elm = null;\r
- return elm;\r
- };\r
-\r
- xbGetElementsByName = function (name, windowRef)\r
- {\r
- if (!windowRef) windowRef = window; \r
-\r
- var i;\r
- var idnamelist = windowRef.document.all.tags(name);\r
- var elmlist = new Array();\r
-\r
- if (!idnamelist) {\r
- return null;\r
- }\r
-\r
- if (!idnamelist.length || idnamelist.name == name)\r
- {\r
- if (idnamelist)\r
- elmlist[elmlist.length] = idnamelist;\r
- }\r
- else\r
- {\r
- for (i = 0; i < idnamelist.length; i++)\r
- {\r
- if (idnamelist.item(i).tagName == name)\r
- elmlist[elmlist.length] = idnamelist[i];\r
- }\r
- }\r
-\r
- return elmlist;\r
- }\r
-\r
-}\r
-else if (document.getElementById)\r
-{\r
- xbGetElementById = function (id, windowRef) { if (!windowRef) windowRef = window; return windowRef.document.getElementById(id); };\r
- xbGetElementsByName = function (name, windowRef) { if (!windowRef) windowRef = window; return windowRef.document.getElementsByTagName(name); };\r
-}\r
-else \r
-{\r
- xbGetElementById = function (id, windowRef) { return null; }\r
- xbGetElementsByName = function (name, windowRef) { return new Array(); }\r
-}\r
-\r
-if (typeof(window.pageXOffset) == 'number')\r
-{\r
- xbGetPageScrollX = function (windowRef) { if (!windowRef) windowRef = window; return windowRef.pageXOffset; };\r
- xbGetPageScrollY = function (windowRef) { if (!windowRef) windowRef = window; return windowRef.pageYOffset; };\r
-}\r
-else if (document.all)\r
-{\r
- xbGetPageScrollX = function (windowRef) { if (!windowRef) windowRef = window; return windowRef.document.body.scrollLeft; };\r
- xbGetPageScrollY = function (windowRef) { if (!windowRef) windowRef = window; return windowRef.document.body.scrollTop; };\r
-}\r
-else\r
-{\r
- xbGetPageScrollX = function (windowRef) { return 0; };\r
- xbGetPageScrollY = function (windowRef) { return 0; };\r
-}\r
-\r
-if (document.layers)\r
-{\r
- xbSetInnerHTML = function (element, str) { element.document.write(str); element.document.close(); };\r
-}\r
-else if (document.all || document.getElementById)\r
-{\r
- xbSetInnerHTML = function (element, str) { if (typeof(element.innerHTML) != 'undefined') element.innerHTML = str; };\r
-}\r
-else\r
-{\r
- xbSetInnerHTML = function (element, str) {};\r
-}\r
-\r
-\r
-// eof: xbDOM.js\r
+/*
+ * xbDOM.js
+ * $Revision: 1.2 $ $Date: 2003/02/07 16:04:18 $
+ */
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Netscape code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2001
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Bob Clary <bclary@netscape.com>
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+function xbToInt(s)
+{
+ var i = parseInt(s, 10);
+ if (isNaN(i))
+ i = 0;
+
+ return i;
+}
+
+function xbGetWindowWidth(windowRef)
+{
+ var width = 0;
+
+ if (!windowRef)
+ {
+ windowRef = window;
+ }
+
+ if (typeof(windowRef.innerWidth) == 'number')
+ {
+ width = windowRef.innerWidth;
+ }
+ else if (windowRef.document.body && typeof(windowRef.document.body.clientWidth) == 'number')
+ {
+ width = windowRef.document.body.clientWidth;
+ }
+
+ return width;
+}
+
+function xbGetWindowHeight(windowRef)
+{
+ var height = 0;
+
+ if (!windowRef)
+ {
+ windowRef = window;
+ }
+
+ if (typeof(windowRef.innerWidth) == 'number')
+ {
+ height = windowRef.innerHeight;
+ }
+ else if (windowRef.document.body && typeof(windowRef.document.body.clientWidth) == 'number')
+ {
+ height = windowRef.document.body.clientHeight;
+ }
+ return height;
+}
+
+function xbGetElementsByNameAndType(name, type, windowRef)
+{
+ if (!windowRef)
+ windowRef = window;
+
+ var elmlist = new Array();
+
+ xbFindElementsByNameAndType(windowRef.document, name, type, elmlist);
+
+ return elmlist;
+}
+
+function xbFindElementsByNameAndType(doc, name, type, elmlist)
+{
+ var i;
+ var subdoc;
+
+ for (i = 0; i < doc[type].length; ++i)
+ {
+ if (doc[type][i].name && name == doc[type][i].name)
+ {
+ elmlist[elmlist.length] = doc[type][i];
+ }
+ }
+
+ if (doc.layers)
+ {
+ for (i = 0; i < doc.layers.length; ++i)
+ {
+ subdoc = doc.layers[i].document;
+ xbFindElementsByNameAndType(subdoc, name, type, elmlist);
+ }
+ }
+}
+
+if (document.layers)
+{
+ nav4FindLayer =
+ function (doc, id)
+ {
+ var i;
+ var subdoc;
+ var obj;
+
+ for (i = 0; i < doc.layers.length; ++i)
+ {
+ if (doc.layers[i].id && id == doc.layers[i].id)
+ return doc.layers[i];
+
+ subdoc = doc.layers[i].document;
+ obj = nav4FindLayer(subdoc, id);
+ if (obj != null)
+ return obj;
+ }
+ return null;
+ }
+
+ nav4FindElementsByName =
+ function (doc, name, elmlist)
+ {
+ var i;
+ var j;
+ var subdoc;
+
+ for (i = 0; i < doc.images.length; ++i)
+ {
+ if (doc.images[i].name && name == doc.images[i].name)
+ {
+ elmlist[elmlist.length] = doc.images[i];
+ }
+ }
+
+ for (i = 0; i < doc.forms.length; ++i)
+ {
+ for (j = 0; j < doc.forms[i].elements.length; j++)
+ {
+ if (doc.forms[i].elements[j].name && name == doc.forms[i].elements[j].name)
+ {
+ elmlist[elmlist.length] = doc.forms[i].elements[j];
+ }
+ }
+
+ if (doc.forms[i].name && name == doc.forms[i].name)
+ {
+ elmlist[elmlist.length] = doc.forms[i];
+ }
+ }
+
+ for (i = 0; i < doc.anchors.length; ++i)
+ {
+ if (doc.anchors[i].name && name == doc.anchors[i].name)
+ {
+ elmlist[elmlist.length] = doc.anchors[i];
+ }
+ }
+
+ for (i = 0; i < doc.links.length; ++i)
+ {
+ if (doc.links[i].name && name == doc.links[i].name)
+ {
+ elmlist[elmlist.length] = doc.links[i];
+ }
+ }
+
+ for (i = 0; i < doc.applets.length; ++i)
+ {
+ if (doc.applets[i].name && name == doc.applets[i].name)
+ {
+ elmlist[elmlist.length] = doc.applets[i];
+ }
+ }
+
+ for (i = 0; i < doc.embeds.length; ++i)
+ {
+ if (doc.embeds[i].name && name == doc.embeds[i].name)
+ {
+ elmlist[elmlist.length] = doc.embeds[i];
+ }
+ }
+
+ for (i = 0; i < doc.layers.length; ++i)
+ {
+ if (doc.layers[i].name && name == doc.layers[i].name)
+ {
+ elmlist[elmlist.length] = doc.layers[i];
+ }
+
+ subdoc = doc.layers[i].document;
+ nav4FindElementsByName(subdoc, name, elmlist);
+ }
+ }
+
+ xbGetElementById = function (id, windowRef)
+ {
+ if (!windowRef)
+ windowRef = window;
+
+ return nav4FindLayer(windowRef.document, id);
+ };
+
+ xbGetElementsByName = function (name, windowRef)
+ {
+ if (!windowRef)
+ windowRef = window;
+
+ var elmlist = new Array();
+
+ nav4FindElementsByName(windowRef.document, name, elmlist);
+
+ return elmlist;
+ };
+
+}
+else if (document.all)
+{
+ xbGetElementById =
+ function (id, windowRef)
+ {
+ if (!windowRef)
+ {
+ windowRef = window;
+ }
+ var elm = windowRef.document.all[id];
+ if (!elm)
+ {
+ elm = null;
+ }
+ return elm;
+ };
+
+ xbGetElementsByName = function (name, windowRef)
+ {
+ if (!windowRef)
+ windowRef = window;
+
+ var i;
+ var idnamelist = windowRef.document.all[name];
+ var elmlist = new Array();
+
+ if (!idnamelist.length || idnamelist.name == name)
+ {
+ if (idnamelist)
+ elmlist[elmlist.length] = idnamelist;
+ }
+ else
+ {
+ for (i = 0; i < idnamelist.length; i++)
+ {
+ if (idnamelist[i].name == name)
+ elmlist[elmlist.length] = idnamelist[i];
+ }
+ }
+
+ return elmlist;
+ }
+
+}
+else if (document.getElementById)
+{
+ xbGetElementById =
+ function (id, windowRef)
+ {
+ if (!windowRef)
+ {
+ windowRef = window;
+ }
+ return windowRef.document.getElementById(id);
+ };
+
+ xbGetElementsByName =
+ function (name, windowRef)
+ {
+ if (!windowRef)
+ {
+ windowRef = window;
+ }
+ return windowRef.document.getElementsByName(name);
+ };
+}
+else
+{
+ xbGetElementById =
+ function (id, windowRef)
+ {
+ return null;
+ };
+
+ xbGetElementsByName =
+ function (name, windowRef)
+ {
+ return new Array();
+ };
+}
+
+function xbGetPageScrollX(windowRef)
+{
+ if (!windowRef)
+ {
+ windowRef = window;
+ }
+
+ if (typeof(windowRef.pageXOffset) == 'number')
+ {
+ return windowRef.pageXOffset;
+ }
+
+ if (typeof(windowRef.document.body && windowRef.document.body.scrollLeft) == 'number')
+ {
+ return windowRef.document.body.scrollLeft;
+ }
+
+ return 0;
+}
+
+function xbGetPageScrollY(windowRef)
+{
+ if (!windowRef)
+ {
+ windowRef = window;
+ }
+
+ if (typeof(windowRef.pageYOffset) == 'number')
+ {
+ return windowRef.pageYOffset;
+ }
+
+ if (typeof(windowRef.document.body && windowRef.document.body.scrollTop) == 'number')
+ {
+ return windowRef.document.body.scrollTop;
+ }
+
+ return 0;
+}
+
+if (document.layers)
+{
+ xbSetInnerHTML =
+ function (element, str)
+ {
+ element.document.write(str);
+ element.document.close();
+ };
+}
+else
+{
+ xbSetInnerHTML = function (element, str)
+ {
+ if (typeof(element.innerHTML) != 'undefined')
+ {
+ element.innerHTML = str;
+ }
+ };
+}
+
+// eof: xbDOM.js
-/*\r
-xbDebug.js revision: 0.003 2002-02-26\r
-\r
-Contributor(s): Bob Clary, Netscape Communications, Copyright 2001\r
-\r
-Netscape grants you a royalty free license to use, modify and \r
-distribute this software provided that this copyright notice \r
-appears on all copies. This software is provided "AS IS," \r
-without a warranty of any kind.\r
-\r
-ChangeLog:\r
-\r
-2002-02-25: bclary - modified xbDebugTraceOject to make sure \r
- that original versions of wrapped functions were not\r
- rewrapped. This had caused an infinite loop in IE.\r
-\r
-2002-02-07: bclary - modified xbDebug.prototype.close to not null\r
- the debug window reference. This can cause problems with\r
- Internet Explorer if the page is refreshed. These issues will\r
- be addressed at a later date.\r
-*/\r
-\r
-function xbDebug()\r
-{\r
- this.on = false;\r
- this.stack = new Array();\r
- this.debugwindow = null;\r
- this.execprofile = new Object();\r
-}\r
-\r
-xbDebug.prototype.push = function ()\r
-{\r
- this.stack[this.stack.length] = this.on;\r
- this.on = true;\r
-}\r
-\r
-xbDebug.prototype.pop = function ()\r
-{\r
- this.on = this.stack[this.stack.length - 1];\r
- --this.stack.length;\r
-}\r
-\r
-xbDebug.prototype.open = function ()\r
-{\r
- if (this.debugwindow && !this.debugwindow.closed)\r
- this.close();\r
- \r
- this.debugwindow = window.open('about:blank', 'DEBUGWINDOW', 'height=400,width=600,resizable=yes,scrollbars=yes');\r
-\r
- this.debugwindow.title = 'xbDebug Window';\r
- this.debugwindow.document.write('<html><head><title>xbDebug Window</title></head><body><h3>Javascript Debug Window</h3></body></html>');\r
- this.debugwindow.focus();\r
-}\r
-\r
-xbDebug.prototype.close = function ()\r
-{\r
- if (!this.debugwindow)\r
- return;\r
- \r
- if (!this.debugwindow.closed)\r
- this.debugwindow.close();\r
-\r
- // bc 2002-02-07, other windows may still hold a reference to this: this.debugwindow = null;\r
-}\r
-\r
-xbDebug.prototype.dump = function (msg)\r
-{\r
- if (!this.on)\r
- return;\r
- \r
- if (!this.debugwindow || this.debugwindow.closed)\r
- this.open();\r
- \r
- this.debugwindow.document.write(msg + '<br>');\r
- \r
- return;\r
-}\r
-\r
-var xbDEBUG = new xbDebug();\r
-\r
-window.onunload = function () { xbDEBUG.close(); }\r
-\r
-function xbDebugGetFunctionName(funcref)\r
-{\r
-\r
- if (funcref.name)\r
- return funcref.name;\r
-\r
- var name = funcref + '';\r
- name = name.substring(name.indexOf(' ') + 1, name.indexOf('('));\r
- funcref.name = name;\r
-\r
- return name;\r
-}\r
-\r
-function xbDebugCreateFunctionWrapper(scopename, funcname, precall, postcall)\r
-{\r
- var wrappedfunc;\r
- var scopeobject = eval(scopename);\r
- var funcref = scopeobject[funcname];\r
-\r
- scopeobject['xbDebug_orig_' + funcname] = funcref;\r
-\r
- wrappedfunc = function () \r
- {\r
- precall(scopename, funcname, arguments);\r
- var rv = funcref.apply(this, arguments);\r
- postcall(scopename, funcname, arguments, rv);\r
- return rv;\r
- };\r
-\r
- if (typeof(funcref.constructor) != 'undefined')\r
- wrappedfunc.constructor = funcref.constuctor;\r
-\r
- if (typeof(funcref.prototype) != 'undefined')\r
- wrappedfunc.prototype = funcref.prototype;\r
-\r
- scopeobject[funcname] = wrappedfunc;\r
-}\r
-\r
-function xbDebugPersistToString(obj)\r
-{\r
- var s = '';\r
- var p;\r
-\r
- if (obj == null)\r
- return 'null';\r
-\r
- switch(typeof(obj))\r
- {\r
- case 'number':\r
- return obj;\r
- case 'string':\r
- return '"' + obj + '"';\r
- case 'undefined':\r
- return 'undefined';\r
- case 'boolean':\r
- return obj + '';\r
- }\r
-\r
- return '[' + xbDebugGetFunctionName(obj.constructor) + ']';\r
-}\r
-\r
-function xbDebugTraceBefore(scopename, funcname, funcarguments) \r
-{\r
- var i;\r
- var s = '';\r
- var execprofile = xbDEBUG.execprofile[scopename + '.' + funcname];\r
- if (!execprofile)\r
- execprofile = xbDEBUG.execprofile[scopename + '.' + funcname] = { started: 0, time: 0, count: 0 };\r
-\r
- for (i = 0; i < funcarguments.length; i++)\r
- {\r
- s += xbDebugPersistToString(funcarguments[i]);\r
- if (i < funcarguments.length - 1)\r
- s += ', ';\r
- }\r
-\r
- xbDEBUG.dump('enter ' + scopename + '.' + funcname + '(' + s + ')');\r
- execprofile.started = (new Date()).getTime();\r
-}\r
-\r
-function xbDebugTraceAfter(scopename, funcname, funcarguments, rv) \r
-{\r
- var i;\r
- var s = '';\r
- var execprofile = xbDEBUG.execprofile[scopename + '.' + funcname];\r
- if (!execprofile)\r
- xbDEBUG.dump('xbDebugTraceAfter: execprofile not created for ' + scopename + '.' + funcname);\r
- else if (execprofile.started == 0)\r
- xbDEBUG.dump('xbDebugTraceAfter: execprofile.started == 0 for ' + scopename + '.' + funcname);\r
- else \r
- {\r
- execprofile.time += (new Date()).getTime() - execprofile.started;\r
- execprofile.count++;\r
- execprofile.started = 0;\r
- }\r
-\r
- for (i = 0; i < funcarguments.length; i++)\r
- {\r
- s += xbDebugPersistToString(funcarguments[i]);\r
- if (i < funcarguments.length - 1)\r
- s += ', ';\r
- }\r
-\r
- xbDEBUG.dump('exit ' + scopename + '.' + funcname + '(' + s + ')==' + xbDebugPersistToString(rv));\r
-}\r
-\r
-function xbDebugTraceFunction(scopename, funcname)\r
-{\r
- xbDebugCreateFunctionWrapper(scopename, funcname, xbDebugTraceBefore, xbDebugTraceAfter);\r
-}\r
-\r
-function xbDebugTraceObject(scopename, objname)\r
-{\r
- var objref = eval(scopename + '.' + objname);\r
- var p;\r
-\r
- if (!objref || !objref.prototype)\r
- return;\r
-\r
- for (p in objref.prototype)\r
- {\r
- if (typeof(objref.prototype[p]) == 'function' && (p+'').indexOf('xbDebug_orig') == -1)\r
- {\r
- xbDebugCreateFunctionWrapper(scopename + '.' + objname + '.prototype', p + '', xbDebugTraceBefore, xbDebugTraceAfter);\r
- }\r
- }\r
-}\r
-\r
-function xbDebugDumpProfile()\r
-{\r
- var p;\r
- var execprofile;\r
- var avg;\r
-\r
- for (p in xbDEBUG.execprofile)\r
- {\r
- execprofile = xbDEBUG.execprofile[p];\r
- avg = Math.round ( 100 * execprofile.time/execprofile.count) /100;\r
- xbDEBUG.dump('Execution profile ' + p + ' called ' + execprofile.count + ' times. Total time=' + execprofile.time + 'ms. Avg Time=' + avg + 'ms.');\r
- }\r
-}\r
+/*
+ * xbDebug.js
+ * $Revision: 1.2 $ $Date: 2003/02/07 16:04:19 $
+ */
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Netscape code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2001
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Bob Clary <bclary@netscape.com>
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ChangeLog:
+
+2002-02-25: bclary - modified xbDebugTraceOject to make sure
+ that original versions of wrapped functions were not
+ rewrapped. This had caused an infinite loop in IE.
+
+2002-02-07: bclary - modified xbDebug.prototype.close to not null
+ the debug window reference. This can cause problems with
+ Internet Explorer if the page is refreshed. These issues will
+ be addressed at a later date.
+*/
+
+function xbDebug()
+{
+ this.on = false;
+ this.stack = new Array();
+ this.debugwindow = null;
+ this.execprofile = new Object();
+}
+
+xbDebug.prototype.push = function ()
+{
+ this.stack[this.stack.length] = this.on;
+ this.on = true;
+}
+
+xbDebug.prototype.pop = function ()
+{
+ this.on = this.stack[this.stack.length - 1];
+ --this.stack.length;
+}
+
+xbDebug.prototype.open = function ()
+{
+ if (this.debugwindow && !this.debugwindow.closed)
+ this.close();
+
+ this.debugwindow = window.open('about:blank', 'DEBUGWINDOW', 'height=400,width=600,resizable=yes,scrollbars=yes');
+ this.debugwindow.moveTo(0,0);
+ window.focus();
+
+ this.debugwindow.document.write('<html><head><title>xbDebug Window</title></head><body><h3>Javascript Debug Window</h3></body></html>');
+}
+
+xbDebug.prototype.close = function ()
+{
+ if (!this.debugwindow)
+ return;
+
+ if (!this.debugwindow.closed)
+ this.debugwindow.close();
+
+ // bc 2002-02-07, other windows may still hold a reference to this: this.debugwindow = null;
+}
+
+xbDebug.prototype.dump = function (msg)
+{
+ if (!this.on)
+ return;
+
+ if (!this.debugwindow || this.debugwindow.closed)
+ this.open();
+
+ this.debugwindow.document.write(msg + '<br>');
+
+ return;
+}
+
+var xbDEBUG = new xbDebug();
+
+window.onunload = function () { xbDEBUG.close(); }
+
+function xbDebugGetFunctionName(funcref)
+{
+
+ if (!funcref)
+ {
+ return '';
+ }
+
+ if (funcref.name)
+ return funcref.name;
+
+ var name = funcref + '';
+ name = name.substring(name.indexOf(' ') + 1, name.indexOf('('));
+ funcref.name = name;
+
+ if (!name) alert('name not defined');
+ return name;
+}
+
+
+// emulate functionref.apply for IE mac and IE win < 5.5
+function xbDebugApplyFunction(funcname, funcref, thisref, argumentsref)
+{
+ var rv;
+
+ if (!funcref)
+ {
+ alert('xbDebugApplyFunction: funcref is null');
+ }
+
+ if (typeof(funcref.apply) != 'undefined')
+ return funcref.apply(thisref, argumentsref);
+
+ var applyexpr = 'thisref.xbDebug_orig_' + funcname + '(';
+ var i;
+
+ for (i = 0; i < argumentsref.length; i++)
+ {
+ applyexpr += 'argumentsref[' + i + '],';
+ }
+
+ if (argumentsref.length > 0)
+ {
+ applyexpr = applyexpr.substring(0, applyexpr.length - 1);
+ }
+
+ applyexpr += ')';
+
+ return eval(applyexpr);
+}
+
+function xbDebugCreateFunctionWrapper(scopename, funcname, precall, postcall)
+{
+ var wrappedfunc;
+ var scopeobject = eval(scopename);
+ var funcref = scopeobject[funcname];
+
+ scopeobject['xbDebug_orig_' + funcname] = funcref;
+
+ wrappedfunc = function ()
+ {
+ var rv;
+
+ precall(scopename, funcname, arguments);
+ rv = xbDebugApplyFunction(funcname, funcref, scopeobject, arguments);
+ postcall(scopename, funcname, arguments, rv);
+ return rv;
+ };
+
+ if (typeof(funcref.constructor) != 'undefined')
+ wrappedfunc.constructor = funcref.constuctor;
+
+ if (typeof(funcref.prototype) != 'undefined')
+ wrappedfunc.prototype = funcref.prototype;
+
+ scopeobject[funcname] = wrappedfunc;
+}
+
+function xbDebugCreateMethodWrapper(contextname, classname, methodname, precall, postcall)
+{
+ var context = eval(contextname);
+ var methodref = context[classname].prototype[methodname];
+
+ context[classname].prototype['xbDebug_orig_' + methodname] = methodref;
+
+ var wrappedmethod = function ()
+ {
+ var rv;
+ // eval 'this' at method run time to pick up reference to the object's instance
+ var thisref = eval('this');
+ // eval 'arguments' at method run time to pick up method's arguments
+ var argsref = arguments;
+
+ precall(contextname + '.' + classname, methodname, argsref);
+ rv = xbDebugApplyFunction(methodname, methodref, thisref, argsref);
+ postcall(contextname + '.' + classname, methodname, argsref, rv);
+ return rv;
+ };
+
+ return wrappedmethod;
+}
+
+function xbDebugPersistToString(obj)
+{
+ var s = '';
+
+ if (obj == null)
+ return 'null';
+
+ switch(typeof(obj))
+ {
+ case 'number':
+ return obj;
+ case 'string':
+ return '"' + obj + '"';
+ case 'undefined':
+ return 'undefined';
+ case 'boolean':
+ return obj + '';
+ }
+
+ if (obj.constructor)
+ return '[' + xbDebugGetFunctionName(obj.constructor) + ']';
+
+ return null;
+}
+
+function xbDebugTraceBefore(scopename, funcname, funcarguments)
+{
+ var i;
+ var s = '';
+ var execprofile = xbDEBUG.execprofile[scopename + '.' + funcname];
+ if (!execprofile)
+ execprofile = xbDEBUG.execprofile[scopename + '.' + funcname] = { started: 0, time: 0, count: 0 };
+
+ for (i = 0; i < funcarguments.length; i++)
+ {
+ s += xbDebugPersistToString(funcarguments[i]);
+ if (i < funcarguments.length - 1)
+ s += ', ';
+ }
+
+ xbDEBUG.dump('enter ' + scopename + '.' + funcname + '(' + s + ')');
+ execprofile.started = (new Date()).getTime();
+}
+
+function xbDebugTraceAfter(scopename, funcname, funcarguments, rv)
+{
+ var i;
+ var s = '';
+ var execprofile = xbDEBUG.execprofile[scopename + '.' + funcname];
+ if (!execprofile)
+ xbDEBUG.dump('xbDebugTraceAfter: execprofile not created for ' + scopename + '.' + funcname);
+ else if (execprofile.started == 0)
+ xbDEBUG.dump('xbDebugTraceAfter: execprofile.started == 0 for ' + scopename + '.' + funcname);
+ else
+ {
+ execprofile.time += (new Date()).getTime() - execprofile.started;
+ execprofile.count++;
+ execprofile.started = 0;
+ }
+
+ for (i = 0; i < funcarguments.length; i++)
+ {
+ s += xbDebugPersistToString(funcarguments[i]);
+ if (i < funcarguments.length - 1)
+ s += ', ';
+ }
+
+ xbDEBUG.dump('exit ' + scopename + '.' + funcname + '(' + s + ')==' + xbDebugPersistToString(rv));
+}
+
+function xbDebugTraceFunction(scopename, funcname)
+{
+ xbDebugCreateFunctionWrapper(scopename, funcname, xbDebugTraceBefore, xbDebugTraceAfter);
+}
+
+function xbDebugTraceObject(contextname, classname)
+{
+ var classref = eval(contextname + '.' + classname);
+ var p;
+ var sp;
+
+ if (!classref || !classref.prototype)
+ return;
+
+ for (p in classref.prototype)
+ {
+ sp = p + '';
+ if (typeof(classref.prototype[sp]) == 'function' && (sp).indexOf('xbDebug_orig') == -1)
+ {
+ classref.prototype[sp] = xbDebugCreateMethodWrapper(contextname, classname, sp, xbDebugTraceBefore, xbDebugTraceAfter);
+ }
+ }
+}
+
+function xbDebugDumpProfile()
+{
+ var p;
+ var execprofile;
+ var avg;
+
+ for (p in xbDEBUG.execprofile)
+ {
+ execprofile = xbDEBUG.execprofile[p];
+ avg = Math.round ( 100 * execprofile.time/execprofile.count) /100;
+ xbDEBUG.dump('Execution profile ' + p + ' called ' + execprofile.count + ' times. Total time=' + execprofile.time + 'ms. Avg Time=' + avg + 'ms.');
+ }
+}
--- /dev/null
+/*
+ * xbLibrary.js
+ * $Revision: 1.3 $ $Date: 2003/03/17 03:44:20 $
+ */
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Bob Clary code.
+ *
+ * The Initial Developer of the Original Code is
+ * Bob Clary.
+ * Portions created by the Initial Developer are Copyright (C) 2000
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Bob Clary <bc@bclary.com>
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (!document.getElementById || navigator.userAgent.indexOf('Opera') != -1)
+{
+ // assign error handler for downlevel browsers
+ // Note until Opera improves it's overall support
+ // for JavaScript and the DOM, it must be considered downlevel
+
+ window.onerror = defaultOnError;
+
+ function defaultOnError(msg, url, line)
+ {
+ // handle bug in NS6.1, N6.2
+ // where an Event is passed to error handlers
+ if (typeof(msg) != 'string')
+ {
+ msg = 'unknown error';
+ }
+ if (typeof(url) != 'string')
+ {
+ url = document.location;
+ }
+
+ alert('An error has occurred at ' + url + ', line ' + line + ': ' + msg);
+ }
+}
+
+function xbLibrary(path)
+{
+ if (path.charAt(path.length-1) == '/')
+ {
+ path = path.substr(0, path.length-1)
+ }
+ this.path = path;
+}
+
+// dynamically loaded scripts
+//
+// it is an error to reference anything from the dynamically loaded file inside the
+// same script block. This means that a file can not check its dependencies and
+// load the files for it's own use. someone else must do this.
+
+xbLibrary.prototype.loadScript =
+function (scriptName)
+{
+ document.write('<script language="javascript" src="' + this.path + '/' + scriptName + '"><\/script>');
+};
+
+// default xbLibrary
+
+xblibrary = new xbLibrary('./');
+
+
--- /dev/null
+/*
+ * xbStyle-css.js
+ * $Revision: 1.2 $ $Date: 2003/02/07 16:04:21 $
+ *
+ */
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Netscape code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2001
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Bob Clary <bclary@netscape.com>
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+// xbStyle.getClip()
+
+function cssStyleGetClip()
+{
+ var clip = this.getEffectiveValue('clip');
+
+ // hack opera
+ if (clip == 'rect()')
+ clip = '';
+
+ if (clip == '' || clip == 'auto')
+ {
+ clip = 'rect(0px, ' + this.getWidth() + 'px, ' + this.getHeight() + 'px, 0px)';
+ }
+ else
+ {
+ clip = clip.replace(/px /g, 'px, ');
+ }
+
+ return clip;
+}
+
+// xbStyle.setClip()
+
+function cssStyleSetClip(sClipString)
+{
+ this.styleObj.clip = sClipString;
+}
+
+// xbStyle.getClipTop()
+
+function cssStyleGetClipTop()
+{
+ var clip = this.getClip();
+ var rect = new xbClipRect(clip);
+ return rect.top;
+}
+
+// xbStyle.setClipTop()
+
+function cssStyleSetClipTop(top)
+{
+ var clip = this.getClip();
+ var rect = new xbClipRect(clip);
+ rect.top = top;
+ this.styleObj.clip = rect.toString();
+}
+
+// xbStyle.getClipRight()
+
+function cssStyleGetClipRight()
+{
+ var clip = this.getClip();
+ var rect = new xbClipRect(clip);
+ return rect.right;
+}
+
+// xbStyle.setClipRight()
+
+function cssStyleSetClipRight(right)
+{
+ var clip = this.getClip();
+ var rect = new xbClipRect(clip);
+ rect.right = right;
+ this.styleObj.clip = rect.toString();
+}
+
+// xbStyle.getClipBottom()
+
+function cssStyleGetClipBottom()
+{
+ var clip = this.getClip();
+ var rect = new xbClipRect(clip);
+ return rect.bottom;
+}
+
+// xbStyle.setClipBottom()
+
+function cssStyleSetClipBottom(bottom)
+{
+ var clip = this.getClip();
+ var rect = new xbClipRect(clip);
+ rect.bottom = bottom;
+ this.styleObj.clip = rect.toString();
+}
+
+// xbStyle.getClipLeft()
+
+function cssStyleGetClipLeft()
+{
+ var clip = this.getClip();
+ var rect = new xbClipRect(clip);
+ return rect.left;
+}
+
+// xbStyle.setClipLeft()
+
+function cssStyleSetClipLeft(left)
+{
+ var clip = this.getClip();
+ var rect = new xbClipRect(clip);
+ rect.left = left;
+ this.styleObj.clip = rect.toString();
+}
+
+// xbStyle.getClipWidth()
+
+function cssStyleGetClipWidth()
+{
+ var clip = this.getClip();
+ var rect = new xbClipRect(clip);
+ return rect.getWidth();
+}
+
+// xbStyle.setClipWidth()
+
+function cssStyleSetClipWidth(width)
+{
+ var clip = this.getClip();
+ var rect = new xbClipRect(clip);
+ rect.setWidth(width);
+ this.styleObj.clip = rect.toString();
+}
+
+// xbStyle.getClipHeight()
+
+function cssStyleGetClipHeight()
+{
+ var clip = this.getClip();
+ var rect = new xbClipRect(clip);
+ return rect.getHeight();
+}
+
+// xbStyle.setClipHeight()
+
+function cssStyleSetClipHeight(height)
+{
+ var clip = this.getClip();
+ var rect = new xbClipRect(clip);
+ rect.setHeight(height);
+ this.styleObj.clip = rect.toString();
+}
+
+// the CSS attributes left,top are for absolutely positioned elements
+// measured relative to the containing element. for relatively positioned
+// elements, left,top are measured from the element's normal inline position.
+// getLeft(), setLeft() operate on this type of coordinate.
+//
+// to allow dynamic positioning the getOffsetXXX and setOffsetXXX methods are
+// defined to return and set the position of either an absolutely or relatively
+// positioned element relative to the containing element.
+//
+//
+
+// xbStyle.getLeft()
+
+function cssStyleGetLeft()
+{
+ var left = this.getEffectiveValue('left');
+ if (typeof(left) == 'number')
+ return left;
+
+ if (left != '' && left.indexOf('px') == -1)
+ {
+ xbDEBUG.dump('xbStyle.getLeft: Element ID=' + this.object.id + ' does not use pixels as units. left=' + left + ' Click Ok to continue, Cancel to Abort');
+ return 0;
+ }
+
+ if (top == 'auto' && this.object && typeof(this.object.offsetTop) == 'number')
+ {
+ left = this.object.offsetTop + 'px';
+ }
+
+ if (left == '')
+ left = '0px';
+
+ return xbToInt(left);
+}
+
+// xbStyle.setLeft()
+
+function cssStyleSetLeft(left)
+{
+ if (typeof(this.styleObj.left) == 'number')
+ this.styleObj.left = left;
+ else
+ this.styleObj.left = left + 'px';
+}
+
+// xbStyle.getTop()
+
+function cssStyleGetTop()
+{
+ var top = this.getEffectiveValue('top');
+ if (typeof(top) == 'number')
+ return top;
+
+ if (top != '' && top.indexOf('px') == -1)
+ {
+ xbDEBUG.dump('xbStyle.getTop: Element ID=' + this.object.id + ' does not use pixels as units. top=' + top + ' Click Ok to continue, Cancel to Abort');
+ return 0;
+ }
+
+ if (top == 'auto' && this.object && typeof(this.object.offsetTop) == 'number')
+ {
+ top = this.object.offsetTop + 'px';
+ }
+
+ if (top == '')
+ top = '0px';
+
+ return xbToInt(top);
+}
+
+// xbStyle.setTop()
+
+function cssStyleSetTop(top)
+{
+ if (typeof(this.styleObj.top) == 'number')
+ this.styleObj.top = top;
+ else
+ this.styleObj.top = top + 'px';
+}
+
+// xbStyle.getPageX()
+
+function cssStyleGetPageX()
+{
+ var x = 0;
+ var elm = this.object;
+ var elmstyle;
+ var position;
+
+ //xxxHack: Due to limitations in Gecko's (0.9.6) ability to determine the
+ // effective position attribute , attempt to use offsetXXX
+
+ if (typeof(elm.offsetLeft) == 'number')
+ {
+ while (elm)
+ {
+ x += elm.offsetLeft;
+ elm = elm.offsetParent;
+ }
+ }
+ else
+ {
+ while (elm)
+ {
+ if (elm.style)
+ {
+ elmstyle = new xbStyle(elm);
+ position = elmstyle.getEffectiveValue('position');
+ if (position != '' && position != 'static')
+ x += elmstyle.getLeft();
+ }
+ elm = elm.parentNode;
+ }
+ }
+
+ return x;
+}
+
+// xbStyle.setPageX()
+
+function cssStyleSetPageX(x)
+{
+ var xParent = 0;
+ var elm = this.object.parentNode;
+ var elmstyle;
+ var position;
+
+ //xxxHack: Due to limitations in Gecko's (0.9.6) ability to determine the
+ // effective position attribute , attempt to use offsetXXX
+
+ if (elm && typeof(elm.offsetLeft) == 'number')
+ {
+ while (elm)
+ {
+ xParent += elm.offsetLeft;
+ elm = elm.offsetParent;
+ }
+ }
+ else
+ {
+ while (elm)
+ {
+ if (elm.style)
+ {
+ elmstyle = new xbStyle(elm);
+ position = elmstyle.getEffectiveValue('position');
+ if (position != '' && position != 'static')
+ xParent += elmstyle.getLeft();
+ }
+ elm = elm.parentNode;
+ }
+ }
+
+ x -= xParent;
+
+ this.setLeft(x);
+}
+
+// xbStyle.getPageY()
+
+function cssStyleGetPageY()
+{
+ var y = 0;
+ var elm = this.object;
+ var elmstyle;
+ var position;
+
+ //xxxHack: Due to limitations in Gecko's (0.9.6) ability to determine the
+ // effective position attribute , attempt to use offsetXXX
+
+ if (typeof(elm.offsetTop) == 'number')
+ {
+ while (elm)
+ {
+ y += elm.offsetTop;
+ elm = elm.offsetParent;
+ }
+ }
+ else
+ {
+ while (elm)
+ {
+ if (elm.style)
+ {
+ elmstyle = new xbStyle(elm);
+ position = elmstyle.getEffectiveValue('position');
+ if (position != '' && position != 'static')
+ y += elmstyle.getTop();
+ }
+ elm = elm.parentNode;
+ }
+ }
+
+ return y;
+}
+
+// xbStyle.setPageY()
+
+function cssStyleSetPageY(y)
+{
+ var yParent = 0;
+ var elm = this.object.parentNode;
+ var elmstyle;
+ var position;
+
+ //xxxHack: Due to limitations in Gecko's (0.9.6) ability to determine the
+ // effective position attribute , attempt to use offsetXXX
+
+ if (elm && typeof(elm.offsetTop) == 'number')
+ {
+ while (elm)
+ {
+ yParent += elm.offsetTop;
+ elm = elm.offsetParent;
+ }
+ }
+ else
+ {
+ while (elm)
+ {
+ if (elm.style)
+ {
+ elmstyle = new xbStyle(elm);
+ position = elmstyle.getEffectiveValue('position');
+ if (position != '' && position != 'static')
+ yParent += elmstyle.getTop();
+ }
+ elm = elm.parentNode;
+ }
+ }
+
+ y -= yParent;
+
+ this.setTop(y);
+}
+
+// xbStyle.getHeight()
+
+function cssStyleGetHeight()
+{
+ var display = this.getEffectiveValue('display');
+ var height = this.getEffectiveValue('height');
+
+ if (typeof(height) == 'number')
+ {
+ // Opera
+ return height;
+ }
+
+ if (height == '' || height == 'auto' || height.indexOf('%') != -1)
+ {
+ if (typeof(this.object.offsetHeight) == 'number')
+ {
+ height = this.object.offsetHeight + 'px';
+ }
+ else if (typeof(this.object.scrollHeight) == 'number')
+ {
+ height = this.object.scrollHeight + 'px';
+ }
+ }
+
+ if (height.indexOf('px') == -1)
+ {
+ xbDEBUG.dump('xbStyle.getHeight: Element ID=' + this.object.id + ' does not use pixels as units. height=' + height + ' Click Ok to continue, Cancel to Abort');
+ return 0;
+ }
+
+ height = xbToInt(height);
+
+ return height;
+}
+
+// xbStyle.setHeight()
+
+function cssStyleSetHeight(height)
+{
+ if (typeof(this.styleObj.height) == 'number')
+ this.styleObj.height = height;
+ else
+ this.styleObj.height = height + 'px';
+}
+
+// xbStyle.getWidth()
+
+function cssStyleGetWidth()
+{
+ var display = this.getEffectiveValue('display');
+ var width = this.getEffectiveValue('width');
+
+ if (typeof(width) == 'number')
+ {
+ // note Opera 6 has a bug in width and offsetWidth where
+ // it returns the page width. Use clientWidth instead.
+ if (navigator.userAgent.indexOf('Opera') != -1)
+ return this.object.clientWidth;
+ else
+ return width;
+ }
+
+ if (width == '' || width == 'auto' || width.indexOf('%') != -1)
+ {
+ if (typeof(this.object.offsetWidth) == 'number')
+ {
+ width = this.object.offsetWidth + 'px';
+ }
+ else if (typeof(this.object.scrollHeight) == 'number')
+ {
+ width = this.object.scrollWidth + 'px';
+ }
+ }
+
+ if (width.indexOf('px') == -1)
+ {
+ xbDEBUG.dump('xbStyle.getWidth: Element ID=' + this.object.id + ' does not use pixels as units. width=' + width + ' Click Ok to continue, Cancel to Abort');
+ return 0;
+ }
+
+ width = xbToInt(width);
+
+ return width;
+}
+
+// xbStyle.setWidth()
+
+function cssStyleSetWidth(width)
+{
+ if (typeof(this.styleObj.width) == 'number')
+ this.styleObj.width = width;
+ else
+ this.styleObj.width = width + 'px';
+}
+
+// xbStyle.getVisibility()
+
+function cssStyleGetVisibility()
+{
+ return this.getEffectiveValue('visibility');
+}
+
+// xbStyle.setVisibility()
+
+function cssStyleSetVisibility(visibility)
+{
+ this.styleObj.visibility = visibility;
+}
+
+// xbStyle.getzIndex()
+
+function cssStyleGetzIndex()
+{
+ return xbToInt(this.getEffectiveValue('zIndex'));
+}
+
+// xbStyle.setzIndex()
+
+function cssStyleSetzIndex(zIndex)
+{
+ this.styleObj.zIndex = zIndex;
+}
+
+// xbStyle.getBackgroundColor()
+
+function cssStyleGetBackgroundColor()
+{
+ return this.getEffectiveValue('backgroundColor');
+}
+
+// xbStyle.setBackgroundColor()
+
+function cssStyleSetBackgroundColor(color)
+{
+ this.styleObj.backgroundColor = color;
+}
+
+// xbStyle.getColor()
+
+function cssStyleGetColor()
+{
+ return this.getEffectiveValue('color');
+}
+
+// xbStyle.setColor()
+
+function cssStyleSetColor(color)
+{
+ this.styleObj.color = color;
+}
+
+// xbStyle.moveAbove()
+
+function xbStyleMoveAbove(cont)
+{
+ this.setzIndex(cont.getzIndex()+1);
+}
+
+// xbStyle.moveBelow()
+
+function xbStyleMoveBelow(cont)
+{
+ var zindex = cont.getzIndex() - 1;
+
+ this.setzIndex(zindex);
+}
+
+// xbStyle.moveBy()
+
+function xbStyleMoveBy(deltaX, deltaY)
+{
+ this.moveTo(this.getLeft() + deltaX, this.getTop() + deltaY);
+}
+
+// xbStyle.moveTo()
+
+function xbStyleMoveTo(x, y)
+{
+ this.setLeft(x);
+ this.setTop(y);
+}
+
+// xbStyle.moveToAbsolute()
+
+function xbStyleMoveToAbsolute(x, y)
+{
+ this.setPageX(x);
+ this.setPageY(y);
+}
+
+// xbStyle.resizeBy()
+
+function xbStyleResizeBy(deltaX, deltaY)
+{
+ this.setWidth( this.getWidth() + deltaX );
+ this.setHeight( this.getHeight() + deltaY );
+}
+
+// xbStyle.resizeTo()
+
+function xbStyleResizeTo(x, y)
+{
+ this.setWidth(x);
+ this.setHeight(y);
+}
+
+// xbStyle.setInnerHTML()
+
+function xbSetInnerHTML(str)
+{
+ if (typeof(this.object.innerHTML) != 'undefined')
+ this.object.innerHTML = str;
+}
+
+
+// Extensions to xbStyle that are not supported by Netscape Navigator 4
+// but that provide cross browser implementations of properties for
+// Mozilla, Gecko, Netscape 6.x and Opera
+
+// xbStyle.getBorderTopWidth()
+
+function cssStyleGetBorderTopWidth()
+{
+ return xbToInt(this.getEffectiveValue('borderTopWidth'));
+}
+
+// xbStyle.getBorderRightWidth()
+
+function cssStyleGetBorderRightWidth()
+{
+ return xbToInt(this.getEffectiveValue('borderRightWidth'));
+}
+
+// xbStyle.getBorderBottomWidth()
+
+function cssStyleGetBorderBottomWidth()
+{
+ return xbToInt(this.getEffectiveValue('borderBottomWidth'));
+}
+
+// xbStyle.getBorderLeftWidth()
+
+function cssStyleGetBorderLeftWidth()
+{
+ return xbToInt(this.getEffectiveValue('borderLeftWidth'));
+}
+
+// xbStyle.getMarginTop()
+
+function cssStyleGetMarginTop()
+{
+ return xbToInt(this.getEffectiveValue('marginTop'));
+}
+
+// xbStyle.getMarginRight()
+
+function cssStyleGetMarginRight()
+{
+ return xbToInt(this.getEffectiveValue('marginRight'));
+}
+
+// xbStyle.getMarginBottom()
+
+function cssStyleGetMarginBottom()
+{
+ return xbToInt(this.getEffectiveValue('marginBottom'));
+}
+
+// xbStyle.getMarginLeft()
+
+function cssStyleGetMarginLeft()
+{
+ return xbToInt(this.getEffectiveValue('marginLeft'));
+}
+
+// xbStyle.getPaddingTop()
+
+function cssStyleGetPaddingTop()
+{
+ return xbToInt(this.getEffectiveValue('paddingTop'));
+}
+
+// xbStyle.getPaddingRight()
+
+function cssStyleGetPaddingRight()
+{
+ return xbToInt(this.getEffectiveValue('paddingRight'));
+}
+
+// xbStyle.getPaddingBottom()
+
+function cssStyleGetPaddingBottom()
+{
+ return xbToInt(this.getEffectiveValue('paddingBottom'));
+}
+
+// xbStyle.getPaddingLeft()
+
+function cssStyleGetPaddingLeft()
+{
+ return xbToInt(this.getEffectiveValue('paddingLeft'));
+}
+
+// xbStyle.getClientWidth()
+
+function cssStyleGetClientWidth()
+{
+ return this.getWidth() + this.getPaddingLeft() + this.getPaddingRight();
+ /*
+ if (typeof(this.object.clientWidth) == 'number')
+ return this.object.clientWidth;
+
+ return null;
+ */
+}
+
+// xbStyle.getClientHeight()
+
+function cssStyleGetClientHeight()
+{
+ return this.getHeight() + this.getPaddingTop() + this.getPaddingBottom();
+ /*
+ if (typeof(this.object.clientHeight) == 'number')
+ return this.object.clientHeight;
+
+ return null;
+ */
+}
+
+xbStyle.prototype.getClip = cssStyleGetClip;
+xbStyle.prototype.setClip = cssStyleSetClip;
+xbStyle.prototype.getClipTop = cssStyleGetClipTop;
+xbStyle.prototype.setClipTop = cssStyleSetClipTop;
+xbStyle.prototype.getClipRight = cssStyleGetClipRight;
+xbStyle.prototype.setClipRight = cssStyleSetClipRight;
+xbStyle.prototype.getClipBottom = cssStyleGetClipBottom;
+xbStyle.prototype.setClipBottom = cssStyleSetClipBottom;
+xbStyle.prototype.getClipLeft = cssStyleGetClipLeft;
+xbStyle.prototype.setClipLeft = cssStyleSetClipLeft;
+xbStyle.prototype.getClipWidth = cssStyleGetClipWidth;
+xbStyle.prototype.setClipWidth = cssStyleSetClipWidth;
+xbStyle.prototype.getClipHeight = cssStyleGetClipHeight;
+xbStyle.prototype.setClipHeight = cssStyleSetClipHeight;
+xbStyle.prototype.getLeft = cssStyleGetLeft;
+xbStyle.prototype.setLeft = cssStyleSetLeft;
+xbStyle.prototype.getTop = cssStyleGetTop;
+xbStyle.prototype.setTop = cssStyleSetTop;
+xbStyle.prototype.getPageX = cssStyleGetPageX;
+xbStyle.prototype.setPageX = cssStyleSetPageX;
+xbStyle.prototype.getPageY = cssStyleGetPageY;
+xbStyle.prototype.setPageY = cssStyleSetPageY;
+xbStyle.prototype.getVisibility = cssStyleGetVisibility;
+xbStyle.prototype.setVisibility = cssStyleSetVisibility;
+xbStyle.prototype.getzIndex = cssStyleGetzIndex;
+xbStyle.prototype.setzIndex = cssStyleSetzIndex;
+xbStyle.prototype.getHeight = cssStyleGetHeight;
+xbStyle.prototype.setHeight = cssStyleSetHeight;
+xbStyle.prototype.getWidth = cssStyleGetWidth;
+xbStyle.prototype.setWidth = cssStyleSetWidth;
+xbStyle.prototype.getBackgroundColor = cssStyleGetBackgroundColor;
+xbStyle.prototype.setBackgroundColor = cssStyleSetBackgroundColor;
+xbStyle.prototype.getColor = cssStyleGetColor;
+xbStyle.prototype.setColor = cssStyleSetColor;
+xbStyle.prototype.setInnerHTML = xbSetInnerHTML;
+xbStyle.prototype.getBorderTopWidth = cssStyleGetBorderTopWidth;
+xbStyle.prototype.getBorderRightWidth = cssStyleGetBorderRightWidth;
+xbStyle.prototype.getBorderBottomWidth = cssStyleGetBorderBottomWidth;
+xbStyle.prototype.getBorderLeftWidth = cssStyleGetBorderLeftWidth;
+xbStyle.prototype.getMarginLeft = cssStyleGetMarginLeft;
+xbStyle.prototype.getMarginTop = cssStyleGetMarginTop;
+xbStyle.prototype.getMarginRight = cssStyleGetMarginRight;
+xbStyle.prototype.getMarginBottom = cssStyleGetMarginBottom;
+xbStyle.prototype.getMarginLeft = cssStyleGetMarginLeft;
+xbStyle.prototype.getPaddingTop = cssStyleGetPaddingTop;
+xbStyle.prototype.getPaddingRight = cssStyleGetPaddingRight;
+xbStyle.prototype.getPaddingBottom = cssStyleGetPaddingBottom;
+xbStyle.prototype.getPaddingLeft = cssStyleGetPaddingLeft;
+xbStyle.prototype.getClientWidth = cssStyleGetClientWidth;
+xbStyle.prototype.getClientHeight = cssStyleGetClientHeight;
+
--- /dev/null
+/*
+ * xbStyle-nn4.js
+ * $Revision: 1.2 $ $Date: 2003/02/07 16:04:22 $
+ */
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Netscape code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2001
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Bob Clary <bclary@netscape.com>
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/////////////////////////////////////////////////////////////
+// xbStyle.getClip()
+
+function nsxbStyleGetClip()
+{
+ var clip = this.styleObj.clip;
+ var rect = new xbClipRect(clip.top, clip.right, clip.bottom, clip.left);
+ return rect.toString();
+}
+
+/////////////////////////////////////////////////////////////
+// xbStyle.setClip()
+
+function nsxbStyleSetClip(sClipString)
+{
+ var rect = new xbClipRect(sClipString);
+ this.styleObj.clip.top = rect.top;
+ this.styleObj.clip.right = rect.right;
+ this.styleObj.clip.bottom = rect.bottom;
+ this.styleObj.clip.left = rect.left;
+}
+
+/////////////////////////////////////////////////////////////
+// xbStyle.getClipTop()
+
+function nsxbStyleGetClipTop()
+{
+ return this.styleObj.clip.top;
+}
+
+/////////////////////////////////////////////////////////////
+// xbStyle.setClipTop()
+
+function nsxbStyleSetClipTop(top)
+{
+ return this.styleObj.clip.top = top;
+}
+
+/////////////////////////////////////////////////////////////
+// xbStyle.getClipRight()
+
+function nsxbStyleGetClipRight()
+{
+ return this.styleObj.clip.right;
+}
+
+/////////////////////////////////////////////////////////////
+// xbStyle.setClipRight()
+
+function nsxbStyleSetClipRight(right)
+{
+ return this.styleObj.clip.right = right;
+}
+
+/////////////////////////////////////////////////////////////
+// xbStyle.getClipBottom()
+
+function nsxbStyleGetClipBottom()
+{
+ return this.styleObj.clip.bottom;
+}
+
+/////////////////////////////////////////////////////////////
+// xbStyle.setClipBottom()
+
+function nsxbStyleSetClipBottom(bottom)
+{
+ return this.styleObj.clip.bottom = bottom;
+}
+
+/////////////////////////////////////////////////////////////
+// xbStyle.getClipLeft()
+
+function nsxbStyleGetClipLeft()
+{
+ return this.styleObj.clip.left;
+}
+
+/////////////////////////////////////////////////////////////
+// xbStyle.setClipLeft()
+
+function nsxbStyleSetClipLeft(left)
+{
+ return this.styleObj.clip.left = left;
+}
+
+/////////////////////////////////////////////////////////////
+// xbStyle.getClipWidth()
+
+function nsxbStyleGetClipWidth()
+{
+ return this.styleObj.clip.width;
+}
+
+/////////////////////////////////////////////////////////////
+// xbStyle.setClipWidth()
+
+function nsxbStyleSetClipWidth(width)
+{
+ return this.styleObj.clip.width = width;
+}
+
+/////////////////////////////////////////////////////////////
+// xbStyle.getClipHeight()
+
+function nsxbStyleGetClipHeight()
+{
+ return this.styleObj.clip.height;
+}
+
+/////////////////////////////////////////////////////////////
+// xbStyle.setClipHeight()
+
+function nsxbStyleSetClipHeight(height)
+{
+ return this.styleObj.clip.height = height;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.getLeft()
+
+function nsxbStyleGetLeft()
+{
+ return this.styleObj.left;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.setLeft()
+
+function nsxbStyleSetLeft(left)
+{
+ this.styleObj.left = left;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.getTop()
+
+function nsxbStyleGetTop()
+{
+ return this.styleObj.top;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.setTop()
+
+function nsxbStyleSetTop(top)
+{
+ this.styleObj.top = top;
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.getPageX()
+
+function nsxbStyleGetPageX()
+{
+ return this.styleObj.pageX;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.setPageX()
+
+function nsxbStyleSetPageX(x)
+{
+ this.styleObj.x = this.styleObj.x + x - this.styleObj.pageX;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.getPageY()
+
+
+function nsxbStyleGetPageY()
+{
+ return this.styleObj.pageY;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.setPageY()
+
+function nsxbStyleSetPageY(y)
+{
+ this.styleObj.y = this.styleObj.y + y - this.styleObj.pageY;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.getHeight()
+
+function nsxbStyleGetHeight()
+{
+ //if (this.styleObj.document && this.styleObj.document.height)
+ // return this.styleObj.document.height;
+
+ return this.styleObj.clip.height;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.setHeight()
+
+function nsxbStyleSetHeight(height)
+{
+ this.styleObj.clip.height = height;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.getWidth()
+
+function nsxbStyleGetWidth()
+{
+ //if (this.styleObj.document && this.styleObj.document.width)
+ // return this.styleObj.document.width;
+
+ return this.styleObj.clip.width;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.setWidth()
+
+// netscape will not dynamically change the width of a
+// layer. It will only happen upon a refresh.
+function nsxbStyleSetWidth(width)
+{
+ this.styleObj.clip.width = width;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.getVisibility()
+
+function nsxbStyleGetVisibility()
+{
+ switch(this.styleObj.visibility)
+ {
+ case 'hide':
+ return 'hidden';
+ case 'show':
+ return 'visible';
+ }
+ return '';
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.setVisibility()
+
+function nsxbStyleSetVisibility(visibility)
+{
+ switch(visibility)
+ {
+ case 'hidden':
+ visibility = 'hide';
+ break;
+ case 'visible':
+ visibility = 'show';
+ break;
+ case 'inherit':
+ break;
+ default:
+ visibility = 'show';
+ break;
+ }
+ this.styleObj.visibility = visibility;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.getzIndex()
+
+function nsxbStyleGetzIndex()
+{
+ return this.styleObj.zIndex;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.setzIndex()
+
+function nsxbStyleSetzIndex(zIndex)
+{
+ this.styleObj.zIndex = zIndex;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.getBackgroundColor()
+
+function nsxbStyleGetBackgroundColor()
+{
+ return this.styleObj.bgColor;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.setBackgroundColor()
+
+function nsxbStyleSetBackgroundColor(color)
+{
+ if (color)
+ {
+ this.styleObj.bgColor = color;
+ this.object.document.bgColor = color;
+ this.resizeTo(this.getWidth(), this.getHeight());
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.getColor()
+
+function nsxbStyleGetColor()
+{
+ return '#ffffff';
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.setColor()
+
+function nsxbStyleSetColor(color)
+{
+ this.object.document.fgColor = color;
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.moveAbove()
+
+function xbStyleMoveAbove(cont)
+{
+ this.setzIndex(cont.getzIndex()+1);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.moveBelow()
+
+function xbStyleMoveBelow(cont)
+{
+ var zindex = cont.getzIndex() - 1;
+
+ this.setzIndex(zindex);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.moveBy()
+
+function xbStyleMoveBy(deltaX, deltaY)
+{
+ this.moveTo(this.getLeft() + deltaX, this.getTop() + deltaY);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.moveTo()
+
+function xbStyleMoveTo(x, y)
+{
+ this.setLeft(x);
+ this.setTop(y);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.moveToAbsolute()
+
+function xbStyleMoveToAbsolute(x, y)
+{
+ this.setPageX(x);
+ this.setPageY(y);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.resizeBy()
+
+function xbStyleResizeBy(deltaX, deltaY)
+{
+ this.setWidth( this.getWidth() + deltaX );
+ this.setHeight( this.getHeight() + deltaY );
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.resizeTo()
+
+function xbStyleResizeTo(x, y)
+{
+ this.setWidth(x);
+ this.setHeight(y);
+}
+
+////////////////////////////////////////////////////////////////////////
+// Navigator 4.x resizing...
+
+function nsxbStyleOnresize()
+{
+ if (saveInnerWidth != xbGetWindowWidth() || saveInnerHeight != xbGetWindowHeight())
+ location.reload();
+
+ return false;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.setInnerHTML()
+
+function nsxbSetInnerHTML(str)
+{
+ this.object.document.open('text/html');
+ this.object.document.write(str);
+ this.object.document.close();
+}
+
+xbStyle.prototype.getClip = nsxbStyleGetClip;
+xbStyle.prototype.setClip = nsxbStyleSetClip;
+xbStyle.prototype.getClipTop = nsxbStyleGetClipTop;
+xbStyle.prototype.setClipTop = nsxbStyleSetClipTop;
+xbStyle.prototype.getClipRight = nsxbStyleGetClipRight;
+xbStyle.prototype.setClipRight = nsxbStyleSetClipRight;
+xbStyle.prototype.getClipBottom = nsxbStyleGetClipBottom;
+xbStyle.prototype.setClipBottom = nsxbStyleSetClipBottom;
+xbStyle.prototype.getClipLeft = nsxbStyleGetClipLeft;
+xbStyle.prototype.setClipLeft = nsxbStyleSetClipLeft;
+xbStyle.prototype.getClipWidth = nsxbStyleGetClipWidth;
+xbStyle.prototype.setClipWidth = nsxbStyleSetClipWidth;
+xbStyle.prototype.getClipHeight = nsxbStyleGetClipHeight;
+xbStyle.prototype.setClipHeight = nsxbStyleSetClipHeight;
+xbStyle.prototype.getLeft = nsxbStyleGetLeft;
+xbStyle.prototype.setLeft = nsxbStyleSetLeft;
+xbStyle.prototype.getTop = nsxbStyleGetTop;
+xbStyle.prototype.setTop = nsxbStyleSetTop;
+xbStyle.prototype.getPageX = nsxbStyleGetPageX;
+xbStyle.prototype.setPageX = nsxbStyleSetPageX;
+xbStyle.prototype.getPageY = nsxbStyleGetPageY;
+xbStyle.prototype.setPageY = nsxbStyleSetPageY;
+xbStyle.prototype.getVisibility = nsxbStyleGetVisibility;
+xbStyle.prototype.setVisibility = nsxbStyleSetVisibility;
+xbStyle.prototype.getzIndex = nsxbStyleGetzIndex;
+xbStyle.prototype.setzIndex = nsxbStyleSetzIndex;
+xbStyle.prototype.getHeight = nsxbStyleGetHeight;
+xbStyle.prototype.setHeight = nsxbStyleSetHeight;
+xbStyle.prototype.getWidth = nsxbStyleGetWidth;
+xbStyle.prototype.setWidth = nsxbStyleSetWidth;
+xbStyle.prototype.getBackgroundColor = nsxbStyleGetBackgroundColor;
+xbStyle.prototype.setBackgroundColor = nsxbStyleSetBackgroundColor;
+xbStyle.prototype.getColor = nsxbStyleGetColor;
+xbStyle.prototype.setColor = nsxbStyleSetColor;
+xbStyle.prototype.setInnerHTML = nsxbSetInnerHTML;
+xbStyle.prototype.getBorderTopWidth = xbStyleNotSupported;
+xbStyle.prototype.getBorderRightWidth = xbStyleNotSupported;
+xbStyle.prototype.getBorderBottomWidth = xbStyleNotSupported;
+xbStyle.prototype.getBorderLeftWidth = xbStyleNotSupported;
+xbStyle.prototype.getMarginLeft = xbStyleNotSupported;
+xbStyle.prototype.getMarginTop = xbStyleNotSupported;
+xbStyle.prototype.getMarginRight = xbStyleNotSupported;
+xbStyle.prototype.getMarginBottom = xbStyleNotSupported;
+xbStyle.prototype.getMarginLeft = xbStyleNotSupported;
+xbStyle.prototype.getPaddingTop = xbStyleNotSupported;
+xbStyle.prototype.getPaddingRight = xbStyleNotSupported;
+xbStyle.prototype.getPaddingBottom = xbStyleNotSupported;
+xbStyle.prototype.getPaddingLeft = xbStyleNotSupported;
+xbStyle.prototype.getClientWidth = xbStyleNotSupported;
+xbStyle.prototype.getClientHeight = xbStyleNotSupported;
+
+window.saveInnerWidth = window.innerWidth;
+window.saveInnerHeight = window.innerHeight;
+
+window.onresize = nsxbStyleOnresize;
+
--- /dev/null
+/*
+ * xbStyle-not-supported.js
+ * $Revision: 1.2 $ $Date: 2003/02/07 16:04:22 $
+ */
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Netscape code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2001
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Bob Clary <bclary@netscape.com>
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+xbStyle.prototype.toString = xbStyleNotSupported;
+xbStyle.prototype.getClip = xbStyleNotSupported;
+xbStyle.prototype.setClip = xbStyleNotSupported;
+xbStyle.prototype.getClipTop = xbStyleNotSupported;
+xbStyle.prototype.setClipTop = xbStyleNotSupported;
+xbStyle.prototype.getClipRight = xbStyleNotSupported;
+xbStyle.prototype.setClipRight = xbStyleNotSupported;
+xbStyle.prototype.getClipBottom = xbStyleNotSupported;
+xbStyle.prototype.setClipBottom = xbStyleNotSupported;
+xbStyle.prototype.getClipLeft = xbStyleNotSupported;
+xbStyle.prototype.setClipLeft = xbStyleNotSupported;
+xbStyle.prototype.getClipWidth = xbStyleNotSupported;
+xbStyle.prototype.setClipWidth = xbStyleNotSupported;
+xbStyle.prototype.getClipHeight = xbStyleNotSupported;
+xbStyle.prototype.setClipHeight = xbStyleNotSupported;
+xbStyle.prototype.getLeft = xbStyleNotSupported;
+xbStyle.prototype.setLeft = xbStyleNotSupported;
+xbStyle.prototype.getTop = xbStyleNotSupported;
+xbStyle.prototype.setTop = xbStyleNotSupported;
+xbStyle.prototype.getVisibility = xbStyleNotSupported;
+xbStyle.prototype.setVisibility = xbStyleNotSupported;
+xbStyle.prototype.getzIndex = xbStyleNotSupported;
+xbStyle.prototype.setzIndex = xbStyleNotSupported;
+xbStyle.prototype.getHeight = xbStyleNotSupported;
+xbStyle.prototype.setHeight = xbStyleNotSupported;
+xbStyle.prototype.getWidth = xbStyleNotSupported;
+xbStyle.prototype.setWidth = xbStyleNotSupported;
+xbStyle.prototype.getBackgroundColor = xbStyleNotSupported;
+xbStyle.prototype.setBackgroundColor = xbStyleNotSupported;
+xbStyle.prototype.getColor = xbStyleNotSupported;
+xbStyle.prototype.setColor = xbStyleNotSupported;
+xbStyle.prototype.setInnerHTML = xbStyleNotSupported;
+xbStyle.prototype.getBorderTopWidth = xbStyleNotSupported;
+xbStyle.prototype.getBorderRightWidth = xbStyleNotSupported;
+xbStyle.prototype.getBorderBottomWidth = xbStyleNotSupported;
+xbStyle.prototype.getBorderLeftWidth = xbStyleNotSupported;
+xbStyle.prototype.getMarginLeft = xbStyleNotSupported;
+xbStyle.prototype.getMarginTop = xbStyleNotSupported;
+xbStyle.prototype.getMarginRight = xbStyleNotSupported;
+xbStyle.prototype.getMarginBottom = xbStyleNotSupported;
+xbStyle.prototype.getMarginLeft = xbStyleNotSupported;
+xbStyle.prototype.getPaddingTop = xbStyleNotSupported;
+xbStyle.prototype.getPaddingRight = xbStyleNotSupported;
+xbStyle.prototype.getPaddingBottom = xbStyleNotSupported;
+xbStyle.prototype.getPaddingLeft = xbStyleNotSupported;
+xbStyle.prototype.getClientWidth = xbStyleNotSupported;
+xbStyle.prototype.getClientHeight = xbStyleNotSupported;
+
-/*\r
-xbStyle.js Revision: 0.202 2002-02-11\r
-\r
-Contributor(s): Bob Clary, Original Work, Copyright 2000\r
- Bob Clary, Netscape Communications, Copyright 2001\r
-\r
-Netscape grants you a royalty free license to use, modify and \r
-distribute this software provided that this copyright notice \r
-appears on all copies. This software is provided "AS IS," \r
-without a warranty of any kind.\r
-\r
-Change Log:\r
-\r
-2001-07-19: bclary - fixed function cssStyleGetLeft() and cssStyleGetTop() to \r
- correctly handle the case where the initial style.left/style.top\r
- are not initialized. This fixes positioning for relatively positioned\r
- DIVS and as a result fixes behavior for ILAYERs exposed as relatively\r
- positioned divs.\r
-2001-10-02: bclary - added missing xbClipRect.getHeight/setHeight methods.\r
-\r
-2001-11-20: bclary - removed use of practical browser sniffer, \r
- added object sniffing, and limited support for opera\r
- note opera returns ints for HTMLElement.style.[left|top|height|width] etc.\r
-\r
-2002-02-11: v 0.201 bclary - with the help of Rob Johnston <rob_johnston@hotmail.com>\r
- found that the "if (document.getElementsByName)" test excluded\r
- IE4. Added a test for document.all to enable IE4 to fully use \r
- xbStyle.\r
-\r
-2002-03-12: v 0.202 Daniel Resare contributed a patch to cssStyleSetPage[X|Y]() which\r
- handles the case where the element has no parentNode.\r
-*/\r
-\r
-function xbStyleNotSupported() {}\r
-\r
-function xbStyleNotSupportStringValue(propname) { xbDEBUG.dump(propname + ' is not supported in this browser'); return '';};\r
-\r
-/////////////////////////////////////////////////////////////\r
-// xbClipRect\r
-\r
-function xbClipRect(a1, a2, a3, a4)\r
-{\r
- this.top = 0;\r
- this.right = 0;\r
- this.bottom = 0;\r
- this.left = 0;\r
-\r
- if (typeof(a1) == 'string')\r
- {\r
- var val;\r
- var ca;\r
- var i;\r
- \r
- if (a1.indexOf('rect(') == 0)\r
- {\r
- // I would have preferred [0-9]+[a-zA-Z]+ for a regexp\r
- // but NN4 returns null for that. \r
- ca = a1.substring(5, a1.length-1).match(/-?[0-9a-zA-Z]+/g);\r
- for (i = 0; i < 4; ++i)\r
- {\r
- val = xbToInt(ca[i]);\r
- if (val != 0 && ca[i].indexOf('px') == -1)\r
- {\r
- xbDEBUG.dump('xbClipRect: A clipping region ' + a1 + ' was detected that did not use pixels as units. Click Ok to continue, Cancel to Abort');\r
- return;\r
- }\r
- ca[i] = val;\r
- }\r
- this.top = ca[0];\r
- this.right = ca[1];\r
- this.bottom = ca[2];\r
- this.left = ca[3];\r
- }\r
- } \r
- else if (typeof(a1) == 'number' && typeof(a2) == 'number' && typeof(a3) == 'number' && typeof(a4) == 'number')\r
- {\r
- this.top = a1;\r
- this.right = a2;\r
- this.bottom = a3;\r
- this.left = a4;\r
- }\r
-}\r
-\r
-xbClipRect.prototype.top = 0;\r
-xbClipRect.prototype.right = 0;\r
-xbClipRect.prototype.bottom = 0;\r
-xbClipRect.prototype.left = 0;\r
-\r
-\r
-function xbClipRectGetWidth()\r
-{\r
- return this.right - this.left;\r
-}\r
-xbClipRect.prototype.getWidth = xbClipRectGetWidth; \r
-\r
-function xbClipRectSetWidth(width)\r
-{\r
- this.right = this.left + width;\r
-}\r
-xbClipRect.prototype.setWidth = xbClipRectSetWidth;\r
-\r
-function xbClipRectGetHeight()\r
-{\r
- return this.bottom - this.top;\r
-}\r
-xbClipRect.prototype.getHeight = xbClipRectGetHeight; \r
-\r
-function xbClipRectSetHeight(height)\r
-{\r
- this.bottom = this.top + height;\r
-}\r
-xbClipRect.prototype.setHeight = xbClipRectSetHeight;\r
-\r
-function xbClipRectToString()\r
-{\r
- return 'rect(' + this.top + 'px ' + this.right + 'px ' + this.bottom + 'px ' + this.left + 'px )' ;\r
-}\r
-xbClipRect.prototype.toString = xbClipRectToString;\r
-\r
-/////////////////////////////////////////////////////////////\r
-// xbStyle\r
-//\r
-// Note Opera violates the standard by cascading the effective values\r
-// into the HTMLElement.style object. We can use IE's HTMLElement.currentStyle\r
-// to get the effective values. In Gecko we will use the W3 DOM Style Standard getComputedStyle\r
-\r
-function xbStyle(obj, position)\r
-{\r
- if (typeof(obj) == 'object' && typeof(obj.style) != 'undefined') \r
- this.styleObj = obj.style;\r
- else if (document.layers) // NN4\r
- {\r
- if (typeof(position) == 'undefined')\r
- position = '';\r
- \r
- this.styleObj = obj;\r
- this.styleObj.position = position;\r
- }\r
- this.object = obj;\r
-}\r
-\r
-xbStyle.prototype.styleObj = null;\r
-xbStyle.prototype.object = null;\r
-\r
-/////////////////////////////////////////////////////////////\r
-// xbStyle.getEffectiveValue()\r
-// note that xbStyle's constructor uses the currentStyle object \r
-// for IE5+ and that Opera's style object contains computed values\r
-// already. Netscape Navigator's layer object also contains the \r
-// computed values as well. Note that IE4 will not return the \r
-// computed values.\r
-\r
-function xbStyleGetEffectiveValue(propname)\r
-{\r
- var value = null;\r
-\r
- // W3/Gecko\r
- if (document.defaultView && document.defaultView.getComputedStyle)\r
- {\r
- if (navigator.family == 'gecko')\r
- {\r
- // xxxHack: work around Gecko getComputedStyle bugs...\r
- switch(propname)\r
- {\r
- case 'clip':\r
- return this.styleObj[propname];\r
- case 'top':\r
- if (navigator.family == 'gecko' && navigator.version < 0.96 && this.styleObj.position == 'relative')\r
- return this.object.offsetTop;\r
- case 'left':\r
- if (navigator.family == 'gecko' && navigator.version < 0.96 && this.styleObj.position == 'relative')\r
- return this.object.offsetLeft;\r
- }\r
- }\r
- // Note that propname is the name of the property in the CSS Style\r
- // Object. However the W3 method getPropertyValue takes the actual\r
- // property name from the CSS Style rule, i.e., propname is \r
- // 'backgroundColor' but getPropertyValue expects 'background-color'.\r
-\r
- var capIndex;\r
- var cappropname = propname;\r
- while ( (capIndex = cappropname.search(/[A-Z]/)) != -1)\r
- {\r
- if (capIndex != -1)\r
- cappropname = cappropname.substring(0, capIndex) + '-' + cappropname.substring(capIndex, capIndex).toLowerCase() + cappropname.substr(capIndex+1);\r
- }\r
-\r
- value = document.defaultView.getComputedStyle(this.object, '').getPropertyValue(cappropname);\r
-\r
- // xxxHack for Gecko:\r
- if (!value && this.styleObj[propname])\r
- value = this.styleObj[propname];\r
- }\r
- else if (typeof(this.styleObj[propname]) == 'undefined') \r
- value = xbStyleNotSupportStringValue(propname);\r
- else \r
- {\r
- if (navigator.family != 'ie4' || navigator.version < 5)\r
- {\r
- // IE4+, Opera, NN4\r
- value = this.styleObj[propname];\r
- }\r
- else\r
- {\r
- // IE5+\r
- value = this.object.currentStyle[propname];\r
- if (!value)\r
- value = this.styleObj[propname];\r
- }\r
- }\r
-\r
- return value;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////\r
-// xbStyle.getClip()\r
-\r
-function cssStyleGetClip()\r
-{\r
- var clip = this.getEffectiveValue('clip');\r
-\r
- // hack opera\r
- if (clip == 'rect()')\r
- clip = '';\r
-\r
- if (clip == '')\r
- clip = 'rect(0px ' + this.getWidth() + 'px ' + this.getHeight() + 'px 0px)';\r
-\r
- return clip;\r
-}\r
-\r
-function nsxbStyleGetClip()\r
-{\r
- var clip = this.styleObj.clip;\r
- var rect = new xbClipRect(clip.top, clip.right, clip.bottom, clip.left);\r
- return rect.toString();\r
-}\r
-\r
-/////////////////////////////////////////////////////////////\r
-// xbStyle.setClip()\r
-\r
-function cssStyleSetClip(sClipString)\r
-{\r
- this.styleObj.clip = sClipString;\r
-}\r
-\r
-function nsxbStyleSetClip(sClipString)\r
-{\r
- var rect = new xbClipRect(sClipString);\r
- this.styleObj.clip.top = rect.top;\r
- this.styleObj.clip.right = rect.right;\r
- this.styleObj.clip.bottom = rect.bottom;\r
- this.styleObj.clip.left = rect.left;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////\r
-// xbStyle.getClipTop()\r
-\r
-function cssStyleGetClipTop()\r
-{\r
- var clip = this.getClip()\r
- var rect = new xbClipRect(clip);\r
- return rect.top;\r
-}\r
-\r
-function nsxbStyleGetClipTop()\r
-{\r
- return this.styleObj.clip.top;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////\r
-// xbStyle.setClipTop()\r
-\r
-function cssStyleSetClipTop(top)\r
-{\r
- var clip = this.getClip();\r
- var rect = new xbClipRect(clip);\r
- rect.top = top;\r
- this.styleObj.clip = rect.toString();\r
-}\r
-\r
-function nsxbStyleSetClipTop(top)\r
-{\r
- return this.styleObj.clip.top = top;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////\r
-// xbStyle.getClipRight()\r
-\r
-function cssStyleGetClipRight()\r
-{\r
- var clip = this.getClip();\r
- var rect = new xbClipRect(clip);\r
- return rect.right;\r
-}\r
-\r
-function nsxbStyleGetClipRight()\r
-{\r
- return this.styleObj.clip.right;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////\r
-// xbStyle.setClipRight()\r
-\r
-function cssStyleSetClipRight(right)\r
-{\r
- var clip = this.getClip();\r
- var rect = new xbClipRect(clip);\r
- rect.right = right;\r
- this.styleObj.clip = rect.toString();\r
-}\r
-\r
-function nsxbStyleSetClipRight(right)\r
-{\r
- return this.styleObj.clip.right = right;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////\r
-// xbStyle.getClipBottom()\r
-\r
-function cssStyleGetClipBottom()\r
-{\r
- var clip = this.getClip();\r
- var rect = new xbClipRect(clip);\r
- return rect.bottom;\r
-}\r
-\r
-function nsxbStyleGetClipBottom()\r
-{\r
- return this.styleObj.clip.bottom;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////\r
-// xbStyle.setClipBottom()\r
-\r
-function cssStyleSetClipBottom(bottom)\r
-{\r
- var clip = this.getClip();\r
- var rect = new xbClipRect(clip);\r
- rect.bottom = bottom;\r
- this.styleObj.clip = rect.toString();\r
-}\r
-\r
-function nsxbStyleSetClipBottom(bottom)\r
-{\r
- return this.styleObj.clip.bottom = bottom;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////\r
-// xbStyle.getClipLeft()\r
-\r
-function cssStyleGetClipLeft()\r
-{\r
- var clip = this.getClip();\r
- var rect = new xbClipRect(clip);\r
- return rect.left;\r
-}\r
-\r
-function nsxbStyleGetClipLeft()\r
-{\r
- return this.styleObj.clip.left;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////\r
-// xbStyle.setClipLeft()\r
-\r
-function cssStyleSetClipLeft(left)\r
-{\r
- var clip = this.getClip();\r
- var rect = new xbClipRect(clip);\r
- rect.left = left;\r
- this.styleObj.clip = rect.toString();\r
-}\r
-\r
-function nsxbStyleSetClipLeft(left)\r
-{\r
- return this.styleObj.clip.left = left;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////\r
-// xbStyle.getClipWidth()\r
-\r
-function cssStyleGetClipWidth()\r
-{\r
- var clip = this.getClip();\r
- var rect = new xbClipRect(clip);\r
- return rect.getWidth();\r
-}\r
-\r
-function nsxbStyleGetClipWidth()\r
-{\r
- return this.styleObj.clip.width;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////\r
-// xbStyle.setClipWidth()\r
-\r
-function cssStyleSetClipWidth(width)\r
-{\r
- var clip = this.getClip();\r
- var rect = new xbClipRect(clip);\r
- rect.setWidth(width);\r
- this.styleObj.clip = rect.toString();\r
-}\r
-\r
-function nsxbStyleSetClipWidth(width)\r
-{\r
- return this.styleObj.clip.width = width;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////\r
-// xbStyle.getClipHeight()\r
-\r
-function cssStyleGetClipHeight()\r
-{\r
- var clip = this.getClip();\r
- var rect = new xbClipRect(clip);\r
- return rect.getHeight();\r
-}\r
-\r
-function nsxbStyleGetClipHeight()\r
-{\r
- return this.styleObj.clip.height;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////\r
-// xbStyle.setClipHeight()\r
-\r
-function cssStyleSetClipHeight(height)\r
-{\r
- var clip = this.getClip();\r
- var rect = new xbClipRect(clip);\r
- rect.setHeight(height);\r
- this.styleObj.clip = rect.toString();\r
-}\r
-\r
-function nsxbStyleSetClipHeight(height)\r
-{\r
- return this.styleObj.clip.height = height;\r
-}\r
-\r
-// the CSS attributes left,top are for absolutely positioned elements\r
-// measured relative to the containing element. for relatively positioned\r
-// elements, left,top are measured from the element's normal inline position.\r
-// getLeft(), setLeft() operate on this type of coordinate.\r
-//\r
-// to allow dynamic positioning the getOffsetXXX and setOffsetXXX methods are\r
-// defined to return and set the position of either an absolutely or relatively\r
-// positioned element relative to the containing element.\r
-//\r
-//\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getLeft()\r
-\r
-function cssStyleGetLeft()\r
-{\r
- var left = this.getEffectiveValue('left');\r
- if (typeof(left) == 'number')\r
- return left;\r
-\r
- if (left != '' && left.indexOf('px') == -1)\r
- {\r
- xbDEBUG.dump('xbStyle.getLeft: Element ID=' + this.object.id + ' does not use pixels as units. left=' + left + ' Click Ok to continue, Cancel to Abort');\r
- return 0;\r
- }\r
-\r
- if (left == '')\r
- left = this.styleObj.left = '0px';\r
- \r
- return xbToInt(left);\r
-}\r
-\r
-function nsxbStyleGetLeft()\r
-{\r
- return this.styleObj.left;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.setLeft()\r
-\r
-function cssStyleSetLeft(left)\r
-{\r
- if (typeof(this.styleObj.left) == 'number')\r
- this.styleObj.left = left;\r
- else\r
- this.styleObj.left = left + 'px';\r
-}\r
-\r
-function nsxbStyleSetLeft(left)\r
-{\r
- this.styleObj.left = left;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getTop()\r
-\r
-function cssStyleGetTop()\r
-{\r
- var top = this.getEffectiveValue('top');\r
- if (typeof(top) == 'number')\r
- return top;\r
-\r
- if (top != '' && top.indexOf('px') == -1)\r
- {\r
- xbDEBUG.dump('xbStyle.getTop: Element ID=' + this.object.id + ' does not use pixels as units. top=' + top + ' Click Ok to continue, Cancel to Abort');\r
- return 0;\r
- }\r
-\r
- if (top == '')\r
- top = this.styleObj.top = '0px';\r
- \r
- return xbToInt(top);\r
-}\r
-\r
-function nsxbStyleGetTop()\r
-{\r
- return this.styleObj.top;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.setTop()\r
-\r
-function cssStyleSetTop(top)\r
-{\r
- if (typeof(this.styleObj.top) == 'number')\r
- this.styleObj.top = top;\r
- else\r
- this.styleObj.top = top + 'px';\r
-}\r
-\r
-function nsxbStyleSetTop(top)\r
-{\r
- this.styleObj.top = top;\r
-}\r
-\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getPageX()\r
-\r
-function cssStyleGetPageX()\r
-{\r
- var x = 0;\r
- var elm = this.object;\r
- var elmstyle;\r
- var position;\r
- \r
- //xxxHack: Due to limitations in Gecko's (0.9.6) ability to determine the \r
- // effective position attribute , attempt to use offsetXXX\r
-\r
- if (typeof(elm.offsetLeft) == 'number')\r
- {\r
- while (elm)\r
- {\r
- x += elm.offsetLeft;\r
- elm = elm.offsetParent;\r
- }\r
- }\r
- else\r
- {\r
- while (elm)\r
- {\r
- if (elm.style)\r
- {\r
- elmstyle = new xbStyle(elm);\r
- position = elmstyle.getEffectiveValue('position');\r
- if (position != '' && position != 'static')\r
- x += elmstyle.getLeft();\r
- }\r
- elm = elm.parentNode;\r
- }\r
- }\r
- \r
- return x;\r
-}\r
-\r
-function nsxbStyleGetPageX()\r
-{\r
- return this.styleObj.pageX;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.setPageX()\r
-\r
-function cssStyleSetPageX(x)\r
-{\r
- var xParent = 0;\r
- var elm = this.object.parentNode;\r
- var elmstyle;\r
- var position;\r
- \r
- //xxxHack: Due to limitations in Gecko's (0.9.6) ability to determine the \r
- // effective position attribute , attempt to use offsetXXX\r
-\r
- if (elm && typeof(elm.offsetLeft) == 'number')\r
- {\r
- while (elm)\r
- {\r
- xParent += elm.offsetLeft;\r
- elm = elm.offsetParent;\r
- }\r
- }\r
- else\r
- {\r
- while (elm)\r
- {\r
- if (elm.style)\r
- {\r
- elmstyle = new xbStyle(elm);\r
- position = elmstyle.getEffectiveValue('position');\r
- if (position != '' && position != 'static')\r
- xParent += elmstyle.getLeft();\r
- }\r
- elm = elm.parentNode;\r
- }\r
- }\r
- \r
- x -= xParent;\r
-\r
- this.setLeft(x);\r
-}\r
- \r
-function nsxbStyleSetPageX(x)\r
-{\r
- this.styleObj.x = this.styleObj.x + x - this.styleObj.pageX;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getPageY()\r
-\r
-function cssStyleGetPageY()\r
-{\r
- var y = 0;\r
- var elm = this.object;\r
- var elmstyle;\r
- var position;\r
- \r
- //xxxHack: Due to limitations in Gecko's (0.9.6) ability to determine the \r
- // effective position attribute , attempt to use offsetXXX\r
-\r
- if (typeof(elm.offsetTop) == 'number')\r
- {\r
- while (elm)\r
- {\r
- y += elm.offsetTop;\r
- elm = elm.offsetParent;\r
- }\r
- }\r
- else\r
- {\r
- while (elm)\r
- {\r
- if (elm.style)\r
- {\r
- elmstyle = new xbStyle(elm);\r
- position = elmstyle.getEffectiveValue('position');\r
- if (position != '' && position != 'static')\r
- y += elmstyle.getTop();\r
- }\r
- elm = elm.parentNode;\r
- }\r
- }\r
- \r
- return y;\r
-}\r
-\r
-function nsxbStyleGetPageY()\r
-{\r
- return this.styleObj.pageY;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.setPageY()\r
-\r
-function cssStyleSetPageY(y)\r
-{\r
- var yParent = 0;\r
- var elm = this.object.parentNode;\r
- var elmstyle;\r
- var position;\r
- \r
- //xxxHack: Due to limitations in Gecko's (0.9.6) ability to determine the \r
- // effective position attribute , attempt to use offsetXXX\r
-\r
- if (elm && typeof(elm.offsetTop) == 'number')\r
- {\r
- while (elm)\r
- {\r
- yParent += elm.offsetTop;\r
- elm = elm.offsetParent;\r
- }\r
- }\r
- else\r
- {\r
- while (elm)\r
- {\r
- if (elm.style)\r
- {\r
- elmstyle = new xbStyle(elm);\r
- position = elmstyle.getEffectiveValue('position');\r
- if (position != '' && position != 'static')\r
- yParent += elmstyle.getTop();\r
- }\r
- elm = elm.parentNode;\r
- }\r
- }\r
- \r
- y -= yParent;\r
-\r
- this.setTop(y);\r
-}\r
- \r
-function nsxbStyleSetPageY(y)\r
-{\r
- this.styleObj.y = this.styleObj.y + y - this.styleObj.pageY;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getHeight()\r
-\r
-function cssStyleGetHeight()\r
-{\r
- var height = this.getEffectiveValue('height');\r
- if (typeof(height) == 'number')\r
- return height;\r
-\r
- if ((height == 'auto' || height.indexOf('%') != -1) && typeof(this.object.offsetHeight) == 'number')\r
- height = this.object.offsetHeight + 'px';\r
-\r
- if (height != '' && height != 'auto' && height.indexOf('px') == -1)\r
- {\r
- xbDEBUG.dump('xbStyle.getHeight: Element ID=' + this.object.id + ' does not use pixels as units. height=' + height + ' Click Ok to continue, Cancel to Abort');\r
- return 0;\r
- }\r
-\r
- height = xbToInt(height);\r
-\r
- return height;\r
-}\r
-\r
-function nsxbStyleGetHeight()\r
-{\r
- //if (this.styleObj.document && this.styleObj.document.height)\r
- // return this.styleObj.document.height;\r
- \r
- return this.styleObj.clip.height;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.setHeight()\r
-\r
-function cssStyleSetHeight(height)\r
-{\r
- if (typeof(this.styleObj.height) == 'number')\r
- this.styleObj.height = height;\r
- else\r
- this.styleObj.height = height + 'px';\r
-}\r
-\r
-function nsxbStyleSetHeight(height)\r
-{\r
- this.styleObj.clip.height = height;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getWidth()\r
-\r
-function cssStyleGetWidth()\r
-{\r
- var width = this.getEffectiveValue('width');\r
- if (typeof(width) == 'number')\r
- return width;\r
-\r
- if ((width == 'auto' || width.indexOf('%') != -1) && typeof(this.object.offsetWidth) == 'number')\r
- width = this.object.offsetWidth + 'px';\r
-\r
- if (width != '' && width != 'auto' && width.indexOf('px') == -1)\r
- {\r
- xbDEBUG.dump('xbStyle.getWidth: Element ID=' + this.object.id + ' does not use pixels as units. width=' + width + ' Click Ok to continue, Cancel to Abort');\r
- return 0;\r
- }\r
-\r
- width = xbToInt(width);\r
-\r
- return width;\r
-}\r
-\r
-function nsxbStyleGetWidth()\r
-{\r
- //if (this.styleObj.document && this.styleObj.document.width)\r
- // return this.styleObj.document.width;\r
- \r
- return this.styleObj.clip.width;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.setWidth()\r
-\r
-function cssStyleSetWidth(width)\r
-{\r
- if (typeof(this.styleObj.width) == 'number')\r
- this.styleObj.width = width;\r
- else\r
- this.styleObj.width = width + 'px';\r
-}\r
-\r
-// netscape will not dynamically change the width of a \r
-// layer. It will only happen upon a refresh.\r
-function nsxbStyleSetWidth(width)\r
-{\r
- this.styleObj.clip.width = width;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getVisibility()\r
-\r
-function cssStyleGetVisibility()\r
-{\r
- return this.getEffectiveValue('visibility');\r
-}\r
-\r
-function nsxbStyleGetVisibility()\r
-{\r
- switch(this.styleObj.visibility)\r
- {\r
- case 'hide':\r
- return 'hidden';\r
- case 'show':\r
- return 'visible';\r
- }\r
- return '';\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.setVisibility()\r
-\r
-function cssStyleSetVisibility(visibility)\r
-{\r
- this.styleObj.visibility = visibility;\r
-}\r
-\r
-function nsxbStyleSetVisibility(visibility)\r
-{\r
- switch(visibility)\r
- {\r
- case 'hidden':\r
- visibility = 'hide';\r
- break;\r
- case 'visible':\r
- visibility = 'show';\r
- break;\r
- case 'inherit':\r
- break;\r
- default:\r
- visibility = 'show';\r
- break;\r
- }\r
- this.styleObj.visibility = visibility;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getzIndex()\r
-\r
-function cssStyleGetzIndex()\r
-{\r
- return xbToInt(this.getEffectiveValue('zIndex'));\r
-}\r
-\r
-function nsxbStyleGetzIndex()\r
-{\r
- return this.styleObj.zIndex;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.setzIndex()\r
-\r
-function cssStyleSetzIndex(zIndex)\r
-{\r
- this.styleObj.zIndex = zIndex;\r
-}\r
-\r
-function nsxbStyleSetzIndex(zIndex)\r
-{\r
- this.styleObj.zIndex = zIndex;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getBackgroundColor()\r
-\r
-function cssStyleGetBackgroundColor()\r
-{\r
- return this.getEffectiveValue('backgroundColor');\r
-}\r
-\r
-function nsxbStyleGetBackgroundColor()\r
-{\r
- return this.styleObj.bgColor;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.setBackgroundColor()\r
-\r
-function cssStyleSetBackgroundColor(color)\r
-{\r
- this.styleObj.backgroundColor = color;\r
-}\r
-\r
-function nsxbStyleSetBackgroundColor(color)\r
-{\r
- if (color)\r
- {\r
- this.styleObj.bgColor = color;\r
- this.object.document.bgColor = color;\r
- this.resizeTo(this.getWidth(), this.getHeight());\r
- }\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getColor()\r
-\r
-function cssStyleGetColor()\r
-{\r
- return this.getEffectiveValue('color');\r
-}\r
-\r
-function nsxbStyleGetColor()\r
-{\r
- return '#ffffff';\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.setColor()\r
-\r
-function cssStyleSetColor(color)\r
-{\r
- this.styleObj.color = color;\r
-}\r
-\r
-function nsxbStyleSetColor(color)\r
-{\r
- this.object.document.fgColor = color;\r
-}\r
-\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.moveAbove()\r
-\r
-function xbStyleMoveAbove(cont)\r
-{\r
- this.setzIndex(cont.getzIndex()+1);\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.moveBelow()\r
-\r
-function xbStyleMoveBelow(cont)\r
-{\r
- var zindex = cont.getzIndex() - 1;\r
- \r
- this.setzIndex(zindex);\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.moveBy()\r
-\r
-function xbStyleMoveBy(deltaX, deltaY)\r
-{\r
- this.moveTo(this.getLeft() + deltaX, this.getTop() + deltaY);\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.moveTo()\r
-\r
-function xbStyleMoveTo(x, y)\r
-{\r
- this.setLeft(x);\r
- this.setTop(y);\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.moveToAbsolute()\r
-\r
-function xbStyleMoveToAbsolute(x, y)\r
-{\r
- this.setPageX(x);\r
- this.setPageY(y);\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.resizeBy()\r
-\r
-function xbStyleResizeBy(deltaX, deltaY)\r
-{\r
- this.setWidth( this.getWidth() + deltaX );\r
- this.setHeight( this.getHeight() + deltaY );\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.resizeTo()\r
-\r
-function xbStyleResizeTo(x, y)\r
-{\r
- this.setWidth(x);\r
- this.setHeight(y);\r
-}\r
-\r
-////////////////////////////////////////////////////////////////////////\r
-// Navigator 4.x resizing...\r
-\r
-function nsxbStyleOnresize()\r
-{\r
- if (saveInnerWidth != xbGetWindowWidth() || saveInnerHeight != xbGetWindowHeight())\r
- location.reload();\r
-\r
- return false;\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.setInnerHTML()\r
-\r
-function xbSetInnerHTML(str)\r
-{\r
- if (typeof(this.object.innerHTML) != 'undefined')\r
- this.object.innerHTML = str;\r
-}\r
-\r
-function nsxbSetInnerHTML(str)\r
-{\r
- this.object.document.open('text/html');\r
- this.object.document.write(str);\r
- this.object.document.close();\r
-}\r
-\r
-////////////////////////////////////////////////////////////////////////\r
-// Extensions to xbStyle that are not supported by Netscape Navigator 4\r
-// but that provide cross browser implementations of properties for \r
-// Mozilla, Gecko, Netscape 6.x and Opera\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getBorderTopWidth()\r
-\r
-function cssStyleGetBorderTopWidth()\r
-{\r
- return xbToInt(this.getEffectiveValue('borderTopWidth'));\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getBorderRightWidth()\r
-\r
-function cssStyleGetBorderRightWidth()\r
-{\r
- return xbToInt(this.getEffectiveValue('borderRightWidth'));\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getBorderBottomWidth()\r
-\r
-function cssStyleGetBorderBottomWidth()\r
-{\r
- return xbToInt(this.getEffectiveValue('borderLeftWidth'));\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getBorderLeftWidth()\r
-\r
-function cssStyleGetBorderLeftWidth()\r
-{\r
- return xbToInt(this.getEffectiveValue('borderLeftWidth'));\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getMarginTop()\r
-\r
-function cssStyleGetMarginTop()\r
-{\r
- return xbToInt(this.getEffectiveValue('marginTop'));\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getMarginRight()\r
-\r
-function cssStyleGetMarginRight()\r
-{\r
- return xbToInt(this.getEffectiveValue('marginRight'));\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getMarginBottom()\r
-\r
-function cssStyleGetMarginBottom()\r
-{\r
- return xbToInt(this.getEffectiveValue('marginBottom'));\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getMarginLeft()\r
-\r
-function cssStyleGetMarginLeft()\r
-{\r
- return xbToInt(this.getEffectiveValue('marginLeft'));\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getPaddingTop()\r
-\r
-function cssStyleGetPaddingTop()\r
-{\r
- return xbToInt(this.getEffectiveValue('paddingTop'));\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getPaddingRight()\r
-\r
-function cssStyleGetPaddingRight()\r
-{\r
- return xbToInt(this.getEffectiveValue('paddingRight'));\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getPaddingBottom()\r
-\r
-function cssStyleGetPaddingBottom()\r
-{\r
- return xbToInt(this.getEffectiveValue('paddingBottom'));\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getPaddingLeft()\r
-\r
-function cssStyleGetPaddingLeft()\r
-{\r
- return xbToInt(this.getEffectiveValue('paddingLeft'));\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getClientTop()\r
-\r
-function cssStyleGetClientTop()\r
-{\r
- return this.getTop() - this.getMarginTop() - this.getBorderTopWidth() - this.getPaddingTop();\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getClientLeft()\r
-\r
-function cssStyleGetClientLeft()\r
-{\r
- return this.getLeft() - this.getMarginLeft() - this.getBorderLeftWidth() - this.getPaddingLeft();\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getClientWidth()\r
-\r
-function cssStyleGetClientWidth()\r
-{\r
- return this.getMarginLeft() + this.getBorderLeftWidth() + this.getPaddingLeft() + this.getWidth() + this.getPaddingRight() + this.getBorderRightWidth() + this.getMarginRight();\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// xbStyle.getClientHeight()\r
-\r
-function cssStyleGetClientHeight()\r
-{\r
- return this.getMarginTop() + this.getBorderTopWidth() + this.getPaddingTop() + this.getHeight() + this.getPaddingBottom() + this.getBorderBottomWidth() + this.getMarginBottom();\r
-}\r
-\r
-////////////////////////////////////////////////////////////////////////\r
-\r
-xbStyle.prototype.getEffectiveValue = xbStyleGetEffectiveValue;\r
-xbStyle.prototype.moveAbove = xbStyleMoveAbove;\r
-xbStyle.prototype.moveBelow = xbStyleMoveBelow;\r
-xbStyle.prototype.moveBy = xbStyleMoveBy;\r
-xbStyle.prototype.moveTo = xbStyleMoveTo;\r
-xbStyle.prototype.moveToAbsolute = xbStyleMoveToAbsolute;\r
-xbStyle.prototype.resizeBy = xbStyleResizeBy;\r
-xbStyle.prototype.resizeTo = xbStyleResizeTo;\r
-\r
-if (document.all || document.getElementsByName)\r
-{\r
- xbStyle.prototype.getClip = cssStyleGetClip;\r
- xbStyle.prototype.setClip = cssStyleSetClip; \r
- xbStyle.prototype.getClipTop = cssStyleGetClipTop;\r
- xbStyle.prototype.setClipTop = cssStyleSetClipTop; \r
- xbStyle.prototype.getClipRight = cssStyleGetClipRight;\r
- xbStyle.prototype.setClipRight = cssStyleSetClipRight; \r
- xbStyle.prototype.getClipBottom = cssStyleGetClipBottom;\r
- xbStyle.prototype.setClipBottom = cssStyleSetClipBottom; \r
- xbStyle.prototype.getClipLeft = cssStyleGetClipLeft;\r
- xbStyle.prototype.setClipLeft = cssStyleSetClipLeft; \r
- xbStyle.prototype.getClipWidth = cssStyleGetClipWidth;\r
- xbStyle.prototype.setClipWidth = cssStyleSetClipWidth; \r
- xbStyle.prototype.getClipHeight = cssStyleGetClipHeight;\r
- xbStyle.prototype.setClipHeight = cssStyleSetClipHeight; \r
- xbStyle.prototype.getLeft = cssStyleGetLeft;\r
- xbStyle.prototype.setLeft = cssStyleSetLeft;\r
- xbStyle.prototype.getTop = cssStyleGetTop;\r
- xbStyle.prototype.setTop = cssStyleSetTop;\r
- xbStyle.prototype.getPageX = cssStyleGetPageX;\r
- xbStyle.prototype.setPageX = cssStyleSetPageX;\r
- xbStyle.prototype.getPageY = cssStyleGetPageY;\r
- xbStyle.prototype.setPageY = cssStyleSetPageY;\r
- xbStyle.prototype.getVisibility = cssStyleGetVisibility;\r
- xbStyle.prototype.setVisibility = cssStyleSetVisibility;\r
- xbStyle.prototype.getzIndex = cssStyleGetzIndex;\r
- xbStyle.prototype.setzIndex = cssStyleSetzIndex; \r
- xbStyle.prototype.getHeight = cssStyleGetHeight;\r
- xbStyle.prototype.setHeight = cssStyleSetHeight;\r
- xbStyle.prototype.getWidth = cssStyleGetWidth;\r
- xbStyle.prototype.setWidth = cssStyleSetWidth;\r
- xbStyle.prototype.getBackgroundColor = cssStyleGetBackgroundColor;\r
- xbStyle.prototype.setBackgroundColor = cssStyleSetBackgroundColor;\r
- xbStyle.prototype.getColor = cssStyleGetColor;\r
- xbStyle.prototype.setColor = cssStyleSetColor;\r
- xbStyle.prototype.setInnerHTML = xbSetInnerHTML;\r
- xbStyle.prototype.getBorderTopWidth = cssStyleGetBorderTopWidth;\r
- xbStyle.prototype.getBorderRightWidth = cssStyleGetBorderRightWidth;\r
- xbStyle.prototype.getBorderBottomWidth = cssStyleGetBorderBottomWidth;\r
- xbStyle.prototype.getBorderLeftWidth = cssStyleGetBorderLeftWidth;\r
- xbStyle.prototype.getMarginLeft = cssStyleGetMarginLeft;\r
- xbStyle.prototype.getMarginTop = cssStyleGetMarginTop;\r
- xbStyle.prototype.getMarginRight = cssStyleGetMarginRight;\r
- xbStyle.prototype.getMarginBottom = cssStyleGetMarginBottom;\r
- xbStyle.prototype.getMarginLeft = cssStyleGetMarginLeft;\r
- xbStyle.prototype.getPaddingTop = cssStyleGetPaddingTop;\r
- xbStyle.prototype.getPaddingRight = cssStyleGetPaddingRight;\r
- xbStyle.prototype.getPaddingBottom = cssStyleGetPaddingBottom;\r
- xbStyle.prototype.getPaddingLeft = cssStyleGetPaddingLeft;\r
- xbStyle.prototype.getClientTop = cssStyleGetClientTop;\r
- xbStyle.prototype.getClientLeft = cssStyleGetClientLeft;\r
- xbStyle.prototype.getClientWidth = cssStyleGetClientWidth;\r
- xbStyle.prototype.getClientHeight = cssStyleGetClientHeight;\r
-}\r
-else if (document.layers)\r
-{\r
- xbStyle.prototype.getClip = nsxbStyleGetClip;\r
- xbStyle.prototype.setClip = nsxbStyleSetClip; \r
- xbStyle.prototype.getClipTop = nsxbStyleGetClipTop;\r
- xbStyle.prototype.setClipTop = nsxbStyleSetClipTop; \r
- xbStyle.prototype.getClipRight = nsxbStyleGetClipRight;\r
- xbStyle.prototype.setClipRight = nsxbStyleSetClipRight; \r
- xbStyle.prototype.getClipBottom = nsxbStyleGetClipBottom;\r
- xbStyle.prototype.setClipBottom = nsxbStyleSetClipBottom; \r
- xbStyle.prototype.getClipLeft = nsxbStyleGetClipLeft;\r
- xbStyle.prototype.setClipLeft = nsxbStyleSetClipLeft; \r
- xbStyle.prototype.getClipWidth = nsxbStyleGetClipWidth;\r
- xbStyle.prototype.setClipWidth = nsxbStyleSetClipWidth; \r
- xbStyle.prototype.getClipHeight = nsxbStyleGetClipHeight;\r
- xbStyle.prototype.setClipHeight = nsxbStyleSetClipHeight; \r
- xbStyle.prototype.getLeft = nsxbStyleGetLeft;\r
- xbStyle.prototype.setLeft = nsxbStyleSetLeft;\r
- xbStyle.prototype.getTop = nsxbStyleGetTop;\r
- xbStyle.prototype.setTop = nsxbStyleSetTop;\r
- xbStyle.prototype.getPageX = nsxbStyleGetPageX;\r
- xbStyle.prototype.setPageX = nsxbStyleSetPageX;\r
- xbStyle.prototype.getPageY = nsxbStyleGetPageY;\r
- xbStyle.prototype.setPageY = nsxbStyleSetPageY;\r
- xbStyle.prototype.getVisibility = nsxbStyleGetVisibility;\r
- xbStyle.prototype.setVisibility = nsxbStyleSetVisibility;\r
- xbStyle.prototype.getzIndex = nsxbStyleGetzIndex;\r
- xbStyle.prototype.setzIndex = nsxbStyleSetzIndex; \r
- xbStyle.prototype.getHeight = nsxbStyleGetHeight;\r
- xbStyle.prototype.setHeight = nsxbStyleSetHeight;\r
- xbStyle.prototype.getWidth = nsxbStyleGetWidth;\r
- xbStyle.prototype.setWidth = nsxbStyleSetWidth;\r
- xbStyle.prototype.getBackgroundColor = nsxbStyleGetBackgroundColor;\r
- xbStyle.prototype.setBackgroundColor = nsxbStyleSetBackgroundColor;\r
- xbStyle.prototype.getColor = nsxbStyleGetColor;\r
- xbStyle.prototype.setColor = nsxbStyleSetColor;\r
- xbStyle.prototype.setInnerHTML = nsxbSetInnerHTML;\r
- xbStyle.prototype.getBorderTopWidth = xbStyleNotSupported;\r
- xbStyle.prototype.getBorderRightWidth = xbStyleNotSupported;\r
- xbStyle.prototype.getBorderBottomWidth = xbStyleNotSupported;\r
- xbStyle.prototype.getBorderLeftWidth = xbStyleNotSupported;\r
- xbStyle.prototype.getMarginLeft = xbStyleNotSupported;\r
- xbStyle.prototype.getMarginTop = xbStyleNotSupported;\r
- xbStyle.prototype.getMarginRight = xbStyleNotSupported;\r
- xbStyle.prototype.getMarginBottom = xbStyleNotSupported;\r
- xbStyle.prototype.getMarginLeft = xbStyleNotSupported;\r
- xbStyle.prototype.getPaddingTop = xbStyleNotSupported;\r
- xbStyle.prototype.getPaddingRight = xbStyleNotSupported;\r
- xbStyle.prototype.getPaddingBottom = xbStyleNotSupported;\r
- xbStyle.prototype.getPaddingLeft = xbStyleNotSupported;\r
- xbStyle.prototype.getClientTop = xbStyleNotSupported;\r
- xbStyle.prototype.getClientLeft = xbStyleNotSupported;\r
- xbStyle.prototype.getClientWidth = xbStyleNotSupported;\r
- xbStyle.prototype.getClientHeight = xbStyleNotSupported;\r
-\r
- window.saveInnerWidth = window.innerWidth;\r
- window.saveInnerHeight = window.innerHeight;\r
-\r
- window.onresize = nsxbStyleOnresize;\r
-\r
-}\r
-else \r
-{\r
- xbStyle.prototype.toString = xbStyleNotSupported;\r
- xbStyle.prototype.getClip = xbStyleNotSupported;\r
- xbStyle.prototype.setClip = xbStyleNotSupported;\r
- xbStyle.prototype.getClipTop = xbStyleNotSupported;\r
- xbStyle.prototype.setClipTop = xbStyleNotSupported;\r
- xbStyle.prototype.getClipRight = xbStyleNotSupported;\r
- xbStyle.prototype.setClipRight = xbStyleNotSupported;\r
- xbStyle.prototype.getClipBottom = xbStyleNotSupported;\r
- xbStyle.prototype.setClipBottom = xbStyleNotSupported;\r
- xbStyle.prototype.getClipLeft = xbStyleNotSupported;\r
- xbStyle.prototype.setClipLeft = xbStyleNotSupported;\r
- xbStyle.prototype.getClipWidth = xbStyleNotSupported;\r
- xbStyle.prototype.setClipWidth = xbStyleNotSupported;\r
- xbStyle.prototype.getClipHeight = xbStyleNotSupported;\r
- xbStyle.prototype.setClipHeight = xbStyleNotSupported;\r
- xbStyle.prototype.getLeft = xbStyleNotSupported;\r
- xbStyle.prototype.setLeft = xbStyleNotSupported;\r
- xbStyle.prototype.getTop = xbStyleNotSupported;\r
- xbStyle.prototype.setTop = xbStyleNotSupported;\r
- xbStyle.prototype.getVisibility = xbStyleNotSupported;\r
- xbStyle.prototype.setVisibility = xbStyleNotSupported;\r
- xbStyle.prototype.getzIndex = xbStyleNotSupported;\r
- xbStyle.prototype.setzIndex = xbStyleNotSupported;\r
- xbStyle.prototype.getHeight = xbStyleNotSupported;\r
- xbStyle.prototype.setHeight = xbStyleNotSupported;\r
- xbStyle.prototype.getWidth = xbStyleNotSupported;\r
- xbStyle.prototype.setWidth = xbStyleNotSupported;\r
- xbStyle.prototype.getBackgroundColor = xbStyleNotSupported;\r
- xbStyle.prototype.setBackgroundColor = xbStyleNotSupported;\r
- xbStyle.prototype.getColor = xbStyleNotSupported;\r
- xbStyle.prototype.setColor = xbStyleNotSupported;\r
- xbStyle.prototype.setInnerHTML = xbStyleNotSupported;\r
- xbStyle.prototype.getBorderTopWidth = xbStyleNotSupported;\r
- xbStyle.prototype.getBorderRightWidth = xbStyleNotSupported;\r
- xbStyle.prototype.getBorderBottomWidth = xbStyleNotSupported;\r
- xbStyle.prototype.getBorderLeftWidth = xbStyleNotSupported;\r
- xbStyle.prototype.getMarginLeft = xbStyleNotSupported;\r
- xbStyle.prototype.getMarginTop = xbStyleNotSupported;\r
- xbStyle.prototype.getMarginRight = xbStyleNotSupported;\r
- xbStyle.prototype.getMarginBottom = xbStyleNotSupported;\r
- xbStyle.prototype.getMarginLeft = xbStyleNotSupported;\r
- xbStyle.prototype.getPaddingTop = xbStyleNotSupported;\r
- xbStyle.prototype.getPaddingRight = xbStyleNotSupported;\r
- xbStyle.prototype.getPaddingBottom = xbStyleNotSupported;\r
- xbStyle.prototype.getPaddingLeft = xbStyleNotSupported;\r
- xbStyle.prototype.getClientTop = xbStyleNotSupported;\r
- xbStyle.prototype.getClientLeft = xbStyleNotSupported;\r
- xbStyle.prototype.getClientWidth = xbStyleNotSupported;\r
- xbStyle.prototype.getClientHeight = xbStyleNotSupported;\r
-}\r
-\r
-\r
+/*
+ * xbStyle.js
+ * $Revision: 1.2 $ $Date: 2003/02/07 16:04:22 $
+ */
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Netscape code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2001
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Bob Clary <bclary@netscape.com>
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+function xbStyleNotSupported() {}
+
+function xbStyleNotSupportStringValue(propname) { xbDEBUG.dump(propname + ' is not supported in this browser'); return '';};
+
+/////////////////////////////////////////////////////////////
+// xbClipRect
+
+function xbClipRect(a1, a2, a3, a4)
+{
+ this.top = 0;
+ this.right = 0;
+ this.bottom = 0;
+ this.left = 0;
+
+ if (typeof(a1) == 'string')
+ {
+ var val;
+ var ca;
+ var i;
+
+ if (a1.indexOf('rect(') == 0)
+ {
+ // I would have preferred [0-9]+[a-zA-Z]+ for a regexp
+ // but NN4 returns null for that.
+ ca = a1.substring(5, a1.length-1).match(/-?[0-9a-zA-Z]+/g);
+ for (i = 0; i < 4; ++i)
+ {
+ val = xbToInt(ca[i]);
+ if (val != 0 && ca[i].indexOf('px') == -1)
+ {
+ xbDEBUG.dump('xbClipRect: A clipping region ' + a1 + ' was detected that did not use pixels as units. Click Ok to continue, Cancel to Abort');
+ return;
+ }
+ ca[i] = val;
+ }
+ this.top = ca[0];
+ this.right = ca[1];
+ this.bottom = ca[2];
+ this.left = ca[3];
+ }
+ }
+ else if (typeof(a1) == 'number' && typeof(a2) == 'number' && typeof(a3) == 'number' && typeof(a4) == 'number')
+ {
+ this.top = a1;
+ this.right = a2;
+ this.bottom = a3;
+ this.left = a4;
+ }
+}
+
+xbClipRect.prototype.top = 0;
+xbClipRect.prototype.right = 0;
+xbClipRect.prototype.bottom = 0;
+xbClipRect.prototype.left = 0;
+
+
+function xbClipRectGetWidth()
+{
+ return this.right - this.left;
+}
+xbClipRect.prototype.getWidth = xbClipRectGetWidth;
+
+function xbClipRectSetWidth(width)
+{
+ this.right = this.left + width;
+}
+xbClipRect.prototype.setWidth = xbClipRectSetWidth;
+
+function xbClipRectGetHeight()
+{
+ return this.bottom - this.top;
+}
+xbClipRect.prototype.getHeight = xbClipRectGetHeight;
+
+function xbClipRectSetHeight(height)
+{
+ this.bottom = this.top + height;
+}
+xbClipRect.prototype.setHeight = xbClipRectSetHeight;
+
+function xbClipRectToString()
+{
+ return 'rect(' + this.top + 'px ' + this.right + 'px ' + this.bottom + 'px ' + this.left + 'px )' ;
+}
+xbClipRect.prototype.toString = xbClipRectToString;
+
+/////////////////////////////////////////////////////////////
+// xbStyle
+//
+// Note Opera violates the standard by cascading the effective values
+// into the HTMLElement.style object. We can use IE's HTMLElement.currentStyle
+// to get the effective values. In Gecko we will use the W3 DOM Style Standard getComputedStyle
+
+function xbStyle(obj, win, position)
+{
+ if (typeof(obj) == 'object' && typeof(obj.style) != 'undefined')
+ this.styleObj = obj.style;
+ else if (document.layers) // NN4
+ {
+ if (typeof(position) == 'undefined')
+ position = '';
+
+ this.styleObj = obj;
+ this.styleObj.position = position;
+ }
+ this.object = obj;
+ this.window = win ? win : window;
+}
+
+xbStyle.prototype.styleObj = null;
+xbStyle.prototype.object = null;
+
+/////////////////////////////////////////////////////////////
+// xbStyle.getEffectiveValue()
+// note that xbStyle's constructor uses the currentStyle object
+// for IE5+ and that Opera's style object contains computed values
+// already. Netscape Navigator's layer object also contains the
+// computed values as well. Note that IE4 will not return the
+// computed values.
+
+function xbStyleGetEffectiveValue(propname)
+{
+ var value = null;
+
+ if (this.window.document.defaultView && this.window.document.defaultView.getComputedStyle)
+ {
+ // W3
+ // Note that propname is the name of the property in the CSS Style
+ // Object. However the W3 method getPropertyValue takes the actual
+ // property name from the CSS Style rule, i.e., propname is
+ // 'backgroundColor' but getPropertyValue expects 'background-color'.
+
+ var capIndex;
+ var cappropname = propname;
+
+ while ( (capIndex = cappropname.search(/[A-Z]/)) != -1)
+ {
+ if (capIndex != -1)
+ {
+ cappropname = cappropname.substring(0, capIndex) + '-' + cappropname.substring(capIndex, capIndex+1).toLowerCase() + cappropname.substr(capIndex+1);
+ }
+ }
+
+ value = this.window.document.defaultView.getComputedStyle(this.object, '').getPropertyValue(cappropname);
+
+ // xxxHack for Gecko:
+ if (!value && this.styleObj[propname])
+ {
+ value = this.styleObj[propname];
+ }
+ }
+ else if (typeof(this.styleObj[propname]) == 'undefined')
+ {
+ value = xbStyleNotSupportStringValue(propname);
+ }
+ else if (typeof(this.object.currentStyle) != 'undefined')
+ {
+ // IE5+
+ value = this.object.currentStyle[propname];
+ if (!value)
+ {
+ value = this.styleObj[propname];
+ }
+
+ if (propname == 'clip' && !value)
+ {
+ // clip is not stored in IE5/6 handle separately
+ value = 'rect(' + this.object.currentStyle.clipTop + ', ' + this.object.currentStyle.clipRight + ', ' + this.object.currentStyle.clipBottom + ', ' + this.object.currentStyle.clipLeft + ')';
+ }
+ }
+ else
+ {
+ // IE4+, Opera, NN4
+ value = this.styleObj[propname];
+ }
+
+ return value;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.moveAbove()
+
+function xbStyleMoveAbove(cont)
+{
+ this.setzIndex(cont.getzIndex()+1);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.moveBelow()
+
+function xbStyleMoveBelow(cont)
+{
+ var zindex = cont.getzIndex() - 1;
+
+ this.setzIndex(zindex);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.moveBy()
+
+function xbStyleMoveBy(deltaX, deltaY)
+{
+ this.moveTo(this.getLeft() + deltaX, this.getTop() + deltaY);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.moveTo()
+
+function xbStyleMoveTo(x, y)
+{
+ this.setLeft(x);
+ this.setTop(y);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.moveToAbsolute()
+
+function xbStyleMoveToAbsolute(x, y)
+{
+ this.setPageX(x);
+ this.setPageY(y);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.resizeBy()
+
+function xbStyleResizeBy(deltaX, deltaY)
+{
+ this.setWidth( this.getWidth() + deltaX );
+ this.setHeight( this.getHeight() + deltaY );
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xbStyle.resizeTo()
+
+function xbStyleResizeTo(x, y)
+{
+ this.setWidth(x);
+ this.setHeight(y);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+xbStyle.prototype.getEffectiveValue = xbStyleGetEffectiveValue;
+xbStyle.prototype.moveAbove = xbStyleMoveAbove;
+xbStyle.prototype.moveBelow = xbStyleMoveBelow;
+xbStyle.prototype.moveBy = xbStyleMoveBy;
+xbStyle.prototype.moveTo = xbStyleMoveTo;
+xbStyle.prototype.moveToAbsolute = xbStyleMoveToAbsolute;
+xbStyle.prototype.resizeBy = xbStyleResizeBy;
+xbStyle.prototype.resizeTo = xbStyleResizeTo;
+
+if (document.all || document.getElementsByName)
+{
+ xblibrary.loadScript('xbStyle-css.js');
+}
+else if (document.layers)
+{
+ xblibrary.loadScript('xbStyle-nn4.js');
+}
+else
+{
+ xblibrary.loadScript('xbStyle-not-supported.js');
+}
+
+