		function writePostBack(formid, varname, value, encodeType){
			//set a value in form field, and create it, if it doesn't exists
			var command = "document.getElementById('" + formid + "')." + varname;
			var result 

			//evaluate exitance of field.
			result = eval(command);

			//write field.
			if ((result==undefined))
			{
			}
			else{
				if (encodeType=="b64"){
					var type = "";
					var field = "document.getElementById('" + formid + "')." + varname
					eval("type = " + field + ".type");
	
					if (type == "text")
						command = "document.getElementById('" + formid + "')." + varname + ".value = r2s('" + value + "')";
					else if (type == "textarea")
						command = "document.getElementById('" + formid + "')." + varname + ".value = r2s('" + value + "')";
					else if (type == "select-one")
						command = "document.getElementById('" + formid + "')." + varname + ".value = r2s('" + value + "')";
					else if (type == "checkbox")
						command = "document.getElementById('" + formid + "')." + varname + ".checked = r2s('" + value + "')";
					else{
						//alert(varname + " = " + type + " : value = " + r2s(value));
						command = "document.getElementById('" + formid + "')." + varname + ".value = r2s('" + value + "')";
					}
				}
				else{
					var type = "";
					var field = "document.getElementById('" + formid + "')." + varname
					eval("type = " + field + ".type");
	
					if (type == "text")
						command = "document.getElementById('" + formid + "')." + varname + ".value = '" + value + "'";
					else if (type == "textarea")
						command = "document.getElementById('" + formid + "')." + varname + ".value = '" + value + "'";
					else if (type == "select-one")
						command = "document.getElementById('" + formid + "')." + varname + ".value = '" + value + "'";
					else if (type == "checkbox")
						command = "document.getElementById('" + formid + "')." + varname + ".checked = '" + value + "'";
					else{
						//alert(varname + " = " + type + " : value = " + r2s(value));
						command = "document.getElementById('" + formid + "')." + varname + ".value = '" + value + "'";
					}
				}
				
				command = command .replace('\n',"\\\n");
				command = command .replace('\r',"\\\r");
				eval(command);
			}
		}