function ChangeDocType(DocPage, SelectedCategory){
	var DropDownName 	= "";
	var DropDownIDs		= "";
	var OptionName		= "";
	var OptionValue		= "";
	var OptionIndexID	= "";
	//alert ("ChangeDocType");
	
	//This function changes the 2nd Drop Down Menu to show Document Types for selected Category
	//All Categories have an array unique to that category, holding all doc types (Set in script when called)
	//All Arrays should have the format of "DropDown" followed by the ID of the category (DropDown1, DropDown2)
	
	//First set the var to have the values of the array for the selected category
	//Category would be the ID of the Selected category
	
	//Following line sets DropDownName to be the array of The selected DropDown
	DropDownName = eval('DropDownName'+DocPage);
	DropDownIDs	= eval('DropDownID'+DocPage);
	
	//Reset the options menu,
	// If you remove this, the code will only overwrite DropDown Options, leaving the old ones if less
	document.getElementById('Category').options.length = 0;

	document.getElementById('Category').options[0] = new Option("All", 0);
	//Loop through the length of the array for selected category
	for(var i = 0; i < DropDownName.length; i++){
		//2 Arrays are passed, one containing the Text shown in the drop down, the other containing the Unique ID
		OptionName 	= DropDownName[i];
		OptionValue	= DropDownIDs[i];
		OptionIndexID = i+1;
		//alert("Option INdex is "+OptionIndexID);
		
		document.getElementById('Category').options[OptionIndexID] = new Option(OptionName, OptionValue);
		//SelectedCategory is the category they selected before submitting
		//If the SelectedCategory is the same as the Option, then make it selected.
		if(SelectedCategory == OptionValue){
			document.getElementById('Category').options[OptionIndexID].selected = true;
		}
	}

}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function displayobj(onoff, element) {
	//alert (onoff);
	var obj = "";
	obj=document.getElementById(element);
	obj.style.display=( (onoff==1) ? '' : 'none');
}

function SearchFormChangeCategory(DocPage, SelectedCategory){
	var DropDownName 	= "";
	var DropDownIDs		= "";
	var OptionName		= "";
	var OptionValue		= "";
	var OptionIndexID	= "";
	//This function changes the 2nd Drop Down Menu to show Document Types for selected Category
	//All Categories have an array unique to that category, holding all doc types (Set in script when called)
	//All Arrays should have the format of "DropDown" followed by the ID of the category (DropDown1, DropDown2)
	
	//First set the var to have the values of the array for the selected category
	//Category would be the ID of the Selected category
	
	//Following line sets DropDownName to be the array of The selected DropDown
	DropDownName = eval('DropDownName'+DocPage);
	DropDownIDs	= eval('DropDownID'+DocPage);
	
	//Reset the options menu,
	// If you remove this, the code will only overwrite DropDown Options, leaving the old ones if less
	document.getElementById('Category').options.length = 0;

	document.getElementById('Category').options[0] = new Option("All", 0);
	//Loop through the length of the array for selected category
	for(var i = 0; i < DropDownName.length; i++){
		//2 Arrays are passed, one containing the Text shown in the drop down, the other containing the Unique ID
		OptionName 	= DropDownName[i];
		OptionValue	= DropDownIDs[i];
		OptionIndexID = i+1;
		//alert("Option INdex is "+OptionIndexID);
		
		document.getElementById('Category').options[OptionIndexID] = new Option(OptionName, OptionValue);
		//SelectedCategory is the category they selected before submitting
		//If the SelectedCategory is the same as the Option, then make it selected.
		if(SelectedCategory == OptionValue){
			document.getElementById('Category').options[OptionIndexID].selected = true;
		}
	}
	if(DropDownName.length > 1){
		displayobj(1, 'CategoryDropDown');
		
	}else{
		if(DropDownName.length == 1){
			document.getElementById('Category').options[1].selected = true;
		}
		displayobj(0, 'CategoryDropDown');
	}

}
