function setFormValue(target, source, saveObj) {
	var tObj = document.getElementsByName(target)[0];
	var sObj = document.getElementsByName(saveObj)[0];
	var value = source.options[source.selectedIndex].value; 
	var text = source.options[source.selectedIndex].text; 
	var option = new Option(text, value, false, false);
	
	found = false;
	for(i=0; i<tObj.length; i++) {
		if(tObj.options[i].value == value) {
			found = true;
		}
	}
	
	if(!found) {
		tObj.options[tObj.length] = option;
	}
	
	tempValue = tObj.options[0].value;
	for(i=1; i<tObj.length; i++) {
		tempValue += ',' + tObj.options[i].value;
	}
	sObj.value = tempValue;
	
	source.selectedIndex = -1;
}

function delFormValue(target, saveObj) {
	var tObj = document.getElementsByName(target)[0];
	var sObj = document.getElementsByName(saveObj)[0];
	
	if(tObj.selectedIndex >= 0) {
		var value = tObj.options[tObj.selectedIndex].value;
		
		for(i=0; i<tObj.length; i++) {
			if(tObj.options[i].value == value) {
				tObj.options[i] = null;
				if(i==0) {
					tObj.selectedIndex = i;
				} else {
					tObj.selectedIndex = i-1;
				}	
			}
		}
	}
	
	if(tObj.length>0) {
		tempValue = tObj.options[0].value;
		for(i=1; i<tObj.length; i++) {
			tempValue += ',' + tObj.options[i].value;
		}
		sObj.value = tempValue;
	}
}

function deleteObjectConfirm(sObj, text) {
	check = confirm(text);

	if(check) {
		sObj.submit();
	}
}

function setActionValue(action, uid) {
	var tarAction = document.getElementsByName('tx_htwdownload_pi1[showcat][action]')[0];
	var tarUid = document.getElementsByName('tx_htwdownload_pi1[showcat][uid]')[0];
	
	tarAction.value = action;
	tarUid.value = uid;
}
