$(document).ready(function(){
	$('#wlpeRegisterForm').validate({
		errorPlacement: function(error, element) {
			element.prev().before(error);
		}
	});
	
	$('#submitCholehForm').validate({
		errorPlacement: function(error, element) {
			element.prev().before(error);
		}
	});

	$('.deleteButton').click(function(e){
		return confirm('Are you sure you want to delete?');
	});
	
	$('#wlpeCholimListCheckboxLabel').click(function(){
		$('#mailingAddress').toggle();
	});
	
    $('#wlpeProfileCholimListEmail, #wlpeProfileCholimListPost').click(function(){
        if ($(this).attr('checked') == true) {
            $(this).attr('value', 'yes');
        }
    });
    
    if($('#wlpeProfileCholimListEmail').attr('value') == 'yes') {
		$('#wlpeProfileCholimListEmail').attr('checked', true);	    
    }
    
	if($('#wlpeProfileCholimListPost').attr('value') == 'yes') {
		$('#mailingAddress').show();
		$('#wlpeProfileCholimListPost').attr('checked', true);	
	}
	else
		$('#mailingAddress').hide();
		
	$('#wlpeProfileCholimListPost').click(function(event){
		$('#mailingAddress').toggle();
	});	
});