function showAdvancedLink()
{
	document.cookie = "advancedLink=1";
	f = document.form;
	city = '';
	document.getElementById('advancedLink').style.visibility = "visible";
	for (i = 0; i<f.city.length; i++)
	{
		if (f.city[i].checked==true)
			city = f.city[i].value;
	}
	populateAdvanced(city);
	//f.city2.selectedIndex=0;
}

function hideAdvancedLink()
{
	document.cookie = "advancedLink=0";
	document.getElementById('advancedLink').style.visibility = "hidden";
	document.getElementById('selectEither').style.visibility = "hidden";
	resetAdvancedSearch();
	hideAdvanced();
	//f.city2.selectedIndex=0;
}

function showAdvancedLink2()
{
	document.cookie = "advancedLink=1";
	f = document.form;
	thiscity = f.city2.options[f.city2.selectedIndex].value;
	document.getElementById('advancedLink').style.visibility = "visible";
	populateAdvanced(thiscity);
}

function hideAdvancedLink2()
{
	document.cookie = "advancedLink=0";
	document.getElementById('advancedLink').style.visibility = "hidden";
	document.getElementById('selectEither').style.visibility = "hidden";
	resetAdvancedSearch();
	hideAdvanced();
}


function hideAdvanced()
{
	f = document.form;
	s = document.getElementById('advancedSearch');
	a = document.getElementById('advancedLink');
	l = document.getElementById('selectEither');

	s.style.display = 'none';
	a.className = 'green8';
	l.style.visiblity = 'hidden';
	//f.price.selectedIndex = 0;
	f.category.selectedIndex = 0;
	f.location.selectedIndex = 0;
	f.hotelname.selectedIndex = 0;
	f.facilities.selectedIndex = 0;
}

londonAttractionDD = new Array();
londonTubeDD = new Array();
londonTrainDD = new Array();
londonAttractionidDD = new Array();
londonTubeidDD = new Array();
londonTrainidDD = new Array();
londonPriceDD = new Array();
londonRatingDD = new Array();
londonLocationDD = new Array();
londonHotelDD = new Array();
londonHotelidDD = new Array();

barcelonaAttractionDD = new Array();
barcelonaAttractionidDD = new Array();
barcelonaPriceDD = new Array();
barcelonaTubeDD = new Array();
barcelonaTrainDD = new Array();
barcelonaTubeidDD = new Array();
barcelonaTrainidDD = new Array();
barcelonaRatingDD = new Array();
barcelonaLocationDD = new Array();
barcelonaHotelDD = new Array();
barcelonaHotelidDD = new Array();

dublinAttractionDD = new Array();
dublinTrainDD = new Array();
dublinTubeDD = new Array();
dublinAttractionidDD = new Array();
dublinTrainidDD = new Array();
dublinTubeidDD = new Array();
dublinPriceDD = new Array();
dublinRatingDD = new Array();
dublinLocationDD = new Array();
dublinHotelDD = new Array();
dublinHotelidDD = new Array();

edinburghAttractionDD = new Array();
edinburghTubeDD = new Array();
edinburghTrainDD = new Array();
edinburghAttractionidDD = new Array();
edinburghTubeidDD = new Array();
edinburghTrainidDD = new Array();
edinburghPriceDD = new Array();
edinburghRatingDD = new Array();
edinburghLocationDD = new Array();
edinburghHotelDD = new Array();
edinburghHotelidDD = new Array();

parisAttractionDD = new Array();
parisTubeDD = new Array();
parisTrainDD = new Array();
parisAttractionidDD = new Array();
parisTubeidDD = new Array();
parisTrainidDD = new Array();
parisPriceDD = new Array();
parisRatingDD = new Array();
parisLocationDD = new Array();
parisHotelDD = new Array();
parisHotelidDD = new Array();

function fillAdvanced(dd, ar,arid)
{
	var dd1 = document.getElementById(dd);
	dd1.length = 1;

	for (var i = 0; i< ar.length ; i++)
	{
		if (arid=='') dd1.options[i+1] = new Option(ar[i], ar[i]);
		else dd1.options[i+1] = new Option(ar[i],arid[i]);
	}
}

function populateAdvanced(city)
{
	document.getElementById('londonTube').style.display = 'none';
	document.getElementById('londonTrain').style.display = 'none';
	document.getElementById('postcode').style.display = 'none';
	if (city == 'London')
	{
		fillAdvanced('attraction', londonAttractionDD,londonAttractionidDD);
		document.getElementById('londonTube').style.display = 'block';
		document.getElementById('londonTrain').style.display = 'block';
		document.getElementById('postcode').style.display = 'block';
		document.tubeimage.src='images/tube.gif';
		fillAdvanced('tube', londonTubeDD,londonTubeidDD);
		fillAdvanced('rail', londonTrainDD,londonTrainidDD);
		//fillAdvanced('price', londonPriceDD,"");
		fillAdvanced('category', londonRatingDD,"");
		fillAdvanced('location', londonLocationDD,"");
		fillAdvanced('hotelname', londonHotelDD,londonHotelidDD);
	}
	else if (city == 'Barcelona')
	{
		fillAdvanced('attraction', barcelonaAttractionDD,barcelonaAttractionidDD);
		document.getElementById('londonTube').style.display = 'block';
		document.getElementById('londonTrain').style.display = 'block';
		document.getElementById('postcode').style.display = 'none';
		document.tubeimage.src='images/metro.gif';
		//fillAdvanced('price', barcelonaPriceDD,"");
		fillAdvanced('tube', barcelonaTubeDD,barcelonaTubeidDD);
		fillAdvanced('rail', barcelonaTrainDD,barcelonaTrainidDD);
		fillAdvanced('category', barcelonaRatingDD,"");
		fillAdvanced('location', barcelonaLocationDD,"");
		fillAdvanced('hotelname', barcelonaHotelDD,barcelonaHotelidDD);
	}
	else if (city == 'Dublin')
	{
		fillAdvanced('attraction', dublinAttractionDD, dublinAttractionidDD);
		document.getElementById('londonTrain').style.display = 'block';
		document.getElementById('londonTube').style.display = 'none';
		document.getElementById('postcode').style.display = 'none';
		//fillAdvanced('price', dublinPriceDD,"");
		fillAdvanced('rail', dublinTrainDD, dublinTrainidDD);
		fillAdvanced('category', dublinRatingDD,"");
		fillAdvanced('location', dublinLocationDD,"");
		fillAdvanced('hotelname', dublinHotelDD, dublinHotelidDD);
	}
	else if (city == 'Edinburgh')
	{
		fillAdvanced('attraction', edinburghAttractionDD, edinburghAttractionidDD);
		document.getElementById('londonTrain').style.display = 'block';
		document.getElementById('postcode').style.display = 'block';
		document.getElementById('londonTube').style.display = 'none';
		//fillAdvanced('price', edinburghPriceDD,"");
		fillAdvanced('rail', edinburghTrainDD, edinburghTrainidDD);
		fillAdvanced('category', edinburghRatingDD,"");
		fillAdvanced('location', edinburghLocationDD,"");
		fillAdvanced('hotelname', edinburghHotelDD, edinburghHotelidDD);
	}
	else if (city == 'Paris')
	{
		fillAdvanced('attraction', parisAttractionDD, parisAttractionidDD);
		document.getElementById('londonTube').style.display = 'block';
		document.getElementById('londonTrain').style.display = 'block';
		document.getElementById('postcode').style.display = 'none';
		document.tubeimage.src='images/metro.gif';
		//fillAdvanced('price', parisPriceDD,"");
		fillAdvanced('tube', parisTubeDD, parisTubeidDD);
		fillAdvanced('rail', parisTrainDD, parisTrainidDD);
		fillAdvanced('category', parisRatingDD,"");
		fillAdvanced('location', parisLocationDD,"");
		fillAdvanced('hotelname', parisHotelDD, parisHotelidDD);
	}
}
