
		var months = new Array('Styczeń','Luty','Marzec','Kwiecień','Maj','Czerwiec','Lipiec','Sierpień','Wrzesień','Październik','Listopad','Grudzień');
		function dayList(){
			for (i=1;i<=31;i++){
				 var opt = "<option value='"+i+"'>"+i+"</option>";
					 $('select#dayList').append($(opt));
			}
		}
		function monthList(){
			for (i=0;i<12;i++){
				 var opt = "<option value='"+i+"'>"+months[i]+"</option>";
					 $('select#monthList').append($(opt));
			}
		}
		function yearList(){
		
			dayList();
			monthList();
			var date = new Date();
			var start_year = 1900;
			var actual_year = 	date.getFullYear();
			
				for (i=start_year; i<=actual_year; i++){
					 var opt = "<option value='"+i+"'>"+i+"</option>";
					 $('select#yearList').append($(opt));
					// console.log(i);

				}
		}   
		
	function showRequest(formData, jqForm, options) { 
		   
		    var queryString = $.param(formData); 
		 
		   
		 
		    //alert('About to submit: \n\n' + queryString); 
		 
		   
		    return true; 
		} 
		 
		// post-submit callback 
		function showResponse(responseText, statusText)  { 
		   if (responseText=='OK'){
			$.unblockUI(); 
			}
		    //alert('status: ' + statusText + '\n\nresponseText: \n' + responseText + 
		        //'\n\nThe output div should have already been updated with the responseText.'); 
		} 
	function validate(formData, jqForm, options) { 
  
	 
	    var rok = $('#yearList').val(); 
		  var miesiac = $('#monthList').val(); 
		  var dzien = $('#dayList').val(); 	
		 if (rok=='' || miesiac=='' || dzien=='') { 
	        alert('Podaj poprawnie date urodzenia. Wybierz wszystkie pola.'); 
	        return false; 
	    } else {
		 	return true;
		 }
	    //alert('Both fields contain values.'); 
	}
	 $(document).ready(function() { 
 		
		
		var options = { 
        target:        '#output',   // target element(s) to be updated with server response 
        beforeSubmit:  validate,  // pre-submit callback 
        success:       showResponse  // post-submit callback 
 
        // other available options: 
        //url:       url         // override for form's 'action' attribute 
        //type:      type        // 'get' or 'post', override for form's 'method' attribute 
        //dataType:  null        // 'xml', 'script', or 'json' (expected server response type) 
        //clearForm: true        // clear all form fields after successful submit 
        //resetForm: true        // reset the form after successful submit 
 
        // $.ajax options can be used here too, for example: 
        //timeout:   3000 
    	}; 
	 	yearList();

 			$.blockUI({ overlayCSS: { backgroundColor: '#f5f4eb' }, message: $('#selectDate'), css: { width: '655px', border: '2px solid #828b33',cursor: 'pointer' } }); 
      
        //$('#submit').click(function() { 
            // update the block message 
            //$.blockUI({ message: "<h1>Remote call in progress...</h1>" }); 
 
            /*$.ajax({ 
                url: 'wait.php', 
                cache: false, 
                complete: function() { 
                    // unblock when remote call returns 
                    $.unblockUI(); 
                } 
            });  */
        //}); 
		 $('#u_dodaj').ajaxForm( options ); 
	  
 	 
 
    }); 


