

/************************      Kohler Credit Union      *************************
*                        \                             /
*                         -----------------------------
*
*   File Location        : /common/js/global.js
*
*   Begin Work           : Tuesday, April 15, 2008
*   Last Work            : 
*   Copyright            : (c) 2008 Kohler Credit Union
*                          All other copyrights to their respectful owners
*                          and is noted where necessary.
*   Location             : http://www.bunnyslipperservices.com/
*
*   Current Version      : v1.0.0
*
********************************************************************************/



window.onload = function()
{
	
}



/* *
 *
 *   >> CREATE OBJECT
 *
 *   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_object(obj_location, obj_classid, obj_codebase, obj_width, obj_height, obj_movie, obj_menu, obj_quality, obj_wmode)
{
	var new_object  = '<object classid="' + obj_classid + '" codebase="' + obj_codebase + '" width="' + obj_width + '" height="' + obj_height + '">';
	    new_object += '<param name="movie" value="' + obj_movie + '" />';
	    new_object += '<param name="menu" value="' + obj_menu + '" />';
	    new_object += '<param name="quality" value="' + obj_quality + '" />';
	    new_object += '<param name="wmode" value="' + obj_wmode + '" />';
	    new_object += '<embed src="' + obj_movie + '" width="' + obj_width + '" height="' + obj_height + '" quality="' + obj_quality + '" menu="' + obj_menu + '" wmode="' + obj_wmode + '" swLiveConnect="true" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer"></embed>';
	    new_object += '</object>';
	
	content_change(new_object, obj_location);
}



/* *
 *
 *   >> CONTENT CHANGE
 *
 *   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();
	}
}



/* *
 *
 *   >> NEW WINDOW
 *
 *   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 new_window(the_location, the_name, the_width, the_height)
{
	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;
}


