/*
    Globals
 */
var serializedForm;

$(function(){
    getResults();
});


/*
    Load Ergebnisliste
 */
function getResults(){
    serializedForm = $("#suchmaske").serialize();
    $.ajax({
        type: "POST",
        url:  contextPath + "/oeffentlich/ajax/anzeigen-list?" + serializedForm,
        success: function(html){
            $(".div-suchmaske-ergebnis-list").html(html);
        },
        error: function(){
            /*alert("ERROR");*/
        }
    });
}

/*
    get Anzeige-Detail
 */
function getAnzeigeDetail(anzeigeId, systemStatus){
	if(systemStatus == 'development'){
		targetUrl =  contextPath + "/oeffentlich/anzeige?anzeigeId=" + anzeigeId;
	} else {
		targetUrl = $.webapp_bridge_URL("http://app.dlg.org:8081" + contextPath + "/oeffentlich/anzeige?anzeigeId=" + anzeigeId);
	}
	window.location.href = targetUrl;
}

/*
    jMesa Ajax-Requests
*/
function onInvokeAction(id) {
    setExportToLimit(id, '');
    serializedForm = $("#suchmaske").serialize();
    var parameterString = createParameterStringForLimit(id) + "&" + serializedForm;
    $.get(contextPath + '/oeffentlich/ajax/anzeigen-list?ajax=true&' + parameterString, function(data) {
        $("#results").html(data);
    });
}
