
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


// get a collection of all elements matching a class name.
// for better speed, a second argument with tag name can be specified so only those tags will be iterated
document.getElementsByClassName = function(cl) {
	var tag = '*';
	if (arguments.length>1) tag = arguments[1];
	var retnode = [];
	var myclass = new RegExp('\\b'+cl+'\\b');
	var elem = this.getElementsByTagName(tag);
	for (var i = 0; i < elem.length; i++) {
		var classes = elem[i].className;
		if (myclass.test(classes)) retnode.push(elem[i]);
	}
	return retnode;
}


// adds/removes/swaps a class name in an object's className attribute. 
// a = action, o = the object, c1 = the first class name, c2= the second class name
function removeClassName(a,o,c1,c2) {
	switch (a){
		case 'swap':
			o.className=!jscss('check',o,c1)?o.className.replace(c2,c1):o.className.replace(c1,c2);
		break;
		case 'add':
			if(!jscss('check',o,c1)){o.className+=o.className?' '+c1:c1;}
		break;
		case 'remove':
			var rep=o.className.match(' '+c1)?' '+c1:c1;
			o.className=o.className.replace(rep,'');
		break;
		case 'check':
			return new RegExp('\\b'+c1+'\\b').test(o.className)
		break;
	}
}


function togglediv(d) {
	var c = document.getElementById(d);
	if (c.style.display=='none') {
		c.style.display = 'block';
	} else {
		c.style.display = 'none';
	}
}

function focusWindow(w) {
	w.focus();
}

function ValidateDate(d,m,y) {
	var o = new Date(y,m,d);
	if (o.getDate() != d) return false;
	return true;
}

function invert_all_chk(form_id, field_prefix) {
	for (i=0; i<document.forms[form_id].elements.length; i++) {
		if (document.forms[form_id].elements[i].name.indexOf(field_prefix) == 0) 
			document.forms[form_id].elements[i].checked=!document.forms[form_id].elements[i].checked;
	}
}

function invert_all_chk_byid(field_prefix) {
	var inputs = document.getElementsByTagName("input");
	for (i=0; i<inputs.length; i++) {
		if (inputs[i].id.indexOf(field_prefix) == 0)
			inputs[i].checked=!inputs[i].checked;
	}
}

/*function change_all_chk(form_id, field_prefix, fstate) {
	for (i=0; i<document.forms[form_id].elements.length; i++) {
		if (document.forms[form_id].elements[i].name.indexOf(field_prefix) == 0) document.forms[form_id].elements[i].checked=fstate;
	}
}
*/

function change_all_chk_byidprefix(field_prefix, fstate) {
	var inputs = document.getElementsByTagName("input");
	for (i=0; i<inputs.length; i++) {
		if (inputs[i].id.indexOf(field_prefix) == 0)
			inputs[i].checked = fstate;
	}
}

function change_all_chk_byclass(classname, state) {
	var inputs = document.getElementsByTagName('input');
	var i;
	for (i=0; i<inputs.length; i++) {
		if (inputs[i].className == classname) inputs[i].checked = state;
	}
}

function invert_one_chk_byid(id) {
	var o = document.getElementById(id);
	o.checked = !o.checked;
}

function InvertCheckboxById(id) {
	var o = document.getElementById(id);
	o.checked = !o.checked;
}

function SetCheckedOn(el) {
	document.getElementById(el).checked = true;
}



function getRealLeft(id) {
	var el = document.getElementById(id);
	var ol = el.offsetLeft;
	while ((el = el.offsetParent) != null) {
		ol += el.offsetLeft;
		if (el.clientLeft) ol += el.clientLeft;
	}
	return ol;
}
function getRealTop1(id) {
	var el = document.getElementById(id);
	var ol = el.offsetTop;
	while ((el = el.offsetParent) != null) {
		ol += el.offsetTop;
		if (el.scrollTop && el != document.body) ol -= el.scrollTop;
	}
	return ol;
}

// GET X COORDINATE
/*function getRealLeft(id) {
	var el = document.getElementById(id);
	if (el) { 
		var xPos = el.offsetLeft;
		var tempEl = el.offsetParent;
		while (tempEl != null) {
			xPos += tempEl.offsetLeft;
			tempEl = tempEl.offsetParent;
		} 
		return xPos;
	} else {
		return 0;
	}
}
*/
// GET Y COORDINATE
function getRealTop(id) {
	var el = document.getElementById(id);
	if (el) { 
		yPos = el.offsetTop;
		tempEl = el.offsetParent;
		while (tempEl != null) {
			yPos += tempEl.offsetTop;
			tempEl = tempEl.offsetParent;
		}
		return (yPos+1);
	} else {
		return 0;
	}
}


// get the index page Y scroll offset
function GetIndexYOffset() {
	var x,y;
	if (parent.window.pageYOffset) // all except Explorer
	{
		x = parent.window.pageXOffset;
		y = parent.window.pageYOffset;
	}
	else if (parent.window.document.documentElement && parent.window.document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		x = parent.window.document.documentElement.scrollLeft;
		y = parent.window.document.documentElement.scrollTop;
	}
	else if (parent.window.document.body) // all other Explorers
	{
		x = parent.window.document.body.scrollLeft;
		y = parent.window.document.body.scrollTop;
	}
	return y;
}

// get the client inner height of the browser
function GetPageClientHeight() {
	var x,y;
	if (parent.window.innerHeight) // all except Explorer
	{
		x = parent.window.innerWidth;
		y = parent.window.innerHeight;
	}
	else if (parent.window.document.documentElement && parent.window.document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = parent.window.document.documentElement.clientWidth;
		y = parent.window.document.documentElement.clientHeight;
	}
	else if (parent.window.document.body) // other Explorers
	{
		x = parent.window.document.body.clientWidth;
		y = parent.window.document.body.clientHeight;
	}
	return y;
}

// get the client inner width of the browser
function GetPageClientWidth() {
	var x,y;
	if (parent.window.innerHeight) // all except Explorer
	{
		x = parent.window.innerWidth;
		y = parent.window.innerHeight;
	}
	else if (parent.window.document.documentElement && parent.window.document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = parent.window.document.documentElement.clientWidth;
		y = parent.window.document.documentElement.clientHeight;
	}
	else if (parent.window.document.body) // other Explorers
	{
		x = parent.window.document.body.clientWidth;
		y = parent.window.document.body.clientHeight;
	}
	return x;
}

function GetPageSize(){
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

function GetPageYSize() {
	var pagesize = GetPageSize();
	return pagesize[1];
}


function toggledivonoff(d, state) {
	var c = document.getElementById(d);
	if (state) {
		c.style.display = 'block';
	} else {
		c.style.display = 'none';
	}
}

function showhidediv(d, state) {
	var c = document.getElementById(d);
	if (state) {
		c.style.display = 'block';
	} else {
		c.style.display = 'none';
	}
}

function showhidedivobj(o, state) {
	if (state) {
		o.style.display = 'block';
	} else {
		o.style.display = 'none';
	}
}


// -------- functions needed for table module
function change_all_chk(form_id, field_prefix, fstate) {
	for (i=0; i<document.forms[form_id].elements.length; i++) {
		if (document.forms[form_id].elements[i].name.indexOf(field_prefix) == 0) document.forms[form_id].elements[i].checked=fstate;
	}
}

// deselects all checkboxes of given prefix, except the one that was clicked
function chk_single_byprefix(prefix, e) {
	if (!e) var e = window.event;   // IE
	var target;
	if (e.target) target = e.target;
	else if (e.srcElement) target = e.srcElement;
	
	var inputs = document.getElementsByTagName("input");
	var i;
	for (i=0; i<inputs.length; i++) {
		if (inputs[i].name.indexOf(prefix) == 0) inputs[i].checked = false;
	}
	target.checked = true;
}

function togglefilterdiv(m) {
	//var imgid = 'imgFilter_'+m;
	var divid = 'divFilter_'+m;
	//var divref = document.getElementById(divid);
	
	//var imx = getRealLeft(imgid);
	//var imy = getRealTop(imgid);
	
	//divref.style.left = imx-640+'px';
	//divref.style.top = imy+12+'px';

	//togglediv(divid);
	$jq("#"+divid).slideToggle("medium");
	
	return false;
}

// Adds a row to a filter table
function addRowDOMFilter(tableID) {
// pass every cell content as a futher arg
  var table = document.getElementById(tableID);
  if (arguments.length > 1) {
	var row = table.insertRow(table.rows.length);
	if (document.getElementById) {
	  for (var i = 1; i < arguments.length; i++) {
		var cell = row.insertCell(i - 1);
		if (i == 1) cell.style.textAlign = 'right';
		
		cell.innerHTML = arguments[i];
	  }  // for
	}
  }
}

// removes a row from a table with id
function removeRowFromTable(tableID, rowNum)
{
	var tbl = document.getElementById(tableID);
	tbl.deleteRow(rowNum);   // zero based
//  var lastRow = tbl.rows.length;
}

// removes a row from a filter table
function removeRowFromFilterTable(moduleID, rowID)
{
	var tbl = document.getElementById('tableFilter_'+moduleID);
	var k = 0;
	// search for the element
	for (i=0; i<document.forms['form_filtering_'+moduleID].elements.length; i++) {
		c = document.forms['form_filtering_'+moduleID].elements[i];
		if ( c.id.indexOf('lstFilterFields_'+moduleID) != -1 ) {   // increment row number only for a row in filter table
			k++;
		}
		if ( c.id.indexOf('btnRemoveCondition_'+moduleID+'_'+rowID) != -1 ) {   // found
			tbl.deleteRow(k);
		}
	}
}
// --------- end of functions needed for table module

function SetChkOn(chk) {
	document.getElementById(chk).checked = true;
}



//var divNoticeBoxesRemovable = new Array();   // holds notice boxes ids to be auto removed by tab switches

// a third argument of true indicates that no status boxes should be removed (e.g. called by page loading or so)
/*
function TabSwitch(d,n) {
	var IDbuttons = "TabButton_";
	var IDcontents = "divTabContents_";
	var i;
	for (i=1; i<=n; i++) {
		if (document.getElementById(IDcontents+i)) {
			showhidediv(IDcontents+i, false);
			document.getElementById(IDbuttons+i).className = '';
			document.getElementById(IDbuttons+i).blur();
		}
	}
	if (d>0) {   // pass 0 to d for no active button
		showhidediv(IDcontents+d, true);
		document.getElementById(IDbuttons+d).className = 'act';
	}
}
*/


function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}



// ---------------------------- cookies management -------------------------------
function writeCookie(name,value,days,path) {
	var expires = "";
	var cpath = "; path=/";
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		expires = "; expires="+date.toGMTString();
	}
	if (path) {
		cpath = "; path=" + path;
	}
	document.cookie = name + "=" + value + expires + cpath;
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for (var i=0; i<ca.length; i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return false;
}

function deleteCookie(name) {
	writeCookie(name, "", -1);
}
// ----------------------------------------------------------------------



function add_select_option(selectid, stext, svalue) {
	var o = document.getElementById(selectid);
	var sellen = o.options.length;
	var newOption = new Option(stext, svalue);
	var saveInd = o.selectedIndex;
	o.options[sellen] = newOption;
	o.selectedIndex = saveInd;
}

function remove_select_option(lst, value) {
	var el = document.getElementById(lst);
	for (i = el.length-1; i >= 0; i--) {
		if (el.options[i].value == value) el.options[i] = null;
	}
}

function copyMultipleSelectOptions(lstSrc, lstDst) {
	var elsrc = document.getElementById(lstSrc);
	var eldst = document.getElementById(lstDst);
	
	for (i = 0; i < elsrc.length; i++) {
		if ( elsrc.options[i].selected ) {
			// check if option already added
			var exists = false;
			for (j = 0; j < eldst.length; j++) {
				if (eldst.options[j].value == elsrc.options[i].value) exists = true;
			}
			if (!exists) add_select_option(lstDst, elsrc.options[i].text, elsrc.options[i].value);
		}
	}
}

function removeMultipleSelectOptions(lst) {
	var el = document.getElementById(lst);
	for (i = el.length-1; i >= 0; i--) {
		if (el.options[i].selected) el.options[i] = null;
	}
}

function removeMultipleSelectOptionsWithCallback(lst,c) {
	var el = document.getElementById(lst);
	for (i = el.length-1; i >= 0; i--) {
		if (el.options[i].selected) {
			c(el.options[i].value);
			el.options[i] = null;
		}
	}
}

function emptySelectOptions(lst) {
	var el = document.getElementById(lst);
	for (i = el.length-1; i >= 0; i--) {
		el.options[i] = null;
	}
}

function listSelectAll(listid) {
	var el = document.getElementById(listid);
	for (i = 0; i < el.length; i++) {
		el.options[i].selected = true;
	}
}


// ------ BROWSER DETECTION OBJECT
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();




/**
*
*  URL encode / decode
*  http://www.webtoolkit.info/
*
**/
 
var UrlCodec = {
	// public method for url encoding
	encode : function (string) {
		return escape(this._utf8_encode(string));
	},
 
	// public method for url decoding
	decode : function (string) {
		return this._utf8_decode(unescape(string));
	},
 
	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
 
		for (var n = 0; n < string.length; n++) {
			var c = string.charCodeAt(n);
 
			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
		}
 
		return utftext;
	},
 
	// private method for UTF-8 decoding
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;
 
		while ( i < utftext.length ) {
			c = utftext.charCodeAt(i);

			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}
		}
 
		return string;
	}
}




function HideSelects() {
	var i;
	var selects = document.getElementsByTagName("select");
	for (i=0; i<selects.length; i++) {
		selects[i].style.visibility = "hidden";
	}
}
function ShowSelects() {
	var i;
	var selects = document.getElementsByTagName("select");
	for (i=0; i<selects.length; i++) {
		selects[i].style.visibility = "visible";
	}
}

function ShowCoverDiv() {
	var obj = document.getElementById('divPageCover');
	var pagesizes = GetPageSize();
	//obj.style.width = pagesizes[2]+'px';
	obj.style.height = pagesizes[1]+'px';
	HideSelects();
	obj.style.display = 'block';
}
function HideCoverDiv() {
	var obj = document.getElementById('divPageCover');
	ShowSelects();
	obj.style.display = 'none';
}


// escape autocomplete for form fields
var autocomplete_entries_to_disable;
function disable_autocomplete_tmout(f) {
	var i;
	for (i=0; i<f.length; i++) {
		document.getElementById(f[i]).value = '';
	}
}
function disable_autocomplete(f) {
	autocomplete_entries_to_disable = f;
	window.setTimeout("disable_autocomplete_tmout(autocomplete_entries_to_disable)", 200);
}



// generate random number in range start-end
function GenerateRandomNumber(start, end) {
	return (Math.floor((end-start) * Math.random()) + start);
}




/* -------------------- Textarea manipulation routines ---------------------- */
function setSelectionRange(input, selectionStart, selectionEnd) {
  if (input.setSelectionRange) {
	input.focus();
	input.setSelectionRange(selectionStart, selectionEnd);
  }
  else if (input.createTextRange) {
	var range = input.createTextRange();
	range.collapse(true);
	range.moveEnd('character', selectionEnd);
	range.moveStart('character', selectionStart);
	range.select();
  }
}

function setCaretToEnd (input) {
	setSelectionRange(input, input.value.length, input.value.length);
}

function setCaretToBegin (input) {
	setSelectionRange(input, 0, 0);
}

function setCaretToPos (input, pos) {
	setSelectionRange(input, pos, pos);
}

// Inserts a text into a textarea at the cursor, or in place of a selection
// tagSymbolsOffset - number of symbols added to selection, needed to move caret to end of selection+tags
function insertAtCursor(myField, myValue, tagSymbolsOffset) {
  //IE support
  if (document.selection) 
  {
	myField.focus();
	sel = document.selection.createRange();
	sel.text = myValue;
	sel.scrollIntoView();
	sel.select();
	sel.collapse(false);
  }
  //MOZILLA/NETSCAPE support
  else if (myField.selectionStart || myField.selectionStart == '0') 
  {
	var startPos = myField.selectionStart;
	var endPos = myField.selectionEnd;
	myField.value = myField.value.substring(0, startPos)
				  + myValue 
				  + myField.value.substring(endPos, myField.value.length);
	setCaretToPos(myField, endPos + tagSymbolsOffset);
  } 
  else 
  {
	myField.value += myValue;
	setCaretToEnd(myField);
  }
}

function getSel(myfield) {
	if (document.selection) {
		return document.selection.createRange().text; 
	}
	else if (myfield.selectionEnd) {
		startPos = 0; endPos = 0;
		startPos = myfield.selectionStart;
		endPos = myfield.selectionEnd;
		if (startPos != endPos) {
			fldtext = myfield.value;
			return fldtext.substr(startPos, endPos-startPos);
		} else {
			return '';
		}
	}
	else {
		return;
	};
}

function taReplaceSelection(f,t) {
	var s = getSel(f);
	s = t;
	insertAtCursor(f, s, s.length);
}

function InsertEmoticon(fldid,t) {
	var fld = document.getElementById(fldid);
	taReplaceSelection(fld, t);
	fld.focus();
}

/* ------------------------------------------------------------------------------------- */






function EF_AMTO_Assign(src, dst) {
	copyMultipleSelectOptions(src, dst);
}
function EF_AMTO_Unassign(lst) {
	removeMultipleSelectOptions(lst);
}


function EF_AMTM_Assign(id) {
	copyMultipleSelectOptions("EF_AMTM_SOURCE_"+id, "EF_AMTM_DEST_"+id);
	if (document.getElementById("inpEFManyToManyChanged_"+id))
		document.getElementById("inpEFManyToManyChanged_"+id).value = "1";   // flag the component as changed
}
function EF_AMTM_Unassign(id) {
	removeMultipleSelectOptions("EF_AMTM_DEST_"+id);
	if (document.getElementById("inpEFManyToManyChanged_"+id))
		document.getElementById("inpEFManyToManyChanged_"+id).value = "1";   // flag the component as changed
}







