
 //Swf Cabin 2008

 //function for checking client side if the file being selected is a swf
 //will pass over to PHP to double check this just in case the client has javascript turned off
  
 function alertSwf()
 {
  
  var path = document.uploadSwf.fileswf.value;
  var swfnum = path.length - 3;
  var checkswf = path.substr(swfnum,3);

  if(!(checkswf=="swf"))
  {
    alert("This is not a swf file");
    document.uploadSwf.reset();
  }
  
 }

 //valide the fields when the form is being submitted
 //if everything checks out invoke uploadSwf method

 function validateUpload ()
 {
 
  var title = document.uploadSwf.title.value;
  var path = document.uploadSwf.fileswf.value;
  valid = true;
 
  if(title=="" || path =="")
  {
    alert("Ensure you have entered a title, and selected a swf");
    valid = false;
  }
  else
    uploadSwf();

    return valid;
 
 }


 //Upload in progress remove the upload button and display the graphic

 function uploadSwf()
 {
  document.getElementById('uploadbtn').style.display = 'none';
  document.getElementById('uploadgraphic').innerHTML="<br /><i><strong>Proccessing</strong></i>  <img src=\"images/publishimg.gif\" width=\"16\" height=\"16\">";

 }

 //method for ensuring that the search box isnt empty
 function validateSearch()
 {
   
  var query = document.swfSearch.query.value;
  search = true;
  if(query=="")
  { 
    alert("Please enter a search query");
    search = false;
  }
  if(!(query.length >= 3))
  {
    alert("A search query must contain 3 or more characters");
    search = false;
  }

  return search;

 }










