
var cafenZipcode = {
	lastZipcodeObj : null,
	getZipcode : function(zip1, zip2, addr1, addr2) {
		lastZipcodeObj = {z1:zip1, z2:zip2, a1:addr1, a2:addr2};
		this.searchZipcode(null, {mode : 'xmlZipcode'});
	},
	searchZipcode : function(form, options) {
		showPopup('/common/zipcode.html',options);
		return false;
	},
	setValue : function(objID, value) {
		var obj = document.getElementById(objID);
		if (obj != null)
			obj.value = value;
	},
	setZipcode : function(zip, addr1) {
		hidePopup();
		var zipInfo = zip.split('-');
		this.setValue(lastZipcodeObj.z1,zipInfo[0]);
		this.setValue(lastZipcodeObj.z2,zipInfo[1]);
		this.setValue(lastZipcodeObj.a1,addr1);
		var obj = document.getElementById(lastZipcodeObj.a2);
		if (obj != null) 
			obj.focus();
	}
}

