InitThisDepth = true; // If this is being called from outside the reference module or new author team, init everything if (REFindNoCase("ReferenceModule",cgi.http_referer,1) eq 0 And REFindNoCase("NewAuthorTeam",cgi.http_referer,1) eq 0) { Session.RefModule = ArrayNew(1); depth = 1; // distinguish between bibliographic and nomenclatural mode Session.RefModuleMode = "bib"; // default Session.RefModuleModeText = "bibliographic reference"; if (Session.CallingPage eq "UpdateNomRef" or Session.CallingPage eq "AddNomRef") { Session.RefModuleMode = "nom"; Session.RefModuleModeText = "nomenclatural reference"; } } else { if (isdefined("URL.depth")) { depth = URL.depth; } else { depth = 1; } // does this level of depth already exist? if (ArrayLen(Session.RefModule) gte depth) { // erase all greater depths for (i eq depth + 1; i lte ArrayLen(Session.RefModule); i=i+1) { ArrayDeleteAt(Session.RefModule, i); } if (Session.RefModule[depth].ThisPage eq ThisPage) { // we've already been here with this page - keep old values InitThisDepth = false; } } } if (InitThisDepth eq True) { Session.RefModule[depth] = StructNew(); Session.RefModule[depth].Referer = cgi.http_referer; Session.RefModule[depth].ThisPage = ThisPage; }