<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
function keepFocus() {
  window.focus();
}
function validaFormPesquisa(form_obj) {
  var val = false;
  if(Number(form_obj.modo.value) == 1) { // hoteis
    form_obj.action = "res_h.asp";
	val = true;
  }
  else if(Number(form_obj.modo.value) == 2) { //programas
    form_obj.action = "res_p.asp";
	val = true;
  }
  if(val && String(form_obj.zona.value) != "0")
    return true;

  alert("Seleccione por favor 'Hoteis' ou 'Programas' e uma zona de destino.");
  return false;
}

function SS_FormatDataUS(formData) {
	var data = formData.value;
	var dia, mes, ano, res;
  
  aux = data.substr(2,1);   //verificar de "-", ou "." ou "/" estão na posição 2 da string
  if (aux =="-" || aux =="." || aux=="/") // a data está no formato DD-MM-AAAA
  {
  	dia = data.substr(0,2);
  	mes = data.substr(3,2);
  	ano = data.substr(6,4);
  	res = mes + "/" + dia + "/" + ano;
  }
  else
  { aux = data.substr(4,1);   //verificar de "-", ou "." ou "/" estão na posição 4 da string
  	if (aux =="-" || aux =="." || aux=="/")  // a data está no formato AAAA-MM-DD
	{
		ano = data.substr(0,4);
  		mes = data.substr(5,2);
  		dia = data.substr(8,2);
  		res = mes + "/" + dia + "/" + ano;	
	}
  }
  formData.value = res;
  return(true);
}
function ConfRemocao_JS(PagRemover)
{
	var msg="Confirma a remoção?"
	
	if (confirm(msg))
		location.href = PagRemover;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_setTextOfTextfield(objName,x,newText) { //v3.0
  var obj = MM_findObj(objName); if (obj) { if(obj.value==x) obj.value = newText };
}

