
NSPACE_ARRAY = new Array();
SPACE_ARRAY = new Array();
SCRIPT_ARRAY = new Array();
CLOSE_ARRAY = new Array();
ID_ARRAY = new Array();
NAME_ARRAY = new Array();
STATE_ARRAY = new Array();
USED_ARRAY = new Array;


ICOUNT = 0;
NOFONTS = "HELLO Mum";
BLSELF = "_blank";
MENULEV = 0;
LINK_FORMAT = "DEFAULT";

// Colour of Banner
var BANCOL = "#a1abd3";

//BANCOL = "#83bfc6";
// Colour of 'Red Box'
var REDBOX = "#e46e64";

var WHITE = "#ffffff";
var BACKCOL = "#c0c0ee"; 
var BACKGCOL = "white";
var HOVERCOL = "#2685f1";
var BACKLCOL = "#c0c0ee"; 
var HOVERLCOL = "#dcdced";
var HOVERLCOLX = "#aaaabb";
var FONT = "10pt Arial";
var FONTS = "20pt Arial";
var FONTM = "11pt Arial";
var BIGFONT = "12pt Arial";
var BIGFONTB = "bold 12pt Arial";
var FONTB = "bold 10pt Arial";
var BIGFONTB_LOWER = "bold 11pt Arial";


var VBIGFONT = "14pt Arial";
var VBIGFONTB = "bold 14pt Arial";
var VVBIGFONTB = "bold 15pt Arial";
var TEXTCOL = "#000070";
var TEXTHOV = "white";
var TEXTLCOLA = "#1010cc";
var TEXTLCOLB = "#000070";
var TEXTLHOVA = "#800020";
var TEXTLHOV = "#ee6060";
var FONTH = "17pt Arial";
var FONTSH = "14pt Arial";
var HEADCOLOUR = "#0000ff";
var HEADCOLOURX = "#202000";

var BACKGCOL = "yellow";


//HEADCOLOURX = "23bac6";
HEADCOLOUR = "#817bd3";



var plate = [0,"HEADING","","",0,0,0,"","_blank",
"","","","",0,0,0,
   "",
   "",
   0,0,
   0,0,0,
   "", // element 23 - Background Colour
   0,
   "", // element 25 - Background Colour Hover
   0,
   "","",3,3,0,0,WHITE,WHITE,
   "", // element 35 - Text Color
   "", // element 36 - Text Hover Colour
   "", // element 37 - Font
   "", // element 38 - Font Hover
   0,0];
   
plate[23] = "yellow";

AIAH = plate.slice(0,41);   
AIAH[23] = AIAH[25] = BACKGCOL;
AIAH[35] = AIAH[36] = HEADCOLOUR;
AIAH[37] = AIAH[38] = FONTH;

AIAB = plate.slice(0,41);   
AIAB[23] = AIAH[25] = AIAB[35] = AIAH[36] = "white";
AIAB[23] = AIAH[25] = AIAB[35] = AIAH[36] = "yellow";
AIAB[25] = HOVERCOL;
AIAB[36] = TEXTHOV;
AIAB[37] = AIAH[38] = "";


AIASH = AIAH.slice(0,41);
AIASH[37] = AIASH[38] = FONTSH;

AIA = plate.slice(0,41);
AIA[25] = AIA[23] = BACKGCOL;
AIA[35] = HEADCOLOUR;
AIA[36] = TEXTLHOVA;
AIA[37] = AIA[38] = FONTM;


AIAHX = AIA.slice(0.41);
AIAHX[36] = HEADCOLOUR;
AIAHX[37] = AIAHX[38] = FONTSH;

AIXAS = plate.slice(0,41);
AIXAS[23] = BACKCOL;
AIXAS[25] = HOVERCOL;
AIXAS[35] = TEXTCOL;
AIXAS[36] = TEXTHOV;
AIXAS[37] = AIXAS[38] = FONT;

AIXA = AIXAS.slice(0,41);
AIXA[37] = AIXA[38] = FONT;

AIXAS[37] = AIXAS[38] = FONTS;


AIXAB = AIXAS.slice(0,41);
AIXAB[37] = AIXAB[38] = FONTM;
AIXAB[8] = "_self";
//AIXAB[23] = "green";

AIXAL = AIXA.slice(0,41);
AIXAL[23] = BACKCOL;
//AIXAL[23] = "green";
AIXAL[25] = HOVERLCOL;
AIXAL[35] = TEXTLCOLB;
AIXAL[36] = TEXTLHOVA;
AIXAL[37] = AIXAL[38] = FONT;


//
//AIXAL[11] = AIXAL[12] = "/cds/assets/images/glucose.gif";
//AIXAL[13] = AIXAL[14] = 50;
//

AINEWS = AIXAL.slice(0,41);
AINEWS[25] = AINEWS[23];
AINEWS[33] = AINEWS[34] = BACKCOL;
AINEWS[35] = TEXTLCOLA;
AINEWS[37] = AINEWS[38] = BIGFONTB;


AIXALS = AIXAL.slice(0,41);
AIXALS[37] = AIXALS[38] = FONT;

AIXAR = AIXAL.slice(0,41);

AIXAD = AIXAL.slice(0,41);

AIXARS = AIXALS.slice(0,41);
AIXARS[37] = AIXARS[38] = BIGFONT;
//AIXARS[23] = "green";


AITOP = AIA.slice(0,41);
AITOP[37] = AITOP[38] = BIGFONTB;
AITOP[23] = AITOP[25] = "white";
AITOP[24] = AITOP[26] = 0;
AITOP[27] = AITOP[28] = "";

AITOP_LOWER = AITOP.slice(0,41);
AITOP_LOWER[37] = AITOP_LOWER[38] = BIGFONTB_LOWER;

// Mike 10/07/2009 
// need login/start text on red background
AIQUICK = AIA.slice(0,41);
//AIQUICK[23] = AIQUICK[25] = AIQUICK[35] = AIQUICK[23] = AIQUICK[25] = 
//AIQUICK[36] = "#ff4444";
AIQUICK[37] = AIQUICK[38] = BIGFONTB;
//AIQUICK[23] = AIQUICK[25] = "#cc4444"; // our red
AIQUICK[23] = REDBOX;
AIQUICK[25] = WHITE;
AIQUICK[35] = "#f0f0f0";
AIQUICK[24] = AIQUICK[26] = 0;
AIQUICK[27] = AIQUICK[28] = "";
AIQUICK[8] = "_self";

AIREFS = AIA.slice(0,41);
AIREFS[37] = AIREFS[38] = FONTB;
AIREFS[23] = HOVERCOL; 
AIREFS[23] = BANCOL;
AIREFS[25] = "#ffffff";
AIREFS[35] = "#f0f0f0";
AIREFS[35] = "#b02222";
AIREFS[24] = AIREFS[26] = 0;
AIREFS[27] = AIREFS[28] = "";
AIREFS[8] = "_self";

AIREFSY = AIA.slice(0,41);
AIREFSY[37] = AIREFS[38] = FONTB;
AIREFSY[23] = HOVERCOL; 
AIREFSY[23] = BANCOL;
AIREFSY[23] = "#6060ff";

AIREFSY[25] = "#ffffff";
AIREFSY[35] = "#f0f0f0";
//AIREFSY[35] = "#b02222";
AIREFSY[35] = BANCOL;
AIREFSY[35] = "#cccccc";
AIREFSY[24] = AIREFS[26] = 0;
AIREFSY[27] = AIREFS[28] = "";
AIREFSY[8] = "_self";

AIREFSX = AIA.slice(0,41);
AIREFSX[37] = AIREFS[38] = FONTB;
AIREFSX[23] = HOVERCOL; 
AIREFSX[23] = BANCOL;
AIREFSX[25] = "#ffffff";
AIREFSX[35] = "#f0f0f0";
AIREFSX[35] = "blue";
AIREFSX[24] = AIREFS[26] = 0;
AIREFSX[27] = AIREFS[28] = "";
AIREFSX[8] = "_self";

AITOPR = AITOP.slice(0,41);
AITOPR[37] = AITOPR[38] = FONTB;



AIHEADING = AITOPR.slice(0,41);
AIHEADING[37] = AIHEADING[38] = FONT;
AIHEADING[35] = HEADCOLOURX;
AIHEADING[36] = AIHEADING[35];

AIDUMMY = AITOPR.slice(0,41);
AIDUMMY[37] = AIHEADING[38] = FONT;
AIDUMMY[35] = HEADCOLOURX;
AIDUMMY[35] = "red";
AIDUMMY[36] = AIHEADING[35];


var bpatemp = [1,4,0,0,2,0,0,0,100,"",-2,"",-2,
90,
   0,0,"#333333",
  "white",
   "",
   3,1,0,"#333333"];


var bpatop = [1,4,0,0,2,0,0,0,100,"",0,"",0,
0,
   0,0,"#333333",
  "white",
   "",
   3,1,0,"#333333"];
bpatop[0] = 0;
bpatop[5] = 4;
bpatop[6] = 0;
bpatop[7] = 0;

//

var bpatemp = new Array();


bpxatemp = [1,1,0,0,3,4,0,0,100,"white",-2,"white",-2,100,0,0,"white",
   "white",
   "",
   3,1,
  2,
  "green"];



// Testing!!!
bpxatemp[6] = 50;

BPA = bpatemp.slice(0,23);

BPXXX = bpatemp.slice(0,23);
BPXXX[5] = 3;
BPXXX[17] = "white";
BPXXX[22] = "white";
BPXXX[21] = 0;

BPYYY = bpatemp.slice(0,23);
BPYYY[0] = 0;
BPYYY[1] = 1;
BPYYY[5] = 3;
BPYYY[17] = "white";
BPYYY[21] = 6;
BPYYY[22] = BACKCOL;
BPYYY[2] = 0;
BPYYY[3] = 0;

BPXA = bpxatemp.slice(0,23);
BPXA[1] = 1;

BPXAR = bpxatemp.slice(0,23);
BPXAR[1] = 2;

BPXAL = bpxatemp.slice(0,23);
BPXAL[1] = 1;


BPXAD = bpxatemp.slice(0,23);
BPXAD[1] = 4;

BPXAQ = BPXAD;

BPANEWS = BPA;

BPATOP = bpatop.slice(0,23);

BM = ["ivvnair",400,"","",0,"","",0,0,0,0,50,1,0,0,""];

SUGAR = "<img\tborder=\"0\"src=\"/cds/assets/images/aglucose.png\"\twidth=\"120\"\theight=\"102\"\talt=\"CDS Logo\"\talign=\"middle\"/>";


LOGOA = "<div\tclass=\"logoaxx\">DARESBURY LABORATORY</div>";

LOGOB = "<div\tclass=\"logobx\"> CDS </div><div class=\"logocx\"> ON-LINE </div>";

LOGOLINK = "<div class=\"logol\">Click Logo for Service details<br\t/><br\t/></div>";


CDSLOGO =  LOGOA + SUGAR + LOGOB + LOGOLINK;

//
// menu_functions.js 
//

function menu_wrap() {
   uptree();
   stm_em();
}


HELLO = "HELLO";

ABSROOT = "ABSROOT_";


function menu_link_r(title)
{
  var space = "&nbsp;&raquo;&nbsp;";
  var space2 = "&nbsp;&nbsp;&nbsp;";
  var padtit = space + title + space2;
  genlink(padtit, "", "LINKR");
}
function menu_link_l(title)
{
  var space = "&nbsp;&laquo;&nbsp;";
  var space2 = "&nbsp;&nbsp;&nbsp;";
  var padtit = space + title + space2;
  genlink(padtit, "", "LINKL");
}
function menu_link_d(title)
{
  var space = "&nbsp;&nbsp;&nbsp;";
  var space2 = "&nbsp;&nbsp;&nbsp;";
  var padtit = space + title + space2;
  genlink(padtit, "", "LINKD");
}

function url_link(title, link)
{
//  alert('url_link');  
  var len = SCRIPT_ARRAY.length;
  var lens = SPACE_ARRAY.length;
  NSPACE_ARRAY[len] = lens;
  SPACE_ARRAY[lens] = len;
  ID_ARRAY[len] = "URL";
  STATE_ARRAY[len] = "FREE";

  var target = "URL" + len;
  NAME_ARRAY[len]  = link;

  var link_new = "";
//  link_new += 'url_firex("';
  link_new += 'url_fire("';
  link_new += link;
  link_new += '","';
  link_new += target;
  link_new += '","';
  link_new += len;
  link_new += '");';

  SCRIPT_ARRAY[len] = link_new;
  USED_ARRAY[len] = "";

  var space = "&nbsp;&#8226;&nbsp;";
  var space2 = "&nbsp;&nbsp;&nbsp;";
  var padtit = space + title + space2;

  var links = "";
  links += len;

  genlink(padtit, links);
}

function url_link_t(title, link, tar)
{
//  alert('url_link');  
  var len = SCRIPT_ARRAY.length;
  var lens = SPACE_ARRAY.length;
  NSPACE_ARRAY[len] = lens;
  SPACE_ARRAY[lens] = len;
  ID_ARRAY[len] = "URL";
  STATE_ARRAY[len] = "FREE";
  if ( tar == '' )
  {
    var target = "URL" + len;
  }
  else
  {
    var target = tar;
  }
  NAME_ARRAY[len]  = link;

  var link_new = "";
//  link_new += 'url_firex("';
  link_new += 'url_fire("';
  link_new += link;
  link_new += '","';
  link_new += target;
  link_new += '","';
  link_new += len;
  link_new += '");';

  SCRIPT_ARRAY[len] = link_new;
  USED_ARRAY[len] = "";

  var space = "&nbsp;&#8226;&nbsp;";
  var space2 = "&nbsp;&nbsp;&nbsp;";
  var padtit = space + title + space2;

  var links = "";
  links += len;

  genlink(padtit, links);
}


function url_link_s(title, link)
{
  alert('url_link_s');  
  var len = SCRIPT_ARRAY.length;
  var lens = SPACE_ARRAY.length;
  NSPACE_ARRAY[len] = lens;
  SPACE_ARRAY[lens] = len;
  ID_ARRAY[len] = "URL";
  STATE_ARRAY[len] = "FREE";

  var target = "URL" + len;
  NAME_ARRAY[len]  = link;

  var link_new = "";
  link_new += "var param = '";
  link_new += link;
  link_new += "'";
  link_new += ';eval(';
//  link_new += "'";
  link_new += 'param';
  link_new += ');';
  
//  alert(link_new);  

  SCRIPT_ARRAY[len] = link_new;
  USED_ARRAY[len] = "";

  var space = "&nbsp;&infin;&nbsp;";
  var space2 = "&nbsp;&nbsp;&nbsp;";
  var padtit = space + title + space2;
  
  var links = "";
  links += len;
  genlink(padtit, links);
}


WINACT="YES";
//WINACT="NO";
top.WORK_ARRAY = new Array();
top.WORK2_ARRAY = new Array();

function url_fire(url,target,dummy)
{
  getNewWinX(target);
  var t_name = typeof top.NAME_ARRAY;
  var t_work = typeof top.NAME_ARRAY;
  if ( t_name == 'undefined' )
  {
    top.NAME_ARRAY = new Array();
  }
  if ( t_work  == 'undefined' )
  {
    top.WORK_ARRAY = new Array();
  }
  var num = url_num(NAME_ARRAY,url);
  url_firex(url,target,num)
}

function url_num (name,url)
{
  var wobj;
  var t_wobj;
  var nlen = name.length;
  var i;
  var rval = nlen;
  for ( i = 0; i < nlen; i++ )
  {
    if ( name[i] == url )
    {
      rval = i;
      wobj = WORK_ARRAY[i];
      t_wobj = typeof wobj;
      if ( t_wobj == 'object' )
      {
        top.WORK_ARRAY[i].close();
	top.WORK_ARRAY[i] = 'XXX ' + i;
      }
    }
  }
  if ( nlen == rval )
  {
     name[nlen] = url;
  }
  return rval;
}

function url_firex (url,target,num)
{
  var wobj = top.WORK_ARRAY[num];
  var t_wobj = typeof wobj;
  if ( t_wobj == 'object' )
  {
    wobj.close();
    top.WORK_ARRAY[num] = '';
  }
//  else if ( t_wobj == 'string' )
//  {
//    alert('wobj is string ' + wobj);
//  }
  setTimeout (
  function()
  {
    top.WORK_ARRAY[num] = window.open(url,target,'',false);
  },0);
}

isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
isOpera = navigator.userAgent.toLowerCase().indexOf('opr') > -1;
isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
isSamsung = navigator.userAgent.toLowerCase().indexOf('samsung') > -1;
isSafari = navigator.userAgent.toLowerCase().indexOf('safari') > -1;

function getNewWinX(aa)
{
   var myTestWindow  = window.open('',aa);

//   var diag = document.getElementById('diagnostic');

   var test = ''
   test += 'target: ' + aa + ' - ';
   test += 'firefox: ' + isFirefox + ' - ';
   test += 'opera: ' + isOpera + ' - ';
   test += 'chrome: ' + isChrome + ' - ';
   test += 'samsung: ' + isSamsung + ' - ';
   test += 'safari: ' + isSafari + ' - ';
   test += 'mobile: ' + MOBILE;
   test += '<br />';
   test += navigator.userAgent;
//   diag.innerHTML = test;

  if (top.MOBILE)
  {   if ( isOpera )
      {
//        myTestWindow.close();
      }
      else if ( isSamsung )
      {
        myTestWindow.close();
      }
      else if ( isFirefox )
      {
        myTestWindow.close();
      }
      else
      {
        myTestWindow.close();
      }
  }
  else
  {
      if ( isOpera )
      {
        myTestWindow.focus();
      }
      else if ( isSafari )
      {
//        myTestWindow.close();
      }
      else if ( isFirefox )
      {
        myTestWindow.close();
      }
      else if ( isChrome )
      {
//        myTestWindow.close();
      }
      else
      {
          myTestWindow.close();
      }
  }
//   alert(test);

}


function isMobileDevice()
{
  var test =  (typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1);
  return test;
}

top.MOBILE = isMobileDevice();

if(typeof(st_js)=="undefined"){
    stAHCM=0;// 0
    stAHWS=1;// 1
    stSMSC=1;// 1
    stSCSP=0;// 0
    stCFSP=0;// 0
    stBIMG=1;// 1
    stDF55=0;// 0
    stMMSZ=10;// 10

nOP=nOP5=nIE=nIE4=nIE5=nNN=nNN4=nNN6=nMAC=nIEM=nIEW=nDM=nVER=st_delb=st_addb=st_scd=0,stmozb=false;
    nDM = true;
    nNN6 = true;
    nNN = true;
    nIE = false;
//    stnav();
    st_reg=!(nIEW&&nVER>=5.5&&nVER<6&&stDF55);
    st_ttb=nIE;
    stHAL=["left","center","right"];
    stVAL=["top","middle","bottom"];
    stREP=["no-repeat","repeat-x","repeat-y","repeat"];
    stBDS=["none","solid","double","dotted","dashed","groove","ridge"];
    st_gc=st_rl=st_cl=st_ct=st_cw=st_ch=st_cm=st_cp=st_ci=st_load=st_scr=0;
    st_ht="";
    st_ims=[];
    st_ms=[];
    stusrld=[];

//    if(nDM&&!nNN4)
//    {

      var s = "";
      s += "<form method='post' id=qwerty action='/' target='_blank'></form>";
      s += "<style>";
      s += "table.st_tbcss{margin:0px; border-collapse: separate; border-spacing: 2px;},";
      s += "td.st_tdcss{white-space: nowrap;},";
      s += "div.st_ftcss{color: transparent; text-decoration: none;}";
      s += "a.st_acss:link{color: transparent; text-decoration: none;}";
      s += "a.st_acss:visited{color: transparent; text-decoration: none;}";
      s += "a.st_acss:hover{color: transparent; text-decoration: none;}";
      s += "a.st_acss:active{color: transparent; text-decoration: none;}";
      s += "</style>";
      SSS= s.slice();
//    }
    st_js=1;
}


// tidied from single-line versions using JSTidy (http://www.howtocreate.co.uk/tutorials/jsexamples/JSTidy.html)
// Mike 09/07/2009

function stm_bp(l, a) {
//   Menu set up
    var m = st_ms[st_cm], p, i = m.ps.length ? m.ps[st_cp].is[st_ci] : 0;
    st_cp = m.ps.length;
    st_ci = 0;
    m.ps[st_cp] = p = {is: [], mei: st_cm, ppi: st_cp, ids: "Stm" + st_cm + "p" + st_cp + "i", par: i, tmid: 0, cuit: 0, issh: 0, isst: !st_cp && !m.mtyp, isck: !st_cp && m.mcks & 1, exed: 0, pver: a[0], pdir: a[1], poffx: a[2], poffy: a[3], pspc: a[4], ppad: a[5], plmw: a[6], prmw: a[7], popc: a[8], pstp: a[14], psds: nIEW ? a[15] : 0, pscl: a[16], pbgc: a[17], pbgi: stbuf(stgsrc(a[18], 0)), pbgr: stREP[a[19]], pbds: stBDS[a[20]], ipbw: a[21], pbdc: (!nDM || nNN4) ? a[22].split(/\s/gi)[0] : a[22], args: a.slice(0)};
    p.peff = [stgeff(a[9], a[10], a[13], p), stgeff(a[11], a[12], a[13], p)];
    if (st_cp) {
        p.par.sub = p;
    }
    p.zind = !st_cp ? 1000 : stgpar(p.par).zind + 1;
    p.pbgd = stgbg(p.pbgc, p.pbgi, p.pbgr);
    if (nIEW) {
        p.effn = [p.peff[0] ? p.peff[0].split(" ").length : 0, p.peff[1] ? p.peff[1].split(" ").length : 0];
    }
    eval(l + "=p");
}
function stm_bpx(l, r, a) {
//   Menu set up
    var p = eval(r);
    stm_bp(l, a.concat(p.args.slice(a.length)));
}
function stm_ai(l, a) {
//   Menu set up
    st_ci = st_ms[st_cm].ps[st_cp].is.length;
    var m = st_ms[st_cm];
    var p = m.ps[st_cp]
    var i = Object();
    if (a[0] == 6) {
        i = {ssiz: a[1], ibgc: [a[2]], simg: stbuf(stgsrc(a[3], 1)), simw: a[4], simh: a[5], simb: a[6], args: a.slice(0)};
    } 
    else {
    var xxx = nOP5 && nVER < 7 && a[24] && a[26] ? ["transparent", "transparent"] : [nOP5 && nVER < 7 || !a[24] ? a[23] : "transparent", nOP5 && nVER < 7 || !a[26] ? a[25] : "transparent"];
    var yyy =  [stbuf(stgsrc(a[27], a[28] && !nNN4)), stbuf(stgsrc(a[28], a[27] && !nNN4))];
       i = 
       {itex: a[0] ? a[1] : a[1].replace(/ /g, " "),
	iimg: [stbuf(stgsrc(a[2], 0)),
	stbuf(stgsrc(a[3], 0))],
	iimw: a[4],
	iimh: a[5],
	iimb: a[6],
	iurl: !a[7] || stabs(a[7]) ? a[7].toLowerCase().indexOf("javascript:") ? a[7] : a[7] + ";void(0);" : m.mpre + a[7],
	itgt: a[8] ? a[8] : "_self",
	istt: a[9], 
	itip: a[10].replace(/"/g,"&quot;"),
	iicn: [stbuf(stgsrc(a[11], 1)), stbuf(stgsrc(a[12], 1))],
	iicw: a[13],
	iich: a[14],
	iicb: a[15],
	iarr: [stbuf(stgsrc(a[16], 1)), stbuf(stgsrc(a[17], 1))],
	iarw: a[18],
	iarh: a[19],
	iarb: a[20],
	ihal: stHAL[a[21]],
	ival: stVAL[a[22]],
        ibgc: xxx,
	ibgi: yyy,
	ibgr: [stREP[a[29]], stREP[a[30]]],
	ibds: stBDS[a[31]], ipbw: a[32],
	ibdc: (!nDM || nNN4) ? [a[33].split(/\s/gi)[0], a[34].split(/\s/gi)[0]] : [a[33], a[34]],
	itxc: [a[35], a[36]], itxf: [a[37], a[38]],
	itxd: [stgdec(a[39]), stgdec(a[40])],
	args: a.slice(0)
       };
    }
    p.is[st_ci] = i;
    i.ityp = a[0];
    i.mei = st_cm;
    i.ppi = st_cp;
    i.iti = st_ci;
    i.ids = p.ids + st_ci + "e";
    i.sub = 0;
    i.tmid = 0;
    i.iwd = 0;
    i.iht = 0;
    i.cstt = 0;
    i.lock = 0;
    eval(l + "=i");
}
function stm_aix(l, r, a) {
//   Menu set up
    var i = eval(r);
    stm_ai(l, a.concat(i.args.slice(a.length)));
}
function stm_ep() {
//   Menu set up
   var m = st_ms[st_cm], p = m.ps[st_cp], i = p.par;
    if (i) {
        st_cm = i.mei, st_cp = i.ppi, st_ci = i.iti;
    }
    if (!p.is.length) {
        --m.ps.length;
        if (i) {
            i.sub = 0;
        }
    }
}
function stpbtx(p) {
//   Menu set up
    with (p) {
        var s = st_ttb || nOP && isst ? "<table class=st_tbcss CELLPADDING=0 CELLSPACING=0" : "<div class=st_divcssA";
        s += stppev(p) + " id=" + ids + " style='" + (nIEM ? "width:1px;" : "") + (nIEW ? "filter:" + stfcss(p) + ";" : "") + "position:" + (p.isst ? "static" : "absolute;" + (nOP && nVER < 7 ? "" : "left:-9999px;top:-9999px")) + ";z-index:" + zind + ";visibility:hidden;'>";
        s += (st_ttb || nOP && isst ? "<td class=st_tdcss id=" + ids + "TTD>" : "");
        s += "<table style='" + stpcss(p) + "' id=" + ids + "TB><td><table class=st_tbcss CELLSPACING=" + (stissc(p) ? 0 : pspc) + " CELLPADDING=0 id=" + ids + "TA>";
//        s += "<table cellpadding=0 cellspacing=0 style='" + stpcss(p) + "' id=" + ids + "TB><td><table class=st_tbcss CELLSPACING=" + (stissc(p) ? 0 : pspc) + " CELLPADDING=0 id=" + ids + "TA>";
        return s;
    }
}
function stpetx(p) {
// Menu setup
  var value = "</table></td></tr></table></div>";
  return value;
}
function stittx(i) {
// Menu setup
//    alert("nIEW: " + nIEW);
    var s = "", p = stgpar(i);
    with (i) 
    {
            s += "<td class=st_tdcss id=" + i.ids + stitev(i);
            s += " style='";
            if (!(ityp != 6 && stmozb) &&
                (ityp != 6 || !(nOP && nVER < 6 && p.pver))) {
                s += sticss(i, 0);
            }
            s += "'>";
            if (ityp == 6) 
	    {
	        alert("type == 6");
            } 
	    else 
	    {
	      ACX = "CLICK";
//                s += "<a class=st_acss id=" + i.ids + "HR " + stgurl(i, 0) + ">";
                s += "<div ";
		s += rfmurl(i, 0);
		s += " class=st_divcssB ";
		s += (stmozb ? " style='" + sticss(i, 0) + "'" : "");
		s += " id=" + i.ids + "DR>";
                s += "<table class=st_tbcss id=" + ids + "TB>";
                s += "<td class=st_tdcss style='text-align:" + ihal + ";color:" + itxc[0] + ";padding:" + p.ppad + "px;' id=" + ids + "MTD>";
                s += "<div class=st_ftcss id=" + ids + "TX style='" + sttcss(i, 0) + ";'>";
                if (itex) {
                    s += itex;
                }
                s += "</div>";
                s += "</td>";
                if (p.pver && p.prmw || !p.pver && iarw) {
//		alert("TEST A");
                    s += "<td class=st_tdcss NOWRAP ALIGN=CENTER VALIGN=MIDDLE STYLE='padding:" + p.ppad + "px' id=" + ids + "RTD" + stgaws(i) + ">" + stgimg(iarr[0], ids + "ARROW", iarw, iarh, iarb, 1) + "</td>";
                } else if (nIEW) {
                    s += "<td style='display:none;'></td>";
                }
                s += "</table>";
//		alert("nNN - " + nNN);
                s += "</div>";
//                s += "</a>";
            }
            s += "</td>";
//	    alert(s);
//        }
    }
    return s;
}
function stpcss(p) {
//   Menu set up
    with (p) {
        return "border-style:" + pbds + ";border-width:" + ipbw + "px;border-color:" + pbdc + ";" + (nIE ? "background:" + pbgd + ";" : "background-color:" + pbgc + ";" + (pbgi ? "background-image:url(" + pbgi + ");background-repeat:" + pbgr + ";" : "")) + (nIEW ? "margin:" + psds + "px;" : ";");
    }
}
function sticss(i, n) {
// Menu setup
    with (i) {
        return (ityp != 6 ? "border-style:" + ibds + ";border-width:" + ipbw + "px;border-color:" + ibdc[n] + ";" + (!nIEM && ibgi[n] ? "background-image:url(" + ibgi[n] + ");background-repeat:" + ibgr[n] + ";" : "") : "") + (nIEM && ityp != 6 ? "background:" + ibgd[n] + ";" : "background-color:" + ibgc[n] + ";") + "cursor:" + (nIEM ? "default" : stgcur(i)) + ";font-size:1px;";
    }
}
function sttcss(i, n) {
//Menu setup   
    var xx = i;
    var retval = "font: "
    retval += xx.itxf[n];
    retval += "; color: ";
    retval += xx.itxc[n];
    return retval;
}
function stgtm(m, w) {
    if (w && w != window && stdmld(w)) {
        var t = w.stmenu(m.mnam);
        if (t) {
            t.sfrm = window;
            if (t.mhdd < 1000) {
                t.mhdd = 1000;
            }
        }
        return t;
    }
    return m;
}
function stitov(e, o, i) {
// Mouse activity
    var p = stgpar(i);
//    alert("stitov: " + p.isck);
    var m = stgme(i), t = m, w = window;
    if (!p.par) {
        w = stgfrm(m);
        t = stgtm(m, w);
    }
    if (!p.isck || m.cked) {
//        alert("A: " +p.cuit);
        if (p.cuit && p.cuit != i) {
            var c = p.cuit;
            sthdit(c);
            if (t != m && t) {
                w.sthdit(t.ps[c.ppi].is[c.iti]);
            }
        }
        else if  (p.cuit && p.cuit == i) 
        {
//          alert("SECOND");
            var c = p.cuit;
            sthdit(c);
	    return
        }
        if (typeof i.myitov != "undefined" && i.myitov(e)) {
            return;
        }
        stshpx(t, m, i, w);
        stshst(i, 1);
        stgpar(i).cuit = i;
    } else if (t.mcks & 2) {
        stshst(i, 1);
    }
}


function stppov(e, o, p) {
    alert("!!!!stpov");
    if (!p.issh ||
        nIE && e.fromElement && o.contains(e.fromElement) ||
        nOP &&
        e.fromElement &&
        e.fromElement.id && e.fromElement.id.indexOf(p.ids) >= 0) {
	alert("TEST 1");
        return;
    }
//	alert("TEST 2");
    var m = stgme(p), w = m.sfrm;
    if (p.par && w != window) {
        if (stdmld(w)) {
            m = w.stmenu(m.mnam);
        } else {
            return;
        }
    }
    if (m.hdid) {
        w.clearTimeout(m.hdid);
        m.hdid = 0;
    }
}
function stppou(e, o, p) {
//Mouse activity
//    alert("stppou");
//    alert(o.id);
    if (!p.issh ||
        nIE && e.toElement && o.contains(e.toElement) ||
        nOP &&
        e.toElement &&
        e.toElement.id && e.toElement.id.indexOf(p.ids) >= 0) {
        return;
    }
    var m = stgme(p), w = m.sfrm;
    if (p.par && w != window) {
        if (stdmld(w)) {
            m = w.stmenu(m.mnam);
        } else {
            return sthdalx(m, 0);
        }
    }
    if (m.hdid) {
        w.clearTimeout(m.hdid);
    }
    m.hdid = w.setTimeout("sthdall(st_ms['" + m.mei + "'],0);", m.mhdd);
}
function stshst(i, n) {
// Mouse action
//    alert("stshst");
    if (i.cstt == n) {
        return;
    }
    if (typeof i.myshst != "undefined" && i.myshst(n)) {
        return;
    }
    i.cstt = n;
    with (i) {
            
            var o = stmozb ? stgobj(i.ids + "DR") : stglay(i), s = o.style;
            if (nIEM) {
                if (ibgd[0] != ibgd[1]) {
                    s.background = ibgd[n];
                }
            } 
	   else 
	   {
                if (ibgc[0] != ibgc[1]) {
                    if (nOP && nVER < 6) {
                        s.background = ibgc[n];
                    } else {
                        s.backgroundColor = ibgc[n];
                    }
                }
                if (ibgi[0] != ibgi[1]) {
                    s.backgroundImage = "url(" + (ibgi[n] ? ibgi[n] : stgme(i).mbnk) + ")";
                }
                s.backgroundRepeat = ibgr[n];
            }
            if (ibdc[0] != ibdc[1]) {
                s.borderColor = ibdc[n];
            }
            var t;
            if (iicn[0] != iicn[1]) {
                t = nIE ? o.all[ids + "ICON"] : stgobj(ids + "ICON");
                if (t) {
                    t.src = iicn[n];
                }
            }
            if (iarr[0] != iarr[1]) {
                t = nIE ? o.all[ids + "ARROW"] : stgobj(ids + "ARROW");
                if (t) {
                    t.src = iarr[n];
                }
            }
            if (ityp == 2 && iimg[0] != iimg[1]) {
                t = nIE ? o.all[ids + "IMG"] : stgobj(ids + "IMG");
                if (t) {
                    t.src = iimg[n];
                }
            }
            if (!i.txstyle) {
                i.txstyle = (nIE ? o.all[ids + "TX"] : stgobj(ids + "TX")).style;
            }
            t = txstyle;
            if (itxf[0] != itxf[1]) {
                t.font = itxf[n];
            }
            t.color = itxc[n];
//        }
    }
}

function stshpp(p) {
//Mouse activity
//    alert("stshpp");
// Function is used
    if (typeof p.myshpp != "undefined" && p.myshpp()) {
        return;
    }
    stshow(p);
}
function stshpx(t, m, i, w) {
//Mouse activity
//    alert("stshpx");
// Functions is used
    if (t == m) {
        var p = i.sub;
        if (p && !p.issh && !(!i.ppi && m.mcff && !m.mcfn)) {
            stshpp(p);
        }
    } else if (t) {
        var p = t.ps[i.ppi].is[i.iti].sub;
        if (p && !p.issh) {
            w.stshpp(p);
        }
    }
}
function sthdpp(p) {
//mouse activity
//    alert("sthdpp");
// Functions is used
    if (typeof p.myhdpp != "undefined" && p.myhdpp()) {
        return;
    }
    if (p.cuit) {
        var t = p.cuit.sub;
        if (t && t.issh) {
            sthdpp(t);
        }
        stshst(p.cuit, 0);
        p.cuit = 0;
    }
    sthide(p);
}

function sthdit(i) {
// mouse activity
//    alert("sthdit");
// Function is used
    var p = i.sub;
    if (p && p.issh) {
        sthdpp(p);
    }
    stshst(i, 0);
    stgpar(i).cuit = 0;
}
function stshow(p) {
// Menu setup
//    alert("stshow");
// Functions is used
    var d = p.par && stgpar(p.par).pver ? stgme(p).msdv : stgme(p).msdh;
    p.exed = 0;
    if (!p.rc) {
        stgxy(p);
    }
    if (p.tmid) {
        clearTimeout(p.tmid);
        p.tmid = 0;
        stwels(1, p);
    }
    if (d > 0) {
        p.tmid = setTimeout(stsdstr(p, 1), d);
    }
    p.issh = 1;
    if (d <= 0) {
        eval(stsdstr(p, 1));
    }
}
function sthide(p) {
//mouse activity
//    alert("sthide");
// Function used
    if (p.tmid) {
        clearTimeout(p.tmid);
        p.tmid = 0;
    }
    if (p.issh && !p.exed) {
        p.exed = 0;
        p.issh = 0;
    } else {
        p.exed = 0;
        p.issh = 0;
        eval(stsdstr(p, 0));
    }
}
function stshx(p) {
// Menu setup
//    alert("stshx");
// Function is used
    var l = stglay(p);
    l.style.visibility = "visible";
}

function sthdx(p) {
//mouse activity
    var l = stglay(p);
    if (nNN4) {
        l.visibility = "hide";
    } else {
        if (nIE5) {
            l.filters.Alpha.opacity = 0;
        }
        l.style.visibility = "hidden";
    }
//        alert(l);
//        alert("sthdx");

}
function sthdall(m, f) {
// mouse activity
//  alert("stdall");
    var t = m, w;
    if (m.mcff) {
        w = stgfrm(m);
        if (w && w != window && stdmld(w)) {
            t = w.stmenu(m.mnam);
            if (typeof t == "object" && t) {
                t.sfrm = window;
            }
        }
    }
    if (m.hdid) {
        clearTimeout(m.hdid);
        m.hdid = 0;
    }
    m.cked = 0;
    var p = m.ps[0];
    if (p.issh) {
        var i = p.cuit;
        if (p.cuit) {
            sthdit(i);
            if (t != m) {
                var p = t.ps[i.ppi].is[i.iti].sub;
                if (p && p.issh) {
                    w.sthdpp(p);
                }
            }
        }
        if (m.mtyp == 2 && (f || stAHCM)) {
            sthide(p);
        }
    }
}
function stgeff(f, i, s, p) {
//Menu setup
//    alert("stgeff");
    return nVER < 5.5 ? (!p.isst || nVER >= 5) && i < 24 && i >= 0 ? "revealTrans(Transition=" + i + ",Duration=" + (110 - s) / 100 + ")" : "" : f == "Normal" ? "" : f;
}
function stftsh(p) {
// Menu setup
//    alert("stfsh");
    if (nIEW && nVER >= 5.5) {
        eval("try{stshfx(p);}catch(e){st_reg=0;stshfx(p);}");
    } else {
        stshfx(p);
    }
}
function stfthd(p) {
//mouse activity
//    alert("*******stfhd");
    if (nIEW && nVER >= 5.5) {
        eval("try{sthdfx(p);}catch(e){st_reg=0;sthdfx(p);}");
    } else {
        sthdfx(p);
    }
}
function stshfx(p) {
//Menu setup
//alert("stshfx");
    var xy = stgxy(p);
    if (stissc(p)) {
        stssc(xy[2], p);
    }
    stmvto(xy, p);
    stwels(-1, p);
    if (nIEW && st_reg) {
        var ts = stglay(p).filters;
        for (var i = 0, j = i + p.effn[0]; i < j; ++i) {
            if (ts[i].status) {
                ts[i].stop();
            }
            ts[i].apply();
        }
    }
    stshx(p);
    if (nIEW && st_reg) {
        var ts = stglay(p).filters;
        for (var i = 0, j = i + p.effn[0]; i < j; ++i) {
            ts[i].play();
        }
    }
}
function sthdfx(p) {
// Mouse activity
//    alert("**sthdfx");
    if (nIEW && st_reg) {
        var ts = stglay(p).filters;
        for (var i = p.effn[0], j = i + p.effn[1]; i < j; ++i) {
            if (ts[i].status) {
                ts[i].stop();
            }
            ts[i].apply();
        }
    }
    sthdx(p);
    stwels(1, p);
    if (nIEW && st_reg) {
        var ts = stglay(p).filters;
        for (var i = p.effn[0], j = i + p.effn[1]; i < j; ++i) {
            ts[i].play();
        }
    }
}

function stckpg() {
// Move page and reload??
//    alert("stckpg");
    st_rl = 0;
    var w = st_cw, h = st_ch, l = st_cl, t = st_ct;
    st_cw = stgcw();
    st_ch = stgch();
    st_cl = stgcl();
    st_ct = stgct();
    st_scd = st_cl - l || st_ct - t;
    if ((st_cw - w || st_ch - h) && (nOP && nVER < 7 || nNN4)) {
        document.location.reload();
    } else {
        if (!nIEM) {
            stscr();
        }
        st_rl = setTimeout("stckpg();", 25);
    }
}

function stpre(m) {
// Tidy after loading?
//    alert("stpre");
    var p = m.ps[m.ps.length - 1], i = p.is[p.is.length - 1];
    while (1) {
        if (stglay(i)) {
            break;
        }
    }
    if (!nNN4) {
        stfix(m);
    }
    if (m.mtyp != 2) {
        stshow(m.ps[0]);
    }
    if (nIEM) {
        onscroll = onresize = new Function("if(st_scr)clearTimeout(st_scr);st_scr=setTimeout('stscr();',500);");
    } else if (!st_rl) {
        st_cw = stgcw();
        st_ch = stgch();
        st_cl = stgcl();
        st_ct = stgct();
        st_rl = setTimeout("stckpg();", 25);
    }
    m.ready = 1;
}
function stfix(m) {
// Fix a position for a Window?
//alert("stfix");
    for (var j = 0; j < m.ps.length; ++j) {
        var p = m.ps[j], l = stglay(p);
        if (!p.isst && (nOP && nVER >= 7 || nNN6)) {
            document.body.appendChild(l);
        }
        if (nOP && nVER < 6) {
            l.style.pixelWidth = parseInt(stgobj(p.ids + "TB").style.pixelWidth);
        }
        if (nIE5) {
            l.style.width = l.offsetWidth;
        }
    }
}
function stgsp(sp, d) {
    alert("stgsp");
    var i = 0, s = 5;
    if (d < s || nIEM || !stSMSC) {
        return d;
    }
    d = (d - d % s) / s;
    while (d > 0) {
        d -= ++i;
    }
    return Math.min(Math.min(i * s, sp + s), 100 * s);
}
function stscr() {
// Mouse setup....
//    alert("stscr");
    for (var j = 0; j < st_ms.length; ++j) {
        var m = st_ms[j];
        if (m.mtyp == 1) {
            var p = m.ps[0], o = stgobj(p), xy = stgxy(p), rc = stgrc(p);
            if (typeof p.scxs == "undefined") {
                p.scxs = 0;
            }
            if (typeof p.scys == "undefined") {
                p.scys = 0;
            }
            var dx = xy[0] - rc[0], dy = xy[1] - rc[1];
            if (dx || dy) {
                if (stAHWS) {
                    sthdall(m, 0);
                }
                stwels(1, p);
                p.scxs = stgsp(p.scxs, Math.abs(dx));
                p.scys = stgsp(p.scys, Math.abs(dy));
                var x = dx > 0 ? rc[0] + p.scxs : rc[0] - p.scxs, y = dy > 0 ? rc[1] + p.scys : rc[1] - p.scys;
                stmvto([x, y], p);
                if (stissc(p)) {
                    stssc(stgsc(x, y, p), p);
                }
                stwels(-1, p);
            } else {
                p.scxs = p.scys = 0;
                if (stissc(p)) {
                    stwels(1, p);
                    stssc(stgsc(xy[0], xy[1], p), p);
                    stwels(-1, p);
                }
            }
        } else if (st_scd && stAHWS && m.sfrm != window) {
            sthdalx(m, 0);
        }
    }
}
function stmvto(xy, p) {
// Get a fix on position
//    alert("stmvto");
    if (xy && (p.par || stgme(p).mtyp)) {
        var l = stglay(p);
        if (nNN4) {
            l.moveToAbsolute(xy[0], xy[1]);
        } else if (nOP) {
            var s = l.style;
            s.pixelLeft = xy[0];
            s.pixelTop = xy[1];
        } else {
            var s = l.style;
            s.left = xy[0] + "px";
            s.top = xy[1] + "px";
        }
        p.rc = [xy[0], xy[1], p.rc[2], p.rc[3]];
    }
}
function stsdstr(p, s) {
//menu generation
//alert("ALERT 1");
    return "var p=st_ms[" + p.mei + "].ps[" + p.ppi + "];p.tmid=0;" + (s ? "stftsh(" : "stfthd(") + "p);p.exed=1;";
}
//function stevfn(n, i) {
//alert("ALERT 2");
//    return new Function("e", "var r=/Stm(\\d*)p(\\d*)i" + (i ? "(\\d*)e" : "") + "/;r.exec(this.parentLayer.id);var m=RegExp.$1;var p=parseInt(RegExp.$2);" + (i ? "var i=parseInt(RegExp.$3);" : "") + "return " + n + "(e,this,st_ms[m].ps[p]" + (i ? ".is[i]" : "") + ");");
//}
function stppev(p) {
//Mouse setup
//alert("stppev");
//    var value = " onMouseOver='stppov(event,this,st_ms[" + p.mei + "].ps[" + p.ppi + "]);' onMouseOut='stppou(event,this,st_ms[" + p.mei + "].ps[" + p.ppi + "]);'";
//     alert("stppev: " + value);
     var value = "";
     return value;
}
function stitev(i) 
{
//Mouse setup
    with (i)
    {
//        alert("ALERT 3 - ityp: " + ityp);
//        return ityp == 6 ? "" : " onMouseOver='stitov(event,this,st_ms[" + mei + "].ps[" + ppi + "].is[" + iti + "]);' onMouseOut='stitou(event,this,st_ms[" + mei + "].ps[" + ppi + "].is[" + iti + "]);' onClick='stitck(event,this,st_ms[" + mei + "].ps[" + ppi + "].is[" + iti + "]);'";
      if ( ityp == 6 )
      {
         return "";
      }
      else
      { 
//        return " onMouseOver='stitov(event,this,st_ms[" + mei + "].ps[" + ppi + "].is[" + iti + "]);' onMouseOut='stitou(event,this,st_ms[" + mei + "].ps[" + ppi + "].is[" + iti + "]);' onClick='stitck(event,this,st_ms[" + mei + "].ps[" + ppi + "].is[" + iti + "]);'";
         return " onMouseOver='stitov(event,this,st_ms[" + mei + "].ps[" + ppi + "].is[" + iti + "]);'";
      }
   }
}
function stquo(n) {
//Mouse setup
//alert("ALERT 4");
    return "\"" + n + "\"";
}
function stgurl(i, f) {
//    alert("stgurl");
    with (i) {
        return (iurl || f ? "HREF=" + stquo(iurl ? iurl.replace(/"/g, "&quot;").replace(/'/g, "&#39;") : "#") + (iurl && itgt ? " TARGET=" + stquo(itgt) : "") : "") + (istt ? " onMouseOver='return stcstt(st_ms[" + mei + "].ps[" + ppi + "].is[" + iti + "]);' onMouseOut=\"top.status='';return true;\"" : "");
    }
}

function rfmurl(i, f) 
{
    var xx = i;
    var retval = "";
    var url = xx.iurl;
    if ( url == "" )
    {
      return retval;
    }
//    var urlx = url.replace(/"/g, "&quot;").replace(/'/g, "&#39;");
    retval += " ONCLICK='";
    retval += 'script_func(';
    retval += url;
    retval += ')';
    retval += "' ";
    return retval;
}


function stcstt(i) {
alert("ALERT 5");
    top.status = i.istt;
    return true;
}

function stgdec(v) {
// Menu setup
//    var value =  v ? (v & 1 ? "underline " : "") + (v & 2 ? "line-through " : "") + (v & 4 ? "overline" : "") : "none";
//    alert("ALERT 6: " + value + " - " + v);
    var value = "none";
    return value;
}

//function stgimg(src, id, w, h, b, f) {
//alert("ALERT 7");
//    var x = w ? w : f, y = h ? h : f;
//    return "<IMG SRC=" + stquo(src) + (id ? " id=" + id : "") + (w > 0 ? " WIDTH=" + w : "") + (h > 0 ? " HEIGHT=" + h : "") + " BORDER=" + b + ">";
//}

function stgbg(c, i, r) {
// Menu setup
//alert("ALERT 8");
    return i ? c + " url(" + i + ") " + r : c;
}
function stgcur(i) {
//Mouse setup
//alert("ALERT 9");
    return i.ityp != 6 && (i.iurl || stgpar(i).isck && i.sub) ? nNN6 ? "pointer" : "hand" : "default";
}
function stgiws(i) {
alert("ALERT 10");
    var p = stgpar(i);
    return p.pver ? p.plmw > 0 ? " WIDTH=" + (p.plmw + 2) : "" : i.iicw > 0 ? " WIDTH=" + (i.iicw + 2) : "";
}
function stgaws(i) {
alert("ALERT 11");
    var p = stgpar(i);
    return p.pver ? p.prmw > 0 ? " WIDTH=" + (p.prmw + 2) : "" : i.iarw > 0 ? " WIDTH=" + (i.iarw + 2) : "";
}
function stgme(ip) {
//menu generation
//alert("ALERT 12 ");
    var p = st_ms[ip.mei].ps[ip.ppi];
    while (p.par) {
        p = stgpar(p.par);
    }
    return st_ms[p.mei];
}
function stgpar(ip) {
// Menu setup
//alert("ALERT 13");
    return st_ms[ip.mei].ps[ip.ppi];
}
function stgcl() {
//menu generation
//alert("ALERT 14");
    return nIE ? (nIEW && document.compatMode == "CSS1Compat" ? document.documentElement : document.body).scrollLeft : pageXOffset;
}
function stgct() {
//menu generation
//alert("ALERT 15");
    return nIE ? (nIEW && document.compatMode == "CSS1Compat" ? document.documentElement : document.body).scrollTop : pageYOffset;
}
function stgcw() {
//menu generation
//alert("ALERT 16");
    return nIE ? (nIEW && document.compatMode == "CSS1Compat" ? document.documentElement : document.body).clientWidth : innerWidth;
}
function stgch() {
//menu generation
//alert("ALERT 17");
    return nIE ? (nIEW && document.compatMode == "CSS1Compat" ? document.documentElement : document.body).clientHeight : innerHeight;
}
function stgobj(id) {
//menu generation
//alert("ALERT 18");
// return
    with (document) {
        return nIE && nVER < 5 ? all[id] : nNN4 ? layers[id] : getElementById(id);
    }
}
function stglay(ip) {
//menu generation
//alert("ALERT 19");
    if (!ip.layer) {
        ip.layer = !stisit(ip) || nNN6 || nOP5 ? stgobj(ip.ids) : nNN4 ? stglay(stgpar(ip)).document.layers[0].document.layers[ip.ids] : stglay(stgpar(ip)).all.tags("td")[ip.ids];
    }
    return ip.layer;
}
function stgstlay(i) {
alert("ALERT 20");
    return stglay(i).document.layers[0].document.layers;
}
function stgrc(ip) {
//menu generation
//alert("ALERT 21");
    var ly = stglay(ip);
    if (nNN4) {
        return [ly.pageX, ly.pageY, ly.clip.width, ly.clip.height];
    } else {
        var l = 0, t = 0, w = typeof ip.rc == "undefined" ? parseInt(nOP && nVER < 7 ? ly.style.pixelWidth : ly.offsetWidth) : ip.rc[2], h = typeof ip.rc == "undefined" ? parseInt(nOP && nVER < 7 ? ly.style.pixelHeight : ly.offsetHeight) : ip.rc[3];
        while (ly) {
            l += parseInt(ly.offsetLeft);
            t += parseInt(ly.offsetTop);
            if (nIEW && stisit(ip) && ly.id == stgpar(ip).ids + "SC") {
                l -= ly.scrollLeft;
                t -= ly.scrollTop;
            }
            ly = navigator.appVersion.indexOf("Safari") >= 0 &&
                ly.style.position.toLowerCase() == "absolute" ? 0 : ly.offsetParent;
        }
        if (nIEM) {
            l += parseInt(document.body.leftMargin);
        }
        if (stisit(ip)) {
            var p = stgpar(ip);
            if (st_delb) {
                l -= ip.ipbw;
                t -= ip.ipbw;
            }
            if (st_addb) {
                var w = p.ipbw;
                l += w;
                t += w;
            }
            if (nIEM) {
                for (var ly = stgobj((p.pver ? p.ids + ip.iti : p.ids) + "TRR"), t = 0; ly; ly = ly.offsetParent) {
                    t += parseInt(ly.offsetTop);
                }
            } else if (nNN && p.pver) {
                w = parseInt(stgobj(ip.ids + "DR").offsetWidth) + 2 * ip.ipbw;
            }
        } else if (nIEM) {
            w = parseInt(stglay(ip).offsetWidth) - ip.ipbw;
        }
        return [l, t, w, h];
    }
}
function stgxy(p) {
//Menu Generation
//alert("stgxy");
    var sr = stgrc(p), ss = 0;
    p.rc = sr.slice(0);
    if (stissc(p)) {
        var sc = stgobj(p.ids + "SC");
        sr[p.pver ? 3 : 2] = ss = (p.pver ? sc.scrollHeight : sc.scrollWidth) + 2 * p.ipbw + 2 * p.psds;
    }
    if (!p.par) {
        var m = stgme(p), x, y;
        if (m.mtyp) {
            x = eval(m.mcox + "");
            y = eval(m.mcoy + "");
        } else {
            x = sr[0];
            y = sr[1];
        }
        if (nIEW) {
            x -= p.psds;
            y -= p.psds;
        }
        return stissc(p) ? [x, y, stgsc(x, y, p)] : [x, y];
    }
    var ir = stgirc(p.par), l = stgcl() - p.psds + stgspc(p, 2), t = stgct() - p.psds + stgspc(p, 0), r = stgcl() + stgcw() - stgspc(p, 3), b = stgct() + stgch() - stgspc(p, 1), x = p.poffx + ir[0], y = p.poffy + ir[1];
    x -= p.pdir == 1 ? sr[2] : p.pdir == 2 ? p.psds - ir[2] : p.psds;
    y -= p.pdir == 3 ? sr[3] : p.pdir == 4 ? p.psds - ir[3] : p.psds;
    if (stissc(p) && !p.pver) {
        var ms = p.pdir == 1 ? (x = Math.max(Math.min(Math.min(r, ir[0] + p.poffx) - sr[2], x), l), Math.min(ir[0] + p.poffx, r) - x) : (x = p.pdir == 2 ? Math.max(x, l) : Math.max(Math.min(r - sr[2], x), l), r - x);
        ss = ss > ms ? ms : 0;
    } else {
        x = Math.max(Math.min(r - sr[2], x), l);
    }
    if (stissc(p) && p.pver) {
        var ms = p.pdir == 3 ? (y = Math.max(Math.min(Math.min(b, ir[1] + p.poffy) - sr[3], y), t), Math.min(ir[1] + p.poffy, b) - y) : (y = p.pdir == 4 ? Math.max(y, t) : Math.max(Math.min(b - sr[3], y), t), b - y);
        ss = ss > ms ? ms : 0;
    } else {
        y = Math.max(Math.min(b - sr[3], y), t);
    }
    return [x, y, ss];
}
function stbuf(s) {
// Menu setup
//alert("ALERT 22");

    if (s && stBIMG) {
        var i = new Image;
        st_ims[st_ims.length] = i;
        i.src = s;
    }
    return s;
}
function stabs(s) {
// Menu setup
//alert("ALERT 23");
    var t = s.toLowerCase();
    return t.indexOf(":") == 1 &&
        t.charCodeAt() >= "a" && t.charCodeAt() <= "z" ||
        !t.indexOf("http:") ||
        !t.indexOf("https:") ||
        !t.indexOf("file:") ||
        !t.indexOf("ftp:") ||
        !t.indexOf("/") ||
        !t.indexOf("javascript:") ||
        !t.indexOf("mailto:") ||
        !t.indexOf("about:") ||
        !t.indexOf("gopher:") ||
        !t.indexOf("news:") ||
        !t.indexOf("telnet:") || !t.indexOf("wais:");
}
function stgsrc(s, f) {
// Menu setup
//alert("ALERT 24");
    var m = st_ms[st_cm];
    return s ? stabs(s) ? s : m.mweb + s : f ? m.mbnk : s;
}

function stmenu(n) {
alert("ALERT 26");
    for (var j = st_ms.length - 1; j >= 0; --j) {
        if (st_ms[j].mnam == n) {
            return st_ms[j];
        }
    }
    return 0;
}
function stgirc(i) {
//Mouse move???
//alert("ALERT 27");
    var m = stgme(i), w = m.sfrm;
    if (stgpar(i).par || w == window) {
        return stgrc(i);
    }
    m = w.stmenu(m.mnam);
    var rc = w.stgrc(m.ps[0].is[i.iti]), x = rc[0] - w.stgcl(), y = rc[1] - w.stgct();
    i.sub.pdir = 4 - m.mcfd;
    switch (m.mcfd) {
      case 0:
        y -= w.stgch();
        break;
      case 1:
        y += stgch();
        break;
      case 2:
        x -= w.stgcw();
        break;
      case 3:
        x += stgcw();
        break;
      default:;
    }
    return [x + stgcl() + m.mcfx, y + stgct() + m.mcfy, rc[2], rc[3]];
}
function stisit(ip) {
//menu generation
//alert("ALERT 28");
    return typeof ip.iti != "undefined";
}
function stgtgt(i) {
alert("ALERT 30");
    var t = i.itgt;
    if (t == "_self") {
        return window;
    } else if (t == "_parent") {
        return parent;
    } else if (t == "_top") {
        return top;
    } else {
        for (var co = window; co != co.parent; co = co.parent) {
            if (typeof co.parent.frames[t] != "undefined") {
                return co.parent.frames[t];
            }
        }
    }
    return 0;
}
function stgfrm(m) {
// Mouse over??
//alert("ALERT 31");
    if (!m.mcff) {
        return window;
    }
    if (m.mhdd < 1000) {
        m.mhdd = 1000;
    }
    var a = m.mcff.split("."), w = "parent";
    for (var j = 0; j < a.length; ++j) {
        w += "." + a[j];
        if (typeof eval(w) == "undefined") {
            return 0;
        }
    }
    return eval("parent." + m.mcff);
}
function stgspc(p, d) {
//Mouse move in??
//alert("ALERT 32");
    var m = stgme(p), w = m.sfrm;
    return p.par &&
        !p.par.ppi &&
        w != window && stdmld(w) && w.stmenu(m.mnam).mcfd == d ? stCFSP : stSCSP;
}
//function stdmld(w) {
//alert("ALERT 34");
//    return typeof w.st_load != "undefined" && w.st_load;
//}
function stissc(p) {
//Mouse setup
//alert("ALERT 35");
// Use this one!
    return nIEW && nVER >= 5 && p.ppi && stgme(p).mscm[p.pver];
}
function stwels(c, p) {
//menu generation
//alert("ALERT 42");
// Use thos one!
    var m = stgme(p);
    if (!st_load || nNN4 || nOP || p.isst) {
        return;
    }
    if (m.mhds && !nIEM) {
        stwtag("SELECT", c, p);
    }
    if (m.mhdo && nIE4) {
        stwtag("OBJECT", c, p);
        stwtag("APPLET", c, p);
    }
    if (m.mhdi && (nIEM || nIEW && nVER < 5.5)) {
        stwtag("IFRAME", c, p);
    }
}
function stwtag(tg, c, p) {
//Mouse move in??
//alert("ALERT 43");
    if ( document.getElementsByTagName(tg) )
    {
      var es =  document.getElementsByTagName(tg);
    }
    else
    {
      var es = document.all.tags(tg)
    }    
    for (var j = 0; j < es.length; ++j) {
        var f = 0, e = es.item(j);
        for (var t = e.offsetParent; t; t = t.offsetParent) {
            if (t.id && t.id.indexOf("Stm") >= 0) {
                f = 1;
            }
        }
        if (f) {
            continue;
        } else if (stwover(e, p)) {
            if (e.visLevel) {
                e.visLevel += c;
            } else {
                e.visLevel = c;
            }
            if (e.visLevel == -1) {
                if (typeof e.visSave == "undefined") {
                    e.visSave = e.style.visibility;
                }
                e.style.visibility = "hidden";
                if (typeof mywehd != "undefined" && mywehd(e)) {
                    return;
                }
            } else if (!e.visLevel) {
                if (typeof mywesh != "undefined" && mywesh(e)) {
                    return;
                }
                e.style.visibility = e.visSave;
            }
        }
    }
}

function stcurl(i, c) {
    alert("stcurl");
    var t = stgtgt(i);
    var u = t ? t.location.href : "", h = i.iurl;
    if (!c) {
        u = u.toLowerCase();
        h = h.toLowerCase();
    }
    if (u && h) {
        if (!h.indexOf("file:////")) {
            h = h.replace(/[\/]{4,}/, "//");
        } else if (h.charAt(0) == "/") {
            var re = /(file:\/{2,}[^\/]+\/|http:\/\/[^\/]+\/|https:\/\/[^\/]+\/)/;
            re.exec(u);
            var s = RegExp.$1, n, r;
            r = s && !u.indexOf(s) ? s.substr(0, s.length - 1) : "";
            h = r ? r + h : "";
        } else if (!stabs(h)) {
            h = u.substr(0, u.lastIndexOf("/") + 1) + h;
        }
    }
    while (h.indexOf("/./") > 0) {
        h = h.replace(/\/\.\//, "/");
    }
    while (h.indexOf("/../") > 0) {
        h = h.replace(/[^\/]*\/\.\.\//, "");
    }
    return u == h || u == h + "/";
}


function stm_bm(a) {
//   Menu set up
//   Begin menu;
   var w = a[2] && a[2].charAt(a[2].length - 1) != "/" ? a[2] + "/" : a[2];
   var p = a.length > 15 ? a[15] && a[15].charAt(a[15].length - 1) != "/" ? a[15] + "/" : a[15] : "";
   st_ms[st_cm] = {ps: [], mscm: [0, 0], mei: st_cm, ids: "Stm" + st_cm + "p", hdid: 0, cked: 0, cfrm: 0, tfrm: window, sfrm: window, mcff: "", mcfd: 0, mcfn: 0, mcfb: 1, mcfx: 0, mcfy: 0, mnam: a[0], mver: a[1], mweb: w, mbnk: stbuf(w + a[3]), mtyp: a[4], mcox: a[5], mcoy: a[6], maln: stHAL[a[7]], mcks: a[8], msdv: a[9], msdh: a[10], mhdd: nNN4 ? Math.max(100, a[11]) : a[11], mhds: a[12], mhdo: a[13], mhdi: a[14], mpre: p, args: a.slice(0), mwid: a.length > 16 ? a[16] : "", midn: a.length > 17 ? a[17] : 0};
//alert("MIDN - " + st_ms[st_cm].midn);
}


function stm_em() {
//   Menu set up
// End menu tree
    if (!st_cm) 
    {
        stsetld();
    }
    var m = st_ms[st_cm];
    if (!m.ps.length) 
    {
        return --st_ms.length;
    }
    
    var mh = "";
    for (var n = nDM ? m.ps.length : 1, j = 0; j < n; ++j) {
        var p = m.ps[j], ph = (p.isst && m.maln != "left" ? "<TABLE BORDER=0 STYLE='border:none;padding:0px;' CELLPADDING=0 CELLSPACING=0 ALIGN=" + m.maln + "><tr><TD class=st_tdcss>" : "") + stpbtx(p);
        if (!p.pver) 
	{
            ph += "<tr id=" + p.ids + "TRR>";
        }
        if (stissc(p))
	{
            ph += stsctx(p, 0);
        }
        for (var k = 0; k < p.is.length; ++k) {
            var i = p.is[k];
            if (i.ityp != 6) 
	    {
                i.ibgd = [stgbg(i.ibgc[0], i.ibgi[0], i.ibgr[0]), stgbg(i.ibgc[1], i.ibgi[1], i.ibgr[1])];
            }
            ph += p.pver ? "<tr id=" + p.ids + i.iti + "TRR>" + stittx(i) + "</tr>" : stittx(i);
        }
        if (stissc(p)) {
            ph += stsctx(p, 1);
        }
        if (!p.pver) {
            ph += "</tr>";
        }
        ph += stpetx(p);
        if (p.isst && m.maln != "left") {
            ph += "</td></tr></table>";
        }
        if (p.isst || nNN || !nDM) {
            mh += ph;
        } else {
            st_ht += ph;
        }
    }
    if (mh) {
        var yyy = SSS.slice();
	yyy +=  mh.slice();
        var xxx = yyy.replace(/on[Cc]lick/g,"dummy").
        replace(/CELLSPACING=2/g,"CELLSPACING=0").
        replace(/CELLSPACING=3/g,"CELLSPACING=0").
        replace(/CELLSPACING=0/g," ").
        replace(/CELLPADDING=0/g," ").
        replace(/on[Mm]ouse[Oo]ver/g,"onClick").
	replace(/on[Mm]ouse[Oo]ut/g,"dummy2");
	var MHTML = xxx.slice();
	var MHTMLX = MHTML.
	replace(/-9999/g,"0");
	document.write(MHTMLX);
        document.close();
//	var MHTMLY = MHTMLX.replace(/</g,"<br>\&lt;");
//        top.xx.document.write(MHTMLY);
//        top.xx.document.close();
    }
    ++st_cm;
//    alert("st_cm - " + st_cm);
    st_cp = 0;
    st_ci = 0;
}

function stsetld() {
//menu generation
    if (nDM) {
        if (typeof onload != "undefined" &&
            onload != st_onload && onload) {
            stusrld[stusrld.length] = onload;
        }
        onload = st_onload;
    }
}

function st_onload() {
// Check wherer loaded?
    if (st_load) {
        return;
    }
    for (var j = 0; j < st_ms.length; ++j) {
        stpre(st_ms[j]);
    }
    st_load = 1;
    for (var i = stusrld.length - 1; i >= 0; --i) 
    {
        stusrld[i]();
    }
    stusrld.length = 0;
    for (var j = 0; j < st_ms.length; ++j)
    {
        var m = st_ms[j];
        for (var k = 0; k < m.ps.length; ++k)
	{
            var p = m.ps[k];
            if (p.issh && p.exed)
	    {
                stwels(-1, p);
            }
        }
    }
}
function script_func (num)
{
//  alert("SCRIPT_FUNC");
//  alert(SCRIPT_ARRAY[num]);
  if ( STATE_ARRAY[num] == "FREE" )
  {
      eval(SCRIPT_ARRAY[num]);
  }
  else if ( STATE_ARRAY[num] == "CLOSE" )
  {
      eval(CLOSE_ARRAY[num]);
      STATE_ARRAY[num] = "FREE";
  }
//  return;

  var xx = false;

  if ( xx )
  {
    alert("OK");
    var yy = document.getElementById(xx);
    var kids = yy.childNodes;
    var numkids = kids.length;
    var id = "";
    var pos = 0;
    var title = "";
    var darray = document.getElementsByTagName("div");
    ldiv = darray.length;
    var matchs = NAME_ARRAY[num] + '_';
    for ( var i = 0; i < ldiv; i++ )
    {
      title = darray[i].title;
      if (title)
      {
	pos = title.indexOf(matchs);
      }
    }
  }
}

if (document.title == "CDS/DL Homepage")
{
  PAGE_CALL = "home";
}
else if (document.title == "Homepage")
{
  PAGE_CALL = "home";
}
else if (document.title == "-")
{
  PAGE_CALL = "no_menu";
}
else if (document.title != "")
{
  PAGE_CALL = "lower";
}
else
{
  PAGE_CALL = "no_menu";
}

if ( PAGE_CALL == "home" )
{
  var loco = window.location.href;
//  ROOT = loco.replace(/^https/,"http").
  ROOT = loco.replace(/^http:/,"https:").
         replace(/\/\//,'~').
	 replace(/\/.*/,'').
	 replace(/~/,'//');
  var locox = loco.replace(/:.*/,'');
  var addr = loco.replace(/.*:/,'');
  top.ADDR = addr.slice();
  var rootname = '';
  rootname = loco.replace(/.*:\/\//,'').replace(/\/.*/,'/').replace(/^/,'http://');
  var USERNAME = cookit();
  var redirect = '';
//  redirect += 'https:';
//  redirect += top.ADDR;

  if ( locox == 'http' )
  {
    redirect = go_redirect();
    redirect = 'REDIRECT';
  }
}

//setTimeout('go_redirect(top.ADDR)',30000);

function go_redirect (aa)
{
  var redirect = ''
  redirect += 'https:';
  redirect += aa;
  var REDIRECT  = '';
  REDIRECT += '<meta http-equiv="refresh" content="0;URL=';
  REDIRECT += "'";
  REDIRECT += redirect;
  REDIRECT += "'";
  REDIRECT += '" />';
  document.write(REDIRECT);
}



//***** Do not edit this file directly - change .js files *****
//
// links_functions.js 
//

function blinkob(ii,m,a,b,s)
{
//   alert("BLINKOB");
   var name = s[1];
   var mode = s[0];

   m[name] = new Object();
   m[name].name = name;
   m[name].address = s[2];
   m[name].store_text = s[3];
   m[name].menu_text1_bold = s[4];
   m[name].menu_text1 = s[5];
   m[name].menu_text2_bold = s[6];
   m[name].menu_text2 = s[7];

   var i = ii[0];
   var j = ii[1];

   a[i] = name;
   i = i + 1;
   
   if( mode == "store" ) {
     b[j] = name;
     j = j + 1;
   }

   ii[0] = i;
   ii[1] = j;

   return 0;
}


//
// rfm_functions.js 
//

function genstart()
{
  var a;
  BLSELF = "_blank";
  STARTING = true;
  MENULEV = 0;
  
  var len = arguments.length;
  if ( len === 0 ) 
    {
       a = "";
    }
  else 
    {
       a = arguments[0];
    }
  BPSTART = BPA;
  AIMAIN = AIA;
  BPNEXT = BPXAR;

  if ( a == "NEWS" ) 
  {
     BPSTART = BPANEWS;
     AIMAIN = AINEWS;
     BPNEXT = BPXAR;
  }
  else if ( a == "SIDE" )
  {
     BPSTART = BPA;
     AIMAIN = AIA;
     BPNEXT = BPXAR;
  }
  else if ( a == "SIDEX" )
  {
     BPSTART = BPXXX;
     AIMAIN = AIA;
     BPNEXT = BPXAR;
     BLSELF = "_self";
  }
  else if ( a == "PMENU" )
  {
     BPSTART = BPXXX;
     AIMAIN = AITOPR;
     BPNEXT = BPYYY;
     BLSELF = "_self";
  }
  else if ( a == "TOP" )
  {
     BPSTART = BPATOP;
     AIMAIN = AITOP;
     BPNEXT = BPXAD;
  }
  else if ( a == "TOPS" )
  {
     BPSTART = BPATOP;
     BPNEXT = BPXAD;
  }
  else if ( a == "QUICK" )
  {
     BPSTART = BPATOP;
     AIMAIN = AIQUICK;
     BPNEXT = BPXAQ;
  }
  else if ( a == "QUACK" )
  {
     BPSTART = BPATOP;
     AIMAIN = AIREFS;
     BPNEXT = BPXAQ;
  }
  else if ( a == "QUACKX" )
  {
     BPSTART = BPATOP;
     AIMAIN = AIREFSX;
     BPNEXT = BPXAQ;
  }
  else if ( a == "QUACKY" )
  {
     BPSTART = BPATOP;
     AIMAIN = AIREFSY;
     BPNEXT = BPXAQ;
  }
  else if ( a == "REFS" )
  {
     BPSTART = BPATOP;
     AIMAIN = AIREFS;
     BPNEXT = BPXAQ;
  }
}

function uptree()
{
  var i;
  var rise;
  var len = arguments.length;
  if (len === 0)
  {
    MENULEV = MENULEV - 1;
    stm_ep();
    return;
  }
  else
  {
    rise = arguments[0];
    for ( i = 0; i < rise; i++)
    {
      MENULEV = MENULEV - 1;
      stm_ep();
    }
    return;
  }
}

function catstring()
{
  var len = arguments.length;
  if ( len === 0 ) 
    {
       return " ";
    }
  if ( len  == 1 ) 
    { 
       cat = arguments[0]; 
       return cat; 
    }
  cat = "<b>" + arguments[0] + "    </b><i>" + arguments[1] + "</i>"; 
  cat = arguments[0];
  return cat;
}

function genlink()
{
  var link = "";
  var cat = "";
  var aia = new Array();
  var bpa = new Array();
  var len = arguments.length;
  var a = arguments[0];
  var b = arguments[1];
  var title = "";
  var address = "";
  if ( len >= 3 ) 
  { 
     address = arguments[2];
     title = catstring(a,b);
  }
  else 
  {
     title = a;
     address = b;
  }
  if ( ( address == "LINKL" ) || ( address == "LINKR" ) || 
     ( address == "START" ) || ( address == "MAIN" ) ||
     ( address == "LINKS" ) || ( address == "STARTX" ) ||
     ( address == "MAINX" ) || ( address == "LINKD" ) )
  {
      if ( address == "LINKD" )
      {
 	  aia = AIXAD;
	  bpa = BPXAD;
          address = "";
      }
      if ( address == "LINKL" )
      {
 	  aia = AIXAL;
	  bpa = BPXAL;
          address = "";
      }
      else if ( address == "LINKR" )
      {
	 aia = AIXAR;
         bpa = BPXAR;
         address = "";
      }
      else if ( address == "LINKS" )
      {
	 aia = AIXAB;
         bpa = BPXAR;
         address = "";
      }
      else if ( address == "MAIN" )
      {
         aia = AIMAIN;
         bpa = BPNEXT;
         address = "";
      }
      else if ( address == "MAINX" )
      {
         aia = AIAHX;
         bpa = BPNEXT;
         address = "";
      }
      else if ( address == "START" )
      {
         aia = AIMAIN;
         bpa = BPNEXT;
      }
      else if ( address == "STARTX" )
      {
         aia = AIAHX;
         bpa = BPNEXT;
      }
      link = "LINK";
      MENULEV = MENULEV + 1;
  }
  else if ( address == "HEADING" )
  {
      aia = AIHEADING;
	  bpa = BPXAL;
      address = "";
  }
  else if ( address == "DUMMY" )
  {
      aia = AIDUMMY;
	  bpa = BPXAL;
      address = "";
  }
  else if ( LINK_FORMAT == "DEFAULT")
  {
      aia = AIXA;
  }
  else
  {
      aia = AIMAIN;
  }      
  aia[1] = title;
  aia[7] = address;
  aia[8] = BLSELF;
  if ( ( address !== "START" ) && ( address !== "STARTX") )
    {
       stm_aix("X1","X1",aia);
    }
  if  ( link == "LINK" )
  {
      if ( ( address == "START" ) || ( address == "STARTX" ) )
      {
	 aia[7] = "";
         stm_bm(BM,this);
	 stm_bp("XX",BPSTART);
	 stm_ai("X1",aia);
	 stm_bpx("XX","XX",bpa);
      }
      else 
      {
         stm_bpx("XX","XX",bpa);
      }
  }
  STARTING = false;
  return;
}

function gendirect()
{
  var link = "";
  var cat = "";
  var len = arguments.length;
  var a = arguments[0];
  var b = arguments[1];
  var title = "";
  var address = "";
  var aia = new Array();
  if ( len >= 3 ) 
  { 
     address = arguments[2];
     title = catstring(a,b);
     var key = true;
  }
  else 
  {
     title = a;
     address = b;
     var key = true;
  }
  aia = AIXAB;
  aia[1] = title;
  aia[7] = address;
  stm_aix("X1","X1",aia);
  return;
}

function linkl() {
   var narg = arguments.length;
   if ( narg == 1 ) 
     {
        genlink(arguments[0],"LINKL");
     }
   else 
     {
        genlink(arguments[0],arguments[1],"LINKL");
     }
}

function linkr() {
   var narg = arguments.length;
   if ( narg == 1 ) 
     {
        genlink(arguments[0],"LINKR");
     }
   else 
     {
        genlink(arguments[0],arguments[1],"LINKR");
     }
}

function linkd() {
   var narg = arguments.length;
   if ( narg == 1 ) 
     {
        genlink(arguments[0],"LINKD");
     }
   else 
     {
        genlink(arguments[0],arguments[1],"LINKD");
     }
}

function new_link() {
   var num = "1";
   var menu = new Object();
   var name = arguments[0];
   menu = MENU_O[name];
   var c = menu.address;
        
   if ( arguments.length == 2 )
     {
        num = arguments[1];
     } 
   var a = menu["menu_text" + num + "_bold"];
   var b = menu["menu_text" + num];
    		
   if ( a === "" ) 
     {
        genlink(b,c);
     }
   else 
     {
        genlink(a,b,c);
     }
     
}

function genheader(a) {
     genlink(a,"HEADING");
}

function gendummy()
{
  genlink("DUMMY","DUMMY");
}



//
// bottoms.js 
//
// As the name implies, this is the javascript for the bottom of the page

function site_search() {
  var blk = "&nbsp;";
  var blk2 = blk +blk;
  var blk4 = blk2 + blk2;
  var blk8 = blk4 + blk4;

  var ret = "";

  ret += '<br /><br />';

  var title = document.title;
  if ( title == "Search the Site" )
  {
    ret = "<br />"
  }
  return ret;
}

function upstring() {

  var months = new Array(13);
  months[1] = "Jan";
  months[2] = "Feb";
  months[3] = "Mar";
  months[4] = "Apr";
  months[5] = "May";
  months[6] = "Jun";
  months[7] = "Jul";
  months[8] = "Aug";
  months[9] = "Sep";
  months[10] = "Oct";
  months[11] = "Nov";
  months[12] = "Dec";
  var dateObj = new Date(document.lastModified);
  var lmonth = months[dateObj.getMonth() + 1];
  var date = dateObj.getDate();
  var fyear = dateObj.getYear();
  if (fyear < 2000) 
  {
     fyear = fyear + 1900;
  }
  var ret = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;modified&nbsp;";
  ret += lmonth + "&nbsp;" + date + ",&nbsp;" + fyear;
  return ret;
}

function genbottom() {
   if ( PAGE_CALL == 'redirect' )
   {
     return ''
   }
   var ret = "";
   var taba = "<table class='fline'>";
   var tabb = "</table>";

   var texta = "<tr><td class='tdlhx'>";
   texta += "XXX";
   texta += "</td></tr>"; 

   var text = taba + texta + tabb;

   var text1 = '<table class="bottom"><tr><td><div>';
   var text2 = '</div></td></tr></table>';

   if ( PAGE_CALL !== "home" )
   {
     ret += "<br /><br />";
   }
   else if (PAGE_CALL == "lower") {
     ret += "</div></div>";
   }
   else if (PAGE_CALL == "no_bottom") {
     ret += "";
   }
   else if (PAGE_CALL == "home" ) {
     ret +="</div>";
   }
   ret += text1.slice();
   ret += '<div align="center">';
   ret += querycom();
   ret += '</div>';
   ret += text2.slice();
   return ret;
}

function botwin(name) {
  var target = " target='botwin_" + name + "' ";
  target += " class='noline' ";
  return target;
}

function querycom() {

    var blk = "&nbsp;";

    var td = "<td>";
    var rtd = "<td>";
    var ltd = "<td>";
    var ctd = "<td>";
    var etd = "</td>";
    var tabrow = "<table><tr>";
    var etabrow = "</tr></table>";
    var rowrow = "</tr><tr>";
    
    var tdspacer = td + "&nbsp;&nbsp;&nbsp;" +etd;

    var stfc = "";
    stfc += '<div class="alleft">';
    stfc += "<a href='https://stfc.ukri.org' ";
    stfc += botwin("stfc");
    stfc += " onMouseOver=\"window.status='To Science &amp; ";
    stfc += "Technology Facilities Council Homepage';";
    stfc += "return true;\" ";
    stfc += " onMouseOut=\"";
    stfc += "window.status=\' \';return true;\">";
//    stfc += "<img src='/cds/assets/images/stfclogo66.gif' ";
    stfc += "<img src='/cds/assets/images/ukri_stfc.jpg' ";
    stfc += "alt='STFC Link' width='180' >";
    stfc += "</a>";
    stfc += "</div>";

    var elogo = "";
    elogo += '<div class="alright">';
    elogo += "<a href='/cds/background_material.html' ";
    elogo += botwin("elogo");
    elogo += " onMouseOver=\"window.status=\'To STFC CDS Info\';";
    elogo += "return true;\" ";
    elogo += " onMouseOut=\"";
    elogo += "window.status=\' \';return true;\">";
    elogo += "<img src='/cds/assets/images/glucose.jpg' ";
    elogo += "alt='Homepage' width='80' >";
    elogo += "</a>";
    elogo += "</div>";

    var contact ="<div class='address'>";
    contact += "Send queries and comments to ";
    contact += "<font class='email'>";
    contact += '<a class="noline" '; 
    contact += "href='mailto:cdsbb@stfc.ac.uk'>";
    contact += "cdsbb@stfc.ac.uk";
    contact += "</a>";
    contact += "</font>";
    contact += "</div>";

    var tohome = "";


    var search ="<div class='search'>";
    search += site_search();
    search += "</div>";

    var update ="<div class='update'>";
    update += upstring();
    update += "</div>";

    var title = document.title;

    var homex = "<div class='home'>";
    if ( title === "" ){
      title += "A CDS Page";
    }
    homex += title;
    homex += "</div>";
    
    var epsrc = ""; 
    var retdl = "";
    retdl += "the Server is operated at Daresbury by the ";
    retdl += "<a href=";
    retdl += "'http://stfc.ukri.org/SCD'";
    retdl += botwin("retdl");
    retdl += "onMouseOver=\"window.status=";
    retdl += "\'About the SCD at Daresbury\'; ";
    retdl += "return true; \"";
    retdl += "onMouseOut=\"window.status=\' \'; return true;\">";
    retdl += "SCD";
    retdl += "</a>";

    var weare = "";
    weare += "<div class='footy'>";
    weare += epsrc;
    weare += retdl;
    weare += "</div>";

    var tdblk = ctd + blk + etd;
    var tdhomex = ctd + homex + etd;
    var tdstfc = rtd + stfc + etd;
    var tdupdate = ltd + update + etd; 
    var tdelogo = rtd + elogo + etd;
    var tdweare = ltd + weare + etd;
    var tdcon = ltd + contact + etd;
    var tdser = ctd + search + etd;

    var tableft = ctd + tabrow + tdhomex + rowrow;
    tableft += tdstfc + etabrow + etd;

    var tabcen = ctd + tabrow + tdser + rowrow + tdcon + rowrow; 
    tabcen += tdweare + etabrow + etd;

    var tabright = ctd + tabrow + tdelogo + rowrow;
    tabright += rowrow + tdupdate + etabrow + etd;

    var ret = "";
    ret += tabrow + tableft + tdspacer + tabcen + tabright + etabrow;
    return ret;

}

if ( PAGE_CALL == "no_menu" )
{ 
    BOTTOM_HOME_HTML = "</div></div>";;
}
else
{
    BOTTOM_HOME_HTML = genbottom();;
}

function home_bottom (mode)
{
   alert("RETURN");
   return;
}

var fs = "";
fs +=  '<form action="/cgi-bin/rfm/news_html.cgi">';
fs += '<input type="submit">';
fs += '</form>';

top.FORMSCRIPT = fs.slice();
//
// main_banner.js 
//


var blk = "&nbsp;";
var blk2 = blk +blk;
var blk3 = blk +blk2;
var blk4 = blk2 + blk2;
var blk5 = blk4 + blk;
var blk6 = blk2 + blk4;
var blk8 = blk4 + blk4;
var blk16 = blk8 + blk8;
var blk24 = blk8 + blk16;
var blk32 = blk16 + blk16;

var brk = "<br>";
var ediv = "</div>";
var efont = "</font>";

var a;
var aa;
var ab;
var ac;
var ad;
var ae;

a = "<img src='/cds/assets/images/glucose.jpg' width='90'";
a += " alt='CDS Logo' align='middle'>";

var glucose = a.slice();

//PAGE_CALL = "lower";
//PAGE_CALL = "no_bottom";

if (PAGE_CALL == "homex") {
  a =  "<div class='cdsbanner'>";
}
else {
  a =  "<div class='cdsbannerx'>";
}  


//a += '<font class="cdsbanner_italic">';
//a += "STFC ";
//a += "</font>";
a += "CrystalWorks Server";
a += "</div>";

var poster = a.slice();

a = "";
a += "<font class='search'>";
a += blk;
a += efont;
a += brk;

if (PAGE_CALL == "home") {
  a += "<div class='padc'>" + blk + ediv;
}
else {
  a += "<div class='padcx'>" + blk + ediv;
}  

a="";

var search = a;

var home_menux = "<script type='text/javascript'>topmenu_mainx()</script> ";
var home_menuy = "<script type='text/javascript'>topmenu_mainy()</script> ";
var home_top = "<script>var dummy='';dummy = topmenu_top();</script> ";

//home_top = "";


if (PAGE_CALL == "home") {
  var home_menu = "<script type='text/javascript'>topmenu_top()</script> ";
  home_menu = "";
}
else {
  var home_menu = "<script type='text/javascript'>topmenu_main()</script> ";
}  

ab = "<td class='bancol'>";
ab += poster;
ab += "</td>";

//ac = "<td class='bancol'>";
//ac += blk8;
//ac += "</td> ";

//ad = "<td class='bancol'>";
//ad += blk4;
//ad += "</td> ";

//ae = "<td class='bancol'>";
//ae += search; 
//ae += "</td>";


//ac = "";
//ad = "";
//ae = "";

var table = "<table  class='ban'><tr>";
table += ab;
table += "</tr></table> ";

a = "";
a += table;
a += "<div class='spacea'>"+blk+"</div>";
a += home_menu;

var oldhead = a.slice();

a = "";
a += table;
a += "<div class='spacea'>"+blk+"</div>";
a += home_menux;

var newhead = a.slice();

a = "";
a += table;
a += "<div class='spacea'>"+blk+"</div>";
a += home_menuy;

var newhead2 = a.slice();

a = "";
a += table;
a += "<div class='spacea'>"+blk+"</div>";
a += home_top;

var newtop = a.slice();

var picture = "";

if (PAGE_CALL !== "home" ) 
{
   picture = '<a target="homepg" class="tohome" href="/" >';
   picture += glucose;
   picture += "<br />&nbsp;To&nbsp;Home&nbsp;";
   picture += "</a>";
}

var toptab = "<table class='global'><tr><td class='global'>";
toptab += "<table><tr><td>";

var bottab = "</td></tr></table>";
bottab += "</td></tr></table>";

//BANNER_HOME_HTML = toptab + picture  + "</td><td>" + oldhead + bottab;
BANNER_HOME_HTML = toptab + picture  + "</td><td>" + newtop + bottab;
if ( PAGE_CALL !== 'redirect' )
{
  BANNER_HOME_TOP = toptab + picture  + "</td><td>" + newtop + bottab;
  BANNER_HOME_HTMLX = toptab + picture  + "</td><td>" + newhead + bottab;
  BANNER_HOME_HTMLY = toptab + picture  + "</td><td>" + newhead2 + bottab;
}
else
{
  BANNER_HOME_TOP = '';
  BANNER_HOME_HTMLX = '';
  BANNER_HOME_HTMLY = '';
}

var main_css = "<style type='text/css'>";
main_css += "body {overflow: auto}";
main_css += "</style>";

// End DIV Tag(s) generated in bottom.js
var botdiv = "";

//alert("PAGE_CALL: " + PAGE_CALL);

if (PAGE_CALL == "lower") {
   botdiv += "<div class='main_lower'>";
   botdiv += "<div class='main_lower_in'>";
}
if (PAGE_CALL == "no_menu") {
   botdiv += "<div class='main_nomenu'>";
   botdiv += "<div class='main_lower_in'>";
   document.write(main_css);
}
else if (PAGE_CALL == "lower_menu") {
   botdiv += "<div class='main_lower_t3'>";
}   
else if (PAGE_CALL == "no_bottom") {
   botdiv += "";
}   
else if (PAGE_CALL == "home") {
//   botdiv += "<div class='main_home'>";
}

botdiv="";

//BANNER_HOME_HTML="";

//botdiv = "";

BANNER_HOME_HTML += botdiv;
BANNER_HOME_HTMLX += botdiv;
BANNER_HOME_HTMLY += botdiv;

//
// menu_functions.js 
//


function quick_goy(a,b) {
   genstart(a);
//   var title = "&nbsp;&nbsp;Access Data&nbsp;&nbsp;";
   var title = "&nbsp; to CrystalWorks&nbsp;";
   genlink(title,b);
   guts_quicky();
   uptree();
}

function link_go(a,b,c) { 
   var xxx = LINK_FORMAT;
   LINK_FORMAT = a;
   genstart(a);
   genlink(b,c);
   LINK_FORMAT = xxx;
}

function registration_go(a,b) { 
   genstart(a);
   genlink(" Registration ",b);
   guts_registration();
   uptree();
}

function general_go(a,b) {
   genstart(a);
   genlink("   Service Overview ",b);
   guts_general();
   uptree();
}

function databases_go(a,b) {
   genstart(a);
   genlink("&nbsp;Databases ",b);
   guts_databases();
   uptree();
}

function news_go(a,b) {
   genstart(a);
   genlink("&nbsp;Archives ",b);
   guts_news();
   uptree();
}

function menu_go(a,b) {
   genstart(a);
   genlink("This Menu &nbsp;",b);
   var br = "<br />";
   var text = "";
   text += '<h4 class="leftx">';
   text += "Navigating the CDS/DL top menu";
   text += "</h4>";
   text += "Clicking on a heading opens its set ";
   text += "of related menu items.";

   text += "Just click on a new heading to select another set. ";
   text += "Reclick on a currently selected heading to close the tree.";

   text += br;
   text += br;

   text += "Please note that when you click anywhere outside the menu area ";
   text += "it no longer has any effect";
   
   text += br;
   text += br;
   
   text += 'Items marked with the "&#8226;" ';
   text += "symbol link to a webpages with ";
   text += "further information.";
   
   text += 'Those marked with "&laquo;" or "&raquo;" ';
   text += "extend the menu tree with ";
   text += "further items ";
   text += "(positioned to left or right). ";
   
   text += "As might be expected "
   text += "it is possible to select an alternative ";
   text += "menu branch or simply close down a current one.";
   
   genheader(text);
   uptree();
}

function rsc_go(a,b) {
   genstart(a);
   genlink("&nbsp; to the PSDS portal &nbsp;",b);
   var br = "<br />";
   var text = "";
   text += '<h4 class="leftx">';
   text += "Link to PSDS portal";
   text += "</h4>";
   genheader(text);
   url_link("Go to the PSDS portal","https://psds.ac.uk");
   uptree();
}

function twitter_go(a,b) {
   genstart(a);
   var text = "";
   text += '&nbsp;&nbsp;&nbsp;';
   text += '<img src="/cds/assets/images/twitter.png" ';
   text +=  'width="15" alt="CDS Twitter" > ';
   text += 'Twitter &nbsp;';
   genlink(text,b);
   text = "";
   var br = "<br />";
   var text = "";
   text += '<h4 class="leftx">';
   text += "Links to Twitter pages";
   text += "</h4>";
   genheader(text);
   url_link("Access @cds_daresbury","https://twitter.com/cds_daresbury");
   url_link("Access @psds_uk","https://twitter.com/psds_uk");
   uptree();
}

function topmenu_top() {
     quick_goy("QUICK","START");
     databases_go("TOP","MAIN");
     menu_go("TOP","MAIN");
     registration_go("QUICK","MAIN");
     news_go("TOP","MAIN");
     twitter_go("TOP","MAIN");
     rsc_go("QUACKY","MAIN");
     menu_wrap();
     return "";
}

function guts_databases() {
      var text =  "";
      text += '<h4 class="leftx">';
      text += "Only Crystal Structures ";
      text += "databases are supported";
      text += "</h4>";      
      genheader(text);
      var text = "";
      text  = "General Information ";
      url_link(text,"/cds/datasets/crys/crystal.html");
      text  = "CrystalWorks ";
      text += "<i>Searching over ";
      text += "the major crystallographic databases</i>";
      menu_link_r(text);
         text = '<h4 class="leftx">';
         text += "About CrystalWorks ";
         text += "</h4>";      
         genheader(text);
         url_link("CrystalWorks Overview",
         "/cds/datasets/crys/cweb/cworks.html");
         url_link("News <i>Information about CDS/DL Implementation</i>",
         "/cgi-bin/news/disp?cworks");
         uptree();
      text  = "CSD ";
      text += "<i>Organics &amp; Organometallics"
      menu_link_r(text);
         text = '<h4 class="leftx">';
         text += "About the Cambridge Structural Database ";
         text += "</h4>";      

         genheader(text);
         url_link("CSD Overview",
          "/cds/datasets/crys/csd/csd.html");
         url_link("News <i>Information about CDS/DL Implementation</i>",
          "/cgi-bin/news/disp?csds");
         uptree();
      text  = "ICSD ";
      text += "<i>Inorganic, Mineral &amp; Metal Structures</i>";
      menu_link_r(text);
         text = '<h4 class="leftx">';
         text += "About the Inorganic Crystal Structure Database";
         text += "</h4>";      
         genheader(text);
         url_link("ICSD Overview",
           "/cds/datasets/crys/icsd/llicsd.html");
         url_link("News <i>Information about CDS/DL Implementation</i>",
           "/cgi-bin/news/disp?icsd");
         uptree();
      text  = "CrystMet ";
      text += "<i>Metals, Alloys &amp; Intermetallics</i>";
      menu_link_r(text);
        text = '<h4 class="leftx">';
        text += "About the CrystMet Database ";
        text += "</h4>";      

        genheader(text);
        url_link("CrystMet Overview",
         "/cds/datasets/crys/mdf/llmdf.html");
        url_link("News <i>Information about CDS/DL Implementation</i>",
           "/cgi-bin/news/disp?crystmet");
         uptree();
      text = "Crystallography Open Database ";
      text += "<i>Open-access crystal structures</i>";
      menu_link_r(text);
         text = '<h4 class="leftx">';
         text += "About the Crystallography Open Database ";
         text += "</h4>";      

         genheader(text);
         url_link("COD Home Site <i>(Lithuania)</i>",
           "https://www.crystallography.net/");
         url_link("News <i>Information about CDS/DL Implementation</i>",
           "/cgi-bin/news/disp?COD");
         uptree();
//      url_link("PeakQuest <i>Powder Diffraction Search/Match</i>",
//       "/cds/peakquest/peakquest.html");
//      uptree();
}

function guts_registration() {
   var text = "";
   text += '<h4 class="leftx">'
   text += "Register or update your details";
   text += '</h4>'
   genheader(text);
   url_link("Online Registration","/cgi-bin/reg/express_uk");
   url_link("Change your Password","/cds/pass.html");
   url_link("Check your Details","/cgi-bin/login/details");
   url_link("Modify your details or unsubscribe","/cgi-bin/reg/modify");
   url_link("Lost Username / contact Daresbury","/cds/unsubscribe.html");
}

function guts_news() {
   var text = "";
   text += '<h4 class="leftx">';
   text += "News &amp; Background";
   text += "</h4>";
   genheader(text);
   url_link("News Files ","/cgi-bin/news/news");
   url_link("Broadcast Messages ","/cgi-bin/news/messages");
   url_link("Newsletters ",
    "/cds/news_and_highlights/newsletters/home.html");
   url_link("Research Highlights ",
    "/cds/news_and_highlights/research/res_high.html");
   url_link("Background Material and  Reports ",
    "/cds/background_material.html");
}

//
// guts_quick.js 
//

links_ass("MENU_A","STORE_A","MENU_O");

strings_ass("STRINGS_O");

function DisplayPropertyNames(obj) {
  var names = "";
  var ii = 0;
  var ray = new Array();
  for (var name in obj){ 
     names += "value " + name + " + ";
     ray[ii++] =name;
  }
  alert(names);
  alert(ii);
  for (var i = 0; i < ii; i++ ) 
  {
     alert(ray[i]); 
  }
}

function strings_ass(X) {
  var k = new String();
  var m = new Object();
  var s = new Array();
  var c = 0;

// TEMPLATE

  k = "TEMPLATE";
  
  s[c++] = "item_name";
  s[c++] = "item_value";


  c = bstringob(m,k,s,c);

// DETHERM related text

  k  = "detherm";
 
  s[c++] = "number_datasets";
  s[c++] = "~5.88 million";
  
  s[c++] = "number_system";
  s[c++] = "127,000";

  s[c++] = "pure_substances";
  s[c++] = "26,500";

  s[c++] = "mixtures";
  s[c++] = "101,300";

  s[c++] = "properties";
  s[c++] = "500";

  s[c++] = "item_name";
  s[c++] = "item_value";


  c = bstringob(m,k,s,c);

// Cambridge Strucural Database

  k = "cambridge";
  
  s[c++] = "software_version";
  s[c++] = "CSD V5.29";

  s[c++] = "data_update";
  s[c++] = "25/01/08";

  s[c++] = "total_entries";
  s[c++] = "436,384";

  s[c++] = "update_freq";
  s[c++] = "quarterly";

  s[c++] = "item_name";
  s[c++] = "item_value";

  c = bstringob(m,k,s,c);

//
  parent[X] = m;
}

function bstringob(m,k,s,top) {
 var name = new String(); 
 var subname = new String(); 
 
 name = k;

 if (!(m[name] instanceof  Object)) {
     m[name] = new Object();
 }
 
 var count = 0;
 while ( count < top ) {
    subname = s[count];
    m[name][subname] = new Object();
    m[name][subname] = s[count + 1]; 
    count += 2;
 }

return 0;
}

function links_ass(X,Y,Z) {

var iii = 0;
var a = new Array();
var b = new Array();
var m = new Object();
var S = new Array();
var N = new Array();
var O = new Array();
var P = new Array();
var D = new Array();
var CGI = new Array();

var A = "http://cds.dl.ac.uk/cds/";
var B = "http://cds.dl.ac.uk/";
var C = "https://cdsdt.dl.ac.uk/";
var G = "http://cds.dl.ac.uk/cgi-bin/";
var GS = "https://cds.dl.ac.uk/cgi-bin/";

N = ["store","",A,"","","","",""];

O = N.slice();
O[0] = "";

CGI = N.slice();
CGI[2] = G;  

CGIS = N.slice();
CGIS[2] = GS;  

P = O.slice();
P[2] = B;

D = P.slice();
D[2] = C;

var ii = [0,0];


S = CGI.slice();
S[1] = "eligibility";
S[2] += "reg/cou";
S[3] = "CDS Conditions of Use";
S[4] = "";
S[5] = "Eligibility and Conditions of Use";
S[6] = "";
S[7] = "";
iii = blinkob(ii,m,a,b,S);

S = P.slice();
S[1] = "registration";
S[2] += "cds/registration/regcds.html";
S[3] = "Online Registration";
S[5] = "Registration (older method)";
iii = blinkob(ii,m,a,b,S);

S = CGI.slice();
S[1] = "express_registration";
S[2] += "reg/express_uk";
S[3] = "Online Registration";
//S[4] = "Online Registration  - within STFC domain only";
S[4] = "Online Registration";
iii = blinkob(ii,m,a,b,S);

S = P.slice();
S[1] = "lostpass_cancel";
S[2] += "cds/unsubscribe.html";
S[3] = "Lost Password or Unsubscribe";
S[4] = "Lost Password or Unsubscribe";
iii = blinkob(ii,m,a,b,S);


S = D.slice();
S[1] = "run_detherm";
S[4] = "";
S[5] = "Detherm - STFC domain only";
S[6] = "Detherm again: ";
S[7] = "italic info";
iii = blinkob(ii,m,a,b,S);


parent[X] = new Array();
parent[Y] = new Array();
parent[Z] = new Object();


parent[X] = a;
parent[Y] = b;
parent[Z] = m;

}

function guts_quicky() {
   var text = "";
   text += '<h3 class="leftx">';
   text += "Access CrystalWorks";
   text += "</h3>";
   genheader(text);

//   genheader("Search &amp; display");
   

   url_link("Search all databases - <i>login required</i>",
   "/cgi-bin/rfm/crystalworks_demo_classicplus");



   url_link("Search COD - <i>open access</i>",
   "/cgi-bin/rfm/crystalworks_demo_cod");


//   genheader("Example Hits List - <i>open access</i>");

//   url_link("View sample entries (old version)",
//   "/cgi-bin/rfm/crystalworks_cds_dl_hitslist");

 
   genheader("Examples Webpages - <i>open access</i>");
//   url_link("View sample CrystalWorks entries",
//   "/cgi-bin/rfm/crystalworks_demo_hitslist");
   url_link_t("Overview with example web pages &amp; demonstration hits list",
   "/cgi-bin/cw_page/link_to_cworks.html","SUMMARY");
   url_link_t("The Crystallography365 project - <i>structures for each day of the year</i>",
   "/cgi-bin/cw_page/examples_365.html","CRYST365");
   url_link_t("The Frank Hoffmann Space Group project - <i>examples for all 230 groups</i>",
   "/cgi-bin/cw_page/examples_230.html","HOFF_230");
   url_link_t("Mineral structures - <i>examples from the Hoffmann site</i>",
   "/cgi-bin/cw_page/examples_minerals.html","HOFF_MINS");
   url_link_t("MOF structures - <i>examples from the Hoffmann site</i>",
   "/cgi-bin/cw_page/examples_mofs.html","HOFF_MOFS");
   url_link_t("Mineral - <i>from the 365Minerals Twitter Feed</i>",
   "/cgi-bin/cw_page/examples_rocks.html","365MINERALS");
   url_link_t("MinCup2020 - <i>a favourite Mineral Knockout Competition</i>",
   "/cgi-bin/cw_page/examples_mincup20.html","MINCUP20");
}


//
// topy.js 
//

function topy() {
   external_go("TOPS","MAIN");
   downloads_go("TOPS","MAIN");
   training_go("TOPS","MAIN");
   databases_go("TOPS","MAIN");
   registration_go("TOPS","MAIN");
   general_go("TOPS","MAIN");
   link_go("TOPS"," Homepage ","http:/");
   menu_wrap();
}
function go_topy() {
genstart("PMENU");
genlink("_","START");
topy();
}
//
// total_side.js 
//

HEADER1 ="<br\t/><font\tclass=\"sidepage\">Page\tLinks</font>";
HEADER2 = "<font\tclass=\"sidepage\">Further\tTopics</font>";
function general_banner() {
   document.write(BANNER_HTML1);
   document.write(BANNER_HTML2);
   document.write(BANNER_HTML3);
   genstart("PMENU");
   genlink(BANNER_TEXT,"STARTX");
topy();
   document.write(BANNER_HTML4);
}


function total_side() {
// CDS Logo Stuff
//document.write(LOGOA);
//document.write("<center>");
//document.write(SUGAR);
//document.write("</center>");
//document.write(LOGOB);
//document.write("");

// Related Links
genstart("PMENU");
//genlink("Page Links","STARTX");
genlink(HEADER1,"STARTX");
uptree();
side_items(1);
// News Section - Page specific items
genlink("News Items","LINKS");
side_items(2);


// General News Stuff
//genlink("General News","LINKR");
//genlink("News Archive","/cgi-bin/news/news");
//genlink("Message Archive","/cgi-bin/news/messages");
uptree(2);
//
uptree();

// Further Topics
genlink("","MAINX");
uptree();
//genlink("Further Topics","MAINX");
genlink(HEADER2,"MAINX");
uptree();


// Page specific General Topics
side_items(3);
//



// wrap up Side Menu
uptree();
stm_em();

}
//
// news_files_pulldown.js 
//

function news_file_main() {
   len = arguments.length;
   var a = arguments[0];
   var b = "Links to related Topics and other News Pages";
   if ( len == 2 )
   { 
     var bb = arguments[1];
     if ( bb != "" ) 
     {
       b = bb;
     }
   }
   news_file_go("REFS","START",a,b);
   menu_wrap();
}

function web_file_sub() {
   len = arguments.length;
   var a = arguments[0];
   var b = "Links to News Pages and related Topics";
   if ( len == 2 )
   { 
     var bb = arguments[1];
     if ( bb != "" ) 
     {
       b = bb;
     }
   }
   web_subfile_go("REFS","START",a,b);
   menu_wrap();
}

function web_file_main() {
   len = arguments.length;
   var a = arguments[0];
   var b = "Links to News Pages and related Topics";
   b += " - click this menu bar for details";
   if ( len == 2 )
   { 
     var bb = arguments[1];
     if ( bb != "" ) 
     {
       b = bb;
     }
   }
   web_file_go("REFS","START",a,b);
   menu_wrap();
}

function news_file_go(a,b,c,d) {
     var B = c.replace(/_draft/,"");
     genstart(a);
     var D = " " + d + " ";
     genlink(D,b);
     guts_news_file(B,"news");
     uptree();
}

function web_file_go(a,b,c,d) {
     var B = c.replace(/_draft/,"");
     genstart(a);
     var D = " " + d + " ";
     genlink(D,b);
     guts_news_file(B,"web");
     uptree();
}

function web_subfile_go(a,b,c,d) {
     var B = c.replace(/_draft/,"");
     genstart(a);
     var D = " " + d + " ";
     genlink(D,b);
     guts_news_file(B,"subpage");
     uptree();
}

function guts_news_file(a,b) {
   if ( a == "peakquest") {
     genheader("Related Links");
     if ( b == "news" )
     {
       genlink("CDS PeakQuest Overview webpage",
       "/cds/peakquest/peakquest.html");
     }
     genlink("Brian Toby CMPR &amp; LOGIC webpages",
     "/cds/peakquest/cmpr.html");
     genlink("CDS X-Windows webpage",
     "/cds/interface_and_utilities/llinter.html");
     genlink("CDS Secure Shell access webpage",
     "/cds/interface_and_utilities/secureshell.html");
     genheader("Related News Pages");
     if ( b != "news" )
     {
        genlink("PeakQuest","/cgi-bin/news/disp?peakquest");
     }
     genlink("The Inorganic Crystal Structure Database","/cgi-bin/news/disp?icsd");
     genlink("The Cambridge Crystallographic Structure Database",
        "/cgi-bin/news/disp?csds");
     genlink("The CrystMet Database (metals, intermetallics and alloys",
        "/cgi-bin/news/disp?crystmet");
   }
   if ( a == "cworks") {
     genheader("Related Links");
     if ( b == "news" || b == "subpage" )
     {
       genlink("The CrystalWorks webpage",
       "/cds/datasets/crys/cweb/cworks.html");
     }
     genlink("Examples webpages linked to CrystalWorks",
     "/cgi-bin/cw_page/link_to_cworks.html");
     genlink("The Crystallographic Open Database (COD)",
     "https://www.crystallography.net/");
     genlink("Crystallographic Datasets on the CDS",
      "/cds/datasets/crys/crystal.html");
     genlink("About Jmol",
      "http://jmol.sourceforge.net/");
     genlink("About JSmol",
      "http://wiki.jmol.org/index.php/JSmol");
     genlink("EMBL-EBI UniChem ",
      "https://www.ebi.ac.uk/unichem/info/general");
     genlink("UniChem data sources",
      "https://www.ebi.ac.uk/unichem/ucquery/listSources");
     genlink("OpenBabel format converter",
      "http://openbabel.org/docs/2.3.0/FileFormats/Overview.html");
     genlink("About CrossRef","http://www.crossref.org/");
     genlink("About ChemSpider",
      "http://www.chemspider.com/");
     genlink("eCrystals Federation Project",
      "http://wiki.ecrystals.chem.soton.ac.uk/index.php/Main_Page");
     genlink("IUPAC International Chemical Identifier (InChI)",
      "http://www.iupac.org/inchi/");
     genheader("Related News Pages");
     if ( b != "news" )
     {
        genlink("CrystalWorks","/cgi-bin/news/disp?cworks");
     }
     genlink("Cambridge Database","/cgi-bin/news/disp?csds");
     genlink("ICSD","/cgi-bin/news/disp?icsd");
     genlink("CrystMet","/cgi-bin/news/disp?crystmet");
   }
   else if ( a == "csds" ) {
     genheader("Related Links");
     if ( b == "news" )
     {
       genlink("The CDS Cambridge Structural Database Web Page",
        "/cds/datasets/crys/csd/csd.html");
     }
     genlink("Key Cambridge packages provided by the CDS",
      "/cds/datasets/crys/csd/training_material.html");
     genlink("The Cambridge Crystallographic Data Centre Website",
      "http://www.ccdc.cam.ac.uk");
     genlink("Full Cambridge product range",
      "http://www.ccdc.cam.ac.uk/products/");
     genlink("Contents and expiry of latest Cambridge full Release",
      "/cds/datasets/crys/csd/csd_links/release_notes_contents_info.html");
     genlink("Whats new with the latest Cambridge full Release",
      "/cds/datasets/crys/csd/csd_links/release_notes_wotsnew.html");
     genlink("Summary of Crystallographic Datasets on the CDS ",
      "/cds/datasets/crys/crystal.html");
     genlink("The CrystalWorks webpage",
       "/cds/datasets/crys/cweb/cworks.html");
     genlink("The CrystalWeb webpage",
       "/cds/datasets/crys/cweb/cweb.html");
     genheader("Related News Pages");
     if ( b != "news" )
     {
       genlink("CSDS","/cgi-bin/news/disp?csds");
     }
     genlink("CrystalWorks","/cgi-bin/news/disp?cworks");
     genlink("CrystalWeb","/cgi-bin/news/disp?crystalweb");
     genlink("ConQuest",
      "/cgi-bin/news/disp?conquest");
     genlink("Mercury","/cgi-bin/news/disp?mercury");
     genlink("IsoStar","/cgi-bin/news/disp?isostar");
     genlink("Mogul","/cgi-bin/news/disp?mogul");
     genlink("ICSD","/cgi-bin/news/disp?icsd");
     genlink("CrystMet","/cgi-bin/news/disp?crystmet");
   }
   else if ( a == "conquest" ) {
     genheader("Related Links");
     genlink("The CDS ConQuest webpage",
      "/cds/datasets/crys/csd/conquest/conquest.html");
     genlink("Cambridge ConQuest Product Description",
      "/cds/datasets/crys/csd/csd_links/csd_conquest_prod.html");
     genlink("Cambridge ConQuest Support Documentation",
      "/cds/datasets/crys/csd/csd_links/csd_conquest.html");
     genlink("Contents and expiry of latest Cambridge full Release",
      "/cds/datasets/crys/csd/csd_links/release_notes_contents_info.html");
     genlink("Whats new with the latest Cambridge full Release",
      "/cds/datasets/crys/csd/csd_links/release_notes_wotsnew.html");
//     genlink("Cambridge Release Notes",
//      "/cds/datasets/crys/csd/csd_links/release_notes.html");
     genlink("Link to full Cambridge Documentation",
      "/cds/datasets/crys/csd/training_material.html");
     genlink("Summary of Crystallographic Datasets on the CDS",
      "/cds/datasets/crys/crystal.html");
     genheader("Related News Pages");
     genlink("News about all CSD component provided by the CDS",
      "/cgi-bin/news/disp?csds");
  }
   else if ( a == "mercury" ) {
     genheader("Related Links");
     genlink("The CDS Mercury webpage",
      "/cds/datasets/crys/csd/mercury/mercury.html");
     genlink("Paper on Mercury Data Analysis Module",
      "http://dx.doi.org/10.1107/S0021889811014622");
     genlink("Cambridge Mercury Product Description",
      "/cds/datasets/crys/csd/csd_links/csd_mercury_prod.html");
     genlink("Cambridge Material Module Product Description",
      "/cds/datasets/crys/csd/csd_links/csd_materials_prod.html");
     genlink("Cambridge Mercury Support Documentation",
      "/cds/datasets/crys/csd/csd_links/csd_mercury.html");
     genlink("Contents and expiry of latest Cambridge full Release",
      "/cds/datasets/crys/csd/csd_links/release_notes_contents_info.html");
     genlink("Whats new with the latest Cambridge full Release",
      "/cds/datasets/crys/csd/csd_links/release_notes_wotsnew.html");
//     genlink("Cambridge Release Notes",
//      "/cds/datasets/crys/csd/csd_links/release_notes.html");
     genlink("Link to full Cambridge Documentation",
      "/cds/datasets/crys/csd/training_material.html");
     genlink("Summary of Crystallographic Datasets on the CDS",
      "/cds/datasets/crys/crystal.html");
     genheader("Related News Pages");
     genlink("News about all CSD component provided by the CDS",
      "/cgi-bin/news/disp?csds");
  }
   else if ( a == "mogul" ) {
     genheader("Related Links");
     genlink("The CDS Mogul webpage",
      "/cds/datasets/crys/csd/mogul/mogul.html");
     genlink("Cambridge Mogul Product Description",
      "/cds/datasets/crys/csd/csd_links/csd_mogul_prod.html");
     genlink("Cambridge Mogul Support Documentation",
      "/cds/datasets/crys/csd/csd_links/csd_mogul.html");
     genlink("Contents and expiry of latest Cambridge full Release",
      "/cds/datasets/crys/csd/csd_links/release_notes_contents_info.html");
     genlink("Whats new with the latest Cambridge full Release",
      "/cds/datasets/crys/csd/csd_links/release_notes_wotsnew.html");
//     genlink("Cambridge Release Notes",
//      "/cds/datasets/crys/csd/csd_links/release_notes.html");
     genlink("Link to full Cambridge Documentation",
      "/cds/datasets/crys/csd/training_material.html");
     genlink("Summary of Crystallographic Datasets on the CDS",
      "/cds/datasets/crys/crystal.html");
     genheader("Related News Pages");
     genlink("News about the IsoStar Knowledge Base",
      "/cgi-bin/news/disp?isostar");
     genlink("News about all CSD component provided by the CDS",
      "/cgi-bin/news/disp?csds");
  }
   else if ( a == "isostar" ) {
     genheader("Related Links");
     genlink("The CDS IsoStar webpage",
      "/cds/datasets/crys/csd/isostar/isostar.html");
     genlink("Cambridge IsoStar Product Description",
      "/cds/datasets/crys/csd/csd_links/csd_isostar_prod.html");
     genlink("Cambridge IsoStar Support Documentation",
      "/cds/datasets/crys/csd/csd_links/csd_isostar.html");
     genlink("IsoStar Client CDS download page",
      "/cds/download/isostar.html");
     genlink("Contents and expiry of latest Cambridge full Release",
      "/cds/datasets/crys/csd/csd_links/release_notes_contents_info.html");
     genlink("Whats new with the latest Cambridge full Release",
      "/cds/datasets/crys/csd/csd_links/release_notes_wotsnew.html");
//     genlink("Cambridge Release Notes",
//      "/cds/datasets/crys/csd/csd_links/release_notes.html");
     genlink("Link to full Cambridge Documentation",
      "/cds/datasets/crys/csd/training_material.html");
     genlink("Summary of Crystallographic Datasets on the CDS",
      "/cds/datasets/crys/crystal.html");
     genheader("Related News Pages");
     genlink("News about the Mogul Knowledge Base",
      "/cgi-bin/news/disp?isostar");
     genlink("News about Mercury",
      "/cgi-bin/news/disp?mercury");
     genlink("News about all CSD component provided by the CDS",
      "/cgi-bin/news/disp?csds");
  }
   else if ( a == "service_changes" ) {
     genheader("Related Links");
     genlink("Download to Putty client for SSH access with Windows",
      "http://putty.org");
     genlink("Download the WinSCP client for FTP access with Windows ",
      "http://www.winscp.net");
   }
   else if ( a == "ilabs" ) {
     genheader("Related Links");
     if ( b == "news" )
     {
        genlink("I-Labs 2.0 webpage",
         "/cds/datasets/spec/ilab/ilab2.html");
        genlink("Original I-Labs webpage (incl. ChemSketch)",
         "/cds/datasets/spec/ilab/ilab.html");
     }
     genlink("Physical properties via DETHERM",
       "/cds/datasets/physchem/detherm/detherm.html");
     genheader("Related News Pages");
     if ( b != "news" )
     {
        genlink("ACD/Labs ",
         "/cgi-bin/news/disp?ilabs");
     }
     genlink("Detherm ",
      "/cgi-bin/news/disp?detherm");
   }
   else if ( a == "detherm" ) {
     genheader("Related Links");
     if ( b == "news" )
     {
       genlink("The CDS Detherm webpage",
        "/cds/datasets/physchem/detherm/detherm.html");
     }
     genlink("The DECHEMA website ",
      "http://www.dechema.de/en/The+DECHEMA-p-1.html");
     genlink("Summary of Detherm Components ",
      "/cds/datasets/physchem/detherm/dt-datafiles.html");
     genlink("Flash Movies - incl. Detherm ",
      "/cds/help/flashmovies.html");
     genlink("Detherm Poster PDF ",
      "/cds/download/ftp/pdf/detherm2poster.pdf");
     genlink("Detherm technical details on DECHEMA site ",
      "http://www.dechema.de/Detherm-lang-en.html");
     genlink("the IK-CAPE PPDX format ",
      "http://www.dechema.de/en/Publications/Engineering+Software/IK_CAPE+PPDX.html");
     genlink("Download the Detherm client ",
      "/cds/download/detherm.html");
     genlink("Detherm Quick Start manual ",
      "/ftp/detherm/DETHERM.pdf");
     genlink("Detherm examples sheet ",
      "/cds/download/ftp/pdf/DethermExamples.pdf");
     genlink("Physical properties data via ACD/Labs ",
      "/cds/datasets/spec/ilab/ilab.html");
     genheader("Related News Pages");
     if ( b != "news" )
     {
        genlink("Detherm ",
         "/cgi-bin/news/disp?detherm");
     }
     genlink("ACD/Labs ",
       "/cgi-bin/news/disp?ilabs");
     
   }
   else if ( a == "icsd" ) {
     genheader("Related Links");
     if ( b == "news" )
     {
        genlink("ICSD webpage",
         "/cds/datasets/crys/icsd/llicsd.html");
     }
     genlink("Summary of Crystallographic Datasets on the CDS ",
      "/cds/datasets/crys/crystal.html");
     genheader("Related News Pages");
     if ( b != "news" )
     {
        genlink("ICSD ",
         "/cgi-bin/news/disp?icsd");
     }
     genlink("CrystalWorks ",
      "/cgi-bin/news/disp?cworks");
     genlink("Cambridge Crystallographic Database ",
      "/cgi-bin/news/disp?csds");
     genlink("CrystMet ",
      "/cgi-bin/news/disp?crystmet");
   }
   else if ( a == "crystmet" ) {
     genheader("Related Links");
     genlink("Summary of Crystallographic Datasets on the CDS ",
      "/cds/datasets/crys/crystal.html");
     genlink("Toth Information Systems site ",
      "http://www.tothcanada.com/");
     genheader("Related News Pages");
     genlink("CrystalWorks ",
      "/cgi-bin/news/disp?cworks");
     genlink("CrystalWeb ",
      "/cgi-bin/news/disp?crystalweb");
     genlink("Cambridge Crystallographic Database ",
      "/cgi-bin/news/disp?csds");
     genlink("ICSD ",
      "/cgi-bin/news/disp?icsd");
   }
   else if ( a == "newsletter" ) {
     genheader("Related Links");
     genlink("Newsletter Archive ",
      "/cds/news_and_highlights/newsletters/home.html");
     genlink("Research Highlights Archive ",
      "/cds/news_and_highlights/research/res_high.html");
   }
   else if ( a == "RIN_JISC_survey" ) {
     genheader("Related Links");
     genlink("The Research Information Network Site",
     "http://www.rin.ac.uk");
     genlink("The JISC Site",
     "http://www.jisc.ac.uk");
     genlink("Aims of RIN/JISC Research Data Centres Study","http://www.rin.ac.uk/our-work/data-management-and-curation/benefits-research-data-centres");
   }
   else if ( a == "tender" ) {
     genheader("Related Links");
     genlink("Community Statement of Need for a UK Chemical Database Facility",
     "/epsrc_reports/epsrc_pdfs/ChemicalDatabaseFacilitySoN.pdf");
     genlink("EPSRC Chemical Database Service discussion list",
     "https://www.jiscmail.ac.uk/cgi-bin/webadmin?A0=CDS-UK");
     genlink("The RSC/CDS site",
     "http://cds.rsc.org/");
     genlink("Chemistry World article",
     "http://www.rsc.org/chemistryworld/2012/12/chemical-database-service-rsc");
   }
   
     genlink("Full CDS News Archive ","/cgi-bin/news/news");

}
//
// page_links_pulldown.js 
//


function page_links_main(a) {
   page_links_go("REFS","START",a);
   menu_wrap();
}


function page_links_go(a,b,c) {
     var A = c.replace(/_rfm_draft/,"");
     var B = A.replace(/_draft/,"");
     genstart(a);
     genlink(" Page related links ",b);
     guts_page_links(B);
     uptree();
}

function guts_page_links(a) {
   if ( a == "detherm") {
     genheader("Related Links");
     genlink("eCrystals Federation Project",
      "http://wiki.ecrystals.chem.soton.ac.uk/index.php/Main_Page");
     genheader("Related News Files");
     genlink("CrystalWeb News","/cgi-bin/news/disp?crystalweb");
     genlink("ConQuest News",
      "/cgi-bin/news/disp?conquest");
     genlink("Detherm News","/cgi-bin/news/disp?detherm");
   }
   
   genheader("CDS News Archives");
   guts_news();
}

function cookit ()
{
  var allcook = document.cookie;
  var len = allcook.length;
  var logtrue = allcook.indexOf("cdsLdap=");
//  alert('logtrue: ' + logtrue);
  var loguser = allcook.indexOf("cdsUser=");
  if ( loguser == -1)
  {
    return "NONE";
  }
  else
  {
    var userx = allcook.substring(loguser + 8 , len);
    var usern = userx.indexOf(";");
    end = userx.length;
    if ( usern != -1 )
    {
      end = usern;
    }
    var user = userx.substring(0,end);
    return user.toLowerCase();
  }    
}
function timeit ()
{
  var i = 0;
  var ii = 0;
  var jj = 0;
  var age = 0;
  var allcook = document.cookie;
  var len = allcook.length;
  var logtrue = allcook.indexOf("cdsLdap=");
  if ( logtrue != -1)
  {
    var dateob = new Date();
    ii =  dateob.getTime();
    var utime = allcook.substring(logtrue + 22 , len);
    i = utime.indexOf(";");
    if ( i != -1 )
    {
      jj = parseInt(utime.substring( 0 , i ));
    }
    else
    { 
      jj = utime;
    }
    age = ( ( ii / 1000 ) - ( jj / 100 ) ) / 60 ;
  }
  return parseInt(age.toString());
}  
var acc_dat = 'Registered for CrystalWorks?';
var log_first = '';
var log_ok = '" to use ';

var USERNAME = cookit();
var AGE = timeit();

//alert("USERNAME: " + USERNAME);
//alert("AGE: " + AGE);

var G = "";
var G2 = "";

if ( PAGE_CALL !== 'redirect' )
{
  G += '<div class="logob"> CDS@DL</div>';
  G += '<div class="middle">';
  G += '<img src="/cds/assets/images/glucose.jpg" ';
  G += 'width="125" alt="CDS Logo">';
  G += '</div>';
  G += '<div class="logoa" >';
  G += 'Daresbury&nbsp;Laboratory';
  G += '</div>';
}

GRAPHIC = G.slice();

G = "";

if ( AGE > 1440 )
{
  USERNAME = "NONE";
}

var S = "";
var S2 = "";
S += '<br />';
S += '<table><tr><td class="lrpad">';
S += '<font class="h3r">login below...</font>';
S += '<form ';
S += 'action="/cgi-bin/login/login"';
//S += 'action="/cgi-bin/login/loginhandler.cgi"';
S += ' method=POST>'
S += '<fieldset class="xxx" id="login">';
//S += '<label class="h3q" for="id"></label>';
S += '<input  class="uname" id="id" name="id"  type="text" ';
S += 'placeholder=" username" ';
S += '/>';
S += '<br />';
//S += '<label class="h3q" for="pasx"></label>';
S += '<input class="uname" id="pass" name="pass" type="password" ';
S += 'placeholder=" password" ';
S += '/>';
S += '<label class="right2" for="fog" >';
S += '<a class="noline" id="fog" target="forgot" '; 
S += 'href="/cgi-bin/reg/passchangeweb.cgi"'
S += '>Reset<br />Password?</a></label>';
S += '<div class="formtextx">';
S += '<input type="submit" value="Login" class="submit">';
S += '</div>';
S += '</fieldset>';
S += '</form>';
S += '</td></tr></table></div>';

S2 += '<br />';
S2 += '<table><tr><td class="lrpad">';
S2 += '<font class="h3">Use your CDS/DL username</font>';
//S2 == '<div>';
S2 += '<form ';
S2 += 'action="http://cds.dl.ac.uk/cgi-bin/login/loginhandler2.cgi"';
S2 += ' method=POST>'
S2 += '<fieldset class="xxx" id="login">';
S2 += '<label class="h3z" for="id">Username:</label>';
S2 += '<input  class="uname" id="id" name="id"  type="text" />';
S2 += '<br />';
S2 += '<label class="h3z" for="pass">Password:</label>';
S2 += '<input class="uname" id="pass" name="pass" type="password" />';
S2 += '<label class="right" for="pass">';
S2 += '<a class="noline" target="forgot" '; 
S2 += 'href="http://cds6.dl.ac.uk/cgi-bin/reg/passchangeweb.cgi"'
S2 += '>Forgot<br />Password?</a></label>';
S2 += '<div class="formtext">';
S2 += '<input type="submit" value="Login" class="submit">';
S2 += '</div>';
S2 += '</fieldset>';
S2 += '</form>';
S2 += '</td></tr></table></div>';

//alert(S);
//alert(S2);


G = '<h3 class="h3xx">';
G += ' '
G += '</h3>';
G += '<font class="h3x">';
G += '<br />';
if ( USERNAME != "NONE" )
{
  G += 'You can now use the ';
  G += ' link in<br />the top menu';
  G += ' to run all CDS/DL option';
  G = '';
  G += '<br /><br />';
  G += '<font class="h3r">';
  G += 'You are logged in ';
  if ( USERNAME != "NOCOOKIE" )
  {
    G += 'as "';
    G += USERNAME;
    G += '"';
    G += '</font>';
  }
  else
  {
    G += '...';
  }
  G += '<br /><br />';
  G += '<form ';
  G += 'action="/cgi-bin/login/logout"';
  G += ' method=POST>'
  G += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
  G += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
  G += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
  G += '<input type="submit" value="Logout" class="submit">';
  G += '</form>';
  G += '<br />';
  G += 'Logout after your CDS@DL session';
  G2 = G.slice();
}
else
{
//  alert("ALERT");
  G += log_first; 
  G += acc_dat;
  G2 = G.slice();
  G +=  S.slice();
  G2 +=  S2.slice();
}
G += '</font>';
G2 += '</font>';

ACTION = G.slice();
ACTION2 = G2.slice();
//redirect = '';
if ( redirect != '' )
{
  ACTION = '';
  ACTION2 = '';
}


NEWS_HEAD = "";

function newswin(name) {
  var target ="newswin " + name;
  var target2 = target.replace(/ /g,"_");
  var target3 = " target=\"" + target2 + "\" ";
  return target3;
}

function get_top_news(text,href,swind)
{
  var dt = "<dt class='news'>";
  var dta = "<dt class='newsa'>";
  var a = "<a  class='news' href='";
  var quote = "'\n ";
  var echev = ">";
  var font = "<font class='newsc'>";
  var efont = "</font>";
  var target = newswin(swind); 
  var ea = "</a>";
  var edt = "</dt>\n";
  var rett = " return true;'";
  var movera = " onMouseOver='window.status=\"";
  var moverb = "\";" + rett;
  var mout = " onMouseOut='window.status=\" \";" +rett;
  var top_news = "";
  if (text !== "" ) {
    var texta = text.slice(0,1);
    var textb = text.slice(1);
    if (href == "NULL") {
      top_news = dta;
      top_news += text;
      top_news += edt;
    }
    else {
      var top_news = dt;
      top_news += a;  
      top.news += href; 
      top_news += quote; 
      top_news += movera;
      top_news += swind;
      top_news += moverb;
      top_news += mout;
      top_news += target;
      top_news += echev;
      top_news += font;
      top_news += texta;
      top_news += efont;
      top_news += textb;
      top_news += ea; 
      top_news += edt;
      }
    }
    return top_news;
}
function disp_html(a,aa)
{ 
  var h;
  var b;
  var c;
  h = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">";
  h += "<html><head><title>Test JS HTML</title></head><body>";
  b = h.replace(/</g,"&lt;");
  b += "<pre>";
  b += a.replace(/</g,"&lt;");
  b += aa.replace(/</g,"&lt;");
  c = b.replace(/>/g,"><br>");
  c += "</pre>";
  h = "</body></html>";
  c += h.replace(/</g,"&lt;");
  return c;
}


var text;
var href;
var swind;
var messcode;
var mess_root = "/cgi-bin/news/dispm?";
var news_root = "/cgi-bin/news/disp?";


messcode = "2012-02-20-CWeb_available";

href = mess_root + messcode;
text = "Hello Mum";
swind = "STATUS B";

text = "";

TOP_NEWS = "";
NEWS_HEAD  = '';
NEWS_FOOT  = '';
NEWS_TOP  = '';
NEWS_TAIL  = '';

if ( PAGE_CALL == 'home' )
{
  NEWS_HEAD += '<h3 class="h3xx">';
  NEWS_HEAD += 'CDS@DL&nbsp;News';
  NEWS_HEAD += '</h3>';
  NEWS_TAIL +=  '<dt class="newsa_work">';
  NEWS_TAIL += 'Click top menu ';
  NEWS_TAIL += '<b>Archives</b> header ';
  NEWS_TAIL += 'for older News and other items. ';
  NEWS_TAIL += '</dt>';
}

function getNewWin(aa,bb)
{
  var nav = navigator.appName;
  var agent = navigator.userAgent;
  var appnum = nav.search("Netscape");
  if ( appnum == -1 )
  {
    var value = "close";
  }
  else
  {
    agentnum=agent.search("Safari");
    if ( agentnum != -1 )
    {
      var value = "leave";
    } 
    else
    {
      var value = "close";
    }
  }
  if (value == "leave" )
  {
    return true;  
  }
  var myWindow=window.open('',aa);
  myWindow.close();
  window.open(bb,aa);
  return false;
}
