function st_displayDocuments()
{
     var url = 'modules.php?mod=shootingtips';
     displayText('maincontent',url);
}

function st_displayUsersPage(page)
{
     var form=document.getElementById('shootingtips_search');
     if (isEmpty(form.searchfield))
          {
          displayText('maincontent','modules.php?mod=shootingtips&req=displayall&pageno=' +page);
          }
     else
    	  {displayText('maincontent','modules.php?mod=shootingtips&req=search&pageno=' +page+'&searchfield='+encodeURIComponent(form.searchfield.value)); 
	  }        
}

/*function st_addDocument()
{
     var url = 'modules.php?mod=adminpandp&req=add';
     displayText('maincontent',url);
}


function st_insertDocument()
{
     var form = document.getElementById('documentform');
     var docname = document.getElementById('myfile').value;
     if (docname =='')
          {
          alert('You must upload a file.');
          return false;
          }

     if ( ! st_validateDocumentForm(form))
          return false;

     var url = 'modules.php?mod=adminpandp&req=insert'+
               '&docname='+encodeURIComponent(docname)+
               '&title='+encodeURIComponent(form.title.value)+
               '&synopsis='+encodeURIComponent(form.synopsis.value)+
               '&description='+encodeURIComponent(form.description.value)+
               '&month='+encodeURIComponent(form.month.value)+
               '&year='+encodeURIComponent(form.year.value);
     ret = serverFunction(url);
alert(ret);
     var url = 'modules.php?mod=adminpandp';
     displayText('maincontent',url);
     return false;
}

function st_editDocument(docid)
{
     var url = 'modules.php?mod=adminpandp&req=edit&id='+docid;
     displayText('maincontent',url);
}

function st_updateDocument()
{
     var form = document.getElementById('documentform');

     if ( ! ap_validateDocumentForm(form))
          return false;

     var docname = document.getElementById('myfile').value;
//alert(docname + "*" + form.filename.value);

     var url = 'modules.php?mod=adminpandp&req=update'+
               '&docid='+encodeURIComponent(form.docid.value)+               
               '&docname='+encodeURIComponent(docname)+
               '&title='+encodeURIComponent(form.title.value)+
               '&synopsis='+encodeURIComponent(form.synopsis.value)+
               '&description='+encodeURIComponent(form.description.value)+
               '&month='+encodeURIComponent(form.month.value)+
               '&filename='+encodeURIComponent(form.filename.value)+
               '&year='+encodeURIComponent(form.year.value);
//alert(url);
     ret = serverFunction(url);
//alert(ret);
     var url = 'modules.php?mod=adminpandp';
     displayText('maincontent',url);
}


function st_deleteDocument(docid)
{
     if (confirm('Are you sure you want to delete this document?'))
          {
          var url = 'modules.php?mod=adminpandp&req=delete&id='+docid;
          serverFunction(url);
          var url = 'modules.php?mod=adminpandp';
          displayText('maincontent',url);
          }
     return false;
}


function st_archiveDocument(docid)
{
     if (confirm('Are you sure you want to archive this document?'))
          {
          var url = 'modules.php?mod=adminpandp&req=archive&id='+docid;
          serverFunction(url);
          var url = 'modules.php?mod=adminpandp';
          displayText('maincontent',url);
          }
     return false;
}


//function stopDocumentUpload(success,path,tmp) is in functions.js
*/
function st_validateDocumentForm(form)
{
     var error_message = "The following errors occurred:\n";
     var errors=0;
     if (isEmpty(form.title))
          {
          error_message = error_message + "\t\ntitle is missing";
          errors=1;
          }
     if (isEmpty(form.synopsis))
          {
          error_message = error_message + "\t\nsynopsis is missing";
          errors=1;
          }
     if (isEmpty(form.description))
          {
          error_message = error_message + "\t\ndescription is missing";
          errors=1;
          }
     if (isEmpty(form.month))
          {
          error_message = error_message + "\t\nmonth is missing";
          errors=1;
          }
     if (isEmpty(form.year))
          {
          error_message = error_message + "\t\nyear is missing";
          errors=1;
          }

/*
     if (docname != '0' && docname =='')
          {
          error_message = error_message + "\t\nYou must upload a document";
          errors=1;
          }
*/
     if (errors==0)
          return true;
     alert(error_message);
     return false; 
}

function st_displayedition(videoid)
{
     //in use
     var url='modules.php?mod=shootingtips&req=oneedition&videoid='+videoid;
     ret=displayText('maincontent',url);
//     var url='http://sassnet.venomouspenguin.com/templates/shootingtips/demo-xml.swf';
//     ret=displayText('myContent',url);
//     startvideoplayer();
//     clientSideInclude('player');
//alert('player started');
   return false;
}


function st_searcheditions()
{
     var form=document.getElementById('shootingtips_search');

     if (isEmpty(form.searchfield))
          {
          displayText('maincontent','modules.php?mod=shootingtips&req=displayall');
          }
     else
    	  { displayText('maincontent','modules.php?mod=shootingtips&req=search&searchfield='+encodeURIComponent(form.searchfield.value)); 
	  }   
     return false;

}
