/*	FlyOut.js
	This file requires jQuery
	
	Parameters to 'flyOut.show':
		callerId		- id of caller container
		flyoutId		- id of the container to flyout
		opacity			- opacity to set flyout, range is 1 to 100 (default is 100, no opacity)
		animation		- animation to use on flyout ('fade','slide','show') (default is 'fade')
		animationSpeed	- speed at which to animate the flyout ('fast','slow') (default is 'fast')
		offsetTop		- top position (in pixels) to position the flyout
		offsetLeft		- top position (in pixels) to position the flyout
		position		- positioning type (default is 'relative')
							'relative' - relative position to the top/left caller container
							'absolute' - absolute screen position
							'caller-width-center-page' - relative to caller width towards center of page
							'over' - centered over the caller
		autoHide		- to automatically hide the flyout use 1 (default), otherwise 0 to disable this feature
		showDelay		- to delay the appearance of the flyout (default is 0)
	
	Example mouseover usage:
		onMouseOver="flyOut.show({ callerId:this.id,flyoutId:'FlyOutId',offsetTop:14,offsetLeft:540,opacity:90,showDelay:600 });"
	
History:
mm/dd/yyyy	Author	Description
----------	------	----------------------------------------------------
07/15/2007	AL		Created
09/05/2007	AL		IE6 fix: "hide" the obtrusive select lists, when the DHTML layer is shown
10/10/2007	AL		Added 'HideEmbedObjects' when the DHTML layer is shown (hides embeded objects such as flash players)
11/05/2007	AL		Added 'autoHide' parameter to disable the automatic hiding 
11/15/2007	AL		Added 'showDelay' delay the appearance of the flyout
05/27/2009	AL		Added 'keepTopOnPage' parameter for 'center-page' position
*/

var flyOut = {
	// Internal working variables
	timerId: -1,
	timerArg0: "",
	timerArg1: "",
	theCaller: null,
	theFlyout: null,
	theCallerCoor: null,
	theFlyoutCoor: null,
	xMouse: 0,
	yMouse: 0,
	visibility: 'hidden',
	outlineImagePath: '/ClientSide/Images/Outlines/',
	outlineImageExtension: 'png',			// png,gif
	IsIE6: false,
	HideEmbedObjects: true,
	ZindexForOverlay: 9988,
	ZindexForFlyOut: 9989,
	GrayItOutDiv: "",
	showDelayTimerId: -1,
	bodywidth: 0,
	bodyheight: 0,
	
	init : function () {
		  // Initialize default options
		flyOut.callerId = "";
		flyOut.flyoutId = "";
		flyOut.showDelay = 0;
		flyOut.delay = 600;
		flyOut.autoHide = 1;
		flyOut.keepTopOnPage = 0;
		flyOut.position = "relative";			// "relative", "absolute", "caller-width-center-page"
		flyOut.offsetTop = 0;
		flyOut.offsetLeft = 0;
		flyOut.opacity = 100;
		flyOut.animation = 'fade';				// "fade", "slide", or ""
		flyOut.animationSpeed = 'fast';			// "slow", "normal", or "fast"
		flyOut.outlineType = 'DropShadow';		// DropShadow, RoundedWhite, REBlue, REBlueShadow, DarkKhaki, AthsSpecial, HeatheredGray
		flyOut.outlinePointer = '';				// Pointer side and position: TL,TC,TR,RT,RM,RB,BL,BC,BR,LT,LM,LB
		flyOut.outlineId = '';
		flyOut.modal = 1;
		// IE browsers get GIF's
		if($.browser.msie) { 
			var ua = navigator.userAgent;  // the navigator's user agent string
			if ( ua.match(/MSIE (\d+(?:\.\d+)+(?:b\d*)?)/) == 'MSIE 6.0,6.0') { flyOut.IsIE6 = true; flyOut.outlineImageExtension = 'gif'; }
			// Keep IE6 from "flickering" when things are modified in the dom.
			if (flyOut.IsIE6) try {document.execCommand("BackgroundImageCache", false, true);} catch(e){};
		}
		if(flyOut.bodywidth==0) { if (flyOut.IsIE6) { flyOut.bodywidth = $('body').width(); } else { flyOut.bodywidth = $('window').width(); } }
		if(flyOut.bodyheight==0) { flyOut.bodyheight = $('body').height(); }
	},
	
	glitch : function () {
		if($.browser.safari) { 
			// Safari wants to repeatedly fire the 'onMouseOver' event
			if (flyOut.timerId != -1 && flyOut.timerArg0.length>0 && flyOut.timerArg1.length>0) {
				if(flyOut.xMouse>=flyOut.theCallerCoor.x && flyOut.xMouse<=flyOut.theCallerCoor.x2 && flyOut.yMouse>=flyOut.theCallerCoor.y && flyOut.yMouse<=flyOut.theCallerCoor.y2) {
					// Mouse is still within the caller object area
					flyOut.visibility = 'visible';
				} else if (flyOut.xMouse>=flyOut.theFlyoutCoor.x && flyOut.xMouse<=flyOut.theFlyoutCoor.x2 && flyOut.yMouse>=flyOut.theFlyoutCoor.y && flyOut.yMouse<=flyOut.theFlyoutCoor.y2) {
					// Mouse is still within the object area
					flyOut.visibility = 'visible';
				} else {
					flyOut.visibility = 'hidden';
				}
				if (flyOut.visibility == 'visible') { return true; }
			}
			return false;
		} else {
			return false;
		}
	},

	objectVisibilityHide : function () {
		if (flyOut.IsIE6) {
			// We are using IE6, so hide the SELECT's
			$('select:visible').css({visibility:'hidden'});
		}
		$('embed:visible').css({visibility:'hidden'});
		$('object:visible').css({visibility:'hidden'});
		if (flyOut.modal) {
			$("#GrayItOut").show();
		}
	},

	objectVisibilityShow : function () {
		if (flyOut.modal) {
			$("#GrayItOut").hide();
		}
		if (flyOut.IsIE6) {
			// We are using IE6, so restore the SELECT's
			$('select:hidden').css({visibility:'visible'});
		}
		$('embed:hidden').css({visibility:'visible'});
		$('object:hidden').css({visibility:'visible'});
	},

	show : function (options) {
		var _TopCoor = 0;
		var _LeftCoor = 0;
		var viewportWidth = $(window).width();
		var viewportHeight = window.innerHeight ? window.innerHeight : $(window).height();
		
		if (flyOut.glitch()) { return false; }
		if (options && flyOut.showDelayTimerId != -1) {
			// New flyout has been triggered (clear the showDelay Timer)
			clearTimeout( flyOut.showDelayTimerId );
			flyOut.showDelayTimerId = -1;
			flyOut.init();
		} else if (flyOut.showDelayTimerId != -1) {
			// Show delay timer called this function
			clearTimeout( flyOut.showDelayTimerId );
			flyOut.showDelayTimerId = -1;
			if (flyOut.isMouseOverObj(flyOut.callerId) == false) {
				// Pointer is no longer over the object, so we are done.
				return false; 
			}
		} else {
			flyOut.init();
			if (options.callback)
				options.callback();
		}
		// Passed in arguments need to overwrite the default settings
		if (options) jQuery.extend(flyOut, options);
		if (flyOut.showDelay != 0) {
			flyOut.showDelayTimerId = setTimeout("flyOut.show();", flyOut.showDelay);
			flyOut.showDelay = 0;
			return false;
		}
		if (flyOut.timerId != -1 && flyOut.timerArg0.length>0 && flyOut.timerArg1.length>0) {
			// Hide the currently visible flyout 
			if(flyOut.timerId!=-1) { clearTimeout( flyOut.timerId ); }
			flyOut.theFlyout.hide();
			flyOut.timerId = -1;
			flyOut.timerArg0 = "";
			flyOut.timerArg1 = "";
			flyOut.theCaller = null;
			flyOut.theFlyout = null;
			flyOut.theCallerCoor = null;
			flyOut.theFlyoutCoor = null;
		}
		if(flyOut.callerId.length) {
			// Get the caller and the flyout objects by id
			flyOut.theCaller = $('#' + flyOut.callerId);
			if(flyOut.outlineType.length) { 
				flyOut.addShadow(); 
				flyOut.theFlyout = $('#' + flyOut.outlineId);
			} else {
				flyOut.theFlyout = $('#' + flyOut.flyoutId);
			}
			if(flyOut.theCaller!=null && flyOut.theFlyout!=null) {
				flyOut.theCallerCoor = flyOut.getCoordinates(flyOut.callerId);	// Save caller coordinates
				flyOut.opacityEffect = "";
				if(flyOut.opacity!=100) { flyOut.opacityEffect = 'filter: alpha(opacity=' + flyOut.opacity + '); -moz-opacity:' + (flyOut.opacity/100) + '; opacity:' + (flyOut.opacity/100) + ';'; }
				if (flyOut.autoHide!=1) {
					flyOut.objectVisibilityHide();
					// Show the object
					if ( flyOut.animation == 'slide' ) {
						flyOut.theFlyout.slideDown(flyOut.animationSpeed);
					} else if ( flyOut.animation == 'fade' ) {
						flyOut.theFlyout.fadeIn(flyOut.animationSpeed);
					} else {
						flyOut.theFlyout.show();
					}
				}
				switch(flyOut.position) {
					case 'relative':
						flyOut.theCoordinates = 'position:absolute;top:' + (flyOut.theCallerCoor.y + flyOut.offsetTop) + 'px; left:' + (flyOut.theCallerCoor.x + flyOut.offsetLeft) + 'px;z-index:' + flyOut.ZindexForFlyOut + ';';
						break;
					case 'relative-right':
						flyOut.theCoordinates = 'position:absolute;top:' + (flyOut.theCallerCoor.y + flyOut.offsetTop - (flyOut.theCallerCoor.y2-flyOut.theCallerCoor.y)) + 'px; left:' + (flyOut.theCallerCoor.x + flyOut.offsetLeft + (flyOut.theCallerCoor.x2-flyOut.theCallerCoor.x)) + 'px;z-index:' + flyOut.ZindexForFlyOut + ';';
						break;
					case 'relative-left':
						flyOut.theCoordinates = 'position:absolute;top:' + (flyOut.theCallerCoor.y + flyOut.offsetTop - (flyOut.theCallerCoor.y2-flyOut.theCallerCoor.y)) + 'px; left:' + (flyOut.theCallerCoor.x + flyOut.offsetLeft - flyOut.theFlyout.width()) + 'px;z-index:' + flyOut.ZindexForFlyOut + ';';
						break;
					case 'absolute':
						flyOut.theCoordinates = 'position:absolute;top:' + flyOut.offsetTop + 'px; left:' + flyOut.offsetLeft + 'px;z-index:' + flyOut.ZindexForFlyOut + ';';
						break;
					case 'over':
						flyOut.theCoordinates = 'position:absolute;top:' + (flyOut.theCallerCoor.yCenter - (flyOut.theFlyout.height()*0.5)) + 'px; left:' + (flyOut.theCallerCoor.xCenter - (flyOut.theFlyout.width()*0.5)) + 'px;z-index:' + flyOut.ZindexForFlyOut + ';';
						break;
					case 'center-page':
						if (flyOut.keepTopOnPage) {
							_TopCoor = Math.max(0, ((document.documentElement.scrollTop || document.body.scrollTop) + ((document.documentElement.clientHeight || document.body.clientHeight)*0.5) - (flyOut.theFlyout.height()*0.5)) );
						} else {
							_TopCoor = ((document.documentElement.scrollTop || document.body.scrollTop) + ((document.documentElement.clientHeight || document.body.clientHeight)*0.5) - (flyOut.theFlyout.height()*0.5));
						}
						flyOut.theCoordinates = 'position:absolute;top:' + _TopCoor + 'px; left:' + (flyOut.theCallerCoor.x2 - $('#' + flyOut.flyoutId).width() - flyOut.offsetLeft) + 'px;z-index:' + flyOut.ZindexForFlyOut + ';';
						break;
					case 'top-center-view':
						_TopCoor = 0;
						if(flyOut.offsetTop > 0) {							
							_TopCoor = flyOut.offsetTop;
						}
						_LeftCoor = (viewportWidth * 0.5) - (flyOut.theFlyout.width()*0.5);
						flyOut.theCoordinates = 'position:absolute;top:' + _TopCoor + 'px; left:' + _LeftCoor + 'px;z-index:' + flyOut.ZindexForFlyOut + ';';
						break;
					case 'caller-width-center-page':
						if(flyOut.theCallerCoor.x<=(document.body.clientWidth*0.5)) {
							flyOut.theCoordinates = 'position:absolute;top:' + (flyOut.theCallerCoor.y + flyOut.offsetTop) + 'px; left:' + (flyOut.theCallerCoor.x + flyOut.offsetLeft) + 'px;z-index:' + flyOut.ZindexForFlyOut + ';';
						} else {
							flyOut.theCoordinates = 'position:absolute;top:' + (flyOut.theCallerCoor.y + flyOut.offsetTop) + 'px; left:' + (flyOut.theCallerCoor.x2 - $('#' + flyOut.flyoutId).width() - flyOut.offsetLeft) + 'px;z-index:' + flyOut.ZindexForFlyOut + ';';
						}
						break;
					default:
						// Relative
						flyOut.theCoordinates = 'position:absolute;top:' + (flyOut.theCallerCoor.y + flyOut.offsetTop) + 'px; left:' + (flyOut.theCallerCoor.x + flyOut.offsetLeft) + 'px;z-index:' + flyOut.ZindexForFlyOut + ';';
						break;
				}
				if(typeof flyOut.theFlyout.attr("style") == 'object') {
					// Change style attribute back to original. (for IE, we need to clear the object first)
					flyOut.theFlyout.attr("style")["cssText"] = "";
					flyOut.theFlyout.attr("style")["cssText"] = flyOut.theCoordinates + flyOut.opacityEffect;
				} else {
					flyOut.theFlyout.attr("style", flyOut.theCoordinates + flyOut.opacityEffect);	
				}
				if (flyOut.autoHide==1) {
					flyOut.objectVisibilityHide();
					// Show the object
					if ( flyOut.animation == 'slide' ) {
						flyOut.theFlyout.slideDown(flyOut.animationSpeed);
					} else if ( flyOut.animation == 'fade' ) {
						flyOut.theFlyout.fadeIn(flyOut.animationSpeed);
					} else {
						flyOut.theFlyout.show();
					}
				}
				if (flyOut.position == 'top-center-view') {
					// Move the flyout into view
					$("#" + flyOut.outlineId).animate({"marginTop": ($(window).scrollTop() + 2) + "px"}, "fast" );
				}
				flyOut.theFlyoutCoor = flyOut.getCoordinates(flyOut.flyoutId);	// Save flyout coordinates
				if (flyOut.autoHide) {
					// Set the timer
					flyOut.timerId = setTimeout("flyOut.hide();", flyOut.delay);
				}
				flyOut.timerArg0 = flyOut.callerId;
				flyOut.timerArg1 = flyOut.flyoutId;
			}
		}
	},

	hide : function () {
		if(flyOut.autoHide) {
			if(flyOut.xMouse>=flyOut.theCallerCoor.x && flyOut.xMouse<=flyOut.theCallerCoor.x2 && flyOut.yMouse>=flyOut.theCallerCoor.y && flyOut.yMouse<=flyOut.theCallerCoor.y2) {
				// Mouse is still within the caller object area
				flyOut.visibility = 'visible';
			} else if (flyOut.xMouse>=flyOut.theFlyoutCoor.x && flyOut.xMouse<=flyOut.theFlyoutCoor.x2 && flyOut.yMouse>=flyOut.theFlyoutCoor.y && flyOut.yMouse<=flyOut.theFlyoutCoor.y2) {
				// Mouse is still within the object area
				flyOut.visibility = 'visible';
			} else {
				flyOut.visibility = 'hidden';
			}
		} else {
			flyOut.visibility = 'hidden';
		}
		if(flyOut.visibility == 'visible') {
			// Set the timer
			flyOut.timerId = setTimeout("flyOut.hide();", flyOut.delay);
			flyOut.objectVisibilityHide();
		} else {
			if(flyOut.timerId!=-1) { clearTimeout( flyOut.timerId ); }
			// Hide the object
			if ( flyOut.animation == 'slide' ) {
				flyOut.theFlyout.slideUp(flyOut.animationSpeed);
			} else if ( flyOut.animation == 'fade' ) {
				flyOut.theFlyout.fadeOut(flyOut.animationSpeed);
			} else {
				flyOut.theFlyout.hide();
			}
			flyOut.timerId = -1;
			flyOut.timerArg0 = "";
			flyOut.timerArg1 = "";
			flyOut.theCaller = null;
			flyOut.theFlyout = null;
			flyOut.theCallerCoor = null;
			flyOut.theFlyoutCoor = null;
			flyOut.objectVisibilityShow();
		}
	},
  
	getCoordinates : function (objId) {
		var newObj = new Object();
		var obj;
		// Get the caller by ID
		obj=$('#'+objId).get(0);
		if(obj!=null) {
			newObj.x = obj.offsetLeft;
			newObj.y = obj.offsetTop;
			var theParent = obj.offsetParent;
			while (theParent != null) {
				newObj.y += theParent.offsetTop;
				newObj.x += theParent.offsetLeft;
				theParent = theParent.offsetParent;
			};
			newObj.x2 = newObj.x + obj.offsetWidth;
			newObj.y2 = newObj.y + obj.offsetHeight;
			newObj.xCenter = newObj.x + (obj.offsetWidth*0.5);
			newObj.yCenter = newObj.y + (obj.offsetHeight*0.5);
		}
		return newObj;
	},
	
	isMouseOverObj : function (objId) {
		var overObj = false;
		var objCoor;
		objCoor = flyOut.getCoordinates(objId);
		if(flyOut.xMouse>=objCoor.x && flyOut.xMouse<=objCoor.x2 && flyOut.yMouse>=objCoor.y && flyOut.yMouse<=objCoor.y2) {
			// Mouse is still within the object area
			overObj = true;
		}
		return overObj;
	},
	
	addShadow : function () {
		var OutlineTbl = '';
		var GrayItOut = '';
		var OverlayImg = 'OverLay1.png';
		var opacityEffect = '';
		var opacity = 30;
		var path = flyOut.outlineImagePath;
		var ext = flyOut.outlineImageExtension;
		var type = flyOut.outlineType;
		var pointer = flyOut.outlinePointer;
		var wrkObj
		var compatModeTDstyles = '';
		var compatModeIMGstyles = '';
		var midWidth = 0;      
		var midHeight = 0;      
		
		flyOut.outlineId = '';
		if( type.length > 0 ) {
			flyOut.outlineId = flyOut.flyoutId + '_OutlineTbl';
			if( $('#' + flyOut.outlineId).is('table') == false ) {
				midWidth = $('#' + flyOut.flyoutId).width();
				midHeight = $('#' + flyOut.flyoutId).height();
				compatModeTDstyles = "border:0pt none;margin:0pt;padding:0pt;line-height:0pt;font-size:0pt;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;";
				compatModeIMGstyles = 'border:0pt none;margin:0pt;padding:0pt;visibility:hidden;display:block;';
				OutlineTbl = OutlineTbl + '<table id="'+flyOut.outlineId+'" border="0" cellspacing="0" cellpadding="0">';
				OutlineTbl = OutlineTbl + 	'<tbody>';
				OutlineTbl = OutlineTbl + 		'<tr>';
				OutlineTbl = OutlineTbl + 			'<td style="background:transparent url('+path+type+'8.'+ext+') bottom right no-repeat; height:20px; width:20px;"><img style="'+compatModeIMGstyles+'" src="'+path+type+'8.'+ext+'"/></td>';
				OutlineTbl = OutlineTbl + 			'<td style="background:transparent url('+path+type+'1.'+ext+') bottom left repeat-x; height:20px; width:auto;'+flyOut.cellPointerStyle('T')+'"><img style="'+compatModeIMGstyles+flyOut.imagePointer('T','visibility')+'" src="'+path+type+'1'+flyOut.imagePointer('T')+'.'+ext+'"/></td>';
				OutlineTbl = OutlineTbl + 			'<td style="background:transparent url('+path+type+'2.'+ext+') bottom left no-repeat; height:20px; width:20px;"><img style="'+compatModeIMGstyles+'" src="'+path+type+'2.'+ext+'"/></td>';
				OutlineTbl = OutlineTbl + 		'</tr>';
				OutlineTbl = OutlineTbl + 		'<tr>';
				OutlineTbl = OutlineTbl + 			'<td style="background:transparent url('+path+type+'7.'+ext+') top right repeat-y; height:'+midHeight+'px; width:20px;'+flyOut.cellPointerStyle('L')+'"><img style="'+compatModeIMGstyles+flyOut.imagePointer('L','visibility')+'" src="'+path+type+'7'+flyOut.imagePointer('L')+'.'+ext+'"/></td>';
				OutlineTbl = OutlineTbl + 			'<td id="'+flyOut.flyoutId+'_OutlineInnerTbl" style="width:auto;overflow:hidden;background-color:white;"></td>';
				OutlineTbl = OutlineTbl + 			'<td style="background:transparent url('+path+type+'3.'+ext+') top left repeat-y; height:'+midHeight+'px; width:20px;'+flyOut.cellPointerStyle('R')+'"><img style="'+compatModeIMGstyles+flyOut.imagePointer('R','visibility')+'" src="'+path+type+'3'+flyOut.imagePointer('R')+'.'+ext+'"/></td>';
				OutlineTbl = OutlineTbl + 		'</tr>';
				OutlineTbl = OutlineTbl + 		'<tr>';
				OutlineTbl = OutlineTbl + 			'<td style="background:transparent url('+path+type+'6.'+ext+') top right no-repeat; height:20px; width:20px;"><img style="'+compatModeIMGstyles+'" src="'+path+type+'6.'+ext+'"/></td>';
				OutlineTbl = OutlineTbl + 			'<td style="background:transparent url('+path+type+'5.'+ext+') top left repeat-x; height:20px; width:auto;'+flyOut.cellPointerStyle('B')+'"><img style="'+compatModeIMGstyles+flyOut.imagePointer('B','visibility')+'" src="'+path+type+'5'+flyOut.imagePointer('B')+'.'+ext+'"/></td>';
				OutlineTbl = OutlineTbl + 			'<td style="background:transparent url('+path+type+'4.'+ext+') top left no-repeat; height:20px; width:20px;"><img style="'+compatModeIMGstyles+'" src="'+path+type+'4.'+ext+'"/></td>';
				OutlineTbl = OutlineTbl + 		'</tr>';
				OutlineTbl = OutlineTbl + 	'</tbody>';
				OutlineTbl = OutlineTbl + '</table>';
				
				if ( flyOut.GrayItOutDiv.length == 0 && flyOut.modal == 1 ) {
					// Overlay Trick (only one of these on a page)
					midWidth = 1640;
					midHeight = 2000;
					if (flyOut.bodywidth != 0) { midWidth = flyOut.bodywidth; }
					if (flyOut.bodyheight !=0) { midHeight = flyOut.bodyheight; }
					if (flyOut.IsIE6) { 
						flyOut.GrayItOutDiv = '<div id="GrayItOut" style="z-index:'+flyOut.ZindexForOverlay+'; filter:alpha(opacity=50); background-color:#BBB; position:absolute; overflow:hidden; top:0px; left:0px; height:'+midHeight+'px; width:'+midWidth+'px; display:none;"></div>';
					} else {
						opacityEffect = 'filter: alpha(opacity=' + opacity + '); -moz-opacity:' + (opacity/100) + '; opacity:' + (opacity/100) + ';';
						flyOut.GrayItOutDiv = '<div id="GrayItOut" style="-x-background-x-position:0%;-x-background-y-position:0%;background-attachment:scroll;background-color:#000000;background-image:none;background-repeat:repeat;bottom:0pt;display:block;left:0pt;position:absolute;right:0pt;top:0pt;' + opacityEffect + 'height:'+midHeight+'px; width:'+midWidth+'px;z-index:'+flyOut.ZindexForOverlay+';"></div>';
					}
					// Add it to the bottom of the page
					$(document.body).append(flyOut.GrayItOutDiv);
				}
				
				wrkObj = $('#' + flyOut.flyoutId);
				$(wrkObj).after(OutlineTbl);
				$(wrkObj).appendTo('#'+flyOut.flyoutId+'_OutlineInnerTbl');
				// Reset the originals styles
				if(typeof $('#' + flyOut.flyoutId).attr("style") == 'object') {
					// Change style attribute back to original. (for IE, we need to clear the object first)
					$('#' + flyOut.flyoutId).attr("style")["cssText"] = "";
					if( $('#' + flyOut.flyoutId).is('table') == true ) {
						$('#' + flyOut.flyoutId).attr("style")["cssText"] = "display:table;position:relative;top:0px;left:0px;";
					} else {
						$('#' + flyOut.flyoutId).attr("style")["cssText"] = "display:block;position:relative;top:0px;left:0px;";
					}
				} else {
					if( $('#' + flyOut.flyoutId).is('table') == true ) {
						$('#' + flyOut.flyoutId).attr("style", "display:table;position:relative;top:0px;left:0px;");
					} else {
						$('#' + flyOut.flyoutId).attr("style", "display:block;position:relative;top:0px;left:0px;");
					}
				}
				// Move the entire thing to the bottom of the page
				$(document.body).append($('#' + flyOut.outlineId));
			}
		}
	},
	
	cellPointerStyle : function (cellPos) {
		var pointer = flyOut.outlinePointer;
		var retVal = "";
		switch(cellPos) {
			case 'R':
				if (pointer=="RT") { retVal = "vertical-align:top;"; }
				if (pointer=="RM") { retVal = "vertical-align:middle;"; }
				if (pointer=="RB") { retVal = "vertical-align:bottom;"; }
				break;
			case 'L':
				if (pointer=="LT") { retVal = "vertical-align:top;"; }
				if (pointer=="LM") { retVal = "vertical-align:middle;"; }
				if (pointer=="LB") { retVal = "vertical-align:bottom;"; }
				break;
			case 'T':
				if (pointer=="TL") { retVal = "text-align:left;"; }
				if (pointer=="TC") { retVal = "text-align:center;"; }
				if (pointer=="TR") { retVal = "text-align:right;"; }
				break;
			case 'B':
				if (pointer=="BL") { retVal = "text-align:left;"; }
				if (pointer=="BC") { retVal = "text-align:center;"; }
				if (pointer=="BR") { retVal = "text-align:right;"; }
				break;
			default:
				retVal = "";
				break;
		}
		return retVal;
	},

	imagePointer : function (imagePos) {
		var pointer = flyOut.outlinePointer;
		var retVal = "";
		switch(imagePos) {
			case 'R':
				if (pointer=="RT" || pointer=="RM" || pointer=="RB") { retVal = "P"; }
				break;
			case 'L':
				if (pointer=="LT" || pointer=="LM" || pointer=="LB") { retVal = "P"; }
				break;
			case 'T':
				if (pointer=="TL" || pointer=="TC" || pointer=="TR") { retVal = "P"; }
				break;
			case 'B':
				if (pointer=="BL" || pointer=="BC" || pointer=="BR") { retVal = "P"; }
				break;
			default:
				retVal = "";
				break;
		}
		if (arguments.length>1) {
			if (retVal.length) {
				retVal = 'visibility:visible;';
			} else {
				retVal = '';
			}
		}
		return retVal;
	}

}; 
// end flyOut object
	
$(document).mousemove(function(e){ 
	flyOut.xMouse = e.pageX; 
	flyOut.yMouse = e.pageY; 
});
