function setAction() {
  var browser = navigator.appName;
  var version = navigator.appVersion;
  var myBP = "";
	if (version.indexOf('Safari') >= 0) {
		myBP = "NS6";
	} else {
			if (browser == "Microsoft Internet Explorer") {
				myBP = "IE";
			} else if (browser == "Netscape") {
				if (version.substr(0,1) >= '5') {
					myBP = "NS6";
				} else {
					myBP = "NS";
				}
			}
	}

	// Interate through the forms collection in the document object.
	
  for (var i=0; i<document.forms.length; i++) {
    var formName = document.forms[i];
    var actionURL = formName.action;
    var paramStart = actionURL.indexOf('?');

    // if there are no paramenters, we can laminate BP onto the end.
    if (paramStart == -1) {
      document.forms[i].action = actionURL + "?BP=" + myBP;
      continue;
    }

    var bpStart = actionURL.indexOf('BP=');

		// if BP parameter doesn't exist on the form action add it.
    if (bpStart == -1) {
      document.forms[i].action = actionURL + "&BP=" + myBP;
      continue;
    }

		// if BP parameter exists, we check if it is the correct one
		// else we substitute the right value of BP we determined in myBP

    var part2 = actionURL.substring(bpStart+3,actionURL.length);
    var bpEnd = part2.indexOf('&');

    if (bpEnd == -1) {
			// In the case BP is the last parameter on the actionURL
      curBP = part2;
      part2 = "";
    } else {
			// In the case BP is in mixed with other parameters
      curBP = part2.substring(0,bpEnd);
      part2 = part2.substring(bpEnd,part2.length);
    }

		// Go to the next form, BP was set correctly
    if (curBP == myBP) {
      continue;
    }
    document.forms[i].action = actionURL.substring(0,bpStart) + "BP=" + myBP + part2;
  }
}
