<!--    

/** 
	Feeder and Component Context
*/


var eoogui = new Object();

eoogui = function(componentName){	
	
	//COMMON
	this.name = componentName;	
	this.value = "";
	
	//Functions
		
	//Functions
	this.initView = function(initVar){
		
		this.value = initVar;
		if(this.value == ""){			
			var altVar = document.getElementById("" + this.name).value;
			if(altVar != ""){
				this.value = altVar;	
			}else{
				this.value = "";	
			}
			
		}		
		document.getElementById(""+this.name).value = this.value;
		
	}//EO this.initView = function(initVar){
	
	
	this.setValue = function(value){
		this.value = value;	
		document.getElementById(""+this.name).value = this.value;
		
	}
		
	
	this.getValue = function(){		
		return this.value;
	}
	
	//SPECIFIC
	
	//Functions
	
}//EO eoogui = function(componentName){	


/** Text Field */
var eooguiInputText = new Object();

eooguiInputText = function(componentName){	
	
	//COMMON
	this.name = componentName;	
	this.value = "";
	
	//Functions
		
	//Functions
	this.initView = function(initVar){
		
		this.value = initVar;
		if(this.value == ""){			
			var altVar = document.getElementById("" + this.name).value;
			if(altVar != ""){
				this.value = altVar;	
			}else{
				this.value = "";	
			}
			
		}		
		document.getElementById(""+this.name).value = this.value;
		
	}//EO this.initView = function(initVar){
	
	
	this.setValue = function(value){
		this.value = value;	
		document.getElementById(""+this.name).value = this.value;
		
	}
		
	
	this.getValue = function(){		
		return this.value;
	}
	
	//SPECIFIC
	
	//Functions
	
}//EO eooguiInputText = function(componentName){	


/** Text Area */
var eooguiTextArea = new Object();

eooguiTextArea = function(componentName){	
	
	//COMMON
	this.name = componentName;	
	this.value = "";
	
	//Functions
		
	//Functions
	this.initView = function(initVar){
		
		this.value = initVar;
		if(this.value == ""){			
			var altVar = document.getElementById("" + this.name).value;
			if(altVar != ""){
				this.value = altVar;	
			}else{
				this.value = "";	
			}
			
		}		
		document.getElementById(""+this.name).value = this.value;
		
	}//EO this.initView = function(initVar){
	
	
	this.setValue = function(value){
		this.value = value;	
		document.getElementById(""+this.name).value = this.value;
		
	}
		
	
	this.getValue = function(){		
		return this.value;
	}
	
	//SPECIFIC
	
	//Functions
	
}//EO eooguiTextArea  = function(componentName){	


/** Contener */

var eooguiContener = new Object();

eooguiContener = function(componentName){	

	//COMMON
	this.name = componentName;	
	this.content = "";
	this.contentTable = new Array();
		
	//Functions
	this.initView = function(initContent){
	
		this.content = initContent;
		if(this.content == ""){			
			var altContent = document.getElementById("" + this.name).innerHTML;
			if(altContent != ""){
				this.content = altContent;	
			}else{
				this.content = "";	
			}
			
		}		
		//document.getElementById(""+this.name).value = this.value;
		
	}//EO this.initView = function(initVar){
	
	
	this.addContent = function(content){		
		
		count = this.contentTable.length;
	
		this.contentTable[count]=content;		
		//alert("count "+count+" length "+this.contentTable.length);
		//alert("fiche "+content+" ajouté. \nHistorique "+document.getElementById("" + this.name).innerHTML);
		
		
		//document.getElementById("" + this.name).innerHTML="";
		
		try{
			var inHtml = document.getElementById("" + this.name);
		}catch(e){
			//alert(typeof(inHtml.innerHTML)+' exception');
			var inHtml = new Object();
		}
		
		
		inHtml.innerHTML="";
		for(count in this.contentTable){					
			if(this.contentTable[count]!=""){
				strContent = this.contentTable[count];
				reg = new RegExp("(::counter)","g");
				strContent = strContent.replace(reg,count);
				inHtml.innerHTML += strContent;	
			}else{
				//this.contentTable[count]=content;
			}
		}	
		
		this.content=inHtml.innerHTML;
		//document.getElementById("" + this.name).innerHTML=this.content
		//alert('fe '+this.name);
		
	}//EO this.addContent = function(content){	
		
	this.removeContent = function(idContent){		
		document.getElementById("" + this.name).innerHTML="";
		contentTableTmp = new Array();
				
		countTmp = 0;
		for(count in this.contentTable){			
			if(this.contentTable[count]!="" && idContent!=count){	
				contentTableTmp[countTmp]=this.contentTable[count];	
				strContent = contentTableTmp[countTmp];				
				reg = new RegExp("(::counter)","g");
				strContent = strContent.replace(reg,countTmp);
				document.getElementById("" + this.name).innerHTML += strContent;
				countTmp++;
			}else{
				//handle exceptions
				if(this.contentTable[count]=="" && idContent!=count){
					contentTableTmp[countTmp]=this.contentTable[count];	
					countTmp++;
				}
			}
		}
		this.contentTable.length=0;
		this.contentTable=contentTableTmp;
		this.content=document.getElementById("" + this.name).innerHTML;
	}//EO this.removeContent = function(idContent){
	
	this.getContent = function(){
		return this.content;
	}
	
	this.getContentLen = function(){
		return this.contentTable.length;	
	}
	
	this.clear = function(){
			this.contentTable.length=0;
			this.content ="";
			document.getElementById("" + this.name).innerHTML = "";
	}
	
	//SPECIFIC
	
	//Functions
	
}//EO eooguiContener = function(componentName){	



/** Check Box */
var eooguiCheckBox = new Object();

eooguiCheckBox = function(componentName){
	//COMMON
	this.name = componentName;	
	this.value = "";
	this.checked = "";
	
	//Functions
	this.initView = function(initVar){
		
		this.checked = initVar;
		if(this.checked == ""){			
			var altVar = document.getElementById("" + this.name).checked;
			if(typeof(altVar) != "undefined" && altVar!="" && altVar==true){
				this.checked = altVar;	
			}else{
				this.checked = false;	
			}
			
		}		
		
		document.getElementById(""+this.name).checked = this.checked;
		this.value = document.getElementById(""+this.name).value;
	}//EO this.initView = function(initVar){
	
	
	this.setChecked = function(bool){			
		document.getElementById(""+this.name).checked=bool;
		this.checked=bool;		
	}
		
	this.getChecked = function(){		
		return this.checked;
	}	
	
	this.getValue = function(){		
		return this.value;
	}
	
	
}//EO eooguiCheckBox = function(componentName){



/** BO Drop List : Combo box */
var eooguiDropList = new Object();

eooguiDropList = function(componentName){
	
	//COMMON
	this.name = componentName;
	this.value = "";
	
	//Functions
	this.initView = function(initVar){
		
		this.value = initVar;
		if(this.value == ""){			
			var altVar = document.getElementById("" + this.name).value;
			if(altVar != ""){
				this.value = altVar;	
			}else{
				this.value = "";	
			}
			
		}
		document.getElementById(""+this.name).value=this.value;
		
	}//EO this.initView = function(initVar){
	
	
	
	this.setOptions = function(optionsArr){		
		//alert(this.name);
		document.getElementById(this.name).length=0;
		for(key in optionsArr){		
			document.getElementById(this.name).options[document.getElementById(this.name).length] = new Option(optionsArr[key], key);		
		}//EO for(key in optionsArr){	
		
	}//EO this.setOptions = function(optionsArr){
		
		
	this.getValue = function(){		
		return this.value;
	}
	
	this.setEnabled = function(bool){
		
		if(bool == false){
			document.getElementById(""+this.name).disabled=true;			
		}else{
			document.getElementById(""+this.name).disabled=false;
		}
	}
	
	this.setSelected = function(selValue){
		
		if(selValue != ""){
			document.getElementById(""+this.name).value=selValue;
			this.value=selValue;
		}
	}
	
	this.getLength = function(){
		return 	document.getElementById(this.name).length;
	}
	
	this.getSelected = function(){		
		return document.getElementById(""+this.name).selectedIndex;
	}
	
	
}//EO eooguiDropList = function(componentName){
/** EO Drop List */


/** Select list : FUL LIST !! NOT COMBO BOX */
var eooguiSelectList = new Object();

eooguiSelectList = function(componentName){
	
	//COMMON
	this.name = componentName;
	this.value = new Array();
	//Functions
	this.initView = function(initVar){
		
		this.value = initVar;
		if(this.value == ""){			
			var altVar = document.getElementById("" + this.name).value;
			if(altVar != ""){
				this.value = altVar;	
			}else{
				this.value = "";	
			}
			
		}
		document.getElementById(""+ this.name).value = this.value;
		
	}//EO this.initView = function(initVar){
		
	this.setOptions = function(optionsArr){
		//First Reset everything
		document.getElementById(this.name).options.length = 0;			

		//Then Update				
		for(key in optionsArr){		
			document.getElementById(this.name).options[document.getElementById(this.name).options.length] = new Option(optionsArr[key], key);		
		}//EO for(key in optionsArr){	
		
	}//EO this.setOptions = function(optionsArr){
		
	this.getSelected = function(){
		
	  	var selectedArray = new Array();		
	  	selObj = document.getElementById(""+ this.name);		
	  	var i;
	  	var count = 0;
	  	for (i=0; i<selObj.options.length; i++) {
			if (selObj.options[i].selected) {
		  	selectedArray[count] = selObj.options[i].value;
		  	count++;
			}
	  	}		
		return selectedArray;	  		
	}//EO this.getSelected = function(){
	
	
	this.updateListBox = function(action,value){
		
		var fullList = new Array();
		var newListTmp = new Array();
		var newList = new Array();
		var recFound = false;
		fullList = this.getValue();
		
		if(action == "remove" && value.length > 0){
			
			for(id in fullList){
				//Searc tru value				
				for(key in value){
					if(fullList[id]==value[key]){	
						recFound = true;						
					}				
				}
				
				if(recFound == false){				
					newList[fullList[id]]=fullList[id];					
				}else{
					recFound = false;	
				}				
				
			}			
			
			this.setOptions(newList);
		}//EO if(action == "remove"){
		
		
		if(action == "add" && value.length > 0){
			count=0;
			for(id in fullList){				
				newListTmp[count]=fullList[id];	
				count++;
			}
			for(key in value){				
				newListTmp[count]=value[key];
				count++;
			}
			
			newListTmp.sort();			
			for(id in newListTmp){
				newList[newListTmp[id]]=newListTmp[id];
			}
			
			this.setOptions(newList);			
		}//EO if(action == "add" && value.length > 0){			
		
		
		
	}//EO this.updateListBox = function(action,value){
		
	
	this.getValue = function(){		
		valObj = document.getElementById(""+ this.name);
		valueArray = new Array();
		var count=0;
		
		for(i=0; i<valObj.options.length; i++){			
			valueArray[count] = valObj.options[i].value;			
		  	count++;
			
		}
		this.value = valueArray;
		return this.value;
	}
	
}//EO eooguiSelectList = function(componentName){


/** Hidden */
var eooguiHidden = new Object();

eooguiHidden = function(componentName){	
	
	//COMMON
	this.name = componentName;	
	this.value = "";
	
	//Functions
	this.initView = function(initVar){
		
		this.value = initVar;
		if(this.value == ""){			
			var altVar = document.getElementById(""+this.name).value;
			if(altVar != ""){
				this.setValue(altVar);	
			}else{
				this.setValue("");	
			}			
		}		
		
	}//EO this.initView = function(initVar){
	
	
	this.setValue = function(value){
		this.value = value;	
		document.getElementById(""+this.name).value=this.value;		
		
	}
	
	
	
	this.getValue = function(){		
		return this.value;
	}
	
	this.strToArray = function(){
		list = new Array();
		//Return All rows
		rowValue = this.getValue();
		//rowValue = this.value();
		if(rowValue != null){
			
			rvLen = this.getValue().length;
			//rvLen = this.value().length;
			
			row='';
			rowCount=0;
			for(i=0;i<=rvLen;i++){
				cStr=rowValue.substring(i,i+1);
				if(cStr==';'){				
					list[rowCount] = row;
					rowCount++;
					row='';
					
				}else{
					row+=cStr;
				}
				
			}		
			this.setValue(list);
		}else{
			this.setValue(null);	
		}
				
	}
	
	
	this.arrayToStr = function(){
		list = new String();
		array = this.getValue();
		for(id in array){
			list+=array[id]+";";	
		}
		
		if(typeof(list)!="undefined" && list!=""){			
			this.setValue(list);
		}else{
			this.setValue(null);	
		}
	}
	
	
	
	
	//SPECIFIC
	
	//Functions
	
}//EO eooguiHidden = function(componentName){




/** Radio */
var eooguiRadio = new Object();

eooguiRadio = function(componentName,sumOptions){
	//COMMON
	this.name = componentName;
	this.value = "";
	this.selected = "";
	//this.selected = new Array;
	this.sumOptions = sumOptions;	
		
	//Preparing Radio cases
	var radioCase = new Array();
	if(this.sumOptions!= "" && this.sumOptions>0){
		for(i=1; i<=this.sumOptions; i++){
			radioCase[i]=this.name+i;
		}	
	}
	
	
	//Functions
	this.initView = function(initVar){		
		if(initVar != "" ){
			this.selected = initVar;
		}
		
		if(this.selected == ""){			
			
			var altVar = this.getSelected();
			if(altVar != ""){
				this.setSelected(altVar);	
			}
			
		}else{			
			this.setSelected(this.selected);
		}		
		
		
		
	}//EO this.initView = function(initVar){
		
	
	this.setSelected = function(value){			
		this.selected = value;
		document.getElementById(""+radioCase[this.selected]).checked = true;
		
	}
		
	this.getSelected = function(){				
		for(selection in radioCase){			
			if(document.getElementById(""+radioCase[selection]).checked == true){
				this.selected=selection;
				return this.selected;
				break;
			}			
		}
	}
	
	
	
}//EO eooguiRadio = function(componentName){
	
	

/** File Browser */
var eooguiFileBrowser = new Object();

eooguiFileBrowser = function(componentName){	
	
	//COMMON
	this.name = componentName;	
	this.value = "";
	
	//Functions
	this.initView = function(initVar){
		
		this.value = initVar;
		if(this.value == ""){			
			var altVar = document.getElementById("" + this.name).value;
			if(altVar != ""){
				this.value = altVar;	
			}else{
				this.value = "";	
			}			
		}		
		
	}//EO this.initView = function(initVar){
	
	
	this.setValue = function(value){
		this.value = value;	
		document.getElementById(""+this.name).value=this.value;		
		
	}
		
	
	this.getValue = function(){		
		return this.value;
	}
	
	
	
	//SPECIFIC
	
	//Functions
	
}//EO eooguiFileBrowser = function(componentName){

//-->