function clearSearch() {
	if ($('#SearchText').attr('value') == $('#SearchText').attr('defaultValue')) {
		$('#SearchText').attr('value', '');
	}
}

$(document).ready(function() {
	/*
		- descending login box
	*/
	
	
	
	(function() {
		var $button = $('#login-button > a'),
		 	$molding = $('#molding'),
			duration = 200;

		$button.toggle(
			function() {
				$molding.animate({
					'marginTop': '0'
				}, duration);
				$button.attr('title', 'Close Panel').find('img').attr('alt', 'Close Panel').end().addClass('active');
			},
			function() {
				$molding.animate({
					'marginTop': '-66px'
				}, duration);
				$button.attr('title', 'Navigation101 Login').find('img').attr('alt', 'Navigation101 Login').end().removeClass('active');
			}
		);
	})();

	
	/* 
		- clear/reset input type text on focus/blur
	*/
	$('input[type="text"]').bind('focus', function() {
		$(this).addClass('active');
		if (this.value == this.defaultValue) {
			this.value = '';
		}
	}).bind('blur', function() {
		$(this).removeClass('active');
		if (this.value == '') {
			this.value = this.defaultValue;
		}
	});


	/*
		- switch input type between text/password on focus/blur
	*/
	(function() {
		var $password_text = $('#password_text');
		var $password = $('#password');
		
		// reset bindings
		$password_text.unbind('focus');
		
		// set new bindings
		$password_text.bind('focus', function() {
			if ($password_text.val() == 'Password') {
				$password_text.attr('style', 'display: none;');
				$password.attr('style', 'display: block;').focus();
			}
		});
		
		$password.bind('blur', function() {
			if ($password.val() == '') {
				$password.attr('style', 'display: none;');
				$password_text.attr('style', 'display: block;');
			}
		});
	})();
});

