$(function ()
{

	var answer = ["8"];

	if ($('.wrapper2').length) {
		var answer = ["9"];
	}

	$("input").val('').prop('disabled', false);
	$("input").prop('disabled', false);

	$("input").bind("input", function () {
		var $this = $(this);
		setTimeout(function () {
			if ($this.val().length >= parseInt($this.attr("maxlength"), 10)) {
				if ($this.val() === answer[$this.data('value')])
				{

					$this.prop('disabled', true).addClass('ok');
					$('#jplayer_well').jPlayer('play');

				} else {
					$this.addClass('bad');
					$this.val('')
					$('#jplayer_wrong').jPlayer('play');
				}
			}

		}, 100);
	});
});
