function bookmark(){
	if((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)){
		window.external.AddFavorite(location.href,document.title);
	} else {
		alert('Press CTRL + D to bookmark this page');
		document.write(msg);
	}
}
function help(div){
	var all = document.getElementsByTagName('div');
	for(i=0;i<all.length;i++){
		if(all[i].id != div){
			all[i].style.display = 'none';
		}
	}
	var obj = document.getElementById(div).style;
	obj.display = obj.display != 'block' ? 'block' : 'none';
}
function getInputObject(objtype, objprefix){
	var obj = document.getElementsByTagName('input');
	for (var i=0;i<obj.length;i++){
		if (obj[i].type==objtype){
			if (obj[i].id!=null){
				if (obj[i].id.indexOf(objprefix)>-1){
					return obj[i];
				}
			}
		}
	}
}
function getSelectObject(objprefix){
	var obj = document.getElementsByTagName('select');
	for (var i=0;i<obj.length;i++){
		if (obj[i].id!=null){
			if (obj[i].id.indexOf(objprefix)>-1){
				return obj[i];
			}
		}
	}
}
function duplicate(){
		//alert('test');
	if(_step3.ShipSame.checked){
		//alert('test2');
		_step3.ShipCompany.value = _step3.CustFirst.value +' '+ _step3.CustLast.value;
		_step3.ShipAddress.value = _step3.CustAddress.value;
		_step3.ShipCity.value = _step3.CustCity.value;
		//_step3.ShipState.value = _step3.CustState.value;
		//_step3.ShipZip.value = _step3.CustZip.value;
		//_step3.ShipCountry.value = _step3.CustCountry.value;
		
		getSelectObject('ShipStates').selectedIndex=getSelectObject('CustStates').selectedIndex;

		getSelectObject('ShipCountry').selectedIndex=getSelectObject('CustCountry').selectedIndex;

		getInputObject('text','ShipZip').value = _step3.CustZip.value;
	}else{
		//alert('test3');
		_step3.ShipCompany.value = '';
		_step3.ShipAddress.value = '';
		_step3.ShipCity.value = '';
		//step3.ShipState.value = _step3.ShipState.selectedIndex;
		getInputObject('text','ShipZip').value = '';
		getSelectObject('ShipStates').selectedIndex=0;
		//getSelectObject('CustStates').selectedIndex;

		getSelectObject('ShipCountry').selectedIndex=0;
		//getSelectObject('CustCountry').selectedIndex;

		//_step3.ShipCountry.value = _step3.ShipCountry.selectedIndex;
		//_step3.ShipType.value = _step3.ShipType.selectedIndex;
	}
}
function tab(input,len,e){
	if(input.value.length >= len){
		input.value = input.value.slice(0, len);
		input.form[(getIndex(input)+1) % input.form.length].focus();
	}
	function getIndex(input) {
		var index = -1, i = 0, found = false;
		while (i < input.form.length && index == -1)
		if (input.form[i] == input)index = i;
		else i++;
		return index;
	}
	return true;
}