// -----------------------------------------------------------------------------
// Copyright (C) 2002 Impel Solutions Corporation. All Rights Reserved.
// Module:  headfoot.js
// Version: 1.0
// Author:  David Houck/Mark Pilger
// Written: 04/16/2002
// Changed: 
// -----------------------------------------------------------------------------

// -----------------------------------------------------------------------------
// Purpose: These four routines handle preloading and swapping of images.
// Input:   N/A
// Output:  N/A
// Author:  Macromedia
// Written: N/A
// Changed: N/A
// -----------------------------------------------------------------------------
function MM_findObj(n, d) {  //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_preloadImages() {  //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf('#')!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() {  //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() {  //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

// -----------------------------------------------------------------------------
// Purpose: Displays a popup window
// Input:   N/A
// Output:  N/A
// Author:  Mark Pilger
// Written: 01/16/2001
// Changed: 
// -----------------------------------------------------------------------------
function popupWindow(strPage, strWindow, strHeight, strWidth) {
  h = "height = " + strHeight + ", ";
  w = "width = " + strWidth + ", ";
//  parms = h + w + "directories=no, location=yes, menu=no, resizable=no, scrollbars=yes, status=no, toolbar=no";
  parms = h + w + "directories=no, location=no, menu=no, resizable=no, scrollbars=yes, status=no, toolbar=no";
  win=window.open(strPage, strWindow, parms);
}

// -----------------------------------------------------------------------------
// Purpose: Displays a new window
// Input:   N/A
// Output:  N/A
// Author:  Mark Pilger
// Written: 01/16/2001
// Changed: 
// -----------------------------------------------------------------------------
function newWindow(strPage, strWindow, strHeight, strWidth) {
  h = "height = " + strHeight + ", ";
  w = "width = " + strWidth + ", ";
  parms = h + w + "directories=no, location=yes, menu=yes, resizable=yes, scrollbars=yes, status=yes, toolbar=yes";
//  parms = h + w + "directories=no, location=no, menu=no, resizable=no, scrollbars=yes, status=no, toolbar=no";
  win=window.open(strPage, strWindow, parms);
}

// -----------------------------------------------------------------------------
// Purpose: Writes the copyright notice
// Written: 08/11/2003
// Changed: 
// Input:   None
// Output:  None
// -----------------------------------------------------------------------------
function CopyrightWrite()
{
  var strCopyright =
    "<table border='0' cellpadding='0' cellspacing='0' width='100%'>" +
    "  <tr>" +
    "    <td bgcolor='#FFFFFF' align='left' valign='middle' width='100%'>" +
    "      <span class='SmallFont'>&nbsp;Copyright &copy; 2003-2010 eTruckerBenefits.com. All Rights Reserved.</span>" +
    "    </td>" +
    "  </tr>" +
    "</table>";
  document.write(strCopyright);
}

// -----------------------------------------------------------------------------
// Purpose: Writes the standard footer
// Written: 08/11/2003
// Changed: 
// Input:   Directory level: 0 = root, 1 = subdirectory, ... (Number)
// Output:  None
// -----------------------------------------------------------------------------
function FooterStdWrite(lngDirLevel)
{
  strDirLevel = setDirLevel(lngDirLevel);  // Calls proc (see below)
  var strSeparator = "&nbsp;|&nbsp;"
  var strFooterStandard =
    "<br>" +
    "<table border='0' cellpadding='0' cellspacing='0' width='770'>" +
    "  <tr>" +
    "    <td bgcolor='#000000'><img src='images/spacer.gif' height='2' width='770'></td>" +
    "  </tr>" +
    "  <tr>" +
    "    <td class='SmallFont' align='left' valign='middle' width='100%'>" +
    "      <a class='NavFooter' href='Default.htm' title='Home'>&nbsp;Home&nbsp;</a>" +
           strSeparator +
    "      <a class='NavFooter' href='getquote.htm' title='Get a Quote'>&nbsp;Get a Quote&nbsp;</a>" +
           strSeparator +
    "      <a class='NavFooter' href='privacypolicy.htm' title='Privacy Policy'>&nbsp;Privacy Policy&nbsp;</a>" +
           strSeparator +
    "      <a class='NavFooter' href='contactus.htm' title='Contact Us'>&nbsp;Contact Us&nbsp;</a>" +
           strSeparator +
    "      <a class='NavFooter' href='answers.htm' title='FAQs'>&nbsp;Help and FAQs&nbsp;</a>" +
           strSeparator +
    "      <a class='NavFooter' href='links.htm' title='Links'>&nbsp;Links&nbsp;</a>" +
           strSeparator +
    "      <a class='NavFooter' href='aboutus.htm' title='About eTruckerBenefits.com'>&nbsp;About eTruckerBenefits.com&nbsp;</a>" +
    "    </td>" +
    "  </tr>" +
    "</table>";
  document.write(strFooterStandard);
  CopyrightWrite();                                                            // Calls proc (see above)
}

// -----------------------------------------------------------------------------
// Purpose: Writes the Chat Icon
// Written: 09/14/2003
// Changed: 
// Input:   None
// Output:  None
// -----------------------------------------------------------------------------
function ChatWrite()
{
  var strChat =
    "<div id='divLiveChatNow' style='position: absolute; border: 1px solid; left: 633px; top: 71px; width: 89px; height: 29px; z-index: 1'>" +
    "<!-- Start LiveChatNow.Com Monitoring code -->" +
    "<script language='javascript' src='http://www.livechatnow.com/js/js.php?img=c&url=&refer=&cid=4511&group=General'></script>" +
    "<script language='javascript'>" +
    "<!--" +
    "_cln_reload(1);" +
    "// -->" +
    "</script>" +
    "</div>";
  document.write(strChat);
}

// -----------------------------------------------------------------------------
// Purpose: Writes the Logo
// Written: 09/11/2003
// Changed: 
// Input:   None
// Output:  None
// -----------------------------------------------------------------------------
function LogoWrite()
{
  var strLogo =
    "<!-- Logo -->" +
    "<div id='divLogo' style='position: absolute; border: 0px solid; left: 0px; top: 83px; width: 262px; height: 41px; z-index: 1'>" +
    "<a href='index.html'>" +
    "<img src='images/etruckerlogo.jpg' alt='eTruckerBenefits.com' border='0' height='41' width='262'>" +
    "</a>" +
    "</div>";
  document.write(strLogo);
}

// -----------------------------------------------------------------------------
// Purpose: Sets the directory level
// Written: 08/11/2003
// Changed:
// Input:   Directory level code (Number: 1-4 valid, > 4 invalid)
// Output:  Directory level (String)
// -----------------------------------------------------------------------------
function setDirLevel(lngDirLevel)
{
  switch (lngDirLevel)
  {
    case 0 :                                                                   // Sets root directory level
      var strDirLevel = ""
      break;
    case 1 :                                                                   // Sets first subdirectory level
      var strDirLevel = "../"
      break;
    case 2 :                                                                   // Sets second subdirectory level
      var strDirLevel = "../../"
      break;
    case 3 :                                                                   // Sets third subdirectory level
      var strDirLevel = "../../../"
      break;
    case 4 :                                                                   // Sets fourth subdirectory level
      var strDirLevel = "../../../../"
      break;
    default :                                                                  // Traps all invalid dir level codes
      alert("Invalid directory level code passed: " + lngDirLevel);
      var strDirLevel = ""
  }
  return strDirLevel;                                                          // Returns the directory level (string)
}
