// search script

if (document.images)
{
	link = "/images/design/mainalt-";
	europe = new Image(); europe.src=link+"europe.gif";
	asia = new Image(); asia.src=link+"asia.gif";
	africa = new Image(); africa.src=link+"africa.gif";
	antarctica = new Image(); antarctica.src=link+"antarctica.gif";
	australia = new Image(); australia.src=link+"australia.gif";
	carribean = new Image(); carribean.src=link+"carribean.gif";
	middle = new Image(); middle.src=link+"middle.gif";
	north = new Image(); north.src=link+"north.gif";
	south = new Image(); south.src=link+"south.gif";
	map = new Image(); map.src="/images/design/dot.gif";
}


function setReg(regName)
{
	if (document.images) {document["regions"].src = eval(regName+".src");}
}

function resetReg()
{
	if (document.images) {document["regions"].src = map.src;}
}



// REGIONS && SUBREGIONS && ACTIVITIES
//-------------------------------------------------------------------------------------------------

s1 = "0,--- Select a region ---";
s2 = "0,--- Select a subregion ---";
s3 = "1,Any subregion";
//p = new Array();
b = new Array();
c = new Array();
b[0]=s1;

b[1]="4,Africa";
c[4]=new Array();
c[4] = [s2, s3, "15,Angola", "16,Algeria", "17,Benin", "18,Botswana", "19,Burkina Faso", "21,Cameroon", "22,Cape Verde",
"23,Central African Republic", "26,Congo", "1839,Democratic Republic of the Congo", "28,Egypt", "30,Eritrea", "31,Ethiopia",
"356,Gambia", "33,Ghana", "37,Ivory Coast", "38,Kenya", "39,Lesotho", "41,Libya", "42,Madagascar", "44,Mali", "46,Mauritius",
"47,Morocco", "48,Mozambique", "49,Namibia", "50,Niger", "52,Reunion", "53,Rwanda", "55,Sao Tome and Principe", "56,Senegal",
"57,Seychelles", "60,South Africa", "62,Swaziland", "63,Tanzania", "65,Togo", "66,Tunisia", "67,Uganda", "70,Zambia", "71,Zimbabwe"];

b[2]="2,Antarctica";
c[2] = [s2, s3, "1838,Antarctica", "1880,Bouvet Island", "1887,French Southern Territories", "1888,Heard and McDonald Islands"];

b[3]="2803,Arctic";
c[2803] = [s2, "2804,Arctic"];

b[4]="3,Asia";
c[3] = [s2, s3, "72,Afghanistan", "74,Bangladesh", "75,Bhutan", "77,Cambodia", "78,China", "79,Hong Kong", "80,India",
"81,Indonesia", "82,Japan", "83,Kazakhstan", "84,Kyrgyzstan", "85,Laos", "87,Malaysia", "88,Maldives", "89,Mongolia",
"90,Myanmar", "91,Nepal", "93,Pakistan", "1891,Philippines", "94,Singapore", "95,South Korea", "97,Sri Lanka",
"98,Taiwan", "99,Tajikistan", "100,Thailand", "101,Tibet", "103,Turkmenistan", "104,Uzbekistan", "105,Vietnam"];

b[5]="5,Australia and Oceania";
c[5]= [s2, s3, "1877,American Samoa", "106,Australia", "107,Cook Is.", "114,Fiji", "4868,French Polynesia", "116,Kiribati",
"118,Micronesia", "121,New Zealand", "125,Palau", "127,Papua New Guinea", "134,Solomon Is.", "138,Tahiti", "139,Tonga", "141,Truk"];

b[6]="6,Central America and Caribbean";
c[6] = [s2, s3, "1878,Anguilla", "147,Antiqua & Barbuda", "148,Aruba", "149,Bahamas", "150,Barbados", "175,Belize", "151,Bermuda",
"152,British Virgin Is.", "153,Cayman Is.", "154,Cuba", "176,Costa Rica", "155,Dominica", "156,Dominican Republic", "177,El Salvador",
"158,Grenada", "159,Guadeloupe", "178,Guatemala", "232,Honduras", "161,Jamaica", "162,Martinique", "163,Netherlands Antilles",
"233,Nicaragua", "234,Panama", "164,Puerto Rico", "165,St Kitts and Nevis", "166,St Lucia", "168,St Vincent and Grenadines",
"170,Tobago", "171,Trinidad", "1893,Trinidad and Tobago", "172,Turks and Caicos", "173,US Virgin Is.", "174,West Indies"];

b[7]="7,Europe";
c[7]=new Array();
c[7] = [s2, s3, "179,Albania", "180,Andorra", "181,Armenia", "182,Austria", "73,Azerbaijan", "183,Belarus", "184,Belgium", "185,Bosnia", "186,Bulgaria",
"187,Croatia", "188,Cyprus", "189,Czech Republic", "190,Denmark", "2260,England", "191,Estonia", "1886,Faroe Islands", "192,Finland",
"193,France", "194,Georgia", "195,Germany", "197,Greece", "198,Greenland", "200,Hungary", "201,Iceland", "202,Ireland", "203,Italy",
"204,Latvia", "206,Lithuania", "207,Luxembourg", "220,Malta", "209,Moldova", "210,Monaco", "211,Montenegro", "212,Netherlands",
"2805,Northern Ireland", "213,Norway", "214,Poland", "215,Portugal", "216,Romania", "217,Russia", "218,San Marino", "219,Scotland",
"221,Serbia", "222,Slovakia", "223,Slovenia", "224,Spain", "226,Sweden", "227,Switzerland", "228,Ukraine", "1968,Wales"];

b[8]="8,Middle East";
c[8]=new Array();
c[8] = [s2, s3, "236,Iran", "238,Israel", "239,Jordan", "240,Kuwait", "241,Lebanon", "242,Oman", "245,Syria", "102,Turkey", "246,United Arab Emirates", "248,Yemen"];

b[9]="11,South America";
c[11]=new Array();
c[11] = [s2, s3, "249,Argentina", "250,Bolivia", "251,Brazil", "252,Chile", "253,Colombia", "289,Ecuador", "290,French Guiana", "291,Guyana",
"293,Peru", "294,Suriname", "295,Uruguay", "296,Venezuela"];

b[10]="255,Canada";
c[255]=new Array();
c[255] = [s2, s3, "316,Alberta", "317,British Columbia", "318,Manitoba", "554,Montreal", "320,New Brunswick", "319,Newfoundland",
"321,Northwest Territories", "322,Nova Scotia", "329,Nunavut", "323,Ontario", "324,Prince Edward Island", "325,Quebec", "326,Saskatchewan",
"553,Toronto", "551,Yellowknife", "327,Yukon"];

c[257]=new Array();
b[11]="257,Mexico";
c[11] = [s2, s3, "257,Mexico"];

c[254]=new Array();
b[12]="254,USA";
c[254] = [s2, s3, "258,Alabama", "259,Alaska", "260,Arizona", "261,Arkansas", "262,California", "263,Colorado", "264,Connecticut",
"308,Delaware", "265,Florida", "266,Georgia", "267,Hawaii", "268,Idaho", "269,Illinois", "270,Indiana", "271,Iowa", "309,Kansas",
"272,Kentucky", "273,Louisiana", "274,Maine", "275,Maryland", "276,Massachusetts", "277,Michigan", "278,Minnesota", "310,Mississippi",
"279,Missouri", "280,Montana", "311,Nebraska", "281,Nevada", "282,New Hampshire", "312,New Jersey", "283,New Mexico", "284,New York",
"314,North Carolina", "315,North Dakota", "286,Ohio", "287,Oklahoma", "288,Oregon", "297,Pennsylvania", "313,Rhode Island",
"298,South Carolina", "299,South Dakota", "300,Tennessee", "301,Texas", "302,Utah", "303,Vermont", "1879,Virginia", "304,Washington",
"305,West Virginia", "306,Wisconsin", "307,Wyoming"];

c[0]=new Array();

a=new Array();
d=new Array();
s4 = "1#-- any --";

a[0]="--- Select an activity ---";
a[1]="Any activity";

a[2]="Artistry";
d[2]=new Array();
d[2][0] = s4;
d[2][1] = "246,262,303#Art and craft workshop";
d[2][2] = "52#Crafts";
d[2][3] = "117#Painting";
d[2][4] = "120#Performing Arts";
d[2][5] = "156#Textile Arts";
d[2][6] = "303#Writer workshops";

a[3]="Health & Wellness";
d[3]=new Array();
d[3][0] = s4;
d[3][1] = "77#Health & Fitness";
d[3][2] = "74,187,331#Golf";
d[3][3] = "188#Spa";

a[4]="History Whiz";
d[4]=new Array();
d[4][0] = s4;
d[4][1] = "22#Archeology/History";
d[4][2] = "64#Film/Film History";
d[4][3] = "101#Military History";
d[4][4] = "106#Museum Tours";

a[5]="Leisure Pursuit";
d[5]=new Array();
d[5][0] = s4;
d[5][1] = "26#Astronomy";
d[5][2] = "47#Collectors Tours";
d[5][3] = "51,234#Cooking School";
d[5][4] = "121#Photography and Videography";

a[6]="Local Culture";
d[6]=new Array();
d[6][0] = s4;
d[6][1] = "31#Barging";
d[6][2] = "45,180#Castle hotel";
d[6][3] = "32#Christmas/New Year Tours";
d[6][4] = "50#Concert Tours";
d[6][5] = "23#Cultural Journey";
d[6][6] = "24#Festival Tours";
d[6][7] = "69#Garden Tours";
d[6][8] = "234,165#Food & Wine";
d[6][9] = "226,279#Language Schools";
d[6][10] = "109#Native Americans";
d[6][11] = "124,97#Railway Trips";
d[6][12] = "57#Self Drive";
d[6][13] = "448#Sightseeing";
d[6][14] = "137#Shopping Trips";

a[7]="Nature & Wildlife";
d[7]=new Array();
d[7][0] = s4;
d[7][1] = "226,37#Birding";
d[7][2] = "181,58#Ecotourism";
d[7][3] = "92#Rainforest";
d[7][4] = "98#Marine Biology";
d[7][5] = "108#National Parks";
d[7][6] = "173#Volcano Tours";
d[7][7] = "131#Wildlife Viewing";

a[8]="Outdoor: Land Rambler";
d[8]=new Array();
d[8][0] = s4;
d[8][1] = "36#Bicycle Touring";
d[8][2] = "39#Camel Riding";
d[8][3] = "40#Camping";
d[8][4] = "44#Caving";
d[8][5] = "55#Desert Expeditions";
d[8][6] = "57#Driving Tours";
d[8][7] = "56#Dogsledding";
d[8][8] = "186,28#Farm Stay & Ranching";
d[8][9] = "231,80,96,159#Hiking & Trekking";
d[8][10] = "87#Horse Riding";
d[8][11] = "185,191,88#Hunting";
d[8][12] = "96#Llama Trekking";
d[8][13] = "103#Motorcycle Tours";
d[8][14] = "431#Multi-activity";
d[8][15] = "129#Rollerblading Tours";
d[8][16] = "142#Snowmobiling";
d[8][17] = "139#Snowshoeing";
d[8][18] = "159#Walking Tours";

a[9]="Outdoor: Mountain Ranger";
d[9]=new Array();
d[9][0] = s4;
d[9][1] = "73#Glacier Tours";
d[9][2] = "78#Heliskiing";
d[9][3] = "89#Ice Climbing";
d[9][4] = "220,105#Mountain/Rock Climbing";
d[9][5] = "116#Outdoor Skills School";
d[9][6] = "140#Skiing & Snowboarding";

a[10]="Outdoor: Sky Eagle";
d[10]=new Array();
d[10][0] = s4;
d[10][1] = "30#Ballooning";
d[10][2] = "42#Canopy Tours";
d[10][3] = "66#Flightseeing";
d[10][4] = "171#Parachute Jumping";
d[10][5] = "119#Paragliding";

a[11]="Outdoor: Water Drifter";
d[11]=new Array();
d[11][0] = s4;
d[11][1] = "232,53,31#Boating and sailing";
d[11][2] = "227,41#Canoeing/Kayaking/Rafting";
d[11][3] = "184,205,65#Fishing";
d[11][4] = "182,219,43#Scuba diving";
d[11][5] = "48#Snorkeling";
d[11][6] = "150#Surfing";

a[12]="Romantic Venture";
d[12]=new Array();
d[12][0] = s4;
d[12][1] = "85#Honeymoon";
d[12][2] = "91#Island Vacation";
d[12][3] = "111#Nightlife";
d[12][4] = "138#Singles Tours";

a[13]="Spiritual Odyssey";
d[13]=new Array();
d[13][0] = s4;
d[13][1] = "35#Biblical Tours";
d[13][2] = "46#Church Tours";
d[13][3] = "122#Pilgrimage/Spirituality";
d[13][4] = "170#Yoga & Spiritual Experience";

a[14]="Sports Freak";
d[14]=new Array();
d[14][0] = s4;
d[14][1] = "27#Auto Racing ";
d[14][2] = "33,327#Baseball";
d[14][3] = "34,328#Basketball";
d[14][4] = "67#Football";
d[14][5] = "82,332#Hockey";
d[14][6] = "86#Horse Racing";
d[14][7] = "114#Olympic Games";
d[14][8] = "439,440#Rugby";
d[14][9] = "143,329#Soccer";
d[14][10] = "325#Sports camps";
d[14][11] = "154,337#Tennis";

a[15]="Sweet Harmony";
d[15]=new Array();
d[15][0] = s4;
d[15][1] = "49#College/Spring Breaks";
d[15][2] = "70#Gay Tours";
d[15][3] = "94#Lesbian Tours";
d[15][4] = "136#Senior Tours";
d[15][5] = "151#Tours for Handicap";
d[15][6] = "166#Women Tours";
d[15][7] = "183,112#Naturist resort";



function InitGroup(group)
{
	obj = a;

	t = GetEl('group');
	t.length = obj.length;
	t.selectedIndex = 0;
	t = t.options;

	for (i=0; i<obj.length; i++)
	{
		t[i].text = obj[i];
		t[i].value = i;

		if (group == i)
			t.selectedIndex = i;
	}
}


function SwitchGroup()
{
	SetCat(GetEl('group').value, 0);
}


function SetCat(group, cat)
{
	if (group > 1 && d[group])
	{
		t = GetEl('scat');
		t.length = d[group].length;
		t.selectedIndex = 0;
		t = t.options;

		for (i=0; i<d[group].length; i++)
		{
			tmp = d[group][i].split("#");
			t[i].text = tmp[1];
			t[i].value = tmp[0];

			if (cat == tmp[0])
				t.selectedIndex = i;
		}

		tmp = "block";
	}
	else
		tmp = "none";

	GetEl('cat_list').style.display=tmp;
}


function GetEl(el)
{
	return document.getElementById(el);
}


function SwitchRegion()
{
	SetSubReg(GetEl('region').value, 0);
}


function SetReg(region, loc)
{
	t = GetEl('region');
	t.length = b.length;
	t = t.options;
	if (region == 0)
		t.selectedIndex = 0;

	for (i=0; i<b.length; i++)
	{
		tmp = b[i].split(",");
		t[i].text = tmp[1];
		t[i].value = tmp[0];

		if (region == tmp[0])
			t.selectedIndex = i;
	}

	SetSubReg(region, loc);
}


function SetSubReg(region, loc)
{
	t = GetEl('loc');

	if (!c[region])
		return;

	t.length  = c[region].length

	if (region > 0 && t.length > 1)
	{
		t = t.options;
		t.selectedIndex = 0;

		for (i=0; i<c[region].length; i++)
		{
			tmp = c[region][i].split(",");
			t[i].text = tmp[1];
			t[i].value = tmp[0];

			if (loc == tmp[0])
				t.selectedIndex = i;
		}

		tmp='block';
	}
	else
		tmp='none';

	GetEl('loc_subregion').style.display=tmp;
}


function InitForm(region, loc, group, cat)
{
	SetReg(region, loc);
	InitGroup(group);
	SetCat(group, cat);
}


function FormValidate()
{
	region = GetEl('region').selectedIndex;
	loc = GetEl('loc').selectedIndex;
	cat = GetEl('group').selectedIndex;

	if ( region <= 0 )
	{
		if (cat < 1)
			alert("Please select a Region.\nPlease select a Category.");
		else
		if (loc < 1 && region > 0)
			alert("Please select a Region.\nPlease select a Sub-region.");
		else
			alert("Please select a Region.");

		return false;
	}

	if (loc == 0 && cat == 0)
	{
		alert("Please select a Sub-region.\nPlease select a Category.");
		return false;
	}
	else
	if (loc == 1 && cat == 1 && (region != 3 && region != 11))
	{
		alert("You must select a sub-region OR a category."); // skip 3, 11
		return false;
	}
	else
	if (loc < 1)
	{
		alert("You must select a sub-region.");
		return false;
	}
	else
	if (cat < 1)
	{
		alert("You must select a category.");
		return false;
	}

	obj = GetEl('ihub_search_frm');
	s_cat = obj.scat.value;

	if (s_cat == 1)
	{
		zz = "";

		for (i=1; i<d[cat].length; i++)
		{
			tmp = d[cat][i].split("#");
			zz = zz + "," + tmp[0];
		}

		s_cat = zz.substr(1, zz.length);
	}
	else
	if (s_cat == "")
	{
		s_cat = 1;
	}

	obj.cat.value = s_cat;
	obj.scat.value = 0;

	return true;
}


/*****************************************************************************/


function InitAdvForm(region, loc, group, cat, price, ss1, ss2)
{
	InitForm(region, loc, group, cat);
	InitPrice(price);

	InitSeason("ss1", ss1);
	InitSeason("ss2", ss2);
	GetEl('adv_list').style.display="block";
}

p = ['-- any --', 'less than $500', 'less than $1000', 'less than $2500', 'less than $5000', 'more than $5000'];


function InitPrice(price)
{
	obj = p;

	t = GetEl('price');

	t.length = obj.length;
	t.selectedIndex = 0;
	t = t.options;

	for (i=0; i<obj.length; i++)
	{
		t[i].text = obj[i];
		t[i].value = i;

		if (price == i)
			t.selectedIndex = i;
	}
}


s = ['-- any --', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];


function InitSeason(oname, season)
{
	obj = s;

	t = GetEl(oname);

	t.length = obj.length;
	t.selectedIndex = 0;
	t = t.options;

	for (i=0; i<obj.length; i++)
	{
		t[i].text = obj[i];
		t[i].value = i;

		if (season == i)
			t.selectedIndex = i;
	}
}

