/**
 * Last updated 21.02.2005
 */
function JSComponentConfig() {

  this.scriptPath       = "/scripts/";
  this.jarPath          = "/scripts/bin/";
  this.imagePath        = "/images/";
  this.cssPath          = "/stylesheets/";
  this.commonScriptPath = "/scripts/";
  this.langScriptPath   = "/scripts/";
  this.htmlPath         = "/html/";

  this.debugMode = true;
  
  this.defaultLanguage    = "en";
  this.autoDetectLanguage = true;

  /* includes requared files */
  
  function includeLibs() {
    this.includeCommon( "template" );
    this.includeCommon( "arraylist" );
    this.includeCommon( "hashmap" );
    this.includeCommon( "strings" );
    this.includeCommon( "browser" );
    this.includeCommon( "dateformatter" );
    this.includeCommon( "dates" );
    this.includeCommon( "visual" );
    this.includeCommon( "event" );
    this.includeCommon( "forms" );
    this.includeCommon( "cookies" );
    this.includeCommon( "numbers" );
    this.includeCommon( "file-utils" );
    this.includeCommon( "validator" );
    this.includeCommon( "windows" );  
    this.includeCommon( "html" );
    this.includeCommon( "image-utils" );
  }
  this.includeLibs = includeLibs;
	
	/**
	 * @depricated
	 */
	function includeCommons(){
		this.includeLibs();
	}
  this.includeCommons = includeCommons;
	

  /* Public Methods */
  this.includeLangFile = includeLangFile;
  this.getLocaleCode   = getLocaleCode;
  this.includeCommon   = includeCommon;
  this.include         = include;
  
  /**
  * including script file with string constants
  * @param  fileName - The name of a file which will be included
  * @return void
  * @type void
  * @see    JSComponentConfig
  */
  function /*:void:*/ includeLangFile( /*:string:*/ fileName ) {
    var /*:string:*/ code = this.getLocaleCode();
    Global.include( this.langScriptPath + "" + fileName + "-" + code + ".js" );
  }

  /**
  * Getting Language Locale Code by checking browser language
  * @param  void
  * @return two first letters of language name
  * @type string
  * @see    JSComponentConfig
  */
  function /*:string:*/ getLocaleCode() {
    return this.defaultLanguage;
  }
  
  /**
  * public method
  * including componence-commons scripts files
  * @param  fileName - The name of a file which will be included
  * @return void
  * @type void
  * @see    JSComponentConfig
  */
  function /*:void:*/ includeCommon( /*:string:*/ fileName ) {
    var /*:string:*/ sourceFile = this.commonScriptPath + "componence-lib-" + fileName + ".js";
    Global.include( sourceFile );
  }


 /**
  * public method
  * including script file into html page
  * @param  fileName  file name , will be included
  * @return void
  * @type void
  * @see    JSComponentConfig
  */  
  function /*:void:*/ include( /*:string:*/ fileName ) {
    var path = null;
    if ( hasExtention( ".js", fileName ) || hasExtention( ".vb", fileName ) || hasExtention( ".vbs", fileName ) ) {
      path = this.scriptPath;
    } else  if ( hasExtention( ".css", fileName ) ) {
      path = this.cssPath;
    } else {
      alert( "incorrect include file: " + fileName );
    }
    if ( path != null ) {
      fileName = path + "" + fileName;
      Global.include( fileName );
    }
  }
  
  /**
  * @private
  * return true if fileName has extention
  * @param  extention - extention of file
  * @param  fileName - name of file which be processed
  * @return boolean
  * @type boolean
  * @see    JSComponentConfig
  */
  function /*:boolean:*/ hasExtention( /*:string:*/ extention, /*:string:*/ fileName ) {
    fileName = fileName.toLowerCase();
    return ( fileName.lastIndexOf( extention ) != -1 );
  }

}
var ComponentConfig = new JSComponentConfig();
/**
 * if you want to include libs manually you have to comment this line
 */
//ComponentConfig.includeLibs();

var ComponenceComponents = {
	/* RTF */
	JSRTF       : "componence-rtf.js",
	JSRTFConfig : "config-componence-rtf.js",

	/* Inserts */
	JSInserts     : "componence-inserts.js",		
	JSImageInsert : "componence-image-insert.js", 
	JSLinkInsert  : "componence-link-insert.js",

	/* Libs */
	JSArrayList            : "componence-lib-arraylist.js",
	JSBrowser              : "componence-lib-browser.js",
	JSCookie               : "componence-lib-cookies.js",
	JSDateFormatter        : "componence-lib-dateformatter.js",
	JSDateUtils            : "componence-lib-dates.js",
	JSEventManager         : "componence-lib-event.js",
	JSFileUtils            : "componence-lib-file-utils.js",
	JSFormManager          : "componence-lib-forms.js",
	JSHashMap              : "componence-lib-hashmap.js",
	JSHtml                 : "componence-lib-html.js",
	JSXML                  : "componence-lib-xml.js",
	JSImageUtils           : "componence-lib-image-utils.js",
	JSNumberUtils          : "componence-lib-numbers.js",
	JSStringUtils          : "componence-lib-strings.js",
	JSTemplate             : "componence-lib-template.js",
	JSValidator            : "componence-lib-validator.js",
	JSVisualElementManager : "componence-lib-visual.js",
	JSWindowManager        : "componence-lib-windows.js",
	
	/* Other */
	JSPopup       : "componence-popup.js, config-componence-popup.js",
	JSPopupConfig : "componence-popup.js, config-componence-popup.js",
	JSDialog      : "componence-dialog.js",
	JSDataGrid    : "componence-data-grid.js",
	JSDrag        : "componence-drag.js"
};