$(document).ready(function(){
	$('label.customRadio').click(checkRadio);
	$('label.customCheckbox').toggle(checkCheckboxOn, checkCheckboxOff );
});

var checkRadio = function(e){
	//checkk off the actual input
	var radioId = $(e.currentTarget).attr('for');
	$('#'+radioId+'').attr('checked');
	//uncheck image for all in radio name group
	var radioName = $(e.currentTarget).attr('name');
	$('.customRadio[name="'+radioName+'"]').children('.customRadioHolder').removeClass('selected');
	//check image for the new one
	$(e.currentTarget).children('.customRadioHolder').addClass('selected');
}

var checkCheckboxOn = function(e){
	//checkk on the actual input
	var checkId = $(e.currentTarget).attr('for');
	//check image for the new one
	if(!$(e.currentTarget).children('.customCheckboxHolder').hasClass('disabled')){
		$('#'+checkId+'').attr('checked', 'checked');
		$(e.currentTarget).children('.customCheckboxHolder').addClass('selected');
	}
}

var checkCheckboxOff = function(e){
	//checkk off the actual input
	var checkId = $(e.currentTarget).attr('for');
	//check image for the new one
	if(!$(e.currentTarget).children('.customCheckboxHolder').hasClass('disabled')){
		$('#'+checkId+'').removeAttr('checked');
		$(e.currentTarget).children('.customCheckboxHolder').removeClass('selected');
	}
}

