var evtleft = 0, evttop = 0;

function openEventWindow(eventKey, width, height, scrollbarFlag)
{
	if (!checkCookie(eventKey))
	{
		var scrollbars = "no";

		if (evtleft >= screen.availWidth)
		{
			evttop += 50;
			evtleft = evttop;
		}

		if (scrollbarFlag == 1)
		{
			scrollbars = "yes";
		}

		window.open("/eventWinView.do?eventWinBean.eventWinKey=" + eventKey, "", "left=" + evtleft + ", top=" + evttop + ", width=" + width + ", height=" + (height + 30) + ", scrollbars=" + scrollbars);
		evtleft += width;
	}
}

function checkCookie(eventKey)
{
	if (getCookie("event" + eventKey) == "noopen")
	{
		return true;
	}
	else
	{
		return false;
	}
}

function getCookie(eventKey)
{
	var cook = document.cookie + ";";
	index1 = cook.indexOf(eventKey, 0);

	if (index1 != -1)
	{
		cook = cook.substring(index1, cook.length);
		index2 = cook.indexOf("=", 0) + 1;
		index3 = cook.indexOf(";", index2);

		return (unescape(cook.substring(index2, index3)));
	}

	return "";
}

