﻿// JScript File

addEvent(window, "load", pageLoad);

var oDiv = null;                           
var sOrigCursor = null;                 
var dragOK = false;                    
var dragXoffset = 0;                  
var dragYoffset = 0;
   
function pageLoad()
{
   oDiv = getObj("filterDiv");
   oDiv.style.display = "none";
 }  

function showFilter(oLink)
{
    var p = findPos(oLink);
   
   oDiv.style.left = Number(p[0]) - 15 + "px";
   oDiv.style.top = p[1] + oLink.offsetHeight +  "px";
   oDiv.style.display = "";
   return false; 
}

function setPosition(oToSet, startFromTag, includeOffsetHeight)
{
    oToSet.style.left = mouse.X + "px";
    oToSet.style.top = mouse.Y + "px"; 

    oToSet.style.left = startFromTag.offsetLeft + mouse.X + "px";
    if(includeOffsetHeight === true)
	    oToSet.style.top = mouse.Y + startFromTag.offsetHeight + 2 + "px";
	else
	    oToSet.style.top = mouse.Y  + 2 + "px"; 
}


function hideFilters()
{
   hide(oDiv);
   return;
}

function showBookingTip(bookingId)
{
    loadTipHtml(ems_PauseToLoadMsg, null, "", "2px solid black");
    currentTip = window.setTimeout("getBookingTip(" + bookingId + ")", 1000);
}

//define our object with defaults that could
//be hidden based on settings
var emsData = {
    "AreaId" : "-1",
   "FacilityId" : "-1",
   "GroupTypeId" : "-1",
   "GroupName" : "",
   "movingMultiplier" : "0"
};


function getBookingTip(bookingId)
{
   emsData.bookingId = bookingId;
   makeCallback("bookingTip"); 
}

function applyFilter()
{
    hideTip();
    clearTimer();
    resetPaging();
    setEmsData();
    emsData.movingMultiplier = "0";
    makeCallback("tabPressed"); 
    hideFilters();
    return false;
}

function loadRooms()
{
   setEmsData();
   makeCallback("loadRooms"); 
}

function loadBuildings() {

    setEmsData();
    makeCallback("loadBuildings"); 
}

