var evtleft = screen.availWidth, 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";
		}

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

function openPopupWindow(eventKey, width, height)
{
	window.open("/eventWinView.do?eventWinBean.eventWinKey=" + eventKey, "", "left=0, top=0, width=" + width + ", height=" + (height + 30));
}

function openTotalWindow(url, width, height, left, top)
{
	window.open(url, "", "left="+left+", top="+top+", width=" + width + ", height=" + height);
}


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 "";
}

