(function(){

var api = {
	init: function()
	{
		$('form.form').addClass('js-on');
		$('form.form ul.checkboxes input').each(function(){
			var s = $('<span></span>').prependTo(this.parentNode);
			if (this.checked)
				s.addClass('checked');
			s.click(function(){
				var i = $('input', this.parentNode)[0];
				i.checked = !i.checked;
					if (i.checked)
					$(this).addClass('checked');
				else
					$(this).removeClass('checked');
			});
		}).click(function(){
			if (this.checked)
				$('span', this.parentNode).addClass('checked');
			else
				$('span', this.parentNode).removeClass('checked');
		});
	}
};

$(document).ready(api.init);

})();