var catopt;
var siteopt;

catopt = new Array; 
//this array stores the main dropdown text
catopt[0]=  "Please Select...";
catopt[1] = "Land services & ";
catopt[2] = "Land services & Cruises ";
//catopt[3] = "Excursions";
//catopt[4] = "Transfers";

siteopt = new Array; 
//this array stores the second dropdown text for the first catagory
siteopt[0]="Please Select...";


var trueLength = siteopt.length; 
//stores how many options are currently in the second dropdown
var lst = siteopt.length; 
//stores how many options are currently in the second dropdown

function changeMenu()
{
  siteopt.length = 0;
  menuNum = document.form1.SelectPrimary.selectedIndex; 
  //document.[Form Name].[Main Option Name].selectedIndex        this grabs the index of the selected option in the main dropdown
  /*
	The next few if statements are based on the selected index 
	of the main dropdown.
	The array stores the values of the second dropdown options 
	that are associated with the currently selected main dropdown
  */
  if (menuNum==null) return;
  if (menuNum==0)
  {
	siteopt = new Array;
    siteopt[0] = new Option("Please Select...");
  }
  
  if (menuNum==1)
  {
    siteopt = new Array;
    siteopt[0] = new Option("All tours");
    siteopt[1] = new Option("Archaeological tours");
    siteopt[2] = new Option("Island tours");
    siteopt[3] = new Option("Byzantine/Religious tours");
  }
  if (menuNum==2)
  {
    siteopt = new Array;
    siteopt[0] = new Option("including a 3-day Cruise");
    siteopt[1] = new Option("including a 4-day Cruise");
    siteopt[2] = new Option("including a 7-day Cruise");
  }
  tot = siteopt.length;  
  //grabs how many options are now in the second dropdown
  for (i = lst; i > 0; i--)
    {
    document.form1.SelectSecondary.options[i] = null;
    /* document.[Form Name].[Select Name].options[i] this 
    gets rid of the secondary options 
    */
    }
  for (i = 0; i < tot; i++)
    {
    document.form1.SelectSecondary.options[i] = siteopt[i];
    /* document.[Form Name].[Select Name].options[i] this 
    puts the new options in the menu 
    */
    }
  document.form1.SelectSecondary.options[0].selected = true;  
  //selects the first option in the second dropdown
  lst = siteopt.length;  
  //grabs how many options are now in the second dropdown
}


function calculate()
{		document.currency_converter.converted.value=Math.round((document.currency_converter.how_much_to_convert.value* document.currency_converter.convert_to.value/document.currency_converter.convert_from.value)*1000)/1000;
}

function check()
{
	if (document.currency_converter.how_much_to_convert.value<0)
	{
		document.currency_converter.how_much_to_convert.value='';
		alert("Please enter a valid amount");
		document.currency_converter.how_much_to_convert.focus;
		return false;
	}
}


function cityweather()
{
	var city;
	city=document.weather.city.options[document.weather.city.selectedIndex].value;
	//var location='http://www.pirateweather.com/weather/hw3.php?config=&forecast=zandh&pands='+city+'&Submit=GO';
	src='http://weatherreports.com/jscript.html?width=125&height=125&theme=white_no_search_box&location='+city+'%2C%20Greece&units=f';
	//window.open(location,"New","resizable=no,scrollbars=no,height=600,width=200");
}

function checkMyCredentials()
{
	if (document.login.username.value=='' || document.login.password.value=='')
	{
		alert("Please provide and username and a password to login...");
		return false;
	}
	else
	{
		var answer=confirm("Please note it is suggested you start over any itinerary you may be working on");
		if (!answer)
		{
			return false;
		}
	}
}

function restartme()
{
	var x=window.confirm("All data you have entered so far will be lost. Would you like to proceed?");
	if (x)
	{
		location.href='startover.asp';
	}
	//else
	//window.alert("Too bad")
}

function openWin()
{
	window.open("","New","resizable=yes,scrollbars=yes,height=450,width=500")
}


function alertLogOut()
{
  var answer=confirm("Please note you need to start over any itinerary you may be working on");
  if (answer)
  {
    location.href="startover.asp";
  }
  else
  {
    return false;
  }
}

function switchToRussian() {
  parts=location.href.split("/");
  sz=parts.length;
  parts[sz] = parts[sz-1];
  parts[sz-1] = "ru";
  location.href = parts.join("/");
}

function switchToEnglish(){
  parts=location.href.split("/");
  sz=parts.length;
  if (parts[sz-1] == "ru") {
    parts[sz-1] = parts[sz];
	parts[sz] = null;
  }
  location.href = parts.join("/");
}


