function activate(obj)
{
	obj.disabled = false;
	obj.style.backgroundColor = 'white';
}

function disable(obj)
{
	obj.disabled = true;
	obj.style.backgroundColor = 'grey';
}


/************************************************************************************************************
(C) www.dhtmlgoodies.com, October 2005

This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	

Terms of use:
You are free to use this script as long as the copyright message is kept intact. However, you may not
redistribute, sell or repost it without our permission.

Thank you!

www.dhtmlgoodies.com
Alf Magne Kalleland

Modifications made by Vincent Eldefors

************************************************************************************************************/	
var ajax = new sack();

function getStateList(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('dhtmlgoodies_state').options.length = 0; // Empty state select box
	document.getElementById('dhtmlgoodies_city').options.length = 0; // Empty city select box
	if(countryCode.length>0 && countryCode != "all"){
		ajax.requestFile = '/edit/getStates.php?countryCode='+countryCode;	// Specifying which file to get
		ajax.onCompletion = createStates;	// Specify function that will be executed after file has been found
		ajax.runAJAX();		// Execute AJAX function
	}
}

function createStates()
{
	var obj = document.getElementById('dhtmlgoodies_state');
	eval(ajax.response);	// Executing the response from Ajax as Javascript code	
}

function getCityList(sel)
{
	var obj = document.getElementById('dhtmlgoodies_country');
	var countryCode = obj.options[obj.selectedIndex].value;

	var stateCode = sel.options[sel.selectedIndex].value;
	document.getElementById('dhtmlgoodies_city').options.length = 0;	// Empty city select box
	if(stateCode.length>0){
		ajax.requestFile = '/edit/getCities.php?stateCode='+stateCode+'&countryCode='+countryCode;	// Specifying which file to get
		ajax.onCompletion = createCities;	// Specify function that will be executed after file has been found
		ajax.runAJAX();		// Execute AJAX function
	}
}

function createCities()
{
	var obj = document.getElementById('dhtmlgoodies_city');
	eval(ajax.response);	// Executing the response from Ajax as Javascript code	
}

function editOpen(filepath, width, height)
{
	window.open('/edit/'+filepath, 'new_window', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=' + width + ', height=' + height + ', top=200, left=300')
}

function searchRedirect()
{
	var obj = document.getElementById('dhtmlgoodies_city');
	try
	{
		if (obj.selectedIndex)
		{
			var cityCode = obj.options[obj.selectedIndex].value;
			var cityName = obj.options[obj.selectedIndex].text;
		}
		else
		{
			var cityCode = 0;
		}
	}
	catch (e)
	{
		var cityCode = 0;
	}

	var obj = document.getElementById('dhtmlgoodies_state');
	try
	{
		if (obj.selectedIndex)
		{
			var stateCode = obj.options[obj.selectedIndex].value;
			var stateName = obj.options[obj.selectedIndex].text;
		}
		else
		{
			var stateCode = 0;
		}
	}
	catch (e)
	{
		var stateCode = 0;
	}

	var obj = document.getElementById('dhtmlgoodies_country');
	try
	{
		if (obj.selectedIndex)
		{
			var countryCode = obj.options[obj.selectedIndex].value;
			var countryName = obj.options[obj.selectedIndex].text;
		}
		else
		{
			var countryCode = 0;
		}
	}
	catch (e)
	{
		var countryCode = 0;
	}

	var url = "http://www.tartareandesire.com/tours/";

	if (cityCode > 0)
	{
		var url2 = countryName + "/" + stateName + "/" + cityName + "/" + cityCode + "/";
	}
	else if (stateCode > 0)
	{
		var url2 = countryName + "/" + stateName + "/" + stateCode + "/";
	}
	else if (countryCode > 0)
	{
		var url2 = countryName + "/" + countryCode + "/";
	}
	else if (countryCode == "all")
	{
		var url2 = "";
	}
	else
	{
		url = "";
		url2 = "";
	}
	url = url + escape(url2);
	if (url != "")
		window.location.href = url;
	else
		alert("You did not choose a geographic region.");
	return (false);
}
