function $(element) {
	if (typeof(element) == 'string') element = document.getElementById(element);
	return element;
}

function getSelectedOptionText(objSelect) {
	objSelect = $(objSelect);
	return objSelect.options[objSelect.options.selectedIndex].innerHTML;
}

function changeSelectOptions(objSelect, arrayValues, defaultOption) {
	objSelect = $(objSelect);
	var len=objSelect.options.length;
	for (var i=0; i<len; i++) {
		objSelect.remove(0);
	}

	var i = 0;
	if(typeof(defaultOption)=='undefined' || defaultOption==false) {}
	else {
		objSelect.options[i] = new Option(defaultOption,"");
		i ++;
	}

	for(var key in arrayValues) {
		if( arrayValues[key].length > 0) {
			objSelect.options[i] = new Option(arrayValues[key], key);
			i++;
		}
	}
}

function getCheckedRadioValue(group, form) {
	if (typeof group == 'string') group = form.elements[group];
	if (typeof group == "undefined" ) return null;
	if (typeof group.length == "undefined" ) {
		if(group.checked) return group.value;
		return null;
	}
	for (var i = 0, n = group.length; i < n; ++i)
	if (group[i].checked) return group[i].value;
	return null;
}

function getDateComponents(dateValue) {
	var components = dateValue.split(/[\/\.-]/);
	if(_DATE_FORMAT["0"]=="m") return {"month":components[0],"day":components[1], "year":components[2]};
	else return {"month":components[1],"day":components[0], "year":components[2]};
}