if (document.images) {
submit_F1 = new Image(64,20); submit_F1.src = "images/submit.gif";
submit_F2 = new Image(64,20); submit_F2.src = "images/submit_f2.gif";
}

/* Function that swaps images. */

function di20(id, newSrc) {
    var theImage = FWFindImage(document, id, 0);
    if (theImage) {
        theImage.src = newSrc;
    }
}

/* Functions that track and set toggle group button states. */

function FWFindImage(doc, name, j) {
    var theImage = false;
    if (doc.images) {
        theImage = doc.images[name];
    }
    if (theImage) {
        return theImage;
    }
    if (doc.layers) {
        for (j = 0; j < doc.layers.length; j++) {
            theImage = FWFindImage(doc.layers[j].document, name, 0);
            if (theImage) {
                return (theImage);
            }
        }
    }
    return (false);
}

function everything(form) 
  {
    isFullname(form)
	isOrganisation(form)
    isAddress(form)
    isTelephone(form)
	isEmail(form)
	isComments(form)
    allblanks(form)
  }
  
function allblanks(form) 
  {
    if((isFullname(form) && isOrganisation(form)) && (isAddress(form)) && isTelephone(form) && isEmail(form) && isComments(form)) 
      {
        form.submit()
      }
    if((isFullname(form) == false || isOrganisation(form) == false) || (isAddress(form) == false) || (isTelephone(form) == false) || (isEmail(form) == false) || (isComments(form) == false)) 
      {
        compose(form)
      }
  }

function compose(form) 
  {
    var text = "Please check that you filled the following required field(s) in correctly:"	
    if(isFullname(form) == false) 
	  {
        text += "\nyour full name"
      }
    if (isOrganisation(form) == false) 
	  {
        text += "\nyour organisation"
      }
    if(isAddress(form) == false) 
	  {
        text += "\nyour address"
      }
	if(isTelephone(form) == false) 
	  {
        text += "\nyour telephone"
      }
	if(isEmail(form) == false) 
	  {
        text += "\nyour email"
      }
	if(isComments(form) == false) 
	  {
        text += "\nyour comments"
      }
	  
    alert(text)
  }

function isFullname(form) 
  {
    if (form.fullname.value == "") 
      {
        return false
      }
    else 
    {
      return true
    }
  }
  
function isOrganisation(form) 
  {
    if(form.organisation.value == "") 
	  {
        return false
      }
    else 
	  {
        return true
      }
  }
  
function isAddress(form) 
  {
    if(form.address.value == "") 
	  {
        return false
      }
    else 
	  {
        return true
      }
  }
  
function isTelephone(form) 
  {
    if(form.telephone.value == "") 
	  {
        return false
      }
    else 
	  {
        return true
      }
  }

function isEmail(form) 
  {
    if ((form.email.value == "" || form.email.value.indexOf('@', 0) == -1) || form.email.value.indexOf('.') == -1) 
     {
       return false
     }
   else 
     {
       return true
     }
  }
  
 function isComments(form) 
  {
    if(form.comments.value == "") 
	  {
        return false
      }
    else 
	  {
        return true
      }
  }
  

