document.write("<script src='/js/cookie.js' type='text/javascript'></script>");

$(function() {

	var o = 'Hide';

	// maintain recently viewed items state
	if ( $.cookie('register') == 'show' ) { $('tr.optional').show(); var o = 'Hide' }
	if ( $.cookie('register') == 'hide' ) { $('tr.optional').hide(); var o = 'Show' }

	// assign event for active inputs
	$("#block5 :input").focus(
		function(){
			$(this).addClass("inputa");
			}
		);

	// remove event for inactive inputs
	$("#block5 :input").blur(
		function(){
			$(this).removeClass("inputa");
			}
		);

	// place focus in first element
	$("#username").focus();

	// append link to remove optional fields
	$("h4#optional")
		.append(" \( <a href=\"\"> - " + o + " Optional Fields?</a> \)")
		.click(function() {
		$("#username").focus();

		if ($("tr.optional").is(":hidden")) {
			$.cookie('register', 'show' );
			$("tr.optional").fadeIn("slow");
			$(this).html("Billing Information \( <a href=\"\"> - Hide Optional Fields?</a> \)");
			}
		else {
			$.cookie('register', 'hide' );
			$("tr.optional").fadeOut("slow");
			$(this).html("Billing Information \( <a href=\"\"> + Show Optional Fields?</a> \)");
			}
			return false;
			}
		);

	//$("#block5 label").addClass("inactive");

	// assign event for active inputs
	//$("#block5 label").hover(
	//	function(){
	//		$(this).removeClass("inactive");
	//		$(this).addClass("active");
	//		},
	//	function(){
	//		$(this).removeClass("active");
	//		$(this).addClass("inactive");
	//		}
	//	);

	}
);
