    /* Ajax-Events: Alle Form-Felder an ...
       ...Struts-Action uebermitteln
    */
    function getResultListSize() {      
        var serializedForm = $("form").serialize();
        $.ajax({
            type: "GET",
            url:  "/verbraucherutf8/frischfleischMySqlEn!ajaxResultCounter.do",
            data: serializedForm,
            success: function(html){
                $("#dynamicSubmit").replaceWith(html);
            }
        });   
    }  
    
    function getDetailPageData(params) {      
        $.ajax({
            type: "POST",
            url:  "/verbraucherutf8/frischfleischMySqlEn!execDetail.do",
            data: params,
            success: function(html){
                $("#verbraucherdetail").show("slow");
                $("#verbraucherdetail").html(html);
            }
        });   
    }      

    $(document).ready(function(){
    
        /* Ajax-Events: Bei DopDown-Listen ...
           ...Events Ajax triggern 
        */
	    $(".ajaxSensible").change(function () {
            getResultListSize();
	    });
	    
	    /* Ajax-Events: Bei Preistraeger-Radios ...
           ...Events Ajax triggern 
        */
	    $(".ajaxSensibleRadio").click(function () {
            getResultListSize();
	    });
	    
		$("input[name='bioCB']").click(function(){
            getResultListSize();
		});		
		$("input[name='jodCB']").click(function(){
            getResultListSize();
		});	
		
        /* Displaytag-Eintraege ins ...
           ...englische uebersetzen
        */
        if($(".pagebanner").html() != null){
            resultsDisplay = $(".pagebanner").html();
            resultsDisplay = resultsDisplay.replace("Ergebnisse gefunden. Angezeigt wird Datensatz:", "results found. Showing result:");
            resultsDisplay = resultsDisplay.replace("Ergebnisse gefunden. Es werden alle Ergebnisse angezeigt.", "results found. Showing all results.");
            resultsDisplay = resultsDisplay.replace("bis", "to");
            $(".pagebanner").html(resultsDisplay);
            pagesDisplay = $(".pagelinks").html();
            pagesDisplay = pagesDisplay.replace("Seite&nbsp;", "Page&nbsp;");
            pagesDisplay = pagesDisplay.replace("&nbsp;von&nbsp;", "&nbsp;of&nbsp;");
            $(".pagelinks").html(pagesDisplay);
        }
				
    });
    
// Adds onmouseover, onmouseout, and onclick handlers to each table row.  The onmouseover handler changes the row's class attribute to
// rowMouseOver.  The onmouseout handler changes it back.  The onclick function makes a request for the specified url, including the
// innerHTML of the specified column as a request parameter.
function addRowHandlers(tableId, rowClassName, connectionColumnIndex, paramName, paramColumnIndex) {
    var previousClass = null;
    var table = document.getElementById(tableId);
    var rows = table.getElementsByTagName("tr");
    for (i = 1; i < rows.length; i++) {
        rows[i].onmouseover = function () {
            previousClass = this.className;
            this.className = "row-highlighted";
        };
        
        rows[i].onmouseout = function () {
            this.className = previousClass;
        };
        
        rows[i].onclick = function () {
            var connectionCell = this.getElementsByTagName("td")[connectionColumnIndex];
            var connectionValue = connectionCell.innerHTML;
            var paramCell = this.getElementsByTagName("td")[paramColumnIndex];
            var paramValue = paramCell.innerHTML;
            var params = "conn=" + connectionValue + "&" + paramName + "=" + paramValue;
            getDetailPageData(params);
            
        };
    }
}

