function checkRegistrationForm() {
	if($("input[name=type]:checked").length == 0) {
		alert("Please select member type.");
		return false;
	}
	
	var type = $('input:radio[name=type]:checked').val();

	if(type==1){
		if (!checkEmail("form_register_login","Please enter valid email address.")) return false
	}
	else if(type==2 || type==3){
		return checkFormRegister($("#register").get(0));
	}
	
	if(type==1 || type==3){
		if (!checkGenreRadio("register","genre","Please choose at least one genre.")) return false
	}	
}

function checkGenreRadio(form, input, errorMessage, inputId){
	var type = $('input:radio[name=type]:checked').val();
	if (type == 1 || type == 3){
		return checkRadio(form, input, errorMessage, inputId);
	} else {
		return true;
	}
}

function checkAll() {
	$(".radio input[@type='checkbox']").each(function(){this.checked=true;});
}
function uncheckAll() {
	$(".radio input[@type='checkbox']").each(function(){this.checked=false;});
}

function refresh() {
	if($("input[name=type]:checked").length == 0) return;
	var value = $("input[name=type]:checked").get(0).value;					
	if(value==1){
		$(".row_name, .row_nick, .row_password, .row_password2").hide();
		$(".row_email, .radio, .radio_comment").show();
	} else if(value==2){
		$(".radio, .radio_comment").hide();
		$(".row_name, .row_nick, .row_email, .row_password, .row_password2").show();
	} else if(value==3){
		$(".row_name, .row_nick, .row_email, .row_password, .row_password2, .radio, .radio_comment").show();
	}
}

$(window).load(function () {
	$("input[name=type]").click(refresh);
	refresh();
});	
