function Globals() {
    this.siteUrl = '/cgi-perl/system/grid.mpl';
    this.c2Url = '/cgi-perl/';
    this.systemsUrl = this.c2Url + 'systems.mpl';
    this.graphSourceUrl = this.c2Url + 'dashcharts.mpl';
    this.risImgSourceUrl = this.c2Url + 'xcharts200.mpl?want=horiz&width=60&pictype=rs&;';
    this.popularityImgSourceUrl = this.c2Url + 'xcharts200.mpl?want=horiz&width=80&systemid=$sid&pictype=gc';

    this.baseUrl = function() { return this.siteUrl + "?rm=ajax_get_data&who=get"; },

	this.random = function() {
	    return "&" + Math.random();
	},

   this.getBase = function(callBack, want) {
       return this.baseUrl() + this.random() + "&callback=" + callBack + "&want=" + want;
   },

   this.getGridListUrl = function() {
       return this.getBase("gridController.getGridListAjax", "getGridList");
   },

   this.getGridUrl = function(gridId) {
       return this.getBase("gridController.createGridAjax", "gridDescr") + "&gridId=" + gridId;
   },

   this.getBackfireGridUrl = function(backFire) {
       var url = this.getBase("gridController.createGridAjax", "gridDescr")
       + "&filter=1"
       + "&gridId=" + backFire.gridId
       + "&column=" + backFire.filter.column
       + "&relation=" + backFire.filter.relation
       + "&value=" + backFire.filter.value;
       return url;
   },

   this.getDataUrl = function(buttonsStateUrlString) {
       return this.siteUrl + "?rm=ajax_get_data&want=data&who=yuiDatasource&callback=gridController.newData" + this.random();
   },

   this.getInstrumentsDataUrl = function(buttonsStateUrlString) {
       return this.getBase("gridController.newData", "instrument") + "&" + buttonsStateUrlString;
   },

   this.getPageStateUrl = function(gridId) {
       return this.getBase("gridController.createGridFromStateAjax", "getstate");
   },

   this.getSaveGridUrl = function(gridDefinitionData) {
       return this.getBase("gridController.saveGridAjax", "saveGrid") + "&" + gridDefinitionData;
   },

   this.getDeleteGridUrl = function() {
       return this.getBase("gridController.deleteGridAjax", "deleteGrid");
   },

   this.getSearchDataUrl = function(columnKey, relation, value) {
       var encodedValue = encodeURIComponent(value);
       return this.getBase("gridController.searchGridAjax", "search") + "&column=" + columnKey + "&relation=" + relation + "&value=" + encodedValue;
   }

   this.getSetStateUrl = function(gridDefinitionData) {
   return this.getBase("gridController.saveStateAjax", "saveState") + "&" + gridDefinitionData;
   },

   this.getNullUrl = function() {
	   return this.getBase("gridController.null", "null");
   },

   /* ---------------- */
    this.INSTRUMET_SELECTOR = 'is';
    this.GRIDS_MENU = 'gm';
    this.GRIDS_MENU_ITEM = 'gmi';
    this.GRID_CONTROLLER = 'gc';
    this.SEARCH_BY_NAME = 'sbn';
    this.SORT_GRID = 'sg';
    this.DELETE_GRID_BUTTON = 'id_deleteGrid_Button';
    this.SAVE_GRID_BUTTON = 'saveGrid_Button';
    this.SEARCH_BY_NAME = 'searchByNameInputField';
    this.DATA_TABLE_CONTAINER = "dataTableContainer"; //This is a real div id! Do not change here!
    this.WAIT_FOR_DATA_CLASS_NAME = "waitClass"; //See grid.css! Do not change here!
}

var globals = new Globals();
