//------------------------------------------------------------------------------
// @file 7D30DF09136D31BB - client.js (JavaScript)
// @desc Submit search from from a menu button
// @stat $Name: release-001-002-0005 $ - $Revision: 1.10 $ - $State: released $
// @auth software.engineering@dnp-services.com
//------------------------------------------------------------------------------

function submitForm( category, subCategory, dateRange, product, searchWords )
// submit the form "prodCatForm" using given search parameters category
// and subCategory.
// Resets all other search fields.
{
   theForm = document.forms['prodCatForm'];

   theForm.critCategory.value = category;
   updateSubCategories(document.forms['prodCatForm'].elements['critCategory'],
      'critSubCategory', subCategory
      );
   theForm.critDateRange.value = dateRange;
   theForm.critProduct.value = product;
   theForm.critSearchWords.value = searchWords;

   theForm.submit( );   

   return false;
}

function showSlides( site )
// open a new window for a slide show of the templates in the product list
{
   theForm = document.forms['prodCatForm'];
   
   url  = 'slide-view.php';
   if ( "undefined" == typeof theForm.critSubCategory ) {
      // no search form present, use global default values
      url += '?sub=' + escape( critSubCategory );
      url += '&since=' + escape( critDateRange );
      url += '&name=' + escape( critProduct );
      url += '&words=' + escape( critSearchWords );
   } else {
      // use values from search form
      url += '?sub=' + escape( theForm.critSubCategory.value );
      url += '&since=' + escape( theForm.critDateRange.value );
      url += '&name=' + escape( theForm.critProduct.value );
      url += '&words=' + escape( theForm.critSearchWords.value );
   }
   url += '&site=' + escape( site );

   window.open( url, 'SlideView', 'height=600,width=800,left=0,top=0' );
}

