
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

var buttonClicked = false;
NS4 = (document.layers) ? true : false;

//popup code
function popitup(url)
{
	newwindow=window.open(url,'name','height=350,width=425');
	if (window.focus) {newwindow.focus()}
	return false;
}

function searchSubmit()
{
	if(document.Form1.searchBox.value == "Search")
	{
		return false;
	}
	else
	{
		document.searchForm.qt.value = document.Form1.searchBox.value;
		document.searchForm.submit();
	}
}

function searchCheckEnter(event)
{
	var code = 0;
	if (NS4)
		code = event.which;
	else
		code = event.keyCode;
	if(code == 13)
		searchSubmit();
}

function loginCheckEnter(event)
{
	var code = 0;

	if (NS4)
		code = event.which;
	else
		code = event.keyCode;
	if (code==13)
		submitSignOn();
}

function submitSignOn()
{
	if (validateSignOn()) {
		SignOn();
	}
}

function validateSignOn()
{
	if (document.Form1.AcctLogin.value == ""){
		alert("Please enter your Member Number");
		document.Form1.AcctLogin.focus();
		return false;
		}
	//cgao 06/27/05 validate memberid as digital input
	//if (document.Form1.AcctLogin.value.match(/[^\d]/)){
	//	alert("Member Number must be digits");
	//	document.Form1.AcctLogin.value = "";
	//	document.Form1.AcctLogin.focus();
	//	return false;
	//}
	//cgao 06/27/05 end
//	if (document.Form1.PIN.value == ""){
//		alert("Please enter your PIN");
//		document.Form1.PIN.focus();
//		return false;
//		}

	var valid="@#$%^&*/-._abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	
	for (var i=0; i < document.Form1.AcctLogin.value.length; i++) {
	if (valid.indexOf(document.Form1.AcctLogin.value.charAt(i)) >= 0) {
		
		return true;
		}
	}

	 var valid="0";
		if (valid.indexOf(document.Form1.AcctLogin.value.charAt(0)) == 0) {
			alert("Please remove precdeing 0's from User Name field");
			document.Form1.AcctLogin.focus();
			return false;	
		}
						
	return true;
}

function SignOn()
{
	document.onlineBankingLogin.MemberID.value = document.Form1.AcctLogin.value;
	//document.onlineBankingLogin.Password.value = document.Form1.PIN.value;
	document.onlineBankingLogin.submit();
}

function login_focus()
{
	if (document.Form1.AcctLogin != null) document.Form1.AcctLogin.focus();
}

function confirm_entry(emailDestination)
{
	endLocation = "mailto:" + emailDestination + "?subject=Website%20Inquiry";

	input_box=confirm("Requests that require a change to your account or that contain sensitive information should be made through the Secure Email feature available in Online Banking or by calling us at (408)451-9111 or (800)553-0880.");
	if (input_box==true)
	{ 
		window.location=endLocation;
	}
}

function confirm_link(strLink)
{
	input_box = confirm("You are leaving the Tech CU website and connecting to an alternative website not operated by the credit union. The credit union is not responsible for the content of the alternate website and does not represent either the third party or the member if the two enter into a transaction. Privacy and security policies may differ from those practices by the credit union.");
	if (input_box==true)
	{ 
		window.open(strLink);
	}
}

function confirm_hsa(strLink)
{
	input_box = confirm("To open a Technology Credit Union Health Savings Account you must open a new membership account.\n\nThere are several ways to qualify for Tech CU membership.\n\n1. You live, work, worship or attend school in Santa Clara County, Alameda County, Contra Costa County, San Mateo County, San Francisco County or Santa Cruz County.\n2. Employed by a Tech CU Member Company.\n3. Employed by, related to or reside with a current Tech CU member.\n\nPlease be advised that the forms which are filled out through our online process are not directly submitted to Tech CU as original documents.  Please fill in the forms, print out and mail to IRA/H.S.A. Department, 2010 N. First Street, San Jose, CA 95131.\n\nTo speak with a Tech CU Representative, please call 1-800-553-0880, or contact us by secure email.");
	if (input_box==true)
	{ 
		window.open(strLink);
	}
}

function resize_window(url,sWidth,sHeight) {
    mywin2 = 
    window.open(url,"win2","toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=no, scrollbars=no, width=" + sWidth + ", height=" + sHeight);
}

startMenu = function() {
	if (document.all && document.getElementById) {
		var topmenu = document.getElementById("menu");
		if (topmenu) {
			var submenus = topmenu.getElementsByTagName('UL');
			for (var i=0; i < submenus.length; i++) {
				var pn = submenus[i].parentNode;
				pn.onmouseover = function() { this.lastChild.style.visibility = 'visible'; }
				pn.onmouseout  = function() { this.lastChild.style.visibility = 'hidden';  }
				
				/** IE script to cover <select> elements with <iframe>s **/
				submenus[i].innerHTML = ('<iframe src="about:blank" scrolling="no" frameborder="0"></iframe>' + submenus[i].innerHTML);
				
				var ieMat = submenus[i].firstChild;
				ieMat.style.width=submenus[i].offsetWidth+"px";
				ieMat.style.height=submenus[i].offsetHeight+"px";	
				submenus[i].style.zIndex="99";
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", startMenu)
//else window.onload=startMenu;