
ClientData = function(){

      this.previousScreenWidth  = null;
      this.previousScreenHeight = null;
      
      this.getScreenWidth = function(){
          return Ext.getBody().getWidth();
      }

      this.getScreenHeight = function(){
          return Ext.getBody().getHeight();
      }

      this.saveScreenData = function(){
          var screenDataStore    = 	 new Ext.data.JsonStore({
    									    url: project_url + 'SaveScreenData',
									        fields: ['width','height'],
									        root:'resolution',
                                            method: 'GET',
									        autoLoad:false
									     });
            screenDataStore.on('load', function(){

                context.clientData.previousScreenWidth  = screenDataStore.getAt(0).get('width');
                context.clientData.previousScreenHeight = screenDataStore.getAt(0).get('height');

                if((context.clientData.previousScreenWidth == null) ||
                   (context.clientData.previousScreenHeight == null)){
                    return;
                }

                if((context.clientData.previousScreenWidth != context.clientData.getScreenWidth() ) ||
                   (context.clientData.previousScreenHeight != context.clientData.getScreenHeight() )){
                   context.menu.refactorIcons();
                }
            }, screenDataStore);

            screenDataStore.load({
                params: {
                    width:  context.clientData.getScreenWidth(),
                    height: context.clientData.getScreenHeight()
                }
            });

            

      }



      this.saveClientData = function(){

          var url = project_url + 'SaveClientData';
              url += '?app_code_name='+navigator.appCodeName;
              url += '&app_name='+navigator.appName;
              url += '&app_version='+navigator.appVersion;
              url += '&user_agent='+navigator.userAgent;
              url += '&platform='+navigator.platform;
              url += '&screen_width='+context.clientData.getScreenWidth();
              url += '&screen_height='+context.clientData.getScreenHeight();

          conn = new Ext.data.Connection({
								url:  url
							});
		   conn.request({
							method: 'GET',
							success: function(responseObject) {
							    		 },
							failure: function() {
							     		 }
			});
      }

}


