// 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 sub-region ---";
s3 = "1,Any sub-region";
//p = new Array();
b = new Array();
c = new Array();
b[0]=s1;

c[4]=new Array();
b[1]="4,Africa";
c[4][0]=s2;
c[4][1]=s3;
c[4][2]="17,Benin";
c[4][3]="18,Botswana";
c[4][4]="19,Burkina Faso";
c[4][5]="21,Cameroon";
c[4][6]="22,Cape Verde";
c[4][7]="26,Congo";
c[4][8]="28,Egypt";
c[4][9]="30,Eritrea";
c[4][10]="31,Ethiopia";
c[4][11]="356,Gambia";
c[4][12]="33,Ghana";
c[4][13]="37,Ivory Coast";
c[4][14]="38,Kenya";
c[4][15]="39,Lesotho";
c[4][16]="41,Libya";
c[4][17]="42,Madagascar";
c[4][18]="44,Mali";
c[4][19]="46,Mauritius";
c[4][20]="47,Morocco";
c[4][21]="48,Mozambique";
c[4][22]="49,Namibia";
c[4][23]="50,Niger";
c[4][24]="52,Reunion";
c[4][25]="53,Rwanda";
c[4][26]="55,Sao Tome and Principe";
c[4][27]="56,Senegal";
c[4][28]="57,Seychelles";
c[4][29]="60,South Africa";
c[4][30]="62,Swaziland";
c[4][31]="63,Tanzania";
c[4][32]="65,Togo";
c[4][33]="66,Tunisia";
c[4][34]="67,Uganda";
c[4][35]="1839,Zaire";
c[4][36]="70,Zambia";
c[4][37]="71,Zimbabwe";

c[2]=new Array();
b[2]="2,Antarctica";
c[2][0]=s2;
c[2][1]=s3;
c[2][2]="1838,Antarctica";
c[2][3]="1880,Bouvet Island";
c[2][4]="1887,French Southern Territories";
c[2][5]="1888,Heard and McDonald Islands";

c[2803]=new Array();
b[3]="2803,Arctic";
c[2803][0]=s2;
c[2803][1]="2804,Arctic";

c[3]=new Array();
b[4]="3,Asia";
c[3][0]=s2;
c[3][1]=s3;
c[3][2]="72,Afghanistan";
c[3][3]="181,Armenia";
c[3][4]="73,Azerbaijan";
c[3][5]="74,Bangladesh";
c[3][6]="75,Bhutan";
c[3][7]="77,Cambodia";
c[3][8]="78,China";
c[3][9]="79,Hong Kong";
c[3][10]="80,India";
c[3][11]="81,Indonesia";
c[3][12]="82,Japan";
c[3][13]="83,Kazakhstan";
c[3][14]="84,Kyrgyzstan";
c[3][15]="85,Laos";
c[3][16]="87,Malaysia";
c[3][17]="88,Maldives";
c[3][18]="89,Mongolia";
c[3][19]="90,Myanmar";
c[3][20]="91,Nepal";
c[3][21]="93,Pakistan";
c[3][22]="1891,Philippines";
c[3][23]="94,Singapore";
c[3][24]="95,South Korea";
c[3][25]="97,Sri Lanka";
c[3][26]="98,Taiwan";
c[3][27]="99,Tajikistan";
c[3][28]="100,Thailand";
c[3][29]="101,Tibet";
c[3][30]="103,Turkmenistan";
c[3][31]="104,Uzbekistan";
c[3][32]="105,Vietnam";

c[5]=new Array();
b[5]="5,Australia and Oceania";
i = 0;
c[5][i++]=s2;
c[5][i++]=s3;
c[5][i++]="1877,American Samoa";
c[5][i++]="106,Australia";
c[5][i++]="107,Cook Is.";
c[5][i++]="114,Fiji";
c[5][i++]="4868,French Polynesia";
c[5][i++]="116,Kiribati";
c[5][i++]="118,Micronesia";
c[5][i++]="121,New Zealand";
c[5][i++]="125,Palau";
c[5][i++]="127,Papua New Guinea";
c[5][i++]="134,Solomon Is.";
c[5][i++]="138,Tahiti";
c[5][i++]="139,Tonga";
c[5][i++]="141,Truk";

c[6]=new Array();
b[6]="6,Central America and Caribbean";
c[6][0]=s2;
c[6][1]=s3;
c[6][2]="1878,Anguilla";
c[6][3]="147,Antiqua & Barbuda";
c[6][4]="148,Aruba";
c[6][5]="149,Bahamas";
c[6][6]="150,Barbados";
c[6][7]="175,Belize";
c[6][8]="151,Bermuda";
c[6][9]="152,British Virgin Is.";
c[6][10]="153,Cayman Is.";
c[6][11]="154,Cuba";
c[6][12]="176,Costa Rica";
c[6][13]="155,Dominica";
c[6][14]="156,Dominican Republic";
c[6][15]="177,El Salvador";
c[6][16]="158,Grenada";
c[6][17]="159,Guadeloupe";
c[6][18]="178,Guatemala";
c[6][19]="232,Honduras";
c[6][20]="161,Jamaica";
c[6][21]="162,Martinique";
c[6][22]="163,Netherlands Antilles";
c[6][23]="233,Nicaragua";
c[6][24]="234,Panama";
c[6][25]="164,Puerto Rico";
c[6][26]="165,St Kitts and Nevis";
c[6][27]="166,St Lucia";
c[6][28]="168,St Vincent and Grenadines";
c[6][29]="170,Tobago";
c[6][30]="171,Trinidad";
c[6][31]="1893,Trinidad and Tobago";
c[6][32]="172,Turks and Caicos";
c[6][33]="173,US Virgin Is.";
c[6][34]="174,West Indies";

c[7]=new Array();
b[7]="7,Europe";
i = 0;
c[7][i++]=s2;
c[7][i++]=s3;
c[7][i++]="180,Andorra";
c[7][i++]="182,Austria";
c[7][i++]="183,Belarus";
c[7][i++]="184,Belgium";
c[7][i++]="185,Bosnia";
c[7][i++]="186,Bulgaria";
c[7][i++]="187,Croatia";
c[7][i++]="188,Cyprus";
c[7][i++]="189,Czech Republic";
c[7][i++]="190,Denmark";
c[7][i++]="2260,England";
c[7][i++]="191,Estonia";
c[7][i++]="1886,Faroe Islands";
c[7][i++]="192,Finland";
c[7][i++]="193,France";
c[7][i++]="194,Georgia";
c[7][i++]="195,Germany";
c[7][i++]="197,Greece";
c[7][i++]="198,Greenland";
c[7][i++]="200,Hungary";
c[7][i++]="201,Iceland";
c[7][i++]="202,Ireland";
c[7][i++]="203,Italy";
c[7][i++]="204,Latvia";
c[7][i++]="206,Lithuania";
c[7][i++]="207,Luxembourg";
c[7][i++]="220,Malta";
c[7][i++]="209,Moldova";
c[7][i++]="210,Monaco";
c[7][i++]="211,Montenegro";
c[7][i++]="212,Netherlands";
c[7][i++]="2805,Northern Ireland";
c[7][i++]="213,Norway";
c[7][i++]="214,Poland";
c[7][i++]="215,Portugal";
c[7][i++]="216,Romania";
c[7][i++]="217,Russia";
c[7][i++]="218,San Marino";
c[7][i++]="219,Scotland";
c[7][i++]="221,Serbia";
c[7][i++]="222,Slovakia";
c[7][i++]="223,Slovenia";
c[7][i++]="224,Spain";
c[7][i++]="226,Sweden";
c[7][i++]="227,Switzerland";
c[7][i++]="228,Ukraine";
c[7][i++]="1968,Wales";

c[8]=new Array();
b[8]="8,Middle East";
c[8][0]=s2;
c[8][1]=s3;
c[8][2]="236,Iran";
c[8][3]="238,Israel";
c[8][4]="239,Jordan";
c[8][5]="240,Kuwait";
c[8][6]="241,Lebanon";
c[8][7]="242,Oman";
c[8][8]="245,Syria";
c[8][9]="102,Turkey";
c[8][10]="246,United Arab Emirates";
c[8][11]="248,Yemen";

c[11]=new Array();
b[9]="11,South America";
c[11][0]=s2;
c[11][1]=s3;
c[11][2]="249,Argentina";
c[11][3]="250,Bolivia";
c[11][4]="251,Brazil";
c[11][5]="252,Chile";
c[11][6]="253,Colombia";
c[11][7]="289,Ecuador";
c[11][8]="290,French Guiana";
c[11][9]="291,Guyana";
c[11][10]="293,Peru";
c[11][11]="294,Suriname";
c[11][12]="295,Uruguay";
c[11][13]="296,Venezuela";

c[255]=new Array();
b[10]="255,Canada";
i = 0;
c[255][i++]=s2;
c[255][i++]=s3;
c[255][i++]="316,Alberta";
c[255][i++]="317,British Columbia";
c[255][i++]="318,Manitoba";
c[255][i++]="554,Montreal";
c[255][i++]="320,New Brunswick";
c[255][i++]="319,Newfoundland";
c[255][i++]="321,Northwest Territories";
c[255][i++]="322,Nova Scotia";
c[255][i++]="329,Nunavut";
c[255][i++]="323,Ontario";
c[255][i++]="324,Prince Edward Island";
c[255][i++]="325,Quebec";
c[255][i++]="326,Saskatchewan";
c[255][i++]="553,Toronto";
c[255][i++]="551,Yellowknife";
c[255][i++]="327,Yukon";

c[257]=new Array();
b[11]="257,Mexico";
c[257][0]=s2;
c[257][1]="257,Mexico";

c[254]=new Array();
b[12]="254,USA";
c[254][0]=s2;
c[254][1]=s3;
c[254][2]="258,Alabama";
c[254][3]="259,Alaska";
c[254][4]="260,Arizona";
c[254][5]="261,Arkansas";
c[254][6]="262,California";
c[254][7]="263,Colorado";
c[254][8]="264,Connecticut";
c[254][9]="308,Delaware";
c[254][10]="265,Florida";
c[254][11]="266,Georgia";
c[254][12]="267,Hawaii";
c[254][13]="268,Idaho";
c[254][14]="269,Illinois";
c[254][15]="270,Indiana";
c[254][16]="271,Iowa";
c[254][17]="309,Kansas";
c[254][18]="272,Kentucky";
c[254][19]="273,Louisiana";
c[254][20]="274,Maine";
c[254][21]="275,Maryland";
c[254][22]="276,Massachusetts";
c[254][23]="277,Michigan";
c[254][24]="278,Minnesota";
c[254][25]="310,Mississippi";
c[254][26]="279,Missouri";
c[254][27]="280,Montana";
c[254][28]="311,Nebraska";
c[254][29]="281,Nevada";
c[254][30]="282,New Hampshire";
c[254][31]="312,New Jersey";
c[254][32]="283,New Mexico";
c[254][33]="284,New York";
c[254][34]="314,North Carolina";
c[254][35]="315,North Dakota";
c[254][36]="286,Ohio";
c[254][37]="287,Oklahoma";
c[254][38]="288,Oregon";
c[254][39]="297,Pennsylvania";
c[254][40]="313,Rhode Island";
c[254][41]="298,South Carolina";
c[254][42]="299,South Dakota";
c[254][43]="300,Tennessee";
c[254][44]="301,Texas";
c[254][45]="302,Utah";
c[254][46]="303,Vermont";
c[254][47]="1879,Virginia";
c[254][48]="304,Washington";
c[254][49]="305,West Virginia";
c[254][50]="306,Wisconsin";
c[254][51]="307,Wyoming";
c[0]=new Array();

a=new Array();
d=new Array();
s4 = "1#-- any --";

a[0]="--- Select a category ---";
a[1]="Any category";

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] = "448#Sightseeing";
d[6][13] = "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');
	//cat = t.value;
	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)
	{
		t = GetEl('scat');
		//cat = t.value;
		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');

	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;
}
