function getCount(id, maxLentght){
	var areaLength = $("#"+id).val().length;
	if (areaLength > maxLentght)
		{
			var value = $("#"+id).val();
			$("#"+id).val(value.substr(0,maxLentght));
			$("#forum-text-count").html('max');
			$("#forum-text-count").css('color','red');
		}
	else
		{
			$("#forum-text-count").html(areaLength);
			$("#forum-text-count").css('color','black');
		}
}

$(document).ready(function() {
	$(".banner-click, .text-click").click(function(event) {
		$.ajax({
			type: "POST",
			url: "/clickthru.php?bid="+$(this).attr("id").replace(/^x/, "", "i")
		});
		event.stopImmediatePropagation();
	});

	/* element el_mod_kosik_novy_ucet*/
	$("#order-registration").click(function() {
		$("#order-create-registration").toggle();
		var email = $("#form-order-address-1 #order-address-1 #email").val();
		$("#order-create-registration #username").val(email);
	});
	
	var x = $("#catalogue-add-reg-form").attr("rel");
	if (x == 1) {
		$("#order-registration").attr("checked", "checked");
		$("#order-create-registration").css("display", "block");
	}
	else if (!$("#order-registration").is(":checked")) {
		$("#order-create-registration").hide();
	}
	
	/* FmwKatalog -> form */
	$("#catalogue-add-login-form").css("display", "none");
	$("#order-login").click(function() {
		if ($(this).attr("checked") == true) {
			$("#catalogue-add-login-form").css("display", "block");
		}
		else {
			$("#catalogue-add-login-form").css("display", "none");
		}
	});
});

