/*&L(0,"*",5);*/

var gHwt=&LState(1,"%u",28);;
var gMdt=&LState(1,"%u",35);;

function showhidesections()
{
	switch (gHwt){
		case 1:
		case 9:
		case 14:
		case 15:
		case 20:
		case 34:
		case 36:
		case 37:
		case 38:
			document.getElementById('enc').style.display='none';
			if (document.getElementById('aec') != null)
				document.getElementById('aec').style.display="none";
		break;
		default:
		break;
	}
	// and after all, hide/show single fields inside sections
}
function showProfile()
{
	var profile;
	
	switch (gHwt){
		case 8:
			profile="encoder only";
		break;
		case 1:
		case 9:
		case 14:
		case 15:
		case 20:
		case 34:
		case 36:
		case 37:
		case 38:
			if (document.getElementById('dec_only_0') != null) {
				document.getElementById('dec_only_0').style.display='none';
			}
			profile="decoder only";
		break;
		default:
			document.getElementById('profmnu').style.display='none';
		break;
	}
	document.getElementById('profile').innerHTML=profile;
}


function checkVolumes()
{	
	var volElem;
	var detectedInconsistencies=0;
	var errorTxt="Detected volume configuration inconsistencies:\n";
	var bgmMax,bgmMin,bgmCurr;
	var paMax,paMin,paCurr;
	
	volElem=document.getElementById('bgm_max');
	bgmMax=parseInt(volElem.options[volElem.selectedIndex].text);
	
	volElem=document.getElementById('bgm_min');
	bgmMin=parseInt(volElem.options[volElem.selectedIndex].text);
	
	volElem=document.getElementById('bgm_curr');
	bgmCurr=parseInt(volElem.options[volElem.selectedIndex].text);
	
	volElem=document.getElementById('pa_max');
	paMax=parseInt(volElem.options[volElem.selectedIndex].text);
	
	volElem=document.getElementById('pa_min');
	paMin=parseInt(volElem.options[volElem.selectedIndex].text);
	
	volElem=document.getElementById('pa_curr');
	paCurr=parseInt(volElem.options[volElem.selectedIndex].text);
	
	if (paMin > paMax){
		errorTxt=errorTxt+"Min PA Volume  greater than the Max PA volume\n";
		detectedInconsistencies++;
	}
	if (paCurr > paMax){
		errorTxt=errorTxt+"PA Volume greater than the Max PA volume\n";
		detectedInconsistencies++;
	}
	if (paCurr < paMin){
		errorTxt=errorTxt+"PA Volume less than the Min PA volume\n";
		detectedInconsistencies++;
	}
	if (bgmMin > bgmMax){
		errorTxt=errorTxt+"Min BGM Volume greater than the Max BGM volume\n";
		detectedInconsistencies++;
	}
	if (bgmCurr > bgmMax){
		errorTxt=errorTxt+"BGM Volume greater than the Max BGM volume\n";
		detectedInconsistencies++;
	}
	if (bgmCurr < bgmMin){
		errorTxt=errorTxt+"BGM Volume less than the Min BGM volume\n";
		detectedInconsistencies++;
	}
	if (detectedInconsistencies > 0){
		alert(errorTxt);
	}
}