﻿/******************************************************************************
File:       bellmortgage.js
Date:       December 26, 2007
Author:     ECRA 
            - Modified by Jeremy Adamich

Contents:   This file contains javascript functions for the bellmortgage.com 
            website.
******************************************************************************/

// The global variable that determines if something should close...(?)
var closeFlag = false;

/******************************************************************************
Name:       showDiv
Parameters: id
            The index of the DIV that is to be shown.
            
Return:     None.
Desc:       Show one DIV, hide the other.
******************************************************************************/
function showDiv(id) 
{
   // Setup the link array
   var linkAry = ['about','mortgage'];
   
   // Hide the other DIV
   hideDiv();
   
   // Update the display and backbround image of the specified DIV
   document.getElementById('menuRolledOver'+id).style.display = 'block';
   document.getElementById(linkAry[id-1]).style.backgroundImage = 'none';

   // Set the timeout to a half second
   setTimeout('checkFlag()', 500);
}

/******************************************************************************
Name:       hideDiv
Parameters: None.
Return:     None.
Desc:       Helper function used by 'showDiv()' to hide the other DIV. 
            (actually just hides both...)
******************************************************************************/
function hideDiv() 
{
   // Hide the 'about' sub menu
   e2 = document.getElementById('menuRolledOver1');
   e2.style.display = 'none';
   document.getElementById('about').style.backgroundImage='url(Images/about-inactive.gif)';

   // Hide the 'mortgage' sub menu
   e4 = document.getElementById('menuRolledOver2');
   e4.style.display = 'none';
   document.getElementById('mortgage').style.backgroundImage='url(Images/mortgage-inactive.gif)';
}

/******************************************************************************
Name:       setCloseFlag
Parameters: status
            The new value for the closeFlag global var.
            
Return:     None.
Desc:       Set the new value for the closeFlag global var.
******************************************************************************/
function setCloseFlag(status) 
{
   closeFlag = status;
}

/******************************************************************************
Name:       checkFlag
Parameters: None.
Return:     None.
Desc:       If the close flag is 'false', then reset the timeout to half a sec.
******************************************************************************/
function checkFlag() 
{
   // Reset the time out to half a sec to call this function again if the close flag is NOT set
   if (!closeFlag) 
      setTimeout('checkFlag()', 500);
   
   // Otherwise, just hide both DIVs...
   else 
      hideDiv();
}


/******************************************************************************
Name:       writeTools
Parameters: None.
Return:     None.
Desc:       write the HTML for the links to the tools
******************************************************************************/
function writeTools()
{
   document.writeln("<div class='toolsContainer'>");
   document.writeln("<p><a href='http://www.bellmortgage.com/Mortgage/calculatorsAfford.html'>Affordability</a></p>");
   document.writeln("<p><a href='http://www.bellmortgage.com/Mortgage/calculatorsAmortization.html'>Amortization Schedule</a></p>");
   document.writeln("<p><a href='http://www.bellmortgage.com/Mortgage/calculatorsDebt.html'>Debt Consolidation</a></p>");
   document.writeln("<p><a href='http://www.bellmortgage.com/Mortgage/calculatorsPayment.html'>Monthly Payment</a></p>");
   document.writeln("</div>");
}

/******************************************************************************
Name:       writeTools_ext
Parameters: None.
Return:     None.
Desc:       write the HTML for the links to the tools
******************************************************************************/
function writeTools_ext()
{
   document.writeln("<div class='toolsContainer'>");
   document.writeln("<p><a href='http://www.bellmortgage.com/Mortgage/calculatorsAfford.html' target='_blank'>Affordability</a></p>");
   document.writeln("<p><a href='http://www.bellmortgage.com/Mortgage/calculatorsAmortization.html' target='_blank'>Amortization Schedule</a></p>");
   document.writeln("<p><a href='http://www.bellmortgage.com/Mortgage/calculatorsDebt.html' target='_blank'>Debt Consolidation</a></p>");
   document.writeln("<p><a href='http://www.bellmortgage.com/Mortgage/calculatorsPayment.html' target='_blank'>Monthly Payment</a></p>");
   document.writeln("</div>");
}

/******************************************************************************
Name:       writeFooter
Parameters: None.
Return:     None.
Desc:       write the HTML for the page footer
******************************************************************************/
function writeFooter()
{
   document.writeln("<div class='footerContainer'>");

   document.writeln("<div class='footerDecor'></div>");

   document.writeln("<div class='footerContent'>");
   document.writeln("<table width='100%' cellpadding='5' cellspacing='0' border='0'>");
   document.writeln("<tr>");
   document.writeln("<td align='center' style='width : 40px;'><img src='http://www.bellmortgage.com/Images/EqualHousingLogo.gif' alt='' /></td>");
   document.writeln("<td align='center' style='width : 156px; text-align : left;'>Equal Housing Lender</td>");
   document.writeln("<td align='center'>2010 Bell America Mortgage, LLC. All rights reserved</td>");
   document.writeln("<td align='center' style='width : 173px; vertical-align : middle;'><a href='http://www.bellmortgage.com/Mortgage/licensing.html'>State Licensing</a></td>");
   document.writeln("</tr>");
   document.writeln("</table>");
   document.writeln("</div>");

   document.writeln("</div>");
}
         