var menu_timeout = {};
$(
	function() {
		$('.menuItem, .submenu>li')
			.mouseenter( function() { $('>ul', this).show(); } )
			.mouseleave( function() { $('>ul', this).hide(); } )
		;
	}
);

function footnotes(url,winWidth,winHeight)
{
	var windowLeft = (screen.width - winWidth) / 2;
  	var windowTop = (screen.height - winHeight) / 2;
	var windowProperties = 'height=' + winHeight + ',width=' + winWidth + ',top=' + windowTop + ',left=' + windowLeft + ',scrollbars=' + 0 + ',resizable=' + 0 + ',menubar=' + 0 + ',toolbar=' + 0 + ',location=' + 0 + ',titlebar=' + 0 + ',statusbar=' + 1 + '';
	var newwindow=window.open(url, '', windowProperties);
}

function ShowPopup(hoveritem)
{
	hp = document.getElementById("hoverpopup");
	// Set popup to visible
	hp.style.top = hoveritem.offsetTop + 18;
	hp.style.left = hoveritem.offsetLeft + 20;

	hp.style.visibility = "Visible";
}

function HidePopup()
{
	hp = document.getElementById("hoverpopup");
	hp.style.visibility = "Hidden";
}

var e = new Object();
function toggleWindow(e)
{
	 var IE = document.all? true: false;
	 //Get window object
	 myWindow = ColdFusion.Window.getWindowObject('footnotes');
	 var cursor = {x:0, y:0};
	 var de = document.documentElement;
	 var b = document.body;
	 myWindow.header.remove();
	 //alert(IE);
	 if (IE) {
		 cursor.x = e.clientX + (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
	     cursor.y = e.clientY + (de.scrollTop || b.scrollTop) - (de.clientTop || 0);

		myWindow.moveTo(cursor.x-200,cursor.y+20);
	}
	else
	{
		cursor.x = e.pageX + 20;
		cursor.y = e.pageY - 32;

		if (cursor.x < 0){cursor.x = 0}
		if (cursor.y < 0){cursor.y = 0}
		myWindow.moveTo(cursor.x-200,cursor.y+40);

	}
	//myWindow.show();

	 //use the isVisible function to determine if the window is already open
	 //if (myWindow.isVisible()){
		//ColdFusion.Window.hide('footnotes');
	 //}
	 //else{
		ColdFusion.Window.show('footnotes');
	 //}
}

function init(){
       //Add the Collapse Button to the cfwindows toolbox
      myWindow = ColdFusion.Window.getWindowObject('footnotes');
      myWindow.collapseBtn=myWindow.toolbox.createChild({cls:"x-dlg-collapse"});
      myWindow.collapseBtn.on("click",myWindow.collapseClick,myWindow);
      myWindow.collapseBtn.addClassOnOver("x-dlg-collapse-over");
      myWindow.header.on("dblclick",myWindow.collapseClick,myWindow);
}


