var popUp; 

function OpenCalendar(idname, postBack, rangerAnterior, rangerPosterior)
{
    popUp = window.open('../reservas/Calendar.aspx?formname=' + document.forms[0].name + '&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack + '&yearBefore=' + rangerAnterior + '&yearAfter=' + rangerPosterior,'popupcal','width=200,height=203,left=200,top=250');
}

function SetDate(formName, id, newDate, postBack)
{
	eval('var theform = document.' + formName + ';');
	popUp.close();
	theform.elements[id].value = newDate;
	if (postBack)
		__doPostBack(id,'');
}
function apenasnumericos(event) 
{	
	/*
	if(document.all) {
	
	var tecla = event.keyCode;
	
	}
	
	else {
		if(document.layers) {
		var tecla = caracter.which;
			}
	}
	*/
	
	var tecla = window.event ? event.keyCode : event.which;
	
		if(tecla > 47 && tecla < 58) {
			return true;
		}
		else {
			if (tecla != 8) {
				return false;
				}
			else {
				return true;
				}
			}
}
function apenasnumericos_data(event) 
{
	/*
	if(document.all) {
	var tecla = event.keyCode;
	}
	else {
		if(document.layers) {
		var tecla = caracter.which;
			}
	}
	*/
	var tecla = window.event ? event.keyCode : event.which;
		if(tecla > 46 && tecla < 59) { 
			return true;
		}
		else {
			if (tecla != 8) {
				return false;
				}
			else {
				return true;
				}
			}
}
function OpenCodSeguranca(idname, postBack){popUp = window.open('../reservas/codigo_seguranca.aspx?formname=' + document.forms[0].name + '&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack,'popupCodSeg','width=520,height=445,left=30,top=30');}
function OpenDicaSenha(){popUp = window.open('dica_senha.aspx','senha','scrollbars=yes,width=450,height=380,left=200,top=212');}
function OpenDicaSenha2(){popUp = window.open('Cadastro/dica_senha.aspx','senha','scrollbars=yes,width=450,height=380,left=200,top=212');}
function OpenDicaSenha3(){popUp = window.open('../Site-seguro/Cadastro/dica_senha.aspx','senha','scrollbars=yes,width=450,height=380,left=200,top=212');}
function popUp(url){sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1, scrollbars=1 ,resizable=1,width=500,height=450');self.name = "mainWin"; }
function OpenFNRH(){popUp = window.open('../reservas/FNRH.aspx','FNRH','scrollbars=no,resizable=no,width=2,height=2,left=0,top=0');}

function OpenReserva(url){
    window.open(url + '?FNRH=1', 'Confirmacao', 'scrollbars=no,resizable=no,width=2,height=2,left=0,top=0');
}
function OpenCancelamentoReserva(url){
    window.open(url, 'Cancelamento', 'scrollbars=no,resizable=no,width=2,height=2,left=0,top=0');
}
function OpenPopupSiteSeguro() { window.open('../popupSiteSeguro.aspx', 'popupSiteSeguro', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=556,height=500,left=0,top=0'); }

function FormataDigitos(fld, e) {
    var sep = 0;
    var key = '';
    var i = j = 0;
    var len = len2 = 0;
    var strCheck = '0123456789';
    var whichCode = (window.Event) ? e.which : e.keyCode;
    if (whichCode == 13) return true;
    key = String.fromCharCode(whichCode);
    if (strCheck.indexOf(key) == -1) return false;
    len = fld.value.length;
}
