$().ready(function() {

var validator = $("#aspnetForm").validate({

		rules: {
			//email
			ctl00$ContentPlaceHolder1$cuCreate$CreateUserStepContainer$UserName: {
				required: true,
				email: true,
				onfocusout: false
			},
			//name
			ctl00$ContentPlaceHolder1$cuCreate$CreateUserStepContainer$tbImie: { 
				required: true,
				minlength: 3,
			},
			//surname
			ctl00$ContentPlaceHolder1$cuCreate$CreateUserStepContainer$tbNazwisko:{ 
				required: true,
				minlength: 3,
			},
			//password
			ctl00$ContentPlaceHolder1$cuCreate$CreateUserStepContainer$Password: {
				required: true,
				minlength: 6
			},
			//confirm password
			ctl00$ContentPlaceHolder1$cuCreate$CreateUserStepContainer$tbPwdAgain: {
				required: true,
				minlength: 6,
				equalTo: "#ctl00_ContentPlaceHolder1_cuCreate_CreateUserStepContainer_Password"
			},
			//date
			ctl00$ContentPlaceHolder1$cuCreate$CreateUserStepContainer$tbDataUrodzenia: {
				required: true,
			},

			//checbox1
			ctl00$ContentPlaceHolder1$cuCreate$CreateUserStepContainer$cbPortal: "required",
			//checbox2
			ctl00$ContentPlaceHolder1$cuCreate$CreateUserStepContainer$cbDane: "required"
		},

		messages: {
			//email
			ctl00$ContentPlaceHolder1$cuCreate$CreateUserStepContainer$UserName: "<img src=\"js/no_ok.jpg\" alt=\"\" />",
			//name
			ctl00$ContentPlaceHolder1$cuCreate$CreateUserStepContainer$tbImie: "<img src=\"js/no_ok.jpg\" alt=\"\" />",
			//surname
			ctl00$ContentPlaceHolder1$cuCreate$CreateUserStepContainer$tbNazwisko: "<img src=\"js/no_ok.jpg\" alt=\"\" />",
			
			//password
			ctl00$ContentPlaceHolder1$cuCreate$CreateUserStepContainer$Password: {
				required: "<img src=\"js/no_ok.jpg\" alt=\"\" />",
				minlength: "<img src=\"js/no_ok.jpg\" alt=\"\" />"
			},
			//confirm password
			ctl00$ContentPlaceHolder1$cuCreate$CreateUserStepContainer$tbPwdAgain: {
				required: "<img src=\"js/no_ok.jpg\" alt=\"\" />",
				minlength: "<img src=\"js/no_ok.jpg\" alt=\"\" />",
				equalTo: "<img src=\"js/no_ok.jpg\" alt=\"\" />"
			},
			//date
			ctl00$ContentPlaceHolder1$cuCreate$CreateUserStepContainer$tbDataUrodzenia: "<img src=\"js/no_ok.jpg\" alt=\"\" />",

			//checbox1
			ctl00$ContentPlaceHolder1$cuCreate$CreateUserStepContainer$cbPortal: "<img src=\"js/no_ok.jpg\" alt=\"\" />",
			//checbox2
			ctl00$ContentPlaceHolder1$cuCreate$CreateUserStepContainer$cbDane: "<img src=\"js/no_ok.jpg\" alt=\"\" />",
		},

		success: function(label) {

				label.addClass("valid").html("<img src=\"js/ok.jpg\" alt=\"\" />")
   		}
	});
/*	$('#ctl00_ContentPlaceHolder1_cuCreate_CreateUserStepContainer_cbForum').click(function(){
		data = $('#ctl00_ContentPlaceHolder1_cuCreate_CreateUserStepContainer_tbDataUrodzenia').val();
		time = $('#ctl00_ContentPlaceHolder1_hfData').val();
		
		if(this.checked && data > time){
			$('.pNick').show();
		}else{
			$('.pNick').val('');
			$('.pNick').hide();
		}

	});
	$('#ctl00_ContentPlaceHolder1_cuCreate_CreateUserStepContainer_tbDataUrodzenia').change(function(){
		data = $('#ctl00_ContentPlaceHolder1_cuCreate_CreateUserStepContainer_tbDataUrodzenia').val();
		time = $('#ctl00_ContentPlaceHolder1_hfData').val();

		if(data == ''){
			$('.pNick').val('');
			$('.pNick').hide();
		}else{ 
			if(data > time){
				$('.pNick').show();
			}
		}
	});*/
	
	// apply inline-box only for mozilla
	if( jQuery.browser.mozilla ) {
		// do when DOM is ready
		$( function() {
			// search form, hide it, search labels to modify, filter classes nocmx and error
			$( 'form.cmxform' ).hide().find( 'p>label:not(.nocmx):not(.error)' ).each( function() {
				var $this = $(this);
				var labelContent = $this.html();
				var labelWidth = document.defaultView.getComputedStyle( this, '' ).getPropertyValue( 'width' );
				// create block element with width of label
				var labelSpan = $("<span>")
					.css("display", "block")
					.width(labelWidth)
					.html(labelContent);
				// change display to mozilla specific inline-box
				$this.css("display", "-moz-inline-box")
					// remove children
					.empty()
					// add span element
					.append(labelSpan);
			// show form again
			}).end().show();
		});
	};
});