window.onload =
	function()
	{
		if(document.forms['form1'].IsAuthenticated.value == '0')
		{
			document.getElementById('LinkSendMessage').onclick = 
				function()
				{
					document.popups['UserLogin'].open();
					document.forms['form1'].WhichButton.value = 1;
					return false;
				}
			document.getElementById('LinkCreateAlbum').onclick = 
				function()
				{
					document.popups['UserLogin'].open();
					document.forms['form1'].WhichButton.value = 2;
					return false;
				}
		}
		document.popups['UserLogin'].onconfirm = 
			function()
			{
				var url;
				if(document.forms['form1'].WhichButton.value == '1')
				{
					document.cookies.reload();
					url = document.getElementById('LinkSendMessage').href;
					url = url.replace('[UserID]', document.cookies['new_loginid']);
					document.getElementById('LinkSendMessage').href = url;
					window.location.href = url;
				}
				else
				{
					window.location.href = document.getElementById('LinkCreateAlbum').href;
				}
			}
	}