// JavaScript Document

function OnlyLettersNumbers(objSource)
{


    var text = document.getElementById('branchquery').value;
    var field=objSource;
	var newVal='';

    var zip = /^[0-9-'.'-',']*$/;
	var txt = /^\s*[a-zA-Z\s]+\s*$/;



    if(isNaN(text)){
		
	  	for (i=0; i<text.length; i++) {
  			if (text.charAt(i).match(/[a-z]|[A-Z]|[0-9]| /)) {
  			newVal += text.charAt(i);
            }
		}
		document.getElementById('branchquery').value = newVal;
		
	}else{
	
   		if (!zip.test(field.value))
    	{
        field.value = field.value.replace(/[^0-9-'.'-',']/g,"");
    	}
	}
		
}


function branchlocatorSubmit(branchsubmittype, e){
	// For Some reason having two forms was messing up the submital, instead I string 
	// the URL together and submit it instead.
	var branchinput = document.getElementById('branchquery').value;

	// If user hits the Enter Key
	if(branchsubmittype == "input"){
	var code;
      if (!e) var e = window.event;
      if (e.keyCode) code = e.keyCode;
      else if (e.which) code = e.which;
      if(code == 13){
		window.location="/search/branchlocator/branchlocator.asp?branchquery="+branchinput ;
		}
 	}
		
	 if(branchsubmittype == "button"){
		window.location="/search/branchlocator/branchlocator.asp?branchquery="+branchinput ;
     }
	 
	 if(branchsubmittype == "text"){
		window.location="/search/branchlocator/branchlocator.asp?branchquery="+branchinput ;
     }
 
	
	
}