function FfmGlobals()
{
this.currentZoomLevel = 1; 
this.currentScale = 1;
this.currentMaxRow = 0;
this.currentMaxColumn = 0;
this.MAX_ZOOM_LEVEL;

this.setCurrentZoomLevel = setCurrentZoomLevel;
function setCurrentZoomLevel(zoomLevel)
{
this.currentZoomLevel = zoomLevel;
this.setCurrentScale();
this.setCurrentMaxRow();
this.setCurrentMaxColumn();
}

this.setMAX_ZOOM_LEVEL = setMAX_ZOOM_LEVEL;
function setMAX_ZOOM_LEVEL()
{
var maxLevelWidth = Math.ceil(Math.log(ffmConfig.MAP_WIDTH/ffmConfig.ZOOM_MIN_WIDTH)/Math.log(ffmConfig.ZOOM_FACTOR)) + 1;
var maxLevelHeight = Math.ceil(Math.log(ffmConfig.MAP_HEIGHT/ffmConfig.ZOOM_MIN_HEIGHT)/Math.log(ffmConfig.ZOOM_FACTOR)) + 1;
this.MAX_ZOOM_LEVEL = Math.max(maxLevelWidth, maxLevelHeight);
}
this.setMAX_ZOOM_LEVEL();

this.setCurrentScale = setCurrentScale;
function setCurrentScale()
{
this.currentScale = 1/Math.pow(ffmConfig.ZOOM_FACTOR, this.currentZoomLevel - 1);
}

this.setCurrentMaxRow = setCurrentMaxRow;
function setCurrentMaxRow() {
this.currentMaxRow = Math.ceil(ffmConfig.MAP_HEIGHT*this.currentScale/ffmConfig.TILE_HEIGHT) - 1;
}
this.setCurrentMaxRow();

this.setCurrentMaxColumn = setCurrentMaxColumn;
function setCurrentMaxColumn() {
this.currentMaxColumn = Math.ceil(ffmConfig.MAP_WIDTH*this.currentScale/ffmConfig.TILE_WIDTH) - 1;
}
this.setCurrentMaxColumn();
}
var ffmGlobals = new FfmGlobals();
function FfmView(bufferSize)
{
this.startRow = 0;
this.startColumn = 0;
this.endRow = 0;
this.endColumn = 0;
this.bufferSize = bufferSize;
this.width = 0;
this.height = 0;
this.offsetX = 0; 
this.offsetY = 0; 

this.isOnScreen = isOnScreen;
function isOnScreen(tile)
{
if (tile.row >= this.startRow 
    && tile.row <= this.endRow 
    && tile.column >= this.startColumn 
    && tile.column <= this.endColumn) {
return true;
}
return false;
}

this.isOnScreenOrInBuffer = isOnScreenOrInBuffer;
function isOnScreenOrInBuffer(tile)
{
if (tile.row >= this.startRow - this.bufferSize && tile.row >= 0
    && tile.row <= this.endRow + this.bufferSize
    && tile.column >= this.startColumn - this.bufferSize
    && tile.column <= this.endColumn + this.bufferSize && tile.column >= 0) {
return true;
}
return false;
}

this.setOffset = setOffset;
function setOffset(newOffsetX, newOffsetY)
{
this.offsetX = newOffsetX;
this.offsetY = newOffsetY;
}

this.setViewArea = setViewArea;
function setViewArea(startRow, startColumn, endRow, endColumn)
{
this.startRow = startRow;
this.startColumn = startColumn;
this.endRow = endRow;
this.endColumn = endColumn;
}

this.getViewAreaByOffset = getViewAreaByOffset;
function getViewAreaByOffset()
{
var view = this.clone();

view.startRow = Math.floor(this.offsetY/ffmConfig.TILE_HEIGHT);
view.startColumn = Math.floor(this.offsetX/ffmConfig.TILE_WIDTH);
view.endRow = view.startRow + Math.ceil(this.height/ffmConfig.TILE_HEIGHT);
view.endColumn = view.startColumn + Math.ceil(this.width/ffmConfig.TILE_WIDTH);

return view;
}

this.setViewAreaByOffset = setViewAreaByOffset;
function setViewAreaByOffset()
{
var newArea = this.getViewAreaByOffset();
if (!this.isViewAreaEqual(newArea)) {
this.setViewArea(newArea.startRow, newArea.startColumn, newArea.endRow, newArea.endColumn);
return true;
}
return false;
}

this.isViewAreaEqual = isViewAreaEqual;
function isViewAreaEqual(view)
{

if (view.startRow != this.startRow 
    || view.endRow != this.endRow 
    || view.startColumn != this.startColumn 
    || view.endColumn != this.endColumn) {
return false;
}
return true;
}

this.resize = resize;
function resize(width, height)
{
this.width = width;
this.height = height;
}

this.clone = clone;
function clone()
{
var view = new FfmView();

view.startRow = this.startRow;
view.startColumn = this.startColumn;
view.endRow = this.endRow;
view.endColumn = this.endColumn;
view.bufferSize = this.bufferSize;
view.width = this.width;
view.height = this.height;
view.offsetX = this.offsetX;
view.offsetY = this.offsetY;

return view;
}

this.getBufferStartRow = getBufferStartRow;
function getBufferStartRow()
{
return this.startRow - this.bufferSize;
}

this.getBufferStartColumn = getBufferStartColumn;
function getBufferStartColumn()
{
return this.startColumn - this.bufferSize;
}

this.getBufferEndRow = getBufferEndRow;
function getBufferEndRow()
{
return this.endRow + this.bufferSize;
}

this.getBufferEndColumn = getBufferEndColumn;
function getBufferEndColumn()
{
return this.endColumn + this.bufferSize;
}

this.getBufferRows = getBufferRows;
function getBufferRows()
{
return this.getBufferEndRow() - this.getBufferStartRow() + 1;
}

this.getBufferColumns = getBufferColumns;
function getBufferColumns()
{
return this.getBufferEndColumn() - this.getBufferStartColumn() + 1;
}

this.getViewRows = getViewRows;
function getViewRows()
{
return this.endRow - this.startRow + 1;
}

this.getViewColumns = getViewColumns;
function getViewColumns()
{
return this.endColumn - this.startColumn + 1;
}

this.getScaledMaxOffsetX = getScaledMaxOffsetX;
function getScaledMaxOffsetX()
{
var maxOffsetX = Math.round(ffmGlobals.currentScale * ffmConfig.MAP_WIDTH) - this.width;
if (maxOffsetX < 0) {
return 0;
}
return maxOffsetX;
}

this.getScaledMaxOffsetY = getScaledMaxOffsetY;
function getScaledMaxOffsetY()
{
var maxOffsetY = Math.round(ffmGlobals.currentScale * ffmConfig.MAP_HEIGHT) - this.height;
if (maxOffsetY < 0) {
return 0;
}
return maxOffsetY;
}

this.toString = toString;
function toString()
{
return 'startRow = ' + this.startRow + ', startColumn = ' + this.startColumn + ', endRow = ' + this.endRow + ', endColumn = ' + this.endColumn + ', bufferSize = ' + this.bufferSize;
}

this.getCenterAbsolute = getCenterAbsolute;
function getCenterAbsolute()
{
var cx = Math.round((this.offsetX + this.width/2)/ffmGlobals.currentScale);
var cy = Math.round((this.offsetY + this.height/2)/ffmGlobals.currentScale);
return new FfmPosition(cx, cy);
}
}



function FfmViewer(bufferSize)
{
this.view = new FfmView(bufferSize);
this.lastMousePosition;
this.onMouseMove = null;

this.translateGridToView = translateGridToView;
function translateGridToView()
{
var grid = this.getGridElement();
grid.style.left = (-1 * this.view.offsetX) + 'px';
grid.style.top = (-1 * this.view.offsetY) + 'px';
grid.style.width = (this.view.offsetX + this.view.width) + 'px';
grid.style.height = (this.view.offsetY + this.view.height) + 'px';
}

this.mouseInNavigation = mouseInNavigation;
function mouseInNavigation(e, mousePosition)
{
if (ffmh.mouseInElement(e, document.getElementById('ffmPanLeftId'), mousePosition)
    || ffmh.mouseInElement(e, document.getElementById('ffmPanUpId'), mousePosition)
    || ffmh.mouseInElement(e, document.getElementById('ffmPanRightId'), mousePosition)
    || ffmh.mouseInElement(e, document.getElementById('ffmPanDownId'), mousePosition)
    || ffmh.mouseInElement(e, document.getElementById('ffmZoomInId'), mousePosition)
    || ffmh.mouseInElement(e, document.getElementById('ffmZoomOutId'), mousePosition)) {
return true;
}
return false;
}

this.display = display;
function display()
{
var html = '';
html += '<div class="ffmViewer" id="ffmViewerId" ' + ffmh.DISABLE_JAVASCRIPT_MOUSE_EVENTS_HTML + '><div class="ffmGrid" id="ffmGridId" ' + ffmh.DISABLE_JAVASCRIPT_MOUSE_EVENTS_HTML + '></div>';
html += '<img id="ffmPanLeftId" class="ffmPanLeft" alt="Pan Left" src="images/panLeftIcon.png" onclick="ffmViewer.pan(-ffmConfig.PAN_SIZE, 0);" ' + ffmh.DISABLE_JAVASCRIPT_MOUSE_EVENTS_EXCEPT_CLICK_HTML + ' />';
html += '<img id="ffmPanUpId" class="ffmPanUp" alt="Pan Up" src="images/panUpIcon.png" onclick="ffmViewer.pan(0, -ffmConfig.PAN_SIZE);" ' + ffmh.DISABLE_JAVASCRIPT_MOUSE_EVENTS_EXCEPT_CLICK_HTML + ' />';
html += '<img id="ffmPanRightId" class="ffmPanRight" alt="Pan Right" src="images/panRightIcon.png" onclick="ffmViewer.pan(ffmConfig.PAN_SIZE, 0);" ' + ffmh.DISABLE_JAVASCRIPT_MOUSE_EVENTS_EXCEPT_CLICK_HTML + ' />';
html += '<img id="ffmPanDownId" class="ffmPanDown" alt="Pan Down" src="images/panDownIcon.png" onclick="ffmViewer.pan(0, ffmConfig.PAN_SIZE);" ' + ffmh.DISABLE_JAVASCRIPT_MOUSE_EVENTS_EXCEPT_CLICK_HTML + ' />';
html += '<img id="ffmZoomInId" class="ffmZoomIn" alt="Zoom In" src="images/zoomInIcon.png" onclick="ffmViewer.zoom(true, true);boothHelper.showLastBoothDetails();" ' + ffmh.DISABLE_JAVASCRIPT_MOUSE_EVENTS_EXCEPT_CLICK_HTML + ' />';
html += '<img id="ffmZoomOutId" class="ffmZoomOut" alt="Zoom Out" src="images/zoomOutIcon.png" onclick="ffmViewer.zoom(false, true);boothHelper.showLastBoothDetails();" ' + ffmh.DISABLE_JAVASCRIPT_MOUSE_EVENTS_EXCEPT_CLICK_HTML + ' />';


html += '<div class="ffmPoweredBy" id="ffmPoweredBy" onclick="window.location.href=\'http://www.goexposoftware.com\'">Powered by GoExpo. &copy;2009 GoExpo, LLC.</div>';
html += '</div>';
html += ffmViewFinder.getHtml();
document.write(html);
var viewer = ffmViewer.getViewerElement();
if (ffmConfig.SHOW_LOG) {
ffml.display(830, 0, ffmConfig.LOG_WINDOW_WIDTH, 500);
}
}

this.getGridElement = getGridElement;
function getGridElement()
{
return document.getElementById('ffmGridId');
}

this.getViewerElement = getViewerElement;
function getViewerElement()
{
return document.getElementById('ffmViewerId');
}

this.isMouseInViewer = isMouseInViewer;
function isMouseInViewer(e, mousePosition)
{
return ffmh.mouseInElement(e, this.getViewerElement(), mousePosition);
}


this.pan = pan;
function pan(dx, dy)
{
if (dx == 0 && dy == 0)
return;

var newOffsetX = this.view.offsetX + dx;
var newOffsetY = this.view.offsetY + dy;
this.panTopLeftTo(newOffsetX, newOffsetY);
}


this.panTopLeftTo = panTopLeftTo;
function panTopLeftTo(newOffsetX, newOffsetY, forceRefresh)
{

if (newOffsetX < 0) {
newOffsetX = 0;
} else if (newOffsetX > this.view.getScaledMaxOffsetX()) {
newOffsetX = this.view.getScaledMaxOffsetX();
}

if (newOffsetY < 0) {
newOffsetY = 0;
} else if (newOffsetY > this.view.getScaledMaxOffsetY()) {
newOffsetY = this.view.getScaledMaxOffsetY();
}

if (forceRefresh || newOffsetX != this.view.offsetX || newOffsetY != this.view.offsetY) {
this.view.setOffset(newOffsetX, newOffsetY);
this.translateGridToView();
ffmTileManagerThread.run(forceRefresh);
ffmViewFinder.updateSelectionPosition();
}
}


this.panCenterTo = panCenterTo;
function panCenterTo(x, y, forceRefresh)
{
var left = x - Math.round(this.view.width/2);
var top = y - Math.round(this.view.height/2);
this.panTopLeftTo(left, top, forceRefresh);
}


this.panCenterToAbsolute = panCenterToAbsolute;
function panCenterToAbsolute(x, y, forceRefresh)
{
var sx = Math.round(x * ffmGlobals.currentScale);
var sy = Math.round(y * ffmGlobals.currentScale);
this.panCenterTo(sx, sy, forceRefresh);
}

this.resize = resize;
function resize(left, top, width, height)
{
if (ffmConfig.SHOW_LOG) {
width -= ffmConfig.LOG_WINDOW_MARGIN_LEFT + ffmConfig.LOG_WINDOW_WIDTH;
var logger = ffml.getLogger();
logger.style.left = left + width + ffmConfig.LOG_WINDOW_MARGIN_LEFT + 'px';
logger.style.top = top  + 'px';
logger.style.height = height + 'px';
}

var viewer = this.getViewerElement();
viewer.style.left = left + 'px';
viewer.style.top = top + 'px';
viewer.style.width = width + 'px';
viewer.style.height = height + 'px';

var grid = this.getGridElement();
grid.style.width = (this.view.offsetX + width) + 'px';
grid.style.height = (this.view.offsetY + height) + 'px';

this.view.resize(width, height);
ffmTileManager.resize();

ffmViewFinder.updateViewFinderPosition();
ffmViewFinder.updateSelectionSize();

var poweredBy = document.getElementById('ffmPoweredBy');
poweredBy.style.top = (height - poweredBy.offsetHeight) + 'px';
}

this.zoomToLevel = zoomToLevel;
function zoomToLevel(newZoomLevel, forceRefresh, hideZoomAnimation)
{
if (newZoomLevel < 1) {
newZoomLevel = 1;
} else if (newZoomLevel > ffmGlobals.MAX_ZOOM_LEVEL) {
newZoomLevel = ffmGlobals.MAX_ZOOM_LEVEL;
}


if (newZoomLevel != ffmGlobals.currentZoomLevel || forceRefresh) {

var zoomIn = true;
if (newZoomLevel > ffmGlobals.currentZoomLevel) {
zoomIn = false;
}

if (this.lastMousePosition != null && this.isMouseInViewer(null, ffmViewer.lastMousePosition)) {
var mrx = this.lastMousePosition.x - ffmh.getAbsoluteX(this.getViewerElement());
var mry = this.lastMousePosition.y - ffmh.getAbsoluteY(this.getViewerElement());
var max = (mrx + this.view.offsetX)/ffmGlobals.currentScale;
var may = (mry + this.view.offsetY)/ffmGlobals.currentScale;


if (!hideZoomAnimation) {
ffmZoomAnimation.showAnimation(zoomIn, mrx, mry);
}
} else {

var center = this.view.getCenterAbsolute();
if (!hideZoomAnimation) {
ffmZoomAnimation.showAnimation(zoomIn, this.view.width/2, this.view.height/2);
}
}

ffmGlobals.setCurrentZoomLevel(newZoomLevel);

ffmTileManagerThread.scheduleReset();


if (this.lastMousePosition != null && this.isMouseInViewer(null, ffmViewer.lastMousePosition)) {

var dx = (mrx - this.view.width/2)/ffmGlobals.currentScale;
var dy = (mry - this.view.height/2)/ffmGlobals.currentScale;

this.panCenterToAbsolute(max - dx, may - dy, true);


} else {
this.panCenterToAbsolute(center.x, center.y, true);
}

ffmViewFinder.updateSelectionSize();


if (ffmConfig.CAN_EDIT)
boothHelper.resizeBooths();
searcher.repositionMarkers();
boothHelper.resizeSelectedBoothMarker();
}
}

this.refresh = refresh;
function refresh()
{


this.zoomToLevel(ffmGlobals.currentZoomLevel, true, true);
}

this.zoom = zoom;
function zoom(zoomIn, fromViewCenter, hideZoomAnimation)
{
if (fromViewCenter)
this.lastMousePosition = null;
if (zoomIn) {
this.zoomToLevel(ffmGlobals.currentZoomLevel - 1, false, hideZoomAnimation);
} else {
this.zoomToLevel(ffmGlobals.currentZoomLevel + 1, false, hideZoomAnimation);
}
}

this.zoomInFull = zoomInFull;
function zoomInFull(hideZoomAnimation)
{
this.zoomToLevel(1, false, hideZoomAnimation);
}


this.processMouseMove = processMouseMove;
function processMouseMove(e)
{
ffmViewer.lastMousePosition = ffmh.getMousePosition(e);






if (ffmViewer.onMouseMove != null) {
ffmViewer.onMouseMove(e);
}
}

this.setBackgroundImage = setBackgroundImage;
function setBackgroundImage(src)
{
var elmnt = this.getViewerElement();
if (elmnt) {
elmnt.style.backgroundImage = 'url(\'' + src + '\')';
}
}
}
var ffmViewer = new FfmViewer(ffmConfig.BUFFER_SIZE);



function FfmZoomAnimation()
{
this.WIDTH = 100;
this.HEIGHT = 75;
this.ZOOM_IN_IMG = 'images/zoomIn.gif';
this.ZOOM_OUT_IMG = 'images/zoomOut.gif';

this.getHtmlId = getHtmlId;
function getHtmlId()
{
return 'ffmZoomAnimationId';
}

this.createZoomAnimationElement = createZoomAnimationElement;
function createZoomAnimationElement()
{
var img = document.createElement('img');
img.id = this.getHtmlId();
img.className = 'ffmZoomAnimation';
img.src = 'images/blank.gif';

img.style.width = this.WIDTH + 'px';
img.style.height = this.HEIGHT + 'px';


img.onmousemove = FfmDisableEvent;
img.onclick = FfmDisableEvent;
img.onmousedown = FfmDisableEvent;
img.onmouseup = FfmDisableEvent;
img.onmouseover = FfmDisableEvent;
img.onmouseout = FfmDisableEvent;

return img;
}

this.getZoomAnimationElement = getZoomAnimationElement;
function getZoomAnimationElement()
{
var animation = document.getElementById(this.getHtmlId());
if (!animation) {
animation = this.createZoomAnimationElement();
ffmViewer.getViewerElement().appendChild(animation);
}
return animation;
}

this.clearAnimation = clearAnimation;
function clearAnimation()
{
var animation = this.getZoomAnimationElement();
animation.src = 'images/blank.gif';
}

this.showAnimation = showAnimation;
function showAnimation(zoomIn, x, y)
{
var animation = this.getZoomAnimationElement();
animation.style.left = (x - this.WIDTH/2) + 'px';
animation.style.top = (y - this.HEIGHT/2) + 'px';

animation.src = (zoomIn ? this.ZOOM_IN_IMG : this.ZOOM_OUT_IMG);


setTimeout('ffmZoomAnimation.clearAnimation();', 5000); 
}
}
var ffmZoomAnimation = new FfmZoomAnimation();



function FfmViewerMouseDragger()
{
this.lastMousePosition;
this.isDragging = false;
this.timestamp = new Date();

this.startDragIfNeeded = startDragIfNeeded;
function startDragIfNeeded(e)
{
var position = ffmh.getMousePosition(e);
var elmnt = ffmViewer.getViewerElement();


if (!ffmh.mouseInElement(e, elmnt, position)) {
return;
}

this.lastMousePosition = position;
this.isDragging = true;
elmnt.style.cursor = "move";

ffmViewer.onMouseMove = FfmViewerMouseDraggerMove; 
}

this.processDrag = processDrag;
function processDrag(e)
{
if ((new Date()).getTime() - this.timestamp.getTime() < ffmConfig.VIEW_MOUSE_DRAG_DISCARD_MS)
return;
this.timestamp = new Date();
var position = ffmh.getMousePosition(e);
var elmnt = ffmViewer.getViewerElement();

var dx = this.lastMousePosition.x - position.x;
var dy = this.lastMousePosition.y - position.y;
ffmViewer.pan(dx, dy);

this.lastMousePosition = position;
}

this.stopDragIfNeeded = stopDragIfNeeded;
function stopDragIfNeeded(e)
{
if (!this.isDragging)
return;

ffmViewer.getViewerElement().style.cursor = "crosshair";

ffmViewer.onMouseMove = null;
this.isDragging = false;
}
}
var ffmViewerMouseDragger = new FfmViewerMouseDragger();

function FfmViewerMouseDraggerMove(e)
{
ffmViewerMouseDragger.processDrag(e);
}


function FfHelper() { }

FfHelper.htmlId = 1;
FfHelper.alertLimitCount = 0;

FfHelper.getNextHtmlId = function()
{
return this.htmlId++;
}

FfHelper.disableEvent = function()
{
return false;
}

FfHelper.disableEvents = function(element)
{
element.onmousemove = FfHelper.disableEvent;
element.onmousedown = FfHelper.disableEvent;
element.onmouseup = FfHelper.disableEvent;
element.ondblclick = FfHelper.disableEvent;
element.onfocus = FfHelper.disableEvent;
element.onblur = FfHelper.disableEvent;
element.onmouseover = FfHelper.disableEvent;
element.onmouseout = FfHelper.disableEvent;
element.onclick = FfHelper.disableEvent;
}

FfHelper.getKeyCode = function(e)
{
if (!e) var e = window.event;
return e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
}

FfHelper.keyPressed = function(e, keyCode)
{
var kc = FfHelper.getKeyCode(e);
if (kc == keyCode)
return true;
return false;
}

FfHelper.setFirstChild = function(element, child)
{
var firstChild = element.firstChild;
if (firstChild) {
element.replaceChild(child, firstChild);
} else {
element.appendChild(child);
}
}

FfHelper.createCookie = function(name, value, seconds)
{
var expires = "";
if (seconds) {
var date = new Date();
date.setTime(date.getTime() + seconds);
expires = "; expires=" + date.toGMTString();
}
document.cookie = name + "=" + value + expires + "; path=/";
}

FfHelper.readCookie = function(name)
{
var nameEq = name + "=";
var pairs = document.cookie.split(';');
for (var i = 0; i < pairs.length; i++) {
var c = pairs[i];
while (c.charAt(0) == ' ')
c = c.substring(1, c.length); 
if (c.indexOf(nameEq) == 0)
return c.substring(nameEq.length, c.length);
}
return null;
}

FfHelper.deleteCookie = function(name)
{
createCookie(name, "", -1);
}

FfHelper.limitedAlert = function(str)
{
if (FfHelper.alertLimitCount++ < 3)
alert(str);
}



function GeExpiredTiles() { }

GeExpiredTiles.tiles = null;





GeExpiredTiles.hasExpired = function(row, column, zoomLevel, areaIndex, remove)
{
if (GeExpiredTiles.tiles != null && row <= ffmGlobals.currentMaxRow && column <= ffmGlobals.currentMaxColumn) {
var expired = GeExpiredTiles.tiles[areaIndex][zoomLevel - 1][row][column];
if (remove)
GeExpiredTiles.tiles[areaIndex][zoomLevel - 1][row][column] = false;
return expired;
}
return false;
}

GeExpiredTiles.merge = function(tiles)
{
if (GeExpiredTiles.tiles == null) {
GeExpiredTiles.tiles = tiles;
} else if (tiles != null) {
for (var a = 0; a < GeExpiredTiles.tiles.length; a++) {
for (var z = 0; z < GeExpiredTiles.tiles[a].length; z++) {
for (var i = 0; i < GeExpiredTiles.tiles[a][z].length; i++) {
for (var j = 0; j < GeExpiredTiles.tiles[a][z][i].length; j++) {
GeExpiredTiles.tiles[a][z][i][j] = GeExpiredTiles.tiles[a][z][i][j] | tiles[a][z][i][j];
}
}
}
}
}
}







function FfmImage(row, column, id, src)
{
this.row = row;
this.column = column;
this.id = id;

this.imageExists = imageExists;
function imageExists()
{
if (this.column > ffmGlobals.currentMaxColumn || this.row > ffmGlobals.currentMaxRow) {
return false;
}
return true;
}

this.getSrc = getSrc;
function getSrc()
{
if (ffmConfig.HIDE_BACKGROUND_IMAGE || !this.imageExists()) {
return ffmConfig.TILE_BLANK_IMAGE_BASENAME;
}
return ffmConfig.TILE_IMAGE_BASENAME + ffmGlobals.currentZoomLevel + '_' + this.row + '_' + this.column + '.' + ffmConfig.TILE_IMAGE_EXT;
}

this.src = this.getSrc();

this.toString = toString;
function toString()
{
return 'row = ' + this.row + ', column = ' + this.column + ', id = ' + this.id + ', src = ' + this.src;
}
}



function FfmImageLoader()
{
this.imagesOnScreen = new Array();
this.imagesInBuffer = new Array();
this.imagesLoading = 0;
this.timestamp = new Date();
this.refreshId = null;

this.pushImageOnScreen = pushImageOnScreen;
function pushImageOnScreen(image)
{
this.imagesOnScreen.push(image);
}

this.pushImageInBuffer = pushImageInBuffer;
function pushImageInBuffer(image)
{
this.imagesInBuffer.push(image);
}

this.nextImageOnScreen = nextImageOnScreen;
function nextImageOnScreen()
{
var image = null;
do {
image = this.imagesOnScreen.shift();
if (image && !ffmViewer.view.isOnScreen(image)) {
if (ffmViewer.view.isOnScreenOrInBuffer(image)) {
this.imagesInBuffer.push(image);
}
image = null;
}
} while (this.imagesOnScreen.length > 0 && !image);
return image;
}

this.nextImageInBuffer = nextImageInBuffer;
function nextImageInBuffer()
{
var image = null;
do {
image = this.imagesInBuffer.shift();
if (image && !ffmViewer.view.isOnScreenOrInBuffer(image)) {
image = null;
}
} while (this.imagesInBuffer.length > 0 && !image);
return image;
}


this.nextImage = nextImage;
function nextImage()
{
var image = this.nextImageOnScreen();
if (!image) {
image = this.nextImageInBuffer();
}
return image;
}

this.loadImages = loadImages;
function loadImages()
{
var N = ffmConfig.MAX_LOADING_IMAGES - this.imagesLoading;
for (var i = 0; i < N; i++) {
this.loadNextImage();
}
}

this.setImage = setImage;
function setImage(id, src)
{
var elmnt = document.getElementById(id);
if (elmnt) {

elmnt.src = src;
}
}

this.triggerRefresh = triggerRefresh;
function triggerRefresh()
{
var now = new Date();
this.refreshId = now.getTime();
FfHelper.createCookie('FFM_IMAGE_LOADER_REFRESH_ID', this.refreshId);
}


this.loadNextImage = loadNextImage;
function loadNextImage()
{
var image = this.nextImage();
if (image) {

var img = new Image();







img.src = image.src + '?' + this.refreshId;



if (!img.complete) {
this.imagesLoading++;
}

setTimeout('ffmImageLoader.setImage(\'' + image.id + '\', \'' + img.src + '\')', 1); 

}
}

this.resetImagesLoadingIfNeeded = resetImagesLoadingIfNeeded;
function resetImagesLoadingIfNeeded()
{
if ((new Date()).getTime() - this.timestamp.getTime() > ffmConfig.RESET_IMAGES_LOADING_MS) {
this.imagesLoading = 0;
this.timestamp = new Date();
}
}

this.processOnLoad = processOnLoad;
function processOnLoad()
{
if (--this.imagesLoading < 0) 
this.imagesLoading = 0;
this.loadImages();
}

this.toString = toString;
function toString()
{
var html = '';
html += 'ON SCREEN:<br/>';
for (var i = 0; i < this.imagesOnScreen.length; i++) {
html += this.imagesOnScreen[i].toString() + '<br/>';
}
html += 'IN BUFFER:<br/>';
for (var i = 0; i < this.imagesInBuffer.length; i++) {
html += this.imagesInBuffer[i].toString() + '<br/>';
}
return html;
}


this.refreshId = FfHelper.readCookie('FFM_IMAGE_LOADER_REFRESH_ID');
if (!this.refreshId)
this.triggerRefresh();
}
var ffmImageLoader = new FfmImageLoader();

function FfmImageLoaderProcessOnLoad()
{
ffmImageLoader.processOnLoad();
}



function FfmImageLoaderThread()
{
this.running = false;

this.run = run;
function run()
{
setTimeout('ffmImageLoaderThread.start()', 1);
}

this.start = start;
function start()
{
if (this.running == true)
return;
this.running = true;

ffmImageLoader.loadImages();

this.running = false;
}
}
var ffmImageLoaderThread = new FfmImageLoaderThread();




function FfmImageLoaderResetImagesLoadingThread()
{
ffmImageLoader.resetImagesLoadingIfNeeded();
ffmImageLoaderThread.run();
setTimeout('FfmImageLoaderResetImagesLoadingThread();', ffmConfig.RESET_IMAGES_LOADING_MS);
}



function FfmTile(row, column, generateId)
{
this.row = row;
this.column = column;
this.onScreen = false;
this.inBuffer = false;

this.getNextId = getNextId;
function getNextId()
{
return FfHelper.getNextHtmlId();
}

if (generateId) {
this.id = this.getNextId();
}

this.getElement = getElement;
function getElement()
{
return document.getElementById(this.id);
}

this.getX = getX;
function getX()
{
return ffmConfig.TILE_WIDTH * this.column;
}

this.getY = getY;
function getY()
{
return ffmConfig.TILE_HEIGHT * this.row;
}

this.move = move;
function move(newRow, newColumn)
{
this.row = newRow;
this.column = newColumn;
var elmnt = this.getElement();
if (elmnt) {
elmnt.src = ffmConfig.TILE_BLANK_IMAGE_BASENAME; 
elmnt.style.left = this.getX() + 'px';
elmnt.style.top = this.getY() + 'px';
}
}

this.createElement = createElement;
function createElement()
{
var img = document.createElement('img');
img.id = this.id;
img.className = 'ffmTile';



img.onload = FfmImageLoaderProcessOnLoad;
img.src = ffmConfig.TILE_BLANK_IMAGE_BASENAME;

img.style.left = this.getX() + 'px';
img.style.top = this.getY() + 'px';


img.onmouseover = FfmDisableEvent;
img.onmousemove = FfmDisableEvent;
img.onclick = FfmDisableEvent;
img.onmousedown = FfmDisableEvent;
img.onmouseup = FfmDisableEvent;

return img;
}

this.toString = toString;
function toString()
{
return 'row = ' + this.row + ', column = ' + this.column + ', id = ' + this.id + ', onScreen = ' + this.onScreen + ', inBuffer = ' + this.inBuffer;
}
}



function FfmTileManager()
{
this.tiles = new Array();


this.exists = new Array();

this.setExists = setExists;
function setExists(row, column, exist)
{
if (row >= 0 && column >= 0) {
this.exists[row * ffmConfig.MAX_COLUMNS + column] = exist;
}
}

this.getExists = getExists;
function getExists(row, column)
{
if (row >= 0 && column >= 0) {
return this.exists[row * ffmConfig.MAX_COLUMNS + column];
}
return false;
}

this.createTilesIfNeeded = createTilesIfNeeded;
function createTilesIfNeeded(totalTiles)
{
if (this.tiles.length < totalTiles) {
var n = totalTiles - this.tiles.length;
for (var i = 0; i < n; i++) {
var tile = new FfmTile(-1, -1, true);
ffmViewer.getGridElement().appendChild(tile.createElement());
this.tiles.push(tile);
}
}
}

this.loadImage = loadImage;
function loadImage(tile)
{
var image = new FfmImage(tile.row, tile.column, tile.id);
if (tile.onScreen) {
ffmImageLoader.pushImageOnScreen(image);
} else if (tile.inBuffer) {
ffmImageLoader.pushImageInBuffer(image);
}
ffmImageLoaderThread.run();
}

this.categorizeTiles = categorizeTiles;
function categorizeTiles()
{
for (var i = 0; i < this.tiles.length; i++) {
if (ffmViewer.view.isOnScreen(this.tiles[i])) {
this.tiles[i].onScreen = true;
this.tiles[i].inBuffer = false;
} else if (ffmViewer.view.isOnScreenOrInBuffer(this.tiles[i])) {
this.tiles[i].onScreen = false;
this.tiles[i].inBuffer = true;
} else {
this.tiles[i].onScreen = false;
this.tiles[i].inBuffer = false;
this.setExists(this.tiles[i].row, this.tiles[i].column, false);
}
}
}

this.existsToString = existsToString;
function existsToString()
{
var html = '';
for (var i = 0; i < this.exists.length; i++) {
if (this.exists[i]) {
var row = Math.floor(i/ffmConfig.MAX_COLUMNS);
var column = i % ffmConfig.MAX_COLUMNS;
html += i + ' (' + row + ', ' + column + '): exists<br/>';
}
}
return html;
}

this.resetTiles = resetTiles;
function resetTiles()
{
for (var i = 0; i < this.tiles.length; i++) {
this.tiles[i].onScreen = false;
this.tiles[i].inBuffer = false;
this.setExists(this.tiles[i].row, this.tiles[i].column, false);
this.tiles[i].move(-1, -1);
}
}

this.getNextOnScreenTile = getNextOnScreenTile;
function getNextOnScreenTile()
{
var currentViewArea = ffmViewer.view.clone();
for (var i = currentViewArea.startRow; i <= currentViewArea.endRow; i++) {
for (var j = currentViewArea.startColumn; j <= currentViewArea.endColumn; j++) {
if (i >= 0 && j >= 0 && !this.getExists(i, j)) {
return new FfmTile(i, j);
}
}
}
return null;
}

this.getNextInBufferTile = getNextInBufferTile;
function getNextInBufferTile()
{
var currentViewArea = ffmViewer.view.clone();
for (var i = currentViewArea.getBufferStartRow(); i <= currentViewArea.getBufferEndRow(); i++) {
for (var j = currentViewArea.getBufferStartColumn(); j <= currentViewArea.getBufferEndColumn(); j++) {
var tile = new FfmTile(i, j);
if (i >= 0 && j >= 0 && !currentViewArea.isOnScreen(tile) && !this.getExists(i, j)) {
return tile;
}
}
}
return null;
}

this.moveTiles = moveTiles;
function moveTiles()
{
for (var i = 0; i < this.tiles.length; i++) {
if (!this.tiles[i].onScreen && !this.tiles[i].inBuffer) {
var tile = this.getNextOnScreenTile();
if (tile) {

this.tiles[i].onScreen = true;
this.tiles[i].inBuffer = false;
} else {
tile = this.getNextInBufferTile();
if (tile) {

this.tiles[i].onScreen = false;
this.tiles[i].inBuffer = true;
} else {


return;
}
}
this.tiles[i].move(tile.row, tile.column);
this.loadImage(this.tiles[i]);
this.setExists(tile.row, tile.column, true);
}
}
}


this.reorganizeTiles = reorganizeTiles;
function reorganizeTiles(forceRefresh)
{
var isChange = ffmViewer.view.setViewAreaByOffset();
if (isChange || forceRefresh) { 
this.categorizeTiles();
this.moveTiles();
}
}

this.resize = resize;
function resize()
{
var newViewArea = ffmViewer.view.getViewAreaByOffset();


this.createTilesIfNeeded(newViewArea.getBufferRows() * newViewArea.getBufferColumns());

ffmTileManagerThread.run();
}

this.toString = toString;
function toString()
{
var html = '';
for (var i = 0; i < this.tiles.length; i++) {
html += i + ': ' + this.tiles[i].toString() + '<br/>';
}
return html;
}
}
var ffmTileManager = new FfmTileManager();



function FfmTileManagerThread()
{
this.running = false;
this.reset = false;

this.run = run;
function run(forceRefresh)
{
setTimeout('ffmTileManagerThread.start(' + (forceRefresh ? 'true' : '') + ')', 1);
}

this.start = start;
function start(forceRefresh)
{
if (this.running == true)
return;
this.running = true;

if (this.reset) {
this.reset = false;
ffmTileManager.resetTiles();
}

ffmTileManager.reorganizeTiles(forceRefresh);

this.running = false;
}

this.scheduleReset = scheduleReset;
function scheduleReset()
{
this.reset = true;
}
}
var ffmTileManagerThread = new FfmTileManagerThread();
function FfmViewFinder()
{
this.isVisible = true;
this.HIDE_VIEW_FINDER_ICON = 'images/hideViewFinderIcon.png';
this.SHOW_VIEW_FINDER_ICON = 'images/showViewFinderIcon.png';

this.getViewFinderBorderElement = getViewFinderBorderElement;
function getViewFinderBorderElement()
{
return document.getElementById('ffmViewFinderBorderId');
}

this.getViewFinderElement = getViewFinderElement;
function getViewFinderElement()
{
return document.getElementById('ffmViewFinderId');
}

this.getViewFinderSelectionElement = getViewFinderSelectionElement;
function getViewFinderSelectionElement()
{
return document.getElementById('ffmViewFinderSelectionId');
}

this.getViewFinderToggleElement = getViewFinderToggleElement;
function getViewFinderToggleElement()
{
return document.getElementById('ffmViewFinderToggleId');
}

this.setSelectionCenterAbsolute = setSelectionCenterAbsolute;
function setSelectionCenterAbsolute(x, y)
{
var vf = this.getViewFinderElement();
var vfs = this.getViewFinderSelectionElement();

var preferredWidth = Math.ceil(ffmViewer.view.width/ffmGlobals.currentScale/ffmConfig.MAP_WIDTH*vf.offsetWidth);
var preferredHeight = Math.ceil(ffmViewer.view.height/ffmGlobals.currentScale/ffmConfig.MAP_HEIGHT*vf.offsetHeight);

var vfsX = x*vf.offsetWidth/ffmConfig.MAP_WIDTH - Math.floor(preferredWidth/2);
var vfsY = y*vf.offsetHeight/ffmConfig.MAP_HEIGHT - Math.floor(preferredHeight/2);

if (vfsX < 0)
vfsX = 0;

if (vfsY < 0)
vfsY = 0;

vfs.style.left = vfsX + 'px';
vfs.style.top = vfsY + 'px';
}

this.updateSelectionPosition = updateSelectionPosition;
function updateSelectionPosition()
{
var center = ffmViewer.view.getCenterAbsolute();
this.setSelectionCenterAbsolute(center.x, center.y);
}

this.updateSelectionSize = updateSelectionSize;
function updateSelectionSize()
{
var vf = this.getViewFinderElement();
var vfs = this.getViewFinderSelectionElement();

var newWidth = Math.floor(ffmViewer.view.width/ffmGlobals.currentScale/ffmConfig.MAP_WIDTH*vf.offsetWidth);
var newHeight = Math.floor(ffmViewer.view.height/ffmGlobals.currentScale/ffmConfig.MAP_HEIGHT*vf.offsetHeight);


newWidth = Math.min(newWidth, vf.offsetWidth);
newHeight = Math.min(newHeight, vf.offsetWidth);

vfs.style.width = newWidth + 'px';
vfs.style.height = newHeight + 'px';
}

this.toggleViewFinder = toggleViewFinder;
function toggleViewFinder()
{
var vfb = this.getViewFinderBorderElement();
var vft = this.getViewFinderToggleElement();
if (this.isVisible) {
vfb.style.visibility = 'hidden';
vft.alt = 'Show View Finder';
vft.src = this.SHOW_VIEW_FINDER_ICON;
} else {
vfb.style.visibility = 'visible';
vft.alt = 'Hide View Finder';
vft.src = this.HIDE_VIEW_FINDER_ICON;
}
this.isVisible = !this.isVisible;
}

this.hideViewFinder = hideViewFinder;
function hideViewFinder()
{
var vfb = this.getViewFinderBorderElement();
var vft = this.getViewFinderToggleElement();
vfb.style.visibility = 'hidden';
vft.alt = 'Show View Finder';
vft.src = this.SHOW_VIEW_FINDER_ICON;
this.isVisible = false;
}

this.updateViewFinderPosition = updateViewFinderPosition;
function updateViewFinderPosition()
{
var vfb = this.getViewFinderBorderElement();
var viewer = ffmViewer.getViewerElement();
vfb.style.left = (ffmh.getAbsoluteX(viewer) + viewer.offsetWidth - vfb.offsetWidth) + 'px';
vfb.style.top = (ffmh.getAbsoluteY(viewer) + viewer.offsetHeight - vfb.offsetHeight) + 'px';
var vft = this.getViewFinderToggleElement();
vft.style.left = (ffmh.getAbsoluteX(viewer) + viewer.offsetWidth - vft.offsetWidth - 2) + 'px';
vft.style.top = (ffmh.getAbsoluteY(viewer) + viewer.offsetHeight - vft.offsetHeight - 2) + 'px';
}

this.mouseInViewFinderBorder = mouseInViewFinderBorder;
function mouseInViewFinderBorder(e, mousePosition)
{
return ffmh.mouseInElement(e, this.getViewFinderBorderElement(), mousePosition) && this.isVisible;
}

this.mouseInViewFinderSelection = mouseInViewFinderSelection;
function mouseInViewFinderSelection(e)
{
return ffmh.mouseInElement(e, this.getViewFinderSelectionElement()) && this.isVisible;
}

this.mouseInViewFinder = mouseInViewFinder;
function mouseInViewFinder(e)
{
return ffmh.mouseInElement(e, this.getViewFinderElement()) && this.isVisible;
}

this.mouseInViewFinderToggle = mouseInViewFinderToggle;
function mouseInViewFinderToggle(e)
{
return ffmh.mouseInElement(e, this.getViewFinderToggleElement());
}

this.panToViewFinder = panToViewFinder;
function panToViewFinder()
{
var vf = this.getViewFinderElement();
var vfs = this.getViewFinderSelectionElement();

var sx = Math.round(vfs.offsetLeft*ffmConfig.MAP_WIDTH/vf.offsetWidth*ffmGlobals.currentScale);
var sy = Math.round(vfs.offsetTop*ffmConfig.MAP_HEIGHT/vf.offsetHeight*ffmGlobals.currentScale);

ffmViewer.panTopLeftTo(sx, sy);
}

this.panToViewFinderClick = panToViewFinderClick;
function panToViewFinderClick(e)
{
var position = ffmh.getMousePosition(e);
var vf = ffmViewFinder.getViewFinderElement();
var vfs = ffmViewFinder.getViewFinderSelectionElement();


var x = position.x - ffmh.getAbsoluteX(vf);
var y = position.y - ffmh.getAbsoluteY(vf);


var left = x - Math.floor(vfs.offsetWidth/2);
var top = y - Math.floor(vfs.offsetHeight/2);

this.panViewFinderSelectionTopLeftTo(left, top, vfs);
ffmViewFinder.panToViewFinder();
}

this.panViewFinderSelectionTopLeftTo = panViewFinderSelectionTopLeftTo;
function panViewFinderSelectionTopLeftTo(newLeft, newTop, viewFinderSelectionElement)
{

var vf = ffmViewFinder.getViewFinderElement();
if (newLeft < 0) {
newLeft = 0;
} else if (newLeft > vf.offsetWidth - viewFinderSelectionElement.offsetWidth + 2) {
newLeft = vf.offsetWidth - viewFinderSelectionElement.offsetWidth + 2;
}
if (newTop < 0) {
newTop = 0;
} else if (newTop > vf.offsetHeight - viewFinderSelectionElement.offsetHeight + 2) {
newTop = vf.offsetHeight - viewFinderSelectionElement.offsetHeight + 2;
}
viewFinderSelectionElement.style.left = newLeft + 'px';
viewFinderSelectionElement.style.top = newTop + 'px';
}

this.getHtml = getHtml;
function getHtml()
{
var html = '';
html += '<div class="ffmViewFinderBorder" id="ffmViewFinderBorderId" ' + ffmh.DISABLE_JAVASCRIPT_MOUSE_EVENTS_HTML + '>';
html += '<img class="ffmViewFinderBorder" src="images/pageBg.png" ' + ffmh.DISABLE_JAVASCRIPT_MOUSE_EVENTS_HTML + ' />';

var selectionExtra = '';

if (ffmConfig.IS_IE_6) {
selectionExtra = 'style="background-image:url(\'images/vfSelectionBg.gif\');"';
}

html += '<div class="ffmViewFinder" id="ffmViewFinderId" ' + ffmh.DISABLE_JAVASCRIPT_MOUSE_EVENTS_HTML + '>';

html += '<img class="ffmViewFinder" id="ffmViewFinderImgId" src="images/blank.gif" ' + ffmh.DISABLE_JAVASCRIPT_MOUSE_EVENTS_HTML + ' />';
html += '<div class="ffmViewFinderSelection" id="ffmViewFinderSelectionId" ' + ffmh.DISABLE_JAVASCRIPT_MOUSE_EVENTS_HTML + ' ' + selectionExtra + '></div>';
html += '</div>';
html += '</div>';
html += '<img class="ffmViewFinderToggle" id="ffmViewFinderToggleId" src="images/hideViewFinderIcon.png" alt="Hide View Finder" onclick="ffmViewFinder.toggleViewFinder();" ' + ffmh.DISABLE_JAVASCRIPT_MOUSE_EVENTS_EXCEPT_CLICK_HTML + ' />';
return html;
}

this.setViewFinderImage = setViewFinderImage;
function setViewFinderImage(src)
{
var elmnt = document.getElementById('ffmViewFinderImgId');
if (elmnt) {
elmnt.src = src;
}
}
}
var ffmViewFinder = new FfmViewFinder();



function FfmViewFinderMouseDragger()
{
this.lastMousePosition;
this.isDragging = false;

this.startDragIfNeeded = startDragIfNeeded;
function startDragIfNeeded(e)
{
var position = ffmh.getMousePosition(e);
var elmnt = ffmViewFinder.getViewFinderSelectionElement();


if (!ffmh.mouseInElement(e, elmnt, position)) {
return;
}

this.lastMousePosition = position;
this.isDragging = true;
ffmViewFinder.getViewFinderElement().style.cursor = "move";


ffmViewer.onMouseMove = FfmViewFinderMouseDraggerMove;
}

this.processDrag = processDrag;
function processDrag(e)
{
var position = ffmh.getMousePosition(e);
var elmnt = ffmViewFinder.getViewFinderSelectionElement();


var vf = ffmViewFinder.getViewFinderElement();
if (!ffmh.mouseInElement(e, vf, position)) {
this.stopDragIfNeeded(e);
}

var dx = this.lastMousePosition.x - position.x;
var dy = this.lastMousePosition.y - position.y;

var newLeft = elmnt.offsetLeft - dx;
var newTop = elmnt.offsetTop - dy;

ffmViewFinder.panViewFinderSelectionTopLeftTo(newLeft, newTop, elmnt);

this.lastMousePosition = position;
}

this.stopDragIfNeeded = stopDragIfNeeded;
function stopDragIfNeeded(e)
{
if (!this.isDragging)
return;

ffmViewFinder.getViewFinderElement().style.cursor = "default";

ffmViewer.onMouseMove = null;
this.isDragging = false;

ffmViewFinder.panToViewFinder();
}
}
var ffmViewFinderMouseDragger = new FfmViewFinderMouseDragger();

function FfmViewFinderMouseDraggerMove(e)
{
ffmViewFinderMouseDragger.processDrag(e);
}



function FfmSearchResultsAdapter(sr)
{
this.sr = sr;

this.goToNextPage = goToNextPage;
function goToNextPage()
{
sr.goToNextPage();
}

this.goToPreviousPage = goToPreviousPage;
function goToPreviousPage()
{
sr.goToPreviousPage();
}
}

function FfmSearchResults(totalRows, curPage, rowsPerPage)
{
this.adapter = new FfmSearchResultsAdapter(this);

this.className = 'ffmSearchResults';
this.curPage = 1;
this.rowsPerPage = 10;

this.htmlElement = null;
this.containerElement = null;
this.hideTotals = false;



this.totalPages = 0;

this.setTotalPages = setTotalPages;
function setTotalPages()
{
this.totalPages = Math.ceil(this.totalRows/this.rowsPerPage);
}



this.initialize = initialize;
function initialize(totalRows, curPage, rowsPerPage)
{
if (totalRows)
this.totalRows = totalRows;
if (curPage) {
this.curPage = curPage;
}
if (rowsPerPage) {
this.rowsPerPage = rowsPerPage;
}
this.setTotalPages();
}
this.initialize(totalRows, curPage, rowsPerPage);



this.goToPage = goToPage;
function goToPage(page)
{
this.curPage = page;

this.loadPageHtml(page, this.rowsPerPage);

}

this.loadCurrentPage = loadCurrentPage;
function loadCurrentPage()
{
this.goToPage(this.curPage);
}




this.goToNextPage = goToNextPage;
function goToNextPage()
{
this.goToPage(this.curPage + 1);
}




this.goToPreviousPage = goToPreviousPage;
function goToPreviousPage()
{
this.goToPage(this.curPage - 1);
}






this.createPageNavigationElement = createPageNavigationElement;
function createPageNavigationElement()
{

var span = document.createElement('span');
span.className = this.className + 'Navigation';


var offset = ((this.curPage - 1)*this.rowsPerPage) + 1;

if (offset > this.rowsPerPage) {
var img = document.createElement('img');
img.className = this.className + 'PreviousPage';
img.src = 'images/blank.gif';
img.alt = 'Previous Page';
img.onclick = this.adapter.goToPreviousPage;
span.appendChild(img);
}

if (offset + this.rowsPerPage - 1 < this.totalRows) {
var img = document.createElement('img');
img.className = this.className + 'NextPage';
img.src = 'images/blank.gif';
img.alt = 'Next Page';
img.onclick = this.adapter.goToNextPage;
span.appendChild(img);
}

return span;
}



this.getResultsHtml = getResultsHtml;
function getResultsHtml()
{
var offset = ((this.curPage - 1)*this.rowsPerPage) + 1;
var endingOffset = Math.min(offset + this.rowsPerPage - 1, this.totalRows);
var html = '<span class="' + this.className + 'Results">' + offset + ' - ' + endingOffset;
if (!this.hideTotals)
html +=' of ' + this.totalRows;
html += '</span>';
return html;
}



this.paint = paint;
function paint(pageHtml)
{
var newContainer = document.createElement('div');

if (this.totalRows > this.rowsPerPage) {
var divHeader = document.createElement('div');
divHeader.className = 'ffmSearchResultsHeader';
divHeader.appendChild(this.createPageNavigationElement());
var spanResultsHeader = document.createElement('span');
spanResultsHeader.innerHTML = this.getResultsHtml();
divHeader.appendChild(spanResultsHeader);
newContainer.appendChild(divHeader);
}

var page = document.createElement('div');
if (pageHtml)
page.innerHTML = pageHtml;
newContainer.appendChild(page);

if (this.totalRows > this.rowsPerPage) {
var divFooter = document.createElement('div');
divFooter.className = 'ffmSearchResultsFooter';
divFooter.appendChild(this.createPageNavigationElement());
var spanResultsFooter = document.createElement('span');
spanResultsFooter.innerHTML = this.getResultsHtml();
divFooter.appendChild(spanResultsFooter);
newContainer.appendChild(divFooter);
}

if (this.containerElement) { 
this.htmlElement.replaceChild(newContainer, this.containerElement);
} else {
this.htmlElement.appendChild(newContainer);
}

this.containerElement = newContainer;
}



this.printHtml = printHtml;
function printHtml(html)
{
var newContainer = document.createElement('div');
newContainer.innerHTML = html;
this.htmlElement.replaceChild(newContainer, this.containerElement);
this.containerElement = newContainer;
}



this.createElement = createElement;
function createElement()
{
this.htmlElement = document.createElement('div');
}



this.appendTo = appendTo;
function appendTo(element)
{
this.createElement();
element.appendChild(this.htmlElement);

this.loadCurrentPage();
}



this.draw = draw;
function draw()
{
this.appendTo(document.body);
}



this.loadPageHtml = loadPageHtml;
function loadPageHtml(page, rowsPerPage) {}


}
function GeBooth(x, y, width, height, actualWidth, actualHeight)
{
this.number = '';
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.id = -1; 
this.bgId = 1;
this.isManual = true;
this.displayText = '';
this.htmlElement;

this.actualWidth = actualWidth;
this.actualHeight = actualHeight;


this.toString = toString;
function toString()
{
return 'GeBooth: id = ' + this.id + ', number = ' + this.number + ', x = ' + this.x + ', y = ' + this.y + ', width = ' + this.width + ', height = ' + this.height + ', bgId = ' + this.bgId + ', isManual = ' + this.isManual + ', displayText = ' + this.displayText + ', actualWidth = ' + this.actualWidth + ', actualHeight = ' + this.actualHeight;
}

this.setProperty = setProperty;
function setProperty(name, value)
{
switch (name) {
case 'number':
this.number = value;
break;
case 'x':
this.x = parseInt(value);
break;
case 'y':
this.y = parseInt(value);
break;
case 'width':
this.width = parseInt(value);
break;
case 'height':
this.height = parseInt(value);
break;
case 'id':
this.id = value;
break;
case 'bgId':
this.bgId = value;
break;
case 'isManual':
this.isManual = (value.toLowerCase() == 'true' ? true : false);
break;
case 'displayText':
this.displayText = value;
break;
case 'actualWidth':
this.actualWidth = parseInt(value);
break;
case 'actualHeight':
this.actualHeight = parseInt(value);
break;
default:
break;
}
}

this.readFromXml = readFromXml;
function readFromXml(boothXml)
{
var nodes = boothXml.childNodes;
for (var i = 0; i < nodes.length; i++) {
var propertyName = nodes[i].nodeName;
var propertyValue = '';
if (nodes[i].childNodes[0])
propertyValue = nodes[i].childNodes[0].nodeValue;
this.setProperty(propertyName, propertyValue);
}
}

this.copy = copy;
function copy(booth)
{
this.number = booth.number;
this.x = booth.x;
this.y = booth.y;
this.width = booth.width;
this.height = booth.height;
this.id = booth.id;
this.bgId = booth.bgId;
this.isManual = booth.isManual;
this.displayText = booth.displayText;
this.actualWidth = booth.actualWidth;
this.actualHeight = booth.actualHeight;
}

this.calculateActualWidth = function()
{
this.actualWidth = Math.ceil(this.width*ffmConfig.AREAS[geFloorPlan.currentAreaIndex].scaleX);
}

this.calculateActualHeight = function()
{
this.actualHeight = Math.ceil(this.height*ffmConfig.AREAS[geFloorPlan.currentAreaIndex].scaleY);
}

this.calculateActualDimensions = function()
{
this.calculateActualWidth();
this.calculateActualHeight();
}

this.calculatePixelWidth = function()
{
this.width = Math.round(this.actualWidth/ffmConfig.AREAS[geFloorPlan.currentAreaIndex].scaleX);
}

this.calculatePixelHeight = function()
{
this.height = Math.round(this.actualHeight/ffmConfig.AREAS[geFloorPlan.currentAreaIndex].scaleY);
}

this.calculatePixelDimensions = function()
{
this.calculatePixelWidth();
this.calculatePixelHeight();
}

if (!actualWidth)
this.calculateActualWidth();
if (!actualHeight)
this.calculateActualHeight();
}



function GeFpBoothError(errorCode, message, boothId)
{
this.GE_FP_BOOTH_ERROR_DUPLICATE_NUMBER = 1;

this.errorCode = errorCode;
this.message = message;
this.boothId = boothId;

this.toString = toString;
function toString()
{
return 'GeFpError: errorCode = ' + this.errorCode + ', message = ' + this.message + ', boothId = ' + this.boothId;
}

this.setProperty = setProperty;
function setProperty(name, value)
{
switch (name) {
case 'errorCode':
this.errorCode = value;
break;
case 'message':
this.message = value;
break;
case 'boothId':
this.boothId = value;
break;
default:
break;
}
}

this.readFromXml = readFromXml;
function readFromXml(xml)
{
var nodes = xml.childNodes;
for (var i = 0; i < nodes.length; i++) {
var propertyName = nodes[i].nodeName;
var propertyValue = '';
if (nodes[i].childNodes[0])
propertyValue = nodes[i].childNodes[0].nodeValue;
this.setProperty(propertyName, propertyValue);
}
}
}



function GeBoothHolder()
{
this.booths = new Array();

this.addBooth = addBooth;
function addBooth(booth)
{
this.booths.push(booth);
}

this.toString = toString;
function toString()
{
var str = 'Booths:';
for (var i = 0; i < this.booths.length; i++) {
str += '</br>' + this.booths[i].toString();
}
return str;
}

this.getBooth = getBooth;
function getBooth(id)
{
for (var i = 0; i < this.booths.length; i++) {
if (this.booths[i].id == id) {
return this.booths[i];
}
}
}

this.getBoothByBoothNumber = getBoothByBoothNumber;
function getBoothByBoothNumber(boothNumber)
{
for (var i = 0; i < this.booths.length; i++) {
if (this.booths[i].number == boothNumber) {
return this.booths[i];
}
}
}

this.deleteBooth = deleteBooth;
function deleteBooth(id)
{
for (var i = 0; i < this.booths.length; i++) {
if (this.booths[i].id == id) {
this.booths.splice(i, 1);
}
}
}



this.readFromXml = readFromXml;
function readFromXml(xmlDoc)
{
var boothsXml = xmlDoc.getElementsByTagName('booth');
for (var i = 0; i < boothsXml.length; i++) {
var booth = new GeBooth();
booth.readFromXml(boothsXml[i]);
this.addBooth(booth);
}
}
}

function GeBoothDetail()
{
this.id;
this.number;
this.areaId;
this.x;
this.y;
this.width;
this.height;
this.company;
this.categories;
this.description;
this.profileUrl;
this.logoUrl;
this.logoWidth;
this.logoHeight;

this.toString = toString;
function toString()
{
return 'GeBoothDetail: id = ' + this.id + ', number = ' + this.number + ', areaId = ' + this.areaId + ', x = ' + this.x + ', y = ' + this.y + ', width = ' + this.width + ', height = ' + this.height + ', company = ' + this.company + ', categories = ' + this.categories + ', description = ' + this.description + ', profileUrl = ' + this.profileUrl + ', logoUrl = ' + this.logoUrl + ', logoWidth = ' + this.logoWidth + ', logoHeight = ' + this.logoHeight;
}

this.setProperty = setProperty;
function setProperty(name, value)
{
switch (name) {
case 'id':
this.id = value;
break;
case 'number':
this.number = value;
break;
case 'areaId':
this.areaId = value;
break;
case 'x':
this.x = parseInt(value);
break;
case 'y':
this.y = parseInt(value);
break;
case 'width':
this.width = parseInt(value);
break;
case 'height':
this.height = parseInt(value);
break;
case 'company':
this.company = value;
break;
case 'categories':
this.categories = value;
break;
case 'description':
this.description = value;
break;
case 'profileUrl':
this.profileUrl = value;
break;
case 'logoUrl':
this.logoUrl = value;
break;
case 'logoWidth':
this.logoWidth = parseInt(value);
break;
case 'logoHeight':
this.logoHeight = parseInt(value);
break;
default:
break;
}
}

this.readFromXml = readFromXml;
function readFromXml(boothXml)
{
var nodes = boothXml.childNodes;
for (var i = 0; i < nodes.length; i++) {
var propertyName = nodes[i].nodeName;
var propertyValue = '';
if (nodes[i].childNodes[0])
propertyValue = nodes[i].childNodes[0].nodeValue;
this.setProperty(propertyName, propertyValue);
}
}

this.getScaledImageDimensions = getScaledImageDimensions;
function getScaledImageDimensions(maxWidth, maxHeight)
{
var sWidth = maxWidth/this.logoWidth;
var sHeight = maxHeight/this.logoHeight;
var scaledWidth = 0;
var scaledHeight = 0;
if (sWidth >= 1 && sHeight >= 1) { 
scaledWidth = this.logoWidth;
scaledHeight = this.logoHeight;
} else if (sWidth < sHeight) { 
scaledWidth = maxWidth;
scaledHeight = Math.round(this.logoHeight*sWidth); 
} else {
scaledHeight = maxHeight;
scaledWidth = Math.round(this.logoWidth*sHeight); 
}
return new FfmDimension(scaledWidth, scaledHeight);
}
}

function GeBoothDetails()
{
this.boothDetails = new Array();

this.addBoothDetail = addBoothDetail;
function addBoothDetail(boothDetail)
{
this.boothDetails.push(boothDetail);
}

this.toString = toString;
function toString()
{
var str = 'BoothDetails:';
for (var i = 0; i < this.boothDetails.length; i++) {
str += '</br>' + this.boothDetails[i].toString();
}
return str;
}

this.readFromXml = readFromXml;
function readFromXml(xmlDoc)
{
var boothDetailsXml = xmlDoc.getElementsByTagName('boothDetail');
for (var i = 0; i < boothDetailsXml.length; i++) {
var boothDetail = new GeBoothDetail();
boothDetail.readFromXml(boothDetailsXml[i]);
this.addBoothDetail(boothDetail);
}
}
}

function GeXmlList(tagName)
{
this.tagName = tagName;
this.items = new Array();

this.toString = toString;
function toString()
{
var str = '';
for (var i = 0; i < this.items.length; i++) {
str += (i > 0 ? ', ' : '') + this.items[i];
}
return str;
}

this.readFromNodes = readFromNodes;
function readFromNodes(nodes)
{
for (var i = 0; i < nodes.length; i++) {
this.items[i] = nodes[i].childNodes[0].nodeValue;
}
}
}

function GeExhibitor()
{
this.exhibitorId = 0;
this.boothId = 0;
this.boothNumber = '';
this.areaId = 0;
this.x = 0;
this.y = 0;
this.width = 0;
this.height = 0;
this.areaAbbreviation = '';
this.company = '';
this.categories = '';
this.appointments = new GeXmlList('appointment');

this.toString = toString;
function toString()
{
return 'GeExhibitor: exhibitor_id = ' + this.exhibitorId + '; boothId = ' + this.boothId + '; boothNumber = ' + this.boothNumber + '; areaId = ' + this.areaId + '; x = ' + this.x + '; y = ' + this.y + '; width = ' + this.width + '; height = ' + this.height + '; areaAbbreviation = ' + this.areaAbbreviation + '; company = ' + this.company + '; categories = ' + this.categories + '; appointments = ' + this.appointments;
}

this.readProperty = readProperty;
function readProperty(name, nodes)
{
switch (name) {
case 'appointments':
this.appointments.readFromNodes(nodes);
break;
default:
if (nodes[0].nodeValue)
this.setProperty(name, nodes[0].nodeValue);
break;
}
}

this.setProperty = setProperty;
function setProperty(name, value)
{
switch (name) {
case 'exhibitorId':
this.exhibitorId = value;
break;
case 'boothId':
this.boothId = value;
break;
case 'boothNumber':
this.boothNumber = value;
break;
case 'areaId':
this.areaId = value;
break;
case 'x':
this.x = parseInt(value);
break;
case 'y':
this.y = parseInt(value);
break;
case 'width':
this.width = parseInt(value);
break;
case 'height':
this.height = parseInt(value);
break;
case 'areaAbbreviation':
this.areaAbbreviation = value;
break;
case 'company':
this.company = value;
break;
case 'categories':
this.categories = value;
break;
default:
break;
}
}

this.readFromXml = readFromXml;
function readFromXml(boothXml)
{
var nodes = boothXml.childNodes;
for (var i = 0; i < nodes.length; i++) {
var propertyName = nodes[i].nodeName;

if (nodes[i].childNodes[0]) {

this.readProperty(propertyName, nodes[i].childNodes);
}

}
}

this.getDimensions = getDimensions;
function getDimensions()
{
var left = Math.round(this.x);
var top = Math.round(this.y);
var width = Math.round(this.width);
var height = Math.round(this.height);
return new FfmRectangle(left, top, width, height);
}

this.getCenter = getCenter;
function getCenter()
{
return GeQuickBooth.getBoothCenter(this.getDimensions());
}
}

function GeExhibitorHolder()
{
this.exhibitors = new Array();
this.totalExhibitors = 0;

this.setProperty = setProperty;
function setProperty(node)
{
var name = node.nodeName;
switch (name) {
case 'exhibitor':
var exhibitor = new GeExhibitor();
exhibitor.readFromXml(node);
this.addExhibitor(exhibitor);
break;
case 'totalExhibitors':
var value = '';
if (node.childNodes[0])
value = node.childNodes[0].nodeValue;
this.totalExhibitors = parseInt(value);
break;
default:
break;
}
}

this.addExhibitor = addExhibitor;
function addExhibitor(exhibitor)
{
this.exhibitors.push(exhibitor);
}

this.toString = toString;
function toString()
{
var str = 'Exhibitors:';
str += '</br> Total Exhibitors: ' + this.totalExhibitors + '; ';
for (var i = 0; i < this.exhibitors.length; i++) {
str += '</br>' + this.exhibitors[i].toString();
}
return str;
}

this.getExhibitor = getExhibitor;
function getExhibitor(exhibitorId)
{
for (var i = 0; i < this.exhibitors.length; i++) {
if (this.exhibitors[i].exhibitorId == exhibitorId) {
return this.exhibitors[i];
}
}
}

this.getExhibitorByBoothNumber = getExhibitorByBoothNumber;
function getExhibitorByBoothNumber(boothNumber)
{
for (var i = 0; i < this.exhibitors.length; i++) {
if (this.exhibitors[i].boothNumber == boothNumber) {
return this.exhibitors[i];
}
}
}

this.readFromXml = readFromXml;
function readFromXml(xmlDoc)
{
var nodes = xmlDoc.childNodes;
for (var i = 0; i < nodes.length; i++) {
this.setProperty(nodes[i]);
}
}
}


function FfLogger() { }


FfLogger.FF_LOGGER_ALL = 1; 
FfLogger.FF_LOGGER_ERROR = 2; 
FfLogger.FF_LOGGER_WARNING = 4; 
FfLogger.FF_LOGGER_NOTICE = 8; 
FfLogger.FF_LOGGER_DEBUG1 = 16; 
FfLogger.FF_LOGGER_DEBUG2 = 32; 


FfLogger.log = function(str, errorLevel)
{

}




function FfAjaxRequest(url, responseHandler, doPost)
{
var xmlHttp;

function send(asynchronous)
{
if (doPost) {
var query = url.split('?')
var params = '';
if (query.length > 1) {
url = query[0];
params = query[1];
}
xmlHttp.open("POST", url, asynchronous);
xmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xmlHttp.setRequestHeader('Content-length', params.length);
xmlHttp.setRequestHeader('Connection', 'close');
xmlHttp.send(params);
} else {
xmlHttp.open('GET', url, asynchronous);
xmlHttp.send(null);
}
}

function makeRequest()
{
FfLogger.log(url);
xmlHttp = FfAjaxHelper.getXmlHttpObject();

try {
if (responseHandler) { 
xmlHttp.onreadystatechange = processResponse;
send(true);


} else { 
send(false);


if (xmlHttp.status != 200)
return null;
return xmlHttp;
}
} catch (e) {
return null;
}
}

function processResponse()
{
if (xmlHttp.readyState == 4) {
if (xmlHttp.status != 200) 
xmlHttp = null;
if (responseHandler)
responseHandler(xmlHttp);
}
}

return makeRequest();
}

FfAjaxRequest.issueRequest = function(url, params)
{
for (var i = 0; i < params.length; i++) {
url += (i == 0 ? '?' : '&') + params[i][0] + '=' + (params[i][1] ? ffUrlEncode(params[i][1]) : '');
}
var xmlHttp = new FfAjaxRequest(url);
if (!xmlHttp || !xmlHttp.responseText) 
return null;
return eval('(' + xmlHttp.responseText + ')');
}


function GeAjaxMediator() { }

GeAjaxMediator.SERVER_URL = FfPaths.FF_ROOT_URL + '/../goExpo/common/GeAjaxServer.php';

GeAjaxMediator.getUrl = function(req, params)
{
var url = GeAjaxMediator.SERVER_URL;
url += '?req=' + req;
if (params) {
for (var i = 0; i < params.length; i++) {
url += '&' + params[i][0] + '=' + (params[i][1] != null ? ffUrlEncode(params[i][1]) : '');
}
}
return url;
}

GeAjaxMediator.issueRequest = function(req, params)
{
var url = GeAjaxMediator.getUrl(req, params);
var xmlHttp = new FfAjaxRequest(url);
if (!xmlHttp || !xmlHttp.responseText) 
return null;
return eval('(' + xmlHttp.responseText + ')');
}

GeAjaxMediator.getPopupProduct = function(productId, exhibitorId, listOffset)
{
var params = [
['pi', productId],
['ei', exhibitorId],
['lo', listOffset],
['uh', GeGlobals.USER_HASH]
];
return GeAjaxMediator.issueRequest(1, params);
}

GeAjaxMediator.addProductToPlanner = function(productId)
{
if (!GeGuiMediator.verifyLogin())
return false;
var params = [
['uh', GeGlobals.USER_HASH],
['pi', productId]
];
GeAjaxMediator.issueRequest(2, params);
return true;
}

GeAjaxMediator.removeProductFromPlanner = function(productId)
{
if (!GeGuiMediator.verifyLogin())
return false;
var params = [
['uh', GeGlobals.USER_HASH],
['pi', productId]
];
GeAjaxMediator.issueRequest(3, params);
return true;
}

GeAjaxMediator.addUserToPlanner = function(userIdToAdd)
{
if (!GeGuiMediator.verifyLogin())
return false;
if (!GeGuiMediator.verifyNotSelf(userIdToAdd))
return false;
var params = [
['uh', GeGlobals.USER_HASH],
['ui', userIdToAdd]
];
GeAjaxMediator.issueRequest(4, params);
return true;
}

GeAjaxMediator.removeUserFromPlanner = function(userIdToRemove)
{
if (!GeGuiMediator.verifyLogin())
return false;
var params = [
['uh', GeGlobals.USER_HASH],
['ui', userIdToRemove]
];
GeAjaxMediator.issueRequest(5, params);
return true;
}

GeAjaxMediator.requestConnection = function(withUserId)
{
if (!GeGuiMediator.verifyLogin())
return false;
if (!GeGuiMediator.verifyNotSelf(withUserId))
return false;
var params = [
['uh', GeGlobals.USER_HASH],
['ui', withUserId]
];
return GeAjaxMediator.issueRequest(6, params);
}

GeAjaxMediator.approveConnection = function(withUserId)
{
if (!GeGuiMediator.verifyLogin())
return false;
var params = [
['uh', GeGlobals.USER_HASH],
['ui', withUserId]
];
return GeAjaxMediator.issueRequest(7, params);
}

GeAjaxMediator.removeConnection = function(withUserId)
{
if (!GeGuiMediator.verifyLogin())
return false;
var params = [
['uh', GeGlobals.USER_HASH],
['ui', withUserId]
];
return GeAjaxMediator.issueRequest(8, params);
}

GeAjaxMediator.getUserPhoto = function(userId, offset)
{
var params = [
['ui', userId],
['of', offset]
];
return GeAjaxMediator.issueRequest(9, params);
}

GeAjaxMediator.pingFloorPlan = function(lastPinged)
{
var params = [
['lp', lastPinged],
['in', GeGlobals.INSTANCE_ID]
];
return GeAjaxMediator.issueRequest(10, params);
}

GeAjaxMediator.saveBoothReservation = function(form, boothId)
{
var params = [
['uh', GeGlobals.USER_HASH],
['id', boothId]
];
var url = GeAjaxMediator.getUrl(11, params);
return form.save(url);
}

GeAjaxMediator.loadBoothReservation = function(form, boothId)
{
var params = [
['uh', GeGlobals.USER_HASH],
['id', boothId]
];
var url = GeAjaxMediator.getUrl(12, params);
return form.load(url);
}

GeAjaxMediator.deleteBoothReservation = function(form, boothId)
{
var params = [
['uh', GeGlobals.USER_HASH],
['id', boothId]
];
var url = GeAjaxMediator.getUrl(13, params);
return form.load(url);
}



function GePinger() { }


GePinger.GE_PINGER_SLEEP_MS = 180000;


GePinger.lastPinged = FfHelper.readCookie('GE_PINGER_LAST_PINGED');

GePinger.ping = function(loop)
{
var response = GeAjaxMediator.pingFloorPlan(GePinger.lastPinged);
if (response) {
GePinger.lastPinged = response.lastPinged;
FfHelper.createCookie('GE_PINGER_LAST_PINGED', GePinger.lastPinged);

if (response.tilesExpired) {
ffmImageLoader.triggerRefresh();
ffmTileManagerThread.scheduleReset();
ffmTileManagerThread.run(true);
}

if (response.quickBoothsUpdated) {

geQuickBoothsLoader.clearBooths();
var now = new Date();
FfJsLoader.loadScript(FfPaths.FF_ROOT_URL + '/../goExpo/floorPlan/mapData/QuickBooths.js?' + now.getTime());
}

if (response.boothsUpdated) {

if (ffmConfig.CAN_EDIT) {
geFloorPlan.selectAreaIndex(geFloorPlan.currentAreaIndex, true);
}
}
}
if (loop)
setTimeout('GePinger.ping(true);', GePinger.GE_PINGER_SLEEP_MS);
}


GePinger.pingSoon = function()
{
setTimeout('GePinger.ping();', 3000);
}
function GeFpClient()
{
this.GE_FP_REQUEST_GET_BOOTHS = 1;
this.GE_FP_REQUEST_NEW_BOOTH = 2;
this.GE_FP_REQUEST_EDIT_BOOTH = 3;
this.GE_FP_REQUEST_DELETE_BOOTH = 4;
this.GE_FP_REQUEST_GET_BOOTH_DETAILS = 5;
this.GE_FP_REQUEST_GET_EXHIBITORS_FOR_BOOTH_NUMBERS = 6;
this.GE_FP_REQUEST_GET_BOOTH = 7;
this.GE_FP_REQUEST_GET_BOOTH_DETAILS_FOR_BOOTH_ID = 8;
this.GE_FP_REQUEST_GET_ALL_EXHIBITORS = 9;
this.GE_FP_REQUEST_GET_FIND_EXHIBITORS = 10;
this.GE_FP_REQUEST_GET_BOOTH_DETAILS_FOR_EXHIBITOR_ID = 11;
this.GE_FP_REQUEST_GET_EXHIBITORS_FOR_APPOINTMENT_DAY = 12;
this.GE_FP_REQUEST_GET_EXHIBITORS_FOR_EXHIBITOR_IDS = 13;
this.GE_FP_REQUEST_GET_QUICK_BOOTHS = 14;
this.GE_FP_REQUEST_GET_EXHIBITORS_FOR_BOOTH_IDS = 19;

this.requestBooths = requestBooths;
function requestBooths(processResponse)
{
new FfmClientRequest(this.GE_FP_REQUEST_GET_BOOTHS, processResponse, 'areaId=' + ffmConfig.FP_AREA_ID);
}

this.requestNewBooth = requestNewBooth;
function requestNewBooth(booth, processResponse)
{
var extraQueryString = 'areaId=' + ffmConfig.FP_AREA_ID + '&x=' + booth.x + '&y=' + booth.y + '&width=' + booth.width + '&height=' + booth.height + '&bgId=' + booth.bgId + '&isManual=' + booth.isManual + '&txt=' + booth.displayText +  '&actualWidth=' + booth.actualWidth + '&actualHeight=' + booth.actualHeight + '&ff_instance=' + GeGlobals.INSTANCE_ID;
new FfmClientRequest(this.GE_FP_REQUEST_NEW_BOOTH, processResponse, extraQueryString);

GePinger.pingSoon();
}

this.requestEditBooth = requestEditBooth;
function requestEditBooth(booth, processResponse)
{
var extraQueryString = 'id=' + booth.id + '&areaId=' + ffmConfig.FP_AREA_ID + '&number=' + booth.number + '&x=' + booth.x + '&y=' + booth.y + '&width=' + booth.width + '&height=' + booth.height + '&bgId=' + booth.bgId + '&isManual=' + booth.isManual + '&txt=' + booth.displayText + '&actualWidth=' + booth.actualWidth + '&actualHeight=' + booth.actualHeight + '&ff_instance=' + GeGlobals.INSTANCE_ID;
new FfmClientRequest(this.GE_FP_REQUEST_EDIT_BOOTH, processResponse, extraQueryString);

GePinger.pingSoon();
}

this.requestDeleteBooth = requestDeleteBooth;
function requestDeleteBooth(id, processResponse)
{
var extraQueryString = 'id=' + id + '&ff_instance=' + GeGlobals.INSTANCE_ID;
new FfmClientRequest(this.GE_FP_REQUEST_DELETE_BOOTH, processResponse, extraQueryString);

GePinger.pingSoon();
}

this.requestBoothDetails = requestBoothDetails;
function requestBoothDetails(x, y, processResponse)
{
var extraQueryString = 'areaId=' + ffmConfig.FP_AREA_ID + '&x=' + x + '&y=' + y;
new FfmClientRequest(this.GE_FP_REQUEST_GET_BOOTH_DETAILS, processResponse, extraQueryString);
}

this.requestExhibitorsForBoothNumbers = requestExhibitorsForBoothNumbers;
function requestExhibitorsForBoothNumbers(boothNumbers, processResponse)
{
var extraQueryString = '';
for (var i = 0; i < boothNumbers.length; i++) {
extraQueryString += (i > 0 ? '&' : '') + 'bn[' + i + ']=' + boothNumbers[i];
}

url = 'GeFpServer.php?request=' + this.GE_FP_REQUEST_GET_EXHIBITORS_FOR_BOOTH_NUMBERS + '&' + extraQueryString;
new FfAjaxRequest(url, processResponse, true); 
}

this.requestExhibitorsForBoothIds = function(boothIds, processResponse)
{
var extraQueryString = '';
for (var i = 0; i < boothIds.length; i++) {
extraQueryString += (i > 0 ? '&' : '') + 'bi[' + i + ']=' + boothIds[i];
}

url = 'GeFpServer.php?request=' + this.GE_FP_REQUEST_GET_EXHIBITORS_FOR_BOOTH_IDS + '&' + extraQueryString;
new FfAjaxRequest(url, processResponse, true); 
}

this.requestExhibitorsForExhibitorIds = requestExhibitorsForExhibitorIds;
function requestExhibitorsForExhibitorIds(exhibitorIds, processResponse)
{
var extraQueryString = '';
for (var i = 0; i < exhibitorIds.length; i++) {
extraQueryString += (i > 0 ? '&' : '') + 'ei[' + i + ']=' + exhibitorIds[i];
}

url = 'GeFpServer.php?request=' + this.GE_FP_REQUEST_GET_EXHIBITORS_FOR_EXHIBITOR_IDS + '&' + extraQueryString;
new FfAjaxRequest(url, processResponse, true); 
}

this.requestBooth = requestBooth;
function requestBooth(boothId, processResponse)
{
var extraQueryString = 'id=' + boothId;
new FfmClientRequest(this.GE_FP_REQUEST_GET_BOOTH, processResponse, extraQueryString);
}

this.requestBoothDetailsForBoothId = requestBoothDetailsForBoothId;
function requestBoothDetailsForBoothId(id, processResponse)
{
var extraQueryString = 'id=' + id;
new FfmClientRequest(this.GE_FP_REQUEST_GET_BOOTH_DETAILS_FOR_BOOTH_ID, processResponse, extraQueryString);
}

this.requestAllExhibitors = requestAllExhibitors;
function requestAllExhibitors(page, rowsPerPage, processResponse)
{
var extraQueryString = 'pg=' + page + '&rpp=' + rowsPerPage;
new FfmClientRequest(this.GE_FP_REQUEST_GET_ALL_EXHIBITORS, processResponse, extraQueryString);
}

this.requestFindExhibitors = requestFindExhibitors;
function requestFindExhibitors(searchStr, page, rowsPerPage, type, processResponse)
{
var extraQueryString = 'str=' + ffmh.urlencode(searchStr) + '&pg=' + page + '&rpp=' + rowsPerPage + '&tp=' + type;
new FfmClientRequest(this.GE_FP_REQUEST_GET_FIND_EXHIBITORS, processResponse, extraQueryString);
}

this.requestBoothDetailsForExhibitorId = requestBoothDetailsForExhibitorId;
function requestBoothDetailsForExhibitorId(id, boothId, processResponse)
{
var extraQueryString = 'id=' + id + '&bi=' + boothId;
new FfmClientRequest(this.GE_FP_REQUEST_GET_BOOTH_DETAILS_FOR_EXHIBITOR_ID, processResponse, extraQueryString);
}

this.requestExhibitorsForAppointmentDay = requestExhibitorsForAppointmentDay;
function requestExhibitorsForAppointmentDay(userId, date, processResponse)
{
var extraQueryString = 'ui=' + userId + '&ad=' + date;
new FfmClientRequest(this.GE_FP_REQUEST_GET_EXHIBITORS_FOR_APPOINTMENT_DAY, processResponse, extraQueryString);
}

this.requestQuickBooths = requestQuickBooths;
function requestQuickBooths(areaId, offset, n, processResponse)
{
var extraQueryString = 'ai=' + areaId + '&o=' + offset + '&n=' + n;
new FfmClientRequest(this.GE_FP_REQUEST_GET_QUICK_BOOTHS, processResponse, extraQueryString);
}
}
var client = new GeFpClient();



function GeFpError(severity, message)
{
this.GE_FP_ERROR_FAILURE = 1;
this.GE_FP_ERROR_WARNING = 2;

this.severity = severity;
this.message = message;

this.toString = toString;
function toString()
{
return 'GeFpError: severity = ' + this.severity + ', message = ' + this.message;
}

this.setProperty = setProperty;
function setProperty(name, value)
{
switch (name) {
case 'severity':
this.severity = value;
break;
case 'message':
this.message = value;
break;
default:
break;
}
}

this.readFromXml = readFromXml;
function readFromXml(xml)
{
var nodes = xml.childNodes;
for (var i = 0; i < nodes.length; i++) {
var propertyName = nodes[i].nodeName;
var propertyValue = '';
if (nodes[i].childNodes[0])
propertyValue = nodes[i].childNodes[0].nodeValue;
this.setProperty(propertyName, propertyValue);
}
}
}
function GeFpServerMediator()
{
this.log = log;
function log()
{
ffml.log(booths.toString());
}

this.processGetBoothsResponse = processGetBoothsResponse;
function processGetBoothsResponse(xmlHttp)
{
if (xmlHttp.responseXML && xmlHttp.responseXML.documentElement) {

booths.readFromXml(xmlHttp.responseXML.documentElement);

boothHelper.loadBooths();
boothHelper.showBooths();
}
}

this.loadBooths = loadBooths;
function loadBooths()
{
client.requestBooths(mediator.processGetBoothsResponse);
}

this.processNewBoothResponse = processNewBoothResponse;
function processNewBoothResponse(xmlHttp)
{
if (xmlHttp.responseXML && xmlHttp.responseXML.documentElement) {
var booth = new GeBooth();
booth.readFromXml(xmlHttp.responseXML.documentElement);
booths.addBooth(booth);
boothHelper.showBooth(booth);
}
}

this.newBooth = newBooth;
function newBooth(booth)
{
client.requestNewBooth(booth, mediator.processNewBoothResponse);
}

this.processEditBoothResponse = processEditBoothResponse;
function processEditBoothResponse(xmlHttp)
{
if (xmlHttp.responseXML && xmlHttp.responseXML.documentElement) {
var error = new GeFpBoothError();
error.readFromXml(xmlHttp.responseXML.documentElement);

if (error.errorCode == error.GE_FP_BOOTH_ERROR_DUPLICATE_NUMBER) {
alert(error.message);
boothHelper.clearBoothNumber(error.boothId);
}
}
}

this.editBooth = editBooth;
function editBooth(id, number, x, y, width, height, bgId, isManual, displayText, actualWidth, actualHeight)
{
var booth = booths.getBooth(id);
booth.number = number;
booth.x = x;
booth.y = y;
booth.width = width;
booth.height = height;
booth.bgId = bgId;
booth.isManual = isManual;
booth.displayText = displayText;
booth.actualWidth = actualWidth;
booth.actualHeight = actualHeight;
client.requestEditBooth(booth, mediator.processEditBoothResponse);
}

this.processDeleteBoothResponse = processDeleteBoothResponse;
function processDeleteBoothResponse(xmlHttp)
{


}

this.deleteBooth = deleteBooth;
function deleteBooth(id)
{
booths.deleteBooth(id);
client.requestDeleteBooth(id, mediator.processDeleteBoothResponse);
}

this.getBoothDetails = getBoothDetails;
function getBoothDetails(x, y, processBoothDetails)
{
client.requestBoothDetails(x, y, processBoothDetails);
}

this.getExhibitorsForBoothNumbers = getExhibitorsForBoothNumbers;
function getExhibitorsForBoothNumbers(boothNumbers, processResponse)
{
client.requestExhibitorsForBoothNumbers(boothNumbers, processResponse);
}

this.getExhibitorsForBoothIds = function(boothIds, processResponse)
{
client.requestExhibitorsForBoothIds(boothIds, processResponse);
}

this.getBooth = getBooth;
function getBooth(boothId, processResponse)
{
client.requestBooth(boothId, processResponse);
}

this.getBoothDetailsForBoothId = getBoothDetailsForBoothId;
function getBoothDetailsForBoothId(boothId, processResponse)
{
client.requestBoothDetailsForBoothId(boothId, processResponse);
}

this.getBoothDetailsForExhibitorId = getBoothDetailsForExhibitorId;
function getBoothDetailsForExhibitorId(exhibitorId, boothId, processResponse)
{
client.requestBoothDetailsForExhibitorId(exhibitorId, boothId, processResponse);
}
}
var mediator = new GeFpServerMediator();


function FfSectionTitle(title, cssClassPrefix, enableEvents)
{
this.htmlId = FfHelper.getNextHtmlId();
if (!cssClassPrefix)
this.cssClassPrefix = 'ffSectionTitleJs';
else
this.cssClassPrefix = cssClassPrefix;
this.htmlElement;
this.contentCell;
this.titleCell;
this.title = title;



this.createElement = createElement;
function createElement()
{
this.htmlElement = document.createElement('table');
this.htmlElement.className = this.cssClassPrefix;
this.htmlElement.cellSpacing = '0px';
this.htmlElement.cellPadding = '0px';
var row = this.htmlElement.insertRow(0);

var cellRight = row.insertCell(0);
cellRight.className = this.cssClassPrefix + 'BottomRight';
var cellMiddle = row.insertCell(0);
cellMiddle.className = this.cssClassPrefix + 'BottomMiddle';
var cellLeft = row.insertCell(0);
cellLeft.className = this.cssClassPrefix + 'BottomLeft';

row = this.htmlElement.insertRow(0);
cellRight = row.insertCell(0);
cellRight.className = this.cssClassPrefix + 'Right';
this.contentCell = row.insertCell(0);
this.contentCell.className = this.cssClassPrefix + 'Middle';
cellLeft = row.insertCell(0);
cellLeft.className = this.cssClassPrefix + 'Left';

row = this.htmlElement.insertRow(0);
cellRight = row.insertCell(0);
cellRight.className = this.cssClassPrefix + 'TopRight';
this.titleCell = row.insertCell(0);
this.titleCell.className = this.cssClassPrefix + 'TopMiddle';
this.titleCell.innerHTML = this.title;
cellLeft = row.insertCell(0);
cellLeft.className = this.cssClassPrefix + 'TopLeft';

if (!enableEvents)
FfHelper.disableEvents(this.htmlElement);

return this.htmlElement;
}
}



function FfButton(className, onClick, mouseOverClassName)
{
var htmlElement;

this.getHtmlElement = getHtmlElement;
function getHtmlElement()
{
if (!htmlElement) {
htmlElement = document.createElement('div');
htmlElement.style.cursor = 'pointer';
htmlElement.className = className;
FfHelper.disableEvents(htmlElement);
htmlElement.onclick = doClick;
htmlElement.onmouseover = onMouseOver;
htmlElement.onmouseout = onMouseOut;
}
return htmlElement;
}

function doClick()
{
if (onClick) {
onClick();
}
}

function onMouseOver()
{
if (mouseOverClassName)
htmlElement.className = mouseOverClassName;
}

function onMouseOut()
{
if (mouseOverClassName)
htmlElement.className = className;
}
}
function FfDimensions(width, height)
{
this.width = width;
this.height = height;

this.setCss = setCss;
function setCss(elmnt)
{
elmnt.style.width = this.width + 'px';
elmnt.style.height = this.height + 'px';
}

this.toString = toString;
function toString()
{
return 'width = ' + this.width + ', height = ' + this.height;
}
}
function FfPosition(x, y)
{
this.x = x;
this.y = y;

this.toString = toString;
function toString()
{
return 'x = ' + this.x + ', y = ' + this.y;
}

this.setCss = setCss;
function setCss(elmnt)
{
elmnt.style.left = this.x + 'px';
elmnt.style.top = this.y + 'px';
}
}
function FfScreenHelper() { }

FfScreenHelper.getScreenDimensions = function()
{

var width = 0;
var height = 0;
if (window.innerWidth) { 
width = window.innerWidth;
height = window.innerHeight;
} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { 
width = document.documentElement.clientWidth;
height = document.documentElement.clientHeight;
} else if (document.body && (document.body.clientWidth || document.body.clientHeight )) { 
width = document.body.clientWidth;
height = document.body.clientHeight;
}
return new FfDimensions(width, height);
}

FfScreenHelper.getScrollPosition = function()
{

var x = 0, y = 0;
if(typeof(window.pageYOffset) == 'number') { 
y = window.pageYOffset;
x = window.pageXOffset;
} else if(document.body && (document.body.scrollLeft || document.body.scrollTop)) { 
y = document.body.scrollTop;
x = document.body.scrollLeft;
} else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) { 
y = document.documentElement.scrollTop;
x = document.documentElement.scrollLeft;
}
return new FfPosition(x, y);
}

FfScreenHelper.getScreenCenter = function()
{

var d = FfScreenHelper.getScreenDimensions();
return new FfPosition(Math.floor(d.width/2), Math.floor(d.height/2));
}

FfScreenHelper.getPageCenter = function()
{
var c = FfScreenHelper.getScreenCenter();
var p = FfScreenHelper.getScrollPosition();
return new FfPosition(c.x + p.x, c.y + p.y);
}
function FfGuiHelper() { }

FfGuiHelper.getAbsoluteX = function(elmnt)
{
var x = 0;
while (elmnt != null) {
x += elmnt.offsetLeft;
elmnt = elmnt.offsetParent;
}
return x;
}

FfGuiHelper.getAbsoluteY = function(elmnt)
{
var y = 0;
while (elmnt != null) {
y += elmnt.offsetTop;
elmnt = elmnt.offsetParent;
}
return y;
}

FfGuiHelper.getAbsolutePosition = function(elmnt)
{

var position = new FfPosition(0, 0);
position.x = FfGuiHelper.getAbsoluteX(elmnt);
position.y = FfGuiHelper.getAbsoluteY(elmnt);
return position;
}

FfGuiHelper.getMousePosition = function(e)
{

var position = new FfPosition(0, 0);
if (document.all) {
position.x = event.clientX + document.body.scrollLeft;
position.y = event.clientY + document.body.scrollTop;


if (!window.innerWidth) { 
position.x -= 2;
position.y -= 2;
}
} else {
position.x = e.pageX;
position.y = e.pageY;
}
if (position.x < 0)
position.x = 0;
if (position.y < 0)
position.y = 0;
return position;
}



function FfWindow(title, width, height, modal, left, top, sectionTitleCssPrefix, onCloseJs, hideHeader, fadeCssClass)
{


this.htmlId = FfHelper.getNextHtmlId();
this.cssClassPrefix = 'ffWindow';
this.htmlElement;
var htmlElement;
this.sectionTitle;
var sectionTitle;
this.title = title;
this.width = width;
this.height = height;
this.left = left;
this.top = top;
this.modal = modal;
this.titleCell;
this.sectionTitleCssPrefix = sectionTitleCssPrefix;
var visible = false;
var clearContentOnClose = false;
var originalOnMouseMove = null;
var originalOnMouseUp = null;
var mouseOffset = null;
var draggable = false;



this.createElement = createElement;
function createElement()
{
htmlElement = document.createElement('div');
this.htmlElement = htmlElement;
this.htmlElement.className = this.cssClassPrefix;
this.htmlElement.style.visibility = 'hidden';
this.htmlElement.style.block = 'none';
this.htmlElement.style.position = 'absolute';

if (this.width || this.height)
this.setDimensions(this.width, this.height);

if (this.left && this.top)
this.setPosition(this.left, this.top);
else
this.center();

sectionTitle = new FfSectionTitle('', this.sectionTitleCssPrefix, true);
this.sectionTitle = sectionTitle;
this.htmlElement.appendChild(this.sectionTitle.createElement());

var header = document.createElement('table');
header.style.width = '100%';
header.cellSpacing = '0px';
header.cellPadding = '0px';
var row = header.insertRow(0);
var cell = row.insertCell(0);
cell.style.textAlign = 'right';
cell.style.paddingLeft = '10px';
cell.style.width = '19px';
var closeButton = new FfButton('ffWindowClose', hide, 'ffWindowCloseOver');
cell.appendChild(closeButton.getHtmlElement());
this.titleCell = row.insertCell(0);
this.titleCell.style.textAlign = 'left';
this.titleCell.innerHTML = this.title;
if (!hideHeader)
this.sectionTitle.titleCell.appendChild(header);

this.titleCell.onmousedown = beginDrag;

return this.htmlElement;
}

this.setTitle = setTitle;
function setTitle(title)
{
this.title = title;
this.titleCell.innerHTML = this.title;
}

this.setPosition = setPosition;
function setPosition(left, top)
{
this.left = left;
this.top = top;
this.htmlElement.style.left = this.left + 'px';
this.htmlElement.style.top = this.top + 'px';
}

this.center = center;
function center()
{

var p = FfScreenHelper.getPageCenter();
this.setPosition(p.x - Math.floor(this.width/2), p.y - Math.floor(this.height/2));
}

this.setDimensions = setDimensions;
function setDimensions(width, height)
{
this.width = width;
this.height = height;
if (width)
this.htmlElement.style.width = width + 'px';
else
this.htmlElement.style.width = 'auto';
if (height)
this.htmlElement.style.height = height + 'px';
else
this.htmlElement.style.height = 'auto';
}

this.hide = hide;
function hide()
{
htmlElement.style.visibility = 'hidden';
htmlElement.style.display = 'none';
visible = false;
if (modal) {
FfWindow.restoreBackground();
}
if (onCloseJs)
eval(onCloseJs);
if (clearContentOnClose) {
getContentElement().innerHTML = '';
}
}

this.show = show;
function show()
{
if (modal) {
FfWindow.fadeBackground(fadeCssClass);
htmlElement.style.zIndex = '1002';
}
htmlElement.style.visibility = 'visible';
htmlElement.style.display = 'block';
visible = true;
}

this.getContentElement = getContentElement;
function getContentElement()
{
return sectionTitle.contentCell;
}

this.isVisible = isVisible;
function isVisible()
{
return visible;
}

this.setOnCloseJs = setOnCloseJs;
function setOnCloseJs(newOnCloseJs)
{
onCloseJs = newOnCloseJs;
}

this.setClearContentOnClose = function(clearContent)
{
clearContentOnClose = clearContent;
}

function processMouseMove(e)
{

var position = FfGuiHelper.getMousePosition(e);
htmlElement.style.left = (position.x - mouseOffset.x) + 'px';
htmlElement.style.top = (position.y - mouseOffset.y) + 'px';
}

function endDrag(e)
{
document.onmousemove = originalOnMouseMove;
document.onmouseup = originalOnMouseUp;
}

function beginDrag(e)
{
if (!draggable)
return;

mouseOffset = FfGuiHelper.getMousePosition(e);
mouseOffset.x = mouseOffset.x - htmlElement.offsetLeft;
mouseOffset.y = mouseOffset.y - htmlElement.offsetTop;
originalOnMouseMove = document.onmousemove;
originalOnMouseUp = document.onmouseup;
document.onmousemove = processMouseMove;
document.onmouseup = endDrag;
}

this.setDraggable = function(drag)
{
draggable = drag;
}
}

FfWindow.fadeBackground = function(cssClass)
{
if (!FfWindow.fadeElement) {
FfWindow.fadeElement = document.createElement('div');

if (document.body.offsetHeight)
FfWindow.fadeElement.style.height = document.body.offsetHeight + 'px';
document.body.appendChild(FfWindow.fadeElement);
}
if (!cssClass)
cssClass = 'ffWindowFade';
FfWindow.fadeElement.className = cssClass;
FfWindow.fadeElement.style.display = 'block';
}

FfWindow.restoreBackground = function()
{
if (FfWindow.fadeElement) {
FfWindow.fadeElement.style.display = 'none';
}
}

FfWindow.showDialog = function(title, width, height, html, left, top, sectionTitleCssPrefix, onCloseJs, clearContentOnClose)
{
if (!FfWindow.dialog) {
FfWindow.dialog = new FfWindow(title, width, height, true, left, top, sectionTitleCssPrefix, onCloseJs);
FfWindow.dialog.createElement();
document.body.appendChild(FfWindow.dialog.htmlElement);
} else {
if (width && height)
FfWindow.dialog.setDimensions(width, height);
if (top && left)
FfWindow.dialog.setPosition(left, top);
else
FfWindow.dialog.center();
FfWindow.dialog.setTitle(title);
FfWindow.dialog.setOnCloseJs(onCloseJs);
}
FfWindow.dialog.setClearContentOnClose(clearContentOnClose);
FfWindow.dialog.getContentElement().innerHTML = html;
FfWindow.dialog.show();
}

FfWindow.showMessageDialog = function(title, msg)
{
var html = 
msg 
+ '<div style="margin-top:5px;"><input class="FORMfieldsSubmit" type="submit" name="ok" value="OK" onclick="FfWindow.dialog.hide();" /></div>';
FfWindow.showDialog(title, 300, 200, html);
}
var booths = new GeBoothHolder();

function GeFpBoothHelper()
{
var selectedBoothMarker;
var lastSelectedBoothMarkerAbsCenter = new FfmPosition();
var lastSelectedBoothMarkerAreaIndex;

this.BOOTH_THICKNESS = 1;
this.HTML_BOOTH_NAME_PREFIX = 'geFpBooth';
this.COPY_BOOTH_OFFSET = 10;
this.BOOTH_DISPLAY_NUMBER_MIN_WIDTH = 30;
this.BOOTH_DISPLAY_NUMBER_MIN_HEIGHT = 10;
this.dragOk = false;
this.dragBooth;
this.corner1;
this.firstClick = true;
this.lastBoothInFocus = null;
this.prevLastBoothInFocus = null;
this.boothInFocus = false;
this.BOOTH_COLOR = 'red';
this.lastBoothDetails;

this.getBoothHtmlId = getBoothHtmlId;
function getBoothHtmlId(booth)
{
return this.HTML_BOOTH_NAME_PREFIX + booth.id;
}

this.getBoothId = getBoothId;
function getBoothId(htmlBoothId)
{
return htmlBoothId.substring(this.HTML_BOOTH_NAME_PREFIX.length);
}

this.getDimensions = getDimensions;
function getDimensions(booth)
{
var left = Math.round(ffmGlobals.currentScale*booth.x);
var top = Math.round(ffmGlobals.currentScale*booth.y);

var width = Math.round(ffmGlobals.currentScale*booth.width) - this.BOOTH_THICKNESS;
if (width <= 0)
width = 1;

var height = Math.round(ffmGlobals.currentScale*booth.height) - this.BOOTH_THICKNESS;
if (height <= 0)
height = 1;
return new FfmRectangle(left, top, width, height);
}

this.createBoothElement = createBoothElement;
function createBoothElement(booth)
{
var div = document.createElement('div');
div.id = this.getBoothHtmlId(booth);
div.className = 'geFpBooth';

var d = this.getDimensions(booth);
div.style.left = d.left + 'px';
div.style.top = d.top + 'px';
div.style.width = d.width + 'px';
div.style.height = d.height + 'px';
div.style.border = this.BOOTH_THICKNESS + 'px solid ' + this.BOOTH_COLOR;

if (d.width >= this.BOOTH_DISPLAY_NUMBER_MIN_WIDTH && d.height >= this.BOOTH_DISPLAY_NUMBER_MIN_HEIGHT) {
div.innerHTML = booth.number;
}

div.onmouseover = GeFpBoothHelperBoothMouseOver;
div.onmouseout = GeFpBoothHelperBoothMouseOut;


div.onmousemove = FfmDisableEvent;
div.onclick = FfmDisableEvent;
div.onmousedown = FfmDisableEvent;
div.onmouseup = FfmDisableEvent;

return div;
}

this.printBooth = printBooth;
function printBooth(booth)
{
booth.htmlElement = this.createBoothElement(booth);
ffmViewer.getGridElement().appendChild(booth.htmlElement);
}

this.boothMouseOver = boothMouseOver;
function boothMouseOver(elmnt)
{
this.doUnhighlightBooth(true);
elmnt.className = 'geFpBoothSelected';
if (this.prevLastBoothInFocus != this.lastBoothInFocus) {
this.prevLastBoothInFocus = this.lastBoothInFocus;
}
this.lastBoothInFocus = elmnt;
this.boothInFocus = true;
}

this.doUnhighlightBooth = doUnhighlightBooth;
function doUnhighlightBooth(always)
{
var elmnt = this.lastBoothInFocus;

if (!elmnt)
return;
if (always || !this.boothInFocus) {
document.getElementById(elmnt.id).className = 'geFpBooth';
}
}

this.getHighlightedBoothNumber = getHighlightedBoothNumber;
function getHighlightedBoothNumber()
{
var elmnt = this.lastBoothInFocus;
if (!elmnt || !this.boothInFocus)
return null;
return elmnt.innerHTML;
}


this.getHighlightedBoothCenter = getHighlightedBoothCenter;
function getHighlightedBoothCenter()
{
var elmnt = this.lastBoothInFocus;
if (!elmnt || !this.boothInFocus)
return null;
var x = (elmnt.offsetLeft + Math.round(elmnt.offsetWidth/2))/ffmGlobals.currentScale;
var y = (elmnt.offsetTop + Math.round(elmnt.offsetHeight/2))/ffmGlobals.currentScale;
return new FfmPosition(x, y);
}

this.unhighlightBooth = unhighlightBooth;
function unhighlightBooth()
{
setTimeout('boothHelper.doUnhighlightBooth()', 1000);
}

this.boothMouseOut = boothMouseOut;
function boothMouseOut()
{
this.boothInFocus = false;
this.unhighlightBooth();
}

this.isBooth = isBooth;
function isBooth(elmnt)
{
if (elmnt.className == 'geFpBooth' || elmnt.className == 'geFpSelected')
return true;
return false;
}

this.inBooth = inBooth;
function inBooth()
{
return this.boothInFocus;
}


this.processBoothDrag = processBoothDrag;
function processBoothDrag(e)
{
var elmnt = boothHelper.dragBooth;
elmnt.style.cursor = 'move';
var position = ffmh.getMousePosition(e);
var dx = position.x - boothHelper.mouseLastPosition.x;
var dy = position.y - boothHelper.mouseLastPosition.y;
if (boothHelper.dragOk) {
boothHelper.moveBooth(elmnt, dx, dy);
}
boothHelper.mouseLastPosition = position;
}

this.startBoothDrag = startBoothDrag;
function startBoothDrag(e)
{
this.mouseLastPosition = ffmh.getMousePosition(e);
this.dragOk = true;
this.dragBooth = ffmh.getMouseTarget(e);

ffmViewer.onMouseMove = boothHelper.processBoothDrag;
}

this.stopBoothDragIfNeeded = stopBoothDragIfNeeded;
function stopBoothDragIfNeeded()
{
if (this.dragOk) {
this.stopBoothDrag();
}
}

this.saveBooth = saveBooth;
function saveBooth(elmnt)
{
var x = elmnt.offsetLeft/ffmGlobals.currentScale;
var y = elmnt.offsetTop/ffmGlobals.currentScale;
var boothId = this.getBoothId(elmnt.id);
var booth = booths.getBooth(boothId);
mediator.editBooth(booth.id, booth.number, x, y, booth.width, booth.height, booth.bgId, booth.isManual, booth.displayText, booth.actualWidth, booth.actualHeight);
}

this.stopBoothDrag = stopBoothDrag;
function stopBoothDrag(e)
{
this.dragOk = false;
var elmnt = this.dragBooth;
elmnt.style.cursor = 'hand';
this.saveBooth(elmnt);

ffmViewer.onMouseMove = null;
}

this.getBooth = getBooth;
function getBooth(booth)
{
var boothElmnt = document.getElementById(this.getBoothHtmlId(booth));
if (!boothElmnt) {
this.printBooth(booth);
}
return boothElmnt;
}

this.showBooth = showBooth;
function showBooth(booth)
{
var boothElmnt = this.getBooth(booth);

if (boothElmnt) {
boothElmnt.style.visibility = 'visible';

}
}

this.hideBooth = hideBooth;
function hideBooth(booth)
{
var boothElmnt = this.getBooth(booth);

boothElmnt.style.visibility = 'hidden';
}

this.showBooths = showBooths;
function showBooths()
{
for (var i = 0; i < booths.booths.length; i++) {
this.showBooth(booths.booths[i]);
}
}

this.loadBooths = function()
{
for (var i = 0; i < booths.booths.length; i++) {
var booth = booths.booths[i];
var elmnt = this.getBooth(booth);
if (elmnt) {
booth.htmlElement = elmnt;
this.resizeBooth(booth);
}
}
}

this.resizeBooth = resizeBooth;
function resizeBooth(booth)
{

var boothElmnt = booth.htmlElement; 
var d = this.getDimensions(booth);
boothElmnt.style.left = d.left + 'px';
boothElmnt.style.top = d.top + 'px';
boothElmnt.style.width = d.width + 'px';
boothElmnt.style.height = d.height + 'px';
boothNumber = '';
if (d.width >= this.BOOTH_DISPLAY_NUMBER_MIN_WIDTH && d.height >= this.BOOTH_DISPLAY_NUMBER_MIN_HEIGHT) {
boothNumber = booth.number;
}
boothElmnt.innerHTML = boothNumber;
this.doUnhighlightBooth(true);
}

this.resizeBooths = resizeBooths;
function resizeBooths()
{
for (var i = 0; i < booths.booths.length; i++) {
this.resizeBooth(booths.booths[i]);
}
}

this.moveBooth = moveBooth;
function moveBooth(elmnt, dx, dy)
{
var boothId = this.getBoothId(elmnt.id);
elmnt.style.left = (elmnt.offsetLeft + dx) + 'px';
elmnt.style.top = (elmnt.offsetTop + dy) + 'px';
}

this.nudgeBooth = nudgeBooth;
function nudgeBooth(dx, dy)
{
var elmnt = this.lastBoothInFocus;
this.moveBooth(elmnt, dx, dy);
this.saveBooth(elmnt);
}

this.processNewBoothClick = processNewBoothClick;
function processNewBoothClick(e)
{
if (this.firstClick) {
this.corner1 = ffmh.getMousePosition(e);
} else {
var viewer = ffmViewer.getViewerElement();
var offsetX = ffmh.getAbsoluteX(viewer) - ffmViewer.view.offsetX;
var offsetY = ffmh.getAbsoluteY(viewer) - ffmViewer.view.offsetY;
var scale = ffmGlobals.currentScale;
var corner2 = ffmh.getMousePosition(e);
var left = (Math.min(corner2.x, this.corner1.x) - offsetX)/scale;
var top = (Math.min(corner2.y, this.corner1.y) - offsetY)/scale;
var width = Math.abs(corner2.x - this.corner1.x)/scale;
var height = Math.abs(corner2.y - this.corner1.y)/scale;
if (width > 10 && height > 10) {
var booth = new GeBooth(left, top, width, height);
mediator.newBooth(booth);
}
}
this.firstClick = !this.firstClick;
}

this.confirmBoothDelete = confirmBoothDelete;
function confirmBoothDelete()
{
var elmnt = this.lastBoothInFocus;
if (this.boothInFocus && elmnt && confirm('Are you sure you want to delete this booth?')) {
var boothId = this.getBoothId(elmnt.id);
var booth = booths.getBooth(boothId);
mediator.deleteBooth(boothId);
this.hideBooth(booth);
this.lastBoothInFocus = null;
}
}

this.clearAllBooths = clearAllBooths;
function clearAllBooths()
{
for (var i = 0; i < booths.booths.length; i++) {
this.hideBooth(booths.booths[i]);
}
booths.booths = new Array();
}

this.editBoothNumber = editBoothNumber;
function editBoothNumber()
{
if (!this.boothInFocus)
return;
var elmnt = this.lastBoothInFocus;
var boothId = this.getBoothId(elmnt.id);
var booth = booths.getBooth(boothId);
var bn = prompt("Booth Number:", booth.number);
if (bn && bn != booth.number) {
elmnt.innerHTML = bn;
booth.number = bn;
this.saveBooth(elmnt);
}
}

this.clearBoothNumber = clearBoothNumber;
function clearBoothNumber(boothId)
{
var booth = booths.getBooth(boothId);
booth.number = '';
var boothElmnt = this.getBooth(booth);

boothElmnt.innerHTML = '';
}

this.editBoothBackground = editBoothBackground;
function editBoothBackground()
{
if (!this.boothInFocus)
return;
var elmnt = this.lastBoothInFocus;
var boothId = this.getBoothId(elmnt.id);
var booth = booths.getBooth(boothId);
var bi = prompt("Background ID:", booth.bgId);
if (bi && bi != booth.bgId) {
booth.bgId = bi;
this.saveBooth(elmnt);
}
}

this.editBoothManual = editBoothManual;
function editBoothManual()
{
if (!this.boothInFocus)
return;
var elmnt = this.lastBoothInFocus;
var boothId = this.getBoothId(elmnt.id);
var booth = booths.getBooth(boothId);
var v = prompt("Is Manual? (True if booth shouldn't be affected by any automated import)", booth.isManual);
if (v && v != booth.isManual) {
booth.isManual = v;
this.saveBooth(elmnt);
}
}

this.editDisplayText = editDisplayText;
function editDisplayText()
{
if (!this.boothInFocus)
return;
var elmnt = this.lastBoothInFocus;
var boothId = this.getBoothId(elmnt.id);
var booth = booths.getBooth(boothId);
var v = prompt("Display Text", booth.displayText);
if (!v)
v = '';
if (v != booth.displayText) {
if (v == '')
booth.displayText = booth.number;
else
booth.displayText = v;
this.saveBooth(elmnt);
if (v == '')
booth.displayText = '';
}
}

this.editBoothReservation = function()
{
if (!this.boothInFocus)
return;
var elmnt = this.lastBoothInFocus;
var fpBoothId = this.getBoothId(elmnt.id);
var booth = booths.getBooth(fpBoothId);
GeBoothWindow.show(fpBoothId, booth.number);
}

this.viewBoothUrl = function()
{
if (!this.boothInFocus)
return;
var elmnt = this.lastBoothInFocus;
var fpBoothId = this.getBoothId(elmnt.id);



var html = '<textarea style="width:650px;">' + FfPaths.FF_ROOT_URL + '/../goExpo/floorPlan/viewFloorPlan.php?bi=' + fpBoothId + '</textarea>';
FfWindow.showDialog('Booth URL:', 700, 150, html);
}

this.copyBooth = copyBooth;
function copyBooth()
{
if (!this.boothInFocus)
return;
var elmnt = this.lastBoothInFocus;
var boothId = this.getBoothId(elmnt.id);
var booth = booths.getBooth(boothId);
var newBooth = new GeBooth();
newBooth.copy(booth);
newBooth.number = '';
newBooth.x = parseInt(newBooth.x) + this.COPY_BOOTH_OFFSET/ffmGlobals.currentScale;
newBooth.y = parseInt(newBooth.y) + this.COPY_BOOTH_OFFSET/ffmGlobals.currentScale;
newBooth.isManual = true;
mediator.newBooth(newBooth);
this.unhighlightBooth();
}

this.newBoothWithPrompt = newBoothWithPrompt;
function newBoothWithPrompt()
{
var width = prompt("Booth Width:", 0);
var height = prompt("Booth Height:", 0);
if (width < 10 || height < 10)
return;
var ac = ffmViewer.view.getCenterAbsolute();
var newBooth = new GeBooth(ac.x, ac.y, width, height);
mediator.newBooth(newBooth);
}

this.combineBooths = function()
{
if (!this.lastBoothInFocus 
    || !this.prevLastBoothInFocus 
    || this.lastBoothInFocus == this.prevLastBoothInFocus)
return;
var lastBoothId = this.getBoothId(this.lastBoothInFocus.id);
var lastBooth = booths.getBooth(lastBoothId);
var prevLastBoothId = this.getBoothId(this.prevLastBoothInFocus.id);
var prevLastBooth = booths.getBooth(prevLastBoothId);
if (!confirm('Are you sure you want to combine booths ' + prevLastBooth.number + ' and ' + lastBooth.number + '?'))
return;
var right = Math.max(prevLastBooth.x + prevLastBooth.width, lastBooth.x + lastBooth.width);
var bottom = Math.max(prevLastBooth.y + prevLastBooth.height, lastBooth.y + lastBooth.height);
prevLastBooth.x = Math.min(prevLastBooth.x, lastBooth.x);
prevLastBooth.y = Math.min(prevLastBooth.y, lastBooth.y);
prevLastBooth.width = right - prevLastBooth.x;
prevLastBooth.height = bottom - prevLastBooth.y;
prevLastBooth.calculateActualDimensions();
mediator.editBooth(prevLastBooth.id, prevLastBooth.number, prevLastBooth.x, prevLastBooth.y, prevLastBooth.width, prevLastBooth.height, prevLastBooth.bgId, prevLastBooth.isManual, prevLastBooth.displayText, prevLastBooth.actualWidth, prevLastBooth.actualHeight);
mediator.deleteBooth(lastBoothId);
this.hideBooth(lastBooth);
this.resizeBooth(prevLastBooth);
}

this.resizeBoothWithPrompt = resizeBoothWithPrompt;
function resizeBoothWithPrompt()
{
if (!this.boothInFocus)
return;
var elmnt = this.lastBoothInFocus;
var boothId = this.getBoothId(elmnt.id);
var booth = booths.getBooth(boothId);
var width = prompt("Booth Width in Pixels:", booth.width);
if (width) {
booth.width = width;
}
var height = prompt("Booth Height in Pixels:", booth.height);
if (height) {
booth.height = height;
}
if (width < 10 || height < 10)
return;
booth.calculateActualDimensions();
mediator.editBooth(booth.id, booth.number, booth.x, booth.y, booth.width, booth.height, booth.bgId, booth.isManual, booth.displayText, booth.actualWidth, booth.actualHeight);
this.resizeBooth(booth);
}

this.resizeActualBoothWithPrompt = function()
{
if (!this.boothInFocus)
return;
var elmnt = this.lastBoothInFocus;
var boothId = this.getBoothId(elmnt.id);
var booth = booths.getBooth(boothId);
var width = prompt("Actual Booth Width:", booth.actualWidth);
if (width)
booth.actualWidth = width;
var height = prompt("Actual Booth Height:", booth.actualHeight);
if (height)
booth.actualHeight = height;
if (width < 10 || height < 10)
return;
booth.calculatePixelDimensions();
mediator.editBooth(booth.id, booth.number, booth.x, booth.y, booth.width, booth.height, booth.bgId, booth.isManual, booth.displayText, booth.actualWidth, booth.actualHeight);
this.resizeBooth(booth);
}

this.printBoothRectangle = printBoothRectangle;
function printBoothRectangle()
{
if (!this.boothInFocus)
return;
var elmnt = this.lastBoothInFocus;
var boothId = this.getBoothId(elmnt.id);
var booth = booths.getBooth(boothId);
alert('x = ' + booth.x + ', y = ' + booth.y + ', width = ' + booth.width + ', height = ' + booth.height);
}




this.processBoothDetailsResponse = processBoothDetailsResponse;
function processBoothDetailsResponse(xmlHttp)
{
if (xmlHttp.responseXML && xmlHttp.responseXML.documentElement) {
var boothDetails = new GeBoothDetails();
boothDetails.readFromXml(xmlHttp.responseXML.documentElement);


geFpBoothDetails.show(boothDetails);
boothHelper.lastBoothDetails = boothDetails;



if (!ffmConfig.CAN_EDIT) {
geFpSelectedBooth.show(boothDetails);
searcher.unselectExhibitor();
}
}
}

this.showBoothDetails = showBoothDetails;
function showBoothDetails(x, y)
{
mediator.getBoothDetails(x, y, boothHelper.processBoothDetailsResponse);
}

this.showBoothDetailsForBoothId = showBoothDetailsForBoothId;
function showBoothDetailsForBoothId(boothId)
{
mediator.getBoothDetailsForBoothId(boothId, boothHelper.processBoothDetailsResponse);
}

this.showLastBoothDetails = showLastBoothDetails;
function showLastBoothDetails()
{
if (this.lastBoothDetails) {
if (geFpBoothDetails.isVisible())
geFpBoothDetails.show(this.lastBoothDetails);
geFpSelectedBooth.show(this.lastBoothDetails);
}
}

this.showSelectedBoothMarker = showSelectedBoothMarker;
function showSelectedBoothMarker(boothCenterX, boothCenterY)
{
if (!selectedBoothMarker) {
selectedBoothMarker = document.createElement('div');
selectedBoothMarker.style.position = 'absolute';
selectedBoothMarker.style.zIndex = '209';
selectedBoothMarker.style.cursor = 'pointer';
ffmViewer.getGridElement().appendChild(selectedBoothMarker);
}

var html = '';
html += '<object style="cursor:pointer;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="80" height="80" id="selectedBooth" align="middle">';
html += '<param name="allowScriptAccess" value="sameDomain" />';
html += '<param name="movie" value="' + FfPaths.FF_ROOT_URL + '/../goExpo/floorPlan/images/selectedBooth.swf" />';
html += '<param name="quality" value="high" />';
html += '<param name="wmode" value="transparent" />';
html += '<param name="bgcolor" value="#ffffff" />';
html += '<embed src="' + FfPaths.FF_ROOT_URL + '/../goExpo/floorPlan/images/selectedBooth.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="80" height="80" name="selectedBooth" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
html += '</object>';
selectedBoothMarker.innerHTML = html;

var offsetX = Math.round(selectedBoothMarker.offsetWidth/2);
selectedBoothMarker.style.left = (boothCenterX*ffmGlobals.currentScale - offsetX) + 'px';
var offsetY = Math.round(selectedBoothMarker.offsetHeight/2);
selectedBoothMarker.style.top = (boothCenterY*ffmGlobals.currentScale - offsetY) + 'px';
lastSelectedBoothMarkerAbsCenter.x = boothCenterX;
lastSelectedBoothMarkerAbsCenter.y = boothCenterY;
lastSelectedBoothMarkerAreaIndex = geFloorPlan.currentAreaIndex;
selectedBoothMarker.style.visibility = 'visible';
}

this.resizeSelectedBoothMarker = resizeSelectedBoothMarker;
function resizeSelectedBoothMarker()
{
if (!selectedBoothMarker)
return;
if (lastSelectedBoothMarkerAreaIndex == geFloorPlan.currentAreaIndex) {
showSelectedBoothMarker(lastSelectedBoothMarkerAbsCenter.x, lastSelectedBoothMarkerAbsCenter.y);
}
}

this.hideOrShowSelectedBoothMarker = hideOrShowSelectedBoothMarker;
function hideOrShowSelectedBoothMarker()
{
if (!selectedBoothMarker)
return;
if (lastSelectedBoothMarkerAreaIndex == geFloorPlan.currentAreaIndex) {
selectedBoothMarker.style.visibility = 'visible';
} else {
selectedBoothMarker.style.visibility = 'hidden';
}
}

this.centerOnExhibitor = centerOnExhibitor;
function centerOnExhibitor(boothNumber, exhibitorId, areaId, boothCenterX, boothCenterY)  
{

this.doCenterOnBoothNew(boothNumber, exhibitorId, areaId, boothCenterX, boothCenterY);
}

this.doCenterOnBoothNew = doCenterOnBoothNew;
function doCenterOnBoothNew(boothNumber, exhibitorId, areaId, boothCenterX, boothCenterY) 
{

geFloorPlan.ignoreBoothPopup = true;
geFloorPlan.selectAreaId(areaId, true);
geFloorPlan.ignoreBoothPopup = false;

ffmViewer.zoomInFull(true);


var offset = 0;
if (ffmViewer.view.width < 800)
offset = 100;
ffmViewer.panCenterToAbsolute(boothCenterX + offset, boothCenterY - offset);

GeFpGuiMediator.showBoothPopup(boothNumber, exhibitorId, boothCenterX, boothCenterY);
}


this.doCenterOnBooth = doCenterOnBooth;
function doCenterOnBooth(boothDetails)
{
var boothDetail = boothDetails.boothDetails[0];


geFloorPlan.selectAreaId(boothDetail.areaId);

var boothCenterX = boothDetail.x + boothDetail.width/2;
var boothCenterY = boothDetail.y + boothDetail.height/2;
ffmViewer.zoomInFull(true);


var offset = 0;
if (ffmViewer.view.width < 800)
offset = 100;
ffmViewer.panCenterToAbsolute(boothCenterX*ffmGlobals.currentScale + offset, boothCenterY*ffmGlobals.currentScale - offset);

geFpBoothDetails.show(boothDetails); 
geFpSelectedBooth.show(boothDetails);
}


this.processBoothResponse = processBoothResponse;
function processBoothResponse(xmlHttp)
{
if (xmlHttp.responseXML && xmlHttp.responseXML.documentElement) {
var boothDetails = new GeBoothDetails();
boothDetails.readFromXml(xmlHttp.responseXML.documentElement);

boothHelper.doCenterOnBooth(boothDetails);
boothHelper.lastBoothDetails = boothDetails;
}
}



this.boothKeyUp = boothKeyUp;
function boothKeyUp(e)
{
if (!e) e = window.event;
var keyCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;


if (keyCode == 46) { 
this.confirmBoothDelete();
} else if (keyCode == 87) { 
this.nudgeBooth(0, -1);
} else if (keyCode == 83) { 
this.nudgeBooth(0, 1);
} else if (keyCode == 65) { 
this.nudgeBooth(-1, 0);
} else if (keyCode == 68) { 
this.nudgeBooth(1, 0);
} else if (keyCode == 67) { 
this.copyBooth();
} else if (keyCode == 69) { 
this.editBoothNumber();
} else if (keyCode == 78) { 
this.newBoothWithPrompt();
} else if (keyCode == 82) { 
this.resizeBoothWithPrompt();
} else if (keyCode == 80) { 
this.printBoothRectangle();
} else if (keyCode == 66) { 
geFloorPlan.showBoothDetails();
} else if (keyCode == 84) { 
this.editBoothBackground();
} else if (keyCode == 79) { 
geFloorPlan.toggleShowBgBooths()
} else if (keyCode == 72) { 
geFloorPlan.toggleShowBgImage()
} else if (keyCode == 77) { 
this.editBoothManual();
} else if (keyCode == 89) { 
this.editDisplayText();
} else if (keyCode == 81) { 
this.editBoothReservation();
} else if (keyCode == 85) { 
this.viewBoothUrl();
} else if (keyCode == 86) { 
this.resizeActualBoothWithPrompt();
} else if (keyCode == 70) { 
this.combineBooths();
}
}
}
var boothHelper = new GeFpBoothHelper();

function GeFpBoothHelperBoothMouseOver(e)
{

var elmnt = ffmh.getEventTarget(e);
boothHelper.boothMouseOver(elmnt);
}

function GeFpBoothHelperBoothMouseOut()
{

boothHelper.boothMouseOut();
}




function GeFpSelectedBooth()
{
this.HTML_ID = 'geFpBoothHighlightedId';
this.BORDER_SIZE = '2';
this.BORDER_COLOR = 'blue';

this.getElement = getElement;
function getElement()
{
return document.getElementById(this.HTML_ID);
}

this.getElementOrCreate = getElementOrCreate;
function getElementOrCreate(boothDetails)
{
var elmnt = this.getElement();
if (!elmnt) {
elmnt = this.createElement(boothDetails);
ffmViewer.getGridElement().appendChild(elmnt);
}
return elmnt;
}

this.getBoothRectangle = getBoothRectangle;
function getBoothRectangle(boothDetails)
{
var boothDetail = boothDetails.boothDetails[0];
var left = boothDetail.x*ffmGlobals.currentScale - this.BORDER_SIZE/2;
var top = boothDetail.y*ffmGlobals.currentScale - this.BORDER_SIZE/2;
var width = boothDetail.width*ffmGlobals.currentScale - this.BORDER_SIZE/2;
var height = boothDetail.height*ffmGlobals.currentScale - this.BORDER_SIZE/2;
return new FfmRectangle(left, top, width, height);
}

this.createElement = createElement;
function createElement(boothDetails)
{
var div = document.createElement('div');
div.id = this.HTML_ID;
div.className = 'geFpBoothHighlighted';

var r = this.getBoothRectangle(boothDetails);
r.setCss(div);
div.style.border = this.BORDER_SIZE + 'px solid ' + this.BORDER_COLOR;

ffmh.disableMouseEvents(div);

return div;
}

this.hide = hide;
function hide()
{
var elmnt = this.getElement();
if (elmnt) {
elmnt.style.visibility = 'hidden';
}
}

this.show = show;
function show(boothDetails)
{
var elmnt = this.getElementOrCreate(boothDetails);
var r = this.getBoothRectangle(boothDetails);
r.setCss(elmnt);
elmnt.style.visibility = 'visible';
}

this.isMouseInElement = isMouseInElement;
function isMouseInElement(e, mousePosition)
{
var elmnt = this.getElement();
if (!elmnt) {
return false;
}
return ffmh.mouseInElement(e, elmnt, mousePosition);
}
}
var geFpSelectedBooth = new GeFpSelectedBooth();



function GeFpBoothDetails()
{
this.HTML_ID = 'geFpBoothDetailsId';
this.WIDTH = 250;
this.HEIGHT = 250;
this.OFFSET = 10;

this.getElement = getElement;
function getElement()
{
return document.getElementById(this.HTML_ID);
}

this.getElementOrCreate = getElementOrCreate;
function getElementOrCreate(boothDetails)
{
var elmnt = this.getElement();
if (!elmnt) {
elmnt = this.createElement(boothDetails);
ffmViewer.getGridElement().appendChild(elmnt);
}
return elmnt;
}


this.getPosition = getPosition;
function getPosition(boothDetails)
{
var boothDetail = boothDetails.boothDetails[0];
var boothCenterX = boothDetail.x + boothDetail.width/2;
var boothCenterY = boothDetail.y + boothDetail.height/2;

var c = ffmViewer.view.getCenterAbsolute();

var left = 0;
var top = 0;

var scale = ffmGlobals.currentScale;

var y = boothCenterY*scale - ffmViewer.view.offsetY;
var h = ffmViewer.view.height/3;
var row = Math.ceil(y/h);


var x = boothCenterX*scale - ffmViewer.view.offsetX;
var w = ffmViewer.view.width/3;
var column = Math.ceil(x/w);


if (row == 2 && column == 2) { 
row = 1;
column = 3;
} else if (row == 2 && column == 3) {

} else if (row == 3 && column == 2) {

}

if (row <= 1) {

top = (boothCenterY + this.OFFSET)*scale;
} else if (row == 2) {
top = (boothCenterY - this.OFFSET)*scale - this.HEIGHT/2;
} else if (row >= 3) {
top = (boothCenterY - this.OFFSET)*scale - this.HEIGHT;
}

if (column <= 1) {
left = (boothCenterX + this.OFFSET)*scale;
} else if (column == 2) {
left = (boothCenterX - this.OFFSET)*scale - this.WIDTH/2;
} else if (column >= 3) {
left = (boothCenterX - this.OFFSET)*scale - this.WIDTH;
}

return new FfmPosition(left, top);
}

this.getContentHtml = getContentHtml;
function getContentHtml(boothDetails)
{
var boothDetail = boothDetails.boothDetails[0];

var detailsImage = 'images/boothDetails.png';


if (ffmConfig.IS_IE_6) {
detailsImage = 'images/boothDetails.gif';
}

var html = '';
html += '<img src="' + detailsImage + '" />';
html += '<div class="geFpBoothDetailsContent" id="geFpBoothDetailsContentId">';
html += '<img class="geFpBoothDetailsContentClose" id="geFpBoothDetailsWindowCloseId" src="images/ffWindowClose.png" alt="Close" />';
html += '<div class="geFpBoothDetailsContentNumber">Booth ' + boothDetail.number + '</div>';
html += '<div class="geFpBoothDetailsContentContainer" id="geFpBoothDetailsContentContainerId">';
var maxWidth = (boothDetails.boothDetails.length > 1 ? 190 : 210);
var maxHeight = 50;

var exhibitorAssigned = false;
for (var i = 0; i < boothDetails.boothDetails.length; i++) {
var boothDetail = boothDetails.boothDetails[i];
if (boothDetail.company) { 
exhibitorAssigned = true;
break;
}
}

var j = 0;
if (exhibitorAssigned) {
for (var i = 0; i < boothDetails.boothDetails.length; i++) {
var boothDetail = boothDetails.boothDetails[i];
if (boothDetail.company) { 
if (j++ > 0) {
html += '<div class="geFpBoothDetailsContentDivider"></div>';
}
if (boothDetail.logoUrl) {
var logoDimensions = boothDetail.getScaledImageDimensions(maxWidth, maxHeight);
html += '<div class="geFpBoothDetailsContentLogo"><img src="' + boothDetail.logoUrl + '" width="' + logoDimensions.width + '" height="' + logoDimensions.height + '" alt="' + boothDetails.company + '" /></div>';
}
html += '<div class="geFpBoothDetailsContentCompany">' + boothDetail.company + '</div>';
html += '<div class="geFpBoothDetailsContentCategories">' + boothDetail.categories + '</div>';
if (boothDetail.description)
html += '<div class="geFpBoothDetailsContentDescription">' + boothDetail.description.substring(0, 100) + '...</div>';
html += '<div class="geFpBoothDetailsContentUrl"><a class="geFpBoothDetailContentUrl" href="" onclick="window.location.href=\'' + boothDetail.profileUrl + '\';">View Company Information</a></div>';
}
}
} else {
html += '<div class="geFpBoothDetailsContentCompany">This booth is available.</div>';
}

html += '</div>';
html += '</div>';

return html;
}

this.createElement = createElement;
function createElement(boothDetails)
{
var div = document.createElement('div');
div.id = this.HTML_ID;
div.className = 'geFpBoothDetails';

var p = this.getPosition(boothDetails);
p.setCss(div);
div.style.width = this.WIDTH + 'px';
div.style.height = this.HEIGHT + 'px';
ffmh.disableMouseEvents(div);

div.innerHTML = this.getContentHtml(boothDetails);

return div;
}

this.hide = hide;
function hide()
{
var elmnt = this.getElement();
if (elmnt) {
elmnt.style.visibility = 'hidden';
}
}

this.show = show;
function show(boothDetails)
{
var elmnt = this.getElementOrCreate(boothDetails);
var p = this.getPosition(boothDetails);
p.setCss(elmnt);
elmnt.innerHTML = this.getContentHtml(boothDetails);
var container = document.getElementById('geFpBoothDetailsContentContainerId');
if (boothDetails.boothDetails.length > 1) {

container.style.overflow = 'auto';
} else {
container.style.overflow = 'hidden';
}
elmnt.style.visibility = 'visible';
}

this.isMouseInElement = isMouseInElement;
function isMouseInElement(e, mousePosition)
{
var elmnt = this.getElement();
if (!elmnt) {
return false;
}
return ffmh.mouseInElement(e, elmnt, mousePosition);
}

this.isVisible = isVisible;
function isVisible()
{
var elmnt = this.getElement();
if (!elmnt) {
return false;
}
if (elmnt.style.visibility == 'visible')
return true;
return false;
}

this.isMouseInWindowClose = isMouseInWindowClose;
function isMouseInWindowClose(e, mousePosition)
{
var elmnt = document.getElementById('geFpBoothDetailsWindowCloseId');
if (!elmnt) {
return false;
}
return ffmh.mouseInElement(e, elmnt, mousePosition);
}
}
var geFpBoothDetails = new GeFpBoothDetails();
function FfResizeAnimator() { }

FfResizeAnimator.resize = function(htmlId, endHeight, startHeight, heightDelta, endWidth, startWidth, widthDelta, sleepMs, doneJs)
{
var element = document.getElementById(htmlId);
if (!element || element.resizing) {
return false;
}
element.resizing = true;
if (!sleepMs) {
sleepMs = 40;
}
if (endHeight != null) {
if (!startHeight)
startHeight = 0;
if (!heightDelta) {
heightDelta = 40;
if (endHeight < startHeight)
heightDelta *= -1;
}
element.style.height = startHeight + 'px';
} else {
endHeight = null;
heightDelta = null;
}
if (endWidth != null) {
if (!startWidth)
startWidth = 0;
if (!widthDelta) {
widthDelta = 40;
if (endWidth < startWidth)
widthDelta *= -1;
}
element.style.width = startWidth + 'px';
} else {
endWidth = null;
widthDelta = null;
}
FfResizeAnimator.doResize(htmlId, endHeight, heightDelta, endWidth, widthDelta, sleepMs, doneJs);
return true;
}

FfResizeAnimator.doResize = function(htmlId, endHeight, heightDelta, endWidth, widthDelta, sleepMs, doneJs)
{
var element = document.getElementById(htmlId);
if (!element)
return;
if (endHeight != null) {
if (heightDelta > 0) { 
heightDelta = Math.min(heightDelta, endHeight - element.offsetHeight);
} else {
heightDelta = Math.max(heightDelta, endHeight - element.offsetHeight);
}
var oldOffset = element.offsetHeight;
element.style.height = (element.offsetHeight + heightDelta) + 'px';
if (oldOffset == element.offsetHeight) 
heightDelta = 0;
} else {
heightDelta = 0;
}
if (endWidth != null) {
if (widthDelta > 0) { 
widthDelta = Math.min(widthDelta, endWidth - element.offsetWidth);
} else {
widthDelta = Math.max(widthDelta, endWidth - element.offsetWidth);
}
var oldOffset = element.offsetWidth;
element.style.width = (element.offsetWidth + widthDelta) + 'px';
if (oldOffset == element.offsetWidth) 
widthDelta = 0;
} else {
widthDelta = 0;
}
if (heightDelta == 0 && widthDelta == 0) {
element.resizing = false;
if (doneJs)
eval(doneJs);
return;
}
if (doneJs)
doneJs = doneJs.replace(/'/g, "\\'");
setTimeout('FfResizeAnimator.doResize(\'' + htmlId + '\',' + endHeight + ',' + heightDelta + ',' + endWidth + ',' + widthDelta + ',' + sleepMs + ',\'' + doneJs + '\');', sleepMs);
}
function FfFader() { }

FfFader.fade = function(htmlId, fadeIn, opacity, opacityDelta, sleepMs, doneJs)
{
var element = document.getElementById(htmlId);
if (!element || element.fading)
return false;
element.fading = true;
if (!opacity) {
opacity = 0.001; 
if (!fadeIn)
opacity = 1;
}
if (!opacityDelta) {
opacityDelta = 0.10;
if (!fadeIn)
opacityDelta *= -1;
}
if (!sleepMs) {
sleepMs = 30;
}
FfFader.doFade(htmlId, opacity, opacityDelta, sleepMs, doneJs);
return true;
}

FfFader.doFade = function(htmlId, opacity, opacityDelta, sleepMs, doneJs)
{
var element = document.getElementById(htmlId);
if (!element)
return;
element.style.opacity = opacity; 
element.style.filter = 'alpha(opacity=' + Math.round(opacity*100) + ')'; 
if (opacityDelta > 0) { 
if (opacity >= 1) {
element.fading = false;
if (doneJs)
eval(doneJs)
return;
}
} else { 
if (opacity <= 0) {
element.fading = false;
if (doneJs)
eval(doneJs)
return;
}
}
opacity += opacityDelta;
if (opacity < 0)
opacity = 0;
else if (opacity > 1)
opacity = 1;
if (doneJs)
doneJs = doneJs.replace(/'/g, "\\'");
setTimeout('FfFader.doFade(\'' + htmlId + '\',' + opacity + ',' + opacityDelta + ',' + sleepMs + ',\'' + doneJs + '\');', sleepMs);
}

FfFader.fadeIn = function(htmlId, doneJs)
{
return FfFader.fade(htmlId, true, null, null, null, doneJs);
}

FfFader.fadeOut = function(htmlId, doneJs)
{
return FfFader.fade(htmlId, false, null, null, null, doneJs);
}






function FfSearchPanel(label, searchFunction, paneHeight, buttonText, minimizeMaximizeFunction)
{

var htmlId = FfHelper.getNextHtmlId();
if (paneHeight == null)
paneHeight = 400;
var toggleButton;
var paneVisible = false;
var pane;
var searchString;
var cssClassPrefix = 'ffSearchPanel';

this.htmlElement;
this.label = label;
if (buttonText)
this.buttonText = buttonText;
else
this.buttonText = 'Search';

this.searchButton;
var labelElmnt;
this.pane = pane;
this.searchString;



this.createElement = createElement;
function createElement()
{
this.htmlElement = document.createElement('div');
this.htmlElement.id = htmlId;
this.htmlElement.className = cssClassPrefix;

var outerTable = document.createElement('table');
outerTable.cellSpacing = '1px';
outerTable.borderCollapse = 'collapse';

outerTable.style.width = '100%';
outerTable.style.height = '40px';
var outerTableRow = outerTable.insertRow(0);
var outerTableCell = outerTableRow.insertCell(0);

var table = document.createElement('table');

table.cellSpacing = '1px';
table.borderCollapse = 'collapse';

var row = table.insertRow(0);


var div = document.createElement('div');
div.style.textAlign = 'right';
toggleButton = document.createElement('img');
toggleButton.src = FfPaths.FF_ROOT_URL + '/images/panDownIcon.png';
FfHelper.disableEvents(toggleButton); 
toggleButton.style.cursor = 'pointer';
toggleButton.onclick = this.togglePaneVisibility;
div.appendChild(toggleButton);
outerTableCell.appendChild(div);

outerTableCell = outerTableRow.insertCell(0);

var cell = row.insertCell(0);
this.searchButton = document.createElement('input');
this.searchButton.className = 'FORMfieldsSubmit';
this.searchButton.type = 'submit';
this.searchButton.name = htmlId + 'SearchButton';
this.searchButton.value = this.buttonText;
this.searchButton.onclick = this.doSearch;
cell.appendChild(this.searchButton);

cell = row.insertCell(0);
searchString = document.createElement('input');
this.searchString = searchString;
searchString.className = 'FORMfieldsText';
searchString.type = 'text';
searchString.name = htmlId + 'SearchString';
searchString.onkeydown = this.onKeyDown;
searchString.onfocus = this.onFocus;
searchString.onblur = this.onBlur;

searchString.size = 17;

cell.appendChild(searchString);

cell = row.insertCell(0);
if (this.label instanceof Array) {
labelElmnt = document.createElement('select');
for (var i = 0; i < this.label.length; i++) {
var opt = document.createElement('option');
opt.text = this.label[i];
opt.value = this.label[i];
if (navigator.appName == 'Microsoft Internet Explorer')
labelElmnt.add(opt);
else
labelElmnt.add(opt, null);
}
} else {
labelElmnt = document.createElement('label');
labelElmnt.className = 'isValid';
labelElmnt.innerHTML = this.label + ':';
labelElmnt.style.paddingLeft = '0px';
}
cell.appendChild(labelElmnt);
this.labelElmnt = labelElmnt;

outerTableCell.appendChild(table);
this.htmlElement.appendChild(outerTable);

pane = document.createElement('div');
this.pane = pane;
pane.className = cssClassPrefix + 'Pane';
pane.style.height = '0px';
pane.id = htmlId + 'Pane';
pane.style.overflow = 'hidden';
pane.style.visibility = 'hidden';
this.htmlElement.appendChild(pane);

return this.htmlElement;
}

this.setPaneVisible = setPaneVisible;
function setPaneVisible(visible)
{
if (visible == paneVisible || pane.resizing) 
return;
if (visible) {
if (minimizeMaximizeFunction)
minimizeMaximizeFunction(true); 
pane.style.visibility = 'visible';
pane.style.marginBottom = '4px';
FfResizeAnimator.resize(htmlId + 'Pane', paneHeight, null, null, null, null, null, null, 'document.getElementById("' + htmlId + 'Pane").style.overflow="auto"');

toggleButton.src = FfPaths.FF_ROOT_URL + '/images/panUpIcon.png';
} else {
if (minimizeMaximizeFunction)
minimizeMaximizeFunction(false); 
pane.style.marginBottom = '0px';
pane.style.overflow = 'hidden';
FfResizeAnimator.resize(htmlId + 'Pane', 0, paneHeight);

toggleButton.src = FfPaths.FF_ROOT_URL + '/images/panDownIcon.png';
}
paneVisible = visible;
}

this.togglePaneVisibility = togglePaneVisibility;
function togglePaneVisibility()
{
setPaneVisible(!paneVisible);
}

this.doSearch = doSearch;
function doSearch()
{
setPaneVisible(true);
if (searchFunction) {
var selectedLabel = null;
if (labelElmnt.selectedIndex != null)
selectedLabel = labelElmnt.options[labelElmnt.selectedIndex].value;
searchFunction(searchString, pane, selectedLabel);
}
}

this.onKeyDown = onKeyDown;
function onKeyDown(event)
{
var keyCode = FfHelper.getKeyCode(event);
if (keyCode == 13) 
doSearch();
else if (keyCode == 27) 
setPaneVisible(false);
}

this.onFocus = onFocus;
function onFocus()
{
searchString.className = 'FORMfieldsText ' + cssClassPrefix + 'SearchStringFocus';
}

this.onBlur = onBlur;
function onBlur()
{
searchString.className = 'FORMfieldsText';
}
}


function FfTab(tabName, onClick, index)
{

var htmlId = FfHelper.getNextHtmlId();
var cssClassPrefix = 'ffTab';
var selected = false;
var onClick = onClick;
var index = index;
var cellLeft;
var cellMiddle;
var cellRight;

this.htmlElement;
this.tabName = tabName;



this.createElement = createElement;
function createElement()
{
this.htmlElement = document.createElement('table');
this.htmlElement.className = cssClassPrefix;
this.htmlElement.cellSpacing = '0px';
this.htmlElement.cellPadding = '0px';
var row = this.htmlElement.insertRow(0);

cellRight = row.insertCell(0);
cellRight.className = cssClassPrefix + 'NotSelectedRight';

cellMiddle = row.insertCell(0);
cellMiddle.className = cssClassPrefix + 'NotSelectedMiddle';
cellMiddle.innerHTML = this.tabName;

cellLeft = row.insertCell(0);
cellLeft.className = cssClassPrefix + 'NotSelectedLeft';


FfHelper.disableEvents(this.htmlElement);

this.htmlElement.onmouseover = this.mouseOver;
this.htmlElement.onmouseout = this.mouseOut;
this.htmlElement.onclick = this.doClick;

return this.htmlElement;
}

this.mouseOver = mouseOver;
function mouseOver()
{
cellLeft.className = cssClassPrefix + 'MouseOverLeft';
cellMiddle.className = cssClassPrefix + 'MouseOverMiddle';
cellRight.className = cssClassPrefix + 'MouseOverRight';
}

this.mouseOut = mouseOut;
function mouseOut()
{
var cssNotSelected = (selected ? '' : 'Not');
cellLeft.className = cssClassPrefix + cssNotSelected + 'SelectedLeft';
cellMiddle.className = cssClassPrefix + cssNotSelected + 'SelectedMiddle';
cellRight.className = cssClassPrefix + cssNotSelected + 'SelectedRight';
}

this.doClick = doClick;
function doClick()
{
if (!selected) {
selected = true;
mouseOut();
}
if (onClick) {
onClick(index);
}
}

this.unselect = unselect;
function unselect()
{
if (selected) {
selected = false;
mouseOut();
}
}

this.isSelected = isSelected;
function isSelected()
{
return selected;
}
}


function FfTabMenu(tabArray)
{

var tabs = new Array();
var tabOnClicks = new Array();
var selectedIndex = null;

this.htmlElement;
this.cssClassPrefix = 'ffTabMenu';



this.onClick = onClick;
function onClick(index)
{

for (var i = 0; i < tabs.length; i++) {
if (index != i && tabs[i].isSelected()) {
tabs[i].unselect();
break;
}
}

selectedIndex = index;
var tabOnClick = tabOnClicks[index];
if (tabOnClick)
tabOnClick(index);
}

this.createTabs = createTabs;
function createTabs(tabArray)
{
for (var i = 0; i < tabArray.length; i++) {
var tabName = tabArray[i][0];

var tab = new FfTab(tabName, this.onClick, i);
tabs.push(tab);
var tabOnClick = tabArray[i][1];
tabOnClicks.push(tabOnClick);
}
}

this.createElement = createElement;
function createElement()
{
this.htmlElement = document.createElement('div');
this.htmlElement.className = this.cssClassPrefix;

var innerTable = document.createElement('table');
innerTable.cellSpacing = '0px';
innerTable.cellPadding = '0px';
var innerRow = innerTable.insertRow(0);
var innerCell;

for (var i = tabs.length - 1; i >= 0; i--) {
innerCell = innerRow.insertCell(0);
innerCell.appendChild(tabs[i].createElement());
innerCell.className = this.cssClassPrefix;
if (i > 0) {
innerCell = innerRow.insertCell(0);
innerCell.className = this.cssClassPrefix + 'Spacer';
}
}

this.htmlElement.appendChild(innerTable);

return this.htmlElement;
}

this.selectTab = selectTab;
function selectTab(tabName)
{
for (var i = 0; i < tabs.length; i++) {
if (tabName == tabs[i].tabName) {

this.selectTabWithIndex(i);
break;
}
}
}

this.selectTabWithIndex = selectTabWithIndex;
function selectTabWithIndex(index)
{
tabs[index].doClick();
}

this.getSelectedIndex = getSelectedIndex;
function getSelectedIndex()
{
return selectedIndex;
}

this.getSelectedTabName = getSelectedTabName;
function getSelectedTabName()
{
if (selectedIndex != null) {
return tabs[selectedIndex].tabName;
}
}



this.createTabs(tabArray);

}


function FfTabPanel(tabArray)
{
this.htmlId = FfHelper.getNextHtmlId();
this.htmlElement;
this.cssClassPrefix = 'ffTabPanel';
this.tabMenu = new FfTabMenu(tabArray);
this.pane;



this.createElement = createElement;
function createElement()
{
this.htmlElement = document.createElement('div');
this.htmlElement.id = this.htmlId;
this.htmlElement.className = this.cssClassPrefix;

this.htmlElement.appendChild(this.tabMenu.createElement());

this.pane = document.createElement('div');
this.pane.className = this.cssClassPrefix + 'Pane';
this.pane.id = FfHelper.getNextHtmlId();
this.pane.style.overflow = 'auto';
this.htmlElement.appendChild(this.pane);

return this.htmlElement;
}

this.displayPane = displayPane;
function displayPane(paneToDisplay)
{
var firstChild = this.pane.firstChild;
if (firstChild) {
this.pane.replaceChild(paneToDisplay, firstChild);
} else {
this.pane.appendChild(paneToDisplay);
}
}
}


function FfStringHelper() { }

FfStringHelper.ltrim = function(str)
{
if (str == null)
return null;
return str.replace(/^( |\t|\n|\r|\0|\x0B)*/,'');
}

FfStringHelper.rtrim = function(str)
{
if (str == null)
return null;
return str.replace(/( |\t|\n|\r|\0|\x0B)*$/,'');
}

FfStringHelper.trim = function(str)
{
if (str == null)
return null;
return FfStringHelper.rtrim(FfStringHelper.ltrim(str));
}

FfStringHelper.escapeCommas = function(str)
{
return str.replace(/,/g, '\\,');
}

FfStringHelper.escapeSingleQuotes = function(str)
{
return str.replace(/'/g, "\\'");
}

FfStringHelper.escapeDoubleQuotes = function(str)
{
return str.replace(/"/g, '\\"');
}

FfStringHelper.arrayToString = function(items)
{
var str = null;
for (i = 0; i < items.length; i++) {
str += (i > 0 ? "," : "") + this.escapeCommas(items[i]);
}
return $str;
}

FfStringHelper.stringToArray = function(value, includeBlanks)
{
if (value == null)
return null;
if (includeBlanks == null)
includeBlanks = false;


value = value.replace(/\\,/g,'__FFEC__');
values = value.split(/,/);
for (var i = 0; i < values.length; i++) {
if (!includeBlanks && FfStringHelper.trim(values[i]).length == 0) {
values.splice(i, 1); 
i--; 
} else {
values[i] = values[i].replace(/__FFEC__/g, ',');
}
}
return values;
}

FfStringHelper.pad = function(input, padLength, padString, padLeft)
{
var inputString = new String(input);
var n = Math.floor((padLength - inputString.length)/padString.length);
var padding = '';
for (var i = 1; i <= n; i++) {
padding += padString;
}
var left = (padLength - inputString.length - n*padString.length);
if (left > 0) {
padding += padString.substr(0, left);
}
if (padLeft) {
return padding + inputString;
} else {
return inputString + padding;
}
}

FfStringHelper.genArray = function(start, end, noPad)
{
var endString = new String(end);
var values = new Array();
for (var i = start; i <= end; i++) {
if (noPad) {
values.push(i);
} else {
values.push(FfStringHelper.pad(i, endString.length, '0', true));
}
}
return values;
}


function GeFpServerMediatorNew() { }

GeFpServerMediatorNew.SERVER_URL = FfPaths.FF_ROOT_URL + '/../goExpo/floorPlan/GeFpServer.php';

GeFpServerMediatorNew.getPopupExhibitor = function(boothNumber, exhibitorId, listOffset)
{
var url = GeFpServerMediatorNew.SERVER_URL;
url += '?request=15';
url += '&bn=' + ffUrlEncode(boothNumber);
url += '&ei=' + (exhibitorId ? ffUrlEncode(exhibitorId) : '');
url += '&lo=' + (listOffset ? ffUrlEncode(listOffset) : '');
url += '&ui=' + (GeGlobals.USER_ID ? ffUrlEncode(GeGlobals.USER_ID) : '');
var xmlHttp = new FfAjaxRequest(url);
if (!xmlHttp || !xmlHttp.responseText) 
return null;
return eval('(' + xmlHttp.responseText + ')');
}

GeFpServerMediatorNew.getPopupCompanyDetails = function(exhibitorId)
{
var url = GeFpServerMediatorNew.SERVER_URL;
url += '?request=16';
url += '&ei=' + ffUrlEncode(exhibitorId);
var xmlHttp = new FfAjaxRequest(url);
if (!xmlHttp || !xmlHttp.responseText) 
return null;
return eval('(' + xmlHttp.responseText + ')');
}

GeFpServerMediatorNew.getPopupProduct = function(productId, exhibitorId, listOffset)
{
var url = GeFpServerMediatorNew.SERVER_URL;
url += '?request=17';
url += '&pi=' + (productId ? ffUrlEncode(productId) : '');
url += '&ei=' + (exhibitorId ? ffUrlEncode(exhibitorId) : '');
url += '&lo=' + (listOffset ? ffUrlEncode(listOffset) : '');
url += '&ui=' + (GeGlobals.USER_ID ? ffUrlEncode(GeGlobals.USER_ID) : '');
var xmlHttp = new FfAjaxRequest(url);
if (!xmlHttp || !xmlHttp.responseText) 
return null;
return eval('(' + xmlHttp.responseText + ')');
}

GeFpServerMediatorNew.getSponsors = function(numSponsors, offset)
{
var url = GeFpServerMediatorNew.SERVER_URL;
url += '?request=18';
url += '&ns=' + ffUrlEncode(numSponsors);
url += '&o=' + ffUrlEncode(offset);
var xmlHttp = new FfAjaxRequest(url);
if (!xmlHttp || !xmlHttp.responseText) 
return null;
return eval('(' + xmlHttp.responseText + ')');
}



function GeFpPopupCompanyPanel()
{
this.htmlElement = document.createElement('div');
this.exhibitorId;
this.details;



this.populate = populate;
function populate(exhibitorId)
{
if (this.exhibitorId == exhibitorId) 
return;
this.exhibitorId = exhibitorId;
this.details = GeFpServerMediatorNew.getPopupCompanyDetails(exhibitorId);
if (!this.details)
return;

var html = '';

if (this.details.productCategories) {
html += '<div class="geFpPopupBlock">';
html += '<div class="geFpPopupHeader">Product Categories:</div>';
html += '<div>';
var categories = FfStringHelper.stringToArray(this.details.productCategories);
for (var i = 0; i < categories.length; i++) {
html += (i > 0 ? '<br/>' : '') + categories[i];
}
html += '</div>';
html += '</div>';
}

if (this.details.description && this.details.showDescription) {
html += '<div class="geFpPopupBlock">';
html += this.details.description;
html += '</div>';
}

if (this.details.companyUrl) {
html += '<div class="geFpPopupBlock">';
html += '<a class="geFpPopup" target="_blank" href="' + this.details.companyUrl + '">Visit Company\'s Website</a>';
html += '</div>';
}

if (!GeGlobals.FP_ONLY) {
html += '<div class="geFpPopupBlock">';
html += '<a class="geFpPopup" href="' + FfPaths.FF_ROOT_URL + '/../goExpo/exhibitor/viewExhibitorProfile.php?__id=' + exhibitorId + '">More Company Information</a>';
html += '</div>';
}

this.htmlElement.innerHTML = html;
}
}


function FfFileHelper() { }

FfFileHelper.WEB_IMAGE_EXTENSIONS = new Array('png', 'gif', 'jpg', 'jpeg');

FfFileHelper.getLastExtension = function(filename)
{
var i = filename.lastIndexOf('.');
if (i == -1)
return '';
return filename.substr(i + 1);
}

FfFileHelper.hasExtension = function(filename, extensions)
{
var ext = this.getLastExtension(filename);
for (i = 0; i < extensions.length; i++) {
if (ext.toLowerCase() == extensions[i])
return true;
}
return false;
}

FfFileHelper.isWebImage = function(filename)
{
return FfFileHelper.hasExtension(filename, FfFileHelper.WEB_IMAGE_EXTENSIONS);
}

FfFileHelper.pathInfo = function(path)
{
var dirname = '', basename = '', extension = '', filename = '';
var lastSlash = path.lastIndexOf('/');
if (lastSlash == -1) {
dirname = path;
} else {
dirname = path.substr(0, lastSlash);
basename = path.substr(lastSlash + 1);
extension = FfFileHelper.getLastExtension(basename);
filename = basename.substr(0, basename.length - extension.length - 1);
}
return [dirname, basename, extension, filename];
}

FfFileHelper.replaceExtension = function(filename, replacement)
{
var info = FfFileHelper.pathInfo(filename);
return info[0] + '/' + info[3] + replacement;
}

FfFileHelper.realPath = function(path)
{
return path.replace(/[^\/]*\/..\//g, '');
}

FfFileHelper.alwaysRedirect = function(url)
{
if(window.location == FfFileHelper.realPath(url))
window.location.reload();
else
window.location = url;
}


function FfUploadVideoViewerField() { }

FfUploadVideoViewerField.getFlashVideoPlayerHtml = function(flv, width, height, autoPlay)
{

var ext = FfFileHelper.getLastExtension(flv);
var html = '';
if (ext.toLowerCase() == 'flv') {
var ap = 'true';
if (!autoPlay)
ap = 'false';
html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + width + '" height="' + height + '" id="FLVPlayer">';
html += '<param name="movie" value="' + FfPaths.FF_ROOT_URL + '/images/FLVPlayer_Progressive.swf" />';
html += '<param name="salign" value="lt" />';
html += '<param name="quality" value="high" />';
html += '<param name="scale" value="noscale" />';
html += '<param name="FlashVars" value="&MM_ComponentVersion=1&skinName=' + FfPaths.FF_ROOT_URL + '/images/Clear_Skin_1&streamName=' + flv + '&autoPlay=' + ap + '&autoRewind=false" />';
html += '<embed src="' + FfPaths.FF_ROOT_URL + '/images/FLVPlayer_Progressive.swf" flashvars="&MM_ComponentVersion=1&skinName=' + FfPaths.FF_ROOT_URL + '/images/Clear_Skin_1&streamName=' + flv + '&autoPlay=' + ap + '&autoRewind=false" quality="high" scale="noscale" width="' + width + '" height="' + height + '" name="FLVPlayer" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
html += '</object>';
} else {
html = '<img style="width:' + width + 'px;height:' + height + 'px;" src="' + FfPaths.FF_ROOT_URL + '/images/videoProcessing.png" />';
}
return html;
}

FfUploadVideoViewerField.setUploadedFileWrapper = function(filename)
{
var html = FfUploadVideoViewerField.getFlashVideoPlayerHtml(filename, this.width, this.height, this.autoPlay);
this.setUploadedFile(filename, html);
}
function FfListHelper(values, cssClass)
{
this.values = values;

if (cssClass)
this.cssClass = cssClass;
else
this.cssClass = 'ffListHelper';
}

FfListHelper.getHtml = function(values, cssClass)
{
if (values == null)
values = this.values;
if (cssClass == null) {
if (this.cssClass)
cssClass = this.cssClass;
else
cssClass = 'ffListHelper';
}

if (values.length == 0)
return;

var html = '<ul class="' + cssClass + '">';

for (var i = 0; i < values.length; i++) {
html += '<li class="' + cssClass + '">' + values[i] + '</li>';
}

html += '</ul>';

return html;
}


function FfToggleButtonInline() { }

FfToggleButtonInline.getHtml = function(classPrefixOn, classPrefixOff, actionOn, actionOff, isOn, textOn, textOff, id)
{


if (!id)
id = FfHelper.getNextHtmlId();
if (!classPrefixOff)
classPrefixOff = classPrefixOn;
if (!actionOff)
actionOff = actionOn;
if (!textOff)
textOff = textOn;









var actionOnMod = escape(actionOn);
var actionOffMod = escape(actionOff);
var textOnMod = escape(textOn);
var textOffMod = escape(textOff);
var params = '\'' + id + '\',\'' + classPrefixOn + '\',\'' + classPrefixOff + '\',\'' + actionOnMod + '\',\'' + actionOffMod + '\',\'' + textOnMod + '\',\'' + textOffMod + '\'';

var className = (isOn ? classPrefixOn : classPrefixOff);
var labelText = (isOn ? textOn : textOff);
var html = ' \
<table id="' + id + '" cellspacing="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0px;"> \
<tr style="vertical-align:top;" valign="top"> \
<td> \
<div id="' + id + '_button" class="' + className + 'Button" onclick="FfToggleButtonInline.doClick(' + params + ');" style="cursor:pointer;"> \
</div> \
</td> \
<td> \
<div id="' + id + '_label" class="' + className + 'Label" onclick="FfToggleButtonInline.doClick(' + params + ');" style="cursor:pointer;"> \
' + labelText + ' \
</div> \
</td> \
</tr> \
</table> \
';

return html;
}

FfToggleButtonInline.doClick = function(id, classPrefixOn, classPrefixOff, actionOn, actionOff, textOn, textOff)
{
var button = document.getElementById(id + '_button');
var label = document.getElementById(id + '_label');

if (!button || !label)
return;


if (button.className == classPrefixOn + 'Button') { 
if (eval(unescape(actionOn)) && classPrefixOn != classPrefixOff) {
button.className = classPrefixOff + 'Button';
label.className = classPrefixOff + 'Label';
label.innerHTML = unescape(textOff);
}
} else {
if (eval(unescape(actionOff)) && classPrefixOn != classPrefixOff) {
button.className = classPrefixOn + 'Button';
label.className = classPrefixOn + 'Label';
label.innerHTML = unescape(textOn);
}
}
}

FfToggleButtonInline.setIsOn = function(id, classPrefixOn, classPrefixOff, isOn, textOn, textOff)
{
if (classPrefixOn == classPrefixOff)
return;
var button = document.getElementById(id + '_button');
var label = document.getElementById(id + '_label');

if (!button || !label)
return;

if (isOn) { 
button.className = classPrefixOn + 'Button';
label.className = classPrefixOn + 'Label';
label.innerHTML = unescape(textOn);
} else {
button.className = classPrefixOff + 'Button';
label.className = classPrefixOff + 'Label';
label.innerHTML = unescape(textOff);
}
}

FfToggleButtonInline.setVisible = function(id, visible)
{
var table = document.getElementById(id);

if (!id)
return;

if (visible) {
table.style.display = 'block';
} else {
table.style.display = 'none';
}
}
function FfMorePanelInline() { }

FfMorePanelInline.getHtml = function(buttonClassPrefixOn, buttonClassPrefixOff, html, showMore, id, moreLabel, lessLabel)
{


if (!id)
id = FfHelper.getNextHtmlId();
if (!moreLabel)
moreLabel = 'More';
if (!lessLabel)
lessLabel = 'Less';

var style = '';
if (!showMore)
style = 'style="display:none;"';
var actionOn = "FfMorePanelInline.doClick('" + id + "','" + buttonClassPrefixOn + "','" + buttonClassPrefixOff + "');";
var elHtml =
FfToggleButtonInline.getHtml(buttonClassPrefixOn, buttonClassPrefixOff, actionOn, actionOn, !showMore, moreLabel, lessLabel, id)
+ '<div id="' + id + '_panel" ' + style + '>' + html + '</div>';
return elHtml;
}

FfMorePanelInline.doClick = function(id, buttonClassPrefixOn, buttonClassPrefixOff)
{
var panel = document.getElementById(id + '_panel');
var button = document.getElementById(id + '_button');
if (button.className == buttonClassPrefixOn + 'Button') { 
panel.style.display = 'block';
} else {
panel.style.display = 'none';
}
return true;
}


function FfStateButtonInline() { }

FfStateButtonInline.getStateItems = function(states, state)
{
for (var i = 0; i < states.length; i++) {
if (states[i][0] == state) {
return states[i];
}
}
}

FfStateButtonInline.getHtml = function(states, state, id)
{


if (!id)
id = FfHelper.getNextHtmlId();

var stateItems = FfStateButtonInline.getStateItems(states, state);
var className = stateItems[1];
var labelText = stateItems[3];

window[id + '_states'] = states;
window[id + '_state'] = state;

var html = ' \
<table id="' + id + '" cellspacing="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0px;"> \
<tr style="vertical-align:top;" valign="top"> \
<td> \
<div id="' + id + '_button" class="' + className + 'Button" onclick="FfStateButtonInline.doClick(\'' + id + '\');" style="cursor:pointer;"> \
</div> \
</td> \
<td> \
<div id="' + id + '_label" class="' + className + 'Label" onclick="FfStateButtonInline.doClick(\'' + id + '\');" style="cursor:pointer;"> \
' + labelText + ' \
</div> \
</td> \
</tr> \
</table> \
';
return html;
}

FfStateButtonInline.doClick = function(id)
{
var button = document.getElementById(id + '_button');
var label = document.getElementById(id + '_label');

if (!button || !label)
return;

var states = window[id + '_states'];

var state = window[id + '_state'];
var stateItems = FfStateButtonInline.getStateItems(states, state);

var newState = eval(stateItems[2]);
var newStateItems = FfStateButtonInline.getStateItems(states, newState);
if (!newStateItems)
return;

button.className = newStateItems[1] + 'Button';
label.className = newStateItems[1] + 'Label';
label.innerHTML = newStateItems[3];

window[id + '_state'] = newState;
}

FfStateButtonInline.setState = function(id, newState)
{
var curState = window[id + '_state'];

if (bewState == state)
return;

var button = document.getElementById(id + '_button');
var label = document.getElementById(id + '_label');

if (!button || !label)
return;

var states = window[id + '_states'];
var newStateItems = FfStateButtonInline.getStateItems(states, newState);
if (!newStateItems)
return;

button.className = newStateItems[1] + 'Button';
label.className = newStateItems[1] + 'Label';
label.innerHTML = newStateItems[3];
}

FfStateButtonInline.setVisible = function(id, visible)
{
var table = document.getElementById(id);

if (!table)
return;

if (visible) {
table.style.display = 'block';
} else {
table.style.display = 'none';
}
}
function GeGuiMediator() { }

GeGuiMediator.showProductPopup = function(productId, exhibitorId, listOffset)
{




var product = GeAjaxMediator.getPopupProduct(productId, exhibitorId, listOffset);

if (product.video) { 

var mediaHtml = FfUploadVideoViewerField.getFlashVideoPlayerHtml(product.video, 480, 360, true);
} else {
if (product.image1) { 

var imageUrl = FfFileHelper.replaceExtension(product.image1, '_tn.jpg');
} else {
var imageUrl = FfPaths.FF_ROOT_URL + '/../goExpo/images/noProductImg.png';
}
var mediaHtml = '<img class="geFrame" alt="' + product.name + '" src="' + imageUrl + '" />';
}

var exhibitorUrl = FfPaths.FF_ROOT_URL + '/../goExpo/exhibitor/viewExhibitorProfile.php?__id=' + product.ex_id;

var html = '\
<div style="width:900px;height:370px;"> \
<table style="width:100%;"> \
<tr style="vertical-align:top;" valign="top"> \
<td style="width:485px;"> \
' + mediaHtml + ' \
</td> \
<td> \
<div class="geProductName" style="max-height:37px;overflow:hidden;"> \
' + product.name + ' \
</div> \
' + (GeGlobals.PERMIT_PLANNER ? ' \
<div style="margin-bottom:10px;"> \
' + GeGuiMediator.getAddProductToPlannerHtml(product.ep_product_id, product.planner_products_id) + ' \
</div> \
' : '') + ' \
<div style="height:295px;overflow:auto;padding:3px;"> \
<div class="geShadedPanel" style="margin-bottom:10px;padding:3px;"> \
<span class="display">Company:</span> <a class="geMain" href="' + exhibitorUrl + '">' + product.company_name + '</a> \
</div> \
' + (product.description ? ' \
<div style="margin-bottom:10px;"> \
' + product.description + ' \
</div> \
' : '') + ' \
' + (product.brochure1_url ? ' \
<div style="margin-bottom:10px;"> \
<a class="geMain" onclick="window.open(\'' + product.brochure1_url + '\');return false;" href="' + product.brochure1_url + '">' + (product.brochure1_name ? product.brochure1_name : 'Brochure 1') + '</a> \
</div> \
' : '') + ' \
' + (product.brochure2_url ? ' \
<div style="margin-bottom:10px;"> \
<a class="geMain" onclick="window.open(\'' + product.brochure2_url + '\');return false;" href="' + product.brochure2_url + '">' + (product.brochure2_name ? product.brochure2_name : 'Brochure 2') + '</a> \
</div> \
' : '') + ' \
' + (product.price ? ' \
<div style="margin-bottom:10px;"> \
Price: $' + product.price + ' \
</div> \
' : '') + ' \
' + (product.url ? ' \
<div style="margin-bottom:10px;"> \
<a class="geMain" onclick="window.open(\'' + product.url + '\');return false;" href="' + product.url + '">Visit Website</a> \
</div> \
' : '') + ' \
' + (product.categories ? ' \
<div class="geShadedPanel" style="padding:3px;"> \
<div> \
<span class="display">Related Product Categories:</span> \
</div> \
' + FfListHelper.getHtml(GeGuiMediator.getClickableCategories(FfStringHelper.stringToArray(product.categories))) + ' \
</div> \
' : '') + ' \
</div> \
</td> \
</tr> \
</table> \
</div> \
';
FfWindow.showDialog(product.name, 930, 390, html, null, null, 'ffSectionTitleJs2', null, true);
}

GeGuiMediator.getClickableCategories = function(categories, urlPrefix)
{
if (!categories)
return null;
if (!urlPrefix)
urlPrefix = FfPaths.FF_ROOT_URL + '/../goExpo/exhibitor/listExhibitorProducts.php?category=';
var cats = new Array();
for (var i = 0; i < categories.length; i++) {

var url = urlPrefix + ffUrlEncode(categories[i]) + '#filter';
cats.push('<a class="geMain" onclick="FfFileHelper.alwaysRedirect(\'' + url + '\');return false;" href="">' + categories[i] + '</a>');
}
return cats;
}

GeGuiMediator.getAddProductToPlannerHtml = function(productId, inPlanner, textOn, textOff)
{



var baseId = 'ge_add_product_' + productId + '_';
var classPrefixOn = 'geAddToPlanner';
var classPrefixOff = 'geRemoveFromPlanner';
if (!textOn)
textOn = 'Add to Planner';
if (!textOff)
textOff = 'Remove from Planner';
var textOnMod = FfStringHelper.escapeSingleQuotes(textOn);
var textOffMod = FfStringHelper.escapeSingleQuotes(textOff);
var actionOn = "if(GeAjaxMediator.addProductToPlanner('" + productId + "'))GeGuiMediator.toggleAllButtons('" + baseId + "','" + classPrefixOn + "','" + classPrefixOff + "',false,'" + textOnMod + "','" + textOffMod + "');";
var actionOff = "GeAjaxMediator.removeProductFromPlanner('" + productId + "');GeGuiMediator.toggleAllButtons('" + baseId + "','" + classPrefixOn + "','" + classPrefixOff + "',true,'" + textOnMod + "','" + textOffMod + "');";
var nextId = GeGuiMediator.getNextToggleButtonId(baseId);
return FfToggleButtonInline.getHtml(classPrefixOn, classPrefixOff, actionOn, actionOff, !inPlanner, textOn, textOff, nextId);
}

GeGuiMediator.getNextToggleButtonId = function(baseId)
{
var i = -1;
while (document.getElementById(baseId + '' + (++i) + '_button'));
return baseId + '' + i;
}

GeGuiMediator.toggleAllButtons = function(baseId, classPrefixOn, classPrefixOff, isOn, textOn, textOff)
{
var i = -1;
while (document.getElementById(baseId + '' + (++i) + '_button')) {
FfToggleButtonInline.setIsOn(baseId + '' + i, classPrefixOn, classPrefixOff, isOn, textOn, textOff)
}
}

GeGuiMediator.getMorePlanelHtml = function(html, showMore)
{

return FfMorePanelInline.getHtml('geMore', 'geLess', html, showMore);
}

GeGuiMediator.getAddUserToPlannerHtml = function(userId, inPlanner, minimized, disableSync)
{



var baseId = 'ge_add_user_' + userId + '_';

if (minimized) {
var classPrefixOn = 'geAddToPlannerMinimized';
var classPrefixOff = 'geRemoveFromPlannerMinimized';
} else {
var classPrefixOn = 'geAddToPlanner';
var classPrefixOff = 'geRemoveFromPlanner';
}

var textOn = 'Add to Planner';
var textOff = 'Remove from Planner';
var textOnMod = FfStringHelper.escapeSingleQuotes(textOn);
var textOffMod = FfStringHelper.escapeSingleQuotes(textOff);

if (disableSync) {
var actionOn = "GeAjaxMediator.addUserToPlanner('" + userId + "');";
var actionOff = "GeAjaxMediator.removeUserFromPlanner('" + userId + "');";
} else {
var actionOn = "if(GeAjaxMediator.addUserToPlanner('" + userId + "'))GeGuiMediator.toggleAllButtons('" + baseId + "','" + classPrefixOn + "','" + classPrefixOff + "',false,'" + textOnMod + "','" + textOffMod + "');";
var actionOff = "GeAjaxMediator.removeUserFromPlanner('" + userId + "');GeGuiMediator.toggleAllButtons('" + baseId + "','" + classPrefixOn + "','" + classPrefixOff + "',true,'" + textOnMod + "','" + textOffMod + "');";
}
var nextId = GeGuiMediator.getNextToggleButtonId(baseId);
return FfToggleButtonInline.getHtml(classPrefixOn, classPrefixOff, actionOn, actionOff, !inPlanner, textOn, textOff, nextId);
}


GeGuiMediator.approveOrRejectConnection = function(userId, baseId, approve)
{

if (approve) {
var newState = GeAjaxMediator.approveConnection(userId);
FfStateButtonInline.setVisible(baseId + 'reject', false);
} else {
var newState = GeAjaxMediator.removeConnection(userId);
FfStateButtonInline.setVisible(baseId + 'approve', false);
}
return newState;
}

GeGuiMediator.getMakeConnectionHtml = function(userId, type)
{
if (type == 'Reverse Block')
return '';



var baseId = 'ge_add_user_' + userId + '_';

var states = [
['None', 'geAddToPlanner', "GeAjaxMediator.requestConnection('" + userId + "');", 'Request Connection'],
['Requested', 'geRejectConnection', "GeAjaxMediator.removeConnection('" + userId + "');", 'Cancel Request (Waitng for Approval)'],
['Connected', 'geRemoveFromPlanner', "GeAjaxMediator.removeConnection('" + userId + "');", 'Remove from Connections'],
['Approve', 'geApproveConnection', "GeGuiMediator.approveOrRejectConnection('" + userId + "','" + baseId + "',true);", 'Approve Connection'],
['Reject', 'geRejectConnection', "GeGuiMediator.approveOrRejectConnection('" + userId + "','" + baseId + "',false);", 'Deny Connection']
];

var state = null;
switch (type) {
case 'Connection':
state = 'Connected';
break;
case 'Request':
state = 'Requested';
break;
case 'Pending':
return FfStateButtonInline.getHtml(states, 'Approve', baseId + 'approve') + FfStateButtonInline.getHtml(states, 'Reject', baseId + 'reject');
break;
default:
state = 'None';
break;
}


return FfStateButtonInline.getHtml(states, state);
}

GeGuiMediator.verifyLogin = function()
{
if (!GeGlobals.USER_HASH) {
window.location = FfPaths.FF_ROOT_URL + '/../goExpo/login.php?goTo=' + ffUrlEncode(window.location);
return false;
}
return true;
}

GeGuiMediator.verifyNotExhibitor = function()
{
if (GeGlobals.IS_EXHIBITOR) {
GeGuiMediator.alert('Exhibitors cannot perform this operation!');
return false;
}
return true;
}

GeGuiMediator.verifyNotSelf = function(userId)
{
if (GeGlobals.USER_ID == userId) {
GeGuiMediator.alert('You cannot perform this operation on yourself!');
return false;
}
return true;
}

GeGuiMediator.alert = function(msg)
{
return alert(msg);
}




function GeFpPopupProductsPanel(popupHtmlId)
{

var htmlId = FfHelper.getNextHtmlId();
var productName;
var productIndex;
var htmlElement = document.createElement('div');
var cssClassPrefix = 'geFpPopupProductsPanel';
var nextProductButton;
var productName;
var prevProductButton;
var productImage;
var productText;
var product;
var MAX_PRODUCT_NAME_LEN = 37; 
var nextProduct;
var prevProduct;
var bottomTable;
var mediaPane;
var removedVideo;
var videoUrlElement;
var prevCell;
var mediaCell;
var productCell;
var topTable;

this.htmlElement = htmlElement;



this.populateProductText = populateProductText;
function populateProductText()
{
var html = '';

if (GeGlobals.PERMIT_PLANNER) {

html += GeGuiMediator.getAddProductToPlannerHtml(product.productId, product.plannerId, 'Add ' + GeGlobals.PRODUCT_NAME + ' to Planner', 'Remove ' + GeGlobals.PRODUCT_NAME + ' from Planner');
}

html += '<div class="geFpPopupBlock" style="width:180px;">';
label = (product.video ? 'Play Video' : 'More Information');
html += '<a class="geFpPopup" href="javascript:GeJsLoader.loadModule(\'GeGuiMediator\');GeGuiMediator.showProductPopup(' + product.productId + ');">' + label + '</a>';
html += '</div>';
if (product.video) {

setTimeout('GeGuiMediator.showProductPopup(\'' + product.productId + '\');', 500); 
}

productText.innerHTML = html;
}

this.create = create;
function create()
{

htmlElement.style.width = '480px';
htmlElement.style.height = '263px';
htmlElement.style.overflow = 'hidden';

topTable = document.createElement('table');
topTable.style.margin = '4px 0px 6px 0px';
topTable.cellSpacing = '0px';
topTable.cellPadding = '0px';

var topRow = topTable.insertRow(0);

var topCell = topRow.insertCell(0);
nextProductButton = document.createElement('img');
nextProductButton.alt = 'Next Product';
nextProductButton.style.cursor = 'pointer';
nextProductButton.src = FfPaths.FF_ROOT_URL + '/images/searchResultsFieldSmallRightArrow2.png';
nextProductButton.onclick = loadNextProduct;
nextProduct = document.createElement('div');
nextProduct.style.visibility = 'hidden';
nextProduct.style.marginRight = '3px';
nextProduct.style.textAlign = 'right';
nextProduct.appendChild(nextProductButton);
topCell.appendChild(nextProduct);

topCell = topRow.insertCell(0);

productName = document.createElement('span');
productName.className = cssClassPrefix + 'ProductName';
topCell.appendChild(productName);
productIndex = document.createElement('span');
productIndex.className = cssClassPrefix + 'ProductIndex';
topCell.appendChild(productIndex);

prevCell = topRow.insertCell(0);
prevProductButton = document.createElement('img');
prevProductButton.alt = 'Previous Product';
prevProductButton.style.cursor = 'pointer';
prevProductButton.src = FfPaths.FF_ROOT_URL + '/images/searchResultsFieldSmallLeftArrow2.png';
prevProductButton.onclick = loadPreviousProduct;
prevProduct = document.createElement('div');
prevProduct.style.visibility = 'hidden';
prevProduct.style.position = 'absolute';
prevProduct.style.marginLeft = '3px';
prevProduct.appendChild(prevProductButton);
prevCell.appendChild(prevProduct);

htmlElement.appendChild(topTable);

bottomTable = document.createElement('table');
bottomTable.style.width = '100%';
bottomTable.cellSpacing = '0px';
bottomTable.cellPadding = '0px';
bottomTable.style.paddingRight = '2px';
var bottomRow = bottomTable.insertRow(0);
bottomRow.style.verticalAlign = 'top';
bottomRow.vAlign = 'top'; 

productCell = bottomRow.insertCell(0);
productText = document.createElement('div');
productText.style.height = '240px';
productText.style.overflow = 'auto';
productCell.appendChild(productText);

mediaCell = bottomRow.insertCell(0);
mediaPane = document.createElement('div');
mediaPane.id = htmlId + 'Media';
mediaCell.appendChild(mediaPane);

htmlElement.appendChild(bottomTable);

videoUrlElement = document.createElement('input');
videoUrlElement.id = htmlId + 'Video';
videoUrlElement.type = 'hidden';
htmlElement.appendChild(videoUrlElement); 
}

this.clearVideo = clearVideo;
function clearVideo()
{

productImage.alt = product.name;
productImage.src = FfPaths.FF_ROOT_URL + '/images/blank.gif';
productImage.style.width = '320px';
productImage.style.height = '240px';
FfHelper.setFirstChild(mediaPane, productImage);
}

this.loadMedia = loadMedia;
function loadMedia()
{
if (!productImage) { 
productImage = document.createElement('img');
productImage.style.cursor = 'pointer';
productImage.onclick = productImageClick;
productImage.style.margin = '0px 0px 0px 2px';
productImage.className = "geFrame";
}

if (product && (!product.image1 || !FfFileHelper.isWebImage(product.image1))) {
product.image1 = FfPaths.FF_ROOT_URL + '/../goExpo/images/noProductImgTn.png';
}

if (product && product.image1 && FfFileHelper.isWebImage(product.image1)) {
productImage.alt = product.name;
productImage.src = product.image1;
productImage.style.width = 'auto';
productImage.style.height = 'auto';
FfHelper.setFirstChild(mediaPane, productImage);
productImage.onclick = function()
{

GeGuiMediator.showProductPopup(product.productId);
}
} else {
if (mediaPane.firstChild)
mediaPane.removeChild(mediaPane.firstChild);
}
}

this.loadProduct = loadProduct;
function loadProduct(newProduct)
{
product = newProduct;

if (!productName) { 
create(); 
}

if (newProduct) {
productIndex.style.visibility = 'visible';

var pName = product.name.substr(0, MAX_PRODUCT_NAME_LEN);
if (product.name.length > MAX_PRODUCT_NAME_LEN)
pName += '...';
productName.innerHTML = pName;

videoUrlElement.value = product.video;

if (product.listSize > 1)
productIndex.innerHTML = '(' + (product.listOffset + 1) + ' of ' + product.listSize + ')';
else
productIndex.innerHTML = '';

if (product.listOffset > 0) {
prevProduct.style.visibility = 'visible';
prevProduct.style.position = 'static';
prevCell.style.width = 'auto'; 
} else {
prevCell.style.width = '0px'; 
prevProduct.style.visibility = 'hidden';
prevProduct.style.position = 'absolute';
}

if (product.listOffset < product.listSize - 1) {
nextProduct.style.visibility = 'visible';
} else {
nextProduct.style.visibility = 'hidden';
}

loadMedia();

productText.style.height = '240px';

populateProductText();
} else {
productName.innerHTML = 'Sorry, this exhibitor has not uploaded any ' + GeGlobals.PRODUCT_NAME_PLURAL + '.';

prevProduct.style.visibility = 'hidden';
prevProduct.style.position = 'absolute';
nextProduct.style.visibility = 'hidden';
productIndex.style.visibility = 'hidden';

prevCell.style.width = '0px'; 

videoUrlElement.value = null;

loadMedia();

productText.innerHTML = '<div class="geFpPopupBlock"><a class="geFpPopup" href="' + FfPaths.FF_ROOT_URL + '/../goExpo/exhibitor/upgradeWizardProducts.php">If you represent this exhibitor, you can upload ' + GeGlobals.PRODUCT_NAME_PLURAL + ' here</a>.</div>';
bottomTable.style.width = 'auto';  
productText.style.height = 'auto'; 
}
}

this.loadProductWithProductId = loadProductWithProductId;
function loadProductWithProductId(productId, exhibitorId)
{
var newProduct = GeFpServerMediatorNew.getPopupProduct(productId, exhibitorId);
if (newProduct)
loadProduct(newProduct);
}

this.loadNextProduct = loadNextProduct;
function loadNextProduct()
{
var newProduct = GeFpServerMediatorNew.getPopupProduct(null, product.exhibitorId, product.listOffset + 1);
if (newProduct)
loadProduct(newProduct);
}

this.loadPreviousProduct = loadPreviousProduct;
function loadPreviousProduct()
{
var newProduct = GeFpServerMediatorNew.getPopupProduct(null, product.exhibitorId, product.listOffset - 1);
if (newProduct)
loadProduct(newProduct);
}

this.productImageClick = productImageClick;
function productImageClick()
{
if (product && product.url)
window.location = product.url;
}


this.removeVideoIfNeeded = removeVideoIfNeeded;
function removeVideoIfNeeded()
{
if (product && product.video) {
removedVideo = product.video;
product.video = null;

clearVideo();
}
}

this.restoreVideoIfNeeded = restoreVideoIfNeeded;
function restoreVideoIfNeeded()
{
if (removedVideo && product) {
product.video = removedVideo;
removedVideo = null;
loadMedia();
}
}

this.loadVideoIfNeededJs = loadVideoIfNeededJs;
function loadVideoIfNeededJs(popupHtmlId)
{
return 'GeFpPopupProductsPanel.loadVideoIfNeeded("' + htmlId + '","' + popupHtmlId + '");';
}

this.hide = hide;
function hide()
{
if (prevProduct)
prevProduct.style.visibility = 'hidden';
if (nextProduct)
nextProduct.style.visibility = 'hidden';
if (productIndex)
productIndex.style.visibility = 'hidden';

}
}


GeFpPopupProductsPanel.loadVideoIfNeeded = function(productsPanelHtmlId, popupHtmlId)
{
return;
var iFading = document.getElementById(popupHtmlId + 'Fading');
if (!iFading)
return;
iFading.value = 'false';
var videoUrlElement = document.getElementById(productsPanelHtmlId + 'Video');
if (!videoUrlElement)
return;
var videoUrl = videoUrlElement.value;
if (!videoUrl || videoUrl == 'null') 
return;
var mPane = document.getElementById(productsPanelHtmlId + 'Media');
if (!mPane)
return;
mPane.innerHTML = FfUploadVideoViewerField.getFlashVideoPlayerHtml(videoUrl, 320, 240, true);
}









function GeFpPopup()
{



var htmlId = FfHelper.getNextHtmlId();
var topPanel;
var bottomPanel;
var companyPanel = new GeFpPopupCompanyPanel();
var productsPanel = new GeFpPopupProductsPanel(htmlId);
var exhibitor;
var htmlElement;
var boothNumber;
var MAX_COMPANY_NAME_LEN = 37; 
var TAB_PANEL_PANE_HEIGHT = 267;
var companyName;
var companyLogo;
var companyLogoLink;
var nextExhibitor;
var prevExhibitor;
var topLinks;
var isFadingElement;
var cssClassPrefix = 'geFpPopup';

this.htmlId = htmlId;
this.cssClassPrefix = cssClassPrefix;
this.htmlElement;
this.topPanel;
this.bottomPanel;
this.companyLogo;
this.nextExhibitor;
this.prevExhibitor;
this.boothNumber;
this.companyName;
this.topLinks;
this.productsPanel = productsPanel;



this.createTopPanel = createTopPanel;
function createTopPanel()
{
topPanel = document.createElement('div');
this.topPanel = topPanel;
this.topPanel.id = this.htmlId + 'Top';
this.topPanel.className = this.cssClassPrefix + 'Top';

var topTable = document.createElement('table');
topTable.style.marginBottom = '2px';
topTable.style.width = '100%';
topTable.cellPadding = '0px';
topTable.cellSpacing = '0px';
var topRow = topTable.insertRow(0);
var topCell = topRow.insertCell(0);

topCell.width = '110px';
topCell.style.textAlign = 'right';
var closeButton = document.createElement('img');
closeButton.src = FfPaths.FF_ROOT_URL + '/images/ffWindowClose.png';
closeButton.alt = 'Close';
closeButton.style.cursor = 'pointer';
closeButton.style.margin = '2px 3px 0px 0px';
FfHelper.disableEvents(closeButton);
closeButton.onclick = this.hide;
topCell.appendChild(closeButton);
topCell = topRow.insertCell(0);
topLinks = document.createElement('div');
this.topLinks = topLinks;
this.topLinks.className = this.cssClassPrefix + 'TopLinks';
this.topLinks.style.visibility = 'hidden';
topCell.appendChild(this.topLinks);
topCell = topRow.insertCell(0);

topCell.width = '110px';
topCell.className = this.cssClassPrefix + 'BoothNumber';
boothNumber = document.createElement('div');
this.boothNumber = boothNumber;
topCell.appendChild(this.boothNumber);
this.topPanel.appendChild(topTable);

var middleTable = document.createElement('table');
middleTable.style.width = '100%';
middleTable.cellPadding = '0px';
middleTable.cellSpacing = '0px';

var middleRow = middleTable.insertRow(0);
var middleCell = middleRow.insertCell(0);
middleCell.style.width = '50px';
middleCell.style.verticalAlign = 'top';
middleCell.vAlign = 'top'; 
nextExhibitor = document.createElement('div');
this.nextExhibitor = nextExhibitor;
this.nextExhibitor.className = this.cssClassPrefix + 'NextExhibitor';
this.nextExhibitor.style.visibility = 'hidden';
this.nextExhibitor.style.marginTop = '13px';
this.nextExhibitor.style.height = '72px';

var nextExhibitorLabel = document.createElement('div');
nextExhibitorLabel.innerHTML = 'Next Exhibitor';
nextExhibitorLabel.className = this.cssClassPrefix + 'NextExhibitorLabel';
this.nextExhibitor.appendChild(nextExhibitorLabel);
var nextExhibitorButton = document.createElement('img');
nextExhibitorButton.alt = 'Next Co-Exhibitor';
nextExhibitorButton.style.cursor = 'pointer';
nextExhibitorButton.src = FfPaths.FF_ROOT_URL + '/images/searchResultsFieldSmallRightArrow2.png';
nextExhibitorButton.onclick = this.loadNextExhibitor;
this.nextExhibitor.appendChild(nextExhibitorButton);
middleCell.appendChild(this.nextExhibitor);

middleCell = middleRow.insertCell(0);
middleCell.style.textAlign = 'center';
middleCell.style.width = '392px';
companyLogoLink = document.createElement('a');
companyLogo = document.createElement('img');
this.companyLogo = companyLogo;
this.companyLogo.style.border = 'none';
companyLogoLink.appendChild(this.companyLogo);
middleCell.appendChild(companyLogoLink);

companyName = document.createElement('div');
this.companyName = companyName;
this.companyName.className = this.cssClassPrefix + 'CompanyName';
middleCell.appendChild(this.companyName);
this.topPanel.appendChild(middleTable);

middleCell = middleRow.insertCell(0);
middleCell.style.width = '50px';
middleCell.style.verticalAlign = 'top';
middleCell.vAlign = 'top'; 
prevExhibitor = document.createElement('div');
this.prevExhibitor = prevExhibitor;
this.prevExhibitor.className = this.cssClassPrefix + 'PreviousExhibitor';
this.prevExhibitor.style.visibility = 'hidden';
this.prevExhibitor.style.marginTop = '13px';
this.prevExhibitor.style.height = '72px';
var prevExhibitorLabel = document.createElement('div');
prevExhibitorLabel.innerHTML = 'Previous Exhibitor';
prevExhibitorLabel.className = this.cssClassPrefix + 'PreviousExhibitorLabel';
this.prevExhibitor.appendChild(prevExhibitorLabel);
var prevExhibitorButton = document.createElement('img');
prevExhibitorButton.alt = 'Previous Co-Exhibitor';
prevExhibitorButton.style.cursor = 'pointer';
prevExhibitorButton.src = FfPaths.FF_ROOT_URL + '/images/searchResultsFieldSmallLeftArrow2.png';
prevExhibitorButton.onclick = this.loadPreviousExhibitor;
this.prevExhibitor.appendChild(prevExhibitorButton);
middleCell.appendChild(this.prevExhibitor);
}

this.createElement = createElement;
function createElement()
{
htmlElement = document.createElement('div');
this.htmlElement = htmlElement;
this.htmlElement.id = this.htmlId;
this.htmlElement.style.visibility = 'hidden';

this.createTopPanel();
this.htmlElement.appendChild(this.topPanel);

var tabs = new Array(
new Array('Company', this.showCompanyPanel),
new Array(GeGlobals.PRODUCT_NAME_PLURAL, this.showProductsPanel)

);
if (!ffmConfig.PERMIT_PRODUCTS)
tabs.splice(1, 1);
bottomPanel = new FfTabPanel(tabs);
this.bottomPanel = bottomPanel;
this.bottomPanel.createElement();
this.bottomPanel.htmlElement.style.visibility = 'hidden';
this.bottomPanel.htmlElement.style.width = '492px';

this.bottomPanel.pane.style.height = '260px';
this.bottomPanel.htmlElement.style.marginLeft = '4px';
this.htmlElement.appendChild(this.bottomPanel.htmlElement);

isFadingElement = document.createElement('input');
isFadingElement.id = this.htmlId + 'Fading';
isFadingElement.type = 'hidden';
isFadingElement.value = 'true';
this.htmlElement.appendChild(isFadingElement);

return this.htmlElement;
}

this.loadExhibitor = loadExhibitor;
function loadExhibitor(newExhibitor)
{
exhibitor = newExhibitor;

boothNumber.innerHTML = 'Booth: ' + (exhibitor.boothNumber ? exhibitor.boothNumber : 'TBD');

if (exhibitor.exhibitorId) {
var company = exhibitor.companyName.substr(0, MAX_COMPANY_NAME_LEN);
if (exhibitor.companyName.length > MAX_COMPANY_NAME_LEN)
company += '...';

var companyHtml = company;
if (!GeGlobals.FP_ONLY)
companyHtml = '<a class="' + cssClassPrefix + 'CompanyName" href="' + FfPaths.FF_ROOT_URL + '/../goExpo/exhibitor/viewExhibitorProfile.php?__id=' + exhibitor.exhibitorId + '">' + companyHtml + '</a>';
companyName.innerHTML = companyHtml;

if (exhibitor.logoUrl) {
companyLogo.src = exhibitor.logoUrl;
companyLogo.style.visibility = 'visible';
companyLogo.style.position = 'static';
companyLogoLink.href = FfPaths.FF_ROOT_URL + '/../goExpo/exhibitor/viewExhibitorProfile.php?__id=' + exhibitor.exhibitorId;
} else {
companyLogo.style.visibility = 'hidden';
companyLogo.style.position = 'absolute';
}

if (exhibitor.listOffset > 0) {
prevExhibitor.style.visibility = 'visible';
} else {
prevExhibitor.style.visibility = 'hidden';
}

if (exhibitor.listOffset < exhibitor.listSize - 1) {
nextExhibitor.style.visibility = 'visible';
} else {
nextExhibitor.style.visibility = 'hidden';
}

topLinks.style.visibility = 'visible';
bottomPanel.htmlElement.style.position = 'static';

if (exhibitor.productIdToDisplay) { 
productsPanel.loadProductWithProductId(exhibitor.productIdToDisplay, exhibitor.exhibitorId);
bottomPanel.tabMenu.selectTab(GeGlobals.PRODUCT_NAME_PLURAL);
} else {
productsPanel.loadProduct(null);
bottomPanel.tabMenu.selectTab('Company');
}

var links = '';

if (GeGlobals.USER_ID) { 
links = '<center><table cellspacing="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0px;"><tr valign="middle">';
if (ffmConfig.PERMIT_APPOINTMENTS && ffmConfig.IS_ATTENDEE)
links += '<td><a class="' + cssClassPrefix + 'TopLink" href="' + FfPaths.FF_ROOT_URL + '/../goExpo/attendee/chooseAppointmentSchedule.php?__id=' + exhibitor.exhibitorId + '">Make Appointment</a></td><td>|</td>';
if (ffmConfig.PERMIT_MESSAGING)
links += '<td><a class="' + cssClassPrefix + 'TopLink" href="' + FfPaths.FF_ROOT_URL + '/../goExpo/exhibitor/viewExhibitorProfile.php?__id=' + exhibitor.exhibitorId + '">Contact</a></td><td>|</td>';
if (GeGlobals.PERMIT_PLANNER) {

links += '<td>' + GeGuiMediator.getAddUserToPlannerHtml(exhibitor.contactId, exhibitor.plannerId, true, true) + '</td>';
} else {
links + '<td></td>';
}
links += '</tr></table></center>';
} else if (ffmConfig.USER_ID) { 

} else { 
var url = FfPaths.FF_ROOT_URL + '/../goExpo/login.php?goTo=' + ffUrlEncode(FfPaths.FF_ROOT_URL + '/../goExpo/exhibitor/viewExhibitorProfile.php?__id=' + exhibitor.exhibitorId);
if (ffmConfig.GOEXPO_PERMIT_ATTENDEE)
links = '[<a class="' + cssClassPrefix + 'TopLink" href="' + url + '">Login Here to Add to Planner or Contact</a>]';
}
topLinks.innerHTML = links;






setTimeout('document.getElementById("' + bottomPanel.htmlId + '").style.visibility="visible";', 500);

} else {
productsPanel.loadProduct(null);
companyName.innerHTML = 'This booth is available.';
companyLogo.style.visibility = 'hidden';
companyLogo.style.position = 'absolute';
topLinks.style.visibility = 'hidden';
bottomPanel.htmlElement.style.visibility = 'hidden';
bottomPanel.htmlElement.style.position = 'absolute';
nextExhibitor.style.visibility = 'hidden';
prevExhibitor.style.visibility = 'hidden';
productsPanel.hide();
}
}

this.show = show;
function show(boothNumber, exhibitorId)
{

var newExhibitor;


if (exhibitorId)
newExhibitor = GeFpServerMediatorNew.getPopupExhibitor(boothNumber, exhibitorId);
else
newExhibitor = GeFpServerMediatorNew.getPopupExhibitor(boothNumber);

if (!newExhibitor) 
return;

if (!newExhibitor.companyName) 
return;

bottomPanel.pane.style.overflow = 'hidden';
htmlElement.style.visibility = 'visible';

FfFader.fadeIn(topPanel.id);
FfFader.fadeIn(bottomPanel.htmlId);

isFadingElement.value = 'true';

loadExhibitor(newExhibitor);

FfResizeAnimator.resize(bottomPanel.pane.id, TAB_PANEL_PANE_HEIGHT, null, null, null, null, null, null, productsPanel.loadVideoIfNeededJs(htmlId) + 'document.getElementById("' + bottomPanel.pane.id + '").style.overflow="auto"');
}

this.hide = hide;
function hide()
{

companyLogo.style.visibility = 'hidden';
topLinks.style.visibility = 'hidden';
nextExhibitor.style.visibility = 'hidden';
prevExhibitor.style.visibility = 'hidden';

productsPanel.loadProduct(null);
bottomPanel.pane.style.overflow = 'hidden';
FfFader.fadeOut(topPanel.id);
FfFader.fadeOut(bottomPanel.htmlId, 'document.getElementById("' + htmlId + '").style.visibility="hidden";document.getElementById("' + bottomPanel.htmlId + '").style.visibility="hidden";');
FfResizeAnimator.resize(bottomPanel.pane.id, 0, TAB_PANEL_PANE_HEIGHT);
}

this.showCompanyPanel = showCompanyPanel;
function showCompanyPanel()
{
companyPanel.populate(exhibitor.exhibitorId);
bottomPanel.displayPane(companyPanel.htmlElement);
}

this.showProductsPanel = showProductsPanel;
function showProductsPanel()
{
bottomPanel.displayPane(productsPanel.htmlElement);
}

this.loadNextExhibitor = loadNextExhibitor;
function loadNextExhibitor()
{
var newExhibitor = GeFpServerMediatorNew.getPopupExhibitor(exhibitor.boothNumber, null, exhibitor.listOffset + 1);
if (newExhibitor)
loadExhibitor(newExhibitor);
}

this.loadPreviousExhibitor = loadPreviousExhibitor;
function loadPreviousExhibitor()
{
var newExhibitor = GeFpServerMediatorNew.getPopupExhibitor(exhibitor.boothNumber, null, exhibitor.listOffset - 1);
if (newExhibitor)
loadExhibitor(newExhibitor);
}
}



function GeFpGuiMediatorClass()
{



var popup = new GeFpPopup();
this.popup = popup;

this.showBoothPopup = showBoothPopup;
function showBoothPopup(boothNumber, exhibitorId, boothCenterX, boothCenterY) 
{

if (!this.popup.htmlElement) {
this.popup.createElement();
this.popup.htmlElement.style.position = 'absolute';
this.popup.htmlElement.style.zIndex = '600';



document.body.appendChild(this.popup.htmlElement);
}
var viewerPos = ffmh.getAbsolutePosition(ffmViewer.getViewerElement());
this.popup.htmlElement.style.left = (viewerPos.x + 5) + 'px';
this.popup.htmlElement.style.top = (viewerPos.y + 5) + 'px';
searcher.searchPanel.setPaneVisible(false);
this.popup.show(boothNumber, exhibitorId);


if (!ffmConfig.CAN_EDIT)
boothHelper.showSelectedBoothMarker(boothCenterX, boothCenterY);
}

this.mouseInBoothPopup = mouseInBoothPopup;
function mouseInBoothPopup(e)
{
if (!this.popup.htmlElement)
return false;
return ffmh.mouseInElement(e, this.popup.htmlElement, ffmViewer.lastMousePosition) && this.popup.htmlElement.style.visibility == 'visible';
}

this.hideOrShowVideo = hideOrShowVideo;
function hideOrShowVideo(maximize)
{
if (maximize) {
popup.productsPanel.removeVideoIfNeeded();
} else {
popup.productsPanel.restoreVideoIfNeeded();
}
}

this.hideBoothPopup = hideBoothPopup;
function hideBoothPopup()
{
if (this.popup.htmlElement) {
this.popup.hide();
}
}
}

GeFpGuiMediator = new GeFpGuiMediatorClass();




function GeFpSearcher()
{


var searchPanel = new FfSearchPanel(['Company', 'Booth'], doSearch, null, null, GeFpGuiMediator.hideOrShowVideo);
this.searchPanel = searchPanel;

var focus = false;
var listDiv;

this.visible = true; 
this.selectedExhibitorId;
this.selectedBoothId;
this.MARKER_WIDTH = 70;
this.MARKER_HEIGHT = 48;
this.SMALL_MARKER_WIDTH = 3;
this.SMALL_MARKER_HEIGHT = 7;
this.loadedExhibitors;
this.markedExhibitors;
this.searchStr = '';
this.searchType = 'Company';

this.exhibitorResults = null;
this.LIST_TYPE_ENUM_ALL = 1;
this.LIST_TYPE_ENUM_SEARCH = 2;
this.LIST_TYPE_ENUM_PLANNER = 3;
this.LIST_TYPE_ENUM_APPOINTMENT_DAY = 4;
this.LIST_TYPE_ENUM_PLANNER_EXHIBITOR_IDS = 5;
this.LIST_TYPE_ENUM_PLANNER_BOOTH_IDS = 6;
this.listType = this.LIST_TYPE_ENUM_ALL;



this.loadBoothNumbers = loadBoothNumbers;
function loadBoothNumbers(boothNumbers)
{
searcher.exhibitorResults.setPagify(false);
mediator.getExhibitorsForBoothNumbers(boothNumbers, searcher.processLoadBoothNumbersResponse);
}


this.processLoadBoothNumbersResponse = processLoadBoothNumbersResponse;
function processLoadBoothNumbersResponse(xmlHttp)
{
if (xmlHttp.responseXML && xmlHttp.responseXML.documentElement) {
var exhibitors = new GeExhibitorHolder();
exhibitors.readFromXml(xmlHttp.responseXML.documentElement);
searcher.exhibitorResults.paint(searcher.getExhibitorListHtml(exhibitors));
searcher.initializeMarkers(exhibitors);
}
}



this.loadBoothIds = function(boothIds)
{
searcher.exhibitorResults.setPagify(false);
mediator.getExhibitorsForBoothIds(boothIds, searcher.processLoadBoothNumbersResponse);
}



this.loadExhibitorIds = loadExhibitorIds;
function loadExhibitorIds(exhibitorIds)
{
searcher.exhibitorResults.setPagify(false);
client.requestExhibitorsForExhibitorIds(exhibitorIds, searcher.processLoadBoothNumbersResponse);
}



this.initializeMarkers = initializeMarkers;
function initializeMarkers(exhibitors)
{
searcher.markedExhibitors = exhibitors;
if (!ffmConfig.CAN_EDIT) {
searcher.createMarkers(exhibitors);
searcher.setMarkersVisible(true);
}

if (exhibitors.exhibitors && exhibitors.exhibitors[0]) {
if (ffmConfig.ZOOM_BOOTH_NUMBER) {
var exhibitor = exhibitors.getExhibitorByBoothNumber(ffmConfig.ZOOM_BOOTH_NUMBER);
if (exhibitor) {
var center = exhibitor.getCenter();
searcher.selectExhibitor(exhibitor.exhibitorId, exhibitor.boothId, exhibitor.boothNumber, exhibitor.areaId, center.x, center.y);
return;
}
}
if (exhibitors.exhibitors.length == 1) {

var exhibitor = exhibitors.exhibitors[0];
var center = exhibitor.getCenter();
searcher.selectExhibitor(exhibitor.exhibitorId, exhibitor.boothId, exhibitor.boothNumber, exhibitor.areaId, center.x, center.y);
} else {

geFloorPlan.selectAreaId(exhibitors.exhibitors[0].areaId);
}
}
}



this.findExhibitors = findExhibitors;
function findExhibitors(searchStr, searchType)
{
this.searchStr = searchStr;
this.searchType = searchType;
searcher.listType = this.LIST_TYPE_ENUM_SEARCH;
searcher.exhibitorResults.setPagify(true);
searcher.exhibitorResults.reset();
}

this.loadSearchExhibitors = loadSearchExhibitors;
function loadSearchExhibitors(page, rowsPerPage)
{
client.requestFindExhibitors(this.searchStr, page, rowsPerPage, this.searchType, this.processFindExhibitorsResponse);
}


this.processFindExhibitorsResponse = processFindExhibitorsResponse;
function processFindExhibitorsResponse(xmlHttp)
{
if (xmlHttp.responseXML && xmlHttp.responseXML.documentElement) {
var exhibitors = new GeExhibitorHolder();
exhibitors.readFromXml(xmlHttp.responseXML.documentElement);


searcher.loadedExhibitors = exhibitors;
searcher.exhibitorResults.totalRows = exhibitors.totalExhibitors;
searcher.exhibitorResults.paint(searcher.getExhibitorListHtml(exhibitors));
} else { 
searcher.printNoResults();
searcher.loadedExhibitors = exhibitors;
}
}



this.loadAllExhibitors = loadAllExhibitors;
function loadAllExhibitors()
{
searcher.listType = this.LIST_TYPE_ENUM_ALL;
searcher.exhibitorResults.setPagify(true);
searcher.exhibitorResults.reset();
}

this.requestAllExhibitors = requestAllExhibitors;
function requestAllExhibitors(page, rowsPerPage)
{
searcher.exhibitorResults.setPagify(true);

searcher.searchPanel.searchString.value = '';
client.requestAllExhibitors(page, rowsPerPage, this.processGetAllExhibitorsResponse);
}


this.processGetAllExhibitorsResponse = processGetAllExhibitorsResponse;
function processGetAllExhibitorsResponse(xmlHttp)
{
if (xmlHttp.responseXML && xmlHttp.responseXML.documentElement) {
var exhibitors = new GeExhibitorHolder();
exhibitors.readFromXml(xmlHttp.responseXML.documentElement);


searcher.loadedExhibitors = exhibitors;
searcher.exhibitorResults.totalRows = exhibitors.totalExhibitors;
searcher.exhibitorResults.paint(searcher.getExhibitorListHtml(exhibitors));
}
}



this.loadExhibitorsByAppointmentDay = loadExhibitorsByAppointmentDay;
function loadExhibitorsByAppointmentDay()
{
client.requestExhibitorsForAppointmentDay(ffmConfig.USER_ID, ffmConfig.APPOINTMENT_DAY, this.processGetExhibitorsByAppointmentDayResponse);
}


this.processGetExhibitorsByAppointmentDayResponse = processGetExhibitorsByAppointmentDayResponse;
function processGetExhibitorsByAppointmentDayResponse(xmlHttp)
{
if (xmlHttp.responseXML && xmlHttp.responseXML.documentElement) {
var exhibitors = new GeExhibitorHolder();
exhibitors.readFromXml(xmlHttp.responseXML.documentElement);

searcher.loadedExhibitors = exhibitors;
searcher.exhibitorResults.paint(searcher.getExhibitorListHtml(exhibitors));
searcher.initializeMarkers(exhibitors);
}
}



this.getExhibitorElement = getExhibitorElement;
function getExhibitorElement(exhibitorId, boothId)
{
return document.getElementById('geFpExhibitorId' + exhibitorId + '_' + boothId);
}

this.unselectExhibitor = unselectExhibitor;
function unselectExhibitor()
{
if (this.selectedExhibitorId) {
var exhibitorElement = searcher.getExhibitorElement(this.selectedExhibitorId, this.selectedBoothId);
if (exhibitorElement) { 
exhibitorElement.className = 'geFpExhibitor';
}
this.selectedExhibitorId = null;
this.selectedBoothId = null;
}
}

this.selectExhibitor = selectExhibitor;
function selectExhibitor(exhibitorId, boothId, boothNumber, areaId, boothCenterX, boothCenterY) 
{
if (areaId == 0) { 

FfWindow.showDialog('Booth Not on Floor Plan', 300, 60, '<div style="width:280px;height:40px;">Sorry, but booth ' + boothNumber + ' has yet to be added to the floor plan.</div>', null, null, 'ffSectionTitleJs2');
return;
}
this.unselectExhibitor();
var exhibitorElement = searcher.getExhibitorElement(exhibitorId, boothId);
exhibitorElement.className = 'geFpExhibitorSelected';
this.selectedExhibitorId = exhibitorId;
this.selectedBoothId = boothId;
this.searchPanel.setPaneVisible(false);
boothHelper.centerOnExhibitor(boothNumber, exhibitorId, areaId, boothCenterX, boothCenterY);
}

this.createMarkerElement = createMarkerElement;
function createMarkerElement(boothId, boothNumber, x, y)
{
var div = document.createElement('div');
div.id = 'geFpExhibitorMarkerId' + boothId;
div.className = 'geFpExhibitorMarker';

var left = Math.round(x*ffmGlobals.currentScale) - Math.floor(this.MARKER_WIDTH/2) + 2; 
var top = Math.round(y*ffmGlobals.currentScale) - this.MARKER_HEIGHT;

div.style.left = left + 'px';
div.style.top = top + 'px';
div.style.width = this.MARKER_WIDTH + 'px';
div.style.height = this.MARKER_HEIGHT + 'px';


div.onmousemove = FfmDisableEvent;
div.onclick = FfmDisableEvent;
div.onmousedown = FfmDisableEvent;
div.onmouseup = FfmDisableEvent;
div.onmouseover = FfmDisableEvent;
div.onmouseout = FfmDisableEvent;



var img = document.createElement('img');

var src = 'images/marker.png';



if (ffmConfig.IS_IE_6)
src = 'images/marker.gif';

img.src = src;


img.onmousemove = FfmDisableEvent;
img.onclick = FfmDisableEvent;
img.onmousedown = FfmDisableEvent;
img.onmouseup = FfmDisableEvent;
img.onmouseover = FfmDisableEvent;
img.onmouseout = FfmDisableEvent;



var divI = document.createElement('div');
divI.className = 'geFpExhibitorMarkerNumber';
divI.innerHTML = (boothNumber ? boothNumber : 'TBD');


divI.onmousemove = FfmDisableEvent;
divI.onclick = FfmDisableEvent;
divI.onmousedown = FfmDisableEvent;
divI.onmouseup = FfmDisableEvent;
divI.onmouseover = FfmDisableEvent;
divI.onmouseout = FfmDisableEvent;

div.appendChild(img);
div.appendChild(divI);

return div;
}

this.printMarker = printMarker;
function printMarker(boothId, boothNumber, x, y)
{
ffmViewer.getGridElement().appendChild(this.createMarkerElement(boothId, boothNumber, x, y));
}

this.createSmallMarkerElement = createSmallMarkerElement;
function createSmallMarkerElement(boothId, boothNumber, x, y)
{
var img = document.createElement('img');
img.id = 'geFpExhibitorSmallMarkerId' + boothId;
img.className = 'geFpExhibitorSmallMarker';
img.alt = boothNumber;
img.src = 'images/smallMarker.gif';

var left = Math.round(x/ffmConfig.MAP_WIDTH*ffmConfig.TILE_WIDTH) - Math.floor(this.SMALL_MARKER_WIDTH/2);
var top = Math.floor(y/ffmConfig.MAP_HEIGHT*ffmConfig.TILE_HEIGHT) - this.SMALL_MARKER_HEIGHT;

img.style.left = left + 'px';
img.style.top = top + 'px';
img.style.width = this.SMALL_MARKER_WIDTH + 'px';
img.style.height = this.SMALL_MARKER_HEIGHT + 'px';


img.onmousemove = FfmDisableEvent;
img.onclick = FfmDisableEvent;
img.onmousedown = FfmDisableEvent;
img.onmouseup = FfmDisableEvent;
img.onmouseover = FfmDisableEvent;
img.onmouseout = FfmDisableEvent;

return img;
}

this.printSmallMarker = printSmallMarker;
function printSmallMarker(boothId, boothNumber, x, y)
{
ffmViewFinder.getViewFinderElement().appendChild(this.createSmallMarkerElement(boothId, boothNumber, x, y));
}

this.getMarker = getMarker;
function getMarker(boothId)
{
return document.getElementById('geFpExhibitorMarkerId' + boothId);
}

this.getSmallMarker = getSmallMarker;
function getSmallMarker(boothId)
{
return document.getElementById('geFpExhibitorSmallMarkerId' + boothId);
}

this.setMarkersVisible = setMarkersVisible;
function setMarkersVisible(visible)
{
if (this.markedExhibitors) {
for (var i = 0; i < this.markedExhibitors.exhibitors.length; i++) {
if (this.markedExhibitors.exhibitors[i].areaId == ffmConfig.FP_AREA_ID) {
var markerElmnt = this.getMarker(this.markedExhibitors.exhibitors[i].boothId);
if (markerElmnt) {
markerElmnt.style.visibility = (visible ? 'visible' : 'hidden');
}
var smallMarkerElmnt = this.getSmallMarker(this.markedExhibitors.exhibitors[i].boothId);
if (smallMarkerElmnt) {

smallMarkerElmnt.style.visibility = (visible ? 'inherit' : 'hidden');
}
}
}
}
}

this.repositionMarker = repositionMarker;
function repositionMarker(boothId, x, y)
{
var marker = this.getMarker(boothId);
if (marker) {
marker.style.left = (x*ffmGlobals.currentScale - this.MARKER_WIDTH/2) + 'px';
marker.style.top = (y*ffmGlobals.currentScale - this.MARKER_HEIGHT) + 'px';
}
}

this.repositionMarkers = repositionMarkers;
function repositionMarkers()
{
if (this.markedExhibitors) {
for (var i = 0; i < this.markedExhibitors.exhibitors.length; i++) {
if (this.markedExhibitors.exhibitors[i].areaId == ffmConfig.FP_AREA_ID) {
var boothCenterX = this.markedExhibitors.exhibitors[i].x + this.markedExhibitors.exhibitors[i].width/2;
var boothCenterY = this.markedExhibitors.exhibitors[i].y + this.markedExhibitors.exhibitors[i].height/2;
this.repositionMarker(this.markedExhibitors.exhibitors[i].boothId, boothCenterX, boothCenterY);
}
}
}
}


this.getExhibitorHtml = getExhibitorHtml;
function getExhibitorHtml(exhibitor)
{
var center = exhibitor.getCenter();
var html = '';
html += '<table><tr valign="middle"><td>';
var escapedBoothNumber = FfStringHelper.escapeSingleQuotes(exhibitor.boothNumber);
html += '<div class="geFpExhibitorMarkerInList" onclick="searcher.selectExhibitor(\'' + exhibitor.exhibitorId + '\',\'' + exhibitor.boothId + '\',\'' + escapedBoothNumber + '\',\'' + exhibitor.areaId + '\',' + center.x + ',' + center.y + ');" style="width:' + this.MARKER_WIDTH + 'px;height:' + this.MARKER_HEIGHT + 'px;background-image:url(\'images/markerSearcherBg.png\');background-repeat:no-repeat;">';
html += '<div>' + (exhibitor.boothNumber ? exhibitor.boothNumber : 'TBD') + '</div>';
if (exhibitor.areaAbbreviation && ffmConfig.AREAS.length > 1) {
html +='<div class="geFpExhibitorMarkerArea">(' + exhibitor.areaAbbreviation + ')</div>';
}
html += '</div>';
html += '</td><td>';
html += '<div class="geFpExhibitor" id="geFpExhibitorId' + exhibitor.exhibitorId + '_' + exhibitor.boothId + '">';
var companyName = exhibitor.company;
if (!companyName)
companyName = '(Unassigned)';
html += '<div><a href="javascript:searcher.selectExhibitor(\'' + exhibitor.exhibitorId + '\',\'' + exhibitor.boothId + '\',\'' + escapedBoothNumber + '\',\'' + exhibitor.areaId + '\',' + center.x + ',' + center.y + ');" class="geFpExhibitorCompany">' + companyName + '</a></div>';

if (exhibitor.appointments.items.length > 0) {
for (var i = 0; i < exhibitor.appointments.items.length; i++) {
html += '<div class="geFpAppointment">' + exhibitor.appointments.items[i] + '</div>';
}
}
html += '</div>';
html += '</td></tr></table>';
return html;
}

this.getExhibitorListHtml = getExhibitorListHtml;
function getExhibitorListHtml(exhibitors)
{
var html = '';
for (var i = 0; i < exhibitors.exhibitors.length; i++) {
html += this.getExhibitorHtml(exhibitors.exhibitors[i]);
}
return html;
}

this.getListElement = getListElement;
function getListElement()
{
return document.getElementById('geFpListId');
}

this.printExhibitorList = printExhibitorList;
function printExhibitorList(exhibitors)
{
var list = this.getListElement();





this.exhibitorResults = new GeFpExhibitorResults();
this.exhibitorResults.appendTo(list);

}

this.printNoResults = printNoResults;
function printNoResults()
{
this.exhibitorResults.printHtml('<div class="geFpSearcherNoExhibitors">Sorry, no exhibitors were found.</div>');
}


this.createMarkers = createMarkers;
function createMarkers(exhibitors)
{

function sortExhibitor(a, b) {
return a.y - b.y;
}
exhibitors.exhibitors.sort(sortExhibitor);

for (var i = 0; i < exhibitors.exhibitors.length; i++) {
var boothCenterX = exhibitors.exhibitors[i].x + exhibitors.exhibitors[i].width/2;
var boothCenterY = exhibitors.exhibitors[i].y + exhibitors.exhibitors[i].height/2;
this.printMarker(exhibitors.exhibitors[i].boothId, exhibitors.exhibitors[i].boothNumber, boothCenterX, boothCenterY);
this.printSmallMarker(exhibitors.exhibitors[i].boothId, exhibitors.exhibitors[i].boothNumber, boothCenterX, boothCenterY);
}
}

this.setVisible = setVisible;
function setVisible(visible)
{
this.visible = visible;
var visibility = 'hidden';
if (visible) {
visibility = 'visible';
}

}

this.isVisible = isVisible;
function isVisible()
{
return this.visible;
}

this.isMouseInSearcher = isMouseInSearcher;
function isMouseInSearcher(e, mousePosition)
{

return ffmh.mouseInElement(e, this.searchPanel.htmlElement, mousePosition);
}

this.ignoreMouseWheel = ignoreMouseWheel;
function ignoreMouseWheel(e)
{

return this.isMouseInSearcher(e, ffmViewer.lastMousePosition);
}



this.doSearch = doSearch;
function doSearch(searchString, pane, selectedLabel)
{
searcher.findExhibitors(searchString.value, selectedLabel);
}

this.onSearchStringFocus = onSearchStringFocus;
function onSearchStringFocus()
{
focus = true;
searchPanel.onFocus();
}

this.onSearchStringBlur = onSearchStringBlur;
function onSearchStringBlur()
{
focus = false;
searchPanel.onBlur();
}

this.inFocus = inFocus;
function inFocus()
{
return focus;
}

this.createSearchPanel = createSearchPanel;
function createSearchPanel()
{
this.searchPanel.createElement();
this.searchPanel.htmlElement.style.position = 'absolute';
this.searchPanel.htmlElement.style.zIndex = '700';
this.searchPanel.htmlElement.style.width = '318px';

var searchMenu = document.createElement('div');
var html = '';
html += '<div class="geFpSearchExhibitors">';
html += '<a href="javascript:searcher.loadAllExhibitors();">All Exhibitors</a>';
if (!GeGlobals.FP_ONLY)
html += ' | <a href="' + FfPaths.FF_ROOT_URL + '/../goExpo/exhibitor/listExhibitorProfiles.php">Advanced Search</a>';
html += '</div>';
if (ffmConfig.IS_ATTENDEE && ffmConfig.PERMIT_APPOINTMENTS) {
html += '<div class="geFpSearchExhibitors2">';
html += '<a href="' + FfPaths.FF_ROOT_URL + '/../goExpo/attendee/appointmentsByDay.php">Map Appointments</a>';
html += '</div>';
}
searchMenu.innerHTML = html;
this.searchPanel.pane.appendChild(searchMenu);

listDiv = document.createElement('div');
listDiv.id = 'geFpListId';
this.searchPanel.pane.appendChild(listDiv);

this.searchPanel.searchString.onfocus = onSearchStringFocus;
this.searchPanel.searchString.onblur = onSearchStringBlur;

document.body.appendChild(this.searchPanel.htmlElement);
}
}
var searcher = new GeFpSearcher();



function GeFpExhibitorResults()
{
this.curPage = 1;
this.ROWS_PER_PAGE_DEFAULT = 50;
this.rowsPerPage = this.ROWS_PER_PAGE_DEFAULT;
this.inheritFrom = FfmSearchResults;
this.inheritFrom(0, this.curPage, this.rowsPerPage);
this.hideTotals = !GeGlobals.PERMIT_EXHIBITOR_TOTALS;

this.setPagify = setPagify;
function setPagify(pagify)
{
if (pagify)
this.rowsPerPage = this.ROWS_PER_PAGE_DEFAULT;
else
this.rowsPerPage = 10000;

}

this.loadPageHtml = loadPageHtml;
function loadPageHtml(page, rowsPerPage)
{

switch(searcher.listType) {
case searcher.LIST_TYPE_ENUM_ALL:
searcher.requestAllExhibitors(page, rowsPerPage);
break;
case searcher.LIST_TYPE_ENUM_SEARCH:
searcher.loadSearchExhibitors(page, rowsPerPage);
break;
case searcher.LIST_TYPE_ENUM_PLANNER:
searcher.loadBoothNumbers(ffmConfig.BOOTH_NUMBERS);
break;
case searcher.LIST_TYPE_ENUM_PLANNER_EXHIBITOR_IDS:
searcher.loadExhibitorIds(ffmConfig.EXHIBITOR_IDS);
break;
case searcher.LIST_TYPE_ENUM_PLANNER_BOOTH_IDS:
searcher.loadBoothIds(ffmConfig.BOOTH_IDS);
break;
case searcher.LIST_TYPE_ENUM_APPOINTMENT_DAY:
searcher.loadExhibitorsByAppointmentDay();
break;
default:
break;
}
}

this.reset = reset;
function reset()
{
this.curPage = 1;
this.loadPageHtml(this.curPage, this.rowsPerPage);
}
}


function GeQuickBooths()
{
this.areaId = null;
this.totalBooths = null;
this.booths = new Array();

this.setProperty = setProperty;
function setProperty(node)
{
var name = node.nodeName;
switch (name) {
case 'b':
var booth = new GeQuickBooth();
booth.readFromXml(node);
this.addBooth(booth);
break;
case 'ai':
var value = '';
if (node.childNodes[0])
value = node.childNodes[0].nodeValue;
this.areaId = parseInt(value);
break;
case 'tb':
var value = '';
if (node.childNodes[0])
value = node.childNodes[0].nodeValue;
this.totalBooths = parseInt(value);
break;
default:
break;
}
}

this.addBooth = addBooth;
function addBooth(booth)
{
this.booths.push(booth);
}

this.toString = toString;
function toString()
{
var str = 'Quick Booths:';
str += '</br> Area Id: ' + this.areaId + '; ';
str += '</br> Total Booths: ' + this.totalBooths + '; ';
for (var i = 0; i < this.booths.length; i++) {
str += ' </br>' + this.booths[i].toString();
}
return str;
}

this.getBooth = getBooth;
function getBooth(boothId)
{
for (var i = 0; i < this.booths.length; i++) {
if (this.booths[i].boothId == boothId) {
return this.booths[i];
}
}
}

this.getBoothByBoothNumber = getBoothByBoothNumber;
function getBoothByBoothNumber(boothNumber)
{
for (var i = 0; i < this.booths.length; i++) {
if (this.booths[i].boothNumber == boothNumber) {
return this.booths[i];
}
}
}

this.readFromXml = readFromXml;
function readFromXml(xmlDoc)
{
var nodes = xmlDoc.childNodes;
for (var i = 0; i < nodes.length; i++) {
this.setProperty(nodes[i]);
}
}
}

function GeQuickBooth(boothId, boothNumber, x, y, width, height, company, notBooth, displayText, actualWidth, actualHeight)
{
this.boothId = boothId;
this.boothNumber = boothNumber;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.company = company;
this.notBooth = notBooth;
this.displayText = displayText;
this.actualWidth = actualWidth;
this.actualHeight = actualHeight;
this.htmlElement;

this.toString = toString;
function toString()
{
return 'GeQuickBooth: boothId = ' + this.boothId + '; boothNumber = ' + this.boothNumber + '; x = ' + this.x + '; y = ' + this.y + '; width = ' + this.width + '; height = ' + this.height + '; company = ' + this.company + '; notBooth = ' + this.notBooth + '; displayText = ' + this.displayText;
}

this.setProperty = setProperty;
function setProperty(name, value)
{
switch (name) {
case 'bi':
this.boothId = parseInt(value);
break;
case 'bn':
this.boothNumber = value;
break;
case 'x':
this.x = parseInt(value);
break;
case 'y':
this.y = parseInt(value);
break;
case 'w':
this.width = parseInt(value);
break;
case 'h':
this.height = parseInt(value);
break;
case 'cn':
this.company = value;
break;
default:
break;
}
}

this.readFromXml = readFromXml;
function readFromXml(boothXml)
{
var nodes = boothXml.childNodes;
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].childNodes[0]) {
var propertyName = nodes[i].nodeName;
var propertyValue = nodes[i].childNodes[0].nodeValue;
this.setProperty(propertyName, propertyValue);
}
}
}



this.BOOTH_THICKNESS = 1;
this.BOOTH_COLOR = 'red';
this.HTML_CLASS_NAME = 'geQB';
this.HTML_ID_PREFIX = 'geQB';

this.getHtmlId = getHtmlId;
function getHtmlId()
{
return this.HTML_ID_PREFIX + this.boothId;
}

this.getDimensions = getDimensions;
function getDimensions()
{
var left = Math.round(ffmGlobals.currentScale*this.x);
var top = Math.round(ffmGlobals.currentScale*this.y);
var width = Math.round(ffmGlobals.currentScale*this.width) - this.BOOTH_THICKNESS;
if (width <= 0)
width = 1;
var height = Math.round(ffmGlobals.currentScale*this.height) - this.BOOTH_THICKNESS;
if (height <= 0)
height = 1;
return new FfmRectangle(left, top, width, height);
}

this.getActualDimensions = getActualDimensions;
function getActualDimensions()
{
var left = Math.round(this.x);
var top = Math.round(this.y);
var width = Math.round(this.width);
var height = Math.round(this.height);
return new FfmRectangle(left, top, width, height);
}

this.getCenter = getCenter;
function getCenter()
{
return GeQuickBooth.getBoothCenter(this.getActualDimensions());
}

this.createHtmlElement = createHtmlElement;
function createHtmlElement()
{
this.htmlElement = document.createElement('div');
this.htmlElement.id = this.getHtmlId();
this.htmlElement.className = this.HTML_CLASS_NAME;

var d = this.getDimensions();
this.htmlElement.style.left = d.left + 'px';
this.htmlElement.style.top = d.top + 'px';
this.htmlElement.style.width = d.width + 'px';
this.htmlElement.style.height = d.height + 'px';
this.htmlElement.style.border = this.BOOTH_THICKNESS + 'px solid ' + this.BOOTH_COLOR;


ffmh.disableMouseEvents(this.htmlElement);


}

this.draw = draw;
function draw()
{
this.createHtmlElement();
ffmViewer.getGridElement().appendChild(this.htmlElement);
}

this.resize = resize;
function resize()
{
if (!this.htmlElement)
return;
var d = this.getDimensions();
this.htmlElement.style.left = d.left + 'px';
this.htmlElement.style.top = d.top + 'px';
this.htmlElement.style.width = d.width + 'px';
this.htmlElement.style.height = d.height + 'px';
}
}

GeQuickBooth.getBoothCenter = function(d)
{
return new FfmPosition(d.left + Math.round(d.width/2), d.top + Math.round(d.height/2));
}


function GeAreaBooths(areaId)
{
this.areaId = areaId;
this.booths = new GeQuickBooths();
this.offset = 0;
this.totalBooths = null;

this.loadNextChunk = loadNextChunk;
function loadNextChunk()
{
client.requestQuickBooths(this.areaId, this.offset, ffmConfig.QUICK_BOOTH_CHUNKS, geQuickBoothsLoader.processQuickBoothsResponse);
}

this.readFromXml = readFromXml;
function readFromXml(xml)
{
this.booths.readFromXml(xml);
this.offset += ffmConfig.QUICK_BOOTH_CHUNKS; 
this.totalBooths = this.booths.totalBooths;
}

this.moreToRead = moreToRead;
function moreToRead()
{
return this.offset < this.totalBooths;
}

this.drawBooths = drawBooths;
function drawBooths()
{
for (i = 0; i < this.booths.booths.length; i++) {
this.booths.booths[i].draw();
}
}

this.resizeBooths = resizeBooths;
function resizeBooths()
{
for (i = 0; i < this.booths.booths.length; i++) {
this.booths.booths[i].resize();
}
}

this.getBooth = getBooth;
function getBooth(x, y)
{
for (i = 0; i < this.booths.booths.length; i++) {
if (x >= this.booths.booths[i].x && x <= this.booths.booths[i].x + this.booths.booths[i].width
    && y >= this.booths.booths[i].y && y <= this.booths.booths[i].y + this.booths.booths[i].height) {
return this.booths.booths[i];
}
}
return null;
}
}

function GeQuickBoothsLoader()
{
this.areaBooths = new Array();
this.currentAreaBoothIndex = 0;

this.initialize = initialize;
function initialize()
{
for (i = 0; i < ffmConfig.AREAS.length; i++) {
this.areaBooths.push(new GeAreaBooths(ffmConfig.AREAS[i].id));
}
}

this.clearBooths = clearBooths;
function clearBooths()
{
this.areaBooths = new Array();
}

this.loadNextChunk = loadNextChunk;
function loadNextChunk()
{
this.areaBooths[geFloorPlan.currentAreaIndex].loadNextChunk(); 
}

this.getAreaBoothIndex = getAreaBoothIndex;
function getAreaBoothIndex(areaId)
{
for (var i = 0; i < this.areaBooths.length; i++) {
if (this.areaBooths[i].areaId == areaId) {
return i;
break;
}
}
return null;
}


this.processQuickBoothsResponse = processQuickBoothsResponse;
function processQuickBoothsResponse(xmlHttp)
{
if (xmlHttp.responseXML && xmlHttp.responseXML.documentElement) {






}
}



this.processMouseMove = processMouseMove;
function processMouseMove(e)
{
if (GeFpGuiMediator.mouseInBoothPopup(e) || ffmViewFinder.mouseInViewFinderBorder(e)) {
geBoothMouseOverPopup.hide();
return;
}

var position = ffmh.getMousePosition(e);
var elmnt = ffmViewer.getViewerElement();


if (!ffmh.mouseInElement(e, elmnt, position)) {
return;
}

viewerPos = ffmh.getAbsolutePosition(ffmViewer.getViewerElement());
var ax = (position.x - viewerPos.x + ffmViewer.view.offsetX)/ffmGlobals.currentScale;
var ay = (position.y - viewerPos.y + ffmViewer.view.offsetY)/ffmGlobals.currentScale;

var areaBooths = geQuickBoothsLoader.areaBooths[this.currentAreaBoothIndex];
var booth = null;
if (areaBooths) 
booth = areaBooths.getBooth(ax, ay);
if (booth) {
geBoothMouseOverPopup.show(booth);
if (!booth.notBooth)
ffmViewer.getViewerElement().style.cursor = "pointer";
} else {
ffmViewer.getViewerElement().style.cursor = "crosshair";
geBoothMouseOverPopup.hide();
}
}

this.updateCurrentAreaBoothIndex = updateCurrentAreaBoothIndex;
function updateCurrentAreaBoothIndex()
{
for (j = 0; j < this.areaBooths.length; j++) {
if (this.areaBooths[j].areaId == geFloorPlan.getCurrentAreaId()) {
this.currentAreaBoothIndex = j;
return;
}
}
}

this.getBooth = getBooth;
function getBooth(ax, ay)
{
return geQuickBoothsLoader.areaBooths[this.currentAreaBoothIndex].getBooth(ax, ay);
}
}
var geQuickBoothsLoader = new GeQuickBoothsLoader();

function GeBoothMouseOverPopup()
{
this.HTML_ID = 'geBoothMouseOverPopup';
this.HTML_CLASS_NAME = 'geBoothMouseOverPopup';
this.OFFSET = 15;
this.htmlElement;

this.createHtmlElement = createHtmlElement;
function createHtmlElement()
{
this.htmlElement = document.createElement('div');
this.htmlElement.id = this.HTML_ID;
this.htmlElement.className = this.HTML_CLASS_NAME;


ffmh.disableMouseEvents(this.htmlElement);
}

this.draw = draw;
function draw()
{
this.createHtmlElement();
ffmViewer.getGridElement().appendChild(this.htmlElement);
}

this.getPosition = getPosition;
function getPosition()
{
var viewerPos = ffmh.getAbsolutePosition(ffmViewer.getViewerElement());
var mx = ffmViewer.lastMousePosition.x;
var my = ffmViewer.lastMousePosition.y;

var left = 0;
var top = 0;

var y = my - viewerPos.y;
var h = ffmViewer.view.height/3;
var row = Math.ceil(y/h);

var x = mx - viewerPos.x;
var w = ffmViewer.view.width/3;
var column = Math.ceil(x/w);






if (row <= 1) {

top = y + this.OFFSET;
} else if (row == 2) {
top = y - this.htmlElement.offsetHeight - this.OFFSET;
} else if (row >= 3) {
top = y - this.htmlElement.offsetHeight - this.OFFSET;
}

if (column <= 1) {
left = x + this.OFFSET;
} else if (column == 2) {
left = x - this.htmlElement.offsetWidth/2;
} else if (column >= 3) {
left = x - this.htmlElement.offsetWidth - this.OFFSET;
}

top += ffmViewer.view.offsetY;
left += ffmViewer.view.offsetX;

return new FfmPosition(left, top);
}

this.show = show;
function show(booth)
{
if (!this.htmlElement)
this.draw();
var text = booth.displayText;

if (!booth.notBooth) {
text += ' - ';
if (booth.company)
text += booth.company;
else if (booth.actualWidth && booth.actualHeight)
text += booth.actualWidth + "ft by " + booth.actualHeight + "ft - " + GeGlobals.AVAILABLE_BOOTH_MOUSE_OVER_HTML;
else
text += GeGlobals.AVAILABLE_BOOTH_MOUSE_OVER_HTML;
}

this.htmlElement.innerHTML = text;
var position = this.getPosition();
this.htmlElement.style.left = position.x +'px';
this.htmlElement.style.top = position.y + 'px';
this.htmlElement.style.visibility = 'visible';
}

this.hide = hide;
function hide()
{
if (this.htmlElement)
this.htmlElement.style.visibility = 'hidden';
}
}
var geBoothMouseOverPopup = new GeBoothMouseOverPopup();


function FfToolbar(buttons, rows)
{
var htmlElement;

this.getHtmlElement = getHtmlElement;
function getHtmlElement()
{
if (!htmlElement) {
htmlElement = document.createElement('table');
htmlElement.cellSpacing = '0px';
htmlElement.cellPadding = '0px';
var tableRow;
var cell;
var column;
var row = 0;

var columns = Math.ceil(buttons.length/rows);
for (var i = 0; i < buttons.length; i++) {
if (i % columns == 0) {
tableRow = htmlElement.insertRow(row++);
column = 0;
}
cell = tableRow.insertCell(column++);
cell.appendChild(buttons[i].getHtmlElement());
}
}
return htmlElement;
}
}
function FfTask(fn)
{

this.taskId = FfHelper.getNextHtmlId();
this.fn = fn;
}


function FfScheduler() { }

FfScheduler.tasks = new Array();

FfScheduler.getTask = function(taskId)
{
for (var i = 0; i < FfScheduler.tasks.length; i++) {
if (FfScheduler.tasks[i].taskId == taskId)
return FfScheduler.tasks[i];
}
return null;
}

FfScheduler.removeTask = function(taskId)
{
for (var i = 0; i < FfScheduler.tasks.length; i++) {
if (FfScheduler.tasks[i].taskId == taskId) {
FfScheduler.tasks.splice(i, 1);
return true;
}
}
return false;
}

FfScheduler.runTask = function(taskId, oneTimeOnly)
{
var task = FfScheduler.getTask(taskId);
if (task) {
task.fn();
if (oneTimeOnly)
FfScheduler.removeTask(taskId);
}
}

FfScheduler.registerTask = function(fn)
{
var task = new FfTask(fn);
FfScheduler.tasks.push(task);
return task;
}

FfScheduler.scheduleTask = function(registeredTask, sleepMs, oneTimeOnly)
{
if (oneTimeOnly)
var oneTimeStr = 'true';
else
var oneTimeStr = 'false';
setTimeout('FfScheduler.runTask(' + registeredTask.taskId + ',' + oneTimeStr + ')', sleepMs);
}

FfScheduler.scheduleOneTimeTask = function(fn, sleepMs)
{
var task = FfScheduler.registerTask(fn);
FfScheduler.scheduleTask(task, sleepMs, true);
}
function FfImageLoader(htmlId, loaderImg)
{
this.onLoad = function()
{
var img = document.getElementById(htmlId);
if (img) {
img.src = loaderImg.src;
img.width = loaderImg.width; 
img.height = loaderImg.height; 
}
}
}







function GeSponsors(labelText, refreshMilliseconds)
{
var htmlElement;
var htmlId = FfHelper.getNextHtmlId();
var sponsorsContainer;
var label;
var rows;
var columns;
var registeredTask;
var sponsors;
var height;
var width;
if (!refreshMilliseconds)
refreshMilliseconds = GeSponsors.DEFAULT_REFRESH_MILLISECONDS;
var cookieOffset = FfHelper.readCookie('GE_SPONSORS_NEXT_OFFSET');
var offset = -1; 
if (GeSponsors.ALPHABETIZE) {
if (cookieOffset)
offset = cookieOffset;
else
offset = -2;
}

function LinkCallback(href)
{
this.onClick = function()
{
window.open(href);
}
}

this.getHtmlElement = getHtmlElement;
function getHtmlElement()
{
if (!htmlElement) {
htmlElement = document.createElement('div');
htmlElement.id = htmlId;

label = document.createElement('div');
label.className = 'geSponsors';
label.innerHTML = labelText;
label.style.visibility = 'hidden';
htmlElement.appendChild(label);

sponsorsContainer = document.createElement('div');
sponsorsContainer.id = htmlId + 'Sponsors';
htmlElement.appendChild(sponsorsContainer);
}
return htmlElement;
}

this.setDimensionsWithoutRotation = setDimensionsWithoutRotation;
function setDimensionsWithoutRotation(newWidth, newHeight)
{
width = newWidth;
height = newHeight;
}

this.setDimensions = setDimensions;
function setDimensions(newWidth, newHeight)
{
setDimensionsWithoutRotation(newWidth, newHeight);

htmlElement.style.width = newWidth + 'px';
htmlElement.style.height = newHeight + 'px';


columns = Math.floor(newWidth/GeSponsors.CELL_WIDTH);
rows = Math.floor((newHeight - GeSponsors.LABEL_HEIGHT)/GeSponsors.CELL_HEIGHT);

rotateSponsors(true);
}

this.rotateSponsors = rotateSponsors;
function rotateSponsors(setDimensionsTrigger)
{
if (rows*columns <= 0)
return;



sponsors = GeFpServerMediatorNew.getSponsors(rows*columns, offset);
if (!sponsors) {
if (sponsorsContainer.firstChild)
sponsorsContainer.removeChild(sponsorsContainer.firstChild);
label.style.visibility = 'hidden';
return;
}

if (labelText)
label.style.visibility = 'visible';

var table = document.createElement('table');
table.style.borderSpacing = '0px 4px';
table.style.width = '100%';
table.cellSpacing = '0px';
table.cellPadding = '0px';

var tableRow;
var cell;
var column;
var row = 0;

var cellWidth = Math.round(100/columns);

for (var i = 0; i < sponsors.length; i++) {
if (i % columns == 0) {
tableRow = table.insertRow(row++);
column = 0;
}
cell = tableRow.insertCell(column++);
cell.style.textAlign = 'center';

var id = FfHelper.getNextHtmlId();

var img = document.createElement('img');
img.id = id;

var loaderImg = document.createElement('img');
var loader = new FfImageLoader(id, loaderImg);
loaderImg.onload = loader.onLoad;
loaderImg.src = sponsors[i].image;
img.alt = sponsors[i].companyName;
img.style.border = 'none';
img.style.margin = '3px';

if (loaderImg.complete) {
img.src = sponsors[i].image;
} else {
img.src = FfPaths.FF_ROOT_URL + '/images/blank.gif';
}

var callback = new LinkCallback(sponsors[i].url);
img.onclick = callback.onClick;
img.style.cursor = 'pointer';

cell.appendChild(img);


cell.style.width = cellWidth + '%';
}


FfHelper.setFirstChild(sponsorsContainer, table);

FfFader.fadeIn(sponsorsContainer.id);

if (!registeredTask) {
registeredTask = FfScheduler.registerTask(rotateSponsors);
FfScheduler.scheduleTask(registeredTask, refreshMilliseconds);
}

if (!setDimensionsTrigger)
FfScheduler.scheduleTask(registeredTask, refreshMilliseconds);

if (GeSponsors.ALPHABETIZE) {
var lastOffset = parseInt(sponsors[sponsors.length - 1].offset)
if (lastOffset)
offset = lastOffset + 1;
else
offset = 1;
FfHelper.createCookie('GE_SPONSORS_NEXT_OFFSET', offset);
}
}

this.resizeWidthToParent = resizeWidthToParent;
function resizeWidthToParent()
{
var fudgeFactor = 10; 
setDimensions(htmlElement.offsetParent.offsetWidth - fudgeFactor, height);
}
}

GeSponsors.LABEL_HEIGHT = 20;

GeSponsors.CELL_WIDTH = 135;
GeSponsors.CELL_HEIGHT = 95;
GeSponsors.DEFAULT_REFRESH_MILLISECONDS = 15000;
GeSponsors.ALPHABETIZE = true;


(function(){
  var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;

  
  this.FfClass = function(){};

  
  FfClass.extend = function(prop) {
    var _super = this.prototype;

    
    
    initializing = true;
    var prototype = new this();
    initializing = false;

    
    for (var name in prop) {
      
      prototype[name] = typeof prop[name] == "function" &&
        typeof _super[name] == "function" && fnTest.test(prop[name]) ?
        (function(name, fn){
          return function() {
            var tmp = this._super;

            
            
            this._super = _super[name];

            
            
            var ret = fn.apply(this, arguments);
            this._super = tmp;

            return ret;
          };
        })(name, prop[name]) :
        prop[name];
    }

    
    function FfClass() {
      
      if ( !initializing && this.init )
        this.init.apply(this, arguments);
    }

    
    FfClass.prototype = prototype;

    
    FfClass.constructor = FfClass;

    
    FfClass.extend = arguments.callee;

    return FfClass;
  };
})();



var FfField = FfClass.extend(
{
name : null,
label : null,
required : null,
value : null,
error : null,
isButton : false,
errorDiv : null,
labelElement : null,
inFocus : false,
subFields : null,
subFieldValueSeparator : '',
subFieldDisplaySeparator : '',
subFieldsCannotBeEmpty : true,

init : function(params)
{
this.name = params[0];
if (params[1])
this.label = params[1];
else
this.label = this.name;
if (params[2])
this.required = params[2];
else
this.required = FfField.NOT_REQUIRED;
},

setValue : function(value)
{
if (this.subFields) {
for (var i = 0; i < this.subFields.length; i++) {
this.subFields[i].clearValue();
}
}
this.setError(null);
this.value = value;
},

getValue : function()
{
if (this.subFields) {
var value = '';
for (var i = 0; i < this.subFields.length; i++) {
if (!this.subFields[i].isEmpty())
value += (i > 0 ? this.subFieldValueSeparator : '') + this.subFields[i].getValue();
}
if (value == '')
return null;
return value;
}
return this.value;
},

clearValue : function()
{
this.setValue(null);
},

isEmpty : function()
{
return FfField.isBlank(this.getValue());
},

checkForBlank : function()
{
if (this.isEmpty()) {
this.setError('cannot be blank!');
return true;
}
return false;
},

isValid : function()
{
this.setError(null);

if (this.error)
return false;

if (this.required == FfField.REQUIRED)
if (this.checkForBlank())
return false;

if (!this.isEmpty() && this.subFields) {
for (var i = 0; i < this.subFields.length; i++) {
if ((this.subFieldsCannotBeEmpty && this.subFields[i].isEmpty()) || !this.subFields[i].isValid()) {
this.setError('is invalid!');
return false;
}
}
}

return true;
},

getErrorDiv : function()
{
if (this.errorDiv)
return this.errorDiv;
this.errorDiv = document.createElement('div');
this.errorDiv.id = this.name + 'Error';
this.errorDiv.className = 'fieldError';
this.errorDiv.style.whiteSpace = 'normal';
return this.errorDiv;
},

getLabelElement : function()
{
if (this.labelElement)
return this.labelElement;
var labelElement = document.createElement('label');
labelElement.id = this.name + 'Label';
labelElement.htmlFor = this.name + 'Id';
labelElement.className = 'isValid';
var html = this.label + ':';
if (this.required == FfField.REQUIRED) {
html = '<span class="required">*</span>' + html;
}
labelElement.innerHTML = html;
this.labelElement = labelElement;
return this.labelElement;
},

printLabel : function(htmlElement)
{
var container = document.createElement('div');
var labelElement = this.getLabelElement();
container.appendChild(labelElement);
container.appendChild(this.getErrorDiv());
htmlElement.appendChild(container);
},

setError : function(error)
{
if (error || this.error) {
this.error = error;
this.getErrorDiv().innerHTML = (error ? error : '');
this.getLabelElement().className = (error ? 'notValid' : 'isValid');
}
},

printEditableField : function(htmlElement)
{
if (this.subFields) {
for (var i = 0; i < this.subFields.length; i++) {
if (i > 0) {
var span = document.createElement('span');
span.className = 'ffSubFields';
span.innerHTML = this.subFieldDisplaySeparator;
htmlElement.appendChild(span);
}
this.subFields[i].printEditableField(htmlElement);
}
} else {
var span = document.createElement('span');
span.className = 'FORMfields';
span.innerHTML = this.value;
htmlElement.appendChild(span);
}
},

printField : function(htmlElement)
{
var divField = document.createElement('div');
divField.id = this.name + '__editable';
divField.className = 'ffField';
this.printEditableField(divField);
htmlElement.appendChild(divField);
},

addSubField : function(field)
{
if (!this.subFields)
this.subFields = new Array();
this.subFields.push(field);
}
});

FfField.REQUIRED = 1;
FfField.NOT_REQUIRED = 2;

FfField.SEP = '_';

FfField.isBlank = function(value)
{
if (value == null || FfStringHelper.trim(value) == '')
return true;
return false;
}


var FfForm = FfClass.extend(
{
fields : new Array(),

addField : function(params)
{
var fName = params[0];
FfForm.loadField(fName);
var initStr = 'new ' + fName + '(params)';
params.splice(0, 1);
var field = eval(initStr);
this.fields.push(field);
},

getField : function(name)
{
for (var i = 0; i < this.fields.length; i++) {
if (this.fields[i].name == name)
return this.fields[i];
}
return null;
},

validate : function()
{
var isError = false;
for (var i = 0; i < this.fields.length; i++) {
if (!this.fields[i].isValid())
isError = true;
}
return !isError;
},

checkValues : function()
{
var noError = this.validate();
if (!noError) {

FfWindow.showMessageDialog('Error', 'Please correct the form errors.');
}
return noError;
},

print : function(htmlElement)
{
var form = document.createElement('div');

var buttons = document.createElement('div');
buttons.className = 'buttons';
var buttonsTable = document.createElement('table');
buttons.appendChild(buttonsTable);
var buttonRow = buttonsTable.insertRow(buttonsTable.rows.length);

var fields = document.createElement('table');
fields.className = 'ffTableSetFORMfields';
for (var i = 0; i < this.fields.length; i++) {
var n = i % 2 + 1;
if (!this.fields[i].isButton) {
var row = fields.insertRow(fields.rows.length);
row.className = 'ffTableSetFORMfields';
var cell = row.insertCell(0);
cell.className = 'ffTableSetFORMfieldsLabel' + n;
var div = document.createElement('div');
div.className = 'cell';
this.fields[i].printLabel(div);
cell.appendChild(div);
cell = row.insertCell(1);
cell.className = 'ffTableSetFORMfieldsField' + n;
var div = document.createElement('div');
div.className = 'cell';
this.fields[i].printField(div);
cell.appendChild(div);
} else {

var cell = buttonRow.insertCell(buttonRow.cells.length);
this.fields[i].printField(cell);
}
}
form.appendChild(fields);
form.appendChild(buttons);
htmlElement.appendChild(form);
},

setValues : function(values)
{
if (!values) {
return;
}
for (var i = 0; i < values.length; i++) {
var field = this.getField(values[i][0]);
if (field)
field.setValue(values[i][1]);
}
},

save : function(url)
{
for (var i = 0; i < this.fields.length; i++) {
url = ffAddParameterToUrl(url, 'ff_save_' + this.fields[i].name, this.fields[i].getValue());
}

var xmlHttp = new FfAjaxRequest(url, null, true);
if (!xmlHttp || !xmlHttp.responseText) 
return null;
return eval('(' + xmlHttp.responseText + ')');
},

load : function(url)
{

var xmlHttp = new FfAjaxRequest(url);
if (!xmlHttp || !xmlHttp.responseText) 
return null;
var values = eval('(' + xmlHttp.responseText + ')');
this.setValues(values);
},

inFocus : function()
{
for (var i = 0; i < this.fields.length; i++) {
if (this.fields[i].inFocus) {
return true;
}
}
return false;
},

clearValues : function()
{
for (var i = 0; i < this.fields.length; i++) {
this.fields[i].clearValue();
}
}
});

FfForm.loadField = function(fieldName)
{
FfJsLoader.loadModule(fieldName);
}
function GeBoothWindow() { }

GeBoothWindow.window = null;
GeBoothWindow.reservationForm = null;
GeBoothWindow.boothId = null;

GeBoothWindow.getWindow = function()
{

if (GeBoothWindow.window)
return GeBoothWindow.window;

var win = new FfWindow('Booth Reservation:', 400, 300);
win.setDraggable(true);
win.createElement();
document.body.appendChild(win.htmlElement);

var daysFromNow = new Date((new Date()).getTime() + (30 * 86400000));


var form = new FfForm();
form.addField(['FfTextField', 'company_name', 'Company Name', FfField.REQUIRED, 100]);
form.addField(['FfTextField', 'contact_name', 'Contact\'s Name', FfField.NOT_REQUIRED, 40]);
form.addField(['FfEmailField', 'contact_email', 'Contact\'s Email', FfField.NOT_REQUIRED]);
form.addField(['FfDateField', 'expiration', 'Expiration', FfField.NOT_REQUIRED, null, new Date(), daysFromNow]);
form.addField(['FfCheckboxField', 'notify_salesperson', 'Expiration Email']);

var saveActions = [
function()
{
if (form.checkValues()) {

GeAjaxMediator.saveBoothReservation(form, GeBoothWindow.boothId);

GePinger.pingSoon();
GeBoothWindow.window.hide();
}
}
];

var clearActions = [
function()
{

GeAjaxMediator.deleteBoothReservation(form, GeBoothWindow.boothId);

GePinger.pingSoon();
GeBoothWindow.window.hide();
}
];

form.addField(['FfSubmitField', 'save', 'Save Reservation', saveActions]);
form.addField(['FfSubmitField', 'clear', 'Clear Reservation', clearActions]);
form.print(win.getContentElement());

win.htmlElement.style.zIndex = '1001';

GeBoothWindow.window = win;
GeBoothWindow.reservationForm = form;
return GeBoothWindow.window;
}

GeBoothWindow.show = function(boothId, boothNumber)
{
var win = GeBoothWindow.getWindow();
win.setTitle('Booth ' + boothNumber + ' Reservation:');
GeBoothWindow.boothId = boothId;

GeBoothWindow.reservationForm.clearValues();


var daysFromNow = new Date((new Date()).getTime() + 14*86400000);
GeBoothWindow.reservationForm.getField('expiration').setDate(daysFromNow);
GeBoothWindow.reservationForm.getField('notify_salesperson').setValue(true);

GeAjaxMediator.loadBoothReservation(GeBoothWindow.reservationForm, GeBoothWindow.boothId);
win.show();
}

GeBoothWindow.mouseIn = function(e)
{
if (!GeBoothWindow.window)
return false;
return GeBoothWindow.window.isVisible() && ffmh.mouseInElement(e, GeBoothWindow.window.htmlElement, ffmViewer.lastMousePosition);
}

GeBoothWindow.inFocus = function()
{
if (!GeBoothWindow.window)
return false;
return GeBoothWindow.reservationForm.inFocus();
}









function GeFloorPlan()
{

this.tabPanel;
this.SHOW_BOOTH_DELAY_MS = 1;
this.showBgBooths = false;
this.messageWindow = new FfWindowOld();
this.currentAreaIndex;
this.toolbar;
this.sponsors;
this.ignoreBoothPopup = false;


this.resizeToScreen = resizeToScreen;
function resizeToScreen()
{


var ffd = ffmh.getScreenDimensions();

var header = document.getElementById('geFpHeaderId');
var headerPos = ffmh.getAbsolutePosition(header);

searcher.searchPanel.htmlElement.style.left = headerPos.x + 'px';
searcher.searchPanel.htmlElement.style.top = 79 + 'px';
var searchPos = ffmh.getAbsolutePosition(searcher.searchPanel.htmlElement);

geFloorPlan.toolbar.getHtmlElement().style.left = (headerPos.x + 321) + 'px';
geFloorPlan.toolbar.getHtmlElement().style.top = 2 + 'px';

geFloorPlan.sponsors.getHtmlElement().style.left = (headerPos.x + 445) + 'px';
geFloorPlan.sponsors.getHtmlElement().style.top = 5 + 'px';
var sponsorsPos = ffmh.getAbsolutePosition(geFloorPlan.sponsors.getHtmlElement());
geFloorPlan.sponsors.setDimensions(ffd.width - sponsorsPos.x - 3, 116);

geFloorPlan.tabPanel.htmlElement.style.left = headerPos.x + 'px';
geFloorPlan.tabPanel.htmlElement.style.top = 123 + 'px';

geFloorPlan.tabPanel.htmlElement.style.width = (ffd.width - 12) + 'px';
var tabPanelPos = ffmh.getAbsolutePosition(geFloorPlan.tabPanel.htmlElement);
geFloorPlan.tabPanel.pane.style.height = (ffd.height - tabPanelPos.y - 35) + 'px';

var tabs = geFloorPlan.tabPanel.htmlElement;
var tabsPos = ffmh.getAbsolutePosition(tabs);

ffmViewer.resize(tabsPos.x + 4,
 tabsPos.y + 23,
 geFloorPlan.tabPanel.pane.offsetWidth - 4, 
 geFloorPlan.tabPanel.pane.offsetHeight - 3);


if (ffd.width <= 800) {
ffmViewFinder.hideViewFinder();
}

var viewerPos = ffmh.getAbsolutePosition(ffmViewer.getViewerElement());
geFloorPlan.messageWindow.setPosition(
null,
viewerPos.y + 5,
ffd.width - viewerPos.x - ffmViewer.view.width + 3);
}

this.processKeyUp = processKeyUp;
function processKeyUp(e)
{
var keyCode = FfHelper.getKeyCode(e);

if (searcher.ignoreMouseWheel(e) 
    || searcher.inFocus()
    || GeBoothWindow.inFocus()) {
return;
}

if (keyCode == 73 || keyCode == 38) { 
ffmViewer.pan(0, -ffmConfig.PAN_SIZE);
} else if (keyCode == 74 || keyCode == 37) { 
ffmViewer.pan(-ffmConfig.PAN_SIZE, 0);
} else if (keyCode == 75 || keyCode == 40) { 
ffmViewer.pan(0, ffmConfig.PAN_SIZE);
} else if (keyCode == 76 || keyCode == 39) { 
ffmViewer.pan(ffmConfig.PAN_SIZE, 0);
} else if (keyCode == 88) { 
ffmViewer.zoom(false, true);
boothHelper.showLastBoothDetails();
} else if (keyCode == 90) { 
ffmViewer.zoom(true, true);
boothHelper.showLastBoothDetails();
} else if (keyCode == 27) { 
ffml.clearLog();
} else {
if (ffmConfig.CAN_EDIT) {
boothHelper.boothKeyUp(e);
}
}
}

this.isHelpVisible = isHelpVisible;
function isHelpVisible()
{

if (!FfWindow.dialog)
return false;
return FfWindow.dialog.isVisible();
}

this.processMouseDown = processMouseDown;
function processMouseDown(e)
{
if (geFloorPlan.isHelpVisible() 
    || GeFpGuiMediator.mouseInBoothPopup(e) 
    || searcher.isMouseInSearcher(e)
    || GeBoothWindow.mouseIn(e))
return;
if (!ffmh.isRightClick(e)) { 
if (ffmViewFinder.mouseInViewFinderBorder(e)) {
if (ffmViewFinder.mouseInViewFinderToggle(e)) {

} else if (ffmViewFinder.mouseInViewFinderSelection(e)) {
ffmViewFinderMouseDragger.startDragIfNeeded(e);
} else if (ffmViewFinder.mouseInViewFinder(e)) {
ffmViewFinder.panToViewFinderClick(e);
}




} else {
ffmViewerMouseDragger.startDragIfNeeded(e);
}
} else if (ffmConfig.CAN_EDIT) { 
if (boothHelper.inBooth()) {
boothHelper.startBoothDrag(e);
} else {
boothHelper.processNewBoothClick(e);
}
}
}

this.processMouseUp = processMouseUp;
function processMouseUp(e)
{
ffmViewerMouseDragger.stopDragIfNeeded(e);
ffmViewFinderMouseDragger.stopDragIfNeeded(e);
boothHelper.stopBoothDragIfNeeded();
if (ffmViewer.lastMousePosition && ffmViewerMouseDragger.lastMousePosition 
    && ffmViewer.lastMousePosition.x == ffmViewerMouseDragger.lastMousePosition.x 
    && ffmViewer.lastMousePosition.y == ffmViewerMouseDragger.lastMousePosition.y
    && !ffmViewer.mouseInNavigation(e, ffmViewer.lastMousePosition))
geFloorPlan.processBoothMouseOver(e);
}

this.processBoothMouseOver = processBoothMouseOver;
function processBoothMouseOver(e)
{

if (geFpBoothDetails.isVisible() && geFpBoothDetails.isMouseInElement(e, ffmViewer.lastMousePosition)) {
return;
}

this.showBoothDetails(e);
}

this.showBoothDetails = showBoothDetails;
function showBoothDetails(e)
{
if (ffmViewer.isMouseInViewer(e, ffmViewer.lastMousePosition) && !ffmViewFinder.mouseInViewFinderBorder(e, ffmViewer.lastMousePosition)) {
setTimeout('geFloorPlan.doShowBooth(' + ffmViewer.lastMousePosition.x + ',' + ffmViewer.lastMousePosition.y + ');', this.SHOW_BOOTH_DELAY_MS);
}
}

this.doShowBooth = doShowBooth;
function doShowBooth(x, y)
{
if (!ffmViewer.lastMousePosition || ffmViewer.lastMousePosition.x != x || ffmViewer.lastMousePosition.y != y)
return;








if (ffmConfig.CAN_EDIT) {
var boothNumber = boothHelper.getHighlightedBoothNumber();
var center = boothHelper.getHighlightedBoothCenter();
if (boothNumber && center)
GeFpGuiMediator.showBoothPopup(boothNumber, null, center.x, center.y);
} else {
var viewerPos = ffmh.getAbsolutePosition(ffmViewer.getViewerElement());
var ax = (ffmViewer.lastMousePosition.x - viewerPos.x + ffmViewer.view.offsetX)/ffmGlobals.currentScale;
var ay = (ffmViewer.lastMousePosition.y - viewerPos.y + ffmViewer.view.offsetY)/ffmGlobals.currentScale;
var booth = geQuickBoothsLoader.getBooth(ax, ay);
if (booth && !booth.notBooth) {
if (!booth.company) { 
if (ffmConfig.AVAILABLE_BOOTH_HTML) {

FfWindow.showDialog('Booth Sales Information', 380, 140, '<div style="width:360px;height:120px;">' + ffmConfig.AVAILABLE_BOOTH_HTML + '</div>', null, null, 'ffSectionTitleJs2');
}
} else {
var center = booth.getCenter();
GeFpGuiMediator.showBoothPopup(booth.boothNumber, null, center.x, center.y);
}
}
}
}


this.processMouseMove = processMouseMove;
function processMouseMove(e)
{
ffmViewer.processMouseMove(e);

geQuickBoothsLoader.processMouseMove(e); 
}

this.init = init;
function init()
{
searcher.createSearchPanel();
this.createTabs();
this.createToolbar();
this.createSponsors();

this.tabPanel.tabMenu.selectTabWithIndex(0); 

if (!ffmConfig.CAN_EDIT)
this.initializeMessageWindow();

geFloorPlan.resizeToScreen();
document.onkeyup = geFloorPlan.processKeyUp;
document.onmousedown = geFloorPlan.processMouseDown;
document.onmouseup = geFloorPlan.processMouseUp;
document.oncontextmenu = FfmDisableEvent; 
document.onmousemove = geFloorPlan.processMouseMove;
window.onresize = geFloorPlan.resizeToScreen;
geMouseWheelHelper.registerEventHandlers();
FfmImageLoaderResetImagesLoadingThread();

if (ffmConfig.USER_ID && ffmConfig.APPOINTMENT_DAY) {
searcher.listType = searcher.LIST_TYPE_ENUM_APPOINTMENT_DAY;
} else if (ffmConfig.BOOTH_NUMBERS.length > 0) {
searcher.listType = searcher.LIST_TYPE_ENUM_PLANNER;
} else if (ffmConfig.EXHIBITOR_IDS.length > 0) {
searcher.listType = searcher.LIST_TYPE_ENUM_PLANNER_EXHIBITOR_IDS;
} else if (ffmConfig.BOOTH_IDS.length > 0) {
searcher.listType = searcher.LIST_TYPE_ENUM_PLANNER_BOOTH_IDS;
} else {
searcher.listType = searcher.LIST_TYPE_ENUM_ALL;
}

searcher.printExhibitorList();



GePinger.ping(true);
}

this.initializeMessageWindow = initializeMessageWindow;
function initializeMessageWindow()
{
var elmnt = this.messageWindow.getHtmlElement();
document.body.appendChild(elmnt);
if (ffmConfig.GOEXPO_BOOTH_AVAILABLE_BG_ID)
this.messageWindow.setContentsAndShow('<table><tr><td><img style="width:20px;height:20px;" src="' + ffmConfig.GOEXPO_BOOTH_AVAILABLE_BG_ID + '"/></td><td style="font-weight:bold;"> - Available booth</td></tr></table><div style="margin-top:5px;"><a href="public/searchBooths.php" style="font-weight:bold;" onclick="window.location=\'../public/searchBooths.php\'">Search Booths</a></div>');
else
this.messageWindow.hide();
}

this.createTabs = createTabs;
function createTabs()
{
var tabs = new Array();
for (var i = 0; i < ffmConfig.AREAS.length; i++) {
tabs[i] = new Array(ffmConfig.AREAS[i].tabName, geFloorPlan.areaIndexOnClick);
}
this.tabPanel = new FfTabPanel(tabs);
this.tabPanel.createElement()
this.tabPanel.htmlElement.style.position = 'absolute';
document.body.appendChild(this.tabPanel.htmlElement);
}

function browseOnClick()
{

searcher.searchPanel.togglePaneVisibility();
}

function plannerOnClick()
{
window.location = FfPaths.FF_ROOT_URL + '/../goExpo/user/viewPlanner.php';
}

function helpOnClick()
{

FfWindow.showDialog('Help', 600, 390, '<div style="width:580px;height:370px;">' + ffmConfig.HELP_CONTENT + '</div>', null, null, 'ffSectionTitleJs2');
}

this.createToolbar = createToolbar;
function createToolbar()
{
var buttons = [
new FfButton('geFpButtonBrowse', browseOnClick, 'geFpButtonBrowseOver'),
new FfButton('geFpButtonPlanner', plannerOnClick, 'geFpButtonPlannerOver'),
new FfButton('geFpButtonPrint', window.print, 'geFpButtonPrintOver'),
new FfButton('geFpButtonHelp', helpOnClick, 'geFpButtonHelpOver')
];
if (!ffmConfig.PERMIT_PLANNER)
buttons.splice(1, 1);
this.toolbar = new FfToolbar(buttons, 2);
this.toolbar.getHtmlElement().style.position = 'absolute';
this.toolbar.getHtmlElement().cellSpacing = '1px';
document.body.appendChild(this.toolbar.getHtmlElement());
}

this.createSponsors = createSponsors;
function createSponsors()
{
this.sponsors = new GeSponsors(ffmConfig.GE_NAME + ' Sponsors:');
this.sponsors.getHtmlElement().style.position = 'absolute';
document.body.appendChild(this.sponsors.getHtmlElement());
}

this.saveAreaState = saveAreaState;
function saveAreaState()
{
if (this.currentAreaIndex == null)
return;
ffmConfig.AREAS[this.currentAreaIndex].zoomLevel = ffmGlobals.currentZoomLevel;
ffmConfig.AREAS[this.currentAreaIndex].offset.x = ffmViewer.view.offsetX;
ffmConfig.AREAS[this.currentAreaIndex].offset.y = ffmViewer.view.offsetY;
}

this.restoreAreaState = restoreAreaState;
function restoreAreaState(areaIndex)
{
var area = ffmConfig.AREAS[areaIndex];
searcher.setMarkersVisible(false);
ffmConfig.FP_AREA_ID = area.id;
ffmConfig.MAP_WIDTH = area.mapWidth;
ffmConfig.MAP_HEIGHT = area.mapHeight;
ffmGlobals.setMAX_ZOOM_LEVEL();
ffmConfig.TILE_IMAGE_BASENAME = area.tileImageBasename;
ffmConfig.VIEW_FINDER_IMAGE = area.viewFinderImage;
ffmViewFinder.setViewFinderImage(ffmConfig.VIEW_FINDER_IMAGE);



ffmViewer.setBackgroundImage(area.bgImageConverted);
if (!area.zoomLevel) { 
ffmGlobals.setCurrentZoomLevel(ffmGlobals.MAX_ZOOM_LEVEL - 1);
ffmViewer.zoomToLevel(ffmGlobals.MAX_ZOOM_LEVEL - 1, true, true);
} else {
ffmGlobals.setCurrentZoomLevel(area.zoomLevel);
ffmViewer.zoomToLevel(area.zoomLevel, true, true); 
}
ffmViewer.panTopLeftTo(area.offset.x, area.offset.y);
searcher.setMarkersVisible(true);
}

this.toggleShowBgBooths = toggleShowBgBooths;
function toggleShowBgBooths()
{
this.showBgBooths = !this.showBgBooths;
for (var i = 0; i < ffmConfig.AREAS.length; i++) {
ffmConfig.AREAS[i].setPaths(this.showBgBooths);
}
ffmConfig.TILE_IMAGE_BASENAME = ffmConfig.AREAS[this.currentAreaIndex].tileImageBasename;
ffmConfig.VIEW_FINDER_IMAGE = ffmConfig.AREAS[this.currentAreaIndex].viewFinderImage;
ffmViewer.refresh();
}

this.toggleShowBgImage = toggleShowBgImage;
function toggleShowBgImage()
{
ffmConfig.HIDE_BACKGROUND_IMAGE = !ffmConfig.HIDE_BACKGROUND_IMAGE;
ffmViewer.refresh();
}

this.getAreaId = getAreaId;
function getAreaId(tabName)
{
for (var i = 0; i < ffmConfig.AREAS.length; i++) {
if (ffmConfig.AREAS[i].tabName == tabName) {
return ffmConfig.AREAS[i].id;
}
}
return null;
}

this.getAreaIndex = getAreaIndex;
function getAreaIndex(areaId)
{
for (var i = 0; i < ffmConfig.AREAS.length; i++) {
if (ffmConfig.AREAS[i].id == areaId) {
return i;
}
}
return null;
}

this.areaIndexOnClick = areaIndexOnClick;
function areaIndexOnClick(areaIndex)
{
geFloorPlan.selectAreaIndex(areaIndex);
}


this.selectAreaIndex = selectAreaIndex;
function selectAreaIndex(areaIndex, force)
{
if (!force && areaIndex == this.currentAreaIndex) 
return;

if (!this.ignoreBoothPopup)
GeFpGuiMediator.hideBoothPopup();


if (ffmConfig.CAN_EDIT) {
boothHelper.clearAllBooths();
}

this.saveAreaState();
this.currentAreaIndex = areaIndex;
this.restoreAreaState(areaIndex);
boothHelper.hideOrShowSelectedBoothMarker();
geQuickBoothsLoader.updateCurrentAreaBoothIndex();



if (ffmConfig.CAN_EDIT) {
mediator.loadBooths();
}
}

this.selectAreaId = selectAreaId;
function selectAreaId(areaId)
{
var areaIndex = getAreaIndex(areaId)
this.tabPanel.tabMenu.selectTabWithIndex(areaIndex);
}

this.getCurrentAreaId = getCurrentAreaId;
function getCurrentAreaId()
{
if (this.currentAreaIndex == null)
return null;
return ffmConfig.AREAS[this.currentAreaIndex].id;
}



}
var geFloorPlan = new GeFloorPlan();



function GeMouseWheelHelper()
{
this.processMouseWheel = processMouseWheel;
function processMouseWheel(event)
{
if (geFloorPlan.isHelpVisible() || searcher.ignoreMouseWheel(event) || GeFpGuiMediator.mouseInBoothPopup(event)) {

return true;
}

var delta = 0;
if (!event) { 
event = window.event;
}
if (event.wheelDelta) { 
delta = event.wheelDelta/120;



} else if (event.detail) { 

delta = -event.detail/3;
}




if (delta) {
this.processScroll(delta);
}


if (event.preventDefault)
event.preventDefault();

event.returnValue = false;
}

this.processScroll = processScroll;
function processScroll(delta)
{
if (delta < 0) {
ffmViewer.zoom(false);
} else {
ffmViewer.zoom(true);
}

}

this.registerEventHandlers = registerEventHandlers;
function registerEventHandlers()
{
if (window.addEventListener) 
window.addEventListener('DOMMouseScroll', GeProcessMouseWheel, false);

try {
document.onmousewheel = GeProcessMouseWheel;
} catch (e) {
try {

} catch (e) {

}
}


}
}
var geMouseWheelHelper = new GeMouseWheelHelper();


function GeProcessMouseWheel(event)
{
geMouseWheelHelper.processMouseWheel(event);
}
