     function makeQuery()
     {
        databaseIndex = document.search.databases.selectedIndex;
        if(databaseIndex == 0)
        {
           alert("Please choose a database");
           return 0;
        }
        database = document.search.databases.options[databaseIndex].value;
        databaseValue = database.replace(/search/, '');

 //		alert(database);
 //		alert(databaseValue);

        searchFieldIndex = document.search.searchFields.selectedIndex;
        if(searchFieldIndex == 0)
        {
           alert("Please choose a search field");
           return 0;
        }
        searchField = document.search.searchFields.options[searchFieldIndex].value;
        if(searchField == 'lessontopic')
        {
           lessonIndex = document.search.lessontopic.selectedIndex;
           if(lessonIndex == 0)
           {
              alert("Please choose a lesson");
              return 0;
           }
           searchValue = document.search.lessontopic.options[lessonIndex].text;
        }
        else if (searchField == 'recipetopic')
        {
           recipeIndex = document.search.recipetopic.selectedIndex;
           if(recipeIndex == 0)
           {
              alert("Please choose a recipe");
              return 0;
           }
           searchValue = document.search.recipetopic.options[recipeIndex].text;
        }
        else
        {
           if(document.search.textBox.value == '')
           {
             alert("Please sumbit search terms");
             return 0;
           }
           searchValue = document.search.textBox.value;
        }

//        alert(searchField);
//        alert(searchValue);
        document.search.databases.selectedIndex = 0;
        document.location = "search.php?" + database + "=" + databaseValue + "&" + searchField + "=" + searchValue;

     }


     function populateSearchFields(index)
     {
        if(index == 0)
        {
          document.search.searchFields.options.length = 0;
          return 0;
        }
        fields = new Array;
        document.getElementById('searchFieldBox').style.display = 'inline';


        document.search.textBox.disabled = 1;
        document.getElementById("fieldBox").style.display = 'none';

        document.getElementById("recipeBox").style.display = 'none';
        document.search.recipetopic.disabled = 1;
        document.getElementById("lessonBox").style.display = 'none';
        document.search.lessontopic.disabled = 1;

        pFields = new Array();
        pFields[0] = new Array('Please Select a Field', 'Author/Person'
                ,'Title','Subject','Place', 'Lesson Topic','Recipe Topic','Company Name'
                ,'Product','Slogan','Location','Type','Creator','Caption' );

        pFields[1] = new Array('', 'author','title','subject','place', 'lessontopic','recipetopic','companyName'
        						,'product','slogan','location','type','creator','caption');

        fields[1] = new Array(0,7,8,9,10);		/*Advertisements*/
        fields[2] = new Array(0,2);				/*Announcements*/
        fields[3] = new Array(0,1,2,3);			/*articles*/
        fields[4] = new Array(0,1,2);			/*Editorials*/
        fields[5] = new Array(0,1,2);			/*fiction*/
        fields[6] = new Array(0,1);				/*happenings*/
        fields[7] = new Array(0,2,10,11,12,13);	/*Images*/
        fields[8] = new Array(0,2,3,5);			/*lesson*/
        fields[9] = new Array(0,4);				/*notes*/
        fields[10] = new Array(0,1,2);			/*plays*/
        fields[11] = new Array(0,1,2,3);		/*poetry*/
        fields[12] = new Array(0,2,6);			/*recipes*/

        document.search.searchFields.options.length = fields[index].length;
        for(i = 0; i < fields[index].length; i++)
        {
           index2 = fields[index][i];
           document.search.searchFields.options[i].text = pFields[0][index2];
           document.search.searchFields.options[i].value = pFields[1][index2];
        }
        document.search.searchFields.selectedIndex  = 0;

     }


     function populateTextOrDropDown(index)
     {
          document.getElementById("lessonBox").style.display = 'none';
          document.getElementById("fieldBox").style.display = 'none';
          document.getElementById("recipeBox").style.display = 'none';


        if(index == 0)
        {
          document.search.textBox.disabled = 1;
          document.search.recipetopic.disabled = 1;
          document.search.lessontopic.disabled = 1;
          return 0;
        }

        if(document.search.searchFields.options[index].text == 'Lesson Topic')
        {
           document.search.lessontopic.disabled = 0;
           document.getElementById("lessonBox").style.display = 'inline';

        }
        else if(document.search.searchFields.options[index].text == 'Recipe Topic')
        {
           document.search.recipetopic.disabled = 0;
           document.getElementById("recipeBox").style.display = 'inline';
        }
        else
        {
           document.search.textBox.disabled = 0;
           document.getElementById("fieldBox").style.display = 'inline';
        }
     }