﻿function GISP_Report(pOptions) {
    var me = this;
    this._UniqueID = GISPlanning_MapUtilities_GUID();
    this._Type = '';
    this._ID = '';
    this._SubReports = {};
    this._Content = document.createElement("div");
    this._Overlays = {};
    this._Bounds = null;
    this._ZoomModifier = 0;
    this._Parameters = {};
    this._Properties = {};


    this._ZoomBounds = function(pBounds, pZoomModifer) {
        if (pBounds != null) {
            me._Bounds = pBounds;
        } //end if bounds were passed as paramater
        if (pZoomModifer != null) {
            me._ZoomModifier = pZoomModifer;
        } //end if bounds were passed as paramater
        if (me._Bounds != null) {
            map.fitBounds(me._Bounds);
        } //end if bounds not null
    };  //end function

    this._SetBounds = function(pBounds) {
        me._Bounds = pBounds;
    };
    this._GetBounds = function() {
        return me._Bounds;
    };

    //Load options
    var myOptions = { Name: "", Icon: null, Parameters: null, Description: "", DisplayImageURL: "" };
    for (var o in myOptions) {
        if (typeof (pOptions[o]) != "undefined") {
            me['_' + o] = pOptions[o];
        } //end if option was passed in
    } //end for each option





    this._Dispose = function() {
        me._Bounds = null;
        me._Content = null;

        //null each overlay
        for (var o in me._Overlays) {
            if (me._Overlays[o].ClickEventHandler != undefined) {
                google.maps.event.removeListener(me._Overlays[o].ClickEventHandler);
            }
            me._Overlays[o] = null;
        } //end for each overlay
        me._Overlays = 0;

        //null each property
        for (var o in me._Properties) {

            me._Properties[o] = null;
        } //end for each overlay
        me._Properties = null;

        //null each parameter
        for (var o in me._Parameters) {
            me._Parameters[o] = null;
        } //end for each overlay
        me._Parameters = null;

        if (me.TabCollection != undefined) {
            me.TabCollection.Dispose();
        }
        me.TabCollection = null;


        me.ModifyFunction = null;
        me.SaveFunction = null;
        me.ResetFunction = null;
        me.ShowParametersFunction = null;
        me.ReloadFunction = null;

        me = null;
    };             //end method




    return new function() {
        this.UniqueID = me._UniqueID;
        this.ID = me._ID;
        this.Type = me._Type;
        this.Content = me._Content;
        this.Name = me._Name;
        this.Icon = me._Icon;
        this.Description = me._Description;
        this.DisplayImageURL = me._DisplayImageURL;
        this.Parameters = me._Parameters;
        this.Properties = me._Properties;
        this.Overlays = me._Overlays;
        this.SubReports = me._SubReports;
        this.SetBounds = me._SetBounds;
        this.GetBounds = me._GetBounds;
        this.ZoomBounds = me._ZoomBounds;
        this.Dispose = me._Dispose;
        //function
        this.ModifyFunction = null;
        this.SaveFunction = null;
        this.ResetFunction = null;
        this.ShowParametersFunction = null;
        this.ReloadFunction = null;
        
    };                  //end constructor
}
