var ctlQuotePrefix = "ctlQuote_";

function ctlPreCallBack(vobjControl) {
	setControls(vobjControl.id, true);
	var objControl = new getObj('txtQuote').obj;
	if (objControl != null) {
		objControl.value = '';
	}
}

function ctlPostCallBack(vobjControl) {
	hideDiv('divPrice');
	setControls(vobjControl.id, false);
	if (vobjControl.id == ctlQuotePrefix + "ddlTintList") {
		if (!(vobjControl.selectedIndex == 0)) {
			var strQuote = new String(vobjControl.options[vobjControl.selectedIndex].value);		
			var intIndex1 = strQuote.indexOf('|')
			//var intIndex2 = strQuote.lastIndexOf('|')

			if ('1' == strQuote.substr(intIndex1 + 1, 1)) {
				strQuote = 'To receive a quote, please call us.'
			} else {
				strQuote = '$ ' + strQuote.substr(0, intIndex1) + ' + Tax'
			}
			var objControl = new getObj('txtQuote').obj;
			if (objControl != null) {
				objControl.value = strQuote;
			}
			showDiv('divPrice');
		}
	}
}

function setControls(vstrControlID, vblnDisabled) {
	var strText = '';
	if (vblnDisabled) {
		strText = 'working...';	
	}

	setControl(ctlQuotePrefix + 'ddlYearMfgList', vblnDisabled);
	setControl(ctlQuotePrefix + 'ddlMakeList', vblnDisabled);
	setControl(ctlQuotePrefix + 'ddlModelList', vblnDisabled);
	setControl(ctlQuotePrefix + 'ddlBodyList', vblnDisabled);
	setControl(ctlQuotePrefix + 'ddlPartList', vblnDisabled);
	setControl(ctlQuotePrefix + 'ddlFeatureList', vblnDisabled);
	setControl(ctlQuotePrefix + 'ddlTintList', vblnDisabled);

	switch (vstrControlID) {
		case ctlQuotePrefix + "ddlYearMfgList" : 
			setLabel(ctlQuotePrefix + 'lblMakeListStatus', strText);
			break;
		case ctlQuotePrefix + "ddlMakeList" : 
			setLabel(ctlQuotePrefix + 'lblModelListStatus', strText);
			break;
		case ctlQuotePrefix + "ddlModelList" : 
			setLabel(ctlQuotePrefix + 'lblBodyListStatus', strText);
			break;
		case ctlQuotePrefix + "ddlBodyList" : 
			setLabel(ctlQuotePrefix + 'lblPartListStatus', strText);
			break;
		case ctlQuotePrefix + "ddlPartList" : 
			setLabel(ctlQuotePrefix + 'lblFeatureListStatus', strText);
			break;
		case ctlQuotePrefix + "ddlFeatureList" : 
			setLabel(ctlQuotePrefix + 'lblTintListStatus', strText);
			break;
		//case ctlQuotePrefix + "ddlTintList" : 
		//	break;
		default :
			break;
	}
}

function setControl(vstrControlID, vblnDisabled) {
	try {
		var objControl = new getObj(vstrControlID).obj;
		objControl.disabled = vblnDisabled;
	}
	catch (exception) {
		return;
	}
}

function setLabel(vstrControlID, vstrText) {
	try {
		var objControl = new getObj(vstrControlID).obj;
		objControl.innerHTML = vstrText;
	}
	catch (exception) {
		return;
	}
}