function preValidate(form_name) {
	if (Validate(form_name)) {
		return true;
	} else {
		$('#content-bg-bottom').css('bottom', '0px');
		focusError();
		return false;
	}
}

function focusError() {
	var error_id = $('.client_error:visible').attr('id');
	document.location.href = '#' + error_id;
}

function reloadCaptcha() {
	var time = (new Date()).getTime();
	$('img.captcha').attr('src', '/images/field_type_31.php#' + time);
}

$.fn.clearForm = function() {
	return this.each(function() {
		var type = this.type;
		var tag  = this.tagName.toLowerCase();

		if (tag == 'form') {
			return $(':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') {
			this.selectedIndex = 0;
		}
	});
}

function uncheckterms()
{
	$("#terms_1").attr('checked', 'off');
}
