﻿function RemoveText(el) {
    if (el.value == "SEARCH SITE:") {
        el.value = "";
    }


}

function AddText(el) {
    if (el.value == "") {
        el.value = "SEARCH SITE:";
    }


}

function CheckCity(el) {
    if (el.value == "Enter a Zip Code") {
        el.value = "";
    }
}

function AddCity(el) {
    if (el.value == "") {
        el.value = "Enter a Zip Code";
    }
}

function check_site()
{
	document.search_form.q.value = "site:www.vectrabank.com " + document.search_form.keywrd.value;
	return true
}

			function ExternalLink(link) {
				text = "IMPORTANT: You Are Leaving Vectra Bank. \n\nBy clicking OK, you will be taken to a Website that is not affiliated with Vectra Bank and may offer a different privacy policy and level of security. Vectra Bank is not responsible for and does not endorse, guarantee or monitor content, availability, viewpoints, products or services that are offered or expressed on other Websites. \n\nYou can click the Return to Vectra Bank button now to return to the previous page or close the window at any time.";
				if(confirm(text)) {
					window.open (link,"mywindow","status=1,toolbar=1,scrollbars=1"); 
				}
			}
			
			function SubmitUserLogin() {
				elUser = document.getElementById("userCred1");
				
				if(elUser.value != "undefined" && elUser.value != null) {
					if(elUser.value != "") {
						document.logonForm.submit();	
					}
					else {
						alert('You must enter a User Id in order to login');	
					}
				}

			}
			function SubmitBusinessLogin() {
				
				elCust = document.getElementById("publicCred2");
				elUser = document.getElementById("publicCred1");
				
	
				 var form = document.logonForm2;
				 elUser =  form["publicCred1"];
			
				if(elUser.value != "undefined" && elUser.value != null) {
					if(elCust.value != "undefined" && elCust.value != null) {
						if(elCust.value == "") {
							if(elCust.value == "") {
								alert('You must enter a Company Id in order to login');	
								return false;
							}
						}
					}
					if(elUser.value == "") { 
						alert('You must enter a User Id in order to login: ' + elUser.value);	
						return false;
					}
				}
				if(elCust.value != "undefined" && elCust.value != null) {
					if(elCust.value != "") {
						bizId = GetBizId(elCust.value);
						if(bizId == "invalid") {
							return false;
						}
						elCust.value = bizId;
						document.getElementsByName("publicCred2").value = bizId;
						
					}
					else {
						alert('You must enter a Company Id in order to login');	
						return false;
					}
				}
				
				
				
				document.logonForm2.submit();	
				
			}
			
			
			function checkEnter(e){ 
				var characterCode;
				if (window.event) {
					e=event;
					characterCode = e.keyCode 
				} //IE	
				else {
					characterCode = e.which  
				}
			   
				if(characterCode == 13){ 
					SubmitBusinessLogin();
					return false
				}
				else{
					return true
				}

			}
			
			function GetBizId(compId) {
				id = "113";
				if(compId.length == 16) {
					return compId;
				}	
				else if(compId.length < 13) {
					for(i = 0; i < 13 - compId.length; i++) {
						id += 0;
					}
					id += compId;
					return id;
				}
				else if (compId.length > 12) {
					alert("Invalid Company Id. Please try again.");
					return "invalid";
				}
				else {
					alert("Invalid Company Id. Please try again.");
					return "invalid";
				}
			}




