with (classes) {
//
with (OCP) {
//
OCP.Page = function ()
{
 with (Common.Observable) call(this);

 with (Page)
 {
  this.clicked = click;

  this.unloading = unloading;

  this.setTheme = setTheme;

  this.abbreviations = abbreviations;
  this.contributors = contributors;
  this.editions = editions;
  this.copyright = copyright;
  this.book = book;

  this.Stylesheet_HTMLLinkElement = null;

  with (this)
  {
   Stylesheet_HTMLLinkElement = getElementById("Stylesheet_HTMLLinkElement");
/*
   with (Stylesheet_HTMLLinkElement = createElement("link"))
   {
    setAttribute("type", "text/css");
    setAttribute("rel", "stylesheet");
   }
*/
   if (Stylesheet_HTMLLinkElement) setTheme(Application.theme_name);

//   getElementsByTagName("head").item(0).appendChild(Stylesheet_HTMLLinkElement);

   with (getElementsByTagName("a")) for (var anchor_index = 0; anchor_index != length; ++ anchor_index)
   {
    var The_HTMLAnchorElement = item(anchor_index);

    var anchor_href = defaultView.location.href + '#';

    if (The_HTMLAnchorElement.href.indexOf(anchor_href) == -1)
    {
     with (XHTML.events) call(The_HTMLAnchorElement, click);

     The_HTMLAnchorElement.addObserver(this);
    }
   }

   addObserver(The_Application);

   broadcastAsync(Events.loaded);
  }
 }

 return this;
}
//
Page.Events =
{
 bookRequest : "OCP_Page_bookRequest",
 copyrightRequest : "OCP_Page_copyrightRequest",
 abbreviationRequest : "OCP_Page_abbreviationRequest",
 contributorRequest : "OCP_Page_contributorRequest",
 editionRequest : "OCP_Page_editionRequest",
 loaded : "OCP_Page_loaded",
 pageRequest : "OCP_Page_pageRequest",
 linkRequest : "OCP_Page_linkRequest",
 unloading : "OCP_Page_unloading"
}
//
Page.click = function (The_MouseEvent, Sending_HTMLElement) { with (Page) with (this)
{
 switch (Sending_HTMLElement.nodeName.toLowerCase())
 {
  case "a": if (Sending_HTMLElement.href)
  {
   var base_href;

   with (defaultView.location.href) base_href = substring(0, lastIndexOf('/') + 1);

   var the_href = Sending_HTMLElement.href;

   if (the_href.indexOf(base_href) + 1) the_href = the_href.substring(base_href.length);

   if (the_href.toLowerCase().indexOf("javascript:") + 1) eval(unescape(the_href));
   else if (the_href.toLowerCase().indexOf("mailto:") + 1) broadcastAsync(Events.linkRequest, the_href);
   else if (the_href.indexOf("://") + 1) broadcastAsync(Events.linkRequest, the_href);
   else broadcastAsync(Events.pageRequest, the_href);
  }
   break;
  default:;
 }
}}
//
Page.unloading = function () { with (Page) (this)
{
 // broadcast(Events.unloading);
}}
//
Page.setTheme = function (theme_name) { with (Page) with (this)
{
 with (Stylesheet_HTMLLinkElement)
 {
  var the_href = getAttribute("href");

  if (theme_name != Application.defaultTheme_name)
   setAttribute("href", the_href.replace("objects/" + Application.defaultTheme_name, "objects/" + theme_name));

 }
}}
//
Page.abbreviations = function (format_name) { with (Page) with (this)
{
 broadcast(Events.abbreviationRequest, format_name);
}}
//
Page.contributors = function (contributor_name) { with (Page) with (this)
{
 broadcast(Events.contributorRequest, contributor_name);
}}
//
Page.editions = function (book_name) { with (Page) with (this)
{
 broadcast(Events.editionRequest, book_name);
}}
//
Page.copyright = function () { with (Page) with (this)
{
 broadcast(Events.copyrightRequest);
}}
//
Page.book = function (book_name) { with (Page) with (this)
{
 broadcast(Events.bookRequest, book_name);
}}
//
}
//
}
