$(window).load(function(){
	
	$(".ui_btn").click(function(){
		UI.showStep($(this).attr("rel"));
		return false;
	});
	
	Forms.addEvents();
	
	$(".tab_nav li a").click(function(){
		Tab.show($(this).attr("href"));
	});
	
	$("a.fancybox").fancybox();
	
});

Forms = {
	
	addEvents : function(){
		
	$("input.text").each(function(){
	
		//Prevent the labels from showing if the user hits back
		if($(this).val() != "")
			$(this).prev("label").hide();
		
		$(this).focus(function(){
			
			$(".note").hide();
			
			if($(this).val() == "") {
				$(this).prev("label").fadeTo(50, 0.5);
				$(this).nextAll("label.note").show();
			}

		});
		
		$(this).keypress(function(){
			$(this).prev("label").hide();
		})
		
		$(this).blur(function(){
			
			$(this).nextAll(".note").hide();
			
			if($(this).val() == "") {
				$(this).prev("label").show().fadeTo(200, 1);
			} else {
				$(this).prev("label").hide();
			}
			
			$(this).removeClass("focus");
				
		});
		
	});
		
	$("label").mousedown(function(){
		return false;
	});
		
	}
	
}
