// X and Y offsets
var xoff=22;
var yoff=12; 
// X and Y div offsets
var xdivoff=10;
var ydivoff=14;

//Set visibility of popup
var vis=false;

//Create Div and Cursor Elements
document.write('<div id="popup"></div>');
document.write('<img id="cursor" src="cursor.jpg">');

//create varibales for IE and NS
var ie=document.all;
var ns6=document.getElementById && !document.all;


if (ie||ns6)
	var tipobj=document.all? document.all["popup"] : document.getElementById? document.getElementById("popup") : "";

var pointerobj=document.all? document.all["cursor"] : document.getElementById? document.getElementById("cursor") : "";

function ietruebody()
{
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function divSet(content, width, color)
{
	if (ns6||ie)
	{
		if (typeof width!="undefined") tipobj.style.width=width+"px";
		if (typeof color!="undefined" && color!="") tipobj.style.backgroundColor=color;
		tipobj.innerHTML=content;
		vis=true;
		return false;
	}
}

function positionit(e)
{
	if (vis)
	{
		var nondefaultpos=false
		var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
		var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
		//Find out how close the mouse is to the corner of the window
		var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20;
		var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20;

		var rightedge=ie&&!window.opera? winwidth-event.clientX-xoff : winwidth-e.clientX-xoff;
		var bottomedge=ie&&!window.opera? winheight-event.clientY-yoff : winheight-e.clientY-yoff;

		var leftedge=(xoff<0)? xoff*(-1) : -1000;

		//if the horizontal distance isn't enough to accomodate the width of the context menu
		if (rightedge<tipobj.offsetWidth)
		{
			//move the horizontal position of the menu to the left by it's width
			tipobj.style.left=curX-tipobj.offsetWidth+"px";
			nondefaultpos=true;
		}
		else if (curX<leftedge)
			tipobj.style.left="5px";
		else
		{
			//position the horizontal position of the menu where the mouse is positioned
			tipobj.style.left=curX+xoff-xdivoff+"px";
			pointerobj.style.left=curX+xoff+"px";
		}

		//same with the vertical position
		//if (bottomedge<tipobj.offsetHeight)
		//{
			tipobj.style.top=curY-tipobj.offsetHeight-yoff+"px";
			nondefaultpos=true;
		//}
		//else
		//{
		//	tipobj.style.top=curY+yoff+ydivoff+"px";
		//	pointerobj.style.top=curY+yoff+"px";
		//}
		
		tipobj.style.visibility="visible";
		
		if (!nondefaultpos)
			pointerobj.style.visibility="visible";
		else
			pointerobj.style.visibility="hidden";
	}
}

function hidepopup()
{
	if (ns6||ie)
	{
		vis=false;
		tipobj.style.visibility="hidden";
		pointerobj.style.visibility="hidden";
		tipobj.style.left="-1000px";
		tipobj.style.backgroundColor='';
		tipobj.style.width='';
	}
}

document.onmousemove=positionit;

var proOne ="<p class='body_bold'>35 Portion Pasta Carousel</p>";
var proTwo ="<p class='body_bold'>Digital Display Screen</p>";
var proThree ="<p class='body_bold'>Backlit Display Panel w/ Twirl Graphics</p>";
var proFour ="<p class='body_bold'>Pasta Dispense Area / Twirl Pasta Bowl</p>";

var plusOne ="<p class='body_bold'>35 Portion Pasta Carousel</p>";
var plusTwo ="<p class='body_bold'>Backlit Display Panel w/ Twirl Graphics </p>";
var plusThree ="<p class='body_bold'>Digital Display Screen</p>";
var plusFour ="<p class='body_bold'>Pasta Dispense Area / Twirl Pasta Bowl</p>";
var plusFive ="<p class='body_bold'>Pasta Sauce Dispense Tray</p>";
var plusSix ="<p class='body_bold'>Pasta Sauce Selection Buttons</p>";

var vendOne ="<p class='body_bold'>35 Portion Pasta Carousel</p>";
var vendTwo ="<p class='body_bold'>Digitral Display Screen</p>";
var vendThree ="<p class='body_bold'>Backlit Display Panel w/ Twirl Graphics</p>";
var vendFour ="<p class='body_bold'>Bill Note Acceptor or Credit Card Reader</p>";
var vendFive ="<p class='body_bold'>Pasta Dispense Area / Twirl Pasta Bowl</p>";
var vendSix ="<p class='body_bold'>Sauce Dispense Area</p>";
var vendSeven ="<p class='body_bold'>Pasta Sauce Selector Buttons</p>";
