//- UpdateAcademicMajor -//
function UpdateAcademicMajor()
{
	var area = document.getElementById('AcademicAreaKey');
	var major = document.getElementById('AcademicArea_MajorKey');
	var nKey = parseInt(area.value);
	if (nKey > 0) {
		major.options.length = 0;
		major.options[0] = new Option('-- select --', '');
		var ai = 1;
		for (var i = 0; i < majorArray.length; i++) {
			var tArray = new Array();
			tArray = majorArray[i].split('|');
			if (parseInt(tArray[0]) == nKey)
			{
				major.options[ai] = new Option(tArray[2], tArray[1]);
				ai++;
			}
		}
	} else {
		major.options.length = 0;
	}
}
	
//- Console_AddRemove -//
function Console_AddRemove(oFromSet, oToSet, bIsAll) {
	//+ unselect
	for (var hOption = 0; hOption < oToSet.length; hOption++) {
		oToSet.options[hOption].selected = false;
	}
	//+ move
	for (hOption = oFromSet.length; hOption != 0; hOption--) {
		if ((bIsAll == true) || (oFromSet.options[hOption - 1].selected == true)) {
			oToSet.options[oToSet.length] = new Option(oFromSet.options[hOption - 1].text, oFromSet.options[hOption - 1].value, false, true);
			oFromSet.options[hOption - 1] = null;
		}
	}
}

//- Console_Pack -//
function Console_Pack(oSet, oField) {
	var cPack = '';
	for (var hOption = 0; hOption < oSet.length; hOption++) {
		cPack += ',' + oSet.options[hOption].value;
	}
	oField.value = cPack.substring(1);
}

//- DecodeZip -//
function DecodeZip(xZip) {
	var cZip = xZip.replace(/\?/g, '');
	return cZip;
}

//- DecodeFon -//
function DecodeFon(xFon) {
	var cFon = '';
	if (xFon.length >= 10) {
		cFon = xFon.substr(0, 3) + '-' + xFon.substr(3, 3) + '-' + xFon.substr(6, 4)
		if ((xFon.length == 15) && (xFon.substr(10, 5) != '?????')) {
			cFon += ' x' + xFon.substr(10, 5).replace(/\?/g, '');
		}
	}	
	return cFon;
}

//- ToggleImage -//
function SetImage(oImage, cImage) {
	oImage.src = cImage;
}

//- CheckEnter -//
function CheckEnter(oForm, cAction, e){
	var nCharacterCode;
	if (e && e.which) {
		e = e;
		nCharacterCode = e.which;
	} else {
		e = event;
		nCharacterCode = e.keyCode;
	}	 
	if(nCharacterCode == 13){
		oForm.Action.value = cAction;
		oForm.submit();
		return false;
	}
	return true;
}

//- ShowRow -// 
function ShowRow(cKey, bIsShow) { 
	var cRowStyleType = 'table-row';
	if (navigator.appName == 'Microsoft Internet Explorer') {
	 cRowStyleType = 'block';
	}
	if (bIsShow == true) {
		document.getElementById(cKey).style.display = cRowStyleType;
	} else {
		document.getElementById(cKey).style.display = 'none';
	}			  
}