	var dbg = false;
	var map;				// GMap2 object
	var storeList;			// table element used to display locations info on the right-hand pane
	var visitorAddress;		// text input element that will contain the address provided by the user
	var resultsForTagId = 'resultsFor'; // shows "Results for: " message on the store locator page
	var isInitial = true; 	// flag tells that state of the map (if initial=true then display/view all 130 stores)
	var geocoder;			// GClientGeocoder object
	var MILES_PER_METER = 0.000621371192;	//convert meters to miles
	var showOutletStores = false; //should outlet stores appear on the map with a different colored icon
	
	//var IMAGES_DIR		// values comes externally from the jsp, declared in a script block
	var pStoresForItemsData = {};	// stores storesforitems data from the parent window
	var TAB_WIDTH = 361;
	// stores information related to input address
	var visitorAddressInfo = { 
		"address":'',
		"latitude":0, 
		"longitude":0 
	};	
	// Stores 5 indexes from the hvtStoresInfo.location array of the closest stores to user input address
	var visitorStoreInfo = []; 
	var visitorsOverlays = [];
	
	var hvtStoresInfoBackup = {"location":[{"phone":"9722707401","longitude":-96.627322,"address2":"","storeId":100203,"state":"TX","address1":"18515 Lyndon B Johnson Fwy","zip":75149,"latitude":32.804596,"name":"Town East","zipplus4":5625,"city":"Mesquite","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"9722983376","longitude":-96.881963,"address2":"","storeId":100205,"state":"TX","address1":"3910 W Camp Wisdom Road","zip":75237,"latitude":32.661952,"name":"Red Bird","zipplus4":2425,"city":"Dallas","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"9723041446","longitude":-97.016098,"address2":"","storeId":100206,"state":"TX","address1":"770 Gateway Blvd","zip":75019,"latitude":32.945591,"name":"Coppell","zipplus4":4433,"city":"Coppell","hours":"Monday through Saturday 10am to 7pm, Sunday 11am to 6pm"},{"phone":"8175819945","longitude":-97.208702,"address2":"Suite 101 Old Town Square","storeId":100208,"state":"TX","address1":"8251 Bedford Euless Rd","zip":76180,"latitude":32.834228,"name":"North Richland Hills","zipplus4":7200,"city":"North Richland Hills","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"9724248880","longitude":-96.711153,"address2":"Collin Creek Village","storeId":100211,"state":"TX","address1":"601 Accent Dr","zip":75075,"latitude":33.005751,"name":"Plano","zipplus4":8963,"city":"Plano","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"9722397174","longitude":-96.830894,"address2":"","storeId":100212,"state":"TX","address1":"4505 Lyndon B Johnson Fwy","zip":75244,"latitude":32.926338,"name":"Galleria","zipplus4":5905,"city":"Farmers Branch","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"9723152800","longitude":-97.035648,"address2":"598 E Round Grove Rd","storeId":100213,"state":"TX","address1":"Vista Ridge Village","zip":75067,"latitude":33.07214,"name":"Vista Ridge","zipplus4":8309,"city":"Lewisville","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"8173468595","longitude":-97.401858,"address2":"","storeId":100214,"state":"TX","address1":"5801 South Hulen St","zip":76132,"latitude":32.664545,"name":"Hulen","zipplus4":2459,"city":"Ft. Worth","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"9038680502","longitude":-96.584213,"address2":"","storeId":100215,"state":"TX","address1":"4612 Texoma Pkwy","zip":75090,"latitude":33.683559,"name":"Sherman","zipplus4":2065,"city":"Sherman","hours":"Monday through Friday 9am to 7pm, Saturday 9am to 8pm, Sunday 11am to 6pm"},{"phone":"9726685820","longitude":-96.815191,"address2":"","storeId":100216,"state":"TX","address1":"8049 Gaylord Pkwy","zip":75034,"latitude":33.101543,"name":"Frisco","zipplus4":8590,"city":"Frisco","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"9037599474","longitude":-94.769264,"address2":"","storeId":100401,"state":"TX","address1":"1101 West Loop 281","zip":75604,"latitude":32.534505,"name":"Longview","zipplus4":2922,"city":"Longview","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"8003308076","longitude":-95.304311,"address2":"","storeId":100402,"state":"TX","address1":"4409 Old Bullard Rd","zip":75703,"latitude":32.301471,"name":"Tyler","zipplus4":1230,"city":"Tyler","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"8063587544","longitude":-101.93758,"address2":"","storeId":100601,"state":"TX","address1":"8600 W 34th St","zip":79121,"latitude":35.176592,"name":"Amarillo","zipplus4":1059,"city":"Amarillo","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"9013804150","longitude":-89.794505,"address2":"","storeId":100701,"state":"TN","address1":"2825 Wolfcreek Pkwy","zip":38133,"latitude":35.202461,"name":"Wolfcreek","zipplus4":8162,"city":"Memphis","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"9017955577","longitude":-89.834381,"address2":"","storeId":100703,"state":"TN","address1":"6870 Winchester Dr","zip":38115,"latitude":35.049271,"name":"Winchester","zipplus4":4402,"city":"Memphis","hours":"Monday through Saturday 10am to 7pm, Sunday noon to 6pm"},{"phone":"9129274600","longitude":-81.12226,"address2":"","storeId":100801,"state":"GA","address1":"7923 Abercorn Extension","zip":31406,"latitude":32.00359,"name":"Abercorn Ext","zipplus4":3414,"city":"Savannah","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"8438375500","longitude":-80.810139,"address2":"","storeId":100803,"state":"SC","address1":"2 Buckingham Plantation Dr","zip":29910,"latitude":32.237209,"name":"Hilton Head","zipplus4":6503,"city":"Bluffton","hours":"Monday through Saturday 10am to 8pm, Sunday noon to 6pm"},{"phone":"7704422810","longitude":-84.297614,"address2":"","storeId":100903,"state":"GA","address1":"6731 N Point Pkwy","zip":30022,"latitude":34.044383,"name":"North Point","zipplus4":8257,"city":"Alpharetta","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"7709617476","longitude":-84.349835,"address2":"","storeId":100904,"state":"GA","address1":"1230 Mt Zion Rd","zip":30260,"latitude":33.571474,"name":"Southlake Mall","zipplus4":2314,"city":"Morrow","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"7709532160","longitude":-84.472905,"address2":"","storeId":100906,"state":"GA","address1":"2079 Cobb Pkwy Se","zip":30080,"latitude":33.887463,"name":"Cobb Parkway","zipplus4":7601,"city":"Smyrna","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"7708316110","longitude":-83.984258,"address2":"","storeId":100907,"state":"GA","address1":"3333 Buford Drive","zip":30519,"latitude":34.071252,"name":"Mall Of Georgia","zipplus4":4930,"city":"Buford","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"7709720564","longitude":-84.008428,"address2":"","storeId":100909,"state":"GA","address1":"2297 Main St E","zip":30078,"latitude":33.854953,"name":"Snellville","zipplus4":3332,"city":"Snellville","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"7704910536","longitude":-84.2185,"address2":"4013 Lavista Rd","storeId":100911,"state":"GA","address1":"Northlake Tower Festival","zip":30084,"latitude":33.8563,"name":"Northlake","zipplus4":5308,"city":"Tucker","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"7704970567","longitude":-84.128583,"address2":"","storeId":100912,"state":"GA","address1":"3380 Satellite Blvd","zip":30096,"latitude":33.964506,"name":"Gwinnett Place","zipplus4":4639,"city":"Duluth","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"7704230266","longitude":-84.575073,"address2":"","storeId":100913,"state":"GA","address1":"724 Home Center Dr Nw","zip":30144,"latitude":34.003946,"name":"Town Center Mall","zipplus4":6810,"city":"Kennesaw","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"7705369158","longitude":-83.849347,"address2":"","storeId":100915,"state":"GA","address1":"1918 Browns Bridge Rd","zip":30501,"latitude":34.28366,"name":"Gainesville","zipplus4":4728,"city":"Gainesville","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"7703520901","longitude":-84.338374,"address2":"","storeId":100917,"state":"GA","address1":"132 Perimeter Center W","zip":30346,"latitude":33.926556,"name":"Perimeter","zipplus4":1224,"city":"Atlanta","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"6788176542","longitude":-84.442923,"address2":"","storeId":100919,"state":"GA","address1":"1302 Hwy 85 N","zip":30214,"latitude":33.473125,"name":"Fayetteville","zipplus4":1355,"city":"Fayetteville","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"8435722214","longitude":-80.04023,"address2":"","storeId":101101,"state":"SC","address1":"7619 Rivers Ave","zip":29406,"latitude":32.94006,"name":"North Charleston","zipplus4":4011,"city":"N Charleston","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"8435566221","longitude":-80.015228,"address2":"","storeId":101102,"state":"SC","address1":"1760 Sam Rittenberg Blvd","zip":29407,"latitude":32.803001,"name":"West Ashley","zipplus4":4903,"city":"Charleston","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"8037987464","longitude":-81.093241,"address2":"","storeId":101301,"state":"SC","address1":"1430 Colonial Life Blvd","zip":29210,"latitude":34.028126,"name":"Dutch Square","zipplus4":7646,"city":"Columbia","hours":"Monday through Saturday 9am to 8pm, Sunday noon to 6pm"},{"phone":"8037880516","longitude":-80.945806,"address2":"","storeId":101303,"state":"SC","address1":"7515 Two Notch Rd","zip":29223,"latitude":34.07537,"name":"Two Notch Road","zipplus4":6219,"city":"Columbia","hours":"Monday through Saturday 9am to 8pm, Sunday noon to 6pm"},{"phone":"9107913320","longitude":-77.903051,"address2":"","storeId":101401,"state":"NC","address1":"3709 Oleander Dr","zip":28403,"latitude":34.2156,"name":"Wilmington","zipplus4":823,"city":"Wilmington","hours":"Monday through Friday 10am to 8pm, Saturday 10am to 7pm, Sunday 1pm to 6pm"},{"phone":"3342715400","longitude":-86.193405,"address2":"","storeId":101501,"state":"AL","address1":"6201 Atlanta Hwy","zip":36117,"latitude":32.382333,"name":"Montgomery","zipplus4":2801,"city":"Montgomery","hours":"Monday through Saturday 10am to 8pm, Sunday 1pm to 6pm"},{"phone":"6157311172","longitude":-86.659101,"address2":"","storeId":101601,"state":"TN","address1":"5222 Hickory Hollow Pkwy","zip":37013,"latitude":36.048486,"name":"Hickory Hollow","zipplus4":3004,"city":"Antioch","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"6158516722","longitude":-86.68751,"address2":"","storeId":101602,"state":"TN","address1":"2208 North Gallatin Rd","zip":37115,"latitude":36.30571,"name":"Rivergate","zipplus4":2006,"city":"Madison","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"6158907591","longitude":-86.439298,"address2":"","storeId":101603,"state":"TN","address1":"135 River Rock Blvd","zip":37128,"latitude":35.845731,"name":"Murfreesboro","zipplus4":4828,"city":"Murfreesboro","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"6153704525","longitude":-86.802212,"address2":"","storeId":101605,"state":"TN","address1":"8105 Moores Ln","zip":37027,"latitude":35.965748,"name":"Cool Springs","zipplus4":8020,"city":"Brentwood","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"2703930099","longitude":-86.432569,"address2":"","storeId":101608,"state":"KY","address1":"1850 Scottsville Rd","zip":42104,"latitude":36.966948,"name":"Bowling Green","zipplus4":3302,"city":"Bowling Green","hours":"Monday through Saturday 9am to 8pm, Sunday noon to 6pm"},{"phone":"5019450178","longitude":-92.221445,"address2":"","storeId":101702,"state":"AR","address1":"4200 Landers Rd","zip":72117,"latitude":34.793465,"name":"North Little Rock","zipplus4":2532,"city":"N Little Rock","hours":"Monday through Saturday 9am to 8pm, Sunday noon to 6pm"},{"phone":"5012249581","longitude":-92.393943,"address2":"","storeId":101703,"state":"AR","address1":"280 S Shackleford Rd","zip":72211,"latitude":34.751484,"name":"Shackleford Road","zipplus4":5723,"city":"Little Rock","hours":"Monday through Saturday 9am to 8pm, Sunday noon to 6pm"},{"phone":"5015368000","longitude":-91.972683,"address2":"","storeId":101704,"state":"AR","address1":"2801 E Harding Ave","zip":71601,"latitude":34.21065,"name":"Pine Bluff","zipplus4":6851,"city":"Pine Bluff","hours":"Monday through Saturday 9am to 8pm, Sunday noon to 6pm"},{"phone":"8282818172","longitude":-82.528127,"address2":"","storeId":101902,"state":"NC","address1":"246 Tunnel Rd","zip":28805,"latitude":35.585783,"name":"Asheville Store","zipplus4":1835,"city":"Asheville","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"8656947572","longitude":-84.105097,"address2":"","storeId":102001,"state":"TN","address1":"9641 Kingston Pike","zip":37922,"latitude":35.908018,"name":"Knoxville","zipplus4":2316,"city":"Knoxville","hours":"Monday through Saturday 10am to 9pm, Sunday 1pm to 6pm"},{"phone":"7045429886","longitude":-80.878492,"address2":"","storeId":102104,"state":"NC","address1":"11500 Carolina Place Pkwy","zip":28134,"latitude":35.076712,"name":"Carolina Place","zipplus4":8817,"city":"Pineville","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"7045962125","longitude":-80.844695,"address2":"","storeId":102105,"state":"NC","address1":"7101 Smith Corners Blvd","zip":28269,"latitude":35.349295,"name":"Smith Corners","zipplus4":3794,"city":"Charlotte","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"3367681000","longitude":-80.30325,"address2":"","storeId":102201,"state":"NC","address1":"230 Charlois Blvd","zip":27103,"latitude":36.082298,"name":"Stratford Park","zipplus4":1508,"city":"Winston Salem","hours":"Monday through Saturday 10am to 8pm, Sunday 1pm to 6pm"},{"phone":"9042726655","longitude":-81.741402,"address2":"","storeId":102301,"state":"FL","address1":"86 Blanding Blvd","zip":32073,"latitude":30.240225,"name":"Orange Park","zipplus4":2626,"city":"Jacksonville","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"9047217075","longitude":-81.546154,"address2":"","storeId":102307,"state":"FL","address1":"9735 Atlantic Blvd","zip":32225,"latitude":30.322059,"name":"Regency","zipplus4":8222,"city":"Jacksonville","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"9042605117","longitude":-81.552038,"address2":"","storeId":102308,"state":"FL","address1":"10464 Phillips Hwy","zip":32256,"latitude":30.178513,"name":"Avenues","zipplus4":3587,"city":"Jacksonville","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"9197836115","longitude":-78.709569,"address2":"","storeId":102401,"state":"NC","address1":"6701 Glenwood Ave Ste 121","zip":27612,"latitude":35.860904,"name":"Raleigh","zipplus4":7126,"city":"Raleigh","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"9194197078","longitude":-78.992968,"address2":"","storeId":102402,"state":"NC","address1":"5501 Durham Chapel Hill Blvd","zip":27707,"latitude":35.953448,"name":"Durham","zipplus4":3318,"city":"Durham","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"9108687093","longitude":-78.968678,"address2":"","storeId":102403,"state":"NC","address1":"1983 Skibo Rd","zip":28314,"latitude":35.061696,"name":"Fayetteville","zipplus4":3318,"city":"Fayetteville","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"7277874177","longitude":-82.772053,"address2":"","storeId":102503,"state":"FL","address1":"31594 Hwy 19 S","zip":34684,"latitude":28.062416,"name":"Palm Harbor","zipplus4":3723,"city":"Palm Harbor","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"8136432010","longitude":-82.314623,"address2":"","storeId":102505,"state":"FL","address1":"1906 W Brandon Blvd","zip":33511,"latitude":27.937759,"name":"Brandon","zipplus4":4814,"city":"Brandon","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"8132646131","longitude":-82.502433,"address2":"","storeId":102506,"state":"FL","address1":"16312 N Dale Mabry Hwy","zip":33618,"latitude":28.102543,"name":"Dale Mabry","zipplus4":1341,"city":"Tampa","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"7278349429","longitude":-82.744983,"address2":"","storeId":102507,"state":"FL","address1":"8905 Us Hwy 19","zip":34668,"latitude":28.177756,"name":"Port Richey","zipplus4":5245,"city":"Port Richey","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"8047947902","longitude":-77.608891,"address2":"","storeId":102702,"state":"VA","address1":"11501 Midlothian Tpke","zip":23235,"latitude":37.505372,"name":"Midlothian","zipplus4":4719,"city":"Richmond","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"8042707043","longitude":-77.570965,"address2":"","storeId":102705,"state":"VA","address1":"10070 W Broad St","zip":23060,"latitude":37.645063,"name":"Glen Allen","zipplus4":6405,"city":"Glen Allen","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"7067388217","longitude":-82.07607,"address2":"","storeId":102801,"state":"GA","address1":"3411 Wrightsboro Rd","zip":30909,"latitude":33.468147,"name":"Augusta","zipplus4":2503,"city":"Augusta","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"3259447133","longitude":-100.457797,"address2":"","storeId":102901,"state":"TX","address1":"1735 Knickerbocker Rd","zip":76904,"latitude":31.429447,"name":"San Angelo","zipplus4":5521,"city":"San Angelo","hours":"Monday through Saturday 10am to 8pm, Sunday noon to 6pm"},{"phone":"2568314740","longitude":-85.827248,"address2":"","storeId":103001,"state":"AL","address1":"1701 S Quintard Ave","zip":36201,"latitude":33.626411,"name":"Anniston","zipplus4":8252,"city":"Anniston","hours":"Monday through Saturday 9am to 8pm, Sunday 1pm to 6pm"},{"phone":"8506563444","longitude":-84.229822,"address2":"","storeId":103401,"state":"FL","address1":"2940 Apalachee Pkwy","zip":32301,"latitude":30.427234,"name":"Tallahassee","zipplus4":3678,"city":"Tallahassee","hours":"Monday through Saturday 10am to 8pm, Sunday noon to 6pm"},{"phone":"3256920300","longitude":-99.786451,"address2":"","storeId":103601,"state":"TX","address1":"1383 S Danville Dr","zip":79605,"latitude":32.429333,"name":"Abilene","zipplus4":4618,"city":"Abilene","hours":"Monday through Saturday 10am to 9pm, Sunday 1pm to 6pm"},{"phone":"2294460419","longitude":-84.219427,"address2":"","storeId":103802,"state":"GA","address1":"827 N Westover Blvd","zip":31707,"latitude":31.59928,"name":"Albany","zipplus4":1677,"city":"Albany","hours":"Monday through Saturday 10am to 8pm, Sunday 1pm to 6pm"},{"phone":"8506510101","longitude":-86.580895,"address2":"","storeId":103902,"state":"FL","address1":"1175 Eglin Pkwy","zip":32579,"latitude":30.442066,"name":"Fort Walton Beach","zipplus4":1299,"city":"Shalimar","hours":"Monday through Saturday 10am to 8pm, Sunday noon to 6pm"},{"phone":"5122579803","longitude":-97.801984,"address2":"","storeId":104102,"state":"TX","address1":"11091 Pecan Park Blvd","zip":78613,"latitude":30.471417,"name":"Austin Lakeline","zipplus4":1527,"city":"Cedar Park","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"8436650411","longitude":-79.803867,"address2":"","storeId":104201,"state":"SC","address1":"220 S Cashua Dr","zip":29501,"latitude":34.190929,"name":"Florence","zipplus4":4004,"city":"Florence","hours":"Monday through Saturday 10am to 7pm, Sunday 1:30pm to 6pm"},{"phone":"4787881396","longitude":-83.691233,"address2":"","storeId":104302,"state":"GA","address1":"3654 Eisenhower Pkwy","zip":31206,"latitude":32.815464,"name":"Macon Store","zipplus4":3677,"city":"Macon","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"8636461463","longitude":-81.956759,"address2":"","storeId":104401,"state":"FL","address1":"4240 S Florida Ave","zip":33813,"latitude":27.98866,"name":"Lakeland","zipplus4":1628,"city":"Lakeland","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"2399362229","longitude":-81.872087,"address2":"","storeId":104501,"state":"FL","address1":"11798 Cleveland Ave","zip":33907,"latitude":26.569223,"name":"Fort Myers","zipplus4":2863,"city":"Fort Myers","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"2395961256","longitude":-81.799381,"address2":"Ste 50","storeId":104504,"state":"FL","address1":"1000 Immokalee Rd","zip":34110,"latitude":26.272225,"name":"Naples","zipplus4":4800,"city":"Naples","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"9419263196","longitude":-82.493033,"address2":"","storeId":104505,"state":"FL","address1":"8599 S Tamiami Trl","zip":34238,"latitude":27.22568,"name":"Sarasota","zipplus4":3045,"city":"Sarasota","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"2513434412","longitude":-88.204896,"address2":"","storeId":104601,"state":"AL","address1":"7033 Airport Blvd","zip":36608,"latitude":30.684671,"name":"Airport Blvd","zipplus4":3712,"city":"Mobile","hours":"Monday through Saturday 10am to 8pm, Sunday noon to 6pm"},{"phone":"8067997544","longitude":-101.905461,"address2":"","storeId":104701,"state":"TX","address1":"7401 Quaker Ave","zip":79424,"latitude":33.527015,"name":"Lubbock","zipplus4":2317,"city":"Lubbock","hours":"Monday through Saturday 10am to 9pm, Sunday 1pm to 6pm"},{"phone":"7724655400","longitude":-80.338333,"address2":"","storeId":104802,"state":"FL","address1":"1718 S Us Hwy 1","zip":34950,"latitude":27.373405,"name":"Fort Pierce","zipplus4":5144,"city":"Fort Pierce","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"7726929214","longitude":-80.274016,"address2":"","storeId":104803,"state":"FL","address1":"3534 Nw Federal Hwy","zip":34957,"latitude":27.248264,"name":"Treasure Coast","zipplus4":4424,"city":"Jensen Beach","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"3184457752","longitude":-92.46954202651,"address2":"","storeId":104901,"state":"LA","address1":"2300 S Mcarthur Dr","zip":71301,"latitude":31.271338462829,"name":"Alexandria","zipplus4":3037,"city":"Alexandria","hours":"Monday through Saturday 9am to 9pm, Sunday noon to 6pm"},{"phone":"3183628093","longitude":-92.063083,"address2":"","storeId":105003,"state":"LA","address1":"4641 Pecanland Mall Dr","zip":71203,"latitude":32.498894,"name":"Monroe","zipplus4":7001,"city":"Monroe","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"7574979500","longitude":-76.159563,"address2":"","storeId":105101,"state":"VA","address1":"5169 Virginia Beach Blvd","zip":23462,"latitude":36.846838,"name":"Virginia Beach","zipplus4":1823,"city":"Virginia Beach","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"7578819500","longitude":-76.484012,"address2":"","storeId":105102,"state":"VA","address1":"11871 Jefferson Ave","zip":23606,"latitude":37.088756,"name":"Newport News","zipplus4":2505,"city":"Newport News","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"3166365445","longitude":-97.244647,"address2":"","storeId":105401,"state":"KS","address1":"1725 N Rock Rd","zip":67206,"latitude":37.714594,"name":"Wichita","zipplus4":1258,"city":"Wichita","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"5023398874","longitude":-85.576795,"address2":"","storeId":105501,"state":"KY","address1":"103 N Hurstbourne Pkwy","zip":40222,"latitude":38.246473,"name":"Louisville","zipplus4":5107,"city":"Louisville","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"8595431223","longitude":-84.4225,"address2":"2150 Paul Jones Way","storeId":105503,"state":"KY","address1":"Hamburg Place","zip":40509,"latitude":38.008,"name":"Lexington","zipplus4":2219,"city":"Lexington","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"2059896492","longitude":-86.798167,"address2":"","storeId":105601,"state":"AL","address1":"3650 Lorna Rd","zip":35216,"latitude":33.380498,"name":"Riverchase","zipplus4":5919,"city":"Birmingham","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"2059561339","longitude":-86.703509,"address2":"","storeId":105602,"state":"AL","address1":"1911 Crestwood Blvd","zip":35210,"latitude":33.533055,"name":"Irondale","zipplus4":2033,"city":"Irondale","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"5405631658","longitude":-79.966944,"address2":"","storeId":105701,"state":"VA","address1":"1920 Valley View Blvd Nw","zip":24012,"latitude":37.305436,"name":"Roanoke","zipplus4":2024,"city":"Roanoke","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"4178645300","longitude":-93.225002,"address2":"","storeId":105801,"state":"MO","address1":"1212 N Eastgate Ave","zip":65802,"latitude":37.21897,"name":"Springfield","zipplus4":2468,"city":"Springfield","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"6012967575","longitude":-89.363612,"address2":"","storeId":105901,"state":"MS","address1":"120 Mayfair Rd","zip":39402,"latitude":31.322136,"name":"Hattiesburg","zipplus4":1463,"city":"Hattiesburg","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"8504941428","longitude":-87.223452,"address2":"","storeId":103903,"state":"FL","address1":"6500 N Davis Hwy","zip":32504,"latitude":30.491451,"name":"North Davis Hwy Store","zipplus4":6957,"city":"Pensacola","hours":"Monday through Saturday 10am to 8pm, Sunday noon to 6pm"},{"phone":"7275310661","longitude":-82.772053,"address2":"","storeId":102508,"state":"FL","address1":"15701 Us 19 N","zip":33764,"latitude":28.062416,"name":"Clearwater Store","zipplus4":7712,"city":"Clearwater","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"4077741330","longitude":-81.406999,"address2":"","storeId":106201,"state":"FL","address1":"645 State Road 436","zip":32714,"latitude":28.661997,"name":"Altamonte Springs","zipplus4":3049,"city":"Altamonte Springs","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"4072280551","longitude":-81.329615,"address2":"","storeId":106202,"state":"FL","address1":"4545 E Colonial Dr","zip":32803,"latitude":28.553442,"name":"East Colonial","zipplus4":4301,"city":"Orlando","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"7039340263","longitude":-77.330001,"address2":"","storeId":106101,"state":"VA","address1":"11151 Lee Hwy","zip":22030,"latitude":38.851932,"name":"Fairfax","zipplus4":5004,"city":"Fairfax","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"7034921122","longitude":-77.292316,"address2":"","storeId":106102,"state":"VA","address1":"2600 Opitz Blvd","zip":22192,"latitude":38.636882,"name":"Woodbridge","zipplus4":6813,"city":"Woodbridge","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"3863233772","longitude":-81.082114,"address2":"","storeId":102303,"state":"FL","address1":"2600 W International Speedway","zip":32114,"latitude":29.176514,"name":"Daytona","zipplus4":1120,"city":"Daytona Beach","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"4078581185","longitude":-81.404821,"address2":"","storeId":106203,"state":"FL","address1":"2000 Principal Row","zip":32837,"latitude":28.426133,"name":"S Orange Blossom Trail","zipplus4":8348,"city":"Orlando","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"8174673280","longitude":-97.13894,"address2":"","storeId":100217,"state":"TX","address1":"1900 Pleasant Ridge Rd","zip":76015,"latitude":32.677976,"name":"Arlington","zipplus4":4511,"city":"Arlington","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"5407851380","longitude":-77.511611,"address2":"","storeId":106103,"state":"VA","address1":"3102 Plank Rd","zip":22407,"latitude":38.296128,"name":"Fredericksburg","zipplus4":4954,"city":"Fredericksburg","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"6015728938","longitude":-90.137384,"address2":"","storeId":105004,"state":"MS","address1":"1051 East County Line Road","zip":39211,"latitude":32.399394,"name":"East County Line","zipplus4":1851,"city":"Jackson","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"5616150049","longitude":-80.090429,"address2":"","storeId":104804,"state":"FL","address1":"2501 Okeechobee Blvd","zip":33409,"latitude":26.70656,"name":"West Palm Beach","zipplus4":4005,"city":"West Palm Beach","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"2055562100","longitude":-87.5252,"address2":"","storeId":105603,"state":"AL","address1":"3215 Mcfarland Blvd., East","zip":35405,"latitude":33.179863,"name":"Tuscaloosa","zipplus4":2425,"city":"Tuscaloosa","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"3014645415","longitude":-76.722256,"address2":"","storeId":106104,"state":"MD","address1":"4510 Mitchellville Road","zip":20716,"latitude":38.945797,"name":"Bowie","zipplus4":3111,"city":"Bowie","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"3216329556","longitude":-80.760951,"address2":"","storeId":106204,"state":"FL","address1":"4075 N Us Hwy 1","zip":32927,"latitude":28.434789,"name":"Cocoa","zipplus4":5914,"city":"Cocoa","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"3217680019","longitude":-80.66649,"address2":"","storeId":106205,"state":"FL","address1":"2800 W New Haven Ave","zip":32904,"latitude":28.078945,"name":"Melbourne","zipplus4":3613,"city":"Melbourne","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"7065466831","longitude":-83.476088,"address2":"","storeId":100921,"state":"GA","address1":"4120 Atlanta Hwy","zip":30622,"latitude":33.940499,"name":"Athens","zipplus4":2210,"city":"Bogart","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"4107159700","longitude":-76.82022,"address2":"","storeId":106105,"state":"MD","address1":"6475 Dobbin Road","zip":21045,"latitude":39.193874,"name":"Columbia","zipplus4":4736,"city":"Columbia","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"5136714920","longitude":-84.467193,"address2":"","storeId":106401,"state":"OH","address1":"11444 Princeton Pike","zip":45246,"latitude":39.285277,"name":"Tri-county","zipplus4":3204,"city":"Cincinnati","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"2252011484","longitude":-91.09467,"address2":"","storeId":106501,"state":"LA","address1":"8680 Airline Hwy","zip":70815,"latitude":30.450726,"name":"Baton Rouge","zipplus4":8128,"city":"Baton Rouge","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"7034440944","longitude":-77.421458,"address2":"","storeId":106106,"state":"VA","address1":"21085 Dulles Town Circle","zip":20166,"latitude":39.028943,"name":"Dulles","zipplus4":2417,"city":"Dulles","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"2106901409","longitude":-98.657264,"address2":"","storeId":106301,"state":"TX","address1":"13141 Ih 10 West","zip":78249,"latitude":29.28221,"name":"San Antonio","zipplus4":2244,"city":"San Antonio","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"2105660303","longitude":-98.327033,"address2":"","storeId":106302,"state":"TX","address1":"14555 Forum Parkway","zip":78154,"latitude":29.571753,"name":"San Antonio/ne (the Forum)","zipplus4":1342,"city":"Selma","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"9548370863","longitude":-80.318835,"address2":"","storeId":104806,"state":"FL","address1":"12610 W. Sunrise Blvd","zip":33323,"latitude":26.145094,"name":"Sawgrass","zipplus4":2998,"city":"Sunrise","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"6147856190","longitude":-82.994485,"address2":"","storeId":101201,"state":"OH","address1":"935 Polaris Parkway","zip":43240,"latitude":40.14951,"name":"Columbus Polaris","zipplus4":2035,"city":"Columbus","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"3175582992","longitude":-86.071464,"address2":"","storeId":101001,"state":"IN","address1":"8410 Castleton Corner","zip":46250,"latitude":39.908985,"name":"Castelton Commons","zipplus4":3579,"city":"Indianapolis","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"3185243325","longitude":-93.713561,"address2":"","storeId":102604,"state":"LA","address1":"1744 East 70th Street","zip":71105,"latitude":32.443336,"name":"Eastgate","zipplus4":5211,"city":"Shreveport","hours":"Monday through Saturday 10am to 9pm, Sunday 1pm to 6pm"},{"phone":"4044432906","longitude":-84.091917,"address2":"","storeId":100914,"state":"GA","address1":"8030 Mall Parkway","zip":30038,"latitude":33.692448,"name":"Stonecrest Mall","zipplus4":2542,"city":"Lithonia","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"9416250363","longitude":-82.128384,"address2":"Suite 225","storeId":104506,"state":"FL","address1":"2000 Tamiami Trail","zip":33948,"latitude":27.003573,"name":"Port Charlotte","zipplus4":2182,"city":"Port Charlotte","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"9722912344","longitude":-96.94095611572,"address2":"","storeId":100220,"state":"TX","address1":"320 Clancy Nolan Drive","zip":75104,"latitude":32.597208023071,"name":"Cedar Hill","zipplus4":2153,"city":"Cedar Hill","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"8642889525","longitude":-82.339662,"address2":"","storeId":103101,"state":"SC","address1":"610 Haywood Rd","zip":29607,"latitude":34.847284,"name":"Greenville","zipplus4":2720,"city":"Greenville","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"8595944283","longitude":-84.640677,"address2":"","storeId":106402,"state":"KY","address1":"77 Spiral Road","zip":41042,"latitude":39.011087,"name":"Florence","zipplus4":4853,"city":"Florence","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"2568374283","longitude":-86.662705,"address2":"","storeId":103201,"state":"AL","address1":"930 Old Monrovia Road","zip":35806,"latitude":34.735858,"name":"Huntsville","zipplus4":2514,"city":"Huntsville","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"},{"phone":"5123588646","longitude":-97.839574,"address2":"Bldg B, Suite 800","storeId":104103,"state":"TX","address1":"4301 West William Cannon","zip":78749,"latitude":30.222582,"name":"Arbor Trail","zipplus4":1476,"city":"Austin","hours":"Monday through Saturday 10am to 9pm, Sunday 11am to 6pm"},{"phone":"8004283789","longitude":-77.128196,"address2":"","storeId":106107,"state":"MD","address1":"1428 Rockville Pike","zip":20852,"latitude":39.067025,"name":"Rockville","zipplus4":1414,"city":"Rockville","hours":"Monday through Saturday 10am to 9pm, Sunday noon to 6pm"}]};

	//<![CDATA[
	/* 	
		Purpose: 	Initialize Google Maps 
		Parameters:	
			mapTagId			:	id of div element where the map will be drawn
			storeListTagId		:	id of table where store location address,phone etc will be shown
			visitorAddressTagId	:	id of input text box containing the input address
	*/
	function loadGoogleMaps(mapTagId, storeListTagId, visitorAddressTagId) {
	        if (dbg) alert("in loadGoogleMaps");
	 
		if (GBrowserIsCompatible()) {
			visitorAddress = document.getElementById(visitorAddressTagId);
			if (dbg) alert("visitorAddress" + visitorAddress.value);
	  	
			if (map != null && map.isLoaded()) {			 
				reset(storeListTagId);				
			} else {
				initialize(mapTagId, storeListTagId, visitorAddressTagId);
				 
			}
		}
	}
	
	function initialize(mapTagId, storeListTagId, visitorAddressTagId) {
	 if (dbg) alert("in initialize");
	  //alert("tags are"+ mapTagId + storeListTagId + visitorAddressTagId);
		// if variable not present, then load stale hard-coded data
		if ( ! eval(hvtStoresInfo) || hvtStoresInfo.location.length == 0) {
			alert('Data initialization review needed.');
			hvtStoresInfo = hvtStoresInfoBackup;
		}
		
		//initialize html tags
	  	map = new GMap2(document.getElementById(mapTagId));
	  	storeList = document.getElementById(storeListTagId);
	  	 
	  	visitorAddress = document.getElementById(visitorAddressTagId);
	  	//alert("storeList" + storeList + "visitorAddress" + visitorAddress);
	 
	  	// used to find lat,lng for input address
		geocoder = new GClientGeocoder(); 
	
		//add controls
		map.addControl(new GLargeMapControl());
		map.addControl(new GScaleControl());
		map.addControl(new GMapTypeControl());
	
		// add features
		map.enableDoubleClickZoom();
		map.enableContinuousZoom();
		map.enableScrollWheelZoom();
	
		// set map center
		map.setCenter(new GLatLng(hvtStoresInfo.location[0].latitude,hvtStoresInfo.location[0].longitude), 5);	
	}
	
	function reset(storeListTagId) {
	 if (dbg) alert("in reset");
		//GUnload();
		//map.clearOverlays();
		//remove previous closest stores
		 
		for (var j=0; j<visitorsOverlays.length; j++) {
			map.removeOverlay(visitorsOverlays[j]);
		}		
		
		// initialize procedural data stored in global variables
		resetData();
		
		// erase store list data from the right-hand pane's table element
		var tbl = document.getElementById(storeListTagId);
		while(tbl.hasChildNodes() == true) {
			tbl.removeChild(tbl.childNodes[0]);
		}		
	}
	
	// Initialize procedural data stored in global variables (hvtStoresInfo.location[i].visited)
	function resetData() {
	 if (dbg) alert("in resetData");
		// go through all stores and reset visited value to 0 (zero)
		for (var i=0; i<hvtStoresInfo.location.length; i++) {
			hvtStoresInfo.location[i].visited = 0;
		}
	}
	/*
		Purpose		: Display map information related to stores for items data
		Parameters	:
			selectedItem		:	
			selectedStore		:	
			iPStoresForItemsData:	StoresForItems JSON object
	*/
	function displayStoresForItemsInfo(selectedItem, selectedStore, iPStoresForItemsData) {
	 if (dbg) alert("in displayStoresForItemsInfo");
		pStoresForItemsData = iPStoresForItemsData;
		var counter = 0;
		var status = 0;
		var storeId = 0;
		var popupOnMap;
		for (var i=0; i<pStoresForItemsData.storeIds.length; i++) {
			popupOnMap = false;
			// display this store on list and on map with appropriate color-coded icon
			storeId = pStoresForItemsData.storeIds[i];
			status = getItemStatusForStore(selectedItem, i);
			visitorStoreInfo[counter] = getLocationForStoreId(storeId);
			if (selectedStore == storeId) {
				popupOnMap = true;
			}
			showItemAvailabilityBasedStore(selectedItem, counter, status, popupOnMap);
			counter++;
		}
		isInitial = false;
		displayHavertysStores();
	}

	/*	Purpose		: Get item availability status relative to store "storeId" 
						(1=onDisplay, 2=otherItemsOnDisplay, 0=notInDisplayAnywhere
		Parameters	: 
			selectedItem	: selected item whose item we need to find status for store "storeId"
			storeIndex		: index of storeId in storesforitems json object 
								(convenience param for locating inventory count)
	*/
	function getItemStatusForStore(selectedItem, storeIdIndex) {
	    if (dbg) alert("in getItemStatusForStore");
		var items = pStoresForItemsData.skuIds;
		var bItemsFoundInStore = false;
		// for store "storeId" find availability of item
		if(pStoresForItemsData.skus[selectedItem].inventory[storeIdIndex] > 0) { // if item available
			return 1;	//i.e. STOCKED
		} else { 
			// item is not available in store "storeId", search if other items are available in this store
			for(var j=0; j<items.length; j++) {
				var refItem = items[j];
				// check for items other than the one selected
				if (refItem != selectedItem && refItem != '') {
					// if this non-selected item's inventory is > 0 in store "storeId", then item found
					if (pStoresForItemsData.skus[refItem].inventory[storeIdIndex] > 0) {
						bItemsFoundInStore = true;
					}
				}
			}
			if (bItemsFoundInStore) {	
				return 2; //other items from group stocked in store "storeId"
			} else {
				return 0; //no items in this group stocked in store "storeId"
			}
		}
	}
	/*
		Purpose		:	
		Parameters	:	
			selectedItem		: status for stores will be shown relative to inventory count of this item
			visitorStoreIndex	: index of this store in the visitorStore array
			selectedItemStatus	: status of item in store stored under hvtStoresInfo.location[visitorStoreInfo[visitorStoreIndex]]
			popupOnMap			: if flag is true then this is the selected store => pop up info window
	*/
	function showItemAvailabilityBasedStore(selectedItem, vistorStoreIndex, selectedItemStatus, popupOnMap) {
	
	    if (dbg) alert("in showItemAvailabilityBasedStore");
		var address;
		var storeLatLng;
		var marker;
		var tbodyel = document.createElement("tbody");
		tbodyel.setAttribute('id', 'storelisttbody');
		var trel; var tdel;
		var i = vistorStoreIndex;
		storeLatLng = new GLatLng(hvtStoresInfo.location[visitorStoreInfo[i]].latitude,hvtStoresInfo.location[visitorStoreInfo[i]].longitude);
		address = getAddress(visitorStoreInfo[i]);
		marker = getColorCodedStoreMapMarker(selectedItem, selectedItemStatus, storeLatLng, visitorStoreInfo[i], popupOnMap);
		map.addOverlay(marker);	
		var infoTabs = getStoreInfoTabsWithAvailabilityInfo(selectedItem, visitorStoreInfo[i]);
		if (popupOnMap) {
			marker.openInfoWindowTabsHtml(infoTabs,{selectedTab:2,maxWidth:TAB_WIDTH});
		}		
		
		trel = document.createElement("tr");
		trel.setAttribute("id", "outerrow"+i);
		trel.setAttribute("class", "mapselect");
		trel.setAttribute("onclick", "javascript:panToLocationByItem('"+selectedItem+"',"+(visitorStoreInfo[i])+");");
		tdel = document.createElement("td");
		tdel.setAttribute("vAlign", "top");
		var tableel1 = document.createElement("table");
		var tbodyel1 = document.createElement("tbody");
		var trel1 = document.createElement("tr");
		var tdel1 = document.createElement("td");
		tableel1.appendChild(tbodyel1);
		tbodyel1.appendChild(trel1);
		trel1.appendChild(tdel1);
		tdel1.appendChild(getStoreListImageLinkByItem(selectedItem, i, address, visitorStoreInfo[i],selectedItemStatus));
		tdel.appendChild(tableel1);
		trel.appendChild(tdel);
		tdel = document.createElement("td");
		tdel.appendChild(getAddressTable(visitorStoreInfo[i],false, false, selectedItem));
		trel.appendChild(tdel);
		tbodyel.appendChild(trel);		
		storeList.appendChild(tbodyel);
		var bounds = new GLatLngBounds();
		for (var i=0; i<visitorStoreInfo.length;i++) {
			var fsp = new GLatLng(hvtStoresInfo.location[visitorStoreInfo[i]].latitude,hvtStoresInfo.location[visitorStoreInfo[i]].longitude);					
			bounds.extend(fsp);
		}
		map.setZoom(map.getBoundsZoomLevel(bounds));
		map.setCenter(bounds.getCenter());		
	}

	/*
		Purpose		:	Get array index of ith storeId
		Parameters	:	
			iStoreId		: storeId value from the hvtStoresInfo.location.storeId
	*/
	function getLocationForStoreId(iStoreId) {
	if (dbg) alert("in getLocationForStoreId");
		for (var i=0; i<hvtStoresInfo.location.length; i++) {
			if (hvtStoresInfo.location[i].storeId == iStoreId) {
				return i;
			}
		}
		return -1;
	}

	/*
		Purpose		:	Locate nearby stores based on input address
		Parameters	:	uses resultsForTagId (tag id for html element where visitor address will be displayed)
	*/		
	function getVisitorLatLng(passFunction, failFunction) {
	if (dbg) alert ("in getvisitorlatlgn " +visitorAddress.value);
	  	
		var address = visitorAddress.value;
		  if (dbg) alert ("in getvisitorlatlgn a1 "+ address );
		  
		//pt = doPoint();  
		// if (dbg) alert ("in getvisitorlatlgn pt "+ pt );
		 		
		geocoder.getLatLng(
			address + " USA",
			function(point) {
			    if (dbg) alert ("in point" );
				var address = visitorAddress.value;					 
				if (dbg) alert ("in getvisitorlatlgn a " + address );		
				var resultsForElement = document.getElementById(resultsForTagId);	
				if (dbg) alert ("in getvisitorlatlgn b " );	
				if (!point) {			
				    if (dbg) alert ("in getvisitorlatlgn if " );			
					resultsForElement.innerHTML = "Please enter a valid zip code or location.";
					if (dbg) alert ("in getvisitorlatlgn c" );	
					if (failFunction != null) {
					    if (dbg) alert ("in getvisitorlatlgn d " );	
						isInitial = true;
						failFunction();			
					}
				} else {				   
				    if (dbg) alert ("in getvisitorlatlgn e " + point );	
					visitorAddressInfo.latitude  = point.lat();
					visitorAddressInfo.longitude = point.lng();
					visitorAddressInfo.address = address;
					isInitial = false;
					if (dbg) alert ("in getvisitorlatlgn f " );	
					displayVisitorsStores();
					
					var bounds = new GLatLngBounds();
					bounds.extend(point);
					for (var i=0; i<visitorStoreInfo.length;i++) {
						var fsp = new GLatLng(hvtStoresInfo.location[visitorStoreInfo[i]].latitude,hvtStoresInfo.location[visitorStoreInfo[i]].longitude);					
						bounds.extend(fsp);
					}
					map.setZoom(map.getBoundsZoomLevel(bounds));
				
					map.setCenter(bounds.getCenter());
					
					resultsForElement.innerHTML = 'Results for ' + address;
					if ( document.getElementById('StoreLocatorResults') != undefined) { 
						document.getElementById('StoreLocatorResults').style.display = "block";
						if (showOutletStores) {
						document.getElementById('ShowOutletsIcons').style.display = "block";
						//document.getElementById('ShowOutletsLink').style.display = "none";
						} else{
						//document.getElementById('ShowOutletsLink').style.display = "block";	
						document.getElementById('ShowOutletsIcons').style.display = "none";	
						}	
					}
					
					if (passFunction != null) {
						passFunction();						
					}
					map.checkResize();
				}  // end else
			} // end function
						
		);
	}



function doPoint() {
			    if (dbg) alert ("in point" );
				var address = visitorAddress.value;					 
				if (dbg) alert ("in getvisitorlatlgn a " + address );		
				var resultsForElement = document.getElementById(resultsForTagId);	
				if (dbg) alert ("in getvisitorlatlgn b " );	
				if (!point) {			
				    			
					resultsForElement.innerHTML = "Please enter a valid zip code or location.";
					if (dbg) alert ("in getvisitorlatlgn c" );	
					if (failFunction != null) {
					    if (dbg) alert ("in getvisitorlatlgn d " );	
						isInitial = true;
						failFunction();			
					}
				} else {				   
				     	
					visitorAddressInfo.latitude  = point.lat();
					visitorAddressInfo.longitude = point.lng();
					visitorAddressInfo.address = address;
					isInitial = false;
					if (dbg) alert ("in getvisitorlatlgn f " );	
					displayVisitorsStores();
					
					var bounds = new GLatLngBounds();
					bounds.extend(point);
					for (var i=0; i<visitorStoreInfo.length;i++) {
						var fsp = new GLatLng(hvtStoresInfo.location[visitorStoreInfo[i]].latitude,hvtStoresInfo.location[visitorStoreInfo[i]].longitude);					
						bounds.extend(fsp);
					}
					map.setZoom(map.getBoundsZoomLevel(bounds));
				
					map.setCenter(bounds.getCenter());
					
					resultsForElement.innerHTML = 'Results for ' + address;
					document.getElementById('StoreLocatorResults').style.display = "block";
					if (showOutletStores) {
					document.getElementById('ShowOutletsIcons').style.display = "block";
					document.getElementById('ShowOutletsLink').style.display = "none";
					} else{
					document.getElementById('ShowOutletsLink').style.display = "block";	
					document.getElementById('ShowOutletsIcons').style.display = "none";	
					}	
					
					if (passFunction != null) {
						passFunction();						
					}
					map.checkResize();
				}  // end else
				
				return point;
			} // end function



	/*
		Purpose		:	Show 5 closes stores based on input address
		Parameters	:	none
	*/	
	function displayVisitorsStores() {
	 
	    if (dbg) alert ("in displayVisitorsStores "  );
		var address;
		var storeLatLng;
		var distance;
		var visitorLatLng = new GLatLng(visitorAddressInfo.latitude,visitorAddressInfo.longitude);
		var marker = getVisitorMapMarker(visitorAddressInfo.address, visitorLatLng);
		map.addOverlay(marker);
		visitorsOverlays[0] = marker;
		// calculate and populate distance to each store from user's address
		for (var i=0; i<hvtStoresInfo.location.length; i++) {
			storeLatLng = new GLatLng(hvtStoresInfo.location[i].latitude,hvtStoresInfo.location[i].longitude);
			address = getAddress(i);	
			distance = Math.round(storeLatLng.distanceFrom(visitorLatLng) * MILES_PER_METER*100)/100;
			hvtStoresInfo.location[i].distance = distance;
		}
		// store 5-closest stores in visitorStoreInfo[] array
		var shortestDistance, shortestDistanceIndex;
		for (var j=0; (j<hvtStoresInfo.location.length) && j<5; j++) {
			shortestDistance = 10000000;
			shortestDistanceIndex = i;
			for (var i=0; i<hvtStoresInfo.location.length; i++) {	
				if(hvtStoresInfo.location[i].visited != 1) {
					if (hvtStoresInfo.location[i].distance < shortestDistance) {
						shortestDistance = hvtStoresInfo.location[i].distance;
						shortestDistanceIndex = i;
					}
				}
			}
			visitorStoreInfo[j] = shortestDistanceIndex;
			hvtStoresInfo.location[shortestDistanceIndex].visited = 1;
		}
		// show closest stores
		var tbodyel = document.createElement("tbody");
		tbodyel.setAttribute('id', 'storelisttbody');
		var trel; var tdel;
		for (var i=0; i<visitorStoreInfo.length; i++) {
			storeLatLng = new GLatLng(hvtStoresInfo.location[visitorStoreInfo[i]].latitude,hvtStoresInfo.location[visitorStoreInfo[i]].longitude);
			address = getAddress(visitorStoreInfo[i]);
			marker = getStoreMapMarker(i, storeLatLng, visitorStoreInfo[i]);
			map.addOverlay(marker);			
			visitorsOverlays[i+1] = marker;
			trel = document.createElement("tr");
			trel.setAttribute("id", "outerrow"+i);
			trel.setAttribute("class", "mapselect");
			trel.setAttribute("onclick", "javascript:panToLocation("+(visitorStoreInfo[i])+");");
			tdel = document.createElement("td");
			tdel.setAttribute("vAlign", "top");
			var tableel1 = document.createElement("table");
			var tbodyel1 = document.createElement("tbody");
			var trel1 = document.createElement("tr");
			var tdel1 = document.createElement("td");
			tableel1.appendChild(tbodyel1);
			tbodyel1.appendChild(trel1);
			trel1.appendChild(tdel1);
			tdel1.appendChild(getStoreOnMapIconHtml(i, address, visitorStoreInfo[i]));
			tdel.appendChild(tableel1);
			trel.appendChild(tdel);
			tdel = document.createElement("td");
			tdel.appendChild(getAddressTable(visitorStoreInfo[i],false, true, null));
			trel.appendChild(tdel);
			tbodyel.appendChild(trel);		
		}
		storeList.appendChild(tbodyel);
	}	
	
	function displayHavertysStores() {
	 
	    if (dbg) alert ("in displayHavertysStores "  );
		// show non-closest stores on the map
		var visitorStoreInfoString = ','+String(visitorStoreInfo)+',';
		var storeLatLng;
		var bounds = new GLatLngBounds();
		for (var i=0; i<hvtStoresInfo.location.length; i++) {
			storeLatLng = new GLatLng(hvtStoresInfo.location[i].latitude,hvtStoresInfo.location[i].longitude);
			if (visitorStoreInfoString.indexOf(','+i+',') == -1) {
				var marker = getStoreMapMarker(-1, storeLatLng, i);
				map.addOverlay(marker);
			} 
			bounds.extend(storeLatLng);
		}
		if (isInitial) {
			map.setZoom(map.getBoundsZoomLevel(bounds));
			map.setCenter(bounds.getCenter());
		}
	}

	function getStoreOnMapIconHtml(iconId, address, locationNumber) {
	//if (dbg) alert ("in getStoreOnMapIconHtml "  );
		var ael = document.createElement("a");
		ael.setAttribute("href", "javascript:panToLocation("+locationNumber+');');
		var imgel = document.createElement("img");
		if (showOutletStores && hvtStoresInfo.location[locationNumber].brtype == 'C')
			imgel.setAttribute("src", IMAGES_DIR + "markerRed"+String.fromCharCode(iconId+65)+".gif");
		else
			imgel.setAttribute("src", IMAGES_DIR + "marker"+String.fromCharCode(iconId+65)+".gif");
		imgel.setAttribute("border", "0");
		ael.appendChild(imgel);
		return ael;
	}

	function getStoreListImageLinkByItem(selectedItem, iconId, address, locationNumber, storeItemQty) {
	if (dbg) alert ("in getStoreListImageLinkByItem "  );
		var iconName = "";
		// determine which icon to use
		if (storeItemQty == '1') {
			iconName = "green";
		} else if (storeItemQty == '2') {
			iconName = "yellow";
		} else if (storeItemQty == '0') {
			iconName = "red";
		}
		var ael = document.createElement("a");
		ael.setAttribute("href", "javascript:panToLocationByItem('"+selectedItem+"',"+locationNumber+",'Availability');");
		var imgel = document.createElement("img");
		imgel.setAttribute("src", IMAGES_DIR+"mm_20_"+iconName+".gif");
		imgel.setAttribute("class", 'locatestoreimglink');
		imgel.setAttribute("border", "0");
		ael.appendChild(imgel);
		return ael;
	}

	function getStoreInfoTabsWithAvailabilityInfo(selectedItem, locationNumber) {
	
	if (dbg) alert ("getStoreInfoTabsWithAvailabilityInfo "  );
		var divel = document.createElement("div");
		divel.appendChild(getAddressTable(locationNumber, true, true, null));
		var divel2 = document.createElement("div");
		divel2.innerHTML = getAvailabilityInfo(selectedItem, locationNumber);		
		divelHours = document.createElement("div");
		divelHours.appendChild(getHoursTable(locationNumber));		
		var infoTabs = [
			new GInfoWindowTab("Address", divel.innerHTML),
			new GInfoWindowTab("Hours", divelHours.innerHTML),
			new GInfoWindowTab("Availability", divel2.innerHTML)
		];
		return infoTabs;
	}	
	function getAvailabilityInfo(selectedItem, locationNumber) {
	if (dbg) alert ("getAvailabilityInfo"  );
	
		var resultHTML = "";
		var storeId = hvtStoresInfo.location[locationNumber].storeId;
		var storeIdPosition = 0;
		var itemName = "";
		var sku = ""
		// find position of this store in json string
		for (var j=0; j<pStoresForItemsData.storeIds.length; j++) {
			if (storeId == pStoresForItemsData.storeIds[j]) {
				storeIdPosition = j;
			}
		}
		itemName = pStoresForItemsData.skus[selectedItem].name;
		if (pStoresForItemsData.skus[selectedItem].inventory[storeIdPosition] > 0) {
			// item is on display
			resultHTML += "<br /><img src='"+IMAGES_DIR+"WherePass.jpg' />"+"The " + itemName + " is on display in this store<br /><br />";
		} else {
			// item is not on display
			resultHTML += "<br /><img src='"+IMAGES_DIR+"WhereFail.jpg' />"+"The " + itemName + " is <b>not</b> on display in this store<br /><br />";
		}
		// get items available/not available at this store
		var onDisplay = "";
		for (var i=0; i<pStoresForItemsData.skuIds.length; i++) {
			sku = pStoresForItemsData.skuIds[i];
			if (selectedItem != sku) {
				itemName = pStoresForItemsData.skus[sku].name; 
				if (pStoresForItemsData.skus[sku].inventory[storeIdPosition] > 0) {
					// item available
					onDisplay += "<img src='"+IMAGES_DIR+"WherePass.jpg' />" + itemName + "<br />";
				}
			}
		}
		if (onDisplay != "") {
			resultHTML += "<span class='bold'>On display</span><br />" + onDisplay;
		}
		var notOnDisplay = "";
		for (var i=0; i<pStoresForItemsData.skuIds.length; i++) {
			sku = pStoresForItemsData.skuIds[i];
			if (selectedItem != sku) {
				itemName = pStoresForItemsData.skus[sku].name; 
				if (pStoresForItemsData.skus[sku].inventory[storeIdPosition] <= 0) {
					// item not available
					notOnDisplay += "<img src='"+IMAGES_DIR+"WhereFail.jpg' />" + itemName + "<br />";
				}
			}
		}	
		if (notOnDisplay != "") {
			resultHTML += "<br /><span class='bold'>" + GMAPS_NOT_ON_DISPLAY + "</span><br />" + notOnDisplay;
		}		
		resultHTML = "<div class='googleMapsInfoWindow'>" + resultHTML + "</div>";	
		return resultHTML;
	}
	function getStoreInfoTabs(locationNumber) {
	//if (dbg) alert ("getStoreInfoTabs"  );
		var divel = document.createElement("div");
		divel.appendChild(getAddressTable(locationNumber, true, true, null));
		divelHours = document.createElement("div");
		divelHours.appendChild(getHoursTable(locationNumber));
		var infoTabs = [
			new GInfoWindowTab("Address", divel.innerHTML),
			new GInfoWindowTab("Hours", divelHours.innerHTML)
		];
		return infoTabs;
	}
	
	function getHoursTable(locationNumber) {
	//if (dbg) alert ("getHoursTable"  );
		var tableel = document.createElement("table");
		var tbodyel = document.createElement("tbody");
		tbodyel.appendChild(getTRHtmlElement(getLogoImg()));
		var h5el = document.createElement("b");
		var bel = document.createTextNode(hvtStoresInfo.location[locationNumber].name + ' ' + GMAPS_SHOWROOM);
		h5el.appendChild(bel);
		tbodyel.appendChild(getTRHtmlElement(h5el));
		tbodyel.appendChild(getTRHtmlElement(document.createElement("br")));
		var hoursarray = hvtStoresInfo.location[locationNumber].hours.split(', ');
		for (var i=0; i<hoursarray.length; i++) {
			tbodyel.appendChild(getTRHtmlElement(document.createTextNode(hoursarray[i])));
		}
		tableel.appendChild(tbodyel);
		return tableel;
	}
	
	function panToLocationByItem(selectedItem, locationNumber, tabToShow) {
		if (dbg) alert ("panToLocationByItem"  );
		var infoTabs;
		if(locationNumber == -1) {
			//infoTabs = getVisitorInfoTabs
		} else {
			infoTabs = getStoreInfoTabsWithAvailabilityInfo(selectedItem, locationNumber);
		}		
		var locationLatLng = 
			new GLatLng(
				hvtStoresInfo.location[locationNumber].latitude,
				hvtStoresInfo.location[locationNumber].longitude
			);
		map.panTo(locationLatLng);
		var iwtabopts = {};
		if (tabToShow == 'Hours') {
			iwtabopts = {selectedTab:1,maxWidth:TAB_WIDTH};
		} else if (tabToShow == 'Availability') {
			iwtabopts = {selectedTab:2,maxWidth:TAB_WIDTH};
		}
		map.openInfoWindowTabsHtml(locationLatLng, infoTabs, iwtabopts);
	}
	function panToLocation(locationNumber, tabToShow) {
	if (dbg) alert ("panToLocation"  );
		var infoTabs;
		if(locationNumber == -1) {
			//infoTabs = getVisitorInfoTabs
		} else {
			infoTabs = getStoreInfoTabs(locationNumber);
		}		
		var locationLatLng = 
			new GLatLng(
				hvtStoresInfo.location[locationNumber].latitude,
				hvtStoresInfo.location[locationNumber].longitude
			);
		map.panTo(locationLatLng);
		var iwtabopts = {};
		if (tabToShow == 'Hours') {
			iwtabopts = {selectedTab:1,maxWidth:TAB_WIDTH};
		}
		map.openInfoWindowTabsHtml(locationLatLng, infoTabs, iwtabopts);
	}

	function getAddress(locationNumber) {
	// if (dbg) alert ("getAddress"  );
		return String (
			hvtStoresInfo.location[locationNumber].address1 + ' ' +
			hvtStoresInfo.location[locationNumber].city + ' ' +
			hvtStoresInfo.location[locationNumber].state + ' ' + 
			hvtStoresInfo.location[locationNumber].zip
		);
	}

	function getGeoAddress(locationNumber) {
	//if (dbg) alert ("getGeoAddress"  );
		return String (
			hvtStoresInfo.location[locationNumber].latitude + ',' +
			hvtStoresInfo.location[locationNumber].longitude
		);
	}

	function getVisitorMapMarker(address, point) {
	if (dbg) alert ("getVisitorMapMarker"  );
		var marker = new GMarker(point,{icon:getVisitorIcon()});
		GEvent.addListener(marker, "mouseover",
			function() {
				marker.openInfoWindowHtml("<br />Your Address: " + address);
			}
		);
		return marker;	
	}
	function getStoreMapMarker(index, point, locationNumber) {
	//if (dbg) alert ("getStoreMapMarker"  );
		var infoTabs = getStoreInfoTabs(locationNumber);
		var myicon;
		if (index >= 0) {
			myicon = getAlphabeticIcon(index, locationNumber);
		} else if (index < 0) {
			myicon = getTinyIcon(locationNumber);
		}
		var marker = new GMarker(point,{icon:myicon});
		GEvent.addListener(marker, "mouseover",
			function() {
				marker.openInfoWindowTabsHtml(infoTabs);
			}
		);
		return marker;
	}
	function getColorCodedStoreMapMarker(selectedItem, qty, point, locationNumber, popupOnMap) {
	//if (dbg) alert ("getColorCodedStoreMapMarker"  );
	
		var infoTabs = getStoreInfoTabsWithAvailabilityInfo(selectedItem, locationNumber);
		var myicon = getColorCodedIcon(qty);
		var marker = new GMarker(point,{icon:myicon});
		GEvent.addListener(marker, "mouseover",
			function() {
				marker.openInfoWindowTabsHtml(infoTabs);
			}
		);
		return marker;
	}
	
	function getVisitorIcon() {
	//if (dbg) alert ("getVisitorIcon"  );
		// Create "tiny" marker icon
		var tinyIcon = new GIcon();
		tinyIcon.image = IMAGES_DIR+"mm_20_green.gif";
		tinyIcon.iconSize = new GSize(12, 20);
		tinyIcon.shadowSize = new GSize(22, 20);
		tinyIcon.iconAnchor = new GPoint(6, 20);
		tinyIcon.infoWindowAnchor = new GPoint(5, 1);
		return tinyIcon;
	}	
	function getTinyIcon(locationNumber) {
	//if (dbg) alert ("getTinyIcon"  );
		// Create "tiny" marker icon
		var tinyIcon = new GIcon();
		if (showOutletStores && hvtStoresInfo.location[locationNumber].brtype == 'C')
			tinyIcon.image = IMAGES_DIR+"mm_20_red.gif";
		else {
			tinyIcon.image = IMAGES_DIR+"mm_20_blue.png";
		}
		tinyIcon.iconSize = new GSize(12, 20);
		tinyIcon.shadowSize = new GSize(22, 20);
		tinyIcon.iconAnchor = new GPoint(6, 20);
		tinyIcon.infoWindowAnchor = new GPoint(5, 1);
		return tinyIcon;
	}

	function getAlphabeticIcon(locationSearchPosition, locationNumber) {
	//if (dbg) alert ("getAlphabeticIcon"  );
		var icon = new GIcon();		 
		if (showOutletStores && hvtStoresInfo.location[locationNumber].brtype == 'C')
			icon.image = IMAGES_DIR + "markerRed"+String.fromCharCode(locationSearchPosition+65)+".gif";
		else
			icon.image = IMAGES_DIR + "marker"+String.fromCharCode(locationSearchPosition+65)+".gif";
		icon.shadow = IMAGES_DIR+"shadow50.png";
		icon.iconSize = new GSize(20, 34);
		icon.shadowSize = new GSize(37, 34);
		icon.iconAnchor = new GPoint(6, 20);
		icon.infoWindowAnchor = new GPoint(5, 1);
		return icon;
	}
	function getColorCodedIcon(storeItemQty) {
	//if (dbg) alert ("getColorCodedIcon"  );
		var icon = new GIcon();
		if (storeItemQty == '1') {
			iconName = "green";
		} else if (storeItemQty == '2') {
			iconName = "yellow";
		} else if (storeItemQty == '0') {
			iconName = "red";
		}		
		icon.image = IMAGES_DIR+"mm_20_"+iconName+".gif";
		icon.shadow = IMAGES_DIR+"shadow50.png";
		icon.iconSize = new GSize(12, 20);
		icon.shadowSize = new GSize(22, 20);
		icon.iconAnchor = new GPoint(6, 20);
		icon.infoWindowAnchor = new GPoint(5, 1);
		return icon;
	}
	
	function getLogoImg() {
		var imgel = document.createElement("img");
		imgel.setAttribute("src", IMAGES_DIR+"logo.gif");
		return imgel;
	}
	function getLogoImgHTML() {
		return "<img src='"+IMAGES_DIR+"logo.gif"+"' />";
	}	
	function getAddressTable(locationNumber, forInfoWindow, showDistance, selectedItem) {
		var visitorAddr = visitorAddress.value;
		var storeAddr = getGeoAddress(locationNumber);
		var tableel = document.createElement("table");
		var tbodyel = document.createElement("tbody");
		if (forInfoWindow) {
			tbodyel.appendChild(getTRHtmlElement(getLogoImg()));
		}
		var h5el = document.createElement("b");
		var locationType = ' ' + GMAPS_SHOWROOM;		
		if (showOutletStores && hvtStoresInfo.location[locationNumber].brtype == 'C')
			locationType = locationType + ' '+GMAPS_CLEARANCE;
		var bel = document.createTextNode(hvtStoresInfo.location[locationNumber].name + locationType);
		var ael = document.createElement("a");
		if (!forInfoWindow) {
			if (selectedItem != null) {
				ael.setAttribute("href", "javascript:panToLocationByItem('"+selectedItem+"',"+(locationNumber)+");");
			} else {
				ael.setAttribute("href", "javascript:panToLocation("+(locationNumber)+");");
			}
			ael.appendChild(bel);
			h5el.appendChild(ael);
		} else {
			h5el.appendChild(bel);
		}
		tbodyel.appendChild(getTRHtmlElement(h5el));
		tbodyel.appendChild(
			getTRTextElement(
				hvtStoresInfo.location[locationNumber].address1 
				//+ ((hvtStoresInfo.location[locationNumber].address2 != '') ? ', ' + hvtStoresInfo.location[locationNumber].address2 : '') //jaddress2
			)		
		);
		tbodyel.appendChild(
			getTRTextElement(
				hvtStoresInfo.location[locationNumber].city + ', ' +
				hvtStoresInfo.location[locationNumber].state + ' ' +
				(forInfoWindow ? hvtStoresInfo.location[locationNumber].zip : '')
			)
		);
		if ((!isInitial && showDistance) || (selectedItem != null)) {
			var phoneel = document.createTextNode(hvtStoresInfo.location[locationNumber].phone);
			var nbspel = document.createTextNode(" - ");
			if (forInfoWindow) {
				// dont show hours link in info window			
				tbodyel.appendChild(getTRHtmlElement(phoneel));
			} else {
				// show hours link
				var aelhours = document.createElement("a");
				aelhours.appendChild(document.createTextNode(GMAPS_STORE_HOURS));
				if (selectedItem != null) {
					aelhours.setAttribute("href", "javascript:panToLocationByItem('"+selectedItem+"',"+(locationNumber)+",'Hours');");
					tbodyel.appendChild(getTRHtmlElement(phoneel));
					tbodyel.appendChild(getTRHtmlElement(aelhours));
				} else {
					aelhours.setAttribute("href", "javascript:panToLocation("+(locationNumber)+",'Hours');");
					tbodyel.appendChild(getTRHtmlElement(phoneel, nbspel, aelhours));					
				}				
			}
		} else {		
			tbodyel.appendChild(getTRTextElement(hvtStoresInfo.location[locationNumber].phone));
		}
		if (!isInitial && showDistance && !forInfoWindow) {
			var boldel = document.createElement('b');
			var distanceel = document.createTextNode("approx. " + hvtStoresInfo.location[locationNumber].distance + " miles");
			boldel.appendChild(distanceel);
			tbodyel.appendChild(getTRHtmlElement(boldel));
		}

		if (forInfoWindow) {

			tbodyel.appendChild(
				getTRHtmlElement(
					document.createTextNode(GMAPS_DIRECTIONS+' '),
					getATextElement(GMAPS_TO_HERE, 'http://maps.google.com?saddr='+visitorAddr+'&daddr='+storeAddr),
					document.createTextNode(' - '),
					getATextElement(GMAPS_FROM_HERE, 'http://maps.google.com?saddr='+storeAddr+'&daddr='+visitorAddr)
				)
			);
		}
		tableel.appendChild(tbodyel);
		return tableel;
	}
	// Helper Methods 
	function getTRHtmlElement(element1, element2, element3, element4) {
		var trel; var tdel;
		trel = document.createElement("tr"); 
		tdel = document.createElement("td");
		tdel.appendChild(element1);
		if (element2 != null) {
			tdel.appendChild(element2);
		}
		if (element3 != null) {
			tdel.appendChild(element3);
		}		
		if (element4 != null) {
			tdel.appendChild(element4);
		}
		trel.appendChild(tdel);
		return trel;
	}
	function getATextElement(linkText, linkHref) {
		var linkel = document.createElement('a');
		linkel.setAttribute('href', linkHref);
		linkel.setAttribute('target', '_blank');
		linkel.appendChild(document.createTextNode(linkText));
		return linkel;
	}
	function getTRTextElement(value) {
		var trel; var tdel;
		trel = document.createElement("tr"); tdel = document.createElement("td");
		tdel.appendChild(document.createTextNode(value));
		trel.appendChild(tdel);
		return trel;
	}
