gIBFbe_modeList = 'lst';		
gIBFbe_modeDetail = 'dtl';		
gIBFbe_sortorderup = 'DESC';
gIBFbe_sortorderdown = 'ASC';
gIBFbe_actionEmpty = '-';	
gIBFbe_actionInsert = 'ins';	
gIBFbe_actionInsertExit = 'insexit';
gIBFbe_actionUpdate = 'upd';	
gIBFbe_actionUpdateExit = 'updexit';
gIBFbe_actionDelete = 'del';	
gIBFbe_actionAddjump = 'addjump';
gIBFbe_actionListExport = 'listexport';
gIBFbe_actionReusekey = 'reusekey';
gIBFbe_validemail = '@email';
gIBFbe_validemails = '@emails';
gIBFbe_validdate = '@date';
gIBFbe_validdatetime = '@datetime';
var gIBFbemsg_sureDelete = 'Are you sure you want to delete this record?';
var gIBFbemsg_isRequired = 'field is required';
var gIBFbemsg_wrongDateformat = 'date format is wrong';
var gIBFbemsg_wrongEmailformat = 'email format is wrong';
var gIBFbemsg_validOnlyOneEmail = 'only one email can be specified';
var oWorkform= {
	init: function() {
		this.name='workform';
		this.prmprefix='';
	},
	setName: function(name) {
		this.name=name;
	},
	setPrmprefix: function(prmprefix) {
		this.prmprefix=prmprefix;
	},
	getForm: function() {
		return document.forms[this.name];
	},
	setMenuitem: function(menuitem) {
		document.forms[this.name].action = 'index.php?mi='+menuitem;
		document.forms[this.name].elements[this.prmprefix+'mi'].value=menuitem;
	},
	setMode: function (mode) {
		document.forms[this.name].elements[this.prmprefix+'md'].value=mode;
	},
	setPage: function (page) {
		document.forms[this.name].elements[this.prmprefix+'pg'].value=page;
	},
	setAction: function (action) {
		document.forms[this.name].elements[this.prmprefix+'ac'].value=action;
	},
	clearAction: function () {
		this.setAction(gIBFbe_actionEmpty);
	},
	setActionfield: function (actionfield) {
		document.forms[this.name].elements[this.prmprefix+'af'].value=actionfield;
	},
	getIkey: function() {
		return document.forms[this.name].elements[this.prmprefix+'ik'].value;
	},
	setIkey: function(ikey) {
		document.forms[this.name].elements[this.prmprefix+'ik'].value=ikey;
	},
	getSortfield: function () {
		return document.forms[this.name].elements[this.prmprefix+'sf'].value;
	},
	setSortfield: function (sortfield) {
		document.forms[this.name].elements[this.prmprefix+'sf'].value=sortfield;
	},
	setSortorder: function (sortorder) {
		document.forms[this.name].elements[this.prmprefix+'so'].value=sortorder;
	},
	toggleSortorder: function () {
		var tog = ((document.forms[this.name].elements[this.prmprefix+'so'].value==gIBFbe_sortorderdown)?gIBFbe_sortorderup:gIBFbe_sortorderdown);
		document.forms[this.name].elements[this.prmprefix+'so'].value=tog;
	},
	submit: function() {
		document.forms[this.name].submit();
	},
	parentListview: function() {
		document.forms[this.name].elements['md'].value=gIBFbe_modeList;
		this.submit();
	},
	getFormfield: function(fieldname) {
		return document.forms[this.name].elements[fieldname];
	},
	setFormfield: function(fieldname,value) {
		document.forms[this.name].elements[fieldname].value=value;
	},
	setFormAction: function(action) {
		document.forms[this.name].action=action;
	},
	getValue: function(fieldname,fieldtype) {
		var val='';
		var fld=document.forms[this.name].elements[fieldname];
		try {
			if (fieldtype=='CHECKBOX') {
				val = (fld.checked)?'true':'';
			} else {
				val = fld.value;
			}
		}
		catch (err) {
			val = '';
		}
		return val;
	},
	getValueType: function(fieldname) {
		var val='';
		var fld=document.forms[this.name].elements[fieldname];
		try {
			if (fld.length!=null) {
				for (i=0;i<fld.length;i++) {
					if ((fld[i].type!='checkbox' && fld[i].type!='radio') || fld[i].checked) {
						if (val!='') val+=';';
						val+=fld[i].value;
					}
				}
			} else {
				if (fld.type!='checkbox' && fld.type!='radio') {
					val = fld.value;					
				} else {
					val = (fld.checked)?fld.value:'';					
				}
			}
		}
		catch (err) {
			val = '';
		}
		return val;
	},
	setFocus: function(formfield) {
		var fld=document.forms[this.name].elements[fieldname];
		if (fld!=null) fld.focus();
	},
	end: function() {
		// afsluiten object 
	}
}
oWorkform.init();