<!--
var tcities = new Array('Anaheim', 'Boston', 'Chicago', 'Hawaii', 'Key West', 'Las Vegas', 'Los Angeles', 'Miami', 'New Orleans', 'New York', 'Orlando', 'Palm Springs', 'Philadelphia', 'San Diego', 'San Francisco', 'Savannah', 'Seattle', 'St Augustine', 'Vancouver', 'Washington DC');
var tgroup = new Object;
var tour_length = tcities.length;

for (i=0; i<tour_length; i++)
  tgroup[tcities[i]]=new Array();
tgroup["Anaheim"][0] = new Option("No preference", "")
tgroup["Anaheim"][1] = new Option("::::::::: Theme Parks :::::::::", "park")
tgroup["Anaheim"][2] = new Option("LA City Tours", "los angeles")
tgroup["Anaheim"][3] = new Option("Hollywood Tours", "hollywood")
tgroup["Anaheim"][4] = new Option("Tijuana Shopping", "tijuana")
tgroup["Anaheim"][5] = new Option("San Diego Zoo", "zoo")
tgroup["Anaheim"][6] = new Option("Six Flags Magic Mt", "six flags")
tgroup["Anaheim"][7] = new Option("Universal Studios", "universal")
tgroup["Anaheim"][8] = new Option("Sea World", "sea world")
tgroup["Anaheim"][9] = new Option("Knott's Betty Farm", "betty farm")
tgroup["Anaheim"][10] = new Option("Medieval Times", "medieval")
tgroup["Anaheim"][11] = new Option("Legoland", "legoland")

tgroup["Boston"][0] = new Option("No preference", "")
tgroup["Boston"][1] = new Option("City Pass", "card")
tgroup["Boston"][2] = new Option("City Tours", "duration")
tgroup["Boston"][3] = new Option("Washington DC", "washington")
tgroup["Boston"][4] = new Option("Niagara Falls", "niagara")
tgroup["Boston"][5] = new Option("Trolley tours ", "trolley")
tgroup["Boston"][6] = new Option("Concord", "concord")
tgroup["Boston"][7] = new Option("Pilgrim's Path", "pilgrim's")
tgroup["Boston"][8] = new Option("Plimoth Plantation", "plimoth")
tgroup["Boston"][9] = new Option("Plimoth Plantation", "plimoth")
tgroup["Boston"][10] = new Option("Salem", "salem")
tgroup["Boston"][11] = new Option("Cape Cod", "cape cod")
tgroup["Boston"][12] = new Option("Newport", "newport")
tgroup["Boston"][13] = new Option("Shopping tours", "outlets")

tgroup["Chicago"][0] = new Option("No preference", "")
tgroup["Chicago"][1] = new Option("City Pass", "card")
tgroup["Chicago"][2] = new Option("Trolley Tours", "trolley")
tgroup["Chicago"][3] = new Option("City Tours", "duration")
tgroup["Chicago"][4] = new Option("Wine Tours", "wine")

tgroup["Hawaii"][0] = new Option("No preference", "")

tgroup["Key West"][0] = new Option("No preference", "")
tgroup["Key West"][1] = new Option("Trolley Tours", "trolley")
tgroup["Key West"][2] = new Option("Aquarium", "aquarium")
tgroup["Key West"][3] = new Option("City Tours", "duration")

tgroup["Las Vegas"][0] = new Option("No preference", "")
tgroup["Las Vegas"][1] = new Option("Hoover Dam", "dam")
tgroup["Las Vegas"][2] = new Option("Grand Canyon", "canyon")
tgroup["Las Vegas"][3] = new Option("City Tours", "duration")
tgroup["Las Vegas"][4] = new Option("Red Rock Mt", "red rock")
tgroup["Las Vegas"][5] = new Option("River Rafting", "river")

tgroup["Los Angeles"][0] = new Option("No preference", "")
tgroup["Los Angeles"][1] = new Option("Las Vegas", "vegas")
tgroup["Los Angeles"][2] = new Option("Grand Canyon", "canyon")
tgroup["Los Angeles"][3] = new Option("San Francisco", "francisco")
tgroup["Los Angeles"][4] = new Option("Yosemite", "yosemite")
tgroup["Los Angeles"][5] = new Option("Mexico", "mexico")
tgroup["Los Angeles"][6] = new Option("City Tours", "duration")
tgroup["Los Angeles"][7] = new Option("Universal Studios", "universal")
tgroup["Los Angeles"][8] = new Option("Sea World", "sea world")
tgroup["Los Angeles"][9] = new Option("Disneyland Adventure", "disneyland")
tgroup["Los Angeles"][10] = new Option(" Knotts Berry Farm", "berry farm")
tgroup["Los Angeles"][11] = new Option("Six Flags Magic Mt", "six flags")
tgroup["Los Angeles"][12] = new Option("Lake Tahoe/Powell", "lake")
tgroup["Los Angeles"][13] = new Option("Rocky Mountain", "rocky")

tgroup["Miami"][0] = new Option("No preference", "")
tgroup["Miami"][1] = new Option("Everglade Park", "everglade")
tgroup["Miami"][2] = new Option("City Pass", "card")
tgroup["Miami"][3] = new Option("City Tours", "duration")
tgroup["Miami"][4] = new Option("Orlando Overnight", "orlando")
tgroup["Miami"][5] = new Option("Snorkeling", "snorkeling")
tgroup["Miami"][6] = new Option("Key West", "key west")
tgroup["Miami"][7] = new Option("Snorkeling", "snorkeling")
tgroup["Miami"][8] = new Option("Parrot Jungle Island", "parrot")

tgroup["New Orleans"][0] = new Option("No preference", "")
tgroup["New Orleans"][1] = new Option("City Tours", "duration")

tgroup["New York"][0] = new Option("No preference", "")
tgroup["New York"][1] = new Option("Washington DC", "washington")
tgroup["New York"][2] = new Option("Niagara Falls", "niagara")
tgroup["New York"][3] = new Option("Philadelphia", "philadelphia")
tgroup["New York"][4] = new Option("Boston", "boston")
tgroup["New York"][5] = new Option("Shopping Tours", "outlets")
tgroup["New York"][6] = new Option("City Tours", "duration")
tgroup["New York"][7] = new Option("Catskills", "catskills")
tgroup["New York"][8] = new Option("Foxwood Casino", "foxwood")
tgroup["New York"][9] = new Option("Helicopters Tour", "minutes")
tgroup["New York"][10] = new Option("Finger Lakes", "lakes")
tgroup["New York"][11] = new Option("Hudson Valley", "hudsonn")

tgroup["Orlando"][0] = new Option("No preference", "")
tgroup["Orlando"][1] = new Option("Kennedy Space Center", "space")
tgroup["Orlando"][2] = new Option("Gatorland", "gatorland")
tgroup["Orlando"][3] = new Option("Cypress Gardens", "cypress")
tgroup["Orlando"][4] = new Option("Silver Springs", "silver")
tgroup["Orlando"][5] = new Option("City Tours", "duration")
tgroup["Orlando"][6] = new Option("Busch Gardens", "busch")
tgroup["Orlando"][7] = new Option("Everglades & Naples", "everglades")

tgroup["Palm Springs"][0] = new Option("No preference", "")
tgroup["Palm Springs"][1] = new Option("City Tours", "duration")
tgroup["Palm Springs"][2] = new Option("Grand Valley", "valley")

tgroup["Philadelphia"][0] = new Option("No preference", "")
tgroup["Philadelphia"][1] = new Option("Amish Experience", "amish")

tgroup["San Diego"][0] = new Option("No preference", "")
tgroup["San Diego"][1] = new Option("City Pass", "card")
tgroup["San Diego"][2] = new Option("Trolley Tours", "trolley")
tgroup["San Diego"][3] = new Option("Rosarito Beach", "rosarito")
tgroup["San Diego"][4] = new Option("Tijuana", "tijuana")
tgroup["San Diego"][5] = new Option("Disneyland/California", "disneyland")
tgroup["San Diego"][6] = new Option("San Diego Zoo", "zoo")
tgroup["San Diego"][7] = new Option("Wild Animal Park", "animal")
tgroup["San Diego"][8] = new Option("City Tours", "duration")
tgroup["San Diego"][9] = new Option("Legoland", "legoland")
tgroup["San Diego"][10] = new Option("Universal Studio", "universal")

tgroup["San Francisco"][0] = new Option("No preference", "")
tgroup["San Francisco"][1] = new Option("City Pass", "card")
tgroup["San Francisco"][2] = new Option("Grand Canyon", "canyon")
tgroup["San Francisco"][3] = new Option("Yosemite", "yosemite")
tgroup["San Francisco"][4] = new Option("Muir Woods", "muir woods")
tgroup["San Francisco"][5] = new Option("Reno (casinos)", "reno")
tgroup["San Francisco"][6] = new Option("Redwood Sequoias", "sequoias")
tgroup["San Francisco"][7] = new Option("Segway Tours", "segway")
tgroup["San Francisco"][8] = new Option("City Tours", "duration")
tgroup["San Francisco"][9] = new Option("Wine Country", "wine")
tgroup["San Francisco"][10] = new Option("Mexico Ensenada", "mexico")
tgroup["San Francisco"][11] = new Option("Monterey/Carmel", "monterey")

tgroup["Savannah"][0] = new Option("No preference", "")
tgroup["Savannah"][1] = new Option("City Tours", "duration")

tgroup["Seattle"][0] = new Option("No preference", "")
tgroup["Seattle"][1] = new Option("City Tours", "duration")
tgroup["Seattle"][2] = new Option("Boeing Factory  ", "boeing")
tgroup["Seattle"][3] = new Option("Vancouver/Victoria", "vancouver")

tgroup["St Augustine"][0] = new Option("No preference", "")
tgroup["St Augustine"][1] = new Option("City Tours", "duration")
tgroup["St Augustine"][2] = new Option("Helicopter Tours", "miles")

tgroup["Vancouver"][0] = new Option("No preference", "")
tgroup["Vancouver"][1] = new Option("City Tours", "duration")
tgroup["Vancouver"][2] = new Option("Dinner Cruises", "cruise")
tgroup["Vancouver"][3] = new Option("Whale Watching", "whale")
tgroup["Vancouver"][4] = new Option("Butchart Gardens", "butchart")
tgroup["Vancouver"][5] = new Option("Capilano Salmon Hatchery", "salmon")
tgroup["Vancouver"][6] = new Option("Trolley Tours", "trolley")
tgroup["Vancouver"][7] = new Option("Whistler Excursion", "whistler")
tgroup["Vancouver"][8] = new Option("Victoria Excursion", "victoria")

tgroup["Washington DC"][0] = new Option("No preference", "")
tgroup["Washington DC"][1] = new Option("City Tours", "duration")
tgroup["Washington DC"][2] = new Option("Night Tours", "monuments")
tgroup["Washington DC"][3] = new Option("Williamsburg, VA ", "williamsburg")
tgroup["Washington DC"][4] = new Option("Busch Gardens", "busch")



function update_tour_depart()
{
        var tf_obj = get_tour_depart_obj();
        for (var i=tf_obj.options.length-1; i>0; i--)
        {
        tf_obj.options[i]=null;
        }
        for (var i=0; i<tcities.length; i++)
        {
                var j = i+1;
        tf_obj.options[j] = new Option(tcities[i], tcities[i]);
        }
}

function get_tour_from_obj()
{
	return get_tour_depart_obj();
}

function get_tour_to_obj()
{
        return get_tour_attraction_obj();
}

function get_tour_depart_obj()
{
	return document.tour_search.depart;
}

function get_tour_attraction_obj()
{
	return document.tour_search.attraction;
}

function get_tour_days_obj()
{
        return document.tour_search.days;
}

function update_tour(depart, attr, keywords, days, jump)
{
	var depart_obj = get_tour_depart_obj();
	var index;
	if (depart)
	{
		index = set_selected(depart_obj, depart);
	}
	else
	{
		index = depart_obj.options.selectedIndex;
		if (index > 0)
        	{
			depart = depart_obj.options[index].value;
		}
	}
	if (index > 0)
	{
		if (tgroup[depart] instanceof Array && tgroup[depart].length > 1)
		{
			update_tour_to(depart, jump);
			if (attr)
			{
				var attr_obj = get_tour_attraction_obj();
				set_selected(attr_obj, attr);
			}		
		}
	}	
        if (days)
	{
		var days_obj = get_tour_days_obj();
		set_selected(days_obj, days);
	}
	if (keywords && document.tour_search.keywords)
	{
		document.tour_search.keywords.value = keywords;
	}
}

function update_tour_to(city, jump)
{
	if (city != '' && tgroup[city] instanceof Array) 
	{	
		var attr_obj = get_tour_attraction_obj();
		var opt_len = tgroup[city].length;
		if (opt_len == 1 && jump)
		{
			return ga("http://www.ivymedia.com/cgi-bin/tour.cgi?depart=" + city);
		}
  		for (var i=attr_obj.options.length-1; i>0; i--)
		{
       			attr_obj.options[i]=null;
   		}
   		for (var i=0; i<opt_len; i++)
		{
       			attr_obj.options[i] = new Option(tgroup[city][i].text, tgroup[city][i].value);
		}
	}
	tour_clear();
}

function set_tour_dates(obj, selected_date)
{
	var wdays= new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun");
	var d = new Date();
	var aDay=86400000;
	var selected = 0;
	for (var i=0; i<60; i++)
	{
		var m = d.getMonth() + 1;
		if (m < 10)
		{
			m = "0" + m;
		}
		var dt = d.getDate();
		if (dt < 10)
		{
			dt = "0" + dt;
		}
		var fdv = d.getFullYear() + "-" + m + "-" + dt + " " + wdays[d.getDay()];
		var fd = d.getFullYear() + "-" + m + "-" + dt;
		obj.options[i+1] = new Option(fdv, fd, true);
		d = new Date(d.valueOf() + aDay);
		if (selected_date == fd)
		{
			selected = i+1;
		}
	}
	obj.options.selectedIndex = selected;
}

function tour_clear()
{
	var t_obj = document.getElementById("itemList");
	if (t_obj)
	{
	    t_obj.innerHTML = ""; 
	}
}

function tour_conditional_regen()
{
	var t_obj = document.getElementById("itemList");
	if (t_obj && t_obj.innerHTML != "")
	{
		tour_regen();
	}
}

function tour_regen()
{
	var depart_obj = document.tour_search.depart;
	var depart = "";
	if (depart_obj && depart_obj.value)
	{
		depart = depart_obj.value;
	}
	else
	{
		tour_clear();
		return;
	}
	var attr = "";
	var attr_obj = document.tour_search.attraction;
	if (attr_obj && attr_obj.value)
	{
		attr = attr_obj.value;
	}
	var date_obj = document.tour_search.date;
	var d = "";
	if (date_obj && date_obj.value)
	{
		d = date_obj.value;
	}
	var ignore = "";
	var ignore_obj = document.tour_search.ignore;
	if (ignore_obj && ignore_obj.checked == true)
	{
		ignore = 1;
	}
	var days_obj = document.tour_search.days;
	var days = "";
	if (days_obj && days_obj.value)
	{
		days = days_obj.value;
	}
	var keywords = "";
	var keywords_obj = document.tour_search.keywords;
	if (keywords_obj && keywords_obj.value)
	{
		keywords = keywords_obj.value;
	}
        var order = "";
        var order_obj = document.tour_search.order;
        if (order_obj && order_obj.value)
        {
                order = order_obj.value;
        }
        ga("/cgi-bin/tour.cgi?depart=" + depart + "&attraction=" + attr + "&date=" + d + "&ignore=" + ignore + "&days=" + days + "&keywords=" + keywords + "&order=" + order);
}

function check_tour_input()
{
        var depart_obj = document.tour_search.depart;
        var depart = '';
        if (depart_obj && depart_obj.value)
        {
                depart = depart_obj.value;
        }
        if (depart == '')
        {
                alert("Please select a departure city!");
                depart_obj.focus();
                return false;
        }
        var date_obj = document.tour_search.date;
        var d = '';
        if (date_obj && date_obj.value)
        {
                d = date_obj.value;
        }
        if (d && !d.match(/\d\d\d\d-\d\d-\d\d/))
        {
                alert("Date (" + d + ") must be either empty or in the format: YYYY-MM-DD");
                date_obj.focus();
                return false;
        }
}

function tour_date_clicked(y,m,d)
{
	if (m < 10) m = '0' + m;
	if (d < 10) d = '0' + d;
	document.tour_search.date.value = y + '-' + m + '-' + d;
	if (document.tour_search.ignore.checked == false)
	{
		tour_conditional_regen();
	}
}

function empty_tour_date()
{
        document.tour_search.date.value = '';
        tour_conditional_regen();
}

function check_tour_ignore()
{
        if (document.tour_search.ignore.checked == false)
        {
                document.tour_search.date.disabled = false;
                var timg_obj = document.getElementById('td_img');
                if (timg_obj != null)
                {
                        timg_obj.src = "/images/calendar.gif";
                }
                if (document.tour_search.date.value == '')
                {
                        var t_date = new Date(past_date.valueOf() + 3 * aDay);
                        document.tour_search.date.value = formatDate(t_date, "yyyy-MM-dd");
			return;
                }
        }
        else
        {
                document.tour_search.date.value = "";
                document.tour_search.date.disabled = true;
                var timg_obj = document.getElementById('td_img');
                if (timg_obj != null)
                {
                        timg_obj.src = "/images/calendar_hidden.gif";
                }
        }
        tour_conditional_regen();
}

function sort_tours(order_by)
{
	if (document.tour_search && document.tour_search.order)
	{
		document.tour_search.order.value = order_by;
		tour_conditional_regen();
	}
}

-->

