﻿//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//	Classe JSMLTextArea estensione della classe JSMultilanguage
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function JSMLTextArea(tableRef, languagePriority, targetObj, selectAllLang){
	JSMultilanguage.call(this, tableRef, languagePriority, targetObj, selectAllLang)
	
	this.createContentTag=createTextAreaTag
	this.modifyDescr=modifyDescr	
}

JSMLTextArea.prototype = new JSMultilanguage(tableRef, languagePriority, targetObj, selectAllLang)

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//	Implementations
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
var newDescr
function createTextAreaTag(langId){

	str="<textarea name=\"descr\" rows=\"7\" cols=\"60\" onchange='"  +  this.targetObj  + ".modifyDescr(value,\"" + langId + "\")'>"
	if (this.dataSrc.getItemByKey(langId) != null) {
		str = str + this.dataSrc.getItemByKey(langId).Text
	}
	else{
		newDescr=new JSTranslation(langId, "" )
		this.dataSrc.addItem(newDescr.LNG_Id, newDescr)
		str = str + this.dataSrc.getItemByKey(langId).Text
	}
	str = str + "</textarea>"
	return str
}


//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//	End Of Implementations
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

function modifyDescr(value, langid){
	this.dataSrc.getItemByKey(langid).setDescription(value)
}
