/**
 * <code>public class <b>Model</b><br>
 * extends Object</code><br><br>
 *
 *
 * Defines static variable: <code>Object ComponentConfig</code><br>
 * Available as <code>new componence.ComponentConfig()</code><br>
 * Packege <b><code>componence</code></b>
 */
 
if(!window.componence) var componence={};

/**
 * Construct a config for all <code>componence</code> classes.
 * 
 * @version	{version}
 * @constructor
 * @lastmodified
 */
componence.ComponentConfig = function() {


/**
	 * Path to where all scripts files are located.
	 *
	 * @access public
	 * @type String
	 */     
  	this.scriptPath = contextPath + "/portlets/ps/core/res/js/";
	
	/**
	 * Path to where all graphical files are located.
	 *
	 * @access public
	 * @type String
	 */
	 this.imagePath = contextPath +  "/portlets/ps/core/res/images/";
	
	/**
	 * Path to where all styleshhets files are located.
	 *
	 * @access public
	 * @type String
	 */
  	this.cssPath = contextPath + "/portlets/ps/core/res/css/";

	
	/**
	 * Path to where all optimized scripts files are located.
	 *
	 * @access public
	 * @type String
	 */
	this.jarPath = this.scriptPath;
	
	/**
	 * Path to where all locales scripts files are located.
	 *
	 * @access public
	 * @type String
	 */
	this.localePath = this.scriptPath;
	
	/**
	 * Path to where all html files are located.
	 *
	 * @access public
	 * @type String
	 */
	this.htmlPath = this.scriptPath;

	/**
	 * Specified displayng error messages. Default <code>false</code>.
	 *
	 * @access public
	 * @type boolean
	 */
	this.debugMode = false;
  
  	/**
	 * Specified locale code. [auto, en, nl, ru, uk]. Default en.<br>
	 * Used in <code>componence.util.Locale</code>
	 *
	 * @access public
	 * @type String
	 * @see componence.util.Locale.defaultLocale
	 */
	this.defaultLanguage = "en";
	
	if (typeof contextPath == "undefined") {
		alert("WARNING: contextPath variable is not defined!");
	}	
	
  	/**
	 * Specified path to manage resource folder<br>
	 * Used in <code>titlebar</code>
	 *
	 * @access public
	 * @type String
	 * @see titlebar
	 */
	this.psManageResourcesPath = contextPath + "/portlets/ps/core/manage";

	/**
	 * Getting path to manage resources
	 * 
	 * @access public
	 * @return psManageResourcesPath
	 * @type String
	 */
	function getPsManageResourcesPath() {
		return this.psManageResourcesPath;
	}
	this.getPsManageResourcesPath = getPsManageResourcesPath;
	
	/**
	 * Setting path to manage resources
	 * 
	 * @access public
	 * @type String
	 */
	function setPsManageResourcesPath(psManResPath) {
		this.psManageResourcesPath=psManResPath;
	}
	this.setPsManageResourcesPath = setPsManageResourcesPath;
	
	/**
	 * Auto detecting locale. Default <code>true</code>.<br>
	 * Used in <code>componence.util.Locale</code>
	 *
	 * @access public
	 * @type String
	 * @see componence.util.Locale.autoDetect
	 */
	this.autoDetectLanguage = false;

	/**
	 * Getting Language Locale Code by checking browser language
	 * 
	 * @access public
	 * @return two first letters of language name
	 * @type String
	 */
	function getLocaleCode() {
		return this.defaultLanguage;
	}
	this.getLocaleCode = getLocaleCode;

	/**
	 * Includs script file into html page
	 *
	 * @access public
	 * @param fileName String file name, will be included
	 * @type boolean
	 * @see componence.lib.Global.include
	 * @see componence.lib.Global.hasExtention
	 */
	function include(file) {
		var /*:Global:*/ g = Global;
		var /*:file:*/ f = String( file );
		var path = null;
		if ( g.hasExtention( ".js", f ) || g.hasExtention( ".vb", f ) || g.hasExtention( ".vbs", f ) ) {
			path = this.scriptPath;
		} else  if ( g.hasExtention( ".jar", f ) ) {
			path = (this.jarPath) ? this.jarPath : this.scriptPath;
		} else  if ( g.hasExtention( ".css", f ) ) {
			path = this.cssPath;
		} else {
			alert( "incorrect include file: " + f );
			return false;
		}
		if ( path != null ) {
			f = path + "" + f;
			return g.include( f );
		}
	}
	this.include = include;
};

/**
 * @access private
 * @deprecated use componence.ComponentConfig
 * Last updated {buildDate}
 */
function /*:JSClass:*/ JSComponentConfig() {
	return new componence.ComponentConfig();
}

var ComponentConfig = new componence.ComponentConfig();

/*
 * used in componence.lib.Global.required<br>
 * componence.lib.Global.required -  deprecated, use 
 * componence.lib.Global.depends
 * 
 * @deprecated
 */
var ComponenceComponents = {
	/* RTF */
	JSRTF       : "componence-rtf.js",
	JSRTFConfig : "config-componence-rtf.js",

	/* Inserts */
	JSInserts     : "componence-inserts.js",		
	JSImageInsert : "componence-inserts.js", 
	JSLinkInsert  : "componence-inserts.js",

	/* Utils */
	JSArrayList     : "componence-util.js",
	JSCookie        : "componence-util.js",
	JSDateUtils     : "componence-util.js",
	JSDateFormatter : "componence-util.js",
	JSHashMap       : "componence-util.js",
	JSLocale        : "componence-util.js",
	JSNumber        : "componence-util.js",
	JSObject        : "componence-util.js",
	JSString        : "componence-util.js",
	

	/* Libs */
	JSBrowser              : "componence-lib.js",
	JSEventManager         : "componence-lib.js",
	JSFileUtils            : "componence-lib.js",
	JSFormManager          : "componence-lib.js",
	JSHtml                 : "componence-lib.js",
	JSImageUtils           : "componence-lib.js",
	JSMouse                : "componence-lib.js",
	JSTemplate             : "componence-lib.js",
	JSValidator            : "componence-lib.js",
	JSVisualElementManager : "componence-lib.js",
	JSWindowManager        : "componence-lib.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"
};

/**
 * begin-:config-componence-inage-place.js
 * @author ssingh
 *  
 */
 
/**
 * Defines global variable: <code>ImagePlaceConfig</code>
 */

/**
 * This jsclass contains common values constants for image place.
 *
 * @constructor
 * @version
 * @lastmodified
 * @extends ComponentConfig
 */
function JSImagePlaceConfig() {

	/**
   * image manager popup name<br>
   * default: <code>"imagemanager"</code>
   * @type String
   */
	this.imageManagerWindowName = "imagemanager";
	
	/**
   * image manager popup url
   * @type String
   */
	this.imageManagerURL = "image-manager.html";
	
	/**
   * image manager popup params, window propertie<br>
   * default: <code>"width=400, height=400"</code>
   * @type String
   * @link http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp
   * @link http://www.mozilla.org/docs/dom/domref/dom_window_ref76.html
   */
	this.imageManagerOpenParams = "width=400,height=400";
	
	/**
	 * image manager default width
	 * @type int
	 */
	this.defaultWidth = 0;
	
	/**
	 * image manager default height
	 * @type int
	 */
  this.defaultHeight = 0;
}

if(window.JSComponentConfig) JSImagePlaceConfig.prototype = new JSComponentConfig();
var ImagePlaceConfig = new JSImagePlaceConfig();

/*
 *	default template for image place
 */
var 
  COMPONENCE_DEFAULT_IMAGE_PLACE = 
      '<span id="{imagePreviewerId}">{imageFieldValue}</span>' +
      ''+
      '<input class="image" id="{showPictureButtonId}" type="button" value="Select image" onclick="{showImageManager}">' +
      '<input class="image" id="{hidePictureButtonId}" type="button" value="Remove image" onclick="{hidePicture}">';
function geti18nDefaultImagePlace(selectImage/*String*/,removeImage/*String*/){
	return COMPONENCE_DEFAULT_IMAGE_PLACE.replace("Select image",selectImage).replace("Remove image",removeImage);
}      

/**
 * begin:-config-componence-link-place.js
 * @author sukhsimran 
 */

/**
 * Defines global variable: <code>LinkPlaceConfig</code>
 */

/**
 * This jsclass contains common values constants for link place.
 *
 * @constructor
 * @version
 * @lastmodified
 * @extends ComponentConfig
 */
function JSLinkPlaceConfig() {
  
  /**
   * link manager popup name<br>
   * default: <code>"linkmanager"</code>
   * @type String
   */
  this.linkManagerWindowName = "linkmanager";
  
  /**
   * link manager popup url
   * @type String
   */
  this.linkManagerURL = contextPath+"/portlets/ps/core/res/jsp/link-manager.jsp";//"{actionURLNM}";
  
  /**
   * link manager popup params, window propertie<br>
   * default: <code>"width=300, height=200"</code>
   * @type String
   * @link http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp
   * @link http://www.mozilla.org/docs/dom/domref/dom_window_ref76.html
   */
  this.linkManagerOpenParams = "width=300,height=200";//"width={PopupWidth},height={PopupHeight},resizable={PopupResizable},menubar={PopupMenuBar},toolbar={PopupToolBar},scrollbars={PopupScrollBars},status=yes";
}
if(window.JSComponentConfig) JSLinkPlaceConfig.prototype = new JSComponentConfig();
var LinkPlaceConfig = new JSLinkPlaceConfig();

/*
 * default template for link place
 */
var  COMPONENCE_DEFAULT_LINK = 
/*
  '<input type="text" name="{linkFieldName}" value="{linkFieldValue}">&nbsp;' +
  '<select type="text" name="{targetFieldName}">' + 
  '<option value=""></option>' +
  '<option value="_self">_self</option>' +
  '<option value="_blank">_blank</option>' +
  '<option value="_parent">_parent</option>' +
  '</select>&nbsp;'+
  '<scr' + 'ipt>FormManager.chooseSelectOption("{targetFieldName}", "{formName}", "{targetFieldValue}");<\/scr' + 'ipt>' +
*/
  '<input class="image" type="button" onClick="{linkPopupShow}" value="Choose link">';


/**
 * begin:- config-componence-attachment-place.js
 * @author sukhsimran 
 */
 
/**
 * Defines global variable: <code>AttachmentPlaceConfig</code>
 */

/**
 * This jsclass creates common values constants for attachment place.
 *
 * @constructor
 * @version
 * @lastmodified
 * @extends ComponentConfig
 */
function JSAttachmentPlaceConfig() {
	
	/**
   * attachment manager popup name<br>
   * default: <code>"attachmentManager"</code>
   * @type String
   */
	this.attachmentManagerWindowName = "attachmentManager";
	
	/**
   * attachment manager popup url
   * @type String
   */
	this.attachmentManagerURL = "/scripts/attachment-manager.html";
	
	/**
   * attachment manager popup params, window propertie<br>
   * default: <code>"width=400, height=400"</code>
   * @type String
   * @link http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp
   * @link http://www.mozilla.org/docs/dom/domref/dom_window_ref76.html
   */
	this.attachmentManagerOpenParams = "width=400,height=400,center=true,modal=true";
	
	/**
	 * attachment manager default width
	 * @type int
	 */
	this.defaultWidth = 400;
	
	/**
	 * attachment manager default height
	 * @type int
	 */
  	this.defaultHeight = 300;
	
	/**
	 * append:<br>
	 * <code>true</code>  - inserts new item before first item <br>
	 * <code>false</code> - inserts new item after last item<br>
	 * @type boolean
	 */
	this.append = false;
	
	/**
	 * HTML template file name, should be located in ComponentConfig.scriptPath
	 * @type String
	 * @see ComponentConfig.scriptPath
	 */
	this.htmlFile = "componence-attachment-place-template.html";
}
if(window.JSComponentConfig) JSAttachmentPlaceConfig.prototype = new JSComponentConfig();
var AttachmentPlaceConfig = new JSAttachmentPlaceConfig();

/*
* Value of follow variables is a template block name
* See componence-attachment-place-template.html
*/
var COMPONENCE_DEFAULT_ATTACHMENT_PLACE = "Place";
var COMPONENCE_CUSTOM_ATTACHMENT_PLACE  = "CustomPlace";
var COMPONENCE_ANOTHER_ONE_PLACE        = "AnotherOnePlace";




 