//JS Trim function
function Ck4Spaces(txt,minlength) {
    chkKeyword = txt.replace(/\s+$/gi, "");
    chkKeyword = chkKeyword.replace(/^\s*/gi, "");
	if(chkKeyword.length<minlength){
		return false;		
	}
}

//Validate Zip Code
function zipcheck(){
	var OkToSubmit = "no";
	if(Ck4Spaces(parent.document.getElementById('zipInput').value,3)==false){
		alert('Please enter a zip code \(3 character minimum\).	');
		parent.document.getElementById('zipInput').focus();
		return false;
	} else {
		OkToSubmit = "yes";
	}
	if (OkToSubmit=="yes"){			
		zipCode(parent.document.getElementById('zipInput').value);
	}
}
	
	
function zipCode(zipCode) {
    // false to make a synchronous call, null no callback
    var fnOnResponse = function( oRequest ) {
        Spry.Utils.setInnerHTML( "search-results-socket", oRequest.xhRequest.responseText );        
    };
    Spry.Utils.loadURL( "GET", "utilities/utl_locator_ajax.cfm?zip=" + zipCode, true, fnOnResponse );
}
