function fnUpdateMinOption(_MaxObj,MinObjName,EqualAllowed){

	var _MinObj = document.getElementById(MinObjName);
	//_MinObj.options[_MinObj.selectedIndex ].value;
	var CurrentMin = _MinObj.value;
	var vinNewMinIndex = 1;

	if ( EqualAllowed ) { 
		vvrMaxStart = _MaxObj.selectedIndex;
	} else {
		vvrMaxStart = _MaxObj.selectedIndex + 1;
	}
	
	for ( i = vvrMaxStart ; i < _MaxObj.length ; i++) {
		vvrThisMax = _MaxObj.options[i].value;
		vtxThisLabel = _MaxObj.options[i].text;
		_MinObj.options[vinNewMinIndex] = new Option(vtxThisLabel,vvrThisMax);
		if (CurrentMin == vvrThisMax ) {
			_MinObj.selectedIndex = vinNewMinIndex;
		}
		vinNewMinIndex++;
	}
	_MinObj.length = vinNewMinIndex;
}

function fnUpdateClassOption(_StyleObj,ClassName){

	ClassObj = document.getElementById(ClassName);

	if ( _StyleObj.value != '' ) {
		if ( typeof('varClass[' + _StyleObj.value + ']') != 'undefined') 
		{
			if (_StyleObj.value == '' ){
				ClassObj.options[0] = new Option('Select a Class','');
			}
			else {
				ClassObj.options[0] = new Option('Select ' + _StyleObj.options[ _StyleObj.selectedIndex ].text + ' classes','');
			}
			
			var vinIndex = 0;
			for ( vehClass in varClass[ _StyleObj.value ] ) {
				vinIndex = vinIndex + 1;
				ClassObj.options[vinIndex] = new Option(varClass[ _StyleObj.value ][vehClass],varClass[ _StyleObj.value ][vehClass]);
				}
				ClassObj.length = vinIndex + 1;
		}
	}
	else {
			ClassObj.options[0] = new Option('Select a Class','');
			var vinIndex = 0;
			for ( vehClass in varClass[ 0 ] ) {
				vinIndex = vinIndex + 1;
				ClassObj.options[vinIndex] = new Option(varClass[ 0 ][vehClass],varClass[ 0 ][vehClass]);
				}
				ClassObj.length = vinIndex + 1;

	}

}


	function SubmitForm(){
		document.forms[ 'hfmSearch' ].submit();
	}

	function SetFldVal(fldname,fldval){
		document.getElementById(fldname).value=fldval;
//		document.hfmSearch.elements[fldname].value = fldval;
	}

	function ShowDetail(ApprIDVal,QryLocationVal){
		SetFldVal('ApprID',ApprIDVal);
		SetFldVal('QryLocation',QryLocationVal);
		SetFldVal('pinID','detail');
		SubmitForm();
	}
	function ShowImageList(ThisfileVal){
		SetFldVal('Thisfile',ThisfileVal);
		SubmitForm();
	}
	
	function DoCompare(checkObj,CompareList){
	
		CompareItemVal = checkObj.value;
		CompareObj = document.getElementById(CompareList);
		
			//Now we actually add or remove the specific entry (if still required)
			if (checkObj.checked) {
				// Add this ID if it doesn't exists already
				if ( CompareObj.value == '' ) {
					CompareObj.value = CompareItemVal;
				} else {
					if ( CompareObj.value.indexOf( CompareItemVal ) == -1 ) {
						CompareObj.value = CompareObj.value + ',' + CompareItemVal;
					}
				}
			}

			if (!checkObj.checked) {
				// Remove this ID if it exists
			    if (CompareObj.value.length > 0) {
				 while (CompareObj.value.indexOf( CompareItemVal ) > -1) {
				    CompareObj.value = CompareObj.value.replace( CompareItemVal , '');
				    CompareObj.value = CompareObj.value.replace( /,,/ , ',');
				    CompareObj.value = CompareObj.value.replace( /^,/ , '');
				    CompareObj.value = CompareObj.value.replace( /,$/ , '');
				 }
			    }
			}
	}
	
function newWindow_print(ApprID) {
	popup = window.open("dsp_detail_print_frame.cfm?ApprID=" + ApprID,"big","width=650,height=457");
}


var popup = null;
function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=790,height=767');");
}

