//
//
// START
//

function ShowHelp(boxnum) {
	document.getElementById('HelpBox' + boxnum).style.display = 'block';
	document.getElementById('HelpLink' + boxnum).style.display = 'none';
}

function HideHelp(boxnum) {
	document.getElementById('HelpBox' + boxnum).style.display = 'none';
	document.getElementById('HelpLink' + boxnum).style.display = 'block';
}


//
//
// FAMILY
//

function mfReset() {
	document.getElementById('cfFamily').style.display = 'none';
	document.getElementById('cfNoPart1').style.display = 'none';
	
	if(value('file1')) {
		document.getElementById('cfFamily').style.display = 'block';
		l('lfPart1').nodeValue = ExtractFileName(value('file1'));
	} else {
		document.getElementById('cfNoPart1').style.display = 'block';
	}
}

function mfRadio(f) {
	radio(f);
	cfam = document.getElementById('cfParts');
	switch(document.getElementById('fFamilyMold').value) {
		case 'Yes':
			cfam.style.display = 'block';
			break;
		case 'No':
			cfam.style.display = 'none';
			break;
	}
}


//
//
// PART OPTIONS (MULTI)
//

function mmReset() {
	for(var i = 1; i <= 4; i++)
		document.getElementById('nmPart' + i).style.display = 'none';
	for(i = 1; i <= totalParts(); i++) {
		var filePath = value('file' + i);
		if(filePath) {
			document.getElementById('nmPart' + i).style.display = 'block';
			l('lmPart' + i).nodeValue = ExtractFileName(filePath);
		}
	}
}

function mmSelect(f) {
	switch(f.name.substring(0, 9)) {
		case 'PartColor':
			var part = f.name.substring(9);
			var customdisp = (f.options[f.selectedIndex].text == '[ Custom ]') ? 'inline' : 'none';
			document.getElementById('PartColorCustom' + part).style.display = customdisp;
			break;
		case 'PartMater':
			var part = f.name.substring(12);
			var customdisp = (f.options[f.selectedIndex].text == '[ Custom ]') ? 'inline' : 'none';
			document.getElementById('PartMaterialCustom' + part).style.display = customdisp;
			break;
	}
}


//
//
// SUBMIT
//

function msReset() {
	l('lsEmailAddress').nodeValue = value('femail');
	//l('lsUnits').nodeValue = value('units');
	
	l('lsExpectancy').nodeValue = value('fAnnualVolume') + ' x ' + value('fLifeCycle') + ' years';
	
	var from = new Array();
	//if(get('fOriginUSA').checked) from.push('RapidMolds USA');
	//if(get('fOriginChina').checked) from.push('RapidMolds China');
	l('lsOrigin').nodeValue = from.join(', ');
	
	l('lsIncludePartPricing').nodeValue = (get('fIncludePartPricing').checked) ? 'Yes' : 'No';
	
	for(var i = 1; i <= 4; i++)
		document.getElementById('lsPart' + i).style.display = 'none';
		
	for(var i = 1; i <= totalParts(); i++) {
		if(value('file' + i)) {
			var lsPart = document.getElementById('lsPart' + i);
			lsPart.style.display = 'inline';
			var ps = ExtractFileName(value('file' + i)) + ': ';
			ps    += value('PartCavities' + i) + ' cavity';
			lsPart.firstChild.nodeValue = ps;
		}
	}
	
	l('lsoSPIMoldClass').nodeValue = lvalue('loSPIMoldClass').substr(2);
	l('lsoMoldConstruction').nodeValue = lvalue('loMoldConstruction').substr(2);
	l('lsoCavityDetail').nodeValue = lvalue('loCavityDetail').substr(2);
	l('lsoCoreDetail').nodeValue = lvalue('loCoreDetail').substr(2);
	l('lsoGatingRequirements').nodeValue = lvalue('loGatingRequirements').substr(2);
	l('lsoEjectionRequirements').nodeValue = lvalue('loEjectionRequirements').substr(2);
	l('lsoEngravingRequirements').nodeValue = lvalue('loEngravingRequirements').substr(2);
	l('lsoOtherOptions').nodeValue = lvalue('loOtherOptions').substr(2);
}
