// JavaScript Document

<!-- getElementById Shorthand --->

function element(elementName)
{
	element = document.getElementById(elementName);
}

<!-- Current Date -->

<!-- -------------------------------------------------------------- -->

      /* Updated By:    Long Tran on 05.22.07
         Purpose:
             Shows/Hides elements  */

		function show(value)
		{
			document.getElementById(value).style.display = '';
		}

		function hide(value)
		{
			document.getElementById(value).style.display = 'none';
		}

	/* In your HTML use the following format
    	<a href="#" onclick="javascript:show(idToShow);">Text text text</a>
		<div id="idToShow"></div>
    */

<!-- -------------------------------------------------------------- -->


      /* Updated By:    Long Tran on 02.25.07
         Purpose:
             Gives a Blank Pop up Placeholder  */
		function demoPopup()
		{
			window.open('../popups/blank.html','blank','menubar=no,scrollbars=yes,dependent=yes,width=630, height=450, left=164,top=4');
		}
		
		function tourPopup(value)
		{
			window.open(value,'blank','menubar=no,scrollbars=no,dependent=yes,width=700, height=566, left=164,top=4');
		}
		
		function contentPopup(value)
		{
			window.open('../popups/' + value + '.html','blank','menubar=no,scrollbars=yes,dependent=yes,width=630, height=500, left=164,top=4');
		}

		function demoAlert()
		{
			alert('Because this is a demo, some links and features are disabled.');
			// alert('You are viewing our demo. This feature is not enabled in the demo.');
		}
		
		function disabledDemo()
		{
			alert('This page has been disabled for the purposes of this alternate demo version.');
			return false;
		}

		function popupSwitch(value){
			window.open('../smartswitch/ss_letter-' + value + '.html','blank','menubar=yes,scrollbars=yes,dependent=yes,width=740, height=550');
		}


<!-- -------------------------------------------------------------- -->


      /* Updated By:    David M. Dailey on 10.05.06
         Purpose:
             Forwards the user to a new location, on selection of a menu item. */
    
        function changeLocation(PageToView)
		{
    
            location.replace(PageToView);
        
        }
    
      /* In your HTML use the following format
        
        <select id="Menu_1" onchange="changeLocation(this.value)">          use a UNIQUE id
          <option value="#" selected>Your First Selection</option>          value is where you want to go, use # to stay at current page.
          <option value="http://www.url.com">Your Next Selection</option>   
        </select> */


<!-- -------------------------------------------------------------- -->

    
      /* Updated By:    David M. Dailey on 10.05.06
         Purpose:
             Opens a new window for the user */
    
    
        function newLocation(PageToOpen)
		{
    
            window.open(PageToOpen,'','scrollbars=yes,menubar=no,height=600,width=680,resizable=yes,toolbar=no,location=no,status=no');
        }
    
      /* In your HTML use the following format
        
        <select id="Menu_1" onchange="newLocation(this.value)">             use a UNIQUE id
          <option value="#" selected>Your First Selection</option>          value is where you want to go, use # to stay at current page.
          <option value="http://www.url.com">Your Next Selection</option>   
        </select> */
        
    
<!-- -------------------------------------------------------------- -->


      /* Updated By:    David M. Dailey on 09.20.06
         Purpose:
             The 'Reveal' Function takes the values in an INPUT option, and displays a hidden block.
         The function first hides all associated blocks that the INPUT effects. Then it Displays the
         block associated with the users choice. */
    
        function Reveal(Value, Menu)
		{
      
            Value = Value.split(',');                                             // Breaks up the VALUE into an Array
                DISPLAY = Value[0];                                               // Item that needs to be shown.
                HIDE    = Value[1];                                               // Item that needs to be hidden
      
            TYPE = document.getElementById(Menu).type;                            // Determines what Type of INPUT is calling the function.
      
              if(TYPE == 'radio') {                                               // Accounts for Radio buttons that have no 'options'
        
                  document.getElementById(HIDE).style.display = 'none';           // Hides a block
    
                  document.getElementById(DISPLAY).style.display = 'block';       // Shows a block
        
              } else {
        
                  NumberOfOptions = document.getElementById(Menu).length;          // Retrieves the number of options in the selection.
        
                  x = 0;                                                           // Declares 'x' outside of the for loop, 'n' will NOT work.
    
                  for(n=1; n <= NumberOfOptions; n++) {                           // This loop is used to hide ALL the associated blocks with a given INPUT
    
                      Hide = document.getElementById(Menu).options[x].value;      // Assigns the VALUE to the variable 'Hide'
    
                      ToHide = Hide.split(',');                                   // Breaks up 'Hide'.
    
                      document.getElementById(ToHide[0]).style.display = 'none';  // Takes the first element in the VALUE, finds the ID that matches it, and hides that block
    
                      x++;
    
                  }
              }
        
            document.getElementById(DISPLAY).style.display = 'block';            // Displays block, associated with the selection
      
        }
    
      /* In your HTML use the following format
    
          <select id="Menu_1" onchange="Reveal(this.value, this.id)" >                          Use a UNIQUE ID
            <option value="Null,Null">Make a Selection</option>                                 VALUE needs to be Item_To_Show,Item_to_Hide use a comma to seperate. No whitespace
            <option value="BoxA,Null">Selection One</option>
            <option value="BoxB,Null">Selection Two</option>
          </select>
        <div id="BoxA" style="display:none;">Selection <b>One</b> was Chosen</div>            Use a UNIQUE id for your hidden block
        <div id="BoxB" style="display:none;">Selection <b>Two</b> was Chosen</div>
        <br />
        <div id="Null" style="display:none; width:0px; height:0px;"></div>                    Use a HIDDEN block at the BOTTOM of the page, that is always hidden. */


<!-- -------------------------------------------------------------- -->


      /* Updated By:    David M. Dailey on 01.10.07
         Purpose:
             Allows a Table ot Div to be hidden, while another is shown. For use
		particularly with Tabs */

			function displayTables(tableToHide, tableToShow)
			{
				document.getElementById(tableToHide).style.display = 'none';
				document.getElementById(tableToShow).style.display = '';
			}
	
 	/* In your HTML use the following format
		<div id="Item[0]" style="width:400px; height:200px; border:solid; border-width:1px; display:block;">
		
		  <a href="#" onclick="displayTables('Item[0]', 'Item[0]');">See Block One</a> | <a href="#" onclick="displayTables('Item[0]', 'Item[1]');">See Block Two</a><br />
		  <br />
		  This is Box One
		</div>
		
		<div id="Item[1]" style="width:400px; height:200px; border:solid; border-width:1px; display:none;">
		  <a href="#" onClick="displayTables('Item[1]', 'Item[0]');">See Block One</a> | <a href="#" onclick="displayTables('Item[1]', 'Item[1]');">See Block Two</a><br />
		  <br />
		  This is Box Two
		</div> */


<!-- -------------------------------------------------------------- -->


      /* Updated By:    David M. Dailey on 03.2.07
         Purpose:
             Generates Dynamic Quick Links based on the Pages 'Link' and 'sublink' being passed in the URL */
                  
			function writeQuicklinksDropdown()
			{
				data = new Array();
			
				data[0] = ["My Quick Links","none"];
				data[1] = ["Transfer Funds","../transfers/index.html?linkid=WWW_Z_BANK_Z_OBTDPC_H4_01_T_Z"];
				data[2] = ["Account Nicknames","../service/nickname.html"];
				data[3] = ["Change Address","../service/address.html"];
				
				document.getElementById('quicklinksDropdown').options[0] = new Option(data[0][0]);
				document.getElementById('quicklinksDropdown').options[1] = new Option(data[1][0]);
				document.getElementById('quicklinksDropdown').options[2] = new Option(data[2][0]);
				document.getElementById('quicklinksDropdown').options[3] = new Option(data[3][0]);
				document.getElementById('quicklinksDropdown').options[1].value = data[1][1];
				document.getElementById('quicklinksDropdown').options[2].value = data[2][1];
				document.getElementById('quicklinksDropdown').options[3].value = data[3][1];
			}


			function printQuicklinks(a,b,c,d)
			{
		
				quicklink = new Array();

quicklink[0] = "<a href=\"../service/nickname.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_00\" >Set Account Display Preferences</a>";

quicklink[1] = "<a href=\"../service/quicklinks.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_01\">Customize My Quick Links</a>";

quicklink[2] = "<a href=\"../service/link.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_02\">Link Accounts</a>";

quicklink[3] = "<a href=\"../messages/inquiry.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_03\">Send a Secure Message</a>";

quicklink[4] = "<a href=\"../alerts/index.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_04\">Set Alerts</a>";

quicklink[5] = "<a href=\"../accounts/statements.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_04\">View Online Statements</a>";

quicklink[6] = "<a href=\"../accounts/downloads.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_06\">Download Account History</a>";

quicklink[7] = "<a href=\"../accounts/details.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_07\">View Account Details & History</a>";

quicklink[8] = "<a href=\"../billpay/addpayee.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_08\">Add New Payee</a>";

quicklink[9] = "<a href=\"../transfers/index.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_09\">Transfer Funds</a>";

quicklink[10] = "<a href=\"../billpay/processed.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_10\">View Payment History</a>";

quicklink[11] = "<a href=\"../billpay/index.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_11\">Schedule a Bill Payment</a>";

quicklink[12] = "<a href=\"../billpay/pending.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_12\">View Pending Bill Payments</a>";

quicklink[13] = "<a href=\"../transfers/processed.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_13\">View Transfer History</a>";

quicklink[14] = "<a href=\"../transfers/pending.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_14\">View Scheduled Transfers</a>";

quicklink[15] = "<a href=\"javascript:demoAlert()\">Funds Transfer User Guide</a>";

quicklink[16] = "<a href=\"../transfers/efi_pending.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_16\">View Pending External Transfers</a>";

quicklink[17] = "<a href=\"../transfers/efi_processed.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_17\">View External Transfer History</a>";

quicklink[18] = "<a href=\"../transfers/efi_manage.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_18\">Link Non-Capital One Account</a>";

quicklink[19] = "<a href=\"../service/index.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_19\">Self Service Center</a>";

quicklink[20] = "<a href=\"../service/address.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_20\">Update Contact Information</a>";

quicklink[21] = "<a href=\"../service/userid.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_21\">Change User ID</a>";

quicklink[22] = "<a href=\"../service/password.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_22\">Change Password</a>";

quicklink[23] = "<a href=\"../service/question_ia.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_23\">Update Security Questions</a>";

quicklink[24] = "<a href=\"../service/landing.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_24\">Set My Start Page</a>";

quicklink[25] = "<a href=\"../billpay/managepayees.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_25\">Manage Payees</a>";

quicklink[26] = "<a href=\"../alerts/history.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_26\">View Alerts History</a>";
		
quicklink[27] = "<a href=\"../alerts/contactpoints.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_27\">Add/Manage Contact Points</a>";
					
quicklink[28] = "<a href=\"../service/statementcopy.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_28\">Order Statement Copy</a>";
					
quicklink[29] = "<a href=\"../service/orderchecks.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_29\">Reorder Checks</a>";
					
quicklink[30] = "<a href=\"../service/checkcopy.html?linkid=WWW_Z_BANK_Z_OBTDQL_R1_01_T_30\">Order Check Copy</a>";

					
				if(a == null || b == null || c == null || d == null)
				{
					document.write(quicklink[0] + "<br />");
					document.write(quicklink[1] + "<br />");
					document.write(quicklink[2] + "<br />");
					document.write(quicklink[3] + "<br />");
					return;
				}
				else
				{
					document.write(quicklink[a] + "<br />");
					document.write(quicklink[b] + "<br />");
					document.write(quicklink[c] + "<br />");
					document.write(quicklink[d] + "<br />");
					return;
				}
			}
        
    
<!-- -------------------------------------------------------------- -->


      /* Updated By:    David M. Dailey on 03.02.07
         Purpose:
 			Randomly Generates an Image for the Quick Links section. This is a Marketing Tool. */

			function displayRandomImage()
			{

				// Generate a Random Number
				var randomNumber = Math.round(Math.random()*4);

				var showImage = new Array();

					showImage[0] = "<img src=\"../images/products/img_01.gif\" width=\"190\" height=\"72\" border=\"0\">";
					showImage[1] = "<img src=\"../images/products/img_02.gif\" width=\"190\" height=\"72\" border=\"0\">";
					showImage[2] = "<img src=\"../images/products/img_03.gif\" width=\"190\" height=\"72\" border=\"0\">";
					// original img_04.jpg removed as requested by MM 11/28/06
					showImage[3] = "<img src=\"../images/products/img_08.jpg\" width=\"190\" height=\"72\" border=\"0\">";
					// showImage[4] = "<img src=\"/images/products/img_05.gif\" width=\"190\" height=\"72\" border=\"0\">";
					// showImage[5] = "<img src=\"/images/products/img_06.gif\" width=\"190\" height=\"72\" border=\"0\">";
					showImage[4] = "<img src=\"../images/products/img_07.gif\" width=\"190\" height=\"72\" border=\"0\">";

				document.write(showImage[randomNumber]);

			}
			

  
  //////////////////////////////////////////////////////////////////////////////
// addLoadEvent
//
//		Add a new function to the windows onload event without 
//		removing any previous existing functions.
//
//  @param   func - function name to add to windows.onload    
//  @return  void
//////////////////////////////////////////////////////////////////////////////
function addLoadEvent(func) {
	
	// Save current onload functions
	var oldonload = window.onload;
	
	// If this is the first function then assign it to window.onload
	// else assign it along with the current functions 
	if (typeof window.onload != 'function') {
		window.onload = func;
	}
	else {
		window.onload = function() {
			oldonload();
			func();
		};
	}
}
		