/**
 * Base class, extended by specialised JS objects that may or may not be included
 * 
 * Namespace "Base"
 * @class Base
 * @desc Base class of this project
 */
var Base = function($) {
	var arr_init = []; // Array containing all registered init-functions of subclasses
	
	/**
	 * Check and execute registered subclass functions
	 */
	function check_register() {
		for (var i=0; i<arr_init.length; i++) {
			arr_init[i]();
		}
	}
	
  
  /**
   * Checks IE version. This requires a line of JS in the <head> tags within
   * IE conditional statements similar to the one below. If not given,
   * Base.ieVersion stays null.
   * 
   * document.getElementsByTagName("html")[0].className += (" ie6");
   */
  function check_ie(){
    if( $ ){
      if(! window.XMLHttpRequest )
        Base.ieVersion = 6;
      
      if( $('html.ie7').length > 0 )
        Base.ieVersion = 7;
      
      if( $('html.ie8').length > 0 )
        Base.ieVersion = 8;
    }
  }
	
	return {
		paths : {}, // used to store system paths
		
		/**
		* Register (initialization) calls from subclasses
		* @param (obj_function) Function to initialize subclass
		*/
		register: function(obj_function) {
			arr_init.push(obj_function);
		},
		
		/**
		* Initialize this class
		*/
		init: function() {
      check_ie();
			
			check_register();
		}
	}
}(jQuery);

jQuery(document).ready(function(){
	Base.init();
});