$(function(){
	
	// Hide the login box
	$("#loginBox").css({top:"78px"});
	
	// Toggle button
	$("#loginButton").toggle(function(){
		$("#loginBox").animate({ top: 39 }, 200);
	},function(){
		$("#loginBox").animate({ top: 78 }, 200);
	});
	
	// Login form default value switcher
	$("#login/input").focus(function(){		
		if($(this).attr("name") == $(this).val()) { $(this).val(""); }
	});

	$("#login/input").blur(function(){		
		if($(this).val() == "") { $(this).val($(this).attr("name")); }
	});
	
	// Login form submit action
	$("#login").submit(function(e){
		e.preventDefault();
		$("<div id='fade'></div><div id='error'><h2>ERROR: Invalid Username And Password</h2><a id='close' href=''>[x] close window</a></div>").appendTo("body");
		$("body").css("z-index: -1;");
		$("#close").click(function(e){
			e.preventDefault();
			$("#fade").remove();
			$("#error").remove();
			$("body").css("z-index: 0;");
		});
	});
	
	sfHover = function() {
		var sfEls = document.getElementById("navigation").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}

	sfHover();
	
});
