// -= Menu Arrays =-
var menuListBase = new Array(
"HOME",       "1","*",
"SPLASH",     "2","index.html",
"ABOUT",      "2","HOME/abou.htm",
"SETUP",      "2","HOME/cnfg.htm",
"CHAT",       "2","HOME/chat.php",

"SPIRITUAL",  "1","*",
"DOGMA",      "2","SPIR/spir.htm",
"QUOTES",     "2","SPIR/quot.htm",
"STORIES",    "2","*",
"treeMan",    "3","SPIR/treeMan.htm",

"POLITICAL",        "1","*",
"REPRESENTATIVES",  "2","POLI/reps.htm",
"ISSUES",           "2","*",
"PMI",              "3","POLI/pmi.htm",
"2010 Tax Cuts",    "3","POLI/taxcuts2010.htm",

"PLAYFUL",      "1","*",
"GAMES",        "2","*",
"Tic-Tac-Toe",  "3","PLAY/ttto.htm",
"PixMatch",     "3","PLAY/conc.htm",
"Tic-Tac-Four", "3","PLAY/tt4.htm",
"NOVELTY",      "2","PLAY/nove.htm",
"JOKES",        "2","PLAY/joke.htm",

"VISUAL",               "1","*",
"COLOR&nbsp;MIXER",     "2","VISU/colors.htm",
"GALLERY",              "2","VISU/gallery.php",
"CSL&nbsp;(CAMP)",      "2","VISU/campCSL.htm",

"TECHNICAL",                 "1","*",
"HTML",                      "2","TECH/html.htm",
"TEST&nbsp;IMAGE",           "2","TECH/phdv.htm",
"CHARACTERS",                "2","*",
"Character&nbsp;Map&nbsp;1", "3","TECH/chr1.htm",
"Character&nbsp;Map&nbsp;2", "3","TECH/chr2.htm",
"Font&nbsp;Showings",        "3","TECH/chr3.htm",
"BASE&nbsp;CONVERT",         "2","TECH/bcon.htm",
"IP&nbsp;SUBNET&nbsp;CALC",  "2","TECH/scal.htm");

var menuListLogin = new Array(
"LOGIN",       "0","logn.php");

var menuListExtra = new Array();

var menuListSiteMap = new Array(
"SITE&nbsp;MAP",   "0","mapp.htm");

var menuList = new Array();

// -= Objects * Variables =-
var menuGate = "";    // String controlling open/closed menue options
var bSniff   = "unk"; // Results of browser sniff routine
var bPref    = "A";   // Results of browser sniff routine
var dDown    = "A";   // A=menu open, B=menu closed
var ss       = "A";   // Style sheet used; A=135px indent, B=6px indent, C=0px indent
var reDir    = "";    // Redirect for directory structure

var leading=12;            //
var futurUse="00000";      //
var lognCode="ZZZZZZZZ";   // Login hash

var flyLDat= new Array();  // Flyout List Data
var flyBDat= new Array();  // Flyout Background Data

// -= Debug works in conjunction with cnfg.htm =-
var debug1="";
var debug2="";
var debug3="";
var debugNow="";
var troubles="<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>";

// -= Setup for flyout menus =-
var flyoutTimer = null; // setTimeout variable
var timerOn = false;    // setTimeout on/off
var flyDelay = 750;     // Delay Length
flyoutSetup();

function cookyData(brwsPref, brwsDDwn, flyFlagg, futurUse, lognCode, menuGate, placeHld, exprDate)
{ this.brwsPref=brwsPref;
  this.brwsDDwn=brwsDDwn;
  this.flyFlagg=flyFlagg;
  this.futurUse=futurUse;
  this.lognCode=lognCode;
  this.menuGate=menuGate;
  this.placeHld=placeHld;
  this.exprDate=exprDate;
}

// -= Object Handling =-
function concatMenuList(addExtras)        // menuListLogin[1] = 0 = not logged in. 1 = logged in. 2=Red
{ var pageInf = new pageData();
  var index=-1;
// writetolayer("veryPHP","WTF");
  for (var i=0; i<menuListBase.length; i++ ) { index++; menuList[index]=menuListBase[i];    }
  if ( menuListLogin[1] == "1" || menuListLogin[1] == "2" )
  { index++; menuList[index]="LOGIN";
    index++; menuList[index]="1";
    index++; menuList[index]="*";
     index++; menuList[index]="LOGIN";
    index++; menuList[index]="2";
    index++; menuList[index]="logn.php";
    for (var k=0; k<menuListExtra.length; k++ ) { index++; menuList[index]=menuListExtra[k]; }
  } else
    { for (var j=0; j<menuListLogin.length; j++ ) { index++; menuList[index]=menuListLogin[j]; } }
  for (var l=0; l<menuListSiteMap.length; l++ ) { index++; menuList[index]=menuListSiteMap[l]; }
troubles+="<br>menuListBase.length="+menuListBase.length;
troubles+="<br>menuListLogin.length="+menuListLogin.length;
troubles+="<br>menuListExtra.length="+menuListExtra.length;
troubles+="<br>menuListSiteMap.length="+menuListSiteMap.length;
troubles+="<br>menuListLogin[1]="+menuListLogin[1];

}

function assignDelay(x)
{ flyDelay = 750;
  if ( x == "1"  )  { flyDelay = 0;    }
  if ( x == "2"  )  { flyDelay = 250;  }
  if ( x == "3"  )  { flyDelay = 500;  }
  if ( x == "4"  )  { flyDelay = 1000; }
}

function assignDelayCode(x)
{ flyCode = 1;
  if ( x == 0  )    { flyCode = 1; }
  if ( x == 250  )  { flyCode = 2; }
  if ( x == 500  )  { flyCode = 3; }
  if ( x == 750  )  { flyCode = 0; }
  if ( x == 1000  ) { flyCode = 4; }
  return flyCode;
}

function QMenuSplitter(Name)
{ var msg = Name;
  var cookyQMenu = new cookyData();
  cookyQMenu.brwsPref = msg.charAt(0);
  cookyQMenu.brwsDDwn = msg.charAt(1);
  cookyQMenu.flyFlagg = msg.charAt(2);
  cookyQMenu.exprDate = "unknown";
  if ( msg.length > 8 )
  { cookyQMenu.futurUse = msg.substring(3, 8);
    cookyQMenu.lognCode = msg.substring(8, 16);
    var start = msg.indexOf("*");
    var end = msg.length;
    if ( start > 0 && start < end )
    { cookyQMenu.placeHld = msg.charAt(start);
      cookyQMenu.menuGate = msg.substring(16,start);
      start++;
      cookyQMenu.exprDate = msg.substring(start, end);
  } }
  return cookyQMenu;
}

// -= Cookies =-
function setCookie(name, vlu, es)
{ if ( es == null ) { es = 31536000000; } var ed = new Date (); ed.setTime(ed.getTime() + es); var vlu = vlu + ed;
  document.cookie = name + "=" + escape(vlu)+"; expires=" + ed.toGMTString() +"; path=/;";
}

function getCookie(name) { var msg="UNK"; var search = name+"="; if (document.cookie.length > 0) { var cc = document.cookie.indexOf(search); if (cc != -1) { cc += search.length; var end = document.cookie.indexOf(";", cc); if (end == -1) { end = document.cookie.length; } msg = unescape(document.cookie.substring(cc, end)); } } return msg; }

// -= Browser Sniffing =-
function browserSniff()
{ var browsTyp = "unk";
  var nUA = navigator.userAgent.toLowerCase();
  if (document.all) { browsTyp = "ie4"; }
  if (document.layers) { browsTyp = "ns4"; }
  if (document.getElementById && !document.all) { browsTyp = "moz"; }
  if (nUA.indexOf("opera") != -1 ) { browsTyp = "opr"; }
  return  browsTyp;
}

function layersUsed(browsTyp)
{ var layrOK = ( browsTyp == "ie4" ) || ( browsTyp == "ns4" ) || ( browsTyp == "moz" ) ? true : false;
  return layrOK;
}

// -= Layer Handling =-
function hidelayer(lay)
{ var s = bSniff;
  if ( s == "ie4" ) {document.all[lay].style.visibility = "hidden";}
  if ( s == "ns4" ) {document.layers[lay].visibility = "hide";}
  if ( s == "moz" ) {document.getElementById([lay]).style.display = "none";}
}

function showlayer(lay)
{ var s = bSniff;
  if ( s == "ie4" ) {document.all[lay].style.visibility = "visible";}
  if ( s == "ns4" ) {document.layers[lay].visibility = "show";}
  if ( s == "moz" ) {document.getElementById([lay]).style.display = "block";}
}

function writetolayer(lay,txt)
{ var s = bSniff;
 // var s = browserSniff();
//document.write("BEEF s="+s+". lay="+lay);

  if ( s == "ie4" ) { document.all[lay].innerHTML = txt; }
  if ( s == "ns4" ) { document[lay].document.open(); document[lay].document.write(txt); document[lay].document.close(); }
  if ( s == "moz" ) { document.getElementById(lay).innerHTML = txt; }
//  return;
}

// -= Compose Layered Menu Support =-     A=L1 open, a=L1 close, B=L2 open, b=L2 close
function menuGateInit(L1,L2)
{ menuGate="";
  var indxAry = 0;
  while ( menuList[indxAry] != null )
  { if ( menuList[indxAry+2].substring(0,1) == "*" )
    { if ( menuList[indxAry+1] == "1" ) { if ( menuList[indxAry] == L1 ) { menuGate += "A"; } else { menuGate += "a"; } }
      if ( menuList[indxAry+1] == "2" ) { if ( menuList[indxAry] == L2 ) { menuGate += "B"; } else { menuGate += "b"; } }
    }
    indxAry=indxAry+3;
  }
debug1+="\nResults from menuGateInit\nL1="+L1+"\nL2="+L2+"\nmenuGate="+menuGate;
}

function modifyMenu(menuChoice)
{ var nuString = ""; var indxAry  = 0; var sectionIndex = -1;
  while ( menuList[indxAry] != null )
  { if ( menuList[indxAry+2] == "*" )
    { sectionIndex++;
      if ( menuChoice == menuList[indxAry] )
      { if ( menuGate.charAt(sectionIndex) == "a" ) { nuString = nuString + "A"; }
        if ( menuGate.charAt(sectionIndex) == "A" ) { nuString = nuString + "a"; }
        if ( menuGate.charAt(sectionIndex) == "b" ) { nuString = nuString + "B"; }
        if ( menuGate.charAt(sectionIndex) == "B" ) { nuString = nuString + "b"; }
      } else { nuString = nuString + menuGate.charAt(sectionIndex); }
    }
    indxAry=indxAry+3;
  }
  menuGate = nuString;
}

function gotoURL(nuURL)
{ window.location = nuURL;
}

function openCloseMenu(oc)
{ var pageInf = new pageData();
  var cQMu = new cookyData();
  dDown = "A";
  if ( oc == "C" ) { dDown = "B"; }
  var msg="A"+dDown+assignDelayCode(flyDelay)+futurUse+lognCode+menuGate+"*";
  setCookie("QMenu", msg);
  var nuURL = pageInf.reDir;
  if ( pageInf.thisSub != "" ) { nuURL+=pageInf.thisSub+"\/"; }
  nuURL += pageInf.thisPage;
  gotoURL(nuURL);
}

function menuChange(passedForm)
{ var localForm = passedForm.form;
  var indx = document.menuForm.selMenu.selectedIndex;
  var nuURL = document.menuForm.selMenu.options[indx].value;
  if ( nuURL != "*" ) { gotoURL(nuURL); }
}

function mouseEn(theLayer)
{ if ( flyDelay != 0 )
  { writetolayer("flyoutsB",flyBDat[theLayer]);
    writetolayer("flyoutsL",flyLDat[theLayer]);
    document.cookyForm.result.value="** CAUTION **\nThe flyout may have disabled the buttons on the form.\nRefresh (or reload) the page to allow the form to work if it appears unresponsive.\nassignDelayCode(flyDelay)="+assignDelayCode(flyDelay)+"\nflyDelay="+flyDelay;
  }
  clearTheTimer();
}

function mouseEx()
{ if ( flyDelay != 0 )
  { flyoutTimer = setTimeout("clearFlyout()",flyDelay);
    timerOn = true;
  }
}

function clearFlyout()
{ if ( flyDelay != 0 )
  { writetolayer("flyoutsB","");
    writetolayer("flyoutsL","");
    clearTheTimer();
  }
}

function clearTheTimer()
{ if (timerOn) { clearTimeout(flyoutTimer); timerOn = false; }
}

// -= Compose Layered Menu =-
function writeMenu(menuChoice,dDown)
{ 
debugNow="<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>%%%%%%%%%%%%%%%%%%%%%%<br>";
for (var i=0; i < menuList.length; i=i+3)
{ debugNow+="<br>["+i+"]="+menuList[i]+"["+i+1+"]="+menuList[i+1]+"["+i+2+"]="+menuList[i+2];
}
debugNow+="length="+menuList.length+"%%%%%%%%%%%%%%%%%%%%%%<br>";
 modifyMenu(menuChoice);
  var pageInf=new pageData(); 
var menuHTM=""; var menuIMG=""; var indxAry=0; var sectnIndx=-1; var menuHeight=0-leading; var hrefInfo="";
  var lk1="<tr><td><a href='"; var clss="' class='menuDir'>"; var im1="<img src='"+reDir+"images/menu/"; var im2="' border=0 height=10px width=";

  var t1="<span style='top: "; var t2="px; left:0px;'><table border=0 cellpadding=0px cellspacing=0"; var t3=" width=134px"; var t4="px>"; var menuTop=0; var theIcon=""; var theLink=""; var theWidth=""; var showB=false; var showC=false;
  var t7="<\/a><\/td><\/tr>"; var t9="<\/table><\/span>"; var s ="&nbsp;"; var g="&gt;&gt;";
  var t1a="<span style='position: absolute; top:";

  var loopIndx=0; var flyIndx=0; var flyMenu=""; var flyBgMenu=""; var flyBgMenuTop="";
  var flyBgMenuHeight=""; var flytop=0; var flytopInc=0; var showTert="n"; var longStr="";

  hrefInfo = "javascript:openCloseMenu(";
  if ( dDown == "B" )
  { menuHTM = t1+menuTop+t2+t4+lk1+hrefInfo+"&quot;O&quot;);"+clss+im1+"open.gif"+im2+"10px>Open Menu"+t7+t9; menuHeight += leading;
    writetolayer("txtLayer", menuHTM);
    menuIMG+=t1+menuTop+t2+t4+im1+"mid.gif' height=4 width=133 border=0><br>"+im1+"bot.gif'  height=15px width=133px border=0><\/span>"


    writetolayer("sideBar", menuIMG);
  } 
   else
    { 
    
//    writetolayer("anim","<BR><BR><BR><BR><BR><BR><BR>BLOOP");
    menuHTM = t1+menuTop+t2+t4+lk1+hrefInfo+"&quot;C&quot;);"+clss+im1+"close.gif"+im2+"10px>Close Menu"+t7+t9; menuHeight += leading; menuTop+=leading;
      while ( menuList[indxAry] != null )
      { theWidth=0; onMo="";
debugNow+=menuList[indxAry]+"<BR>";
        if ( menuList[indxAry+2].substring(0,1) == "*" )
        { sectnIndx++;
          hrefInfo = "javascript:writeMenu(&quot;"+menuList[indxAry]+"&quot;);";
          if ( menuGate.charAt(sectnIndx) == "A" ) { theWidth=10; theLink=hrefInfo; showB=true;  showC=false; if ( pageInf.thisHead == menuList[indxAry] ) { theIcon="arrow04.gif"; } else { theIcon="arrow02.gif"; } }
          if ( menuGate.charAt(sectnIndx) == "a" ) { theWidth=10; theLink=hrefInfo; showB=false; showC=false; if ( pageInf.thisHead == menuList[indxAry] ) { theIcon="arrow03.gif"; } else { theIcon="arrow01.gif"; } }
          if ( menuGate.charAt(sectnIndx) == "B" && showB) { theWidth=20;  theLink=hrefInfo;     showC=true;  if ( pageInf.thisMenu == menuList[indxAry] ) { theIcon="point04.gif"; } else { theIcon="point02.gif"; } }
          if ( menuGate.charAt(sectnIndx) == "b" && showB) { theWidth=20;  theLink=hrefInfo;     showC=false; if ( pageInf.thisMenu == menuList[indxAry] ) { theIcon="point03.gif"; } else { theIcon="point01.gif"; } }

          loopIndx=indxAry; flyBgMenuHeight=0; flytop=menuTop; flyBgMenuTop=flytop-9; flytopInc=flytop;
          if ( menuList[loopIndx+1] == "2" && menuList[loopIndx+4] == "3" )
          { flyBDat[flyIndx]=t1a+flyBgMenuTop+"px'>";
            flytop=flytop-4;
            flyLDat[flyIndx]=t1a+flytop+t2+t4+"<tr><td><p class=bodycopy2>&nbsp;"+menuList[loopIndx]+":<\/td><\/tr>"+t9;
            flytopInc=flytopInc+leading;

            while ( menuList[loopIndx+4] == "3" )
            { longStr=reDir+menuList[loopIndx+5]+"' onMouseOver='clearTheTimer();' onMouseOut='mouseEx();";
              flyLDat[flyIndx]+=t1a+flytopInc+t2+t3+t4+lk1+longStr+clss+im1+"docu.gif"+im2+"10px>"+menuList[loopIndx+3]+t7+t9;
              flytopInc=flytopInc+leading;
              flyBgMenuHeight=flyBgMenuHeight+leading;
              loopIndx=loopIndx+3;
            }
            flyBgMenuHeight=flyBgMenuHeight+leading+4;
            flyBDat[flyIndx]+=im1+"flyout_t.gif' border=0 height=6px width=130px><br>"+im1+"flyout_m.gif' border=0 height="+flyBgMenuHeight+" width=130px><br>"+im1+"flyout_b.gif' border=0 height=9px width=130px><\/span>";

            onMo="' onMouseOver='mouseEn(&quot;"+flyIndx+"&quot;);' onMouseOut='mouseEx(&quot;"+flyIndx+"&quot;);";
            flyIndx++;
            debug2=flyBDat[flyIndx-1];
            debug3=flyLDat[flyIndx-1];
          }
        } else
          { hrefInfo = reDir+menuList[indxAry+2];
            if ( menuList[indxAry+1] == "2" && showB)
            { theWidth=20; theLink=hrefInfo;
              if ( pageInf.thisMenu == menuList[indxAry] ) { theIcon="hilite2.gif"; } else { theIcon="docu2.gif"; }
            }
            if ( menuList[indxAry+1] == "3" && showC)
            { theWidth=30; theLink=hrefInfo;
              if ( pageInf.thisSubHead == menuList[indxAry] ) { theIcon="hilite3.gif"; } else { theIcon="docu3.gif"; }
            }
            if ( menuList[indxAry+1] == "0" )
            { theWidth=10; theLink=hrefInfo;
              if ( pageInf.thisSub == menuList[indxAry] ) { theIcon="hilite.gif"; } else { theIcon="docu.gif"; }
              if ( pageInf.thisPage == "logn.php" && menuList[indxAry] == "LOGIN" )         { theIcon="hilite.gif"; }
              if ( pageInf.thisPage == "mapp.htm" && menuList[indxAry] == "SITE&nbsp;MAP" ) { theIcon="hilite.gif"; }

            }
          }
        if ( theWidth != 0) { menuHTM += t1+menuTop+t2+t4+lk1+theLink+onMo+clss+im1+theIcon+im2+theWidth+t4+menuList[indxAry]+t7+t9; menuHeight += leading; menuTop+=leading; }
        indxAry=indxAry+3;
      }
      menuHTM += t9;
      writetolayer("txtLayer", menuHTM);
      menuHeight+=2;
      menuIMG+="<span top : 0px; left:0px;>"+im1+"mid.gif' height="+menuHeight+" width=133 border=0><br>";
      menuIMG+="<span top :"+ menuHeight+"px; left:0px;>"+im1+"bot.gif'  height=17 width=133 border=0><\/span><\/span>";
      writetolayer("sideBar", menuIMG);
      debug1+=menuHTM;
    }
//document.write("<BR>ZZZZZZZZZZZZZZZZZZZZZZ<BR>ZZZZZZZZZZZZZZZZZZZZZZ<BR>ZZZZZZZZZZZZZZZZZZZZZZ<BR>ZZZZZZZZZZZZZZZZZZZZZZ<BR>ZZZZZZZZZZZZZZZZZZZZZZ<BR>ZZZZZZZZZZZZZZZZZZZZZZ<BR>ZZZZZZZZZZZZZZZZZZZZZZ<BR>ZZZZZZZZZZZZZZZZZZZZZZ<BR>ZZZZZZZZZZZZZZZZZZZZZZ<BR>ZZZZZZZZZZZZZZZZZZZZZZ");
//writetolayer("anim",troubles);
debugNow="";
}

function drawLayerHead(reDir,thisMenu,thisHead,thisSubHead)
{ var im1="<img src='"+reDir+"images/menu/"; var im2="' border=0 height=44 width=";
  var s ="&nbsp;"; var g ="&gt;&gt;"; var t8="<\/td>"; var t9="<\/tr>"; var headHTM = ""; var winW = 0; var winH = 0;
  if ( bSniff == "ie4" ) { winW = document.body.offsetWidth-163-20; winH = document.body.offsetHeight-20; }
  if ( bSniff == "ns4" ) { winW = window.innerWidth-163-16; winH = window.innerHeight-16; }
  if ( bSniff == "moz" ) { winW = window.innerWidth-163-16; winH = window.innerHeight-16; }
  if (winW < 432) { winW = 432; }
  headHTM+="<div id='topHead'><table border=0 cellpadding=0 cellspacing=0><tr><td>"+im1+"top_ld";
  headHTM+=".gif"+im2+"150>"+t8+"<td>"+im1+"top_m.gif"+im2+winW+t8+"<td>"+im1+"top_r.gif"+im2+"15"+t8+t9+"<\/table><\/div>";

// document.write("TRYING TO DRAW LAYER HEAD"+www+"<br>");
  writetolayer("topHead", headHTM);
  headHTM= "<div id='topTitle' class='theSect'>&nbsp;&gt;&gt;&nbsp;";
  if ( thisHead != "" ) { headHTM+=thisHead+"&nbsp;&gt;&gt;&nbsp;"; }
  headHTM+=thisMenu;
  if ( thisSubHead == "" ) { headHTM+="<\/div>"; } else { headHTM+="&nbsp;&gt;&gt;&nbsp;"+thisSubHead+"<\/div>"; }
  writetolayer("topTitle", headHTM);
}

// -= Compose Alternate Layered Menu =-
function composeMenuForm(reDir)
{ var op1="<OPTION VALUE ='"; var op2="'>"; var op3="<\/OPTION>";
  var menEwe=op1+"*"+op2+"MENU:"+op3; var indxAry = 0;
  while ( menuList[indxAry] != null )
  { if ( menuList[indxAry+1] == "1" )
    { menEwe+=op1+"*"+op2+menuList[indxAry]+":"+op3;
    } else
      { if ( menuList[indxAry+1] == "2" )
        { menEwe+=op1+reDir+menuList[indxAry+2]+op2+"&nbsp;+-&nbsp;"+menuList[indxAry]+op3;
        } else { menEwe+=op1+reDir+menuList[indxAry+2]+op2+"&nbsp;+---&nbsp;"+menuList[indxAry]+op3; }
      }
    indxAry=indxAry+3;
  }
  return menEwe;
}

function drawHeadFlat(xreDir, xthisPage, xthisMenu, xthisSub, xthisHead, xbrwsPref)
{ var reDir=xreDir; var thisPage=xthisPage; var thisMenu=xthisMenu; var thisSub=xthisSub; var thisHead=xthisHead; var brwsPref=xbrwsPref;
  var headHTM="<table border=0 cellpadding=0 cellspacing=0>"; var winW=(thisHead.length+thisMenu.length+8)*15; var b=">";
  var im1="<img src='"+reDir+"images/menu/"; var im2="' border=0 height="; var im3="width="; var s ="&nbsp;"; var g ="&gt;&gt;";
  var ht="7 "; var hm="33 "; var hb="6 "; var wl="148>"; var wr="16>"; var wmu="198>";
  var t1="<tr>"; var t2="<td>"; var t3="<td bgcolor=#CCCCFF class='theSect' valign=middle>"; var t4="<\/td>"; var t5="<\/tr>";
  headHTM+=t1+t2+im1+"th_01.gif"+im2+ht+im3+wl+t4+t2+im1+"th_02.gif"+im2+ht+im3+winW+b+t4+t2+im1+"th_02.gif"+im2+ht+im3+wmu+t4+t2+im1+"th_03.gif"+im2+ht+im3+wr+t4+t5;
  headHTM+=t1+t2+im1+"th_04.gif"+im2+hm+im3+wl+t4+t3+s+g+s+thisHead+s+g+s+thisMenu+s+t4;
  var menEwe=composeMenuForm(reDir);
  headHTM+=t3+"<div style='display:inline;'><FORM METHOD='POST' NAME='menuForm' style='margin-bottom:0; margin-top:0; vertical-align:middle;'><SELECT NAME='selMenu' onChange='menuChange(this);'>"+menEwe+"<\/SELECT><\/FORM><\/div>"+t4+t2+im1+"th_06.gif"+im2+hm+im3+wr+t4+t5;
  headHTM+=t1+t2+im1+"th_07.gif"+im2+hb+im3+wl+t4+t2+im1+"th_08.gif"+im2+hb+im3+winW+b+t4+t2+im1+"th_08.gif"+im2+hb+im3+wmu+t4+t2+im1+"th_09.gif"+im2+hb+im3+wr+t4+t5+"<\/table>";
  return headHTM;
}

// -= Compose Mobile Menu =-
function drawMobileHead(xreDir, xthisPage, xthisMenu, xthisSub, xthisHead, xbrwsPref)
{ var menEwe=composeMenuForm(xreDir); var s ="&nbsp;"; var g ="&gt;&gt;";
  var t1="<tr bgcolor=#CCCCFF><td bgcolor=#CCCCFF"; var t2="<td>"; var t3="<td bgcolor=#CCCCFF class='theSect' valign=middle>"; var t4="<\/td>"; var t5="<\/tr>";
  var headHTM="<table border=0 cellpadding=0 cellspacing=0 width=100%>";
  headHTM+=t1+"><img src='"+xreDir+"images/menu/q.gif' height=24px width=140px"+t4+t5;
  headHTM+=t1+" class='theSect'>"+s+g+s+xthisHead+s+g+s+xthisMenu+s+"<\/td><\/tr>";
  headHTM+=t1+"><FORM METHOD='POST' NAME='menuForm' style='margin-bottom:0; margin-top:0; vertical-align:middle;'><SELECT NAME='selMenu' onChange='menuChange(this);'>"+menEwe+"<\/SELECT><\/FORM>"+t4+t5;
  headHTM+=t1+"><img src='"+xreDir+"images/menu/dkLine.gif' height=6px width=100%>"+t4+t5;
  headHTM+="<\/table>";
  return headHTM;
}

// -= Control =-
function validateBrwsPref(brwsPref) {if ( brwsPref != "A" && brwsPref != "B" && brwsPref != "C" ) { brwsPref = "A"; }  return brwsPref; }
function validatebrwsDDwn(brwsDDwn) {if ( brwsDDwn != "A" && brwsDDwn != "B" ) { brwsDDwn = "A"; }  return brwsDDwn; }

function writeSS()
{ document.write("<LINK REL='stylesheet' TYPE='text\/css' HREF='"+reDir+"css\/style"+ss+".css'>");
}

function writeTallHole(howTall,w2layer)
{ var vsp1="<table border=0 cellpadding=0 cellspacing=0><tr><td><img src='"+reDir+"images/menu/tallhole.gif' border=0 width='1px' height='";
  var vsp2="px'><\/td><\/tr><\/table>";
  if ( w2layer == "" )
  { document.write(vsp1+howTall+vsp2);
  } else
    { return vsp1+howTall+vsp2;
    }
}

function loadPage_dWrites()
{ var pageInf = new pageData();
  var cookyQMenu = new cookyData();
  var cC = getCookie("QMenu");
  reDir=pageInf.reDir;
  bSniff=browserSniff();
  ss="A";
  if ( !layersUsed(bSniff) ) { bPref = "C"; }
  if ( cC != "UNK" ) { cookyQMenu = QMenuSplitter(cC);
// futurUse=cookyQMenu.futurUse;
  }
  bPref=validateBrwsPref(cookyQMenu.brwsPref);
  dDown=validatebrwsDDwn(cookyQMenu.brwsDDwn);
  if ( bPref == "A" && dDown == "B" ) { ss = "B"; }
  if ( bPref == "B" ) { ss = "B"; }
  if ( bPref == "C" ) { ss = "C"; }
  writeSS();
  concatMenuList();
  
  if ( bPref == "A" )
  { menuGateInit(pageInf.thisHead, pageInf.thisMenu);
    if ( dDown == "A" )
    { writeTallHole("42",""); } else { writeTallHole("60",""); }
  }
  
  if ( bPref == "B" )
  { var headHTM = drawHeadFlat(reDir, pageInf.thisPage, pageInf.thisMenu, pageInf.thisSub, pageInf.thisHead, pageInf.thisSubHead, bPref);
    document.write(headHTM);
  }
  
  if ( bPref == "C" )
  { var headHTM = drawMobileHead(reDir, pageInf.thisPage, pageInf.thisMenu, pageInf.thisSub, pageInf.thisHead, pageInf.thisSubHead, bPref);
    document.write(headHTM);
  }
}

// onLoading() is processed after loadPage_dWrites()
function onLoading() 
{ var pageInf = new pageData();
  if ( bPref == "A" )
  { drawLayerHead(reDir,pageInf.thisMenu,pageInf.thisHead,pageInf.thisSubHead);
    menuGateInit(pageInf.thisHead, pageInf.thisMenu);
    writeMenu("",dDown); 
  }
}

