/* cbe.js
 * mike@cross-browser.com
*/

var cbeBasePath = window.location.protocol;
cbeBasePath = cbeBasePath.toLowerCase();
var h = window.location.host;
if (h.indexOf('lelavision.com') != -1) cbeBasePath = "http://www.lelavision.com/";
else if (h.indexOf('lelavision') != -1) cbeBasePath = "http://izzy/lelavision/html/";
else cbeBasePath = "";

function topNavBarEx(pg) {
  if (!pg) pg = 0;
  var nb = commonTitleBar1();
  nb += commonNavBar(pg);
  nb += commonTitleBar2();
  document.write(nb);
}

function bottomNavBarEx(pg) {
  if (!pg) pg = 0;
  var nb =
    "<table width='100%' border='0' cellspacing='0' cellpadding='4'>"
    +"<tr>"
    +"  <td class='clsNav' height='22'>";
  nb += commonNavBar(pg);
  nb +=
    ("&nbsp;|&nbsp;"
    +"<a class='clsAMenu' href='#topofpage' title='Top of Page'>Top</a>"
    +"</td></tr></table>");
  document.write(nb);
}

function commonTitleBar1() {
  var nb =
    "<table width='100%' border='0' cellspacing='0' cellpadding='4'>"
    +"<tr>"
    +"  <td class='clsTitle' height='40'>&nbsp;Cross-Browser.com</td>"
    +"  <td class='clsSubTitle' align='right' valign='bottom'>Cross-Browser DHTML&nbsp;</td>"
    +"</tr>"
    +"<tr>"
    +"  <td class='clsNav' colspan='2' height='22'>";
  return nb;
}
function commonTitleBar2() {
  var nb = "</td></tr></table>";
  return nb;
}

function commonNavBar(pg) {
  var nb =
    "&nbsp;"
    +"<a class='clsAMenu' href='"+(pg==1?"javascript:show(1)":"javascript:showC(1)")+"' title='Intro, Browsers, About, Upgrading'>Home</a>"
    +"&nbsp;|&nbsp;"
    +"<a class='clsAMenu' href='"+(pg==1?"javascript:show(6)":"javascript:showC(6)")+"' title='News, Revision Notes'>News</a>"
    +"&nbsp;|&nbsp;"
    +"<a class='clsAMenu' href='"+(pg==1?"javascript:show(3)":"javascript:showC(3)")+"' title='Guides, References, Documentation'>Documents</a>"
    +"&nbsp;|&nbsp;"
    +"<a class='clsAMenu' href='"+(pg==1?"javascript:show(4)":"javascript:showC(4)")+"' title='CBE Programming Examples'>Examples</a>"
    +"&nbsp;|&nbsp;"
    +"<a class='clsAMenu' href='"+(pg==1?"javascript:show(7)":"javascript:showC(7)")+"' title='Applications, Projects, Experiments'>Projects</a>"
    +"&nbsp;|&nbsp;"
    +"<a class='clsAMenu' href='"+(pg==1?"javascript:show(5)":"javascript:showC(5)")+"' title='Support, License, Newsletter, Links'>Support</a>"
    +"&nbsp;|&nbsp;"
    +"<a class='clsAMenu' href='"+(pg==1?"javascript:show(2)":"javascript:showC(2)")+"' title='Download Files, X Library'>Downloads</a>"
    +"&nbsp;|&nbsp;"
    +"<a class='clsAMenu' href='javascript:if(window.cbeDebugJsLoaded)cbeRefWindow()' title='CBE Reference Window'>Reference</a>"
    +"&nbsp;|&nbsp;"
    +"<a class='clsAMenu' href='javascript:if(window.cbeDebugJsLoaded)cbeDebugWindow()' title='CBE Debug Window'>Debug</a>"
    +"&nbsp;|&nbsp;"
    +"<a class='clsAMenu' href='javascript:if(window.cbeDebugJsLoaded)cbeTileWindows()' title='Open and Tile the CBE Debug and Reference Windows'>IDE</a>";
  return nb;
}

function showC(n) {
  if (window.cbeSetCookie) {
    if (n) cbeSetCookie('c', n.toString());
  }  
  if (n) window.location = cbeBasePath+"index.html";
  else window.history.back();
}
