/**
 * 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() {
	// VARIABLES DEFINED HERE ARE PRIVATE
	var arr_init = []; // Array containing all registered init-functions of subclasses
	
	// FUNCTIONS DEFINED HERE ARE PRIVATE
	
	/**
	 * 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 { // Public area
		// VARIABLES DEFINED HERE ARE PUBLIC
		ie6	: ($.browser.msie && ( parseInt($.browser.version)==6 ) ) ? true : false,
		
		// FUNCTIONS DEFINED HERE ARE PUBLIC
		
		/**
		* 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();
			
			swfobject.embedSWF("/dut/images/main.swf", "content", "940", "390", "9.0.0", '', {}, {}, {}, function(){
				$('#content').show();
			});
			
			check_register();
		}
	}
}();

$(document).ready(function(){
	Base.init();
});