
function initPage()
{
	var nav = document.getElementById("navigation");
	if (nav)
	{
		var nodes = nav.getElementsByTagName("li");
		for (var i = 0; i < nodes.length; i++)
		{
				nodes[i].onmouseover = function ()
				{
					this.className += " hover";
				}
				nodes[i].onmouseout = function ()
				{
					this.className = this.className.replace(" hover", "");
				}
		}
	}
}
if (document.all && !window.opera) attachEvent("onload", initPage);

$(document).ready(function(){
	$("#sitemap-link").click(function () {
		  $("#sitemap").slideToggle("fast");
		  $("#sitemap").show();
	});
	$('#btn_login').click(
		function () {
			$('.error').hide();
			var user = $("input#user").val();
			if (user == "") {
				$("label#user_error").show();
				$("input#user").focus();
				return false;
			}
			var password = $("input#password").val();
			if (password == "") {
				$("label#password_error").show();
				$("input#password").focus();
				return false;
			}

			$.post("post-login.php",
				{user: user, password: password},
				function (data) {
					switch (data) {
						case 'user':
							$("label#user_error2").show();
							$("input#user").focus();
						break;
						case 'password':
							$("label#password_error2").show();
							$("input#password").focus();
						break;
						case 'success':
							$("#login").hide();
							$("#upload").show();
							$.swfobject.embedSWF("upload.swf", "uploadswf", "400", "152", "9.0.0", null, null, {wmode: "transparent"}, null);
						break;
					}
				},
				'text'
			);
			return false;
		}
	);
});
