function viewConfig() {
	window.open('http://config.amstron.com/','config','width=680,height=640,scrollbars=yes');
}

function loadBrands() {
	var ind = document.configurator.CatName.selectedIndex;	
	if (ind > 0) {
		document.getElementById('div_brand_0').className = 'hideGrp';
		document.getElementById('div_brand').className = 'showGrp';
		document.getElementById('B').focus();
	}
	else {
		document.getElementById('div_brand_0').className = 'showGrp';
		document.getElementById('div_brand').className = 'hideGrp';
	}
	document.getElementById('div_model_0').className = 'showGrp';
	document.getElementById('div_model').className = 'hideGrp';
	document.configurator.M.length = 0;
	document.configurator.M.options[0] = new Option('select model ...');
	document.configurator.B.length = 0;
	document.configurator.B.options[0] = new Option('select brand ...');
	if (ind == 1) {
		for (var i = 0; i < camcorder_brands.length; i++) {
			document.configurator.B.options[i+1] = new Option(camcorder_brands[i]);
		}
	}
	else if (ind == 2) {
		for (var i = 0; i < cellular_brands.length; i++) {
			document.configurator.B.options[i+1] = new Option(cellular_brands[i]);
		}	
	}
	else if (ind == 3) {
		for (var i = 0; i < cordless_brands.length; i++) {
			document.configurator.B.options[i+1] = new Option(cordless_brands[i]);
		}	
	}
	else if (ind == 4) {
		for (var i = 0; i < digitalcamera_brands.length; i++) {
			document.configurator.B.options[i+1] = new Option(digitalcamera_brands[i]);
		}	
	}
	else if (ind == 5) {
		for (var i = 0; i < laptop_brands.length; i++) {
			document.configurator.B.options[i+1] = new Option(laptop_brands[i]);
		}	
	}
	else if (ind == 6) {
		for (var i = 0; i < pda_brands.length; i++) {
			document.configurator.B.options[i+1] = new Option(pda_brands[i]);
		}	
	}
	else if (ind == 7) {
		for (var i = 0; i < ups_brands.length; i++) {
			document.configurator.B.options[i+1] = new Option(ups_brands[i]);
		}	
	}
	else if (ind == 8) {
		for (var i = 0; i < powertools_brands.length; i++) {
			document.configurator.B.options[i+1] = new Option(powertools_brands[i]);
		}	
	}
	else if (ind == 9) {
		for (var i = 0; i < scanner_brands.length; i++) {
			document.configurator.B.options[i+1] = new Option(scanner_brands[i]);
		}	
	}	
	else if (ind == 10) {
		for (var i = 0; i < dvdplayer_brands.length; i++) {
			document.configurator.B.options[i+1] = new Option(dvdplayer_brands[i]);
		}	
	}	
	else if (ind == 11) {
		for (var i = 0; i < gameplayer_brands.length; i++) {
			document.configurator.B.options[i+1] = new Option(gameplayer_brands[i]);
		}	
	}	
	else if (ind == 12) {
		for (var i = 0; i < mp3_brands.length; i++) {
			document.configurator.B.options[i+1] = new Option(mp3_brands[i]);
		}	
	}	
	else if (ind == 13) {
		for (var i = 0; i < sla_brands.length; i++) {
			document.configurator.B.options[i+1] = new Option(sla_brands[i]);
		}	
	}	
}

function loadModels() {
	var cat = document.configurator.CatName.selectedIndex;
	var ind = document.configurator.B.selectedIndex;
	if (ind > 0) {
		document.getElementById('div_model_0').className = 'hideGrp';
		document.getElementById('div_model').className = 'showGrp';
		document.getElementById('M').focus();
	}
	else {
		document.getElementById('div_model_0').className = 'showGrp';
		document.getElementById('div_model').className = 'hideGrp';
	}
	ind = ind - 1
	if (ind >= 0) {
		document.configurator.M.length = 0;
		document.configurator.M.options[0] = new Option('select model ...');
		if (cat == 1) {
			for (var i = 0; i < camcorder_models[ind].length; i++) {
				document.configurator.M.options[i+1] = new Option(camcorder_models[ind][i]);
			}
		}
		else if (cat == 2) {
			for (var i = 0; i < cellular_models[ind].length; i++) {
				document.configurator.M.options[i+1] = new Option(cellular_models[ind][i]);
			}	
		}
		else if (cat == 3) {
			for (var i = 0; i < cordless_models[ind].length; i++) {
				document.configurator.M.options[i+1] = new Option(cordless_models[ind][i]);
			}	
		}
		else if (cat == 4) {
			for (var i = 0; i < digitalcamera_models[ind].length; i++) {
				document.configurator.M.options[i+1] = new Option(digitalcamera_models[ind][i]);
			}	
		}
		else if (cat == 5) {
			for (var i = 0; i < laptop_models[ind].length; i++) {
				document.configurator.M.options[i+1] = new Option(laptop_models[ind][i]);
			}	
		}
		else if (cat == 6) {
			for (var i = 0; i < pda_models[ind].length; i++) {
				document.configurator.M.options[i+1] = new Option(pda_models[ind][i]);
			}	
		}
		else if (cat == 7) {
			for (var i = 0; i < ups_models[ind].length; i++) {
				document.configurator.M.options[i+1] = new Option(ups_models[ind][i]);
			}	
		}
		else if (cat == 8) {
			for (var i = 0; i < powertools_models[ind].length; i++) {
				document.configurator.M.options[i+1] = new Option(powertools_models[ind][i]);
			}	
		}
		else if (cat == 9) {
			for (var i = 0; i < scanner_models[ind].length; i++) {
				document.configurator.M.options[i+1] = new Option(scanner_models[ind][i]);
			}	
		}
		else if (cat == 10) {
			for (var i = 0; i < dvdplayer_models[ind].length; i++) {
				document.configurator.M.options[i+1] = new Option(dvdplayer_models[ind][i]);
			}	
		}
		else if (cat == 11) {
			for (var i = 0; i < gameplayer_models[ind].length; i++) {
				document.configurator.M.options[i+1] = new Option(gameplayer_models[ind][i]);
			}	
		}
		else if (cat == 12) {
			for (var i = 0; i < mp3_models[ind].length; i++) {
				document.configurator.M.options[i+1] = new Option(mp3_models[ind][i]);
			}	
		}
		else if (cat == 13) {
			for (var i = 0; i < sla_models[ind].length; i++) {
				document.configurator.M.options[i+1] = new Option(sla_models[ind][i]);
			}	
		}
	}
}	
function goTo(pagename) {
	if (pagename.options[pagename.selectedIndex].value != 'null') {
		location.href=pagename.options[pagename.selectedIndex].value;
	}
	//else {
	//	alert('Please make a selection ...');
	//}
	return true;
}

function winPop(url,width,height) {

        // Use to pop a new window with no browser buttons

        if (url != null) {

                if (width == null) width = 640;

                if (height == null) height = 480;

                var atts = "width=" + (width + 15) + ",height=" + (height + 15) + ",resizable,scrollbar,scrollbars";

                var newwin = window.open(url, "newwin", atts);

                newwin.focus();

                }

}

function openDISC(url,target,spec) {
	window.open(url, target, spec);
}

function showSearch() {
	document.getElementById('div_Search').className = 'showGrp';
	document.getElementById('div_Login').className = 'hideGrp';
	document.getElementById('div_Contact').className = 'hideGrp';
}
function showLogin() {
	document.getElementById('div_Search').className = 'hideGrp';
	document.getElementById('div_Login').className = 'showGrp';
	document.getElementById('div_Contact').className = 'hideGrp';
}
function showContact() {
	document.getElementById('div_Search').className = 'hideGrp';
	document.getElementById('div_Login').className = 'hideGrp';
	document.getElementById('div_Contact').className = 'showGrp';
}

function doCheckout(obj) {
	obj.txtcheckout.value = '1';
	//alert(obj.txtcheckout.value);
	obj.submit();
	//return true;
}
function completeShipping(obj) {
  if (obj.billandship.checked) {
		obj.shipfirstname.value = obj.firstname.value;
		obj.shiplastname.value = obj.lastname.value;
		obj.shipcompany.value = obj.company.value;
		obj.shipaddress.value= obj.address.value;
		obj.shipsuite.value = obj.suite.value;
		obj.shipcity.value = obj.city.value;
		obj.shipstate.value = obj.state.value;
		obj.shipzip.value = obj.zip.value;
		obj.shipcountry.value = obj.country.value;
		obj.shipphone.value = obj.phone.value;
	}
	else {
		obj.shipfirstname.value = '';
		obj.shiplastname.value = '';
		obj.shipcompany.value = '';
		obj.shipaddress.value = '';
		obj.shipsuite.value ='';
		obj.shipcity.value ='';
		obj.shipstate.value = '';
		obj.shipzip.value = '';
		obj.shipcountry.value = 'United States';
		obj.shipphone.value = '';
	}
  return true;
}
function backTo (url) {
	window.opener.location.href = url;
	window.close();
	//return true;
}

if(document.getElementById) {
	var upLevel = true;
	}
else if(document.layers) {
	var ns4 = true;
	}
else if(document.all) {
	var ie4 = true;
	}

function showObject(obj) {
	if (ns4) obj.visibility = "show";
	else if (ie4 || upLevel) obj.style.visibility = "visible";
	}
function hideObject(obj) {
	if (ns4) {
		obj.visibility = "hide";
		}
	if (ie4 || upLevel) {
		obj.style.visibility = "hidden";
		}
	}

function product_tm(str, num) {
	for (var i = 0; i <=num; i++) {
		if (i == str) {
			document.getElementById('div_image' + i).className = 'showGrp';
			document.getElementById('id_product_tm' + i).className = 'img_tm_1';
		}
		else {
			document.getElementById('div_image' + i).className = 'hideGrp';
			document.getElementById('id_product_tm' + i).className = 'img_tm';
		}		
	}
}

function move(str) {
	var arr_cat_img = new Array (
			'aa-rechargers',
			'camcorder', 
			'cellular', 
			'digital-camera', 
			'dvd-player', 
			'game-player', 
			'laptop', 
			'mp3', 
			'pda', 
			'power-tools', 
			'scanner', 
			'two-way', 
			'ups', 
			'universal_external_batteries');
	var arr_cat_title = new Array (
			'<a href="/aa_batteries.asp" title="Eco-Friendly Power Solutions">Eco-Friendly Power Solutions</a>', 
			'<a href="/products/camcorder.asp" title="Camcorder Batteries">Camcorder Batteries</a>', 
			'<a href="/products/cellular.asp" title="Cell Phones Batteries">Cell Phones Batteries</a>',
			'<a href="/products/digital-camera.asp" title="Digital Camera Batteries" >Digital Camera Batteries</a>',
			'<a href="/products/dvd-player.asp" title="DVD Player Batteries">DVD Player Batteries</a>',
			'<a href="/products/game-player.asp" title="Game Player Batteries">Game Player Batteries</a>',
			'<a href="/products/laptop.asp" title="Laptop Batteries">Laptop Batteries</a>',
			'<a href="/products/mp3.asp" title="MP3 Player Batteries">MP3 Player Batteries</a>', 
			'<a href="/products/pda.asp" title="PDA Batteries">PDA Batteries</a>', 
			'<a href="/products/power-tools.asp" title="Power Tools Batteries">Power Tools Batteries</a>', 
			'<a href="/products/scanner.asp" title="Scanner Batteries">Scanner Batteries</a>',
			'<a href="/products/two-way.asp" title="Two Way Radio Batteries">Two Way Radio Batteries</a>',
			'<a href="/products/sla.asp" title="Sealed Lead Acid Batteries">Sealed Lead Acid Batteries</a>', 
			'<a href="/external-battery.asp" title="Universal External Batteries">Universal External Batteries</a>');

	var arr_cat_link = new Array (
			'/aa_batteries.asp', 
			'/products/camcorder.asp', 
			'/products/cellular.asp',
			'/products/digital-camera.asp',
			'/products/dvd-player.asp',
			'/products/game-player.asp',
			'/products/laptop.asp',
			'/products/mp3.asp', 
			'/products/pda.asp', 
			'/products/power-tools.asp', 
			'/products/scanner.asp',
			'/products/two-way.asp',
			'/products/sla.asp', 
			'/external-battery.asp');

	var sIdx = 0;
	sIdx = parseInt(document.getElementById('img_idx_0').value);

	if (str == 'R') {
		sIdx = sIdx + 1;
		if (sIdx > arr_cat_img.length-1) {
			sIdx = 0;
		}
	} else {
		sIdx = sIdx -1;
		if (sIdx < 0) {
			sIdx = arr_cat_img.length-1
		}
	}
	for (var j = 0; j < 5 ; j++ ) {
		var tempIdx = sIdx + j;
		if (tempIdx > arr_cat_img.length -1) {
			//tempIdx = tempIdx - (arr_cat_img.length -1);
			tempIdx = tempIdx - arr_cat_img.length;
		}
		document.getElementById('cat_img_' + j).src = '/pics/home/category/' + arr_cat_img[tempIdx] + '.jpg';
		document.getElementById('img_idx_' + j).value = tempIdx;
		document.getElementById('title_' + j).innerHTML = arr_cat_title[tempIdx];
		document.getElementById('link_' + j).href = arr_cat_link[tempIdx];	

	}
}

function acc_view(str) {
	if (str == 0) {
	document.getElementById('div_acc_0').className = 'showGrp';
	document.getElementById('div_acc_1').className = 'hideGrp';
	document.getElementById('div_acc_tbl_0').className = 'showGrp';
	document.getElementById('div_acc_tbl_1').className = 'hideGrp';
	}
	else if (str == 1) {
	document.getElementById('div_acc_0').className = 'hideGrp';
	document.getElementById('div_acc_1').className = 'showGrp';
	document.getElementById('div_acc_tbl_0').className = 'hideGrp';
	document.getElementById('div_acc_tbl_1').className = 'showGrp';
	}
}