
	//- 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);
	}

	//- DirtyTool -//
	function DirtyTool(cTool) {
		var oTool = document.getElementById('Tool' + cTool);
		if (oTool != null) {
			oTool.IsDirty = true;
			var c = new String(oTool.onerror);
			oTool.src = c.match(/.*\"(.*)\".*/)[1];
			oTool.onmouseover = null;
			oTool.onmouseout = null;
		}
	}
	
	//- CopyBillingToShipping -//
	function CopyBillingToShipping(oForm) {
		oForm['ShippingName'].value = oForm.BillingName.value;
		oForm['ShippingAttention'].value = oForm.BillingAttention.value;
		oForm['ShippingStreet'].value = oForm.BillingStreet.value;
		oForm['ShippingStreet2'].value = oForm.BillingStreet2.value;
		oForm['ShippingCity'].value = oForm.BillingCity.value;
		var cState = oForm.BillingState.value;
		var o = oForm['ShippingState'];
		for (var h = 0; h < o.options.length; h++) {
			if (o.options[h].value == cState) {
				oForm['ShippingState'].selectedIndex = h;
			}
		}
		oForm['ShippingZip'].value = oForm.BillingZip.value;
	//	oForm['ShippingPhone'].value = null;
	}

	//- CopyShippingToBilling -//
	function CopyShippingToBilling(oForm) {
		oForm['BillingStreet'].value = oForm.ShippingStreet.value;
		oForm['BillingStreet2'].value = oForm.ShippingStreet2.value;
		oForm['BillingCity'].value = oForm.ShippingCity.value;
		var cState = oForm.ShippingState.value;
		var o = oForm['BillingState'];
		for (var h = 0; h < o.options.length; h++) {
			if (o.options[h].value == cState) {
				oForm['BillingState'].selectedIndex = h;
			}
		}
		oForm['BillingZip'].value = ExportZip(oForm.ShippingZip.value);
	//	oForm['BillingEmail'].value = null;
	}
	
	//- IfEnterAction -//
	function IfEnterAction(oForm, cAction, cSelId){
		if ((EventKeyCode() == 13) || (EventKeyCode() == 3)) {
			oForm.Action.value = cAction;
			oForm.SelId.value = cSelId;
			oForm.submit();
			return false;
		}
		return true;
	}

	//- IfEnterScript -//
	function IfEnterScript(cScript) {
		if ((EventKeyCode() == 13) || (EventKeyCode() == 3)) {
			eval(cScript);
			return false;
		}
		return true;
	}

	//- EventKeyCode -//
	function EventKeyCode() {
		return ((event != null) && (event.which != null) ? event.which : event.keyCode);
	}

	//- AutoTab -//
	function AutoTab(cInput, nSize, cEvent) {	
		var bIsNetscape = (navigator.appName.indexOf("Netscape") != -1);
		var cKey = (bIsNetscape) ? cEvent.which : cEvent.keyCode; 
		var cKeyArray = (bIsNetscape) ? [0,8,9,16] : [0,8,9,16,17,18,37,38,39,40,46];
		if ((cInput.value.length >= nSize) && (!GetElement(cKeyArray, cKey))) {
			cInput.value = cInput.value.slice(0, nSize);			
			if (cInput.form[(GetIndex(cInput) + 1)].type != 'hidden') {
				cInput.form[(GetIndex(cInput) + 1) % cInput.form.length].focus();
			}
		}
		function GetElement(cKeyArray, cKey) {
			var bIsExist = false;
			var nToken = 0;
			while(!bIsExist && nToken < cKeyArray.length) {
				if(cKeyArray[nToken] == cKey) {
					bIsExist = true;
				} else {
					nToken++;
				}
			}
			return bIsExist;
		}
		function GetIndex(cInput) {
			var nIndex = -1;
			var nToken = 0;
			while (nToken < cInput.form.length && nIndex == -1) {
				if (cInput.form[nToken] == cInput) {
					nIndex = nToken;
				} else {
					 nToken++;
				}	
			}
			return nIndex;
		}
		return true;
	}	
