/**
 * class to get information about user
 * @class UserData
 * @author Janusz Rygal
 * @date 21.07.2008
 */
function UserData(){
	  
	  /**browser name*/
	  var browserName;
	  /**browser version*/
	  var browserVersion;
	  /**browser code name*/
	  var browserCodeName;
	  /**user platform*/
	  var platform;
	  /**is cookie enable*/
	  var cookieEnable;
	  /**is java enable*/
	  var javaEnable;
	  /**browser language*/
	  var browserLang;
	  /**user language*/
	  var userLang;
	  /**user profile*/
	  var userProfile;
	  /**the cpu class*/
	  var cpuClass;
	  /**full address*/
	  var fullAddress;
	  /**ip*/
	  var ip;
	  /**screen width*/
	  var screenWidth;
	  /**screen height*/
	  var screenHeight;
	  
	  
	  /**
	   * method to get the kind of the browser
	   * @return name and version of the user browser
	   */
	   this.getInfo = function(){
	   		var info = '';
	   		
	   		info += 'Browser Name       --------------- ' + this.getBrowserName() + '\n';  
	   		info += 'Browser Version    --------------- ' + this.getBrowserVersion() + '\n';  
	   		info += 'Browser Code Name  --------------- ' + this.getBrowserCodeName() + '\n';  
	   		info += 'Platform           --------------- ' + this.getPlatform() + '\n';  
	   		info += 'Is cookie enable   --------------- ' + this.isCookieEnable() + '\n';  
	   		info += 'Is java enable     --------------- ' + this.isJavaEnable() + '\n';  
	   		info += 'Browser language   --------------- ' + this.getBrowserLang() + '\n';  
	   		info += 'User language      --------------- ' + this.getUserLang() + '\n';  
	   		info += 'User profile       --------------- ' + this.getUserProfile() + '\n';  
	   		info += 'CPU class          --------------- ' + this.getCpuClass() + '\n';  
	   		info += 'Full address       --------------- ' + this.getFullAddress() + '\n'; 
	   		info += 'IP          		--------------- ' + this.getIp() + '\n'; 
	   		info += 'Screen width       --------------- ' + this.getScreenWidth() + '\n'; 
	   		info += 'Screen height      --------------- ' + this.getScreenHeight() + '\n';    	
	   		return info;
	   }
	  
	  /**
	   * method to get the browser name
	   * @return the browser name
	   */
	   this.getBrowserName = function(){
	   		return this.browserName;
	   }
	   
	  /**
	   * method to get the browser version
	   * @return the browser version
	   */
	   this.getBrowserVersion = function(){
	   		return this.browserVersion;
	   }
	  
	   /**
	    * method to get the browser code name
	    * @return the browser code name
	    */
	    this.getBrowserCodeName = function(){
	    	return this.codeName;
	    }
	    
	   /**
	    * method to get the user platform
	    * @return the platform name
	    */
	    this.getPlatform = function(){
	    	return this.platform;
	    }
	    
	   /**
	    * is cookie enable or not
	    * @return boolean
	    */
	    this.isCookieEnable = function(){
	    	return this.cookieEnable;
	    }
	    
	   /**
	    * is java enable or not
	    * @return boolean
	    */ 
	    this.isJavaEnable  = function(){
	    	return this.javaEnable;
	    } 
	    
	    /**
	     * method to check is the explorer browser or not
	     * @return if explorer the true else false
	     */
	     this.isExplorer  = function(){
	     		if (navigator.userAgent.indexOf('MSIE') !=-1)
	     			return true;
	            return false;
	     }
	     
	     /**
	      * get the browser language
	      * @return the browser language
	      */
	     this.getBrowserLang = function(){
	     	return this.browserLang;
	     } 
	     
	     /**
	      * get the user language
	      * @return the user language
	      */
	      this.getUserLang = function(){
	      	return this.userLang;
	      }
	      
	     /**
	      * method to get the user profile
	      * @return the user profile
	      */ 
	      this.getUserProfile = function(){
	      	return this.userProfile;
	      }
	      
	     /**
	      * method to get the cpu class
	      * @return the cpu class
	      */ 
	      this.getCpuClass = function(){
	      	return this.cpuClass;	
	      }
	      
	      /**
	       * get domain and ip
	       * @return get domain and ip
	       */
	       this.getFullAddress = function(){
	       	 return this.fullAddress;	
	       }
	       
	       /**
	        * get ip address
	        * @return ip address
	        */
	        this.getIp = function(){
	          return this.ip;	
	        }
	    
	       /**
	        * function to get the screen width
	        * @return screen width
	        */	
	        this.getScreenWidth = function(){
	        	return this.screenWidth;
	        }
	        
	       /**
	        * function to get the screen height
	        * @return screen height
	        */ 
	        this.getScreenHeight = function(){
	        	return this.screenHeight;
	        }
	    	
	  
		  /**
		   * init function
		   */
		  this.init = function(){
		  		
		  		this.browserName     = navigator.appName;
		  		this.browserVersion  = parseFloat(navigator.appVersion);
		  		this.browserCodeName = navigator.appCodeName;
		  		this.platform        = navigator.platform;
		  		this.cookieEnable    = navigator.cookieEnabled;
		  		this.javaEnable      = navigator.javaEnabled();
		  		
		  		if(this.isExplorer()){
		  		  this.browserLang     = navigator.browserLanguage;
		  		  this.userLang        = navigator.userLanguage;
		  		}
		  		else{
		  		  this.browserLang     = navigator.language;
		  		  this.userLang        = navigator.language;	
		  		} 
		  		
		  		this.userProfile     = navigator.userProfile;
		  		this.cpuClass        = navigator.cpuClass;
		  
		  		/*
			  	var ip = new java.net.InetAddress.getLocalHost();
				this.fullAddress = new java.lang.String(ip);
				this.ip          = this.fullAddress.substring(this.fullAddress.indexOf("/")+1);	
				*/
				
				
				this.screenWidth  = screen.width;
				this.screenHeight = screen.height; 
		  }
	  
}
