﻿
function IsVOWCustomer(chkbox, url) {
    GetSessionValue('GetLoginStatus', 'time=' + Math.random(),
	          function(Contact) {
	              Contact = eval('(' + Contact + ')');
	              if (!CheckLoginStatus(Contact)) {
	                  $.colorbox({ href: "/Popup/Popup_HomeAlertLogin.aspx?page=" + (url != null ? url : ""), width: "630px", height: "365px", iframe: true });
	              }
	          });
    GetSessionValue('GetLoginStatus', 'time=' + Math.random(),
	          function(Contact) {
	              Contact = eval('(' + Contact + ')');
	              if (!CheckLoginStatus(Contact)) {
	                  alert('You must be a registered user to search Sold listings and you must agree to the "Virtual Office Website" terms.');
	                  chkbox.checked = false;
	              }
	          });
}

function Area(island, area) {
    this.island = island;
    this.area = area;
}

function Nhood(island, area, nhood) {
    this.island = island;
    this.area = area;
    this.nhood = nhood;
}

var islands = new Array("Big Island of Hawaii", "Kauai", "Lanai", "Maui", "Molokai", "Oahu");


var areas = new Array(
    new Area("Big Island of Hawaii", "Hamakua"),
    new Area("Big Island of Hawaii", "Kau"),
    new Area("Big Island of Hawaii", "North Hilo"),
    new Area("Big Island of Hawaii", "North Kohala"),
    new Area("Big Island of Hawaii", "North Kona"),
    new Area("Big Island of Hawaii", "Puna"),
    new Area("Big Island of Hawaii", "South Hilo"),
    new Area("Big Island of Hawaii", "South Kohala"),
    new Area("Big Island of Hawaii", "South Kona"),
    new Area("Kauai", "Hanalei"),
    new Area("Kauai", "Kawaihau"),
    new Area("Kauai", "Koloa"),
    new Area("Kauai", "Lihue"),
    new Area("Kauai", "Waimea"),
    new Area("Oahu", "Central"),
    new Area("Oahu", "Diamond Head"),
    new Area("Oahu", "Ewa Plain"),
    new Area("Oahu", "Hawaii Kai"),
    new Area("Oahu", "Kailua"),
    new Area("Oahu", "Kaneohe"),
    new Area("Oahu", "Leeward"),
    new Area("Oahu", "Makakilo"),
    new Area("Oahu", "Metro and Waikiki"),
    new Area("Oahu", "North Shore"),
    new Area("Oahu", "Pearl City"),
    new Area("Oahu", "Waipahu"),
    new Area("Maui", "Central Maui"),
    new Area("Maui", "East Maui"),
    new Area("Maui", "North Shore Maui"),
    new Area("Maui", "South Maui"),
    new Area("Maui", "Up Country"),
    new Area("Maui", "West Maui"),
    new Area("Molokai", "Molokai"),
    new Area("Lanai", "Lanai")
    );


var nhoods = new Array(
    new Nhood("Big Island of Hawaii", "Hamakua", "Ahualoa"),
    new Nhood("Big Island of Hawaii", "Hamakua", "Honokaa"),
    new Nhood("Big Island of Hawaii", "Hamakua", "Kapulena"),
    new Nhood("Big Island of Hawaii", "Hamakua", "Paauhau/Kalopa"),
    new Nhood("Big Island of Hawaii", "Hamakua", "Paauilo"),
    new Nhood("Big Island of Hawaii", "Hamakua", "Waipio to Kukuihaele"),
    new Nhood("Big Island of Hawaii", "Kau", "Discovery Harbour"),
    new Nhood("Big Island of Hawaii", "Kau", "Green Sands"),
    new Nhood("Big Island of Hawaii", "Kau", "Kamaoa/South Point"),
    new Nhood("Big Island of Hawaii", "Kau", "Naalehu/Waiohinu"),
    new Nhood("Big Island of Hawaii", "Kau", "Ocean View"),
    new Nhood("Big Island of Hawaii", "Kau", "Pahala"),
    new Nhood("Big Island of Hawaii", "North Hilo", "Ninole"),
    new Nhood("Big Island of Hawaii", "North Hilo", "Ookala"),
    new Nhood("Big Island of Hawaii", "North Hilo", "Papaaloa"),
    new Nhood("Big Island of Hawaii", "North Hilo", "Waipunalei & Laupahoehoe"),
    new Nhood("Big Island of Hawaii", "North Kohala", "Hawi"),
    new Nhood("Big Island of Hawaii", "North Kohala", "Kapaau"),
    new Nhood("Big Island of Hawaii", "North Kohala", "Kohala"),
    new Nhood("Big Island of Hawaii", "North Kona", "Holualoa"),
    new Nhood("Big Island of Hawaii", "North Kona", "Hualalai"),
    new Nhood("Big Island of Hawaii", "North Kona", "Hualalai Resort"),
    new Nhood("Big Island of Hawaii", "North Kona", "Kailua-Kona"),
    new Nhood("Big Island of Hawaii", "North Kona", "Kaloko"),
    new Nhood("Big Island of Hawaii", "North Kona", "Keahole Ag"),
    new Nhood("Big Island of Hawaii", "North Kona", "Kealakehe"),
    new Nhood("Big Island of Hawaii", "North Kona", "Kealakekua"),
    new Nhood("Big Island of Hawaii", "North Kona", "Keauhou"),
    new Nhood("Big Island of Hawaii", "North Kona", "Kukio"),
    new Nhood("Big Island of Hawaii", "North Kona", "Palisades"),
    new Nhood("Big Island of Hawaii", "North Kona", "Puu Lani Ranch"),
    new Nhood("Big Island of Hawaii", "North Kona", "Waikoloa"),
    new Nhood("Big Island of Hawaii", "Puna", "Eden Rock/Fern Forest"),
    new Nhood("Big Island of Hawaii", "Puna", "Hawaiian Acres"),
    new Nhood("Big Island of Hawaii", "Puna", "Hawaiian Beaches"),
    new Nhood("Big Island of Hawaii", "Puna", "Hawaiian Paradise Park"),
    new Nhood("Big Island of Hawaii", "Puna", "Kapoho"),
    new Nhood("Big Island of Hawaii", "Puna", "Keaau/Kurtistown"),
    new Nhood("Big Island of Hawaii", "Puna", "Kehena/Opihikao"),
    new Nhood("Big Island of Hawaii", "Puna", "Mountain View"),
    new Nhood("Big Island of Hawaii", "Puna", "Pahoa"),
    new Nhood("Big Island of Hawaii", "Puna", "Volcano"),
    new Nhood("Big Island of Hawaii", "South Hilo", "Hakalau"),
    new Nhood("Big Island of Hawaii", "South Hilo", "Hilo"),
    new Nhood("Big Island of Hawaii", "South Hilo", "Honomu"),
    new Nhood("Big Island of Hawaii", "South Hilo", "Kaumana"),
    new Nhood("Big Island of Hawaii", "South Hilo", "Keaukaha"),
    new Nhood("Big Island of Hawaii", "South Hilo", "Onomea/Papaikou/Puueo-Paku"),
    new Nhood("Big Island of Hawaii", "South Hilo", "Panaewa"),
    new Nhood("Big Island of Hawaii", "South Hilo", "Pepeekeo"),
    new Nhood("Big Island of Hawaii", "South Hilo", "Waiakea"),
    new Nhood("Big Island of Hawaii", "South Kohala", "Kawaihae"),
    new Nhood("Big Island of Hawaii", "South Kohala", "Kolea"),
    new Nhood("Big Island of Hawaii", "South Kohala", "Mauna Kea"),
    new Nhood("Big Island of Hawaii", "South Kohala", "Mauna Lani"),
    new Nhood("Big Island of Hawaii", "South Kohala", "Puako"),
    new Nhood("Big Island of Hawaii", "South Kohala", "Waikii"),
    new Nhood("Big Island of Hawaii", "South Kohala", "Waikoloa"),
    new Nhood("Big Island of Hawaii", "South Kohala", "Waikoloa Makai"),
    new Nhood("Big Island of Hawaii", "South Kohala", "Waimea"),
    new Nhood("Big Island of Hawaii", "South Kona", "Captain Cook"),
    new Nhood("Big Island of Hawaii", "South Kona", "Honaunau"),
    new Nhood("Big Island of Hawaii", "South Kona", "Hookena"),
    new Nhood("Big Island of Hawaii", "South Kona", "Kailua-Kona"),
    new Nhood("Big Island of Hawaii", "South Kona", "Keei"),
    new Nhood("Big Island of Hawaii", "South Kona", "Kona Paradise"),
    new Nhood("Big Island of Hawaii", "South Kona", "Milolii"),


    new Nhood("Kauai", "Hanalei", "Anini"),
    new Nhood("Kauai", "Hanalei", "Haena"),
    new Nhood("Kauai", "Hanalei", "Hanalei"),
    new Nhood("Kauai", "Hanalei", "Kilauea"),
    new Nhood("Kauai", "Hanalei", "Princeville"),
    new Nhood("Kauai", "Kawaihau", "Anahola"),
    new Nhood("Kauai", "Kawaihau", "Kapaa"),
    new Nhood("Kauai", "Kawaihau", "Kapaa-Kawaihau"),
    new Nhood("Kauai", "Kawaihau", "Kapaa-Wailua"),
    new Nhood("Kauai", "Kawaihau", "Kealia"),
    new Nhood("Kauai", "Kawaihau", "Wailua"),
    new Nhood("Kauai", "Kawaihau", "Wailua Homesteads"),
    new Nhood("Kauai", "Koloa", "Eleele"),
    new Nhood("Kauai", "Koloa", "Kalaheo"),
    new Nhood("Kauai", "Koloa", "Koloa"),
    new Nhood("Kauai", "Koloa", "Lawai"),
    new Nhood("Kauai", "Koloa", "Poipu"),
    new Nhood("Kauai", "Lihue", "Hanamaulu"),
    new Nhood("Kauai", "Lihue", "Lihue"),
    new Nhood("Kauai", "Lihue", "Nawiliwili"),
    new Nhood("Kauai", "Lihue", "Puhi"),
    new Nhood("Kauai", "Lihue", "Wailua"),
    new Nhood("Kauai", "Waimea", "Hanapepe"),
    new Nhood("Kauai", "Waimea", "Kekaha"),
    new Nhood("Kauai", "Waimea", "Kokee"),
    new Nhood("Kauai", "Waimea", "Waimea"),

    new Nhood("Oahu", "Central", "Botanical Garden"),
    new Nhood("Oahu", "Central", "Govt/Ag"),
    new Nhood("Oahu", "Central", "Mililani Area"),
    new Nhood("Oahu", "Central", "Mililani Mauka"),
    new Nhood("Oahu", "Central", "Military"),
    new Nhood("Oahu", "Central", "Wahiawa Area"),
    new Nhood("Oahu", "Central", "Wahiawa Heights"),
    new Nhood("Oahu", "Central", "Wahiawa Park"),
    new Nhood("Oahu", "Central", "Whitmore Village"),
    new Nhood("Oahu", "Central", "Wilikina"),
    new Nhood("Oahu", "Diamond Head", "Aina Haina Area"),
    new Nhood("Oahu", "Diamond Head", "Aina Haina Beach"),
    new Nhood("Oahu", "Diamond Head", "Black Point"),
    new Nhood("Oahu", "Diamond Head", "Diamond Head"),
    new Nhood("Oahu", "Diamond Head", "Hawaii Loa Ridge"),
    new Nhood("Oahu", "Diamond Head", "Kahala Area"),
    new Nhood("Oahu", "Diamond Head", "Kahala Kua"),
    new Nhood("Oahu", "Diamond Head", "Kai Nani"),
    new Nhood("Oahu", "Diamond Head", "Kaimuki"),
    new Nhood("Oahu", "Diamond Head", "Kalani Iki"),
    new Nhood("Oahu", "Diamond Head", "Kapahulu"),
    new Nhood("Oahu", "Diamond Head", "Kuliouou"),
    new Nhood("Oahu", "Diamond Head", "Maunalani Heights"),
    new Nhood("Oahu", "Diamond Head", "Niu Beach"),
    new Nhood("Oahu", "Diamond Head", "Niu Valley"),
    new Nhood("Oahu", "Diamond Head", "Paiko Lagoon"),
    new Nhood("Oahu", "Diamond Head", "Palolo"),
    new Nhood("Oahu", "Diamond Head", "Puupanini"),
    new Nhood("Oahu", "Diamond Head", "Reserve"),
    new Nhood("Oahu", "Diamond Head", "St. Louis"),
    new Nhood("Oahu", "Diamond Head", "Waialae G/C"),
    new Nhood("Oahu", "Diamond Head", "Waialae Iki"),
    new Nhood("Oahu", "Diamond Head", "Waialae Nui Rdge"),
    new Nhood("Oahu", "Diamond Head", "Waialae Nui Vly"),
    new Nhood("Oahu", "Diamond Head", "Waialae Nui-Lwr"),
    new Nhood("Oahu", "Diamond Head", "Wailupe Area"),
    new Nhood("Oahu", "Diamond Head", "Wailupe Bch"),
    new Nhood("Oahu", "Diamond Head", "Wilhelmina"),
    new Nhood("Oahu", "Ewa Plain", "Ag/Indl/Navy"),
    new Nhood("Oahu", "Ewa Plain", "Campbell Ind Prk"),
    new Nhood("Oahu", "Ewa Plain", "Ewa"),
    new Nhood("Oahu", "Ewa Plain", "Ewa  Gen Lofts"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Beach"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Alii Court"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Alii Cove"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Breakers"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Carriages"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Cortebella"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Cypress"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Haleakea"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Haleakea Ii"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Kula Lei"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Las Brisas"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Latitudes"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Meridian"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Montecito/Tuscany"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Prescott"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Sea Breeze"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Soda Creek"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Sonoma"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Summerhill"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Sun Terra"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Sun Terra On T"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Sun Terra Sou"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Terrazza"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Tiburon"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Trovare"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Tuscany Ii"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Gen Woodbridge"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Lombard Way"),
    new Nhood("Oahu", "Ewa Plain", "Ewa Villages"),
    new Nhood("Oahu", "Ewa Plain", "Huelani"),
    new Nhood("Oahu", "Ewa Plain", "Kapolei"),
    new Nhood("Oahu", "Ewa Plain", "Kapolei Knolls"),
    new Nhood("Oahu", "Ewa Plain", "Kapolei-Aeloa"),
    new Nhood("Oahu", "Ewa Plain", "Kapolei-Iwalani"),
    new Nhood("Oahu", "Ewa Plain", "Kapolei-Kai"),
    new Nhood("Oahu", "Ewa Plain", "Kapolei-Kekuilani"),
    new Nhood("Oahu", "Ewa Plain", "Kapolei-Malanai"),
    new Nhood("Oahu", "Ewa Plain", "Ko Olina"),
    new Nhood("Oahu", "Ewa Plain", "Leeward Estates"),
    new Nhood("Oahu", "Ewa Plain", "Ocean Pointe"),
    new Nhood("Oahu", "Ewa Plain", "West Loc Villages"),
    new Nhood("Oahu", "Ewa Plain", "Westloch Estates"),
    new Nhood("Oahu", "Ewa Plain", "Westloch Fairway"),
    new Nhood("Oahu", "Hawaii Kai", "Anchorage"),
    new Nhood("Oahu", "Hawaii Kai", "Hahaione-Lower"),
    new Nhood("Oahu", "Hawaii Kai", "Hahaione-Upper"),
    new Nhood("Oahu", "Hawaii Kai", "Kalama Valley"),
    new Nhood("Oahu", "Hawaii Kai", "Kamehame Ridge"),
    new Nhood("Oahu", "Hawaii Kai", "Kamilo Nui"),
    new Nhood("Oahu", "Hawaii Kai", "Kamiloiki"),
    new Nhood("Oahu", "Hawaii Kai", "Kealaula Kai"),
    new Nhood("Oahu", "Hawaii Kai", "Koko Head Terrac"),
    new Nhood("Oahu", "Hawaii Kai", "Koko Kai"),
    new Nhood("Oahu", "Hawaii Kai", "Koko Villas"),
    new Nhood("Oahu", "Hawaii Kai", "Laulima"),
    new Nhood("Oahu", "Hawaii Kai", "Luna Kai"),
    new Nhood("Oahu", "Hawaii Kai", "Marina West"),
    new Nhood("Oahu", "Hawaii Kai", "Mariners Cove"),
    new Nhood("Oahu", "Hawaii Kai", "Mariners Ridge"),
    new Nhood("Oahu", "Hawaii Kai", "Mariners Valley"),
    new Nhood("Oahu", "Hawaii Kai", "Napali Haweo"),
    new Nhood("Oahu", "Hawaii Kai", "Napua Point"),
    new Nhood("Oahu", "Hawaii Kai", "Portlock"),
    new Nhood("Oahu", "Hawaii Kai", "Queens Gate"),
    new Nhood("Oahu", "Hawaii Kai", "Reserve/Park/Ag"),
    new Nhood("Oahu", "Hawaii Kai", "Spinnaker Isle"),
    new Nhood("Oahu", "Hawaii Kai", "Triangle"),
    new Nhood("Oahu", "Hawaii Kai", "West Marina"),
    new Nhood("Oahu", "Kailua", "Aikahi Park"),
    new Nhood("Oahu", "Kailua", "Beachside"),
    new Nhood("Oahu", "Kailua", "Bluestone"),
    new Nhood("Oahu", "Kailua", "Cntry Club Knoll"),
    new Nhood("Oahu", "Kailua", "Coconut Grove"),
    new Nhood("Oahu", "Kailua", "Enchanted Lake"),
    new Nhood("Oahu", "Kailua", "Govt/Ag"),
    new Nhood("Oahu", "Kailua", "Hillcrest"),
    new Nhood("Oahu", "Kailua", "Kailua Bluffs"),
    new Nhood("Oahu", "Kailua", "Kailua Estates"),
    new Nhood("Oahu", "Kailua", "Kailua Town"),
    new Nhood("Oahu", "Kailua", "Kaimalino"),
    new Nhood("Oahu", "Kailua", "Kalaheo Hillside"),
    new Nhood("Oahu", "Kailua", "Kalama Tract"),
    new Nhood("Oahu", "Kailua", "Kalama/Cnut Grov"),
    new Nhood("Oahu", "Kailua", "Kaopa"),
    new Nhood("Oahu", "Kailua", "Kawailoa"),
    new Nhood("Oahu", "Kailua", "Keolu Hills"),
    new Nhood("Oahu", "Kailua", "Koolaupoku"),
    new Nhood("Oahu", "Kailua", "Kukanono"),
    new Nhood("Oahu", "Kailua", "Kukilakila"),
    new Nhood("Oahu", "Kailua", "Kuulei Tract"),
    new Nhood("Oahu", "Kailua", "Lanikai"),
    new Nhood("Oahu", "Kailua", "Maunawili"),
    new Nhood("Oahu", "Kailua", "Olomana"),
    new Nhood("Oahu", "Kailua", "Pohakupu"),
    new Nhood("Oahu", "Kailua", "Waimanalo"),
    new Nhood("Oahu", "Kaneohe", "Ag/Preserve"),
    new Nhood("Oahu", "Kaneohe", "Ahaolelo"),
    new Nhood("Oahu", "Kaneohe", "Ahuimanu Area"),
    new Nhood("Oahu", "Kaneohe", "Ahuimanu Hills"),
    new Nhood("Oahu", "Kaneohe", "Ahuimanu Knolls"),
    new Nhood("Oahu", "Kaneohe", "Alii Bluffs"),
    new Nhood("Oahu", "Kaneohe", "Alii Shores"),
    new Nhood("Oahu", "Kaneohe", "Bay View Estates"),
    new Nhood("Oahu", "Kaneohe", "Bay View Garden"),
    new Nhood("Oahu", "Kaneohe", "Bayview Golf Course"),
    new Nhood("Oahu", "Kaneohe", "Castle Hill"),
    new Nhood("Oahu", "Kaneohe", "Club View Estate"),
    new Nhood("Oahu", "Kaneohe", "Country Club"),
    new Nhood("Oahu", "Kaneohe", "Crown Terrace"),
    new Nhood("Oahu", "Kaneohe", "Fish Pond"),
    new Nhood("Oahu", "Kaneohe", "Government"),
    new Nhood("Oahu", "Kaneohe", "Haiku Knolls"),
    new Nhood("Oahu", "Kaneohe", "Haiku Park"),
    new Nhood("Oahu", "Kaneohe", "Haiku Plantation"),
    new Nhood("Oahu", "Kaneohe", "Haiku Village"),
    new Nhood("Oahu", "Kaneohe", "Hakipuu"),
    new Nhood("Oahu", "Kaneohe", "Hale Kou"),
    new Nhood("Oahu", "Kaneohe", "Halekauwila"),
    new Nhood("Oahu", "Kaneohe", "Halepuu"),
    new Nhood("Oahu", "Kaneohe", "Hauula"),
    new Nhood("Oahu", "Kaneohe", "Heeia Kea"),
    new Nhood("Oahu", "Kaneohe", "Heeia View"),
    new Nhood("Oahu", "Kaneohe", "Hygienic Store"),
    new Nhood("Oahu", "Kaneohe", "Kaaawa"),
    new Nhood("Oahu", "Kaneohe", "Kaalaea"),
    new Nhood("Oahu", "Kaneohe", "Kahaluu Fishpond"),
    new Nhood("Oahu", "Kaneohe", "Kahaluu Town"),
    new Nhood("Oahu", "Kaneohe", "Kahana"),
    new Nhood("Oahu", "Kaneohe", "Kahanahou"),
    new Nhood("Oahu", "Kaneohe", "Kahuhipa Indstrl"),
    new Nhood("Oahu", "Kaneohe", "Kam Hwy Makai"),
    new Nhood("Oahu", "Kaneohe", "Kamooalii"),
    new Nhood("Oahu", "Kaneohe", "Kaneohe Bay"),
    new Nhood("Oahu", "Kaneohe", "Kaneohe Bus"),
    new Nhood("Oahu", "Kaneohe", "Kaneohe Heights"),
    new Nhood("Oahu", "Kaneohe", "Kaneohe Town"),
    new Nhood("Oahu", "Kaneohe", "Kaneohe Woods"),
    new Nhood("Oahu", "Kaneohe", "Kapuna Hala"),
    new Nhood("Oahu", "Kaneohe", "Keaahala"),
    new Nhood("Oahu", "Kaneohe", "Keapuka"),
    new Nhood("Oahu", "Kaneohe", "Kokokahi"),
    new Nhood("Oahu", "Kaneohe", "Kualoa Area"),
    new Nhood("Oahu", "Kaneohe", "Kualoa Beach"),
    new Nhood("Oahu", "Kaneohe", "Lilipuna"),
    new Nhood("Oahu", "Kaneohe", "Lulani Ocean"),
    new Nhood("Oahu", "Kaneohe", "Mahalani"),
    new Nhood("Oahu", "Kaneohe", "Mahinui"),
    new Nhood("Oahu", "Kaneohe", "Matson Point"),
    new Nhood("Oahu", "Kaneohe", "Mikiola"),
    new Nhood("Oahu", "Kaneohe", "Military"),
    new Nhood("Oahu", "Kaneohe", "Miomio"),
    new Nhood("Oahu", "Kaneohe", "Mokulele"),
    new Nhood("Oahu", "Kaneohe", "Nohanani Tract"),
    new Nhood("Oahu", "Kaneohe", "Parkway"),
    new Nhood("Oahu", "Kaneohe", "Pikoiloa"),
    new Nhood("Oahu", "Kaneohe", "Preservation"),
    new Nhood("Oahu", "Kaneohe", "Preserve"),
    new Nhood("Oahu", "Kaneohe", "Puahuula"),
    new Nhood("Oahu", "Kaneohe", "Punaluu"),
    new Nhood("Oahu", "Kaneohe", "Puohala Village"),
    new Nhood("Oahu", "Kaneohe", "Puualii"),
    new Nhood("Oahu", "Kaneohe", "Temple Valley"),
    new Nhood("Oahu", "Kaneohe", "Valley Estates"),
    new Nhood("Oahu", "Kaneohe", "Waihee"),
    new Nhood("Oahu", "Kaneohe", "Waihole"),
    new Nhood("Oahu", "Kaneohe", "Waikalua"),
    new Nhood("Oahu", "Kaneohe", "Waikane"),
    new Nhood("Oahu", "Kaneohe", "Windward Estates"),
    new Nhood("Oahu", "Kaneohe", "Windward Mall"),
    new Nhood("Oahu", "Kaneohe", "Woodridge"),
    new Nhood("Oahu", "Leeward", "Govt/Preserve"),
    new Nhood("Oahu", "Leeward", "Lualualei"),
    new Nhood("Oahu", "Leeward", "Maili"),
    new Nhood("Oahu", "Leeward", "Makaha"),
    new Nhood("Oahu", "Leeward", "Military"),
    new Nhood("Oahu", "Leeward", "Nanakuli"),
    new Nhood("Oahu", "Leeward", "Waianae"),
    new Nhood("Oahu", "Makakilo", "Ag/Navy"),
    new Nhood("Oahu", "Makakilo", "Ag/Preserve"),
    new Nhood("Oahu", "Makakilo", "Campbell Ind Prk"),
    new Nhood("Oahu", "Makakilo", "Campbell Industrial"),
    new Nhood("Oahu", "Makakilo", "Makakilo-Anuhea"),
    new Nhood("Oahu", "Makakilo", "Makakilo-Highlands"),
    new Nhood("Oahu", "Makakilo", "Makakilo-Highpointe"),
    new Nhood("Oahu", "Makakilo", "Makakilo-Kahiwelo"),
    new Nhood("Oahu", "Makakilo", "Makakilo-Kumulani"),
    new Nhood("Oahu", "Makakilo", "Makakilo-Lower"),
    new Nhood("Oahu", "Makakilo", "Makakilo-Palehua Hgts"),
    new Nhood("Oahu", "Makakilo", "Makakilo-Royal Ridge"),
    new Nhood("Oahu", "Makakilo", "Makakilo-Starsedge"),
    new Nhood("Oahu", "Makakilo", "Makakilo-Upper"),
    new Nhood("Oahu", "Makakilo", "Makakilo-Wai Kaloi"),
    new Nhood("Oahu", "Makakilo", "Makakilo-West Hills"),
    new Nhood("Oahu", "Makakilo", "Nanakai Gardens"),
    new Nhood("Oahu", "Metro and Waikiki", "Airport/Industl"),
    new Nhood("Oahu", "Metro and Waikiki", "Ala Moana"),
    new Nhood("Oahu", "Metro and Waikiki", "Alewa Heights"),
    new Nhood("Oahu", "Metro and Waikiki", "Aliamanu"),
    new Nhood("Oahu", "Metro and Waikiki", "Chinatown"),
    new Nhood("Oahu", "Metro and Waikiki", "City Hall"),
    new Nhood("Oahu", "Metro and Waikiki", "Dillingham"),
    new Nhood("Oahu", "Metro and Waikiki", "Downtown"),
    new Nhood("Oahu", "Metro and Waikiki", "Dowsett"),
    new Nhood("Oahu", "Metro and Waikiki", "Holiday Mart"),
    new Nhood("Oahu", "Metro and Waikiki", "Judd Hillside"),
    new Nhood("Oahu", "Metro and Waikiki", "Kakaako"),
    new Nhood("Oahu", "Metro and Waikiki", "Kalihi Area"),
    new Nhood("Oahu", "Metro and Waikiki", "Kalihi Kai"),
    new Nhood("Oahu", "Metro and Waikiki", "Kalihi Uka"),
    new Nhood("Oahu", "Metro and Waikiki", "Kalihi Valley"),
    new Nhood("Oahu", "Metro and Waikiki", "Kalihi-Lower"),
    new Nhood("Oahu", "Metro and Waikiki", "Kalihi-Upper"),
    new Nhood("Oahu", "Metro and Waikiki", "Kam Heights"),
    new Nhood("Oahu", "Metro and Waikiki", "Kapahulu"),
    new Nhood("Oahu", "Metro and Waikiki", "Kapalama"),
    new Nhood("Oahu", "Metro and Waikiki", "Kapio/Kinau/Ward"),
    new Nhood("Oahu", "Metro and Waikiki", "Kapiolani"),
    new Nhood("Oahu", "Metro and Waikiki", "Kuakini"),
    new Nhood("Oahu", "Metro and Waikiki", "Lakeside"),
    new Nhood("Oahu", "Metro and Waikiki", "Liliha"),
    new Nhood("Oahu", "Metro and Waikiki", "Makiki"),
    new Nhood("Oahu", "Metro and Waikiki", "Makiki Area"),
    new Nhood("Oahu", "Metro and Waikiki", "Makiki Heights"),
    new Nhood("Oahu", "Metro and Waikiki", "Manoa Area"),
    new Nhood("Oahu", "Metro and Waikiki", "Manoa-Lower"),
    new Nhood("Oahu", "Metro and Waikiki", "Manoa-Upper"),
    new Nhood("Oahu", "Metro and Waikiki", "Manoa-Woodlawn"),
    new Nhood("Oahu", "Metro and Waikiki", "Mapunapuna"),
    new Nhood("Oahu", "Metro and Waikiki", "Mccully"),
    new Nhood("Oahu", "Metro and Waikiki", "Military"),
    new Nhood("Oahu", "Metro and Waikiki", "Moanalua Gardens"),
    new Nhood("Oahu", "Metro and Waikiki", "Moanalua Valley"),
    new Nhood("Oahu", "Metro and Waikiki", "Moiliili"),
    new Nhood("Oahu", "Metro and Waikiki", "Nuuanu Area"),
    new Nhood("Oahu", "Metro and Waikiki", "Nuuanu Pali"),
    new Nhood("Oahu", "Metro and Waikiki", "Nuuanu-Lower"),
    new Nhood("Oahu", "Metro and Waikiki", "Oahu Cc"),
    new Nhood("Oahu", "Metro and Waikiki", "Old Pali"),
    new Nhood("Oahu", "Metro and Waikiki", "Pacific Heights"),
    new Nhood("Oahu", "Metro and Waikiki", "Palama"),
    new Nhood("Oahu", "Metro and Waikiki", "Papakolea"),
    new Nhood("Oahu", "Metro and Waikiki", "Pauoa Valley"),
    new Nhood("Oahu", "Metro and Waikiki", "Pawaa"),
    new Nhood("Oahu", "Metro and Waikiki", "Punahou"),
    new Nhood("Oahu", "Metro and Waikiki", "Punchbowl Area"),
    new Nhood("Oahu", "Metro and Waikiki", "Punchbowl-Lower"),
    new Nhood("Oahu", "Metro and Waikiki", "Puunui"),
    new Nhood("Oahu", "Metro and Waikiki", "Queens"),
    new Nhood("Oahu", "Metro and Waikiki", "Salt Lake"),
    new Nhood("Oahu", "Metro and Waikiki", "Sand Island"),
    new Nhood("Oahu", "Metro and Waikiki", "Tantalus"),
    new Nhood("Oahu", "Metro and Waikiki", "Ualakaa"),
    new Nhood("Oahu", "Metro and Waikiki", "University"),
    new Nhood("Oahu", "Metro and Waikiki", "Waikiki"),
    new Nhood("Oahu", "North Shore", "Ag/Preserve"),
    new Nhood("Oahu", "North Shore", "Beach Parks"),
    new Nhood("Oahu", "North Shore", "Govt/Ag"),
    new Nhood("Oahu", "North Shore", "Haleiwa"),
    new Nhood("Oahu", "North Shore", "Kaena Point"),
    new Nhood("Oahu", "North Shore", "Kahuku"),
    new Nhood("Oahu", "North Shore", "Kawailoa"),
    new Nhood("Oahu", "North Shore", "Kawela Bay"),
    new Nhood("Oahu", "North Shore", "Kuilima"),
    new Nhood("Oahu", "North Shore", "Laie"),
    new Nhood("Oahu", "North Shore", "Malaekahana"),
    new Nhood("Oahu", "North Shore", "Metcalf Acres"),
    new Nhood("Oahu", "North Shore", "Mokuleia"),
    new Nhood("Oahu", "North Shore", "Paalaakai"),
    new Nhood("Oahu", "North Shore", "Pupukea"),
    new Nhood("Oahu", "North Shore", "School"),
    new Nhood("Oahu", "North Shore", "Sunset Area"),
    new Nhood("Oahu", "North Shore", "Sunset/Velzy"),
    new Nhood("Oahu", "North Shore", "Waialua"),
    new Nhood("Oahu", "North Shore", "Waimea"),
    new Nhood("Oahu", "Pearl City", "Ag/Preserve"),
    new Nhood("Oahu", "Pearl City", "Aiea Area"),
    new Nhood("Oahu", "Pearl City", "Aiea Heights"),
    new Nhood("Oahu", "Pearl City", "Foster Village"),
    new Nhood("Oahu", "Pearl City", "Halawa"),
    new Nhood("Oahu", "Pearl City", "Halawa Heights"),
    new Nhood("Oahu", "Pearl City", "Manana"),
    new Nhood("Oahu", "Pearl City", "Military"),
    new Nhood("Oahu", "Pearl City", "Momilani"),
    new Nhood("Oahu", "Pearl City", "Navy/Federal"),
    new Nhood("Oahu", "Pearl City", "Newtown"),
    new Nhood("Oahu", "Pearl City", "Pacific Palisades"),
    new Nhood("Oahu", "Pearl City", "Pearl City-Upper"),
    new Nhood("Oahu", "Pearl City", "Pearlridge"),
    new Nhood("Oahu", "Pearl City", "Royal Summit"),
    new Nhood("Oahu", "Pearl City", "Waiau"),
    new Nhood("Oahu", "Pearl City", "Wailuna"),
    new Nhood("Oahu", "Pearl City", "Waimalu"),
    new Nhood("Oahu", "Waipahu", "Ag/Preserve"),
    new Nhood("Oahu", "Waipahu", "Business"),
    new Nhood("Oahu", "Waipahu", "Crestview"),
    new Nhood("Oahu", "Waipahu", "Hale Lumi"),
    new Nhood("Oahu", "Waipahu", "Harbor View"),
    new Nhood("Oahu", "Waipahu", "Kunia"),
    new Nhood("Oahu", "Waipahu", "Renaissance"),
    new Nhood("Oahu", "Waipahu", "Robinson Heights"),
    new Nhood("Oahu", "Waipahu", "Royal Kunia"),
    new Nhood("Oahu", "Waipahu", "Seaview"),
    new Nhood("Oahu", "Waipahu", "Village Park"),
    new Nhood("Oahu", "Waipahu", "Waikele"),
    new Nhood("Oahu", "Waipahu", "Waipahu Estates"),
    new Nhood("Oahu", "Waipahu", "Waipahu Gardens"),
    new Nhood("Oahu", "Waipahu", "Waipahu Triangle"),
    new Nhood("Oahu", "Waipahu", "Waipahu-Lower"),
    new Nhood("Oahu", "Waipahu", "Waipio Gentry"),

    new Nhood("Maui", "Central Maui", "Kahakuloa"),
    new Nhood("Maui", "Central Maui", "Wailuku"),
    new Nhood("Maui", "Central Maui", "Kahului"),
    new Nhood("Maui", "East Maui", "Nahiku"),
    new Nhood("Maui", "East Maui", "Hana"),
    new Nhood("Maui", "East Maui", "Kipahulu"),
    new Nhood("Maui", "East Maui", "Kaupo"),
    new Nhood("Lanai", "Lanai", "Lanai"),
    new Nhood("Molokai", "Molokai", "Molokai"),
    new Nhood("Maui", "North Shore Maui", "Keanae"),
    new Nhood("Maui", "North Shore Maui", "Spreckelsville/Paia/Kuau"),
    new Nhood("Maui", "North Shore Maui", "Haiku"),
    new Nhood("Maui", "South Maui", "Wailea/Makena"),
    new Nhood("Maui", "South Maui", "Maui Meadows"),
    new Nhood("Maui", "South Maui", "Maalaea"),
    new Nhood("Maui", "South Maui", "Kihei"),
    new Nhood("Maui", "Up Country", "Kula/Ulupalakua/Kanaio"),
    new Nhood("Maui", "Up Country", "Pukalani"),
    new Nhood("Maui", "Up Country", "Makawao/Olinda/Haliimaile"),
    new Nhood("Maui", "West Maui", "Honokohau"),
    new Nhood("Maui", "West Maui", "Kapalua"),
    new Nhood("Maui", "West Maui", "Napili/Kahana/Honokowai"),
    new Nhood("Maui", "West Maui", "Kaanapali"),
    new Nhood("Maui", "West Maui", "Lahaina"),
    new Nhood("Maui", "West Maui", "Olowalu")
    );

function GetAreas(island) {
    var filteredAreas = new Array();
    var index = 0;
    for (i = 0; i < areas.length; i++) {
        if (areas[i].island == island) {
            filteredAreas[index++] = new Area(island, areas[i].area);
        }
    }
    return filteredAreas;
}

function GetAreasFromArr(islands) {
    var filteredAreas = new Array();
    var index = 0;
    for (i = 0; i < areas.length; i++) {
        if (InAreaArray(areas[i].island,  islands)) {
            filteredAreas[index++] = new Area(areas[i].island, areas[i].area);
        }
    }
    return filteredAreas;
}

function GetNhoods(island, area) {
    var filteredNhoods = new Array();
    var index = 0;
    for (i = 0; i < nhoods.length; i++) {
        if (nhoods[i].island == island && nhoods[i].area == area) {
            filteredNhoods[index++] = new Nhood(island, nhoods[i].area, nhoods[i].nhood);
        }
    }
    return filteredNhoods;
}

function GetNhoodsFromArr(arrArea) {
    var filteredNhoods = new Array();
    var index = 0;
    for (i = 0; i < nhoods.length; i++) {
        if (InNhoodArray(nhoods[i], arrArea)) {
            filteredNhoods[index++] = new Nhood(nhoods[i].island, nhoods[i].area, nhoods[i].nhood);
        }
    }
    return filteredNhoods;
}

function GetNhoodsFromSmallArr(arrArea) {
    var filteredNhoods = new Array();
    var index = 0;
    for (i = 0; i < nhoods.length; i++) {
        if (InNhoodSmallArray(nhoods[i], arrArea)) {
            filteredNhoods[index++] = new Nhood(nhoods[i].island, nhoods[i].area, nhoods[i].nhood);
        }
    }
    return filteredNhoods;
}

function InAreaArray(value, array) {
    var result = false;
    for (q = 0; q < array.length; q++) {
        if (array[q] == value) {
            result = true;
            break;
        }
    }
    return result;
}

function InNhoodArray(item, array) {
    var result = false;
    for (q = 0; q < array.length; q++) {
        if (array[q].island == item.island && array[q].area == item.area) {
            result = true;
            break;
        }
    }
    return result;
}

function InNhoodSmallArray(item, array) {
    var result = false;
    for (q = 0; q < array.length; q++) {

        if (array[q] == item.area) {
            result = true;
            break;
        }
    }
    return result;
}

function InOptions(ctrl, value)
{
    var result = false;
    for (q = 0; q < ctrl.options.length; q++) {
        if (ctrl.options[q].value == value) {
            result = true;
            break;
        }
    }
    return result;
}

function RemoveOption(ctrl, value) {
    for (q = ctrl.options.length - 1; q >= 0; q--) {
        if (ctrl.options[q].value == value) {
            ctrl.remove(q);
            break;
        }
    }
}

function SortList(ctrl) {
    try {
        var sortedArray = new Array();
        for (i = 0; i < ctrl.options.length; i++) {
            sortedArray[i] = ctrl.options[i].value;
        }
        sortedArray.sort();
        for (i = ctrl.options.length - 1; i >= 0; i--) {
            ctrl.remove(i);
        }
        for (i = 0; i < sortedArray.length; i++) {
            ctrl.options.add(new Option(sortedArray[i], sortedArray[i]));
        }
    }
    catch (e) { alert("SortList stError: " + e); }
}

/*
function InitAreas() {
    var filteredAreas = new Array();
    var index = 0;
    for (i = 0; i < islands.length; i++) {
        filteredAreas[index++] = new Area(islands[0], areas[i].area);
    }
    return filteredAreas;
}
*/

function changeIsland(island) {
    var area = document.getElementById("cntContent_Area");
    if (area == null)
        area = document.getElementById("ctl00_cntContent_Area");
    for (i = area.options.length - 1; i > 0; i--)
        area.remove(i);
    var areasFiltered = GetAreas(island);
    for (i = 0; i < areasFiltered.length; i++)
        area.options.add(new Option(areasFiltered[i].area, areasFiltered[i].area));
    changeArea(island, area.options[area.selectedIndex].value);
}

function changeArea(island, area) {
    var nhood = document.getElementById("cntContent_Neighborhood");
    if (nhood == null)
        nhood = document.getElementById("ctl00_cntContent_Neighborhood");
    for (i = nhood.options.length - 1; i > 0; i--)
        nhood.remove(i);
    var nhoodsFiltered = GetNhoods(island, area);
    for (i = 0; i < nhoodsFiltered.length; i++)
        nhood.options.add(new Option(nhoodsFiltered[i].nhood, nhoodsFiltered[i].nhood));
}

function initAllAreas()
{
    var island = document.getElementById("cntContent_AvailCounty");
    if (island == null)
        island = document.getElementById("ctl00_cntContent_AvailCounty");
    var area = document.getElementById("cntContent_AvailArea");
    if (area == null)
        area = document.getElementById("ctl00_cntContent_AvailArea");
    var nhood = document.getElementById("cntContent_AvailNeighborhood");
    if (nhood == null)
        nhood = document.getElementById("ctl00_cntContent_AvailNeighborhood");
    for (i = island.options.length - 1; i >= 0; i--)
        island.remove(i);
    for (i = area.options.length - 1; i >= 0; i--)
        area.remove(i);
    for (i = nhood.options.length - 1; i >= 0; i--)
        nhood.remove(i);
    for (x = 0; x < islands.length; x++) {
        island.options.add(new Option(islands[x], islands[x]));
        var areasFiltered = GetAreas(islands[x]);
        for (y = 0; y < areasFiltered.length; y++) {
            area.options.add(new Option(areasFiltered[y].area, areasFiltered[y].area));
            var nhoodsFiltered = GetNhoods(islands[x], areasFiltered[y].area);
            for (z = 0; z < nhoodsFiltered.length; z++) {
                nhood.options.add(new Option(nhoodsFiltered[z].nhood, nhoodsFiltered[z].nhood));
            }
        }
    }
}

function InitAreas() {
    var area = document.getElementById("cntContent_AvailArea");
    if (area == null)
        area = document.getElementById("ctl00_cntContent_AvailArea");
    for (i = area.options.length - 1; i >= 0; i--)
        area.remove(i);
    for (x = 0; x < islands.length; x++) {
        var areasFiltered = GetAreas(islands[x]);
        for (y = 0; y < areasFiltered.length; y++) {
            if (!InOptions(area, areasFiltered[y].area))
                area.options.add(new Option(areasFiltered[y].area, areasFiltered[y].area));
        }
    }
    SortList(area);
}

function InitNeighborhoods() {
    var nhood = document.getElementById("cntContent_AvailNeighborhood");
    if (nhood == null)
        nhood = document.getElementById("ctl00_cntContent_AvailNeighborhood");

    for (i = nhood.options.length - 1; i >= 0; i--)
        nhood.remove(i);
    for (x = 0; x < islands.length; x++) {
        var areasFiltered = GetAreas(islands[x]);
        for (y = 0; y < areasFiltered.length; y++) {
            var nhoodsFiltered = GetNhoods(islands[x], areasFiltered[y].area);
            for (z = 0; z < nhoodsFiltered.length; z++) {
                //if (!InOptions(nhood, nhoodsFiltered[z].nhood))
                nhood.options.add(new Option(nhoodsFiltered[z].nhood, nhoodsFiltered[z].nhood));
            }
        }
    }
    SortList(nhood);
}


function AddCounties_Click() {
    var availCounty = document.getElementById("cntContent_AvailCounty");
    if (availCounty == null)
        availCounty = document.getElementById("ctl00_cntContent_AvailCounty");
    var county = document.getElementById("cntContent_County");
    if (county == null)
        county = document.getElementById("ctl00_cntContent_County");
    var availArea = document.getElementById("cntContent_AvailArea");
    if (availArea == null)
        availArea = document.getElementById("ctl00_cntContent_AvailArea");
    var area = document.getElementById("cntContent_Area");
    if (area == null)
        area = document.getElementById("ctl00_cntContent_Area");
    var availNeighborhood = document.getElementById("cntContent_AvailNeighborhood");
    if (availNeighborhood == null)
        availNeighborhood = document.getElementById("ctl00_cntContent_AvailNeighborhood");
    var neighborhood = document.getElementById("cntContent_Neighborhood");
    if (neighborhood == null)
        neighborhood = document.getElementById("ctl00_cntContent_Neighborhood");

    for (a = availArea.options.length - 1; a >= 0; a--) {
        availArea.remove(a);
    }
    if (availNeighborhood != null) {
        for (a = availNeighborhood.options.length - 1; a >= 0; a--) {
            availNeighborhood.remove(a);
        }
    }
    for (a = availCounty.options.length - 1; a >= 0; a--) {
        if (availCounty.options[a].selected) {
            var island = availCounty.options[a].value;
            county.options.add(new Option(island, island));
            availCounty.remove(a);
        }
    }
    var selectedCounties = new Array();
    var index = 0;
    for (a = county.options.length - 1; a >= 0; a--) {
        selectedCounties[index++] = county.options[a].value;
    }
    SortList(availCounty);
    SortList(county);
    var areasFiltered = GetAreasFromArr(selectedCounties);
    for (x = 0; x < areasFiltered.length; x++) {
        if (!InOptions(availArea, areasFiltered[x].area))
            availArea.options.add(new Option(areasFiltered[x].area, areasFiltered[x].area));
    }
    SortList(availArea);
    SortList(area);
    if (availNeighborhood != null) {
        var nhoodsFiltered = GetNhoodsFromArr(areasFiltered);
        for (x = 0; x < nhoodsFiltered.length; x++) {
            if (!InOptions(availNeighborhood, nhoodsFiltered[x].nhood))
                availNeighborhood.options.add(new Option(nhoodsFiltered[x].nhood, nhoodsFiltered[x].nhood));
        }
        SortList(availNeighborhood);
        SortList(neighborhood);
    }
    SaveAreas();
}

function RemoveCounties_Click() {
    var availCounty = document.getElementById("cntContent_AvailCounty");
    if (availCounty == null)
        availCounty = document.getElementById("ctl00_cntContent_AvailCounty");
    var county = document.getElementById("cntContent_County");
    if (county == null)
        county = document.getElementById("ctl00_cntContent_County");
    var availArea = document.getElementById("cntContent_AvailArea");
    if (availArea == null)
        availArea = document.getElementById("ctl00_cntContent_AvailArea");
    var area = document.getElementById("cntContent_Area");
    if (area == null)
        area = document.getElementById("ctl00_cntContent_Area");
    var availNeighborhood = document.getElementById("cntContent_AvailNeighborhood");
    if (availNeighborhood == null)
        availNeighborhood = document.getElementById("ctl00_cntContent_AvailNeighborhood");
    var neighborhood = document.getElementById("cntContent_Neighborhood");
    if (neighborhood == null)
        neighborhood = document.getElementById("ctl00_cntContent_Neighborhood");

    for (a = availArea.options.length - 1; a >= 0; a--) {
        availArea.remove(a);
    }
    if (availNeighborhood != null) {
        for (a = availNeighborhood.options.length - 1; a >= 0; a--) {
            availNeighborhood.remove(a);
        }
    }     
    for (a = county.options.length - 1; a >= 0; a--) {
        if (county.options[a].selected) {
            var island = county.options[a].value;
            availCounty.options.add(new Option(island, island));
            county.remove(a);
        }
    }
    var selectedCounties = new Array();
    var index = 0;
    for (a = county.options.length - 1; a >= 0; a--) {
        selectedCounties[index++] = county.options[a].value;
    }
    SortList(availCounty);
    SortList(county);
    var areasFiltered = GetAreasFromArr(selectedCounties);
    for (x = 0; x < areasFiltered.length; x++) {
        if (!InOptions(availArea, areasFiltered[x].area))
            availArea.options.add(new Option(areasFiltered[x].area, areasFiltered[x].area));
    }
    for (x = area.options.length - 1; x >= 0; x--) {
        if (!InOptions(availArea, area.options[x].value))
            area.remove(x);
        else if (InOptions(availArea, area.options[x].value)) {
            RemoveOption(availArea, area.options[x].value)
        }
    }
    if (availArea.options.length == 0)
        InitAreas();
    SortList(availArea);
    SortList(area);
    if (availNeighborhood != null) {

        var nhoodsFiltered = GetNhoodsFromArr(areasFiltered);
        for (x = 0; x < nhoodsFiltered.length; x++) {
            if (!InOptions(availNeighborhood, nhoodsFiltered[x].area))
                availNeighborhood.options.add(new Option(nhoodsFiltered[x].nhood, nhoodsFiltered[x].nhood));
        }
        for (x = neighborhood.options.length - 1; x >= 0; x--) {
            if (!InOptions(availNeighborhood, neighborhood.options[x].value))
                neighborhood.remove(x);
            else if (InOptions(availNeighborhood, neighborhood.options[x].value)) {
                RemoveOption(availNeighborhood, neighborhood.options[x].value)
            }
        }
        if (availNeighborhood.options.length == 0)
            InitNeighborhoods();
        SortList(availNeighborhood);
        SortList(neighborhood);
    }
    SaveAreas();
}

function AddAreas_Click() {
    var availArea = document.getElementById("cntContent_AvailArea");
    if (availArea == null)
        availArea = document.getElementById("ctl00_cntContent_AvailArea");
    var area = document.getElementById("cntContent_Area");
    if (area == null)
        area = document.getElementById("ctl00_cntContent_Area");
    var availNeighborhood = document.getElementById("cntContent_AvailNeighborhood");
    if (availNeighborhood == null)
        availNeighborhood = document.getElementById("ctl00_cntContent_AvailNeighborhood");
    var neighborhood = document.getElementById("cntContent_Neighborhood");
    if (neighborhood == null)
        neighborhood = document.getElementById("ctl00_cntContent_Neighborhood");

    if (availNeighborhood != null) {

        for (a = availNeighborhood.options.length - 1; a >= 0; a--) {
            availNeighborhood.remove(a);
        }
    }     
    for (a = availArea.options.length - 1; a >= 0; a--) {
        if (availArea.options[a].selected) {
            var selectedArea = availArea.options[a].value;
            area.options.add(new Option(selectedArea, selectedArea));
            availArea.remove(a);
        }
    }
    var selectedAreas = new Array();
    var index = 0;
    for (a = area.options.length - 1; a >= 0; a--) {
        selectedAreas[index++] = area.options[a].value;
    }
    SortList(availArea);
    SortList(area);
    if (availNeighborhood != null) {

        var nhoodsFiltered = GetNhoodsFromSmallArr(selectedAreas);
        for (x = 0; x < nhoodsFiltered.length; x++) {
            if (!InOptions(availNeighborhood, nhoodsFiltered[x].nhood))
                availNeighborhood.options.add(new Option(nhoodsFiltered[x].nhood, nhoodsFiltered[x].nhood));
        }
        SortList(availNeighborhood);
        SortList(neighborhood);
    }
    SaveAreas();
}

function RemoveAreas_Click() {
    var availArea = document.getElementById("cntContent_AvailArea");
    if (availArea == null)
        availArea = document.getElementById("ctl00_cntContent_AvailArea");
    var area = document.getElementById("cntContent_Area");
    if (area == null)
        area = document.getElementById("ctl00_cntContent_Area");
    var availNeighborhood = document.getElementById("cntContent_AvailNeighborhood");
    if (availNeighborhood == null)
        availNeighborhood = document.getElementById("ctl00_cntContent_AvailNeighborhood");
    var neighborhood = document.getElementById("cntContent_Neighborhood");
    if (neighborhood == null)
        neighborhood = document.getElementById("ctl00_cntContent_Neighborhood");

    if (availNeighborhood != null) {
        for (a = availNeighborhood.options.length - 1; a >= 0; a--) {
            availNeighborhood.remove(a);
        }
    }     
    for (a = area.options.length - 1; a >= 0; a--) {
        if (area.options[a].selected) {
            var selectedArea = area.options[a].value;
            availArea.options.add(new Option(selectedArea, selectedArea));
            area.remove(a);
        }
    }
    var selectedAreas = new Array();
    var index = 0;
    for (a = area.options.length - 1; a >= 0; a--) {
        selectedAreas[index++] = area.options[a].value;
    }
    SortList(availArea);
    SortList(area);
    if (availNeighborhood != null) {
        var nhoodsFiltered = GetNhoodsFromSmallArr(selectedAreas);
        for (x = 0; x < nhoodsFiltered.length; x++) {
            if (!InOptions(availNeighborhood, nhoodsFiltered[x].nhood))
                availNeighborhood.options.add(new Option(nhoodsFiltered[x].nhood, nhoodsFiltered[x].nhood));
        }
        for (x = neighborhood.options.length - 1; x >= 0; x--) {
            if (!InOptions(availNeighborhood, neighborhood.options[x].value)) {
                neighborhood.remove(x);
            }
            else if (InOptions(availNeighborhood, neighborhood.options[x].value)) {
                RemoveOption(availNeighborhood, neighborhood.options[x].value)
            }
        }
        if (availNeighborhood.options.length == 0)
            InitNeighborhoods();
        SortList(availNeighborhood);
        SortList(neighborhood);
        SaveAreas();
    }
}

function AddNeighborhoods_Click() {
    var availNeighborhood = document.getElementById("cntContent_AvailNeighborhood");
    if (availNeighborhood == null)
        availNeighborhood = document.getElementById("ctl00_cntContent_AvailNeighborhood");
    var neighborhood = document.getElementById("cntContent_Neighborhood");
    if (neighborhood == null)
        neighborhood = document.getElementById("ctl00_cntContent_Neighborhood");

    for (a = availNeighborhood.options.length - 1; a >= 0; a--) {
        if (availNeighborhood.options[a].selected) {
            var selectedNeighborhood = availNeighborhood.options[a].value;
            neighborhood.options.add(new Option(selectedNeighborhood, selectedNeighborhood));
            availNeighborhood.remove(a);
        }
    }
    SortList(availNeighborhood);
    SortList(neighborhood);
    SaveAreas();
}

function RemoveNeighborhoods_Click() {
    var availNeighborhood = document.getElementById("cntContent_AvailNeighborhood");
    if (availNeighborhood == null)
        availNeighborhood = document.getElementById("ctl00_cntContent_AvailNeighborhood");
    var neighborhood = document.getElementById("cntContent_Neighborhood");
    if (neighborhood == null)
        neighborhood = document.getElementById("ctl00_cntContent_Neighborhood");

    for (a = neighborhood.options.length - 1; a >= 0; a--) {
        if (neighborhood.options[a].selected) {
            var selectedNeighborhood = neighborhood.options[a].value;
            availNeighborhood.options.add(new Option(selectedNeighborhood, selectedNeighborhood));
            neighborhood.remove(a);
        }
    }
    SortList(availNeighborhood);
    SortList(neighborhood);
    SaveAreas();
}

function SaveAreas() {
    var countyValue = "";
    var areaValue = "";
    var neighborhoodValue = "";

    var hdnCounty = document.getElementById("cntContent_hdnCounty");
    if (hdnCounty == null)
        hdnCounty = document.getElementById("ctl00_cntContent_hdnCounty");
    var hdnArea = document.getElementById("cntContent_hdnArea");
    if (hdnArea == null)
        hdnArea = document.getElementById("ctl00_cntContent_hdnArea");
    var hdnNeighborhood = document.getElementById("cntContent_hdnNeighborhood");
    if (hdnNeighborhood == null)
        hdnNeighborhood = document.getElementById("ctl00_cntContent_hdnNeighborhood");


    if (hdnCounty == null)
        return;


    var county = document.getElementById("cntContent_County");
    if (county == null)
        county = document.getElementById("ctl00_cntContent_County");
    var area = document.getElementById("cntContent_Area");
    if (area == null)
        area = document.getElementById("ctl00_cntContent_Area");
    var neighborhood = document.getElementById("cntContent_Neighborhood");
    if (neighborhood == null)
        neighborhood = document.getElementById("ctl00_cntContent_Neighborhood");

    for (a = county.options.length - 1; a >= 0; a--) {
        countyValue += county.options[a].value + ",";
    }
    for (a = area.options.length - 1; a >= 0; a--) {
        areaValue += area.options[a].value + ",";
    }
    if (neighborhood != null) {
        for (a = neighborhood.options.length - 1; a >= 0; a--) {
            neighborhoodValue += neighborhood.options[a].value + ",";
        }
    }
    if (countyValue.length > 0)
        countyValue = countyValue.substring(0, countyValue.length - 1);
    if (areaValue.length > 0)
        areaValue = areaValue.substring(0, areaValue.length - 1);
    if (neighborhood != null) {
        if (neighborhoodValue.length > 0)
            neighborhoodValue = neighborhoodValue.substring(0, neighborhoodValue.length - 1);
    }
    hdnCounty.value = countyValue;
    hdnArea.value = areaValue;
    if (neighborhood != null)
        hdnNeighborhood.value = neighborhoodValue;
}

function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        alert('func');
        window.onload = func;
    } else {
        window.onload = function() {
        if (oldonload) {
            alert('NOT func');
                oldonload();
            }
            func();
        }
    }
}

function SearchOnEnterKeyPress() {
    var keycode;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    else return true;
    if (keycode == 13) {
        try {
            var submitButton = document.getElementById("cntContent_ibSubmit");
            if(submitButton == null)
                submitButton = document.getElementById("ctl00_cntContent_ibSubmit");
            if (submitButton != null)
                submitButton.click();
        }
        catch (e)
    { }
    }
}


document.onkeypress = SearchOnEnterKeyPress;

//addLoadEvent(SearchOnEnterKeyPress);
