
// requires the jQuery library - http://docs.jquery.com/

$(window).load(function(){

	// search box functionality
	$('#q').attr('value', 'search'); 
	$('#q').focus(function(){
		$(this).attr('value', ( 
			($(this).attr('value') == 'search') ? '' : $(this).attr('value') ) 
		)
	}); 
	$('#q').blur(function(){
		$(this).attr('value', ( 
			($(this).attr('value') == '') ? 'search' : $(this).attr('value') ) 
		)
	});
	
	// login form
	$('#ctype-ret').click(function() {
		$('#p').focus();
		$('#paneconfirm').hide();
		$('#panereset').show();
    });
	$('#ctype-new').click(function() {
		$('#p').focus();
		$('#paneconfirm').show();
		$('#panereset').hide();
    });
	
	if ($('#ctype-ret').attr('checked')) {
		$('#paneconfirm').hide();
		$('#panereset').show();
	}
	if ($('#ctype-new').attr('checked')) {
		$('#paneconfirm').show();
		$('#panereset').hide();
	}

	// checkout address form
	$("input[@name='atype']").click(function(){
		addressSelect();
	});
	addressSelect();
	
});

function addressSelect() {
	$('.addressitem').hide();
	$("input[@name='atype']:checked").parent().next('div').show(); 
}

