/*--------------------------------------------------------------------------*/
/* Common '$' extensions                                                    */
/*--------------------------------------------------------------------------*/
function $F(element) {
	var value = $(element).val();
	if (typeof(value) == 'string') {value = value.trim();}
	return value;
}

function $show(element) {
	return $(element).css('display', '');
}

function $hide(element) {
	return $(element).css('display', 'none');
}

function $toggle(element) {
	if ($(element).css('display') == 'none') {
		return $show(element);
	} else {
		return $hide(element);
	}		
}


/*--------------------------------------------------------------------------*/
// depenent ListBox
// ver 1.04 
/*--------------------------------------------------------------------------*/
function setDepenentlistbox(parentId, childId, valueArray) {

	var mainValue = $F('#parentId');
	childObject = $('#childId');

	//Clear child listbox
	for(var i=childObject.length;i>1;i--) {
		childObject.options[i] = null;
	}
	
	for (i=0; i < valueArray.length; i++) {
		if (childArray[i][1] == mainValue) {
			childObject.options[i+1] = new Option(valueArray[i][2], valueArray[i][0]);
		}
	}
	//Select first option
	childObject.selectedIndex = 0;
}