var SamplesRegistry={init:function(callback){this.samplesDescUrl=this.getWebappBaseUrl()+"/samples.xml";this.showDeprecated=(window.location.href.indexOf("deprecated=true")>=0);this.noMenu=(window.location.href.indexOf("nomenu=true")>=0);var self=this;this.withRegistry(function(){if(!self.noMenu){self.buildTopNavigationMenu();} if(callback){callback();}});},getWebappBaseUrl:function(){return ERDAS.misc.conf("webapp.context.path");},withRegistry:function(callback){var reg=this.registry;var self=this;if(!reg){this.loadXML(this.samplesDescUrl,function(xmlDocument){self.registry=self.parseRegistryDescriptor(xmlDocument);if(callback){callback(self.registry);}});}else{if(callback){callback(reg);}}},buildTopNavigationMenu:function(){var self=this;this.withRegistry(function(registry){var menubarBody=document.createElement("div");var menubarHolder=document.createElement("div");menubarBody.className="bd";menubarHolder.className="yui-skin-sam yuimenubar yuimenubarnav";menubarHolder.appendChild(menubarBody);document.getElementById("links").appendChild(menubarHolder);var menubar=new YAHOO.widget.MenuBar(menubarHolder,{autosubmenudisplay:true,hidedelay:750,showdelay:50,lazyload:false,zIndex:2000});var i,n,curCat,j,k,curSample,menuitem,submenu,submenuData,url;var menuHolder,menuBody;for(i=0,n=registry.categories.length;i=0){callback(sample);}});});},parseRegistryDescriptor:function(xmlDocument){var categories=[];var curCategory;var i,n,xmlCategories=xmlDocument.getElementsByTagName("category");for(i=0,n=xmlCategories.length;iNo description provided"};},parseSampleDescriptor:function(sampleElement){var anchor=sampleElement.getElementsByTagName("anchor")[0].childNodes[0].nodeValue;var title=sampleElement.getElementsByTagName("title")[0].childNodes[0].nodeValue;var description=sampleElement.getElementsByTagName("description")[0].childNodes[0].nodeValue;var href=sampleElement.getElementsByTagName("href")[0].childNodes[0].nodeValue;var deprecated=sampleElement.getElementsByTagName("deprecated").length>0;var dynload=sampleElement.getElementsByTagName("dynload").length>0;return{"anchor":anchor,"title":title,"description":description,"href":href,"deprecated":deprecated,"dynamic":dynload};},loadXML:function(url,callback){var xmlReq;var stateChangeHandler=function(){if(xmlReq.readyState===4){if(xmlReq.responseXML&&xmlReq.responseXML.documentElement){callback(xmlReq.responseXML.documentElement);}else{callback(xmlReq);}}};if(typeof ActiveXObject!=="undefined"){xmlReq=new ActiveXObject("Msxml2.DOMDocument.3.0");xmlReq.async=true;xmlReq.onreadystatechange=stateChangeHandler;xmlReq.load(url);}else{if(typeof XMLHttpRequest!=='undefined'){xmlReq=new XMLHttpRequest();} if(xmlReq){xmlReq.onreadystatechange=stateChangeHandler;}else{alert("Cannot fetch document @ \""+url+"\": cannot use XMLHttpRequest (or equivalent)");return;} xmlReq.open("GET",url,true);xmlReq.send("");}}};