//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2008 Adobe Systems Incorporated.  All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
function ControlVersion()
{
	var version;
	var axo;
	var e;
	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}
	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";
			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";
			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}
	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}
	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}
	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}
// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}
// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];
        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}
function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '';
  if (isIE && isWin && !isOpera)
  {
    str += '<object ';
    for (var i in objAttrs)
    {
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params)
    {
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
  }
  else
  {
    str += '<embed ';
    for (var i in embedAttrs)
    {
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }
  document.write(str);
}
function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    
    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblclick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
} // end flash player detection

var onload_functions = Array();
var onload_priorities = Array();

function add_onload_function(fxn_str, priority) {
	onload_functions[onload_functions.length] = fxn_str;
	onload_priorities[onload_priorities.length] = priority;
}
function do_onloads() {
	for (var i=0; i<onload_functions.length; i++) {
		if (onload_priorities[i]=='high') {
			eval(onload_functions[i]);
		}
	}
	for (var i=0; i<onload_functions.length; i++) {
		if (onload_priorities[i]=='normal') {
			eval(onload_functions[i]);
		}
	}
	for (var i=0; i<onload_functions.length; i++) {
		if (onload_priorities[i]=='low') {
			eval(onload_functions[i]);
		}
	}		
}


var menu_x = 0;
var menu_y = 0;
var offsetHeight = 0;
var menu_displacement = -19;
var dhtml = (document.all || document.getElementById);

var menu_persist_interval = 400; 
var menu_hover_states = Array();
var menu_interval_objects = Array();
var menu_interval_states = Array();

var use_masks = get_use_masks();
function get_use_masks() {
	var agt = navigator.userAgent.toLowerCase();	
	var idx = agt.indexOf('msie');
	if (idx == -1 || agt.indexOf('opera') != -1) {
		return false;
	} else {
		//browser detection code from http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
		var is_major = parseInt(navigator.appVersion);
		var is_minor = parseFloat(navigator.appVersion);
		var is_ie3    = (is_major < 4);
		var is_ie4    = ((is_major == 4) && (agt.indexOf("msie 4")!=-1) );
		var is_ie4up  = (is_major >= 4);
		var is_ie5    = ((is_major == 4) && (agt.indexOf("msie 5")!=-1) );
		var is_ie6up =(!is_ie3 && !is_ie4 && !is_ie5);
		//end cited code
		if (is_ie6up) {
			return true;
		} else {
			return false;
		}
	}
}

function menu_link_mouseover (menu_name, parent) {
	if (get_element(menu_name)) {
	//make sure the menu has been loaded
		if (parent != 'menu_none') {
			get_element(parent).allow_hide = false;
			get_element(menu_name).parent_menu = parent;
			menu_hover_states[parent] = true;
			//alert(menu_name + ' ' + parent);
		} else {
			close_all_menus();
		}
		menu_hover_states[menu_name] = true;
		set_and_show(menu_name);
	}
}

function menu_link_mouseout(menu_name, child_menu) {
	menu_hover_states[menu_name] = false;
	schedule_menu_closing(menu_name);
	menu_hover_states[child_menu] = false;
}

function clear_menu_over(menu_name) {
	//if(menu_name == 'menu_17') {
		//alert((get_element(menu_name).allow_hide) + ' ' + menu_hover_states[menu_name]);
	//}
	if ((get_element(menu_name).allow_hide != false) && !menu_hover_states[menu_name]) {
		//alert(get_element(menu_name).allow_hide);
		//alert(menu_name);
		//alert(get_element(menu_name).allow_hide);
		clearInterval(menu_interval_objects[menu_name]);
		menu_interval_states[menu_name]=false;
		hide_menu(menu_name);
	}
}
function schedule_menu_closing(menu_name) {
	if (!menu_interval_states[menu_name]) {
		menu_interval_objects[menu_name] = setInterval('clear_menu_over("' + menu_name + '")', menu_persist_interval);
		menu_interval_states[menu_name]=true;
	}
}
function close_all_menus() {
	for (menu_name in menu_hover_states) {
		if (!get_element(menu_name)) {
			//alert(menu_name);
		} else {
			if (get_element(menu_name).allow_hide == true) {
				menu_hover_states[menu_name]=false;
				if (menu_interval_states[menu_name]) {
					clearInterval(menu_interval_objects[menu_name]);
					menu_interval_states[menu_name] = false;
					hide_menu(menu_name);
				}
			}
		}
	}
}

function set_and_show(menu_name) {
	e=get_element('image_' + menu_name);
	menu_x=GetXOffset(e);
	menu_y=GetYOffset(e);
	offsetHeight = e.offsetHeight;
	show_menu(menu_name);
	if (use_masks == true) {
		//prevent <select> elements from showing through
		mask = get_element('iframe_mask' + get_menu_depth(menu_name));
		/*mask_calib = get_element('iframe_div');
		mask.style.left = GetXOffset(mask_calib) + 'px';//menu_x + 'px';
		mask.style.top = GetYOffset(mask_calib) + 'px';//(menu_y + offsetHeight + menu_displacement) + "px";
		mask.style.height = mask_calib.offsetHeight;//get_element(menu_name).offsetHeight;
		mask.style.width = mask_calib.offsetWidth;//get_element(menu_name).offsetHeight;*/		
		mask.style.left = menu_x + 'px';
		mask.style.top = (menu_y + offsetHeight + menu_displacement) + "px";
		mask.style.height = get_element(menu_name).offsetHeight + 'px';
		//alert(menu_name);
		mask.style.width = get_element(menu_name).offsetWidth + 'px';		
		mask.style.display = "";
	}	
	schedule_menu_closing(menu_name);
}
function get_menu_depth(menu_name) {
	var i=1;
	e = get_element(menu_name);
	while (e.parent_menu) {
		e = get_element(e.parent_menu);
		i++;
	}
	return i;
}
		
function show_menu(menu_name) {
	if (dhtml) {
		var tempVar=get_element(menu_name);
		//document.getElementById('floater_text').innerHTML=menu_text;
		tempVar.style.left= menu_x + "px";
		tempVar.style.top = (menu_y + offsetHeight + menu_displacement) + "px";
		tempVar.style.display="";
		tempVar.allow_hide=true;
	}
}
function hide_menu(menu_name) {
	if ( dhtml ){
		var tempVar = get_element(menu_name);
		tempVar.style.display="none";
		get_element('iframe_mask' + get_menu_depth(menu_name)).style.display = 'none';
		if ( get_element(tempVar.parent_menu) )  {
			get_element(tempVar.parent_menu).allow_hide=true;
			clear_menu_over(tempVar.parent_menu);
		}
	}
}
function get_element(elem_id) {
	if (document.getElementById) {
		return document.getElementById(elem_id);
	} else if (document.all) {
		return document.all[elem_id];
	} else {
		return false;
	}
}	
function GetXOffset(e) {
	var x=e.offsetLeft;
	var pe;
	pe=e.offsetParent;
	while (pe !=null ) {
		x+=pe.offsetLeft;
		pe=pe.offsetParent;
	}
	return x;
}
function GetYOffset(e) {
	var y=e.offsetTop;
	var pe;
	pe=e.offsetParent;
	while (pe !=null ) {
		y+=pe.offsetTop;
		pe=pe.offsetParent;
	}
	return y;
}

//version 1.1
var popup_array = Array();
function open_popup(url, popup_name, options) {
	var cur_popup = popup_array[popup_name];
	var is_popup_defined = (typeof(cur_popup) == 'object');
	var is_popup_open = (is_popup_defined)
		? !(cur_popup.closed)
		: false;

	if ( is_popup_defined && is_popup_open ) {
		cur_popup.document.write (' ');
		cur_popup.focus();
		cur_popup.location.href = url;
		cur_popup.focus();
	} else if ((is_popup_defined && !is_popup_open) || !is_popup_defined) {
		popup_array[popup_name] = window.open(url, popup_name, options);
	}
}

function PopEx(link) {
	//open_popup("/common/external_link.html?url=" + escape(link), "PopWin","width=800,height=600,top=0,left=0,toolbar=0,scrollbars=1,location=0,status=1,menubar=0,resizable=1");
	//msg = 'You are now leaving Christian Community Credit Union and are being transferred to a trusted partner site, do you wish to proceed?';
	msg =   'You are now leaving the Web site of Christian Community Credit Union ' + 
			'(CCCU) to a link not operated by Christian Community Credit Union. CCCU ' + 
			'is not responsible for the content of the alternate Web site and does ' + 
			'not represent either the third party or the member if you enter into a ' + 
			'transaction with them. The privacy and security policies of the Web site ' + 
			'you may be visiting may differ from those practiced by CCCU. ';
	var wnd;
	if (confirm(msg)) {
		pageTracker._trackPageview('/outgoing/'+link);
		wnd = window.open(link, "_blank","width=800,height=540,top=0,left=0,toolbar=yes,scrollbars=yes,location=yes,status=yes,menubar=yes,resizable=yes");
		wnd.focus();
	}
}

function PopNoEx(link) {
	pageTracker._trackPageview('/outgoing/'+link);
	wnd = window.open(link, "_blank","width=800,height=540,top=0,left=0,toolbar=yes,scrollbars=yes,location=yes,status=yes,menubar=yes,resizable=yes");
	wnd.focus();
}

function PopUpWindow (url, hWind, nHeight, nWidth, nScroll, nResize) {
	var cToolBar = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=" + nScroll + ",resizable=0,width=" + nWidth + ",height=" + nHeight;
	var popupwin = window.open(url, hWind, cToolBar);
}

function openAccount()
{
	PopNoEx("https://secure.andera.com/index.cfm?fiid=A725B996566C4FBAA8CC7D29EAE7FF0B");
	/*
	var cfgToken='';
	var w=780;
	var h=screen.height*0.75;
	var winl=(screen.width-w)/2;
	var wint=((screen.height-h)/2)*0.75;
	if(openAccount.arguments.length)
	{
		cfgToken="&selectedProducts="+openAccount.arguments[0];
	}
	window.open('https://secure.andera.com/index.cfm?fiid=A725B996566C4FBAA8CC7D29EAE7FF0B'+cfgToken,'openAccount','height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,menubar=no,status=yes,toolbar=no,resizable=yes');*/
}

var first_click = '';
function clearField(theField, theClick)
{
	if(theClick == 1)
	{
		theField.value = '';
	}
	return false;
}

var first_click_loc = '0';
function clearFieldLoc(theField)
{
	first_click_loc+=1;
	if(first_click_loc == 1)
	{
		theField.value = '';
	}
	return false;
}

function preloadImages() {
	var preload_images = Array('/images/select_box_products2.gif',
							   '/images/select_box_products_btn2.gif',
							   '/images/search-box-mid.gif',
							   '/images/search-box-bottom.png',
							   '/images/search_box_bg.png',
							   '/images/search_box_last.png',
							   '/images/search_box2.png',
							   '/images/search_button2.gif');
	document.preloaded_images = Array();
	for (var i=0; i<preload_images.length; i++) {
		document.preloaded_images[i] = new Image;
		document.preloaded_images[i].src = preload_images[i];
	}
}

function toggle_products(){
	var display = 'block';
	var button_bg = "/images/select_box_products_btn2.gif";
	var input_bg = "/images/select_box_products2.gif";
	var products = document.getElementById('find-products');
	var product_input = document.getElementById('select-box-products');
	var product_button = document.getElementById('select-box-products-btn');
	if (products.style.display == 'block')
	{
		display = 'none';
		button_bg = "/images/select_box_products_btn.gif";
		input_bg = "/images/select_box_products.gif";
	}
	products.style.display = display;
	product_input.style.background = "url('" + input_bg + "') no-repeat";
	product_button.src = button_bg;
}

function toggle_accounts(){
	var display = 'block';
	var button_bg = "/images/search_button2.gif";
	var input_bg = "/images/search_box2.gif";
	var accounts = document.getElementById('account-select');
	var accounts_input = document.getElementById('search_box');
	var accounts_button = document.getElementById('search_button');
	if (accounts.style.display == 'block')
	{
		display = 'none';
		button_bg = "/images/search_button.gif";
		input_bg = "/images/search_box.gif";
	}
	accounts.style.display = display;
	accounts_input.style.background = "url('" + input_bg + "') no-repeat";
	accounts_button.src = button_bg;
}

function close_products()
{
	var products = document.getElementById('find-products');
	var product_input = document.getElementById('select-box-products');
	var product_button = document.getElementById('select-box-products-btn');
	
	products.style.display = "none";
	product_input.style.background = "url('/images/select_box_products.gif') no-repeat";
	product_button.src = "/images/select_box_products_btn.gif";
}

function close_accounts()
{
	var accounts = document.getElementById('account-select');
	var accounts_input = document.getElementById('search_box');
	var accounts_button = document.getElementById('search_button');
	
	accounts.style.display = 'none';
	accounts_input.style.background = "url('/images/search_box.gif') no-repeat";
	accounts_button.src = "/images/search_button.gif";
}


function showLightboxWithIframe(iframeSource) {
	var docWidth = $(window).width();
	var docHeight = $(window).height();
	
	/*
	if (window.console) {
		console.info("$('#hd_lightbox').click:");
		console.log("document.documentElement.clientWidth = " + document.documentElement.clientWidth);
		console.log("document.documentElement.offsetHeight = " + document.documentElement.offsetHeight);
		console.log("window.innerWidth= " + window.innerWidth);
		console.log("window.innerHeight = " + window.innerHeight);
	}
	*/
	
	
	if (document.documentElement.clientWidth && window.innerHeight) {
		//docWidth = window.innerWidth;
		docWidth = document.documentElement.clientWidth;
		docHeight = window.innerHeight;
	}
	else if (document.documentElement.clientWidth && document.documentElement.offsetHeight) {
		//docWidth = document.documentElement.offsetWidth;

		//for width in IE
		docWidth = document.documentElement.clientWidth;

		//for height in IE
		docHeight = document.documentElement.offsetHeight;
	}
	
	$("body").append("<div id='lightbox'></div>");
	$("#lightbox").width(docWidth);
	$("#lightbox").height(docHeight);
	
	$("#lightbox").append("<div id='lightbox_bg'>&nbsp;</div>");
	$("#lightbox_bg").width(docWidth);
	$("#lightbox_bg").height(docHeight);
	
	$("#lightbox").append("<div id='lightbox_container'></div>");
	$("#lightbox_container").append('<div id="lightbox_close" class="lightbox_close_up" onmouseover="this.className=\'lightbox_close_over\'" onmouseout="this.className=\'lightbox_close_up\'"></div>');
	
	$("#lightbox_close").click(function(e) {
		$("#lightbox").remove();
	});
	
	$("#lightbox_container").append("<div id='lightbox_contents'></div>");
	
	//var adjustCloseButtonTop = parseInt($('div#lightbox_contents').position().top) + parseInt(10);
	//$('div#lightbox_close').css('top', adjustCloseButtonTop + 'px');
	
	var lbContainerWidth = 897; 
	var lbContainerHeight = 520;
	
	$("#lightbox_container").width(lbContainerWidth);
	$("#lightbox_contents").width(lbContainerWidth);
	$("#lightbox_contents").height(lbContainerHeight);
	//$("#lightbox_contents").append('<iframe id="myContent" name="myContent" src="https://campaigns3.documatix.com/campaign/webform.aspx?id=14CF6CE3A34589B1" allowtransparency="true" width="' + lbContainerWidth + '" height="' + lbContainerHeight + '" frameborder="0" border="0" scrolling="auto"></iframe>');
	$("#lightbox_contents").append('<iframe id="myContent" name="myContent" src="' + iframeSource + '" allowtransparency="true" width="' + lbContainerWidth + '" height="' + lbContainerHeight + '" frameborder="0" border="0" scrolling="auto"></iframe>');
	$('#lightbox').css('top', $(window).scrollTop() + "px");
}

