
var space_img = new Image(); space_img.src="img/space.gif";
var no_img = new Image();    no_img.src="img/no_img.jpg";

//OPTIONクリア
function clear_select_option(select_obj) {
	select_obj.options.length = 0;
}
//OPTION追加
function add_select_option(select_obj, value, label, selected) {
	var option = document.createElement("option");
	option.value=value;
	option.text=label;
	option.selected = selected;
	try {
		select_obj.add(option, null);
	}catch(e) {
		select_obj.add(option);
	}
}
//OPTION削除
function rm_select_option(select_obj, value) {
	for (var i = 0; i < select_obj.options.length; i++) {
		if (select_obj.options[i].value == value) {
			select_obj.remove(i);
			break;
		}
	}
}
//OPTION選択
function select_option(select_obj, value) {
	for (var i = 0; i < select_obj.options.length; i++) {
		if (select_obj.options[i].value == value) {
			select_obj.options[i].selected = true;
			break;
		}
	}
}
//選択されているOPTIONを取得
function get_selected_option(select_obj) {
	if(select_obj.type=="select-multiple") {
		var selected_options = new Array();
		for (var i = 0; i < select_obj.options.length; i++) {
			if (select_obj.options[i].selected)
				selected_options.push(select_obj.options[i]);
		}
		return selected_options;
	}
	else {
		for (var i = 0; i < select_obj.options.length; i++) {
			if (select_obj.options[i].selected)
				return select_obj.options[i];
		}
		if(select_obj.options.length > 0)
			return select_obj.options[0];
	}
}

