/* Ajax-Events: Alle Form-Felder an ...
   ...Struts-Action uebermitteln
*/
function getResultListSize() {      
	flobu.enable();
	document.body.style.cursor = 'wait';
    var serializedForm = $("form").serialize();
    $.ajax({
        type: "POST",
        url:  "/uadb/hofdaten!ajaxResultCounter.do",
        data: serializedForm,
        success: function(html){
            $("#dynamicSubmit").replaceWith(html);
            flobu.disable(); 
            document.body.style.cursor = 'default';
        },
        error: function(){
            $("#dynamicSubmit").replaceWith("Ein Fehler ist aufgetreten!");
            flobu.disable(); 
            document.body.style.cursor = 'default';
        }    

    });   
}  

$(document).ready(function(){
    $(".esajaxSensible").click(function () {
        getResultListSize();
    });
    $(".esajaxDropDownSensible").change(function () {
        getResultListSize();
    });
    $(".esajaxHofnameSensible").keydown(function () {
    	hofname = $(".esajaxHofnameSensible").val();
    	if(hofname.length > 2){
    		getResultListSize();
    	}
    }); 
    $(".esajaxHofnameSensible").keyup(function () {
    	hofname = $(".esajaxHofnameSensible").val();
    	if(hofname.length == 0){
    		getResultListSize();
    	}
    });     
    $(".esajaxPlzSensible").keyup(function () {
    	plz = $(".esajaxPlzSensible").val();
    	if(plz.length > 0){
    		getResultListSize();
    	}
    }); 
    $(".esajaxOrtSensible").keyup(function () {
    	ort = $(".esajaxOrtSensible").val();
    	if(ort.length > 2){
    		getResultListSize();
    	}
    }); 
    $(".esajaxOrtSensible").keyup(function () {
    	ort = $(".esajaxOrtSensible").val();
    	if(ort.length == 0){
    		getResultListSize();
    	}
    }); 
});



/*** Wait-Cursor ***/
var flobu;
$(function(){
	flobu = new flower_bubble ({
		base_obj: $( '#erweiterteSuche' ),
		base_dir: 'http://www.landtourismus.de/fileadmin/img/helpers/flobu_wait_cursor/',
		background: { css: '#F8EDCD', opacity: 0.78 },
		flower: { image: 'flower.gif', width: 32, height: 32 },
		block_mode: 'base_obj'
	});
});
