// Declare Global Variables

var Prefix        = "ec_";                // Prefix for URL's belonging to this site
var PageName      = Prefix + "pages";     // Name of top-level page
var TopFrameName  = Prefix + "navigate";  // Name of topframe
var LeftFrameName = Prefix + "index";     // Name of leftframe
var BodyFrameName = Prefix + "body";      // Name of bodyframe
var URLExtension  = ".htm";               // URL = Name + URLExtension

// Check whether the current page is the top page.
// If not, save the current page temporarily in the name of the top-window
// and load the top-level page.

if (!(top.CurrentPage))               // The top page is a page not belonging to this site
  { top.ReferrerPage = null;
    top.name         = null;
    top.location.replace(PageName + URLExtension);
  }
else 
  if (top.CurrentPage  != PageName)  // The top page belongs to the site but is a subframe
    { top.ReferrerPage  = null;
      top.name          = CurrentPage; 
      top.location.replace(PageName + URLExtension);
    }
  else // the current page is the top page. If there is a previous page, save it.
    if (top.name.indexOf(Prefix) != -1)
      { top.ReferrerPage = top.name;
      }

// Check whether there is a previous page.
// if so load the body frame with it unless it is the top- or leftframe or the top page.

if (top.ReferrerPage != null             && 
    top.ReferrerPage != TopFrameName     && 
    top.ReferrerPage != LeftFrameName    &&
    top.ReferrerPage != PageName         &&
    CurrentPage      == BodyFrameName       )
  { window.location.replace(top.ReferrerPage + URLExtension);
    top.ReferrerPage =  null;
    top.name         =  null;
  }

// Show the title of the body-frame as the title of the top-document
if (top.CurrentPage == PageName      &&
    window.name     == BodyFrameName )
  { top.document.title = document.title}

// Show and or hide date and tomorrow and yesterday buttons 
function show(current, tomorrow, yesterday)
{ var v=parent.frames[TopFrameName].document,
      w=parent.frames[LeftFrameName].document,
      x=v.ec_date,
      y=w.ec_button6,
      z=w.ec_button7;

  if (current  != '')
  { x.src = 'images/ec_d'+current+'.jpg';
  }
  else
  { x.src = 'images/ec_dnone.jpg';
  }
 
  if (tomorrow != '')
  { y.src           = 'images/ec_button6.jpg'; 
    y.width         = 171; 
    y.height        = 50;
    w.links[6].href = Prefix+tomorrow+URLExtension;
  } 
  else
  { y.src           = 'images/ec_button_none.jpg'; 
    y.width         = 1; 
    y.height        = 1;
    w.links[6].href = ''; 
  }

  if (yesterday != '')
  { z.src           = 'images/ec_button7.jpg'; 
    z.width         = 171; 
    z.height        = 50;
    w.links[7].href = 'ec_'+yesterday+'.htm'
  } 
  else
  { z.src           = 'images/ec_button_none.jpg'; 
    z.width         = 1; 
    z.height        = 1;
    w.links[7].href = ''; 
  }
}

// Some default Dreamweaver functions to allow rollover images.

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_changeImage() { //v3.0
  var i,j=0,x,a=MM_changeImage.arguments,b=document.MM_sr; 
  for(i=0;i<(a.length-2);i+=3)
  {  x=MM_findObj(a[i]); 
     for(k=0;b&&k<b.length&&(x=b[k])&&x.oSrc;k++)x.oSrc=a[i+2];
  }
}


