/**
 * @author cesc
 */
////////////////////////////////////////////////////////////////////////////////////////////////////
function filtra_combo(id_combo, array_elementos_validos)
{
	var validos = array_elementos_validos.split("@");

	muestra_options_todos(id_combo);

	if(validos.length > 0)
	{
		$('#' + id_combo + ' option').each(function(i) {
			if ((!existe_valor(validos, $(this).val())) && ($(this).val() != 0))
			{
				$(this).hide();
			}
		});
	}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
function existe_valor(array_original, valor)
{
	if (array_original.length > 0)
	{
		for(i=0; i<= array_original.length; i++)
		{
			if (array_original[i] == valor)
			{
				return true;
			}
		}

		return false;
	}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
function muestra_options_todos(id_combo)
{
	$('#' + id_combo + ' option').each(function(i) {
		$(this).show();
	});
}
////////////////////////////////////////////////////////////////////////////////////////////////////
function redondea(numero, decimales, simbolo_coma, separador_miles)
{
	numero = parseFloat(numero).toFixed(decimales);

	numero = numero.replace(".", simbolo_coma);

	entero = parseInt(numero).toString();

	cadena = numero.substr(numero.length - 3, 3);

	for (cont = 0; cont <= entero.length; cont++)
	{
		if (cont != 1)
		{
//			alert (cadena + " / " + cont % 3);

			if (cont % 3 == 1)
			{
				cadena = separador_miles + cadena;
			}

		}
		cadena = entero.substr(entero.length - cont, 1) + cadena;
	}

	return cadena;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
function muestra_ventana(id_ventana)
{
	$("#" + id_ventana).dialog({
		bgiframe: true,
		modal: true,
		resizable: false,
		show: "blind",
		hide:"blind",
		buttons: {
			"Aceptar": function() {
				$(this).dialog('close');
			}
		}
	});

	$("#" + id_ventana).dialog('open');
}
////////////////////////////////////////////////////////////////////////////////////////////////////

function poptastic(url, height, width)
{
	var newwindow;
//	newwindow=window.open(url,'{_URL_MINISITE_HOTEL}','');
	newwindow=window.open(url, "newwindow", 'height=' + height + ',width=' + width + ',resizable=yes,scrollbars=yes,status=yes');
//	if (window.focus) {newwindow.focus()}
}


function muestra_bono(tipo)
{
	$("#tipo").val(tipo);
	document.getElementById("form_aux").submit();
}
