<!--

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function viewFullSize(imgo, objx){
 document.getElementById(objx).src= imgo;
}


//Ajax functionality

function sendHttpRequest(url, reqstr, objx){
 http_request = false; 
 if(window.XMLHttpRequest){ // Mozilla, Safari, Opera 8.0+, Firefox...
  http_request = new XMLHttpRequest();
  if(http_request.overrideMimeType) {
     // set type accordingly to anticipated content type
     // http_request.overrideMimeType('text/xml');
   http_request.overrideMimeType('text/html');
  }
 }else if(window.ActiveXObject){ // IE
  try{
   http_request = new ActiveXObject("Msxml2.XMLHTTP");
  }catch(err){
   try{
    http_request = new ActiveXObject("Microsoft.XMLHTTP");
   }catch(err){}
  }
 }
 if(!http_request) {
  alert('Cannot create XMLHTTP instance');
 }
 http_request.onreadystatechange = function(){
  if(http_request.readyState == 4){
   var ajaxDisplay = document.getElementById(objx); ajaxDisplay.innerHTML = http_request.responseText;
  }
 }
 http_request.open("POST", url, true);
 http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
 http_request.setRequestHeader("Content-length", reqstr.length);
 http_request.setRequestHeader("Connection", "close");
 http_request.send(reqstr);
}

function postAjax_RequestForm(url, fieldId, objx){
 var reqstr = ""; var fieldArr = fieldId.split(",");
 for(i=0 ; i < fieldArr.length; i++){
  reqstr += fieldArr[i] + "=" + document.getElementById(fieldArr[i]).value + "&";
 }
 sendHttpRequest(url, reqstr, objx);
}

function postAjax_RequestFormNames(fObj, url, fieldId, objx){
 var reqstr = ""; var fieldArr = fieldId.split(",");
 for(i=0 ; i < fieldArr.length; i++){
  objval = eval("document." + fObj + "." + fieldArr[i] + ".value");
  reqstr += fieldArr[i] + "=" + objval + "&";
 }
 sendHttpRequest(url, reqstr, objx);
}

function postAjax_RequestString(url, reqstr, objx){
 sendHttpRequest(url, reqstr, objx);
}

function postAjax_ClearObject(reqstr, objx){
 var ajaxDisplay = document.getElementById(objx); ajaxDisplay.innerHTML = '';
}

function showMoreDetails(url, reqstr, objx){
 mdYSrolled = document.body.scrollTop;
 document.getElementById(objx).style.display = "block";
 document.getElementById("propertylist").style.display = "none";
 postAjax_RequestString(url, reqstr, objx);
 scrollTo(0, 0);
}

function hideMoreDetails(url, reqstr, objx, hobj){
 postAjax_ClearObject(reqstr, hobj);
 document.getElementById(hobj).style.display = "none";
 document.getElementById("propertylist").style.display = "block";
 scrollTo(0, mdYSrolled);
}

function checkAddBook(Obj){
 if(Obj.addbooked.value == '00000000'){
  alert("Please select some dates form the calendar\t");
  return false;
 }else{
  return true
 }
}

function switchClass(obj, curdate){
 var curClass = document.getElementById(obj).className;
 if(curClass == "rsv"){
  classSwitch = "av";
  undoBooked(curdate);
 }else{
  classSwitch = "rsv";
  addToBooked(curdate);
 } 
 document.getElementById(obj).className = classSwitch;

}
	
function addToBooked(curdate){
 var comDate = "," + curdate;
 removeFromList(comDate);
 document.getElementById("addbooked").value = document.getElementById("addbooked").value + comDate
}
	
function undoBooked(curdate){
 var comDate = "," + curdate;
 removeFromList(comDate);
 document.getElementById("unbooked").value = document.getElementById("unbooked").value + comDate;
}

function removeFromList(comDate){
 var addValue = document.getElementById("addbooked").value.replace(comDate, '');
  document.getElementById("addbooked").value = addValue;
   var undValue = document.getElementById("unbooked").value.replace(comDate, '');
    document.getElementById("unbooked").value = undValue;
}

function submitIniForm(obj, drc){
 var iniYear  = obj.years.value;
  var iniMonth = obj.months.value;

  if(document.getElementById("addbooked").value == "00000000" && document.getElementById("unbooked").value == "00000000"){

   obj.inidate.value = iniYear + "-" + iniMonth + "-01";
    return true;

  }else{

   var aGree = confirm("You have made changes to the dates in the month displayed below.\\t\\nPlease select OK to save the changes you have made.\\t");

    if(aGree){
	
     document.iniform.inidate.value = iniYear + "-" + iniMonth + "-01";
      document.iniform.submit();
       return false;
	
    }else{
	
     obj.inidate.value = iniYear + "-" + iniMonth + "-01";
      return true;
	
    }
  }
	
}


/* PREVIEW POPUPS */


var offsetfrommouse=[15,25];
var defaultimagewidth = 260;
var defaultimageheight = 440;
var whichWindow;
var lastWindow = null;
var popInWay = false

function showPreviewWindow(windowItem){
  whichWindow = windowItem;
 var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth - offsetfrommouse[0];
  var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight);

 if((navigator.userAgent.indexOf("Konqueror") == -1  || navigator.userAgent.indexOf("Firefox") != -1 || (navigator.userAgent.indexOf("Opera") == -1 && navigator.appVersion.indexOf("MSIE") != -1)) && (docwidth>650 && docheight>500)){
  if(popInWay == false){
   if(lastWindow != null){
    document.getElementById(lastWindow).style.display = 'none';
   }
   document.onmousemove = followmouse; 
   setTimeout("document.getElementById(whichWindow).style.display = 'block'", 200);
   lastWindow = whichWindow;
  }
 }
}

function hidePreviewWindow(closeWindow){
 if(popInWay == false){
  document.getElementById(closeWindow).style.display = 'none';
  document.onmousemove = "";
  gettrailobj().top  = "-500px";
 }
}

function gettrailobj(){
 if (document.getElementById){
  return document.getElementById(whichWindow).style
 }
}

function truebody(){
 return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function followmouse(e){
 var xcoord=offsetfrommouse[0];
  var ycoord=offsetfrommouse[1];
   var docwidth=document.all? truebody().scrollLeft + truebody().clientWidth : pageXOffset + window.innerWidth - 15;
    var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight);

 if(typeof e != "undefined"){
  if (docwidth - e.pageX < defaultimagewidth + 2*offsetfrommouse[0]){
   xcoord = e.pageX - xcoord - defaultimagewidth; // Move to the left side of the cursor
  }else{
   xcoord += e.pageX;
  }
  if (docheight - e.pageY < defaultimageheight + 2*offsetfrommouse[1]){
   ycoord += e.pageY - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + e.pageY - docheight - truebody().scrollTop));
  }else{
   ycoord += e.pageY;
  }
 }else if(typeof window.event != "undefined"){

  if (docwidth - event.clientX < defaultimagewidth + 2*offsetfrommouse[0]){
   xcoord = event.clientX + truebody().scrollLeft - xcoord - defaultimagewidth; // Move to the left side of the cursor
  }else{
   xcoord += truebody().scrollLeft+event.clientX
  }
  if (docheight - event.clientY < (defaultimageheight + 2*offsetfrommouse[1])){
   ycoord += event.clientY + truebody().scrollTop - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + event.clientY - docheight));
  } else {
   ycoord += truebody().scrollTop + event.clientY;
  }

 }
 gettrailobj().left = xcoord + "px";
 gettrailobj().top  = ycoord + "px";
}


//-->