function setCookie(c_name, value, expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
function getCookie(c_name)
{
	if (document.cookie.length > 0)
	{
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start != -1)
		{
			c_start = c_start + c_name.length+1;
			c_end = document.cookie.indexOf(";", c_start);
			if (c_end==-1)
			{
				c_end=document.cookie.length;
			}
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return "";
}
function showSubmenu(id, offset)
{
	if (getCookie('status') != "")
	{
		document.getElementById("b" + getCookie('status')).style.backgroundImage = "url(http://pocontrol.com/images/menuOff.png)";
	}
	document.getElementById("b" + id).style.backgroundImage = "url(http://pocontrol.com/images/menuOn.png)";
	document.getElementById("submenu").style.marginLeft = offset;
	document.getElementById("submenu").innerHTML = document.getElementById("submenu_" + id).innerHTML;
	setCookie('status', id, 6);
}
/*
To add links to a submenu - simply enter the neccessary links in the appropriate div elements with id "submenu_(number)" in Includes/main_site_menu.html
-------------------------------------
The functions are currently designed so that the submenus appear below the beginning of their respective button.
If the space is not enough the submenus can appear in left, so that more space is available.
To do so - simply substitute the respective element in the array "offsets", as well as the parameter passed, when calling the showSubmenu function in Includes/main_site_menu.html
If changing the content of the offsets array - do not forget to change the content of the same array in the menu_blog.js file, which is in the same directory as the current file.
-------------------------------------
*/
function loadMenu()
{
	if (getCookie('status') != "")
	{
		var memo = getCookie('status');
		var offsets = new Array("", "0px", "125px", "0px", "500px", "625px", "250px", "750px", "875px");
		document.getElementById("b" + memo).style.backgroundImage = "url(http://pocontrol.com/images/menuOn.png)";
		showSubmenu(memo, offsets[memo]);
	}
}