/**
 *
 * @access public
 * @return void
 **/
function UpdateHours(which)
{
	var select = $(which+'_hour');
	var selected_option = select.options[select.selectedIndex].value;

	var option;
	select.options.length = 0;

	if ($F(which+'_location') == 13)
	{
		for (hour=6; hour<=7; hour++)
		{
		   	option = document.createElement('option');
			option.setAttribute('value',hour+':00');
			var text = document.createTextNode(hour+':00 a.m.');
			option.appendChild(text);
			select.appendChild(option);
		   	option = document.createElement('option');
			option.setAttribute('value',hour+':30');
			var text = document.createTextNode(hour+':30 a.m.');
			option.appendChild(text);
			select.appendChild(option);
		}
	}

	for (hour=8; hour<=11; hour++)
	{
	   	option = document.createElement('option');
		option.setAttribute('value',hour+':00');
		var text = document.createTextNode(hour+':00 a.m.');
		option.appendChild(text);
		select.appendChild(option);
	   	option = document.createElement('option');
		option.setAttribute('value',hour+':30');
		var text = document.createTextNode(hour+':30 a.m.');
		option.appendChild(text);
		select.appendChild(option);
	}

   	option = document.createElement('option');
	option.setAttribute('value','12:00');
	var text = document.createTextNode('NOON');
	option.appendChild(text);
	select.appendChild(option);
   	option = document.createElement('option');
	option.setAttribute('value','12:30');
	var text = document.createTextNode('12:30 p.m.');
	option.appendChild(text);
	select.appendChild(option);

	for (hour=1; hour<=5; hour++)
	{
	   	option = document.createElement('option');
		option.setAttribute('value',(hour+12)+':00');
		var text = document.createTextNode(hour+':00 p.m.');
		option.appendChild(text);
		select.appendChild(option);
	   	option = document.createElement('option');
		option.setAttribute('value',(hour+12)+':30');
		var text = document.createTextNode(hour+':30 p.m.');
		option.appendChild(text);
		select.appendChild(option);
	}

	if ($F(which+'_location') == 13)
	{
		for (hour=6; hour<=9; hour++)
		{
		   	option = document.createElement('option');
			option.setAttribute('value',(hour+12)+':00');
			var text = document.createTextNode(hour+':00 p.m.');
			option.appendChild(text);
			select.appendChild(option);
		   	option = document.createElement('option');
			option.setAttribute('value',(hour+12)+':30');
			var text = document.createTextNode(hour+':30 p.m.');
			option.appendChild(text);
			select.appendChild(option);
		}
	}

	options = select.options;
	for (var i=0; i < options.length; i++)
	{
		if (options[i].value == selected_option)
		{
			options[i].setAttribute('selected', true);
			break;
		}
	}

	/*
	 * Dentro de la manipulación de horarios, agregamos un requerimiento
	 * especial que es que no se puede alquilar un carro en San Pedro Sula
	 * y devolverlo en Roatán porque es necesario pasar por un ferry
	 * demasiado caro.
	 */

	select = $('dropoff_location');
	selected_option = select.options[select.selectedIndex].value;
	select.options.length = 0;

	if (($F('pickup_location') != 15) && ($F('pickup_location') != 16))
	{
		option = document.createElement('option');
		option.setAttribute('value','14');
		var text = document.createTextNode('02. San Pedro Sula Downtown');
		option.appendChild(text);
		select.appendChild(option);
		option = document.createElement('option');
		option.setAttribute('value','13');
		var text = document.createTextNode('03. San Pedro Sula Airport');
		option.appendChild(text);
		select.appendChild(option);
	}

	if (($F('pickup_location') != 13) && ($F('pickup_location') != 14))
	{
		option = document.createElement('option');
		option.setAttribute('value','15');
		var text = document.createTextNode('04. Roatán International Airport');
		option.appendChild(text);
		select.appendChild(option);
		option = document.createElement('option');
		option.setAttribute('value','16');
		var text = document.createTextNode('05. Roatán Downtown');
		option.appendChild(text);
		select.appendChild(option);
	}

	options = select.options;
	for (var i=0; i < options.length; i++)
	{
		if (options[i].value == selected_option)
		{
			options[i].setAttribute('selected', true);
			break;
		}
	}

}