//////////////////////////////////////////////
// Common javascript function
// common.js
// COPYRIGHT ARCANTEL 2002
// Last modified : Jun 2002
//////////////////////////////////////////////

function FillForm(formElement, elementValue) {
	// alert( formElement.type );
	switch ( formElement.type ) {
		case 'select-one':
			FillFormSelectOne(formElement, elementValue);
			return 1;
		case 'text':
			FillFormText(formElement, elementValue);
			return 1;
		case 'submit':
			FillFormSubmit(formElement, elementValue);
			return 1;
	}
}

function FillFormSelectOne(formElement, elementValue) {
	var elementOptions = formElement.options;
	for (var i=0; i<elementOptions.length; i++) {
		if (elementOptions[i].value == elementValue) {
			elementOptions[i].selected = true;
		}
	}
}

function FillFormText(formElement, elementValue) {
	formElement.value = elementValue;
}

function FillFormSubmit(formElement, elementValue) {
	if ( elementValue == 0 ) { formElement.disabled = true; }
}
