function posicao(iden,menu){
contentorid=document.getElementById(iden)
contentorid2=document.getElementById(iden)

curtopo = -100;
if (contentorid.offsetParent){
while(contentorid.offsetParent){
curtopo += contentorid.offsetTop
contentorid = contentorid.offsetParent;
}
curtopo=curtopo
}

curesq = +30;
if (contentorid2.offsetParent){
while(contentorid2.offsetParent){
curesq += contentorid2.offsetLeft
contentorid2 = contentorid2.offsetParent;
}
curesq=curesq
}

document.getElementById(menu).style.top=curtopo+"px";
document.getElementById(menu).style.left=curesq+"px";
document.getElementById(menu).style.display='';
}

function desposicao(iden,menu){
document.getElementById(menu).style.display='none';
}


function ajaxInit() {
var req;
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch(ex) {
try {
req = new XMLHttpRequest();
} catch(exc) {
alert("Esse browser não tem recursos para uso do Ajax");
req = null;
}
}
}

return req;
}

function enviadados(){
document.getElementById("botaoaccao").value = "Aguarde por favor";
var formulario = document.getElementById("formreservas"); 
var tamanho = formulario.elements.length; 
var conteudoformulario = "" 
var sepcampos 
sepcampos = "" 
for (var i=0; i <= formulario.elements.length-1;i++) { 
conteudoformulario += sepcampos+formulario.elements[i].name+'='+(formulario.elements[i].value); 
sepcampos="&"; 
} 
ajax = ajaxInit(); 
ajax.open("post", "ajaxreservas.asp", true);
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajax.onreadystatechange=function() {
if(ajax.readyState==4){
novaarr=ajax.responseText.split(";");
if(novaarr[0]=="0"){
document.getElementById("botaoaccao").value = "Enviar";
alert(novaarr[1].replace(/<br>/gi,"\n"));
}
else{
document.getElementById("botaoaccao").value = "Enviar";
alert(ajax.responseText);
window.location.href='index.asp';
}
}
}
urlid=encodeURI(conteudoformulario)
ajax.send(urlid);
}

function testar(par){
if(par=='alm'){
document.getElementById("op1").value='Almoço';
document.getElementById("op2").value='';
document.getElementById("op3").value='';
}
else if(par=='jan'){
document.getElementById("op1").value='';
document.getElementById("op2").value='Jantar';
document.getElementById("op3").value='';
}
else if(par=='dor'){
document.getElementById("op1").value='';
document.getElementById("op2").value='';
document.getElementById("op3").value='Dormida';
}
}
