function AddCookie(Name, Value)
{
	document.cookie = Name + '=' + Value + '; path=/';
}
function GetCookieValue(Name)
{
	if (document.cookie.length > 0)
	{
		startIndex = document.cookie.indexOf(Name + '=');
		if (startIndex != -1)
		{ 
			startIndex = startIndex + Name.length + 1 ;
			endIndex = document.cookie.indexOf(';', startIndex);
			if (endIndex == -1)
				endIndex = document.cookie.length;
			return document.cookie.substring(startIndex, endIndex);
		}
		return null;
	}
	return null;
}

function ChangeIFramePage()
{
	var iFramePath = GetCookieValue('IFramePath');
	AddCookie('IFramePath', '');
	if (iFramePath != null)
		document.getElementById('insideF').src = iFramePath;
}

function OnLoadIFrameEvents(subPageWidth)
{
	//Open in IFrame
	if (parent.document.getElementById('insideF'))
	{
		CreateBody();
		parent.leftMenuMoveDownFromSubpageResized(subPageWidth);
		repositionFooter();
	}
	else //Open in Top Window
	{
		AddCookie('IFramePath', 'CenterPage/TopMenu/HTML/Events.htm');
		top.location.replace('../../../');
	}
}