
/********************************************************************************
*                        \  Added by Digital Insight   /
*                         -----------------------------
*
*/ // NOTE CHANGE BACK SITEDIR ON HOMEPAGE

	// kohlercu.net and kohlercu.org open the .com address in a full-size frame, thereby throwing off the redirect.
	// This function redirects directly to kohlercu.com if it finds itself in a framed page

   // Added by DI developers
   var url = location.href;
   
   // CALL TO CORRECT DIRECTORY BELOW
   var imgdir    = "../images/";
   var sitedir   = "";
   var securedir = "";
   var homedir   = "../";

   if (url.match(/index\.html/))
   {
	   imgdir    = "images/";
	  // sitedir   = "site/";
	   sitedir   = "http://www.kohlercu.com/site/"
	   securedir = "";
	   homedir   = "";
   }
   else if (url.match(/https/))
   {
	   imgdir    = "https://www.kohlercu.com/images/"
	   sitedir   = "http://www.kohlercu.com/site/"
	   securedir = "https://www.kohlercu.com/site/"
	   homedir   = "http://www.kohlercu.com/"
   }
   else
   {
	   imgdir    = "http://www.kohlercu.com/images/"
	   sitedir   = "http://www.kohlercu.com/site/"
	   securedir = "http://www.kohlercu.com/site/"
	   homedir   = "http://www.kohlercu.com/"
   }

/*******************************************************************************/



/********************************************************************************
*                        \     Kohler Credit Union     /
*                         -----------------------------
*
*   File Location        : /site/scripts_global.js
*
*   Begin Work           : Tuesday, September 26, 2006
*   Last Work            : Tuesday, November 13, 2007
*   Copyright            : (c) 2006-2007 Kohler Credit Union
*                          All other copyrights to their respectful owners
*                          and is noted where necessary.
*   Location             : http://www.kohlercu.com/
*
*   Current Version      : v1.0.0
*
********************************************************************************/



// Write 'keywords' META tag to all pages
/*document.write('<meta name="keywords" content="Kohler Credit Union, Kohler, Credit, Union, KohlerCU, KCU, online, credit union, home banking, online banking, internet banking, online bill payment, Microsoft Money, Quicken, bill payment, mortgage, second mortgage, home equity, equity, investment, investment products, CUNA Mutual Group, CUNA, MEMBERS, IRA, Roth IRA, CD, Share Certificate, Term Share Certificate, loan, lending, student loan, vehicle loan, auto loan, automobile loan, RV loan, recreational vehicle loan, new car loan, used car loan, new truck loan, used truck loan, personal loan, credit card, MasterCard, VISA, credit card points, points, ScoreCard, Score Card, debit card, check card, ATM, online application, safe deposit box, savings account, share draft account, checking account, calculator, financial calculator, mortgage calculator, retirement calculator, a financial institution of excellence" />');
*/
window.onload = function()
{
	set_focus();													// Setting focus on Member Number field
	
	if (window.location.href.match(/about_locations.html/i))
	{
		kcu_branch_show(4);											// Load Kohler branch
		kcu_atm_map_load('all');										// Load all ATM locations on map
	}
	
	if (window.location.href.match(/cs_checking.html/i))
	{
		show_account('main');											// Default checking information to display
	}
	
	if (window.location.href.match(/relocate_realtors.html/i))
	{
		realtor_county('sheboygan');										// Load information for Sheboygan County
		realtor_city('sheboygan');										// Load realtor information for Sheboygan
	}
}



/*
 *  A universal function to display Flash items on a page.  The visitor MUST
 *  have JavaScript enabled for this to function.  Make sure to include the old
 *  way of displaying Flash ojbects inside a NOSCRIPT tag for universal function.
 *
 *  Internet Explorer and Objects
 *  -----------------------------------------------------------------------------
 *  With the release of Service Pack 2 for Internet Explorer 6, and all future
 *  version of the program, Microsoft changed the way ActiveX objects function.
 *  This was due to a lawsuit brought upon them for 'infringement' of the way
 *  ActiveX functions in a browser.  With the change, before any object can be
 *  used in the browser, EACH item must be 'activated' first. This function
 *  automatically 'activates' the object, acting as if the item was being called
 *  from an external source from the page.
 */

function create_flash_object(obj_location, obj_classid, obj_codebase, obj_width, obj_height, obj_movie, obj_menu, obj_quality, obj_wmode)
{
	var flash_object  = '<object classid="' + obj_classid + '" codebase="' + obj_codebase + '" width="' + obj_width + '" height="' + obj_height + '">';
	    flash_object += '<param name="movie" value="' + obj_movie + '" />';
	    flash_object += '<param name="menu" value="' + obj_menu + '" />';
	    flash_object += '<param name="quality" value="' + obj_quality + '" />';
	    flash_object += '<param name="wmode" value="' + obj_wmode + '" />';
	    flash_object += '<embed src="' + obj_movie + '" width="' + obj_width + '" height="' + obj_height + '" quality="' + obj_quality + '" menu="' + obj_menu + '" wmode="' + obj_wmode + '" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer"></embed>';
	    flash_object += '</object>';
	
	content_change(flash_object, obj_location);
}



/*
 *  This is a universal function to make changing content on a page much easier
 *  instead of writing it over and over again in all scripts.  The function
 *  allows for all sorts of different browsers to make the content change work.
 *  The only items needed to work are the content to display and DIV ID.
 */

function content_change(page_content, page_location)
{
	if (document.getElementById)
	{
		x = document.getElementById(page_location);
		x.innerHTML = '';
		x.innerHTML = page_content;
	}
	else if (document.all)
	{
		x = document.all[page_location];
		x.innerHTML = page_content;
	}
	else if (document.layers)
	{
		x = document.layers[page_location];
		x.document.open();
		x.document.write(page_content);
		x.document.close();
	}
}



/*
 *  Display the current year on each page for copyright information.
 */

function current_year()
{
	var current_year = new Date();
	var year = current_year.getFullYear();
	
	document.write(year);
	
	return;
}



/*
 *  Firefox and New Windows
 *  -----------------------------------------------------------------------------
 *  Beginning with Firefox 2, there was a change in how the browser works with
 *  JavaScript, new windows, and tabs.  In previous versions, the browser would
 *  function similar to Internet Explorer.  Due to an abuse of new windows by
 *  advertisers, etc., Mozilla found it necessary to modify this functionality.
 *  The new default function for Firefox 2 is to open all popups in a new tab.
 *
 *  http://kb.mozillazine.org/Browser.link.open_newwindow.restriction
 *
 *  Internet Explorer and New Windows
 *  -----------------------------------------------------------------------------
 *  With the release of Internet Explorer 7, Microsoft introduced the rest of
 *  the world to tabs.  The default behavior of tabs and new windows is to open
 *  all new popups in a new window.
 */

function external_site(the_location, the_name, third_party, the_width, the_height)
{
	if (third_party == true)
	{
		outside_url  = the_location;										// URL where user wants to go
		the_location = 'outside_site.html';									// Third party site disclaimer
	}
	
	if ((the_width == 0 && the_height == 0) || navigator.userAgent.match('Firefox/2'))
	{
		window.open(the_location, the_name);									// Firefox 2 does some weird stuff, so this is necessary.  See note above.
	}
	else
	{
		var from_top  = ((parseInt(screen.height) - the_height) / 2);						// Position window from the top
		var from_left = ((parseInt(screen.width) - the_width) / 2);						// Position window from the left
		
		window.open(the_location, the_name, 'width=' + the_width + ', height=' + the_height + ', top=' + from_top + ', left=' + from_left + ', location=yes, scrollbars=yes');
	}
	
	return;
}



/*
 *  Flip through a list of pictures to display on a page.
 */

function image_flip(direction)
{
	var total_images = (image_flip_pics.length - 1);								// Get total number of images in the 'image_flip_pics' array
	
	if (current_pic > total_images) { current_pic = 0; }								// CATCH:  Check if current picture is within the array
	if (current_pic < 0) { current_pic = total_images; }								// CATCH:  Check if current picture is within the arry
	
	if (direction == 'next' && current_pic < total_images) { current_pic++; }					// Go to the next picture, unless it's at the final image
	if (direction == 'previous' && current_pic > 1) { current_pic--; }						// Go to the previous pcutre, unless it's at the first image

	// Build the image based upon data in the 'image_flip_pics' array
	var next_image = '<img src="../images/' + image_flip_pics[current_pic][0] + '" width="' + image_flip_pics[current_pic][1] + '" height="' + image_flip_pics[current_pic][2] + '" alt="' + image_flip_pics[0] + '" title="' + image_flip_pics[0] + '" />';
	
	content_change(next_image, 'fb_pics');										// Display the requested image on the page
}



/*
 *  Clear the default search box value for user convenience.
 */

function search_clear(search_value)
{
	if (search_value.defaultValue == search_value.value)
	{
		search_value.value = '';
	}
}



/*
 *  Set the cursor focus on the Member Accout Login area to make it more
 *  convenient for the member to type in his or her account information.
 */

function set_focus()
{
	var focus_on = null;
	
	if (document.getElementById)
	{
		focus_on = document.getElementById('Login');
	}
	else if (window.login_form)
	{
		focus_on = window.Login;
	}
	
	if (focus_on)
	{
		if (focus_on.userNumber.value == null || focus_on.userNumber.value == "")
		{
			focus_on.userNumber.focus();
		}
		else
		{
			focus_on.password.focus();
		}
	}
	
	return;
}



/*
 *  The website will utilize a SINGLE function to launch any application, such
 *  as sending an email through a form, submitting a job application, and more.
 *
 *               NOTE ON BROWSERS *WITHOUT* JAVASCRIPT SUPPORT:
 *  -----------------------------------------------------------------------------
 *  Any browser that does not support JavaScript will still be able to utilize
 *  these forms by slipping through a normal <a href="">link</a>.  However, the
 *  verification of the forms is done through JavaScript and will not be 
 *  processed.  Unfortunately, this method of verification is something that can
 *  be easily bypassed by any user with a malicious intent.
 */

function website_app(app_name)
{
	var popup_width  = 750;													// Fixed window width of 760 pixels
	var popup_height = 800;													// Fixed window height of 550 pixels
	
	var from_top     = ((parseInt(screen.height) - popup_height) / 2);							// Position window from the top
	var from_left    = ((parseInt(screen.width) - popup_width) / 2);							// Position window from the left
	
	window.open('http://www.kohlercu.com/site/email_contact.php?' + app_name, 'application', 'width=' + popup_width + ', height=' + popup_height + ', top=' + from_top + ', left=' + from_left + ', directories=no, location=yes, menubar=yes, resizable=yes, scrollbars=yes, status=yes, toolbar=no');/*,toolbar=0,location=0,directories=0,status=0,menubar=0,location=yes,scrollbars=yes,resizable=yes,status=yes*/
	
	return;
}

