annotate interfaces/AB.js @ 2726:c74c698795a9

#163. Fixed
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Sat, 15 Apr 2017 12:05:31 +0100
parents 7b1dfb582637
children d999a8fc26ea
rev   line source
nickjillings@1341 1 // Once this is loaded and parsed, begin execution
nickjillings@1341 2 loadInterface();
nicholas@2691 3 /*globals window, interfaceContext, testState, Interface, audioEngineContext, console, document, specification, $, storage*/
nickjillings@1341 4 function loadInterface() {
nicholas@2538 5 // Get the dimensions of the screen available to the page
nicholas@2538 6 var width = window.innerWidth;
nicholas@2538 7 var height = window.innerHeight;
nicholas@2538 8 interfaceContext.insertPoint.innerHTML = ""; // Clear the current schema
nicholas@2538 9
nicholas@2538 10 // Custom comparator Object
nicholas@2538 11 Interface.prototype.comparator = null;
nicholas@2538 12
nicholas@2538 13 // The injection point into the HTML page
nicholas@2538 14 interfaceContext.insertPoint = document.getElementById("topLevelBody");
nicholas@2538 15 var testContent = document.createElement('div');
nicholas@2538 16 testContent.id = 'testContent';
nicholas@2538 17
nicholas@2538 18 // Create the top div for the Title element
nicholas@2538 19 var titleAttr = specification.title;
nicholas@2538 20 var title = document.createElement('div');
nicholas@2538 21 title.className = "title";
nicholas@2538 22 title.align = "center";
nicholas@2538 23 var titleSpan = document.createElement('span');
nicholas@2470 24 titleSpan.id = "test-title";
nicholas@2538 25
nicholas@2538 26 // Set title to that defined in XML, else set to default
nicholas@2691 27 if (titleAttr !== undefined) {
nicholas@2538 28 titleSpan.textContent = titleAttr;
nicholas@2538 29 } else {
nicholas@2538 30 titleSpan.textContent = 'Listening test';
nicholas@2538 31 }
nicholas@2538 32 // Insert the titleSpan element into the title div element.
nicholas@2538 33 title.appendChild(titleSpan);
nicholas@2538 34
nicholas@2538 35 var pagetitle = document.createElement('div');
nicholas@2538 36 pagetitle.className = "pageTitle";
nicholas@2538 37 pagetitle.align = "center";
nicholas@2691 38
nicholas@2691 39 titleSpan = document.createElement('span');
nicholas@2538 40 titleSpan.id = "pageTitle";
nicholas@2538 41 pagetitle.appendChild(titleSpan);
nicholas@2538 42
nicholas@2538 43 // Create Interface buttons!
nicholas@2538 44 var interfaceButtons = document.createElement('div');
nicholas@2538 45 interfaceButtons.id = 'interface-buttons';
nicholas@2538 46 interfaceButtons.style.height = '25px';
nicholas@2538 47
nicholas@2538 48 // Create playback start/stop points
nicholas@2538 49 var playback = document.createElement("button");
nicholas@2538 50 playback.innerHTML = 'Stop';
nicholas@2538 51 playback.id = 'playback-button';
nicholas@2538 52 playback.style.float = 'left';
nicholas@2538 53 // onclick function. Check if it is playing or not, call the correct function in the
nicholas@2538 54 // audioEngine, change the button text to reflect the next state.
nicholas@2538 55 playback.onclick = function () {
nicholas@2538 56 if (audioEngineContext.status == 1) {
nicholas@2538 57 audioEngineContext.stop();
nicholas@2538 58 this.innerHTML = 'Stop';
nickjillings@1341 59 var time = audioEngineContext.timer.getTestTime();
nickjillings@1341 60 console.log('Stopped at ' + time); // DEBUG/SAFETY
nicholas@2538 61 }
nicholas@2538 62 };
nicholas@2538 63 // Append the interface buttons into the interfaceButtons object.
nicholas@2538 64 interfaceButtons.appendChild(playback);
nicholas@2538 65
nicholas@2538 66 // Global parent for the comment boxes on the page
nicholas@2538 67 var feedbackHolder = document.createElement('div');
nicholas@2538 68 feedbackHolder.id = 'feedbackHolder';
nicholas@2538 69
nicholas@2396 70 // Create outside reference holder
nicholas@2396 71 var outsideRef = document.createElement("div");
nicholas@2396 72 outsideRef.id = "outside-reference-holder";
nicholas@2538 73
nicholas@2538 74 // Construct the AB Boxes
nicholas@2538 75 var boxes = document.createElement('div');
nicholas@2538 76 boxes.align = "center";
nicholas@2538 77 boxes.id = "box-holders";
nickjillings@1341 78 boxes.style.float = "left";
nicholas@2538 79
nicholas@2538 80 var submit = document.createElement('button');
nicholas@2538 81 submit.id = "submit";
nicholas@2538 82 submit.onclick = buttonSubmitClick;
nicholas@2538 83 submit.className = "big-button";
nicholas@2538 84 submit.textContent = "submit";
nicholas@2538 85 submit.style.position = "relative";
nicholas@2538 86 submit.style.left = (window.innerWidth - 250) / 2 + 'px';
nicholas@2538 87
nicholas@2538 88 feedbackHolder.appendChild(boxes);
nicholas@2538 89
nicholas@2475 90 // Create holder for comment boxes
nicholas@2475 91 var comments = document.createElement("div");
nicholas@2475 92 comments.id = "comment-box-holder";
nicholas@2538 93
nicholas@2538 94 // Inject into HTML
nicholas@2538 95 testContent.appendChild(title); // Insert the title
nicholas@2538 96 testContent.appendChild(pagetitle);
nicholas@2538 97 testContent.appendChild(interfaceButtons);
nicholas@2396 98 testContent.appendChild(outsideRef);
nicholas@2538 99 testContent.appendChild(feedbackHolder);
nicholas@2538 100 testContent.appendChild(submit);
nicholas@2475 101 testContent.appendChild(comments);
nicholas@2538 102 interfaceContext.insertPoint.appendChild(testContent);
nickjillings@1341 103
nicholas@2538 104 // Load the full interface
nicholas@2538 105 testState.initialise();
nicholas@2538 106 testState.advanceState();
nickjillings@1341 107 }
nickjillings@1341 108
nicholas@2538 109 function loadTest(audioHolderObject) {
nicholas@2538 110 var feedbackHolder = document.getElementById('feedbackHolder');
nicholas@2651 111 var interfaceObj = interfaceContext.getCombinedInterfaces(audioHolderObject);
nicholas@2538 112 if (interfaceObj.length > 1) {
nicholas@2538 113 console.log("WARNING - This interface only supports one <interface> node per page. Using first interface node");
nicholas@2538 114 }
nicholas@2538 115 interfaceObj = interfaceObj[0];
nicholas@2538 116
nicholas@2475 117 var commentHolder = document.getElementById('comment-box-holder');
nicholas@2475 118 commentHolder.innerHTML = "";
nicholas@2538 119
nicholas@2396 120 // Delete outside reference
nicholas@2538 121 var outsideReferenceHolder = document.getElementById("outside-reference-holder");
nicholas@2396 122 outsideReferenceHolder.innerHTML = "";
nicholas@2538 123
nicholas@2470 124 // Set the page title
nicholas@2470 125 if (typeof audioHolderObject.title == "string" && audioHolderObject.title.length > 0) {
nicholas@2691 126 document.getElementById("test-title").textContent = audioHolderObject.title;
nicholas@2470 127 }
nicholas@2538 128
nicholas@2691 129 if (interfaceObj.title !== null) {
nicholas@2538 130 document.getElementById("pageTitle").textContent = interfaceObj.title;
nicholas@2538 131 }
nicholas@2538 132
nicholas@2651 133 var interfaceOptions = interfaceObj.options;
nicholas@2394 134 // Clear the interfaceElements
nicholas@2394 135 {
nicholas@2394 136 var node = document.getElementById('playback-holder');
nicholas@2538 137 if (node) {
nicholas@2538 138 feedbackHolder.removeChild(node);
nicholas@2538 139 }
nicholas@2394 140 node = document.getElementById('page-count');
nicholas@2538 141 if (node) {
nicholas@2538 142 document.getElementById('interface-buttons').removeChild(node);
nicholas@2538 143 }
nicholas@2394 144 node = document.getElementById('master-volume-holder-float');
nicholas@2538 145 if (node) {
nicholas@2538 146 feedbackHolder.removeChild(node);
nicholas@2538 147 }
nicholas@2394 148 }
nicholas@2538 149
n@2407 150 // Populate the comparator object
nicholas@2538 151 interfaceContext.comparator = new comparator(audioHolderObject);
nicholas@2538 152
nicholas@2538 153 for (var option of interfaceOptions) {
nicholas@2538 154 if (option.type == "show") {
nicholas@2538 155 switch (option.name) {
nickjillings@1356 156 case "playhead":
nickjillings@1356 157 var playbackHolder = document.getElementById('playback-holder');
nicholas@2691 158 if (playbackHolder === null) {
nickjillings@1356 159 playbackHolder = document.createElement('div');
nicholas@2394 160 playbackHolder.id = 'playback-holder';
nickjillings@1356 161 playbackHolder.style.width = "100%";
nickjillings@1356 162 playbackHolder.style.float = "left";
nickjillings@1356 163 playbackHolder.align = 'center';
nickjillings@1356 164 playbackHolder.appendChild(interfaceContext.playhead.object);
nickjillings@1356 165 feedbackHolder.appendChild(playbackHolder);
nickjillings@1356 166 }
nickjillings@1356 167 break;
nickjillings@1356 168 case "page-count":
nickjillings@1356 169 var pagecountHolder = document.getElementById('page-count');
nicholas@2691 170 if (pagecountHolder === null) {
nickjillings@1356 171 pagecountHolder = document.createElement('div');
nickjillings@1356 172 pagecountHolder.id = 'page-count';
nicholas@2393 173 document.getElementById('interface-buttons').appendChild(pagecountHolder);
nickjillings@1356 174 }
nicholas@2538 175 pagecountHolder.innerHTML = '<span>Page ' + (testState.stateIndex + 1) + ' of ' + testState.stateMap.length + '</span>';
nickjillings@1356 176 break;
nickjillings@1356 177 case "volume":
nicholas@2691 178 if (document.getElementById('master-volume-holder-float') === null) {
nickjillings@1356 179 feedbackHolder.appendChild(interfaceContext.volume.object);
nickjillings@1356 180 }
nickjillings@1356 181 break;
n@2407 182 case "comments":
n@2407 183 // Generate one comment box per presented page
nicholas@2538 184 for (var element of audioEngineContext.audioObjects) {
n@2407 185 interfaceContext.commentBoxes.createCommentBox(element);
n@2407 186 }
nicholas@2538 187 interfaceContext.commentBoxes.showCommentBoxes(commentHolder, true);
n@2407 188 break;
nickjillings@1356 189 }
nickjillings@1356 190 }
nickjillings@1356 191 }
nicholas@2538 192
nicholas@2538 193 $(audioHolderObject.commentQuestions).each(function (index, element) {
nicholas@2538 194 var node = interfaceContext.createCommentQuestion(element);
nicholas@2538 195 commentHolder.appendChild(node.holder);
nicholas@2538 196 });
nicholas@2538 197
nicholas@2538 198 resizeWindow(null);
nickjillings@1341 199 }
nickjillings@1341 200
nicholas@2538 201 function comparator(audioHolderObject) {
nicholas@2538 202 this.comparatorBox = function (audioElement, id, text) {
nicholas@2538 203 this.parent = audioElement;
nicholas@2538 204 this.id = id;
nicholas@2538 205 this.value = 0;
nicholas@2538 206 this.disabled = true;
nicholas@2538 207 this.box = document.createElement('div');
nicholas@2538 208 this.box.className = 'comparator-holder';
nicholas@2538 209 this.box.setAttribute('track-id', audioElement.id);
nicholas@2538 210 this.box.id = 'comparator-' + text;
nicholas@2538 211 this.selector = document.createElement('div');
nicholas@2538 212 this.selector.className = 'comparator-selector disabled';
nicholas@2538 213 var selectorText = document.createElement('span');
nicholas@2538 214 selectorText.textContent = text;
nicholas@2538 215 this.selector.appendChild(selectorText);
nicholas@2538 216 this.playback = document.createElement('button');
nicholas@2538 217 this.playback.className = 'comparator-button';
nicholas@2538 218 this.playback.disabled = true;
nicholas@2538 219 this.playback.textContent = "Listen";
nicholas@2538 220 this.box.appendChild(this.selector);
nicholas@2538 221 this.box.appendChild(this.playback);
nicholas@2691 222 this.selectorClicked = function () {
nicholas@2691 223 var i;
nicholas@2538 224 var time = audioEngineContext.timer.getTestTime();
nicholas@2691 225 if (this.parent.state !== 1) {
nicholas@2691 226 interfaceContext.lightbox.post("Message", "Please wait for the sample to load");
nicholas@2538 227 console.log("Please wait until sample has loaded");
nicholas@2538 228 return;
nickjillings@2112 229 }
nicholas@2691 230 if (audioEngineContext.status === 0) {
nicholas@2538 231 interfaceContext.lightbox.post("Message", "Please listen to the samples before making a selection");
nicholas@2538 232 console.log("Please listen to the samples before making a selection");
nicholas@2538 233 return;
nicholas@2538 234 }
nicholas@2691 235 interfaceContext.comparator.selected = this.id;
nicholas@2691 236 $(".comparator-selector").removeClass('selected');
nicholas@2691 237 $(this.selector).addClass('selected');
nicholas@2691 238 this.comparator.comparators.forEach(function (a) {
nicholas@2691 239 if (a !== this) {
nicholas@2691 240 a.value = 0;
nicholas@2691 241 } else {
nicholas@2691 242 a.value = 1;
nickjillings@2112 243 }
nicholas@2693 244 a.parent.metric.moved(time, a.value);
nicholas@2691 245 }, this);
nicholas@2691 246 console.log("Selected " + this.id + ' (' + time + ')');
nicholas@2538 247 };
nicholas@2538 248 this.playback.setAttribute("playstate", "ready");
nicholas@2691 249 this.playbackClicked = function () {
n@2694 250 if (this.playback.getAttribute("playstate") == "ready") {
nicholas@2691 251 audioEngineContext.play(this.id);
n@2694 252 } else if (this.playback.getAttribute("playstate") == "playing") {
nickjillings@1376 253 audioEngineContext.stop();
nickjillings@1376 254 }
nicholas@2538 255
nicholas@2538 256 };
nicholas@2691 257 this.handleEvent = function (event) {
nicholas@2691 258 if (event.currentTarget === this.selector) {
nicholas@2691 259 this.selectorClicked();
nicholas@2691 260 } else if (event.currentTarget === this.playback) {
nicholas@2691 261 this.playbackClicked();
nicholas@2691 262 }
nicholas@2691 263 }
nicholas@2691 264 this.playback.addEventListener("click", this);
nicholas@2691 265 this.selector.addEventListener("click", this);
nicholas@2538 266
nicholas@2538 267 this.enable = function () {
nicholas@2538 268 if (this.parent.state == 1) {
nicholas@2538 269 $(this.selector).removeClass('disabled');
nicholas@2538 270 this.playback.disabled = false;
nicholas@2538 271 }
nicholas@2538 272 };
nicholas@2538 273 this.updateLoading = function (progress) {
nicholas@2538 274 if (progress != 100) {
nicholas@2538 275 progress = String(progress);
nicholas@2538 276 progress = progress.split('.')[0];
nicholas@2538 277 this.playback.textContent = progress + '%';
nicholas@2538 278 } else {
nicholas@2538 279 this.playback.textContent = "Play";
nicholas@2538 280 }
nicholas@2538 281 };
nicholas@2538 282 this.error = function () {
nickjillings@2113 283 // audioObject has an error!!
nickjillings@2113 284 this.playback.textContent = "Error";
nickjillings@2113 285 $(this.playback).addClass("error-colour");
nicholas@2691 286 };
nicholas@2538 287 this.startPlayback = function () {
n@2426 288 if (this.parent.specification.parent.playOne || specification.playOne) {
n@2426 289 $('.comparator-button').text('Wait');
nicholas@2538 290 $('.comparator-button').attr("disabled", "true");
nicholas@2576 291 $(this.playback).css("disabled", "false");
n@2426 292 } else {
n@2426 293 $('.comparator-button').text('Listen');
n@2426 294 }
nickjillings@1376 295 $(this.playback).text('Stop');
nicholas@2538 296 this.playback.setAttribute("playstate", "playing");
nicholas@2726 297 interfaceContext.commentBoxes.highlightById(audioElement.id);
nickjillings@1360 298 };
nicholas@2538 299 this.stopPlayback = function () {
n@2426 300 if (this.playback.getAttribute("playstate") == "playing") {
n@2426 301 $('.comparator-button').text('Listen');
n@2426 302 $('.comparator-button').removeAttr("disabled");
nicholas@2538 303 this.playback.setAttribute("playstate", "ready");
n@2426 304 }
nicholas@2726 305 var box = interfaceContext.commentBoxes.boxes.find(function (a) {
nicholas@2726 306 return a.id === audioElement.id;
nicholas@2726 307 });
nicholas@2726 308 if (box) {
nicholas@2726 309 box.highlight(false);
nicholas@2726 310 }
nickjillings@1360 311 };
nicholas@2538 312 this.exportXMLDOM = function (audioObject) {
nicholas@2538 313 var node = storage.document.createElement('value');
nicholas@2538 314 node.textContent = this.value;
nicholas@2538 315 return node;
nicholas@2538 316 };
nicholas@2538 317 this.getValue = function () {
nicholas@2538 318 return this.value;
nicholas@2538 319 };
nicholas@2538 320 this.getPresentedId = function () {
nicholas@2538 321 return this.selector.children[0].textContent;
nicholas@2538 322 };
nicholas@2538 323 this.canMove = function () {
nicholas@2538 324 return false;
nicholas@2538 325 };
nicholas@2538 326 };
nicholas@2538 327
nicholas@2538 328 this.boxHolders = document.getElementById('box-holders');
nicholas@2538 329 this.boxHolders.innerHTML = "";
nicholas@2538 330 this.comparators = [];
nicholas@2538 331 this.selected = null;
nicholas@2538 332
nicholas@2607 333 var labelType = audioHolderObject.label;
nicholas@2607 334 if (labelType == "default") {
nicholas@2607 335 labelType = "capital";
nicholas@2607 336 }
nicholas@2607 337
nicholas@2538 338 // First generate the Audio Objects for the Audio Engine
nicholas@2538 339 for (var index = 0; index < audioHolderObject.audioElements.length; index++) {
nicholas@2538 340 var element = audioHolderObject.audioElements[index];
nickjillings@2177 341 var audioObject = audioEngineContext.newTrack(element);
nicholas@2538 342 if (index == audioHolderObject.outsideReference || element.type == 'outside-reference') {
nicholas@2538 343 var orNode = new interfaceContext.outsideReferenceDOM(audioObject, index, document.getElementById("outside-reference-holder"));
nicholas@2538 344 audioObject.bindInterface(orNode);
nickjillings@2177 345 } else {
nicholas@2663 346 var label = element.label;
nicholas@2663 347 if (label === "") {
nicholas@2663 348 label = interfaceContext.getLabel(labelType, index, audioHolderObject.labelStart);
nicholas@2663 349 }
nicholas@2538 350 var node = new this.comparatorBox(audioObject, index, label);
nicholas@2691 351 Object.defineProperties(node, {
nicholas@2691 352 'comparator': {
nicholas@2691 353 'value': this
nicholas@2691 354 }
nicholas@2691 355 });
nickjillings@2177 356 audioObject.bindInterface(node);
nickjillings@2177 357 this.comparators.push(node);
nickjillings@2177 358 this.boxHolders.appendChild(node.box);
nickjillings@1295 359 }
nicholas@2538 360 }
nicholas@2538 361 return this;
nickjillings@1341 362 }
nickjillings@1341 363
nicholas@2538 364 function resizeWindow(event) {
nicholas@2538 365 document.getElementById('submit').style.left = (window.innerWidth - 250) / 2 + 'px';
nicholas@2538 366 var numObj = interfaceContext.comparator.comparators.length;
nicholas@2538 367 var boxW = numObj * 312;
nickjillings@1341 368 var diff = window.innerWidth - boxW;
nicholas@2538 369 while (diff < 0) {
nicholas@2538 370 numObj = Math.ceil(numObj / 2);
nicholas@2538 371 boxW = numObj * 312;
nickjillings@1341 372 diff = window.innerWidth - boxW;
nickjillings@1341 373 }
nicholas@2538 374 document.getElementById('box-holders').style.marginLeft = diff / 2 + 'px';
nicholas@2538 375 document.getElementById('box-holders').style.marginRight = diff / 2 + 'px';
nickjillings@1341 376 document.getElementById('box-holders').style.width = boxW + 'px';
nicholas@2538 377
nickjillings@2177 378 var outsideRef = document.getElementById('outside-reference');
nicholas@2691 379 if (outsideRef !== null) {
nicholas@2538 380 outsideRef.style.left = (window.innerWidth - 120) / 2 + 'px';
nicholas@2538 381 }
nickjillings@1341 382 }
nickjillings@1341 383
nicholas@2538 384 function buttonSubmitClick() {
nicholas@2651 385 var checks = testState.currentStateMap.interfaces[0].options,
nicholas@2651 386 canContinue = true;
nickjillings@1341 387
nicholas@2538 388 for (var i = 0; i < checks.length; i++) {
nicholas@2538 389 if (checks[i].type == 'check') {
nicholas@2691 390 var checkState;
nicholas@2538 391 switch (checks[i].name) {
nicholas@2538 392 case 'fragmentPlayed':
nicholas@2538 393 // Check if all fragments have been played
nicholas@2691 394 checkState = interfaceContext.checkAllPlayed();
nicholas@2691 395 if (checkState === false) {
nicholas@2538 396 canContinue = false;
nicholas@2538 397 }
nicholas@2538 398 break;
nicholas@2538 399 case 'fragmentFullPlayback':
nicholas@2538 400 // Check all fragments have been played to their full length
nicholas@2691 401 checkState = interfaceContext.checkFragmentsFullyPlayed();
nicholas@2691 402 if (checkState === false) {
nicholas@2538 403 canContinue = false;
nicholas@2538 404 }
nicholas@2538 405 break;
nicholas@2538 406 case 'fragmentMoved':
nicholas@2538 407 // Check all fragment sliders have been moved.
nicholas@2691 408 checkState = interfaceContext.checkAllMoved();
nicholas@2691 409 if (checkState === false) {
nicholas@2538 410 canContinue = false;
nicholas@2538 411 }
nicholas@2538 412 break;
nicholas@2538 413 case 'fragmentComments':
nicholas@2538 414 // Check all fragment sliders have been moved.
nicholas@2691 415 checkState = interfaceContext.checkAllCommented();
nicholas@2691 416 if (checkState === false) {
nicholas@2538 417 canContinue = false;
nicholas@2538 418 }
nicholas@2538 419 break;
nicholas@2538 420 case 'scalerange':
nicholas@2538 421 // Check the scale has been used effectively
nicholas@2703 422 console.log("WARNING - Check 'scalerange' does not make sense in AB/ABX! Ignoring!");
nicholas@2538 423 break;
nicholas@2538 424 default:
nicholas@2538 425 console.log("WARNING - Check option " + checks[i].check + " is not supported on this interface");
nicholas@2538 426 break;
nicholas@2538 427 }
nicholas@2538 428
nicholas@2538 429 }
nicholas@2538 430 if (!canContinue) {
nicholas@2538 431 break;
nicholas@2538 432 }
nicholas@2538 433 }
nicholas@2538 434 if (canContinue) {
nicholas@2538 435 if (audioEngineContext.status == 1) {
nicholas@2538 436 var playback = document.getElementById('playback-button');
nicholas@2538 437 playback.click();
nicholas@2538 438 // This function is called when the submit button is clicked. Will check for any further tests to perform, or any post-test options
nicholas@2538 439 } else {
nicholas@2691 440 if (audioEngineContext.timer.testStarted === false) {
nicholas@2538 441 interfaceContext.lightbox.post("Warning", 'You have not started the test! Please click play on a sample to begin the test!');
nicholas@2538 442 return;
nicholas@2538 443 }
nicholas@2538 444 }
nicholas@2538 445 testState.advanceState();
nicholas@2538 446 }
nickjillings@1341 447 }
nickjillings@1341 448
nicholas@2538 449 function pageXMLSave(store, pageSpecification) {
nicholas@2538 450 // MANDATORY
nicholas@2538 451 // Saves a specific test page
nicholas@2538 452 // You can use this space to add any extra nodes to your XML <audioHolder> saves
nicholas@2538 453 // Get the current <page> information in store (remember to appendChild your data to it)
nicholas@2538 454 // pageSpecification is the current page node configuration
nicholas@2538 455 // To create new XML nodes, use storage.document.createElement();
nicholas@2538 456 }