function SoloNumeros(e){
	key=(document.all)?e.keyCode:e.which;
	// NOTA: Backspace=8, Tabulador=0 Enter=13, '0' = 48, '9' = 57 
	if((key!=8 && key!=0 && key!=13) && (key < 48 || key > 57)){
		return false;
	}else{
		return true;
	}
}
function SoloFechas(e){
	key=(document.all)?e.keyCode:e.which;
	// NOTA: Backspace=8, Tabulador=0 Enter=13, '/' = 47, '0' = 48, '9' = 57 
	if((key!=8 && key!=0 && key!=13) && (key < 47 || key > 57)){
		return false;
	}else{
		return true;
	}
}
function confirmar (mensaje) {
	return confirm (mensaje);
} 
function DataEntrada (dia_entrada) {
//	location.reload(true);
	parent.document.getElementById('form_reserves').entrada.value=dia_entrada;
//	document.cookie = "entrada=" + dia_entrada;
	parent.document.getElementById('cal_seleccio').style.visibility= "Hidden";
	parent.document.getElementById('cal_seleccio').style.display = "none";
}
function DataSortida (dia_sortida) {
//	location.reload(true);
	//parent.document.getElementById('form_reserves').importe.value='1000€';
	parent.document.getElementById('form_reserves').sortida.value=dia_sortida;
//	document.cookie = "sortida=" + dia_sortida;
	parent.document.getElementById('cal_seleccio').style.visibility= "Hidden";
	parent.document.getElementById('cal_seleccio').style.display = "none";
}
function CalSeleccio (calendari, mes, any){
	document.getElementById('cal_seleccio').src='/includes/' + calendari + '.php';//?m=' + mes + '&y=' + any;	
	ShowPopup('cal_seleccio');
}
function CalculImport (estat){
	document.getElementById('calcul_import').src='/includes/calcul_import.php?estat=' + estat;//?m=' + mes + '&y=' + any;	
	ShowPopup('calcul_import');
}
function SeparadorMiles(nStr)
{
    nStr += '';
    x = nStr.split('.');
    x1 = x[0];
    x2 = x.length > 1 ? '.' + x[1] : '';
    var rgx = /(\d+)(\d{3})/;
    while (rgx.test(x1)) {
        x1 = x1.replace(rgx, '$1' + '.' + '$2');
    }
    return x1 + x2;
}
function CalculImportOcult(importe){
	importe=importe.toFixed(2);
	parent.document.getElementById('form_reserves').importe.value=SeparadorMiles(importe.replace('.',',')) + ' ' + String.fromCharCode(8364);
	parent.document.getElementById('calcul_import').style.visibility= "Hidden";
	parent.document.getElementById('calcul_import').style.display = "none";
}
