var rpc;
var ua=navigator.userAgent.toLowerCase();
var gecko=false;
if (ua.indexOf("gecko")>0) gecko=true;
if (gecko) {
  rpc=new XMLHttpRequest();
} else {
  rpc=new ActiveXObject("Microsoft.XMLDOM");
  rpc.async="false";
}
function rpcget(url) {
  if (gecko) {
    rpc.open("GET",url,false);
    rpc.send(null);
    return rpc.responseXML.documentElement;
  } else {
    rpc.load(url);
    return rpc.documentElement;
  }
}
function getText(node) {
  if (gecko) return node.textContent; else return node.text;
}
function mail(hotelid) {
  var email=prompt("Enter the E-Mail address to send this destination to:","");
  if (!email||email.length<1||email.indexOf("@")<1) return;
  rpcget("/corelist?service=sendmail&hotelid="+hotelid+"&email="+email);
  alert("Your E-Mail was sent!");
}
function map(hotelid) {
  var map=window.open("/corelist?service=googlemap&hotelid="+hotelid,"Map","width=750,height=550,resizable=yes");
}
function fpsearch() {
  var n=document.getElementById("n");
  if (n.value=="(any name)") n.value="";
  var form=document.getElementById("searchform");
  form.submit();
}
function inithtmlelements() {
  var menu=document.getElementById("menu");
  if (menu) {  
    var p=menu.getElementsByTagName("p");
    for (var i=0; i<p.length; i++) {
      p[i].onmouseover=function() { this.style.backgroundPosition="right"; }
      p[i].onmouseout=function() { this.style.backgroundPosition="left"; }  
      p[i].onmouseup=function() { this.style.backgroundPosition="left"; } 
    }
  }  
  var search=document.getElementById("searchbtn");
  if (search) {
    search.onmouseover=function() { this.style.backgroundPosition="right"; }
    search.onmouseout=function() { this.style.backgroundPosition="left"; }
    search.onmouseup=function() { this.style.backgroundPosition="left"; }
  }
  var p=document.getElementsByTagName("p");
  for (var i=0; i<p.length; i++) {
    if (p[i].className=="link") {
      p[i].onmouseover=function() { this.style.color="#000000"; }
      p[i].onmouseout=function() { this.style.color="#856c22"; }
    }
  }
}  
function init() {
  inithtmlelements();
}
