var CW_GlobalVar = {

	/**
	 * relative to ComwebBean_error <br/>
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	Error_UNKNOWN : 0,
	/**
	 * relative to ComwebBean_error <br/>
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	Error_SERVLET_ACTION_MISSING : 1,
	/**
	 * relative to ComwebBean_error <br/>
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	Error_SERVLET_ACTION_UNKNOWN : 2,
	/**
	 * relative to ComwebBean_error <br/>
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	Error_GENERAL_PARSE_DATE : 3,
	/**
	 * relative to ComwebBean_error <br/>
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	Error_GENERAL_PARSE_NUMBER : 4,
	/**
	 * relative to ComwebBean_error <br/>
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	Error_REGISTRATION_INVALID_EMAIL : 5,
	/**
	 * relative to ComwebBean_error <br/>
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	Error_REGISTRATION_INVALID_USERNAME : 6,
	/**
	 * relative to ComwebBean_error <br/>
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	Error_REGISTRATION_NO_EMAIL : 7,
	/**
	 * relative to ComwebBean_error <br/>
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	Error_REGISTRATION_NO_USERNAME : 8,
	/**
	 * relative to ComwebBean_error <br/>
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	Error_REGISTRATION_DUPLICATE_USERNAME : 9,
	/**
	 * relative to ComwebBean_error <br/>
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	Error_REGISTRATION_INVALID_PASSWORD : 10,
	/**
	 * relative to ComwebBean_error <br/>
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	Error_REGISTRATION_NICKNAME_RUDE : 11,



	/**
	 * relative to ComwebBean_group <br/>
	 * The following constants identifies a medias playlist.
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	Group_TYPE_PLAYLIST : 0,
	/**
	 * relative to ComwebBean_group <br/>
	 * The following constants identifies a friends group.
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	Group_TYPE_FRIENDS : 1,
	/**
	 * relative to ComwebBean_group <br/>
	 * The following constants identifies a medias favourite.
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	Group_TYPE_FAVOURITE : 2,
	/**
	 * relative to ComwebBean_group <br/>
	 * The following constant identifies the blocked users for
	 * a user.
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	Group_TYPE_BLOCKED : 3,
	/**
	 * relative to ComwebBean_group <br/>
	 * The following constant identifies professionnel type
	 * groups
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	Group_TYPE_PROFESSIONNEL : 4,
	/**
	 * relative to ComwebBean_mailBox <br/>
	 * The following constant store the inbox folder type,
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	 MailBox_TYPE_INBOX : 1,
	/**
	 * relative to ComwebBean_mailBox <br/>
	 * The following constant store the outbox folder type,
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	 MailBox_TYPE_OUTBOX : 2,
	/**
	 * relative to ComwebBean_mailBox <br/>
	 * The following constant store the archive folder type,
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	 MailBox_TYPE_ARCHIVE : 3,




	/**
	 * relative to ComwebBean_user<br/>
	 * The following constants to define different genders for a user
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	User_MAN : 1,
	User_WOMEN : 2,
	User_MIXTE : 3,
	/**
	 * relative to ComwebBean_user<br/>
	 * The following constants to define different title for a user
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	User_MISTER : 1,
	User_MRS : 2,
	User_MISS : 3,
	/**
	 * relative to ComwebBean_user<br/>
	 * The following constants to define different marital status for a user
	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	User_RELATIONSHIP_STATUS_SINGLE : 1,
	User_RELATIONSHIP_STATUS_INRELATION : 2,
	User_RELATIONSHIP_STATUS_MARRIED : 3,
	User_RELATIONSHIP_STATUS_DIVORCED : 4,
	User_RELATIONSHIP_STATUS_SEPARATED : 5,
	User_RELATIONSHIP_STATUS_LOOKING : 6,
	User_RELATIONSHIP_STATUS_SECRET : 7,







	ITEM_TYPE_USER : 1,
	/**
	 * The following constant store the media type identifier.
	 * @author Patrick Herrmann
	 */
	ITEM_TYPE_MEDIA : 2,
	/**
	 * The following constant store the tag type identifier.
	 * @author Patrick Herrmann
	 */
	ITEM_TYPE_TAG : 3,
	/**
	 * The following constant store the comment type identifier.
	 * @author Patrick Herrmann
	 */
	ITEM_TYPE_COMMENT : 4,
	/**
	 * The following constant store the group type identifier.
	 * @author Patrick Herrmann
	 */
	ITEM_TYPE_GROUP : 5,
	/**
	 * The following constant store the subscription type identifier.
	 * @author Patrick Herrmann
	 */
	ITEM_TYPE_SUBSCRIPTION : 6,
	/**
	 * The following constant store the site type identifier.
	 * @author Patrick Herrmann
	 */
	ITEM_TYPE_SITE : 7,
	/**
	 * The following constant store the category type identifier.
	 * @author Patrick Herrmann
	 */
	ITEM_TYPE_CATEGORY : 8,
	/**
	 * The following constant store the country type identifier.
	 * @author Patrick Herrmann
	 */
	ITEM_TYPE_COUNTRY : 9,
	/**
	 * The following constant store the mailbox type identifier.
	 * @author Patrick Herrmann
	 */
	ITEM_TYPE_MAILBOX : 10,
	/**
	 * The following constant store the message type identifier.
	 * @author Patrick Herrmann
	 */
	ITEM_TYPE_MESSAGE : 11,
	/**
	 * The following constant store the browsing session type identifier.
	 * @author Patrick Herrmann
	 */
	ITEM_TYPE_SESSION : 12,
	/**
	 * The following constant store the foldermessage type identifier.
	 * @author Simon Loury
	 */
	ITEM_TYPE_FOLDERMESSAGE : 13,
	/**
	 * The following constant store the carrier provider type identifier.
	 * @author Mayooranath
	 */
	ITEM_TYPE_CARRIERPROVIDER : 14,


	/**
	 * relative to ComwebBean_user<br/>
	 * The following constants to define different stages in registration process for a user
	 *@author Charles Herteaux <cherteaux@scroon.com>
	 */
	Registration_STEP_1 : 1,
	Registration_STEP_2 : 2,
	Registration_STEP_3 : 3,
	Registration_STEP_4 : 4,
	Registration_FINISHED : 5
}

var CW_XML_NODE_TYPE ={
	ELEMENT_NODE 	:1, // Objet Element
	ATTRIBUTE_NODE 	:2, // Objet Attribut
	TEXT_NODE 	:3, // Objet Text.
	CDATA_SECTION_NODE 	:4, // Objet CDATASection.
	ENTITY_REFERENCE_NODE 	:5, // Objet EntityReference.
	ENTITY_NODE 	:6, // Objet Entity.
	PROCESSING_INSTRUCTION_NODE 	:7, // Objet ProcessingInstruction
	COMMENT_NODE 	:8, // Objet Comment.
	DOCUMENT_NODE 	:9, // Objet Document
	DOCUMENT_TYPE_NODE 	:10, // Objet DocumentType.
	DOCUMENT_FRAGMENT_NODE 	:11, // Objet DocumentFragment.
	NOTATION_NODE 	:12 // Objet Notation.
}

//NEW VERSION
/**
 * Attention
 * 	ComwebBean_internationalization
 *
 *
 */

function ComwebBeanXmlDom () {
	this.initialize();
}
ComwebBeanXmlDom.prototype = {
	xmlDom : null,
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.xmlDom=null;
		this.childListRegisteredComwebBean = null;
		this.childRegisteredNames = null;
	},
	setXmlDom:function(xmlDom){
		this.xmlDom = xmlDom;
	},
	_getImmediateChildDom:function (childName){
		var arrayChilds = new Array();
		try{
			var nodelistChild =  this.xmlDom.getElementsByTagName(childName);
			for (var i=0;i<nodelistChild.length;i++){
				if (nodelistChild.item(i).parentNode == this.xmlDom){
					arrayChilds.push(nodelistChild.item(i));
				}
			}
		}catch(e){
			CW_logger.log(CW_logger.LEVEL_ERROR,"ComwebBeanXmlDom.getImmediateChildDom(" + childName + ") error:" + e );
		}
		return arrayChilds;
	},
	get:function(key){
		return this.getValues(key);
	},
	changeValue:function(key,newValue){
		var result = null;
		try{
			result = this.xmlDom.attributes.getNamedItem(key);
			result.nodeValue;
		}catch(e){
			//given key is not in attributes search in childs
			try{
				result = null;
				result =  this._getImmediateChildDom(key)[0].firstChild;
			}catch(e){
				return false;
			}
		}
		try{
			if (result!=null){
				result.nodeValue =newValue;
				return true;
			}
		}catch(e){
			return false;
		}
		return false;

	},

	getValues: function (key){
		var result = null;
		try{
			result = this.xmlDom.attributes.getNamedItem(key).nodeValue;
			if (result!=null){
				return result;
			}
		}catch(e){
			//given key is not in attributes search in childs
			try{
				return this._getImmediateChildDom(key)[0].firstChild.nodeValue;
			}catch(e){
				return null;
			}
		}
	},

	getSpecificChildren: function (beanName){
		//veref if the system have already ask this bean in this case, those beans are registred
		if (this._isRegisteredChildName(beanName)){
			return this._getSpecificRegisteredChildren(beanName);
		}
		//veref if this.xmlDom have wanted chidren, if not return the default result : empty Array
		var arrayChilds = this._getImmediateChildDom(beanName);
		if (arrayChilds.length ==0){
			return new Array();
		}
		if(this.childListRegisteredComwebBean == null){
			this.childListRegisteredComwebBean = new Array();
		}

		this._registeredChildName(beanName);

		var result = new Array();
		var specificChild = null;
		var analysedNode = null;
		for(var i=0;i<arrayChilds.length;i++){
			try{
				analysedNode = arrayChilds[i];
				specificChild = eval("new ComwebBean_"+beanName+"();");
				specificChild.parseXml(analysedNode);
				this.xmlDom.removeChild(analysedNode);
				this.childListRegisteredComwebBean.push(specificChild);
				result.push(specificChild);
			}catch (e){
				CW_logger.log(CW_logger.LEVEL_ERROR,"ComwebBeanXmlDom.getSpecificChildren(" + beanName + ") error:" + e );
			}
		}
		return result;
	},
	_getSpecificRegisteredChildren: function (beanName){
		if(this.childListRegisteredComwebBean == null){
			return new Array();
		}
		beanName = 'ComwebBean_' + beanName;
		var result = new Array();
		for(var i=0; i<this.childListRegisteredComwebBean.length; i++) {
			if (this.childListRegisteredComwebBean[i].getName() == beanName){
				result.push(this.childListRegisteredComwebBean[i]);
			}
		}
		return result;
	},
	hasError:function(){
		return (this.getSpecificChildren("error").length > 0);
	},
	_isRegisteredChildName:function(childName){
		if (this.childRegisteredNames == null){
			return false;
		}else{
			for(var i=0; i<this.childRegisteredNames.length; i++) {
				if (this.childRegisteredNames[i] == childName){
					return true;
				}
			}
			return false;
		}
	},
	_registeredChildName:function(childName){
		if (this.childRegisteredNames == null){
			this.childRegisteredNames = new Array();
		}
		this.childRegisteredNames.push(childName);
	},
	toString:function(){

	}
}

/**
* Create a new instance of ComwebBean (call this.initialize).
* @class This class permits to implements the general behavior (xml parser ...) of comweb bean object, which are used
* as xml wrapper, in order to implements only the guetter for the instance which inherits of this class
* @classDescription	This class permits to implements the general behavior (xml parser ...) of comweb bean object, which are used
* as xml wrapper, in order to implements only the guetter for the instance which inherits of this class
* @constructor
*/
function ComwebBean () {
	this.initialize();
}
/**
 * stores the name of the relative comweb bean object (must be specialised in child object)
 * @public
 * @type String
 */
ComwebBean.prototype.name = null;
/**
 * stores the differents attribute or element from the xml content
 * @public
 * @type HashTable
 */
ComwebBean.prototype.storageValues = null;
/**
 * stores ComwebBean childs
 * @public
 * @type Array
 */
ComwebBean.prototype.childList = null;

ComwebBean.prototype = {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean";
		this.storageValues = new ComwebBeanXmlDom();
		this.childList = null;
	},
	/**
	 * parse the xml value (attributes and node value) of the given domNode Object in order to
	 * set the storageValues array and the childList array
	 * @param {Object} domNode - object DOMNode which contain xml values for this object
	 */
	parseXml:function(domNode){
		this.storageValues = new ComwebBeanXmlDom();
		this.storageValues.setXmlDom(domNode);
	},
	/**
	 * retrieves the list attributes of the given node and set theirs values in the storageValues hashtable
	 * @param {Object} domNode - object DOMNode which contain xml values (attributes) for this object
	 */
	parseXmlAttributes:function(domNode){
	},
	/**
	 *retrieves the list of xml node (name and value) of the given node and
	 * if the node name not correspond to another comweb bean object : set theirs values in the storageValues hashtable
	 * otherwise build the corresponde comweb bean object and put it in the  childList
	 * note that the corresponding comweb bean object is an instance of the class "ComwebBean_[xml node name]"
	 * @param {Object} domNode - object DOMNode which contain xml values (node value) for this object
	 */
	parseXmlNodes: function (domNode){
	},
	/**
	 * Put a new child in the childlist after verification that the relativ comweb bean object
	 * exist {@link ComwebBean#parseXmlNodes}
	 * @param {Object} domNode
	 */
	putChild: function (domNode){
	},

	parseDate:function(stringDate){
		var result = new Date();

		try{
			var regexpZero = new RegExp("^[0]+","g");
			result.setFullYear(parseInt(stringDate.substr(0,4)));
			result.setMonth(parseInt(stringDate.substr(5,2).replace(regexpZero, "") ) - 1 );
			result.setDate(parseInt(stringDate.substr(8,2).replace(regexpZero, "") ));
			result.setHours(parseInt(stringDate.substr(11,2)));
			result.setMinutes(parseInt(stringDate.substr(14,2)));
			result.setSeconds(parseInt(stringDate.substr(17,2)));
			return result;

		}catch(e){
			CW_logger.log("Error","ComwebBean.js parseDate cant parse the given date:" + stringDate + " (normal format:2007-03-22 10:18:03)");
			return null;
		}

	},
	changeValue:function(key,newValue){
		return this.storageValues.changeValue(key,newValue);
	},
	/**
	 * permits to retriev the corresponding value of a node name or attribute name
	 * @see HashTable#get
	 * @param {String} key - attribute or node name
	 * @return {String} the correspondig value or null if ther is not any one
	 */
	getValues: function (key){
		return this.storageValues.get(key);
	},
	/**
	 * Guetter
	 * @return {String} the name of the comweb bean object
	 */
    getName:function(){
		return this.name;
	},
	/**
	 * Guetter
	 * @return {Array} the comweb bean childs
	 */
	getChildren: function (){
		alert("ComwebBean.getChildren is called " + this.name);
	},
	/**
	 * Guetter
	 * @return {HashTable} the storageValues
	 */
	getStorageValues: function (){
		return this.storageValues;
	},
	/**
	 * Guetter
	 * @return {Array} the comweb bean children type
	 */
	getChildrenType: function (){
		alert("ComwebBean.getChildrenType is called " + this.name);
	},
	/**
	 * Guetter
	 * @param {String} comwebBeanType, type of the wanted comweb bean, ex to have ComwebBean_category
	 * in the result array specifie comwebBeanType as "category"
	 * @return {Array} the comweb bean children, wich correspond to the given type
	 */
	getSpecificChildren: function (comwebBeanType){
		return this.storageValues.getSpecificChildren(comwebBeanType);
	},
	/**
	 * Indicates if this comwebBean have comwebBean_error child
	 * @return {boolean}
	 */
	hasError:function(){
		return this.storageValues.hasError();
	},
	/**
	 *  Returns a short description of this object
	 * @return {String} Returns a short description of this object
	 */
	toString:function(){
		return  this.name + ":"+ this.storageValues.toString();
	}
};


/**
 * Create a new instance of ComwebBean_internationalization (call this.initialize).
 * @class Xml wrapper of a internationalization content, the corresponding xml node name is:"internationalization"
 * @classDescription Xml wrapper of a internationalization content, the corresponding xml node name is:"internationalization"
 * @extends ComwebBean
 * @constructor
 */

function ComwebBean_internationalization(){
	this.initialize();
}
ComwebBean_internationalization.prototype = {

	/**
	 * stores the regular expression which permits to obtain internationalization parameter like
	 * "{$user:default}"
	 * @public
	 * @type RegExp
	 */
	regExpValue: null,

	domNodeI18n : null,

	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_internationalization";
		this.storageValues = new HashTable();
		this.childList = null;
		this.regExpValue = new RegExp("\{[$][^{]+\}","g");
	},
	/**
	 * Guetter return : the language identifier
	 * @return {String} the language identifier
	 */
	getLangId: function(){
		return this.getValues("langId");
	},

	/**
	 * @param {String} key
	 * @param {HashTable} hashTableParamValue
	 */
	getValueParams: function (key,hashTableParamValue){
		if (key == "langId"){
			return ( this.storageValues.get("langId"));
		}
		var result = (CW_util.decodeUTF8(this.getValues((key))));
		if (!result){
			return "";
		}
		var tabValues = this.regExpValue.exec2(result);
		if (tabValues.length >0){

			var keyValue = "";
			var defaultValueVar = "";

			while (tabValues.length>0){
				var fullValue = new String(tabValues.pop());
				var separatorIndex2 = fullValue.indexOf(":",0);
				if (separatorIndex2 > 0){
					keyValue = fullValue.substring(2,separatorIndex2);
					defaultValueVar = fullValue.substring(separatorIndex2+1,fullValue.length -1);
				}else{
					keyValue = fullValue.substring(2,fullValue.length -1);
					defaultValueVar = "";
				}
				var replaceValue = hashTableParamValue.get(keyValue);
				if (replaceValue != null && replaceValue!="" && replaceValue!="null"){
					result = result.replace(fullValue,replaceValue);
				}else{
					result = result.replace(fullValue,defaultValueVar);
				}
			}
		}
		return result ;
	},
	/**
	 * permits to obtain the internationalization value from the corresponding key
	 * if the key corresponds to an internationalization which need paremeters like (where "value1" is the key):
	 * value1={$ownerName:Le propriétaire du média} autorise aucun tag sur {$mediaTitle:le média visualisé}
	 * call this function like: getValue("value1","ownerName=Charles","mediaTitle=title");
	 * if you don't specifie parameter you will obtain the default values:
	 * "Le propriétaire du média autorise aucun tag sur le média visualisé"
	 * @param {String} key
	 */
	getValue: function (key){
		if (key == "langId"){
			return (this.storageValues.get("langId"));
		}


		var  hashTableParamValue = new HashTable();

		for (var i=1;i<arguments.length;i++){
			var param = arguments[i];
			var separatorIndex = param.indexOf("=");

			if (separatorIndex > 0){
				hashTableParamValue.put(param.substring(0,separatorIndex),param.substring(separatorIndex+1));
			}
		}

		return this.getValueParams(key,hashTableParamValue);
	},

		/**
	 * Guetter
	 * The following method returns the unique identifier attached to the
	 * current instance.
	 * @return {int} This method returns the current resource identifier.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getUid: function(){
		return parseInt(this.storageValues.get("uid"));
	},
	getLangId:function(){
		return (this.storageValues.get("langId"));
	}
};
//set the extends class
ComwebBean_internationalization.prototype = Object.extend(new ComwebBean(),ComwebBean_internationalization.prototype);






//END OF NEW VERSION




/*
 *
 * OLD VERSION OF COMWEB BEAN & COWEB BEAN INTENATIONALZATION
 *

function ComwebBean () {
	this.initialize();
}
ComwebBean.prototype.name = null;
ComwebBean.prototype.storageValues = null;
ComwebBean.prototype.childList = null;

ComwebBean.prototype = {
	initialize: function(){
		this.name = "ComwebBean";
		this.storageValues = new HashTable();
		this.childList = null;
	},
	parseXml:function(domNode){
		this.parseXmlAttributes(domNode);
		this.parseXmlNodes(domNode);
		try{
			if (this.name == "ComwebBean_comweb"){
				var comwebBeanSessionArray = this.getSpecificChildren("session");
				if (comwebBeanSessionArray.length > 0){
					var sessionUID = comwebBeanSessionArray[0].getUid();
					if (sessionUID!=null && sessionUID!="NaN"){
						var cookieHelper = new ComwebCookieHelper();
						cookieHelper.setCookie(CW_Action_User.COOKIE_NAME_SESSION, sessionUID, "/comweb/");
					}
				}
			}
		}catch(e){
			CW_logger.log(CW_logger.LEVEL_ERROR,"error while ComwebBean.parseXml creating cookie session :" + e);
		}
	},
	parseXmlAttributes:function(domNode){
		var tabAttribute = domNode.attributes;
		for (i=0;i<tabAttribute.length;i++){
			var node = tabAttribute.item(i);
			this.storageValues.put(node.nodeName ,(node.nodeValue ));
		}
	},
	parseXmlNodes: function (domNode){
		//CW_logger.log("information", this.name + " : parseXmlNodes");
		var chilNodes = domNode.childNodes ;
		var currentNode;
		var currentNodeChild;

		var log = "";

		for (var i=0;i<chilNodes.length;i++){
			currentNode = chilNodes.item(i);
			if (currentNode.hasChildNodes){
				var IEhasChildNode = false;
				try{
					IEhasChildNode = (currentNode.firstChild.nodeType==CW_XML_NODE_TYPE.ELEMENT_NODE && currentNode.childNodes.length==1)
				}catch(e){}
				if (currentNode.childNodes.length > 1 || IEhasChildNode ){
					this.putChild(currentNode);
				}else{
					try{
						this.storageValues.put(currentNode.nodeName , (currentNode.firstChild.nodeValue));
					}catch(e){}
				}
			}
		}
	},
	putChild: function (domNode){
		var nodeName = domNode.nodeName ;
		var comwebBean = null;
		try{
			comwebBean = eval("new ComwebBean_" + nodeName + "();");
		}catch(e){
			CW_logger.log("Error","comwebBean(putChild):  can't create the corresponding object: ComwebBean_" + nodeName + ", try to set ComwebBean : " + e);
			return;
		}
		try{
			if (comwebBean != null && domNode.nodeType == CW_XML_NODE_TYPE.ELEMENT_NODE){
				comwebBean.parseXml(domNode);
				if (this.childList == null){
					this.childList = new Array();
				}
				this.childList.push(comwebBean);
			}
		}catch(e){
			CW_logger.log(CW_logger.LEVEL_WARNING,"comwebBean(putChild):  can't create the corresponding object: ComwebBean_" + nodeName + ", try to set ComwebBean : " + e);

			try{
				var child = new ComwebBean();
				child.parseXml(domNode);
				this.childList.push(child);
			}catch(e){
				CW_logger.log(CW_logger.LEVEL_ERROR,"comwebBean(putChild):  while  triing to set default ComwebBean : " + e);

			}
		}
	},
	parseDate:function(stringDate){
		var result = new Date();
		try{
			var regexpZero = new RegExp("^[0]+","g");
			result.setFullYear(parseInt(stringDate.substr(0,4)));
			result.setMonth(parseInt(stringDate.substr(5,2).replace(regexpZero, "") ) - 1 );
			result.setDate(parseInt(stringDate.substr(8,2).replace(regexpZero, "") ));

			if (stringDate.length > 10){
				result.setHours(parseInt(stringDate.substr(11,2)));
				result.setMinutes(parseInt(stringDate.substr(14,2)));
				result.setSeconds(parseInt(stringDate.substr(17,2)));
			}
			return result;

		}catch(e){
			CW_logger.log("Error","ComwebBean.js parseDate cant parse the given date:" + stringDate + " (normal format:2007-03-22 10:18:03)");
			return null;
		}
	},
	changeValue:function(key,newValue){
		 this.storageValues.remove(key);
		 this.storageValues.put(key,newValue);
	},
	getValues: function (key){
		return this.storageValues.get(key);
	},
    getName:function(){
		return this.name;
	},
	getChildren: function (){
		if (this.childList == null){
			this.childList = new Array();
		}
		return this.childList;
	},
	getStorageValues: function (){
		return this.storageValues;
	},
	getChildrenType: function (){
		if (this.childList == null){
			return new Array();
		}else{
			var result = new Array();
			for (var i = 0;i<this.childList.length;i++){
				try{
					var name = this.childList[i].getName();
					var hasName = false;

					for (var j = 0;j<result.length && !hasName;j++){
						hasName = (result[j]) == name;
					}
					if (!hasName){
						result.push(name);
					}
				}catch(e){
				}
			}

			return result;
		}
	},
	getSpecificChildren: function (comwebBeanType){
		comwebBeanType = "ComwebBean_" + comwebBeanType;
		if (this.childList == null){
			return new Array();
		}else{
			try{
				var test =  eval("new "+comwebBeanType+"();");
				test.getName();
			}catch(e){
				CW_logger.log("Error","comwebBean:" + this.getName() + " : getSpecificChildren(comwebBeanType:"+comwebBeanType+"), the wanted type don't exist" + e);
				return null;
			}
			var result = new Array();
			for (var i = 0;i<this.childList.length;i++){
				try{
					if (this.childList[i].getName() == comwebBeanType){
						result.push(this.childList[i]);
					}
				}catch(e){
					CW_logger.log("Error","comwebBean:" + this.getName() + " : getSpecificChildren(comwebBeanType) when browsing childs:" + e);
				}
			}
			return result;
		}
	},
	hasError:function(){
		return (this.getSpecificChildren("error").length > 0);
	},
	toString:function(){
		return  this.name + ":"+ this.storageValues.toString();
	}
};
function ComwebBean_internationalization(){
	this.initialize();
}
ComwebBean_internationalization.prototype = {
	regExpValue: null,
	domNodeI18n : null,
	initialize: function(){
		this.name = "ComwebBean_internationalization";
		this.storageValues = new HashTable();
		this.childList = null;
		this.regExpValue = new RegExp("\{[$][^{]+\}","g");
		this.chilNodesI18n = null;
	},
	getLangId: function(){
		return this.getValues("langId");
	},
	parseXml:function(domNode){
		this.domNodeI18n = domNode;
		this.parseXmlAttributes(domNode);
	},
	getValues: function (key){
		if (key == "langId"){
			return (this.storageValues.get("langId"));
		}
		if (this.domNodeI18n == null){
			return "";
		}
		var chilNodesI18nVar = this.domNodeI18n.childNodes;
		if (chilNodesI18nVar.length < 5){
			return "";
		}
		var currentNode = null;
		for (var i=0;i<chilNodesI18nVar.length;i++){
			currentNode = chilNodesI18nVar.item(i);
			if (currentNode.nodeName == key){
				return CW_util.decodeUTF8(currentNode.firstChild.nodeValue);
			}
		}
	},
	getValueParams: function (key,hashTableParamValue){
		if (key == "langId"){
			return (this.storageValues.get("langId"));
		}
		var result = (this.getValues((key)));
		if (!result){
			return "";
		}
		var tabValues = this.regExpValue.exec2(result);
		if (tabValues.length >0){
			var keyValue = "";
			var defaultValueVar = "";
			while (tabValues.length>0){
				var fullValue = new String(tabValues.pop());
				var separatorIndex2 = fullValue.indexOf(":",0);
				if (separatorIndex2 > 0){
					keyValue = fullValue.substring(2,separatorIndex2);
					defaultValueVar = fullValue.substring(separatorIndex2+1,fullValue.length -1);
				}else{
					keyValue = fullValue.substring(2,fullValue.length -1);
					defaultValueVar = "";
				}
				var replaceValue = hashTableParamValue.get(keyValue);
				if (replaceValue != null && replaceValue!="" && replaceValue!="null"){
					result = result.replace(fullValue,replaceValue);
				}else{
					result = result.replace(fullValue,defaultValueVar);
				}
			}
		}
		return result ;
	},
	getValue: function (key){
		if (key == "langId"){
			return (this.storageValues.get("langId"));
		}
		var  hashTableParamValue = new HashTable();
		for (var i=1;i<arguments.length;i++){
			var param = arguments[i];
			var separatorIndex = param.indexOf("=");

			if (separatorIndex > 0){
				hashTableParamValue.put(param.substring(0,separatorIndex),param.substring(separatorIndex+1));
			}
		}
		return this.getValueParams(key,hashTableParamValue);
	},
	getUid: function(){
		return parseInt(this.storageValues.get("uid"));
	},
	getLangId:function(){
		return (this.storageValues.get("langId"));
	}
};
//set the extends class
ComwebBean_internationalization.prototype = Object.extend(new ComwebBean(),ComwebBean_internationalization.prototype);
*/



/**
 * Create a new instance of ComwebBean_config (call this.initialize).
 * @class Xml wrapper of a config description, the corresponding xml node name is:"config"
 * @classDescription Xml wrapper of a config description, the corresponding xml node name is:"config"
 * @extends ComwebBean
 * @constructor
 */

function ComwebBean_config(){
	this.initialize();
}

ComwebBean_config.prototype = {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_config";
		this.storageValues = new HashTable();
		this.childList = null;
	},
	/**
	 * Guetter return : the service identifier
	 * @return {int} the service identifier
	 */
	getServiceId: function(){
		return parseInt(this.getValues("serviceId"));
	},
	/**
	 * Guetter return : the language identifier
	 * @return {String} the language identifier
	 */
	getLangId: function(){
		return this.getValues("langId");
	},
	/**
	 * Guetter return : the webapp name
	 * @return {String} the webapp name
	 */
	getWebappName: function(){
		return this.getValues("webappName");
	}
};

//set the extends class
ComwebBean_config.prototype = Object.extend(new ComwebBean(),ComwebBean_config.prototype);


/**
 * Create a new instance of ComwebBean_comment (call this.initialize).
 * @class The following class implements a COMWEB comment. Comments are pieces of
 * text that can be posted by COMWEB users on either other users profiles or
 * on medias.
 * <BR/>
 * A comment holds:
 * <UL TYPE="DISC">
 * 	<LI> its <I>author</I> identifier</LI>
 * 	<LI> its <I>targeted COMWEB item</I> identifier</LI>
 * 	<LI> its <I>text</I></LI>
 * 	<LI> the <I>language</I> its author selected when browsing the site<LI>
 * 	<LI> <I>common item attributes</LI>
 * </UL>
 * the corresponding xml node name is:"comment"
 * @extends ComwebBean
 * @constructor
 * @author Charles Herteaux <cherteaux@scroon.com>
 */
function ComwebBean_comment (){
	this.initialize();
}
ComwebBean_comment.prototype =  {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_comment";
		this.storageValues = new HashTable();
		this.childList = null;
	},
	/**
	 * Guetter
	 * The following method returns the unique identifier attached to the
	 * current instance.
	 * @return {int} This method returns the current resource identifier.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getUid: function(){
		return parseInt(this.getValues("uid"));
	},

	/**
	 * Guetter
	 * The following method returns the date this bean has been created on
	 * the COMWEB platform.
	 * @return {Date} This method returns the date this bean has been created on
	 * the COMWEB platform.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getCreationDate: function(){
		return this.parseDate(this.getValues("creationdate"));
	},
	/**
	 * Guetter
	 * By default, a site item information can be browsed by all visitors on
	 * a COMWEB implementation. The following method indicates wether or
	 * not it's still the case for this bean.
	 * @return {boolean} indicates wether or
	 * not it's still the case for this bean.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	isPublic:function(){
		 return (this.getValues("public") == "true");
	},

	/**
	 * Guetter
	 * The following method returns the value that uniquely identifies a
	 * comment author.
	 * @return {int} the value that uniquely identifies a comment author.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getAuthorUserUid: function(){
		return parseInt(this.getValues("authoruid"));
	},

	getAuthorName: function(){
		return (this.getValues("authorname"));
	},

	getAuthorUsername: function(){
		return (this.getValues("username"));
	},

	getAuthorConnexionId: function(){
		return parseInt(this.getValues("authorconnection"));
	},

		/**
	 * Guetter
	 * The following method returns the user connected device (online, offline ...)
	 * <br />returns:
	 * <UL>
	 * 	<LI>i18n(general.member.onlineweb)</LI>
	 * 	<LI>i18n(general.member.onlinewap)</LI>
	 * 	<LI>i18n(general.member.offline)</LI>
	 * <UL/>
	 * @return {String} the user connected device
	 */
	getAuthorConnexionType:function(){
		switch (parseInt(this.getValues("connectedDevice"))) {
			case 1:
				return CW_internationalization.getValue("general.member.onlineweb");
				break;
			case 2:
				return CW_internationalization.getValue("general.member.onlinewap");
				break;
			case 3:
				return CW_internationalization.getValue("general.member.offline");
				break;
			default:
				break;
		}
	},

	getAuthorPreview: function(){
		return (this.getValues("userpreview"));
	},

	getItemUid: function(){
		return parseInt(this.getValues("itemuid"));
	},
	getLangId: function(){
		return parseInt(this.getValues("lang"));
	},
	/**
	 * Guetter
	 * The following method returns the text a comment holds.
	 * @return {String} the text a comment holds.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getText: function(){
		return (this.getValues("text"));
	}

};
//set the extends class
ComwebBean_comment.prototype = Object.extend(new ComwebBean(),ComwebBean_comment.prototype);


/**
 * Create a new instance of ComwebBean_folderMessage (call this.initialize).
 * @class The following class wraps information about a user MailBox.
 * <BR/>
 * the corresponding xml node name is:"folderMessage"
 * @extends ComwebBean
 * @constructor
 * @author Charles Herteaux <cherteaux@scroon.com>
 */
function ComwebBean_folderMessage (){
	this.initialize();
}
ComwebBean_folderMessage.prototype =  {
	/**
	 * call by the constructor in order to initialize attributes values
	 */

	initialize: function(){
		this.name = "ComwebBean_folderMessage";
		this.storageValues = new HashTable();
		this.childList = null;
	},
	/**
	 * Guetter
	 * The following method returns the unique identifier attached to the
	 * current instance.
	 * @return {int} This method returns the current resource identifier.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getUid: function(){
		return parseInt(this.getValues("uid"));
	},

	getStatus:function(){
		return parseInt(this.getValues("status"));
	},

	getStatusLabel:function(){
		var statusMessage = parseInt(this.getValues("status"));

		switch (statusMessage) {
			case 0:
				return CW_internationalization.getValue("mailBox.box.unread");
				break;
			case 1:
				return CW_internationalization.getValue("mailBox.box.read");
				break;
			case 2:
				return CW_internationalization.getValue("mailBox.box.archived");
				break;
			case 3:
				return CW_internationalization.getValue("mailBox.box.answered");
				break;
			default:
				return CW_internationalization.getValue("mailBox.box.unread");
				break;
		}

	}


};
//set the extends class
ComwebBean_folderMessage.prototype = Object.extend(new ComwebBean(),ComwebBean_folderMessage.prototype);

/**
 * Create a new instance of ComwebBean_group (call this.initialize).
 * @class The following class implements a group wrapper.
 * <BR/>
 * A group is an ordered list that can store any kind of COMWEB items. For
 * example, a playlist, friends or favourite medias are implemented as group
 * of items.
 * <BR/>
 * the corresponding xml node name is:"group"
 * @extends ComwebBean
 * @constructor
 * @author Charles Herteaux <cherteaux@scroon.com>
 */
function ComwebBean_group (){
	this.initialize();
}
ComwebBean_group.prototype =  {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_group";
		this.storageValues = new HashTable();
		this.childList = null;
	},
	/**
	 * Guetter
	 * The following method returns the unique identifier attached to the
	 * current instance.
	 * @return {int} This method returns the current resource identifier.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getUid: function(){
		return parseInt(this.getValues("uid"));
	},

	/**
	 * Guetter
	 * The following method returns the date this bean has been created on
	 * the COMWEB platform.
	 * @return {Date} This method returns the date this bean has been created on
	 * the COMWEB platform.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getCreationDate: function(){
		return this.parseDate(this.getValues("creationDate"));
	},
	/**
	 * Guetter
	 * By default, a site item information can be browsed by all visitors on
	 * a COMWEB implementation. The following method indicates wether or
	 * not it's still the case for this bean.
	 * @return {boolean} indicates wether or
	 * not it's still the case for this bean.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	isPublic:function(){
		 return (this.getValues("public") == "true");
	},

	/**
	 * Guetter
	 * The following method returns the group name (as specified by the
	 * group owner).
	 * @return {String} the group name
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getGroupName: function(){
		return (this.getValues("name"));
	},

	/**
	 * Guetter
	 * The following method returns the identifier of the group owner (the
	 * user who created the group).
	 * @return {int} the identifier of the group owner
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getOwnerUserUid: function(){
		return parseInt(this.getValues("ownerUserUid"));
	},

	/**
	 * Guetter
 	 * The following method returns the number of items in the current group
	 * not depending on their type.
	 * @return {int} This method returns the total number of items the current group holds.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getNbItems: function(){
		return parseInt(this.getValues("getNbItems"));
	},
	/**
	 * Guetter
 	 * The following method returns description of the current group
	 * @return {String} This method returns group description as a String.
 	 * @author Philippe Dobrowlanski
	 */
	getDescription: function(){
		return this.getValues("pl.description");
	},
	/**
	 * Guetter
 	 * The following method returns the current group's category uid
	 * @return {Int} This method returns group category identifier.
 	 * @author Philippe Dobrowlanski
	 */
	getCategoryUid: function(){
		return this.getValues("pl.category.uid");
	},
	/**
	 * Guetter
 	 * The following method returns the group's user level authorization
	 * @return {Int}
 	 * @author Philippe Dobrowlanski
	 */
	getLevelAutorisation: function(){
		return this.getValues("pl.user.autorisation");
	},

	getCreationDateSince: function(){
		var result = "";
		var creationDate = this.getCreationDate();
		var ecartGMT = creationDate.getTimezoneOffset()*60000;
		var currentDate = new Date();
		var creationUTC = Date.UTC(creationDate.getFullYear(),
			creationDate.getMonth(),
			creationDate.getDate(),
			creationDate.getHours(),
			creationDate.getMinutes());
		var currentUTC = Date.UTC(currentDate.getFullYear(),
			currentDate.getMonth(),
			currentDate.getDate(),
			currentDate.getHours(),
			currentDate.getMinutes());
		var diffUTC = currentUTC - creationDate + ecartGMT;
		if(diffUTC >= 86400000){
			return CW_util.getDateShort(creationDate);
		}
		else if(diffUTC <= 3600000 && diffUTC>120000){
			var min = parseInt(diffUTC/60000);
			result = min + " minutes ago";
			return result;
		}
		else if(diffUTC <= 60000){
			result = "1 minute ago";
			return result;
		}
		else if(diffUTC>=7200000 && diffUTC<84400000){
			var hour = parseInt(diffUTC/3600000);
			result = hour + " hours ago";
			return result;
		}
		else{
			result = "1 hour ago";
			return result;
		}
	}


};
//set the extends class
ComwebBean_group.prototype = Object.extend(new ComwebBean(),ComwebBean_group.prototype);

/**
 * Create a new instance of ComwebBean_groupitem (call this.initialize).
 * @class The following class wraps information about a playlist group of media.
 * <BR/>
 * the corresponding xml node name is:"groupitem"
 * @extends ComwebBean
 * @constructor
 * @author Philippe Dobrowlanski
 */

function ComwebBean_groupitem(){
	this.initialize();
}
ComwebBean_groupitem.prototype = {
	initialize:function(){
		this.name = "ComwebBean_groupitem";
		this.storageValues = new HashTable();
		this.childList = null;
	}
}
//set the extends class
ComwebBean_groupitem.prototype = Object.extend(new ComwebBean(),ComwebBean_groupitem.prototype);




/**
 * Create a new instance of ComwebBean_mailBox (call this.initialize).
 * @class The following class wraps information about a user MailBox.
 * <BR/>
 * the corresponding xml node name is:"mailBox"
 * @extends ComwebBean
 * @constructor
 * @author Charles Herteaux <cherteaux@scroon.com>
 */
function ComwebBean_mailbox (){
	this.initialize();
}
ComwebBean_mailbox.prototype =  {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_mailbox";
		this.storageValues = new HashTable();
		this.childList = null;
	},
	/**
	 * Guetter
	 * The following method returns the unique identifier attached to the
	 * current instance.
	 * @return {int} This method returns the current resource identifier.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getUid: function(){
		return parseInt(this.getValues("uid"));
	}

};
//set the extends class
ComwebBean_mailbox.prototype = Object.extend(new ComwebBean(),ComwebBean_mailbox.prototype);

/**
 * Create a new instance of ComwebBean_media (call this.initialize).
 * @class The following class wraps information about a COMWEB media.
 * <BR/>
 * Such a media is a COMWEB item that:
 * <UL TYPE="DISC">
 * 	<LI> has been uploaded by a user</LI>
 * 	<LI> belongs to a COMWEB implementation (site)</LI>
 * 	<LI> belongs to a category</LI>
 * 	<LI> can be tagged</LI>
 * 	<LI> can be commented</LI>
 * 	<LI> ...</LI>
 * </UL>
 * the corresponding xml node name is:"media"
 * @extends ComwebBean
 * @constructor
 * @author Charles Herteaux <cherteaux@scroon.com>
 */
function ComwebBean_media (){
	this.initialize();
}
ComwebBean_media.prototype =  {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_media";
		this.storageValues = new HashTable();
		this.childList = null;
	},
	/**
	 * Guetter
	 * The following method returns the unique identifier attached to the
	 * current instance.
	 * @return {int} This method returns the current resource identifier.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getUid: function(){
		return parseInt(this.getValues("uid"));
	},
	/**
	 * Guetter
	 * The following method returns the date this bean has been created on
	 * the COMWEB platform.
	 * @return {Date} This method returns the date this bean has been created on
	 * the COMWEB platform.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getCreationDate: function(){
		return this.parseDate(this.getValues("creationdate"));
	},
	/**
	 * Getter
	 * The following methods returns  time since this bean has been created on comweb
	 * paltform
	 * @return {Sring}
	 */
	getCreationDateSince: function(){
		var result = "";
		var creationDate = this.getCreationDate();
		var ecartGMT = creationDate.getTimezoneOffset()*60000;
		var currentDate = new Date();
		var creationUTC = Date.UTC(creationDate.getFullYear(),
			creationDate.getMonth(),
			creationDate.getDate(),
			creationDate.getHours(),
			creationDate.getMinutes());
		var currentUTC = Date.UTC(currentDate.getFullYear(),
			currentDate.getMonth(),
			currentDate.getDate(),
			currentDate.getHours(),
			currentDate.getMinutes());
		var diffUTC = currentUTC - creationDate + ecartGMT;
		if(diffUTC >= 86400000){
			return CW_util.getDateShort(creationDate);
		}
		else if(diffUTC <= 3600000 && diffUTC>120000){
			var min = parseInt(diffUTC/60000);
			result = min + " "+CW_internationalization.getValue("general.minute.ago");
			return result;
		}
		else if(diffUTC <= 60000){
			result = "1 "+CW_internationalization.getValue("general.minute.ago");
			return result;
		}
		else if(diffUTC>=7200000 && diffUTC<84400000){
			var hour = parseInt(diffUTC/3600000);
			result = hour + " " + CW_internationalization.getValue("general.hour.ago");
			return result;
		}
		else{
			result = "1 " + CW_internationalization.getValue("general.hour.ago");
			return result;
		}
	},
	/**
	 * Guetter
	 * By default, a site item information can be browsed by all visitors on
	 * a COMWEB implementation. The following method indicates wether or
	 * not it's still the case for this bean.
	 * @return {boolean} indicates wether or
	 * not it's still the case for this bean.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	isPublic:function(){
		 return (this.getValues("public") == "true");
	},
	/**
	 * Some medias, depending on their type (video, audio) need to be
	 * encoded before they can be distributed on a COMWEB site.
	 * <BR/>
	 * The following method indicates wether or not this media has been
	 * encoded.
	 * @return {boolean} indicates wether or not this media has been
	 * encoded.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	isEncoded: function(){
		return (this.getValues("encoded") == "true");
	},

	/**
	 * The following method returns the media type (video, music, image)
	 * refer to CW_Action_Media.Media_TYPE_[...],
	 * @return {int} the media type (refer to CW_GlobalVar.Media_TYPE_[...])
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getMediaType: function(){

		return parseInt(this.getValues("type"));
	},

	getMediaTypeName: function(){

		var type = parseInt(this.getValues("type"));

		switch (type) {
			case CW_Action_Media.Media_TYPE_VIDEO:
				return CW_internationalization.getValue("general.video");
				break;
			case CW_Action_Media.Media_TYPE_IMAGE:
				return CW_internationalization.getValue("general.photo");
				break;
			case CW_Action_Media.Media_TYPE_MUSIC:
				return CW_internationalization.getValue("general.audio");
				break;

			default:
				return "";
				break;
		}

	},


	/**
	 * The following method returns  the name a user set to medias he
	 * uploaded.
	 * @return {String} the media name
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getMediaName: function(){
		return (this.getValues("name"));
	},

	/**
	 * The following method returns  the media description
	 * @return {String} the media description
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getDescription: function(){
		return (this.getValues("desc"));
	},
	/**
	 * The following method returns the media owner nickname
	 * @return {String}  the media owner nickname
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getOwnerNickName: function(){
		return (this.getValues("ownernickname"));
	},

	getOwnerUsername: function(){
		return (this.getValues("username"));
	},

	/**
	 * The following method returns the amedia owner unique identifier.
	 * @return {int} the amedia owner unique identifier.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getOwnerUserUid: function(){
		return parseInt(this.getValues("owneruid"));
	},

	/**
	 * The following method the number of times that this media was seen
	 * @return {int} the number of times that this media was seen
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getNbVisualisation: function(){
		return parseInt(this.getValues("nbvisualisation"));
	},



	/**
	 * The following method the category Identifier on this media
	 * @return {int} the category Identifier
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getCategoryId: function(){
		return parseInt(this.getValues("category"));
	},


	/**
	 * The following method the number of comment posted on this media
	 * @return {int} the number of comment posted on this media
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getNbComment: function(){
		return parseInt(this.getValues("nbcomment"));
	},

	/**
	 * The following method retrieves how many times that the current media has been added in favourites
	 * @return {int} how many times that the current media has been added in favourites
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getNbFavorite: function(){
		return parseInt(this.getValues("nbfavourite"));
	},

	/**
	 * The following method returns the complete uri of the preview movie
	 * @return {String} the complete uri of the preview movie
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getFLVpreviewUri: function(){
		return (this.getValues("flvPreviewUri"));
	},

	/**
	 * The method below returns the site unique identifier of the current media
	 * @return {int} site unique identifier of current media
	 * @author Philippe Dobrowlanski
	 */
	getSiteUID: function(){
		return parseInt(this.getValues("siteuid"));
	},


	/**
	 * The method below returns how many votes current media has
	 * @return {int} media's number of vote
	 * @author Philippe Dobrowlanski
	 */
	getNbVote: function(){
		return parseInt(this.getValues("nbvote"));
	},
	/**
	 * The method below returns current media's (audio or video) length.
	 * Length format is [X hr Y mn, Z sec]
	 * @return {string} media lenght formatted
	 * @author Philippe Dobrowlanski
	 */
	getMediaLengthFormatted: function(){
		var lengthSec = this.getValues("length");
		var nbHour;
		var nbMin;
		var nbSec;
		var tmp;
		var format;
		if (lengthSec == null || lengthSec=="" || lengthSec=="null"){
			return CW_internationalization.getValue("general.notprecise");
		}
		nbHour = parseInt(lengthSec/3600);
		tmp = lengthSec%3600;
		nbMin = parseInt(tmp/60);
		tmp = tmp%60;
		nbSec = tmp;

		if(nbHour == 0 && nbMin == 0){
			format = nbSec+" sec";
			return format;
		}else if (nbHour == 0 ){
			format = nbMin+" mn, "+nbSec+" sec";
			return format;
		}




		format = nbHour+" hr "+nbMin+" mn, "+nbSec+" sec";
		return format;
	},
	/**
	 * The method below returns current media's (audio or video) length.
	 * Length format is [X hr Y mn, Z sec]
	 * @return {string} media lenght formatted
	 * @author Parra Mathieu
	 */
	getMediaLengthFormatted2: function(){
		var lengthSec = this.getValues("length");
		var nbHour;
		var nbMin;
		var nbSec;
		var tmp;
		var format;
		if (lengthSec == null || lengthSec=="" || lengthSec=="null"){
			return CW_internationalization.getValue("general.notprecise");
		}
		nbHour = parseInt(lengthSec/3600);
		tmp = lengthSec%3600;
		nbMin = parseInt(tmp/60);
		tmp = tmp%60;
		nbSec = tmp;

		if(nbHour == 0 && nbMin == 0){
			format = nbSec+" sec";
			return format;
		}else if (nbHour == 0 ){			
			if (nbSec < 10){	
				format = nbMin+":0"+nbSec+" min";
				return format;		
			} else {
				format = nbMin+":"+nbSec+" min";
				return format;		
			}		
		}
		if (nbMin < 60){	
			format = nbHour+":0"+nbMin+":"+nbSec+" hr";
			return format;		
		} else {		
			format = nbHour+":"+nbMin+":"+nbSec+" hr";
			return format;
		}
	}	,
	/**
	 * The method below returns current media's (video or audio) length in second
	 * @return {int} media length
	 * @author Philippe Dobrowlanski*/
	getMediaLength: function(){
		return (this.getValues("length"));
	},

	/**
	 * Guetter
	 * The following method returns the notation preview image
	 * <br />returns:
	 * <UL>
	 * 	<LI>img/default/vote/vote_0_5.gif</LI>
	 * 	<LI>img/default/vote/vote_1_5.gif</LI>
	 * 	<LI>img/default/vote/vote_2_5.gif</LI>
	 * 	<LI>img/default/vote/vote_3_5.gif</LI>
	 * 	<LI>img/default/vote/vote_4_5.gif</LI>
	 * 	<LI>img/default/vote/vote_5_5.gif</LI>
	 * <UL/>
	 * @return {String} the  the notation preview image
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getNotationPreview:function(){
		var notation = (this.getValues("average"));

		CW_logger.log(CW_logger.LEVEL_WARNING,"                   !!!!!!       getNotationPreview notation:" + notation);

		var result = "";
		if (notation== null || notation == "" || notation == "null"){
			result = "img/default/vote/vote_0_5.gif";
		}else{
			notation = parseInt(notation);
			if (notation >= 0 && notation <6){
				 result = "img/default/vote/vote_"+notation+"_5.gif";
			}
		}


			CW_logger.log(CW_logger.LEVEL_WARNING,"                   !!!!!!       getNotationPreview result:" + result);


		return result;
	},
	
	/**
	 * Guetter
	 * The following method returns the alternative notation preview image
	 * <br />returns:
	 * <UL>
	 * 	<LI>img/default/vote/vote_b_0_5.gif</LI>
	 * 	<LI>img/default/vote/vote_b_1_5.gif</LI>
	 * 	<LI>img/default/vote/vote_b_2_5.gif</LI>
	 * 	<LI>img/default/vote/vote_b_3_5.gif</LI>
	 * 	<LI>img/default/vote/vote_b_4_5.gif</LI>
	 * 	<LI>img/default/vote/vote_b_5_5.gif</LI>
	 * <UL/>
	 * @return {String} the  the alternative notation preview image
 	 * @author Remi Veyret <rveyret@scroon.com>
	 */
	getNotationPreview2:function(){
		var notation = (this.getValues("average"));

		CW_logger.log(CW_logger.LEVEL_WARNING,"                   !!!!!!       getNotationPreview notation:" + notation);

		var result = "";
		if (notation== null || notation == "" || notation == "null"){
			result = "img/default/vote/vote_b_0_5.gif";
		}else{
			notation = parseInt(notation);
			if (notation >= 0 && notation <6){
				 result = "img/default/vote/vote_b_"+notation+"_5.gif";
			}
		}


			CW_logger.log(CW_logger.LEVEL_WARNING,"                   !!!!!!       getNotationPreview result:" + result);


		return result;
	},	

	getAuthorizationLevel:function(){
		var autorization = (this.getValues("authorization"));
		if (autorization!= null && autorization != "null" && autorization != ""){
			return parseInt(autorization);
		}else{
			return 1;
		}
	},
	/**
	 * The method below returns the notation media
	 * @return {int} media's notation
	 * @author Charles Herteaux
	 */
	getNotation: function(){
		var notation = (this.getValues("average"));
		if (notation== null || notation == "null" || notation == ""){
			return 0;
		}else{
			return parseInt(notation);
		}

	}
};
//set the extends class
ComwebBean_media.prototype = Object.extend(new ComwebBean(),ComwebBean_media.prototype);






/**
 * Create a new instance of ComwebBean_message (call this.initialize).
 * @class  The following class implements a message wrapper.
 * <BR/>
 * A message
 * 	<LI> Belongs to two or more mailboxes</LI>
 * <BR/>
 * the corresponding xml node name is:"message"
 * @extends ComwebBean
 * @constructor
 * @author Charles Herteaux <cherteaux@scroon.com>
 */
function ComwebBean_message (){
	this.initialize();
}
ComwebBean_message.prototype =  {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_message";
		this.storageValues = new HashTable();
		this.childList = null;
	},
	/**
	 * Guetter
	 * The following method returns the unique identifier attached to the
	 * current instance.
	 * @return {int} This method returns the current resource identifier.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getUid: function(){
		return parseInt(this.getValues("uid"));
	},

	/**
	 * Guetter
	 * The following method returns the subject of the message
	 * @return {String} the subject of the message
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getMessageSubject: function(){
		return (this.getValues("subject"));
	},

	/**
	 * Guetter
	 * The following method returns the body of the message
	 * @return {String} the body of the message
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getMessageBody: function(){
		return (this.getValues("body"));
	},

	/**
	 * Guetter
	 * The following method returns the date that the message has been sent
	 * @return {Date} the date that the message has been sent
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getSentDate: function(){
		return this.parseDate(this.getValues("sentdate"));
	},

	getIsAlert:function (){
		return (this.getValues("isalert")) == "true";
	},

	getAlertType:function (){
		return (this.getValues("alerttype"));
	}


};
//set the extends class
ComwebBean_message.prototype = Object.extend(new ComwebBean(),ComwebBean_message.prototype);

/**
 * Create a new instance of ComwebBean_session (call this.initialize).
 * @class The following class wraps a remote end-user's browsing session.
 * <BR/>
 * More precisely, whenever a remote end-user browses a COMWEB site
 * implementation, he is assigned a new session server-side, where the
 * platform will store information about his browsing.
 * <BR/>
 * the corresponding xml node name is:"session"
 * @extends ComwebBean
 * @constructor
 * @author Charles Herteaux <cherteaux@scroon.com>
 */
function ComwebBean_session (){
	this.initialize();
}
ComwebBean_session.prototype =  {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_session";
		this.storageValues = new HashTable();
		this.childList = null;
	},
	/**
	 * Guetter
	 * The following method returns the unique identifier attached to the
	 * current instance.
	 * @return {int} This method returns the current resource identifier.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getUid: function(){
		return parseInt(this.getValues("uid"));
	},
	/**
	 * Guetter
	 * The following method returns the identifier of the site a remote
	 * end-user is browsing.
	 * @return {int} This method returns the identifier of the site
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getSiteUid: function(){
		return parseInt(this.getValues("siteUid"));
	},
	/**
	 * Guetter
	 * The following method returns the identifier of the COMWEB user
	 * attached to a session (if such a user logged in the site).
	 * @return {int} This method returns  the identifier of the COMWEB user
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getUserUid: function(){
		return parseInt(this.getValues("userUid"));
	}
};
//set the extends class
ComwebBean_session.prototype = Object.extend(new ComwebBean(),ComwebBean_session.prototype);

/**
 * Create a new instance of ComwebBean_stat (call this.initialize).
 * @class The following class wraps information about stat of a item COMWEB.
 * <BR/>
 * the corresponding xml node name is:"stat"
 * @extends ComwebBean
 * @constructor
 * @author Charles Herteaux <cherteaux@scroon.com>
 */
function ComwebBean_stat(){
	this.initialize();
}
ComwebBean_stat.prototype =  {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_stat";
		this.storageValues = new HashTable();
		this.childList = null;
	},
	/**
	 * Guetter
	 * The following method returns the unique identifier attached to the
	 * current instance.
	 * @return {int} This method returns the current resource identifier.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getUid: function(){
		return parseInt(this.getValues("uid"));
	},
	/**
	 * Guetter
	 * the value that identifies the date of creation of the stat.
	 * @return {Date}the value that identifies the date of creation of the stat.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getCreationDate: function(){
		return this.parseDate(this.getValues("creation_date"));
	},

	/**
	 * The following method returns the value that identifies the type of stat (visualisation, notation, ...) (refer to CW_GlobalVar.Stat_TYPE_[..])
	 * @return {int}the value that uniquely identifies (refer to CW_GlobalVar.Stat_TYPE_[..])
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getTypeStatUid: function(){

		return parseInt(this.getValues("item_type_uid"));
	}

};
//set the extends class
ComwebBean_stat.prototype = Object.extend(new ComwebBean(),ComwebBean_stat.prototype);


function ComwebBean_note (){
	this.initialize();
}
ComwebBean_note.prototype =  {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_note";
		this.storageValues = new HashTable();
		this.childList = null;
	},

	/**
	 * Guetter
	 * The following method returns the note detail nickname.
	 * @return {String} This method returns the note detail.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getDetail: function(){
		return (this.getValues("detail"));
	}
}

//set the extends class
ComwebBean_note.prototype = Object.extend(new ComwebBean(),ComwebBean_note.prototype);









function ComwebBean_detail (){
	this.initialize();
}
ComwebBean_detail.prototype =  {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_detail";
		this.storageValues = new HashTable();
		this.childList = null;
	}
}

//set the extends class
ComwebBean_detail.prototype = Object.extend(new ComwebBean(),ComwebBean_detail.prototype);












function ComwebBean_list (){
	this.initialize();
}
ComwebBean_list.prototype =  {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_list";
		this.storageValues = new HashTable();
		this.childList = null;
	},
	/**
	 * Guetter
	 * The following method returns the unique identifier attached to the
	 * current instance.
	 * @return {int} This method returns the current resource identifier.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getUid: function(){
		return parseInt(this.getValues("uid"));
	},
	/**
	 * Guetter
	 * The following method returns the number of item that the list can contain with no filters
	 * current instance.
	 * @return {int} This method returns the number of item that the list can contain with no filters
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getTotalNbItem:function(){
		return parseInt(this.getValues("total"));
	}


}

//set the extends class
ComwebBean_list.prototype = Object.extend(new ComwebBean(),ComwebBean_list.prototype);



/**
 * Create a new instance of ComwebBean_user (call this.initialize).
 * @class The following class wraps information about a COMWEB user.
 * <BR/>
 * the corresponding xml node name is:"user"
 * @extends ComwebBean
 * @constructor
 * @author Charles Herteaux <cherteaux@scroon.com>
 */
function ComwebBean_user (){
	this.initialize();
}

ComwebBean_user.prototype =  {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_user";
		this.storageValues = new HashTable();
		this.childList = null;
	},
	/**
	 * Guetter
	 * The following method returns the unique identifier attached to the
	 * current instance.
	 * @return {int} This method returns the current resource identifier.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getUid: function(){
		return parseInt(this.getValues("uid"));
	},
	/**
	 * Guetter
	 * The following method returns the user nickname. This nickname is the
	 * one displayed on COMWEB sites.
	 * @return {String} This method returns the user nickname.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getNickname: function(){
		return (this.getValues("nickname"));
	},
	/**
	 * Guetter
	 * The following method returns the user username. This username should
	 * be provided when trying to login a COMWEN implementation.
	 * <BR/>
	 * This username may be different from the nickname, as some COMWEB
	 * implementation may require that users authenticate through their
	 * e-mail, for example.
	 * @return {String} This method returns the user username.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getUsername: function(){
		return (this.getValues("username"));
	},

	/**
	 * Guetter
	 * The following method returns the date this bean has been created on
	 * the COMWEB platform.
	 * @return {Date} This method returns the date this bean has been created on
	 * the COMWEB platform.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getCreationDate: function(){
		return this.parseDate(this.getValues("creationDate"));
	},

	/**
	 * Guetter
	 * The following method returns the user dob
	 * @return {Date}  the user dob
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getDob: function(){
		return this.parseDate(this.getValues("dateOfBirth"));
	},
	/**
	 * Guetter
	 * The following method returns the user gender id
	 * <br />returns:
	 * <UL>
	 * 	<LI>CW_GlobalVar.User_MAN </LI>
	 * 	<LI>CW_GlobalVar.User_WOMEN</LI>
	 * 	<LI>CW_GlobalVar.User_MIXTE</LI>
	 * 	<LI>-1</LI>
	 * <UL/>
	 * @return {int}  the user gender id
 	 * @author Charles Herteaux <cherteaux@scroon.com>
 	 */
	getGenderID: function(){
		var genderId =  parseInt(this.getValues("genderId"));
		/*if (genderId!= CW_GlobalVar.User_MAN || genderId!=CW_GlobalVar.User_WOMEN || genderId != CW_GlobalVar.User_MIXTE ){
			genderId =-1;
		}*/
		return genderId;
	},

	/**
	 * Guetter
	 * The following method returns the user gender
	 * <br />returns:
	 * <UL>
	 * 	<LI>i18n(general.user.sex.man)</LI>
	 * 	<LI>i18n(general.user.sex.woman)</LI>
	 * 	<LI>i18n(general.user.sex.mixte)</LI>
	 * 	<LI>i18n(general.notprecise)</LI>
	 * <UL/>
	 * @return {String}  the user gender
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getGender: function(){
		var genderId =  parseInt(this.getValues("genderId"));
		switch (genderId) {
			case CW_GlobalVar.User_MAN:
					return CW_internationalization.getValue("general.user.sex.man");
				break;
			case CW_GlobalVar.User_WOMEN:
					return CW_internationalization.getValue("general.user.sex.woman");
				break;
			case CW_GlobalVar.User_MIXTE:
					return CW_internationalization.getValue("general.user.sex.mixte");
				break;
			default:
					return CW_internationalization.getValue("general.notprecise");
				break;
		}

	},

	/**
	 * Guetter
	 * The following method returns the user country identigfier
	 * @return {int} the user country identifier
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getCountryId: function(){
		return parseInt(this.getValues("countryUid"));
	},

	/**
	 * Guetter
	 * The following method returns the user state province identifier
	 * @return {int} the user state province identifier
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getStateProvinceId: function(){
		return parseInt(this.getValues("stateProvinceUid"));
	},
	/**
	 * Guetter
	 * The following method returns the user city name
	 * <br />returns:
	 * <UL>
	 * 	<LI>the correct user city name</LI>
	 * 	<LI>i18n(general.notprecise)</LI>
	 * <UL/>
	 * @return {String} the user city name
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getCityName: function(){
		var cityName =  (this.getValues("cityName"));
		if (cityName == null || cityName=="" || cityName=="null"){
			return CW_internationalization.getValue("general.notprecise");
		}
		return cityName;
	},

	/**
	 * Guetter
	 * The following method returns the user description
	 * <br />returns:
	 * <UL>
	 * 	<LI>the correct user description name</LI>
	 * 	<LI>i18n(general.notprecise)</LI>
	 * <UL/>
	 * @return {String} the user description
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getDescription: function(){
		var desc = (this.getValues("description"));

		if (desc == null || desc=="" || desc=="null"){
			return CW_internationalization.getValue("general.notprecise");
		}

		return desc;
	},

	getEmail: function(){
		var email = (this.getValues("email"));

		if (email == null || email=="" || email=="null"){
			return "undefined";
		}

		return email;
	},

	/**
	 * Guetter
	 * The following method returns the user connected device (online, offline ...)
	 * <br />returns:
	 * <UL>
	 * 	<LI>i18n(general.member.onlineweb)</LI>
	 * 	<LI>i18n(general.member.onlinewap)</LI>
	 * 	<LI>i18n(general.member.offline)</LI>
	 * <UL/>
	 * @return {String} the user connected device
	 */
	getConnectedType:function(){
		switch (parseInt(this.getValues("connectedDevice"))) {
			case 1:
				return CW_internationalization.getValue("general.member.onlineweb");
				break;
			case 2:
				return CW_internationalization.getValue("general.member.onlinewap");
				break;
			case 3:
				return CW_internationalization.getValue("general.member.offline");
				break;
			case 0:
				return CW_internationalization.getValue("general.member.offline");
				break;
			default:
				break;
		}
	},

	/**
	 * Guetter
	 * The following method returns the user visualisation number
	 * @return {int} the user visualisation number
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getNbVisualisation:function(){
		return parseInt(this.getValues("nbvisualisation"));
	},

	/**
	 * Guetter
	 * The following method returns the user comment number
	 * @return {int} the user comment number
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getNbComment:function(){
		return parseInt(this.getValues("nbcomment"));
	},

	/**
	 * Guetter
	 * The following method returns the user favorite number
	 * @return {int} the user favorite number
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getNbFavorite:function(){
		return parseInt(this.getValues("nbfavourite"));
	},

	/**
	 * Guetter
	 * The following method returns the user friend number
	 * @return {int} the user friend number
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getNbFriend:function(){
		return parseInt(this.getValues("nbfriend"));
	},

	/**
	 * Guetter
	 * The following method returns the user video number
	 * @return {int} the user video number
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getNbVideo:function(){
		return parseInt(this.getValues("nbvideo"));
	},

	/**
	 * Guetter
	 * The following method returns the user photo number
	 * @return {int} the user photo number
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getNbPhoto:function(){
		return parseInt(this.getValues("nbphoto"));
	},
	/**
	 * Guetter
	 * The following method returns the user years old
	 * <br />returns:
	 * <UL>
	 * 	<LI>the user years old like: </LI>
	 * 	<LI>i18n(general.notprecise)</LI>
	 * <UL/>
	 * @return {String} the user years old
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getYearsOld:function(){
		var sqlYearsOld = this.getValues("dateOfBirth");
		if (sqlYearsOld == null || sqlYearsOld=="" || sqlYearsOld=="null"){
			return CW_internationalization.getValue("general.notprecise");
		}

		var dob = this.parseDate(sqlYearsOld);
		var age = parseInt(((new Date()).getTime() - dob.getTime()) / (1000*60*60*24*365));

		CW_logger.log(CW_logger.LEVEL_INFORMATION,"USER BEAN.getYearsOld(), sqlYearsOld:"+ sqlYearsOld + " dob:" + dob + " age:" + age);

		return CW_internationalization.getValue("general.user.yearsold","yo=" + age);

	},

	/**
	 * Guetter
	 * The following method returns the user flag uri
	 * <br />returns:
	 * <UL>
	 * 	<LI>the correct flag preview uri</LI>
	 * 	<LI>img/flags/default.gif</LI>
	 * <UL/>
	 * @return {String} the user flag uri
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getFlagPreview:function(){
		var flag= this.getValues("flag");
		if (flag == null || flag=="" || flag=="null"){
			return "img/flags/default.gif";
		}
		return flag;
	},

	getAuthorizationLevel:function(){
		var autorization = (this.getValues("authorization"));
		if (autorization!= null && autorization != "null" && autorization != ""){
			return parseInt(autorization);
		}else{
			return 1;
		}
	},

	/**
	 * Guetter
	 * The following method returns the user avatar
	 * <br />returns:
	 * <UL>
	 * 	<LI>the correct avatar uri</LI>
	 * 	<LI>img/default/member/memberElement_men.jpg</LI>
	 * 	<LI>img/default/member/memberElement_women.jpg</LI>
	 * 	<LI>img/default/member/memberElement.jpg</LI>
	 * <UL/>
	 * @return {String} the user avatar uri
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getAvatar:function(){
		var avatar = null;
		avatar = (this.getValues("avatar"));
		if (avatar == null || avatar=="" || avatar=="null"){
			var genderId =  parseInt(this.getValues("genderId"));
			switch (genderId) {
				case CW_GlobalVar.User_MAN:
						return "img/member/member_Men_SmallPreview.gif"
					break;
				case CW_GlobalVar.User_WOMEN:
						return "img/member/member_Wom_SmallPreview.gif"
					break;
				case CW_GlobalVar.User_MIXTE:
						return "img/member/member_SmallPreview.gif"
					break;
				default:
						return "img/member/member_SmallPreview.gif"
					break;
			}
		}
		return avatar;
	},

	getAvatarPreview:function(){
		var avatar = null;
		avatar = (this.getValues("avatar"));
		if (avatar == null || avatar=="" || avatar=="null"){
			var genderId =  parseInt(this.getValues("genderId"));
			switch (genderId) {
				case CW_GlobalVar.User_MAN:
						return "img/member/memberElement_men.jpg"
					break;
				case CW_GlobalVar.User_WOMEN:
						return "img/member/memberElement_women.jpg"
					break;
				case CW_GlobalVar.User_MIXTE:
						return "img/member/memberElement.jpg"
					break;
				default:
						return "img/member/memberElement.jpg"
					break;
			}
		}
		return avatar;
	},

	getAutorisationTag:function(){
		return parseInt(this.getValues("user.autorisationTags"));
	},

	getFirstName:function(){
		return this.getValues("user.firstname");
	},

	getLastName:function(){
		return this.getValues("user.lastname");
	},

	getMobileNo:function(){
		return this.getValues("user.mobile.no");
	},

	getOperator:function(){
		return parseInt(this.getValues("user.operator"));
	},

	getNewsLetter:function(){
		return parseInt(this.getValues("user.newsletter"));
	},

	getOfferPartner:function(){
		return parseInt(this.getValues("user.partner.offers"));
	},

	getPostCode:function(){
		return this.getValues("postcode");
	},

	isBlocked:function(){
		return this.getValues("isblocked");
	},

	isFriend:function(){
		return this.getValues("isfriend");
	},

	isForbidden:function(){
		return this.getValues("isforbidden");
	},
	
	isSubscribed:function(){
		return this.getValues("issubscribe");
	}
};
//set the extends class
ComwebBean_user.prototype = Object.extend(new ComwebBean(),ComwebBean_user.prototype);


/**
 * Create a new instance of ComwebBean_error (call this.initialize).
 * @class The following class wraps information about a COMWEB error.
 * <BR/>
 * the corresponding xml node name is:"error"
 * @extends ComwebBean
 * @constructor
 * @author Charles Herteaux <cherteaux@scroon.com>
 */
function ComwebBean_error (){
	this.initialize();
}

ComwebBean_error.prototype =  {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_error";
		this.storageValues = new HashTable();
		this.childList = null;
	},
	/**
	 * Guetter
	 * The following method returns the unique identifier attached to the
	 * current instance.
	 * @return {int} This method returns the current resource identifier.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getUid: function(){
		return parseInt(this.getValues("uid"));
	},
	/**
	 * Guetter
	 * The following method returns the detail error
	 * @return {String} This method returns the detail error.
 	 * @author Charles Herteaux <cherteaux@scroon.com>
	 */
	getDetail: function(){
		return (this.getValues("detail"));
	}
};
//set the extends class
ComwebBean_error.prototype = Object.extend(new ComwebBean(),ComwebBean_error.prototype);


function ComwebBean_tag (){
	this.initialize();
}
ComwebBean_tag.prototype =  {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_tag";
		this.storageValues = new HashTable();
		this.childList = null;
	},
	getText: function(){
		return (this.getValues("text"));
	},

	getType: function(){
		return parseInt(this.getValues("type"));
	},

	getUid: function(){
		return parseInt(this.getValues("uid"));
	},


	getCounter: function(){
		return parseInt(this.getValues("counter"));
	},

	getCreationDate: function(){
		var creationDate = this.getValues("creationDate");
		if (creationDate==null){
			 creationDate = this.getValues("creationdate");
		}
		return this.parseDate(creationDate);
	}
}

//set the extends class
ComwebBean_tag.prototype = Object.extend(new ComwebBean(),ComwebBean_tag.prototype);


function ComwebBean_comweb (){
	this.initialize();
}
ComwebBean_comweb.prototype =  {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_comweb";
		this.storageValues = new HashTable();
		this.childList = null;
	}/*,

	parseXml:function(domNode){
		//CW_logger.log("information", this.name + " : parseXml");
		this.parseXmlAttributes(domNode);
		this.parseXmlNodes(domNode);
		//CW_logger.log("information",this.toString());

		try{
			var comwebBeanSessionArray = this.getSpecificChildren("session");
			if (comwebBeanSessionArray.length > 0){
				var sessionUID = comwebBeanSessionArray[0].getUid();
				if (sessionUID!=null && sessionUID!="null" && sessionUID!="" && sessionUID!="NaN"){
					var cookieHelper = new ComwebCookieHelper();
					//alert("setsession cookie:" + sessionUID);
					cookieHelper.setCookie(CW_Action_User.COOKIE_NAME_SESSION, sessionUID, "/comweb/");
				}
			}
		}catch(e){
			CW_logger.log(CW_logger.LEVEL_ERROR,"error while ComwebBean.parseXml creating cookie session :" + e);
		}
	}*/
};
//set the extends class
ComwebBean_comweb.prototype = Object.extend(new ComwebBean(),ComwebBean_comweb.prototype);




function ComwebBean_usercountry (){
	this.initialize();
}
ComwebBean_usercountry.prototype =  {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_usercountry";
		this.storageValues = new HashTable();
		this.childList = null;
	}
};
//set the extends class
ComwebBean_usercountry.prototype = Object.extend(new ComwebBean(),ComwebBean_usercountry.prototype);







/**
 * Create a new instance of ComwebBean_category (call this.initialize).
 * @class Xml wrapper of a category description, the corresponding xml node name is:"category"
 * @classDescription Xml wrapper of a category description, the corresponding xml node name is:"category"
 * @extends ComwebBean
 * @constructor
 */
function ComwebBean_category (){
	this.initialize();
}
ComwebBean_category.prototype =  {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_category";
		this.storageValues = new HashTable();
		this.childList = null;
	},
	/**
	 * Guetter
	 * @return {int} return the category identifier
	 */
	getId: function(){
		return parseInt(this.getValues("uid"));
	},
	/**
	 * Guetter
	 * @return {int} return the category identifier
	 */
	getUid: function(){
		return parseInt(this.getValues("uid"));
	},
	/**
	 * Guetter
	 * @return {String} return the category title
	 */
	getTitle: function(){
		return this.getValues("name");
	},
	/**
	 * Guetter
	 * @return {String} return the category description
	 */
	getDescription: function(){
		return this.getValues("desc");
	},
	/**
	 * Guetter
	 * @return {String} return the number of video media of the category
	 */
	getNbVideo:function(){
		return parseInt(this.getValues("nbvideos"));
	},

	/**
	 * Guetter
	 * @return {String} return the number of photo media of the category
	 */
	getNbPhotos:function(){
		return parseInt(this.getValues("nbphotos"));
	},

	/**
	 * Guetter
	 * @return {String} return the number of music media of the category
	 */
	getNbMusics:function(){
		return parseInt(this.getValues("nbmusics"));
	}

};
//set the extends class
ComwebBean_category.prototype = Object.extend(new ComwebBean(),ComwebBean_category.prototype);



/**
 * Create a new instance of ComwebBean_upload (call this.initialize).
 * @class Xml wrapper of an upload description, the corresponding xml node name is:"upload"
 * @classDescription  Xml wrapper of an upload description, the corresponding xml node name is:"upload"
 * @extends ComwebBean
 * @constructor
 */
function ComwebBean_upload(){
	this.initialize();
}
ComwebBean_upload.prototype =  {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_upload";
		this.storageValues = new HashTable();
		this.childList = null;
	},

	getHost:function(){
		return (this.getValues("host"));
	},
	getSessionUid:function(){
		return (this.getValues("session.uid"));
	},
	getMediaId:function(){
		return (this.getValues("mediaid"));
	},

	/**
	 * Guetter
	 * @return {int} return the upload status [0-100]
	 */
	getStatus: function(){
		return parseInt(this.getValues("status"));
	}
}

//set the extends class
ComwebBean_upload.prototype = Object.extend(new ComwebBean(),ComwebBean_upload.prototype);





function ComwebBean_country (){
	this.initialize();
}
ComwebBean_country.prototype =  {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_country";
		this.storageValues = new HashTable();
		this.childList = null;
	},

	/**
	 * Guetter
	 * @return {int} return the country identifier
	 */
	getUid: function(){
		return parseInt(this.getValues("uid"));
	},

	/**
	 * Guetter
	 * @return {String} return the country name
	 */
	getCountryName: function(){
		return (this.getValues("name"));
	},

	/**
	 * Guetter
	 * @return {String} return the country flag path
	 */
	getFlagPath: function(){
		return (this.getValues("flag"));
	}
}

//set the extends class
ComwebBean_country.prototype = Object.extend(new ComwebBean(),ComwebBean_country.prototype);

function ComwebBean_lang(){
	this.initialize();
}
ComwebBean_lang.prototype = {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_lang";
		this.storageValues = new HashTable();
		this.childList = null;
	},

	/**
	 * Guetter
	 * @return {int} return the language identifier
	 */
	getUid: function(){
		return parseInt(this.getValues("uid"));
	},

	/**
	 * Guetter
	 * @return {String} return the language name
	 */
	getLangName: function(){
		return (this.getValues("name"));
	}
}

//set the extends class
ComwebBean_lang.prototype = Object.extend(new ComwebBean(),ComwebBean_lang.prototype);



function ComwebBean_sender(){
	this.initialize();
}
ComwebBean_sender.prototype = {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_sender";
		this.storageValues = new HashTable();
		this.childList = null;
	}
}

//set the extends class
ComwebBean_sender.prototype = Object.extend(new ComwebBean(),ComwebBean_sender.prototype);

function ComwebBean_receiver(){
	this.initialize();
}
ComwebBean_receiver.prototype = {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_receiver";
		this.storageValues = new HashTable();
		this.childList = null;
	}
}

//set the extends class
ComwebBean_receiver.prototype = Object.extend(new ComwebBean(),ComwebBean_receiver.prototype);


function ComwebBean_messagebody(){
	this.initialize();
}
ComwebBean_messagebody.prototype = {
	/**
	 * call by the constructor in order to initialize attributes values
	 */
	initialize: function(){
		this.name = "ComwebBean_messagebody";
		this.storageValues = new HashTable();
		this.childList = null;
	},

	getTargetItemType: function(){
		return parseInt(this.getValues("targetitemtype"));
	},
	getTargetItemName: function(){
		return (this.getValues("targetitemname"));
	},
	getTargetItemUid: function(){
		return parseInt(this.getValues("targetitemuid"));
	},
	getItemUid: function(){
		return parseInt(this.getValues("itemuid"));
	},
	getBodyText: function(){
		return (this.getValues("bodytext"));
	}
}

//set the extends class
ComwebBean_messagebody.prototype = Object.extend(new ComwebBean(),ComwebBean_messagebody.prototype);

function ComwebBean_subscription(){
	this.initialize();	
}

ComwebBean_subscription.prototype = {
	initialize:function(){
		this.name = "ComwebBean_subscription";
		this.storageValues = new HashTable();
		this.childList = null;
	},
	
	getUid:function(){
		return parseInt(this.getValues("uid"))
	},
	
	isChanged:function(){
		return this.getValues("changed");
	},
	
	getItemType:function(){
		return parseInt(this.getValues("itemtypeuid"));
	},
	
	getOwnerNickname:function(){
		return this.getValues("username");
	}
}

ComwebBean_subscription.prototype = Object.extend(new ComwebBean(),ComwebBean_subscription.prototype);




