$j(document).ready(function() {
	
	$j('#emailFriend_link').click(function (){
		$j('#emailFriend_box').slideToggle();
	});
	
	$j('#emailFriend_form input[name=js_check]').val('ba1d2ef30bfa5260f2d63ab2ee7ad481');
	
	$j('#side_search .resetButton').click(function (){
		if (confirm('Are you sure you want to clear your current search values?')) {
			$j('#side_search form').clearForm();
		} else {
			return false;
		}
	});
	
	$j('#side_search select[name=volOrMem]').change(function() {
		type = $j(this).val();
		$j('#side_search_volMem p').hide();
		$j('#side_search_volMem p.search_' + type).show();
	}).triggerHandler('change');
	
	
});


$j.fn.clearForm = function() {
	return this.each(function() {
		var type = this.type, tag = this.tagName.toLowerCase();
		if (tag == 'form') {
			return $j(':input',this).clearForm();
		}
		if (type == 'text' || type == 'password' || tag == 'textarea') {
			this.value = '';
		} else if (type == 'checkbox' || type == 'radio') {
			this.checked = false;
		} else if (tag == 'select') {
			value = '';
			if (type == 'select-multiple') {
				value = -1;
			}
			this.selectedIndex = value;
		}
		
	});
};

