﻿
var HighlightShapes = {
    Manager: function () {
        this.viewPortIdPart = "Viewport";
        this.contentFillerIdPart = "ContentFiller";
        this.navigationPanelDivIdPart = "NavigationPanelDiv";
        this.navigationPanelShadowIdPart = "NavigationPanelShadow";
        this.zoomPanelDivIdPart = "ZoomPanelDiv";
        this.zoomPanelShadowIdPart = "ZoomPanelShadow";
        this.dojoSurfaceId = "highlightedShapes";
        this.dragRectangleId = "dragRectangle";
        this.cboRegionsId = "cboRegion";
        this.txtVinenameId = "txtVinename";
        this.btnSearchVineName = "imgVineName";
        this.txtPriceId = "txtPrice";
        this.filterAreaId = "filterarea";
        this.filterPanelId = "filterpanel";
        this.filterPanelContentHeaderId = "panelcontentheader";
        this.btnReset = "btnReset";
        this.filterResultId = "filterresult";
        this.filterResultAmountId = "filterresultamount";

        this.m_contentFiller = null;

        //Gets or sets the id of the mapcontrol.
        MapControlId: "MapControlId";
        //Gets or sets the parent element for the dragrectangle.
        DragRectangleParent: "DragRectangleParent";
        //Gets or sets the id of the overview mapcontrol.
        HallOverviewMapControlId: "HallOverviewMapControlId";
        //Gets or sets the id of the dropdown which contains the getränkeart.
        CboGetraenkeArtId: "CboGetraenkeArtId";
        //Gets or sets the id of the dropdown which contains the countries.
        CboCountriesId: "CboCountriesId";
        //Gets or sets the id of the dropdown which contains the rebsorten.
        CboRebsorteId: "CboRebsorteId";
        //Gets or sets the id of the dropdown which contains the qualitaet.
        CboQualityId: "CboQualityId";
        //Gets or sets the id of the dropdown which contains the Produzent.
        CboProducerId: "CboProducerId";
        //Gets or sets the id of the dropdown which contains the Jahrgang.
        CboYearsId: "CboYearsId";
        //Gets or sets the id of the dropdown which contains the Auszeichnungen.
        CboAwardId: "CboAwardId";
        //Gets or sets the id of the dropdown which contains the pricefrom value.
        CboPriceFromId: "CboPriceFromId";
        //Gets or sets the id of the dropdown which contains the priceto value.
        CboPriceToId: "CboPriceToId";
        //Gets or sets the string resources used in javascript.
        StringResources: "StringResources";

        //Initialize the elements
        this.Initialize = function () {
            this.IsPanning = false;
            this.SelectCurrentStand = true;
            //Get the Dundas MapControl
            var mapControl = this.GetMapControl();
            //Get the dojoSurfaceParent element
            var dojoSurfaceParent = this.CreateDojoSurfaceParent();
            //Get the contentfiller element from the mapcontrols viewport
            var contentFiller = this.GetContentFiller();
            if (contentFiller != null) {
                //Gets the X value from the contentfiller element
                contentFillerX = parseInt(contentFiller.position().left);
                //Gets the Y value from the contentfiller element
                contentFillerY = parseInt(contentFiller.position().top);
                //Gets the width value from the contentfiller element
                contentFillerWidth = parseInt(contentFiller.width());
                //Gets the height value from the contentfiller element
                contentFillerHeight = parseInt(contentFiller.height());

                if (dojoSurfaceParent != null) {
                    //Sets the dimensions to the dojoSurfaceParent element.
                    dojoSurfaceParent.css({
                        width: contentFillerWidth,
                        height: contentFillerHeight
                    });
                    //Appends the dojoSurfaceParent to its parent element.
                    contentFiller.append(dojoSurfaceParent);

                    //For firefox and safari
                    //Sets the zIndex for following elements to an higher level
                    this.SetZIndexForMapControlElements(dojoSurfaceParent);

                    var xMouseDown = 0;
                    var yMouseDown = 0;
                    //Binds the mousedown event to the contentfiller element
                    //Detecting the x,y coordinates at mousedown.
                    contentFiller.mousedown(function (e) {
                        xMouseDown = e.pageX;
                        yMouseDown = e.pageY;
                    });
                    //Binds the click event to the contentfiller element
                    //Detecting the x,y coordinates at click.
                    contentFiller.click(function (e) {
                        var xClick = e.pageX;
                        var yClick = e.pageY;
                        //If the mousedown coordinates the same like the click coordinates
                        //Then there's no panning event.
                        if ((xMouseDown == xClick) && (yMouseDown == yClick)) {
                            var layerX = parseInt(e.pageX + contentFiller.position().left - contentFiller.offset().left);
                            var layerY = parseInt(e.pageY + contentFiller.position().top - contentFiller.offset().top);
                            //12.10.2010 ie hack: wrong y position when the user scrolls down to the pages end.
                            if ($.browser.msie == true) {
                                //the scrollbar offset.
                                layerY -= $("body,html").scrollTop();
                            }
                            PerformCallback(mapControl, "SelectStand", layerX + "," + layerY, oncallbackcomplete);
                        }
                    });
                }
            }

            //If there is a checkbox selection at startup. The callback for the coordinates will be executed
            var divFilterResult = this.GetDivFilterResult();
            var spanFilterResultAmount = this.GetSpanFilterResultAmount();
            $("#m_lstExhibitors input:checkbox").each(function (i) {
                var strValues = "";
                var iAmount = 0;
                $("#m_lstExhibitors input:checkbox:checked").each(function (i) {
                    strValues += $(this).val() + ";";
                    iAmount++;
                });
                if (strValues != "") {
                    if (spanFilterResultAmount) {
                        spanFilterResultAmount.text(iAmount);
                    }
                    if (divFilterResult) {
                        divFilterResult.show();
                    }
                    PerformCallback(mapControl, "HighlightExhibitors", strValues, oncallbackcomplete);
                }
            });

            this.BindExhibitorsCheckBoxClick();
            this.BindExhibitorsButtonClick();

            //DragRectangle
            var parent = this.GetDragRectangleParent();
            if ((mapControl != null) && (parent != null)) {
                var dragRectangle = $("#" + this.dragRectangleId);
                if (dragRectangle.length == 0) {

                    var zoomValue = mapControl.getZoom();
                    var viewCenter = mapControl.getViewCenter();

                    var iWidth = (parent.width() / zoomValue * 100);
                    var iHeight = iWidth;
                    var iLeft = (parent.width() - iWidth) / 2;
                    var iTop = iLeft;

                    dragRectangle = $("<div/>").attr({
                        id: this.dragRectangleId
                    }).css({
                        position: "absolute",
                        top: iTop,
                        left: iLeft,
                        height: iHeight,
                        width: iWidth,
                        borderWidth: 2,
                        zIndex: 80
                    });

                    if (parent.length != 0) {
                        parent.append(dragRectangle);
                    }
                }

                var overViewImage = this.HallOverviewMapControl();
                dragRectangle.draggable({
                    containment: parent,
                    drag: function () {
                        //Delay for the mapcontrols panning
                        setTimeout(function () {
                            var x = dragRectangle.position().left + dragRectangle.width() / 2;
                            var y = dragRectangle.position().top + dragRectangle.height() / 2;
                            var iMapCenterX = x / $(overViewImage).width() * 100;
                            var iMapCenterY = y / $(overViewImage).height() * 100;
                            mapControl.setViewCenter(iMapCenterX, iMapCenterY);
                        }, 200)
                    }
                });
            }

            var strCollapseText = this.GetStringFromResource("IDS_JS_TooltipMiniplanCollapse");
            var strExpandText = this.GetStringFromResource("IDS_JS_TooltipMiniplanExpand");

            //ToggleButton
            var toogleButton = $("#expandRectangle");
            if (toogleButton.length > 0) {
                toogleButton
                .attr({
                    title: strExpandText
                })
                .click(function () {
                    var toggleImage = $("#imgMiniPlan");
                    if ($("#panmaparea").is(":hidden")) {
                        toggleImage.attr({
                            src: "images/collapse_map.gif",
                            title: strCollapseText
                        });

                        var zoomValue = mapControl.getZoom();
                        var viewCenter = mapControl.getViewCenter();
                        ResizeDragRectangle(dragRectangle, zoomValue, viewCenter);
                    }
                    else {
                        toggleImage.attr({
                            src: "images/expand_map.gif",
                            title: strExpandText
                        });
                    }
                    $("#panmaparea").toggle();
                });
            }

            var filterArea = this.GetFilterArea();
            if (filterArea != null) {
                var filterPanel = this.GetFilterPanel();
                if (filterPanel != null) {
                    filterPanel.css({
                        width: filterArea.width()
                    });

                    var filterPanelContentHeader = this.GetFilterPanelContentHeader();
                    if (filterPanelContentHeader != null) {
                        filterPanelContentHeader.css({
                            width: filterPanel.width()
                        });
                    }
                }
            }

            var panelCaption = $("#panelcaptionbar");
            if (panelCaption.length > 0) {
                panelCaption.click(function () {
                    var panelContent = $("#panelcontent");
                    if (panelContent.length > 0) {
                        if (panelContent.is(":hidden")) {
                            panelCaption.hover(
                            function () {
                                $(this).css({
                                    backgroundImage: "url(images/leiste_geoeffnet_v2_hover.png)"
                                });
                            },
                            function () {
                                $(this).css({
                                    backgroundImage: "url(images/leiste_geoeffnet_v2.png)"
                                });
                            });
                            panelContent.slideDown();

                        }
                        else {
                            panelCaption.hover(
                            function () {
                                $(this).css({
                                    backgroundImage: "url(images/leiste_geschlossen_v2_hover.png)"
                                });
                            },
                            function () {
                                $(this).css({
                                    backgroundImage: "url(images/leiste_geschlossen_v2.png)"
                                });
                            });
                            panelContent.slideUp();

                        }
                    }
                });
            }

            var context = this;
            var cboCountries = this.GetCboCountries();
            var cboRegions = this.GetCboRegions();
            var cboGetraenkeArt = this.GetCboGetraenkeArt();
            var cboRebsorten = this.GetCboRebsorten();
            var cboQuality = this.GetCboQuality();
            var cboAwards = this.GetCboAwards();
            var cboProducer = this.GetCboProducer();
            var cboYears = this.GetCboYears();
            var cboPriceFrom = this.GetCboPriceFrom();
            var cboPriceTo = this.GetCboPriceTo();
            var traderinfo = $("#traderinfopopup");
            var txtVineName = this.GetTxtBoxVineName();
            var btnSearchVinename = this.GetButtonVineName();
            var txtPrice = this.GetTxtBoxPrice();
            var btnReset = this.GetButtonReset();
            var suggestResult = this.GetSuggestResult();

            suggestResult.hide();

            if ($.browser.opera) {
                txtVineName.keypress(ProcessKey);
            }
            else {
                txtVineName.keydown(ProcessKey);
            }
            txtVineName.blur(function () {
                suggestResult.hide();
            });

            function ProcessKey(e) {
                if ((/27$|38$|40$/.test(e.keyCode) && suggestResult.is(':visible')) ||
					(/^13$|^9$/.test(e.keyCode) && GetCurrentSuggestion(context))) {

                    if (e.preventDefault) {
                        e.preventDefault();
                    }
                    if (e.stopPropagation) {
                        e.stopPropagation();
                    }

                    e.cancelBubble = true;
                    e.returnValue = false;

                    var keyCode = e.keyCode;
                    switch (keyCode) {
                        case 9: //tab
                        case 13: //enter
                            var currentResult = GetCurrentSuggestion(context);
                            if (currentResult) {
                                suggestResult.hide();
                                var serviceValues = new ServiceValues(context);
                                serviceValues.VineName = currentResult.text();
                                txtVineName.val(serviceValues.VineName);
                                CreateParametersAndPerformCallback("WeinService.svc/GetHaendlerData",
                                    AddHaendler,
                                    context,
                                    serviceValues);
                                serviceValues = null;
                            }
                            break;
                        case 27: //escape
                            suggestResult.hide();
                            break;
                        case 38: //up arrow
                            var currentResult = GetCurrentSuggestion(context);
                            if (currentResult) {
                                currentResult.removeClass("selected").prev().addClass("selected");
                            }
                            else {
                                var lstSuggestions = context.GetSuggestResult();
                                lstSuggestions.children('li:last-child').addClass("selected");
                            }
                            break;
                        case 40: //down arrow
                            var currentResult = GetCurrentSuggestion(context);
                            if (currentResult) {
                                currentResult.removeClass("selected").next().addClass("selected");
                            }
                            else {
                                var lstSuggestions = context.GetSuggestResult();
                                lstSuggestions.children("li:first-child").addClass("selected");
                            }
                            break;
                    }
                }
                else if (/^13$|^9$/.test(e.keyCode) && (!GetCurrentSuggestion(context))) {
                    if (e.preventDefault) {
                        e.preventDefault();
                    }
                    if (e.stopPropagation) {
                        e.stopPropagation();
                    }

                    e.cancelBubble = true;
                    e.returnValue = false;

                    var keyCode = e.keyCode;
                    switch (keyCode) {
                        case 9: //tab
                        case 13: //enter
                            suggestResult.hide();
                            var serviceValues = new ServiceValues(context);
                            CreateParametersAndPerformCallback("WeinService.svc/GetHaendlerData",
                                AddHaendler,
                                context,
                                serviceValues);
                            serviceValues = null;
                            break;
                    }
                }
                else {
                    setTimeout(function () {
                        LoadSuggestions(context)
                    }, 100);
                }
            }

            function LoadSuggestions(context) {
                var strSearchPhrase = context.GetTxtBoxVineName().val();
                if (strSearchPhrase.length > 2) {
                    PerformRestCallback("WeinService.svc/GetWeinnameForAutocomplete", { strSearchPhrase: strSearchPhrase }, AddSuggestions, context);
                }
                else {
                    var suggestResult = context.GetSuggestResult();
                    suggestResult.hide();
                }
            }

            if (cboGetraenkeArt) {
                cboGetraenkeArt.change(function () {
                    traderinfo.hide();
                    var serviceValues = new ServiceValues(context);
                    CreateParametersAndPerformCallback("WeinService.svc/GetHaendlerData",
                        AddHaendler,
                        context,
                        serviceValues);
                    serviceValues = null;
                });
            }
            if (cboCountries) {
                cboCountries.change(function () {
                    traderinfo.hide();
                    var serviceValues = new ServiceValues(context);
                    serviceValues.RegionId = -1;
                    CreateParametersAndPerformCallback("WeinService.svc/GetRegionsAndHaendlerData",
                        AddRegionsAndHaendler,
                        context,
                        serviceValues);
                    serviceValues = null;
                });
            }
            if (cboRegions) {
                cboRegions
                .attr({
                    disabled: "disabled"
                })
                .change(function () {
                    traderinfo.hide();
                    var serviceValues = new ServiceValues(context);
                    CreateParametersAndPerformCallback("WeinService.svc/GetHaendlerData",
                        AddHaendler,
                        context,
                        serviceValues);
                    serviceValues = null;
                });
            }
            if (cboRebsorten) {
                cboRebsorten.change(function () {
                    traderinfo.hide();
                    var serviceValues = new ServiceValues(context);
                    CreateParametersAndPerformCallback("WeinService.svc/GetHaendlerData",
                        AddHaendler,
                        context,
                        serviceValues);
                    serviceValues = null;
                });
            }
            if (cboQuality) {
                cboQuality.change(function () {
                    traderinfo.hide();
                    var serviceValues = new ServiceValues(context);
                    CreateParametersAndPerformCallback("WeinService.svc/GetHaendlerData",
                        AddHaendler,
                        context,
                        serviceValues);
                    serviceValues = null;
                });
            }
            if (cboAwards) {
                cboAwards.change(function () {
                    traderinfo.hide();
                    var serviceValues = new ServiceValues(context);
                    CreateParametersAndPerformCallback("WeinService.svc/GetHaendlerData",
                        AddHaendler,
                        context,
                        serviceValues);
                    serviceValues = null;
                });
            }
            if (cboProducer) {
                cboProducer.change(function () {
                    traderinfo.hide();
                    var serviceValues = new ServiceValues(context);
                    CreateParametersAndPerformCallback("WeinService.svc/GetHaendlerData",
                        AddHaendler,
                        context,
                        serviceValues);
                    serviceValues = null;
                });
            }
            if (cboYears) {
                cboYears.change(function () {
                    traderinfo.hide();
                    var serviceValues = new ServiceValues(context);
                    CreateParametersAndPerformCallback("WeinService.svc/GetHaendlerData",
                        AddHaendler,
                        context,
                        serviceValues);
                    serviceValues = null;
                });
            }
            if (cboPriceFrom) {
                cboPriceFrom.change(function () {
                    traderinfo.hide();
                    var serviceValues = new ServiceValues(context);
                    CreateParametersAndPerformCallback("WeinService.svc/GetHaendlerData",
                        AddHaendler,
                        context,
                        serviceValues);
                    serviceValues = null;
                });
            }
            if (cboPriceTo) {
                cboPriceTo.change(function () {
                    traderinfo.hide();
                    var serviceValues = new ServiceValues(context);
                    CreateParametersAndPerformCallback("WeinService.svc/GetHaendlerData",
                        AddHaendler,
                        context,
                        serviceValues);
                    serviceValues = null;
                });
            }
            if (btnSearchVinename) {
                btnSearchVinename.click(function (e) {
                    var serviceValues = new ServiceValues(context);
                    CreateParametersAndPerformCallback("WeinService.svc/GetHaendlerData",
                        AddHaendler,
                        context,
                        serviceValues);
                    serviceValues = null;
                });
            }
            if (btnReset) {
                btnReset.click(function (e) {
                    traderinfo.hide();
                    cboRegions.attr({
                        disabled: "disabled"
                    }).empty();
                    var serviceValues = new ServiceValues(context);
                    serviceValues.GetraenkeArtId = -1;
                    serviceValues.CountryId = -1;
                    serviceValues.RegionId = -1;
                    serviceValues.RebsorteId = -1;
                    serviceValues.QualityId = -1;
                    serviceValues.AwardId = -1;
                    serviceValues.PriceFromValue = -1;
                    serviceValues.PriceToValue = -1;
                    serviceValues.Year = "";
                    serviceValues.Producer = "";
                    serviceValues.VineName = "";
                    CreateParametersAndPerformCallback("WeinService.svc/GetHaendlerData",
                        ClearFilterResults,
                        context,
                        serviceValues);
                    serviceValues = null;
                });
            }
        }

        this.InitializeZooming = function () {
            var dragRectangle = $("#" + this.dragRectangleId);
            var parent = this.GetDragRectangleParent();
            var contentFiller = this.GetContentFiller();
            var traderinfo = $("#traderinfopopup");
            var mapControl = this.GetMapControl();
            var manager = this;
            mapControl.onzoom = function () {

                if (traderinfo.length > 0) {
                    var traderinfoParent = $(traderinfo).parent();
                    if (traderinfoParent.attr("id") == contentFiller.attr("id")) {
                        traderinfo.hide();
                    }
                };

                var zoomValue = mapControl.getZoom();
                var viewCenter = mapControl.getViewCenter();
                ResizeDragRectangle(dragRectangle, zoomValue, viewCenter);
                var strValues = "";
                $("#m_lstExhibitors input:checkbox:checked").each(function (i) {
                    strValues += $(this).val() + ";";
                });
                if (strValues) {
                    manager.ClearHighlightedShapes();
                    PerformCallback(mapControl, "HighlightExhibitors", strValues, oncallbackcomplete);
                }
            }
        };

        this.InitializePanning = function () {
            var dragRectangle = $("#" + this.dragRectangleId);
            var parent = this.GetDragRectangleParent();
            var mapControl = this.GetMapControl();
            var viewport = this.GetViewPort();
            var traderinfo = $("#traderinfopopup");
            var isPanning = false;

            mapControl.onpan = function () {
                var zoomValue = mapControl.getZoom();
                var viewCenter = mapControl.getViewCenter();

                var x = viewCenter.x;
                var y = viewCenter.y;

                x = x > 100 ? 100 : x;
                x = x < 0 ? 0 : x;
                y = y > 100 ? 100 : y;
                y = y < 0 ? 0 : y;

                var width = dragRectangle.outerWidth();
                var height = dragRectangle.outerHeight();
                var parentWidth = parent.width();
                var parentHeight = parent.height();

                var iLeft = (x / 100 * parentWidth) - (width / 2);
                if (iLeft + width > parentWidth) {
                    iLeft = parentWidth - width;
                }
                iLeft = iLeft < 0 ? 0 : iLeft;

                var iTop = (y / 100 * parentHeight) - (height / 2);
                if (iTop + height > parentHeight) {
                    iTop = parentHeight - height;
                }
                iTop = iTop < 0 ? 0 : iTop;

                dragRectangle.css({
                    left: iLeft,
                    top: iTop
                });

                //performs the cursor change while panning
                if (isPanning != true) {
                    isPanning = true;
                    traderinfo.hide();
                    $(viewport).css({
                        cursor: "url(images/grabbing.cur),auto"
                    })
                    .mouseup(function () {
                        $(viewport).css({
                            cursor: "default"
                        });
                        isPanning = false;
                    });
                }
            }
        };
        //Highlight the selected shapes
        this.HighlightShapes = function (data) {
            var result = eval("(" + data + ")");
            if (result != null) {
                var polygons = result.Polygons;
                if (polygons != null) {
                    var iPolygonAmount = polygons.length;
                    var contentFiller = this.GetContentFiller();
                    var mapControl = this.GetMapControl();
                    var viewport = this.GetViewPort();
                    var selectCurrentStand = this.SelectCurrentStand;
                    if (contentFiller != null) {
                        var contentFillerX = contentFiller.position().left;
                        var contentFillerY = contentFiller.position().top;
                        var contentFillerWidth = parseInt(contentFiller.width());
                        var contentFillerHeight = parseInt(contentFiller.height());

                        //creates the parent for dojo surface
                        var dojoSurfaceParent = this.CreateDojoSurfaceParent();
                        if (dojoSurfaceParent != null) {
                            //Append the parent for the dojo drawing to its parent
                            contentFiller.append(dojoSurfaceParent);
                            //Read the the id of the dojo parent element
                            var dojoSurfaceParentId = dojoSurfaceParent.attr("id");
                            //For firefox and safari
                            //Set the zIndex for following elements to an higher level
                            this.SetZIndexForMapControlElements(dojoSurfaceParent);
                            //Creates the dojo surface
                            var dojoSurface = dojox.gfx.createSurface(dojo.byId(dojoSurfaceParentId), contentFillerWidth, contentFillerHeight);
                            $.each(polygons, function (index, polygon) {

                                var point = polygon.Point;
                                if (point != null)
                                    var strCoordinates = "[";
                                var counter = point.length;
                                $.each(point, function (index, pointF) {
                                    var x = pointF.x;
                                    var y = pointF.y;
                                    if ((x != null) && (y != null)) {
                                        strCoordinates += "{ x: " + x + "," + " y: " + y + " }";
                                    }
                                    if (index < counter - 1) {
                                        strCoordinates += ",";
                                    }
                                });
                                strCoordinates += "]";
                                //Draws a polygon to the dojo surface
                                var shapeObject = dojoSurface.createPolyline(eval("" + strCoordinates + "")).setFill([123, 0, 59, 0.4]);
                                //Sets the shapes offset to the dojo object
                                shapeObject.setTransform({ dx: contentFillerX * -1, dy: contentFillerY * -1 });

                                if (iPolygonAmount == 1) {
                                    if (selectCurrentStand == true) {

                                        var point = polygons[0].Point;
                                        if (point) {
                                            var x1 = point[0].x;
                                            var x2 = point[0].x;
                                            var y1 = point[0].y;
                                            var y2 = point[0].y;
                                            $.each(point, function (index) {
                                                if (point[index].x > x2) {
                                                    x2 = point[index].x;
                                                }
                                                if (point[index].y > y2) {
                                                    y2 = point[index].y;
                                                }
                                            });

                                            var viewCenterX = x1 + ((x2 - x1) / 2);
                                            var viewCenterY = y1 + ((y2 - y1) / 2);

                                            var zoomValue = mapControl.getZoom();
                                            var contentWidth = viewport.width() * zoomValue / 100.0;
                                            var contentHeight = viewport.height() * zoomValue / 100.0;
                                            viewCenterX = viewCenterX - contentFillerX;
                                            viewCenterY = viewCenterY - contentFillerY;
                                            viewCenterX /= contentWidth / 100.0;
                                            viewCenterY /= contentHeight / 100.0;
                                            mapControl.setViewCenter(parseInt(viewCenterX), parseInt(viewCenterY));
                                        }
                                    }
                                }
                            });
                        }
                    }
                }
                result = null;
            }
        };
        //Creates a dhtml popup with the exhibitor imformations.
        this.PopUpTraderInformation = function (data, name) {
            var result = eval("(" + data + ")");
            if (result != null) {
                var contentFiller = this.GetContentFiller();
                var viewPort = this.GetViewPort();
                var getQuadrant = function (viewport, x, y) {
                    var iQuadrant = 0;
                    if (viewPort != null) {
                        var rectangle = new Rectangle();
                        //upper left
                        rectangle.X = 0;
                        rectangle.Y = 0;
                        rectangle.Width = viewPort.width() / 2;
                        rectangle.Height = viewPort.height() / 2;
                        if (rectangle.Contains(x, y) == true) {
                            return 1;
                        }
                        //upper right
                        rectangle.X += viewPort.width() / 2;
                        if (rectangle.Contains(x, y) == true) {
                            return 2;
                        }
                        //lower right;
                        rectangle.Y += viewPort.height() / 2;
                        if (rectangle.Contains(x, y) == true) {
                            return 3;
                        }
                        //lower left;
                        rectangle.X = 0;
                        if (rectangle.Contains(x, y) == true) {
                            return 4;
                        }
                    }
                    return iQuadrant;
                }

                var htmlContent = result.Html;
                var point = result.Point;
                if (point && htmlContent) {

                    var iX = 0
                    var iY = 0

                    var objX = point.x;
                    if (objX != null) {
                        iX = objX;
                    }
                    var objY = point.y;
                    if (objY != null) {
                        iY = objY;
                    }

                    var traderinfo = $("#traderinfopopup");
                    if (traderinfo != null) {
                        traderinfo.html(htmlContent);

                        if (name == "StandPopUp") {
                            var traderinfoParent = $(traderinfo).parent();
                            if (traderinfoParent.attr("id") != contentFiller.attr("id")) {
                                traderinfo.appendTo(contentFiller);
                            }

                            if (viewPort != null) {
                                var iQuadrant = getQuadrant(viewPort, iX, iY);
                                switch (iQuadrant) {
                                    case 2:
                                        iX -= traderinfo.width();
                                        break;
                                    case 3:
                                        iX -= traderinfo.width();
                                        iY -= traderinfo.height();
                                        break;
                                    case 4:
                                        iY -= traderinfo.height();
                                        break;
                                }
                            }
                            var iY1 = iY;
                            if (contentFiller != null) {
                                var position = contentFiller.position();
                                if (position != null) {
                                    iX += contentFiller.position().left * -1;
                                    iY += contentFiller.position().top * -1;
                                }
                            }
                        }
                        if (name == "ExhibitorPopUp") {
                            var traderinfoParent = $(traderinfo).parent();
                            if (traderinfoParent.attr("id") != "traderscontent") {
                                traderinfo.appendTo("#traderscontent");
                            }

                            var closeDiv = $("<div/>")
                                .css({
                                    position: "absolute",
                                    top: -10,
                                    left: traderinfo.width() - 20,
                                    width: 30,
                                    height: 30,
                                    backgroundImage: "url(images/close_button.png)",
                                    zIndex: 250
                                }).hover(
                                function () {
                                    $(this).css({
                                        backgroundPosition: "0px -30px"
                                    });
                                },
                                function () {
                                    $(this).css({
                                        backgroundPosition: "0px 0px"
                                    });
                                })
                                .click(function () {
                                    traderinfo.hide();
                                });
                            traderinfo.append(closeDiv);
                        }
                        traderinfo.css({
                            left: iX,
                            top: iY,
                            display: "block"
                        }).show();
                    }
                }
            }
        };

        function PerformCallback(mapControl, strCommand, strArguments, callback) {
            if (mapControl != null) {
                mapControl.doCallback(strCommand, strArguments);
                if (callback != null) {
                    mapControl.oncallbackcomplete = callback;
                }
            }
        };

        function CreateParametersAndPerformCallback(url, callback, context, serviceValues) {
            if (serviceValues) {
                PerformRestCallback(url,
                     {
                         iGetraenkeArtId: serviceValues.GetraenkeArtId,
                         iCountryId: serviceValues.CountryId,
                         iRegionId: serviceValues.RegionId,
                         iRebsorteId: serviceValues.RebsorteId,
                         iQualityId: serviceValues.QualityId,
                         iAwardId: serviceValues.AwardId,
                         iPriceFrom: serviceValues.PriceFromValue,
                         iPriceTo: serviceValues.PriceToValue,
                         strJahrgang: serviceValues.Year,
                         strProduzent: serviceValues.Producer,
                         strWeinname: serviceValues.VineName
                     },
                    callback,
                    context);
            }
        }

        function PerformRestCallback(url, data, callback, context) {

            $.ajax({
                type: "GET",
                url: url,
                data: data,
                context: context,
                contentType: "application/json; charset=utf-8",
                success: callback,
                error: function (data) {
                    alert("error");
                }
            });
        };

        function AddRegionsAndHaendler(data) {
            var lstTraders = $("#m_lstExhibitors").empty();
            var dropDownList = $("#cboRegion").empty();
            var arrResult = eval("(" + data + ")");
            var regionsAndHaendlerDataResult = arrResult.GetRegionsAndHaendlerDataResult;
            if (regionsAndHaendlerDataResult != null) {
                var regions = regionsAndHaendlerDataResult.Regions;
                if (regions != null) {
                    if (regions.length == 0) {
                        dropDownList.attr({
                            disabled: "disabled"
                        });
                    }
                    else {
                        dropDownList.attr({
                            disabled: ""
                        });
                        $.each(regions, function (index, region) {
                            if (region.RegionId == null) {
                                region.RegionId = "";
                            }
                            if (region.Regionname == null) {
                                region.Regionname = "";
                            }
                            var option = $("<option/>").val(region.RegionId).text(region.Regionname);
                            dropDownList.append(option);
                        });
                    }
                }
                var haendlerDataResult = regionsAndHaendlerDataResult.Haendler;
                if (haendlerDataResult != null) {
                    FillHaendlerData(this.context, lstTraders, haendlerDataResult);
                }
                regionsAndHaendlerDataResult = null;
            }
        };

        function AddHaendler(data) {
            var lstTraders = $("#m_lstExhibitors").empty();
            var arrResult = eval("(" + data + ")");
            var haendlerDataResult = arrResult.GetHaendlerDataResult;
            if (haendlerDataResult != null) {
                FillHaendlerData(this.context, lstTraders, haendlerDataResult);
                haendlerDataResult = null;
            }
        };

        function ClearFilterResults(data) {
            this.context.ClearHighlightedShapes();
            var divFilterResult = this.context.GetDivFilterResult();
            if (divFilterResult) {
                divFilterResult.hide();
            }
            var lstTraders = $("#m_lstExhibitors").empty();
            var arrResult = eval("(" + data + ")");
            var haendlerDataResult = arrResult.GetHaendlerDataResult;
            if (haendlerDataResult != null) {
                AppendHaendlerDataToParent(lstTraders, haendlerDataResult)
                this.context.BindExhibitorsCheckBoxClick();
                this.context.BindExhibitorsButtonClick();
            }
        }

        function FillHaendlerData(context, parentList, haendlerDataResult) {

            var filterResultAmount = haendlerDataResult.length;
            var spanFilterResultAmount = context.GetSpanFilterResultAmount();
            if (spanFilterResultAmount) {
                spanFilterResultAmount.text(filterResultAmount);
            }
            var divFilterResult = context.GetDivFilterResult();
            if (divFilterResult) {
                divFilterResult.show();
            }

            $.each(haendlerDataResult, function (index, haendlerData) {
                if (haendlerData.HaendlerId != -1) {
                    //creates the list item
                    var listItem = $("<li/>");
                    //creates the checkbox
                    var cboItem = $("<input type=\"checkbox\"/>").attr({
                        id: "chkExhibitor" + haendlerData.Stand,
                        checked: "checked"
                    }).val(haendlerData.Stand);
                    listItem.append(cboItem);
                    //creates the hidden field
                    var hiddenItem = $("<input type=\"hidden\"/>").attr({
                        id: "txtTrader" + haendlerData.HaendlerId
                    }).val(haendlerData.HaendlerId);
                    listItem.append(hiddenItem);
                    //creates the button
                    var buttonItem = $("<input type=\"button\"/>").val(haendlerData.Firma);
                    listItem.append(buttonItem);
                    //Append all items to the ul element
                    parentList.append(listItem);
                }
            });
            //
            var strValues = "";
            parentList.find("li input:checkbox:checked").each(function (i) {
                strValues += $(this).val() + ";";
            });
            if (strValues) {
                var mapControl = context.GetMapControl();
                if (mapControl != null) {
                    PerformCallback(mapControl, "HighlightExhibitors", strValues, oncallbackcomplete);
                }
            }
            else {
                context.ClearHighlightedShapes();
            }
            context.BindExhibitorsCheckBoxClick();
            context.BindExhibitorsButtonClick();
        };

        function AppendHaendlerDataToParent(parentList, haendlerDataResult) {
            if (haendlerDataResult != null) {
                $.each(haendlerDataResult, function (index, haendlerData) {
                    if (haendlerData.HaendlerId != -1) {
                        //creates the list item
                        var listItem = $("<li/>");
                        //creates the checkbox
                        var cboItem = $("<input type=\"checkbox\"/>").attr({
                            id: "chkExhibitor" + haendlerData.Stand
                        }).val(haendlerData.Stand);
                        listItem.append(cboItem);
                        //creates the hidden field
                        var hiddenItem = $("<input type=\"hidden\"/>").attr({
                            id: "txtTrader" + haendlerData.HaendlerId
                        }).val(haendlerData.HaendlerId);
                        listItem.append(hiddenItem);
                        //creates the button
                        var buttonItem = $("<input type=\"button\"/>").val(haendlerData.Firma);
                        listItem.append(buttonItem);
                        //Append all items to the ul element
                        parentList.append(listItem);
                    }
                });
            }
        }

        function AddSuggestions(data) {
            var context = this.context;
            var lstSuggestions = this.context.GetSuggestResult().empty();
            var arrResult = eval("(" + data + ")");
            var autoCompleteresult = arrResult.GetWeinnameForAutocompleteResult;
            if (autoCompleteresult != null) {

                if (!autoCompleteresult.length) {
                    lstSuggestions.hide();
                    return;
                }

                var parent = lstSuggestions.parent();
                var txtVineName = parent.find(":input");

                $.each(autoCompleteresult, function (index, suggestion) {
                    var listItem = $("<li/>").text(suggestion);
                    lstSuggestions.append(listItem);
                });

                lstSuggestions
                .css({
                    left: parent.position().left,
                    top: txtVineName.position().top + txtVineName.height() + 2 * parseInt(txtVineName.css("border-width"))
                })
                .show();

                lstSuggestions
                .children("li").mouseover(function () {
                    lstSuggestions.children('li').removeClass("selected");
                    $(this).addClass("selected");
                })
                .mousedown(function (e) {
                    var currentResult = GetCurrentSuggestion(context);
                    if (currentResult) {
                        var serviceValues = new ServiceValues(context);
                        serviceValues.VineName = currentResult.text();
                        txtVineName.val(serviceValues.VineName);
                        lstSuggestions.hide();
                        CreateParametersAndPerformCallback("WeinService.svc/GetHaendlerData",
                            AddHaendler,
                            context,
                            serviceValues);
                        serviceValues = null;
                        return false;
                    }
                });
                autoCompleteresult = null;
            }
        }
        //Gets the selected suggestion from the suggestions list
        function GetCurrentSuggestion(context) {
            var lstSuggestions = context.GetSuggestResult();

            if (lstSuggestions.is(":visible") == false) {
                return false;
            }

            var currentResult = lstSuggestions.children("li.selected");
            if (currentResult.length == false) {
                currentResult = false;
            }
            return currentResult;
        }
        //Select the stand for the Trader
        //binds the checkbox click event for the trader selection.
        this.BindExhibitorsCheckBoxClick = function () {
            var mapControl = this.GetMapControl();
            $("#m_lstExhibitors input:checkbox").each(function (i) {
                $(this).click(function (e) {
                    var strValues = "";
                    $("#m_lstExhibitors input:checkbox:checked").each(function (i) {
                        strValues += $(this).val() + ";";
                    });
                    PerformCallback(mapControl, "HighlightExhibitors", strValues, oncallbackcomplete);
                });
            });
        };
        //Trader buttons
        //binds the click event for the trader buttons.
        this.BindExhibitorsButtonClick = function () {
            var mapControl = this.GetMapControl();
            $("#m_lstExhibitors input:button").each(function (i) {
                $(this).click(function (e) {
                    var layerX = e.pageX;
                    var layerY = e.pageY;
                    var iTraderId = $(this).parent().find("input:hidden").val();
                    if (parseInt(iTraderId) != null) {
                        PerformCallback(mapControl, "SelectExhibitor", layerX + "," + layerY + "," + iTraderId, oncallbackcomplete);
                    }
                });
            });
        };

        function ResizeDragRectangle(dragRectangle, zoomValue, viewCenter) {
            var parent = dragRectangle.parent();
            var x = viewCenter.x;
            var y = viewCenter.y;

            //if display: none, the jquery result of border-width is allways 0. Getting the borderTopWidth with javascript results in correct values.
            var borderWidth = 0;
            var tmpDragRectangle = document.getElementById(dragRectangle.attr("id"));
            if (tmpDragRectangle != null) {
                borderWidth = parseInt(tmpDragRectangle.style.borderTopWidth);
            }
            if (isNaN(borderWidth)) {
                borderWidth = 0;
            }

            x = x > 100 ? 100 : x;
            x = x < 0 ? 0 : x;
            y = y > 100 ? 100 : y;
            y = y < 0 ? 0 : y;

            var parentWidth = parent.width();
            var parentHeight = parent.height();
            var width = parseInt((parentWidth / zoomValue * 100));
            var height = width;
            var iLeft = parseInt((x / 100 * parentWidth) - (width / 2));
            if (iLeft + width + (2 * borderWidth) > parentWidth) {
                iLeft = parentWidth - width - (2 * borderWidth);
            }
            iLeft = iLeft < 0 ? 0 : iLeft;

            var iTop = (y / 100 * parentHeight) - (height / 2);
            if (iTop + height + (2 * borderWidth) > parentHeight) {
                iTop = parentHeight - height - 2 * borderWidth;
            }
            iTop = iTop < 0 ? 0 : iTop;

            dragRectangle.css({
                top: iTop,
                left: iLeft,
                height: height,
                width: width
            });
        };

        //Removes all the dojo objects from its parent
        this.ClearHighlightedShapes = function () {
            //removes all the dojo objects from its parent.
            $("#" + this.dojoSurfaceId).children().each(function (i) {
                if ($(this).attr("id") != "traderinfopopup") {
                    $(this).remove();
                }
            });
        };

        this.GetSuggestResult = function () {
            var suggestId = "suggestResult";

            var suggestResult = $("#" + suggestId);
            if (suggestResult.length > 0) {
                return suggestResult;
            }
            var parent = $("#vinenamewrapper");
            var txtBox = parent.find(":input");
            suggestResult = $("<ul/>").attr({
                id: suggestId
            }).css({
                left: parent.position().left,
                top: txtBox.position().top + txtBox.height() + 2 * parseInt(txtBox.css("border-width"))
            });
            parent.append(suggestResult);
            return suggestResult;
        };
        //Creates the dojo surface parent and the appended div element for the traders information.
        this.CreateDojoSurfaceParent = function () {

            this.ClearHighlightedShapes();

            var dojoSurfaceParent = null;
            var dojoSurface = $("#" + this.dojoSurfaceId);
            //if there is an element...
            if (dojoSurface.length != 0) {
                dojoSurfaceParent = dojoSurface;
            }
            else {
                //otherwise create the element
                dojoSurfaceParent = $("<div/>").attr({
                    id: this.dojoSurfaceId
                }).css({
                    position: "absolute",
                    top: 0,
                    left: 0,
                    zIndex: 1
                });
            }
            return dojoSurfaceParent;
        };
        this.SelectCurrentStand = function (value) {
            this.selectCurrentStand = value;
        };
        //Increase the z-index value for some div elements. In Firefox and Safari the temp div element is positioned on top of the
        //navigation panel or zoom panel.
        this.SetZIndexForMapControlElements = function (indexedObject) {
            if ($.browser.msie == true) {
                var browserVersion = parseFloat($.browser.version);
                //IE8 reacts like all the other browsers
                if (browserVersion < 8) {
                    return;
                }
            }
            if (indexedObject != null) {
                var mapControlId = this.MapControlId;
                var newZIndex = indexedObject.css("zIndex") + 1;
                var navigationPanelDiv = document.getElementById(this.MapControlId + this.navigationPanelDivIdPart);
                var navigationPanelShadow = document.getElementById(this.MapControlId + this.navigationPanelShadowIdPart);
                var zoomPanelDiv = document.getElementById(this.MapControlId + this.zoomPanelDivIdPart);
                var zoomPanelShadow = document.getElementById(this.MapControlId + this.zoomPanelShadowIdPart);

                var elements = [$(navigationPanelDiv), $(navigationPanelShadow), $(zoomPanelDiv), $(zoomPanelShadow)];
                $.each(elements, function (i) {
                    $(this).css({
                        zIndex: newZIndex
                    });
                });
            }
        };
        //Gets a string from the string array
        this.GetStringFromResource = function (strKey) {
            var strResourceValue = "";
            if (this.StringResources) {
                $.each(this.StringResources, function (index, keyValue) {
                    if (keyValue.Key == strKey) {
                        strResourceValue = keyValue.Value;
                        return false;
                    }
                });
            }
            return strResourceValue;
        };
        //An object with the values from the filter form
        ServiceValues = function (context) {
            this.GetraenkeArtId = -1;
            this.CountryId = -1;
            this.RegionId = -1;
            this.RebsorteId = -1;
            this.QualityId = -1;
            this.VineName = "";
            this.PriceFromValue = -1;
            this.PriceToValue = -1;
            this.Year = "";
            this.Producer = "";
            this.AwardId = -1;

            var cboGetraenkeArt = context.GetCboGetraenkeArt();
            if (cboGetraenkeArt) {
                if (isNaN(parseInt(cboGetraenkeArt.val())) == false) {
                    this.GetraenkeArtId = cboGetraenkeArt.val();
                }
            }
            var cboCountries = context.GetCboCountries();
            if (cboCountries) {
                if (isNaN(parseInt(cboCountries.val())) == false) {
                    this.CountryId = cboCountries.val();
                }
            }
            var cboRegions = context.GetCboRegions();
            if (cboRegions) {
                if (isNaN(parseInt(cboRegions.val())) == false) {
                    this.RegionId = cboRegions.val();
                }
            }
            var cboRebsorten = context.GetCboRebsorten();
            if (cboRebsorten) {
                if (isNaN(parseInt(cboRebsorten.val())) == false) {
                    this.RebsorteId = cboRebsorten.val();
                }
            }
            var cboQuality = context.GetCboQuality();
            if (cboQuality) {
                if (isNaN(parseInt(cboQuality.val())) == false) {
                    this.QualityId = cboQuality.val();
                }
            }
            var cboAwards = context.GetCboAwards();
            if (cboAwards) {
                if (isNaN(parseInt(cboAwards.val())) == false) {
                    this.AwardId = cboAwards.val();
                }
            }
            var cboProducer = context.GetCboProducer();
            if (cboProducer) {
                if (cboProducer.val().length > 0) {
                    this.Producer = $.trim(cboProducer.val());
                }
            }
            var cboYears = context.GetCboYears();
            if (cboYears) {
                if (cboYears.val().length > 0) {
                    this.Year = $.trim(cboYears.val());
                }
            }
            var txtVineName = context.GetTxtBoxVineName();
            if (txtVineName) {
                if (txtVineName.val().length > 0) {
                    this.VineName = $.trim(txtVineName.val());
                }
            }
            var cboPriceFrom = context.GetCboPriceFrom();
            var cboPriceTo = context.GetCboPriceTo();
            if ((cboPriceFrom) && (cboPriceTo)) {
                if (isNaN(parseInt(cboPriceFrom.val())) == false) {
                    this.PriceFromValue = parseInt(cboPriceFrom.val());
                }
                if (isNaN(parseInt(cboPriceTo.val())) == false) {
                    this.PriceToValue = parseInt(cboPriceTo.val());
                }
            }
        };
        function Rectangle() {
            this.X = 0;
            this.Y = 0;
            this.Width = 0;
            this.Height = 0;
            this.Contains = Contains;

            function Contains(x, y) {
                if ((isNaN(x) == false) && (isNaN(y) == false)) {
                    return ((this.X <= x) && (x <= (this.X + this.Width)) && (this.Y <= y) && (y <= (this.Y + this.Height)));
                }
                return false;
            }
        };
        //Gets the mapcontrols contentfiller jquery object
        this.GetContentFiller = function () {
            if (this.m_contentFiller == null) {
                var contentFillerObj = document.getElementById(this.MapControlId + this.contentFillerIdPart);
                if (contentFillerObj != null) {
                    this.m_contentFiller = $(contentFillerObj);
                }
            }
            return this.m_contentFiller;
        };
        //Gets the mapcontrols viewport jquery object
        this.GetViewPort = function () {
            var viewPort = null;
            viewPort = document.getElementById(this.MapControlId + this.viewPortIdPart);
            if (viewPort != null) {
                viewPort = $(viewPort);
            }
            return viewPort;
        };
        //Gets the Dundas MapControl
        this.GetMapControl = function () {
            return document.getElementById(this.MapControlId);
        };
        //Gets the overview Dundas MapControl
        this.HallOverviewMapControl = function () {
            return document.getElementById(this.HallOverviewMapControlId);
        };
        //Gets the drag rectangle's parent
        this.GetDragRectangleParent = function () {
            return $(this.DragRectangleParent);
        };
        //Gets the filterarea element
        this.GetFilterArea = function () {
            var filterArea = null;
            filterArea = document.getElementById(this.filterAreaId);
            if (filterArea != null) {
                filterArea = $(filterArea);
            }
            return filterArea;
        };
        //Gets the filterpanel element
        this.GetFilterPanel = function () {
            var filterPanel = null;
            filterPanel = document.getElementById(this.filterPanelId);
            if (filterPanel != null) {
                filterPanel = $(filterPanel);
            }
            return filterPanel;
        };
        //Gets the filterpanel's contentheader element
        this.GetFilterPanelContentHeader = function () {
            var filterPanelContentHeader = null;
            filterPanelContentHeader = document.getElementById(this.filterPanelContentHeaderId);
            if (filterPanelContentHeader != null) {
                filterPanelContentHeader = $(filterPanelContentHeader);
            }
            return filterPanelContentHeader;
        };
        //Gets the dropdownlist for the getraenkeart
        this.GetCboGetraenkeArt = function () {
            var cboGetraenkeArt = null;
            cboGetraenkeArt = document.getElementById(this.CboGetraenkeArtId);
            if (cboGetraenkeArt != null) {
                cboGetraenkeArt = $(cboGetraenkeArt);
            }
            return cboGetraenkeArt;
        };
        //Gets the dropdownlist for the countries
        this.GetCboCountries = function () {
            var cboCountries = null;
            cboCountries = document.getElementById(this.CboCountriesId);
            if (cboCountries != null) {
                cboCountries = $(cboCountries);
            }
            return cboCountries;
        };
        //Gets the dropdownlist for the regions related the a country
        this.GetCboRegions = function () {
            var cboRegions = null;
            cboRegions = document.getElementById(this.cboRegionsId);
            if (cboRegions != null) {
                cboRegions = $(cboRegions);
            }
            return cboRegions;
        };
        //Gets the dropdownlist for the auszeichnungen
        this.GetCboAwards = function () {
            var cboAwards = null;
            cboAwards = document.getElementById(this.CboAwardId);
            if (cboAwards != null) {
                cboAwards = $(cboAwards);
            }
            return cboAwards;
        };
        //Gets the dropdownlist for the auszeichnungen
        this.GetTxtBoxVineName = function () {
            var txtVinename = null;
            txtVinename = document.getElementById(this.txtVinenameId);
            if (txtVinename != null) {
                txtVinename = $(txtVinename);
            }
            return txtVinename;
        };
        this.GetButtonVineName = function () {
            var btnSearchVineName = null;
            btnSearchVineName = document.getElementById(this.btnSearchVineName);
            if (btnSearchVineName != null) {
                btnSearchVineName = $(btnSearchVineName);
            }
            return btnSearchVineName;
        };
        this.GetButtonReset = function () {
            var btnReset = null;
            btnReset = document.getElementById(this.btnReset);
            if (btnReset != null) {
                btnReset = $(btnReset);
            }
            return btnReset;
        };
        this.GetTxtBoxPrice = function () {
            var txtPrice = null;
            txtPrice = document.getElementById(this.txtPriceId);
            if (txtPrice != null) {
                txtPrice = $(txtPrice);
            }
            return txtPrice;
        };
        this.GetCboRebsorten = function () {
            var cboRebsorten = null;
            cboRebsorten = document.getElementById(this.CboRebsorteId);
            if (cboRebsorten != null) {
                cboRebsorten = $(cboRebsorten);
            }
            return cboRebsorten;
        };
        this.GetCboQuality = function () {
            var cboQuality = null;
            cboQuality = document.getElementById(this.CboQualityId);
            if (cboQuality != null) {
                cboQuality = $(cboQuality);
            }
            return cboQuality;
        };
        this.GetCboProducer = function () {
            var cboProducer = null;
            cboProducer = document.getElementById(this.CboProducerId);
            if (cboProducer != null) {
                cboProducer = $(cboProducer);
            }
            return cboProducer;
        };
        this.GetCboYears = function () {
            var cboYears = null;
            cboYears = document.getElementById(this.CboYearsId);
            if (cboYears != null) {
                cboYears = $(cboYears);
            }
            return cboYears;
        };
        this.GetCboPriceFrom = function () {
            var cboPriceFrom = null;
            cboPriceFrom = document.getElementById(this.CboPriceFromId);
            if (cboPriceFrom != null) {
                cboPriceFrom = $(cboPriceFrom);
            }
            return cboPriceFrom;
        };
        this.GetCboPriceTo = function () {
            var cboPriceTo = null;
            cboPriceTo = document.getElementById(this.CboPriceToId);
            if (cboPriceTo != null) {
                cboPriceTo = $(cboPriceTo);
            }
            return cboPriceTo;
        };
        this.GetDivFilterResult = function () {
            var divFilterResult = null;
            divFilterResult = document.getElementById(this.filterResultId);
            if (divFilterResult != null) {
                divFilterResult = $(divFilterResult);
            }
            return divFilterResult;
        };
        this.GetSpanFilterResultAmount = function () {
            var spanFilterResultAmount = null;
            spanFilterResultAmount = document.getElementById(this.filterResultAmountId);
            if (spanFilterResultAmount != null) {
                spanFilterResultAmount = $(spanFilterResultAmount);
            }
            return spanFilterResultAmount;
        };
    }
}
