/** * Usage: * var x = new SNTripleLocation( a, b, c, [ d, e, f ]); * * a ID of country pulldown * b ID of province pulldown * c ID of city pulldown * [d] country abbreviation of logged in member's country * [e] province abbreviation of logged in member's country * [f] city name of logged in member's country * * d, e, and f are optional and can be null; * ***** Note this package assumes AMAX is included and available to call */ function SNTripleLocation() { var me = this; var cntrFld = document.getElementById(arguments[0]); var provFld = document.getElementById(arguments[1]); var ctyFld = document.getElementById(arguments[2]); var memCntr = arguments[3]; var memProv = arguments[4]; var memCity = arguments[5]; var am; init(); function init() { provFld.style.display = displayProvince(cntrFld.value); cntrFld.onchange = function() { me.cntrFldOnChange(); } provFld.onchange = function() { me.provFldOnChange(); } ctyFld.onchange = function() { me.onCityChange(); } clearField(provFld, 0); clearField(ctyFld, 0); ctyFld.options[0] = new Option("Select City", ""); populateProvince(); if (memCntr) selectField(cntrFld, memCntr); if (memProv) selectField(provFld, memProv); if (memCity) selectField(ctyFld, memCity); } function selectField(fld, val) { for (i=0; i