$(document).ready(function() {
	$('label.inlabel').siblings("input").focus(function() {
		var id = $(this).attr("id");
		$(this).siblings("label[for="+id+"]").hide();
	});
	
	$('label.inlabel').siblings("input").blur(function() {
		var id = $(this).attr("id");
		
		if ($(this).val()=="") {
			$(this).siblings("label[for="+id+"]").show();
		};
	});

	$('label.inlabel').siblings("input").each(function(index, th) {
		if ($(th).val()!="") {
			var id = $(th).attr("id");
			$(th).siblings("label[for="+id+"]").hide();
		};
	});

	if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/iPad/i)) {
		$(document).ready(function () {
			$('label[for]').click(function () {
				var el = $(this).attr('for');
				if ($('#' + el + '[type=radio], #' + el + '[type=checkbox]').attr('selected', !$('#' + el).attr('selected'))) {
					return;
				} else {
					$('#' + el)[0].focus();
				}
			});
		});
	}

});

