// JavaScript Document

function submitAdForm(id,task)
{
  window.document.adForm.ad_id.value=id;
  window.document.adForm.task.value=task;
  window.document.adForm.action="./search/";
  window.document.adForm.submit();
  return true;
}

function submitWantedAdForm(id,task)
{
  window.document.adForm.wanted_id.value=id;
  window.document.adForm.task.value=task;
  window.document.adForm.action="./search_wanted/";
  window.document.adForm.submit();
  return true;
}



<!--- image upload javascript functions --->

  function DoPreview()
  {
    var maxheight = 200;
	var maxwidth = 200;
	var filename = document.form1.filesent.value;
    var Img = new Image();
    if (navigator.appName == "Netscape")
    {
      alert("Previews do not work in Netscape.");
    }
    else
    {
      
	  Img.src = filename;
      if ((document.images[0].width > maxwidth || document.images[0].height > maxheight))
	  {
	    alert ("Image size exceed maximum size. it will show as follow.");
	  }
	  document.images.image1.src = Img.src;
	  document.images.image1.width = maxwidth; 
    }
  }



  function CheckUpload()
  {
    var filename = document.form1.filesent.value;
    var extension;
    var valid = true
    var Img1 = new Image()
    if (navigator.appName == "Netscape")
    {
      alert("This upload function cannot be used with Netscape.");
      valid = false;
    }
    else if (filename == '')
    {
      valid = false;
      alert("Please include a file.");
    }
    else
    {  
      extension = filename.substring(filename.length - 3, filename.length);
      if (extension.toUpperCase() != 'JPG')
      {
        valid = false;
        alert("The file must be a JPG.");
      }
      else
      {
        Img1.src = filename;
        if ((Img1.height == 0) || (Img1.width == 0))
        {
          valid = false;
          alert("The file is invalid.");
        }
		else if ((Img1.height > 200) || (Img1.width > 200))
		{
		  valid =true;
		  alert("Image size must be 200 X 200 this file is larger and it will rezise automaticlay");
          document.form1.height.value = Img1.height;
          document.form1.width.value = Img1.width;		  
		} 
        else
        {
          document.form1.height.value = Img1.height;
          document.form1.width.value = Img1.width;
        }
      }
    }
    return valid
  }
// End -->
