jQuery(document).ready(function($) {
	$('#lpHomeWrap').css('top',$(window).scrollTop());

	$('#lpClose').click(function() {
		$('#lpHomeWrap').remove();
	});

	$('#lpHome input.button').click(function(){
		var error = false;
		$('.error').removeClass('error');
		if($('#lpHome #imie').val().length < 4) { error = true; $('#lpHome #imie').addClass('error');}
		if($('#lpHome #nazwisko').val().length < 4) { error = true;$('#lpHome #nazwisko').addClass('error');}
		if($('#lpHome #miasto').val().length < 4) { error = true;$('#lpHome #miasto').addClass('error');}
		if($('#lpHome #tel_kom').val().length < 3) { error = true;$('#lpHome #tel_kom').addClass('error');}
		if($('#lpHome #tel_kom_2').val().length < 3) { error = true;$('#lpHome #tel_kom_2').addClass('error');}
		if($('#lpHome #tel_kom_3').val().length < 3) { error = true;$('#lpHome #tel_kom_3').addClass('error');}
		if($('#lpHome #email').val().length < 4) { error = true;$('#lpHome #email').addClass('error');}
		if($('#lpHome #zgoda1:checked').length == 0) { error = true; $('#lpHome #tip1').addClass('error');}
		if(error) {
			$('#scriptAlert').show().click(function() { $('#scriptAlert').hide(); });
			return false;
		}
	});

	if($(window).height() > 566) {
		var lpTop = ($(window).height() - 566) / 2;
		$('#lpHome').css('top', lpTop+'px');
	}

	$(window).scroll(function() {
		if($(window).height() > 566) {
			$('#lpHomeWrap').css('top',$(window).scrollTop());
		}
	});

	$(window).resize(function() {
		if($(window).height() > 566) {
		var lpTop = ($(window).height() - 566) / 2;
			$('#lpHome').css('top', lpTop+'px');
		}
	});

	$("#tip1").hover(
		function () {
			$("#info1").show();
		},
		function () {
			$("#info1").hide();
		}
	);

	$("#tip2").hover(
		function () {
			$("#info2").show();
		},
		function () {
			$("#info2").hide();
		}
	);
	/*@cc_on
		/*@if (@_jscript_version <= 5.6)
			$('#lpHomeWrap').css('display','none');
		/*@end
	@*/
});


function isNumberKey(evt) {
	var charCode = (evt.which) ? evt.which : evt.keyCode;
	if ( (charCode >= 48) && (charCode <= 57 ) || (charCode == 8) || (charCode == 9) || (charCode == 28) || (charCode == 29) || (charCode == 32)
	  || (charCode == 37) || (charCode == 39) || (charCode == 40) || (charCode == 41) || (charCode == 43) || (charCode == 45) || (charCode == 46) || (charCode == 127) )
		return true;
	return false;
}
 

