//Array of Resorts
function resortRecord(country_c, country_name, resort_c, resort_name)
{
  this.country_c = country_c
  this.country_name = country_name
  this.resort_c = resort_c
  this.resort_name = resort_name
}

function resorts(resort_c, resort_name)
{
  this.resort_c = resort_c
  this.resort_name = resort_name
}

function countries(country_c, country_name)
{
  this.country_c = country_c
  this.country_name = country_name
}

//Create Resort main array
var resortList = Array()
var justResorts = Array()
var justCountries = Array()

//Create Resort pointer
var resortPoint
var justresortsPoint
var justcountriesPoint


function showhelp(newurl,newname) 
{
  apopup=window.open(newurl,newname,'toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width=500,height=350,screenX=10,screenY=10');
}

function doPrint()
{
  window.focus();
  window.print();
}

//Empty resort list and repopulate with only those corresponding to strCountry
function FilterResorts(strCountry)
{
	var cmbRsrt = document.getElementById("cmbResort");
	var newOpt;
	for (var i=cmbRsrt.options.length-1; i>=0; i--)
		cmbRsrt.options[i] = null;
	newOpt = new Option("Any resort", "");
	cmbRsrt.options[cmbRsrt.options.length] = newOpt;
	for (var i=0; i<=resortPoint; i++)
		if (resortList[i].country_c == strCountry || strCountry == "")
		{
			newOpt = new Option(resortList[i].resort_name, resortList[i].resort_c);
			cmbRsrt.options[cmbRsrt.options.length] = newOpt;
		}

}

//Set country combo to strResort's country code
function SetCountry(strResort)
{
	var strCtry;
	for (var i=0; i<=resortPoint; i++)
		if (resortList[i].resort_c == strResort)
		{
			strCtry = resortList[i].country_c;
			break;
		}
	var cmbCtry = document.getElementById("cmbCountry");
	for (var i=cmbCtry.options.length-1; i>=0; i--)
		if (cmbCtry.options[i].value == strCtry)
		{
			cmbCtry.options[i].selected=true;
			break;
		}
}

//go to search page
function goSearch(strAdvMode)
{
	parent.parent.parent.right.goSearch(strAdvMode);
}

//go to search results page
function goSearchResults(blnUpdateState)
{
	parent.parent.parent.right.goSearchResults(blnUpdateState);
}

//go to search results page
function goSearchResultsQuick(blnUpdateState)
{
	parent.parent.parent.right.resetSearch();
	parent.parent.parent.right.goSearchResultsQuick(blnUpdateState);
}

//toggle thumbnails on / off
function toggleThumbs(blnState)
{
	parent.parent.parent.right.toggleThumbs(blnState);
}

//go to a given results page
function goPage(intPage)
{
	parent.parent.parent.right.goPage(intPage);
}

//go to comparison page
function goCompare()
{
	parent.parent.parent.right.goCompare();
}

//alter Chalets for comparison list
function changeCompare(intChalet,blnInclude)
{
	return parent.parent.parent.right.changeCompare(intChalet,blnInclude);
}

//alter order by
function changeSort(intValue)
{
	return parent.parent.parent.right.changeSort(intValue);
}

function changeFacilitySort(intValue)
{
	return parent.parent.parent.right.changeFacilitySort(intValue);
}

//email search result list
function email()
{
  var email;
  email=prompt('Enter email address to send these results to','');
  if (email != null)
  {
    var name;
    name=prompt('Enter your name','');
    if (name != null)
        parent.parent.parent.right.email(email,name);
  }
}

//highlight or dehighlight result rows
function highlight(intRow)
{
	var row = document.getElementById('row_'+intRow);
	if (row)
		row.className='highlighted';
	var row = document.getElementById('row2_'+intRow);
	if (row)
		row.className='highlighted';
}
function dehighlight(intRow)
{
	var row = document.getElementById('row_'+intRow);
	if (row)
		row.className='results';				
	var row = document.getElementById('row2_'+intRow);
	if (row)
		row.className='results';				
}
