
      function doAction(formID,action,fieldID,fieldValue) {
            // get the form name
            myForm = document.getElementById(formID);
            myLink = document.getElementById('searchLink');
	                
	    if(action == 'search_store' && myLink){
		    myLink.removeAttribute("href");
		    myLink.removeAttribute("onclick");
	                	
            }
        	// set the submitted action
            if (document.getElementById("submission_action")) {
                document.getElementById("submission_action").value = action;
            }
            if( document.getElementById(fieldID) ) {
                document.getElementById(fieldID).value = fieldValue;
            }
            // alert('stuff: '+formID+'/'+action+'/'+fieldID+'/'+fieldValue);
            // submit it
        	myForm.submit();							  																	
        	return false;		
        }

      //function for forcing form submission in IE upon kepress of 'Enter' key
      function checkEnter(e){

          if (document.all && !document.layers) {

              var characterCode
              if(e && e.which){
                  e = e
                  characterCode = e.which
              }else{
                  e = event
                  characterCode = e.keyCode
              }	
              if(characterCode == 13){
 	             return doAction('submitForm','search_store');
              }
              return true
          }
      }

      function ContextualHelpPopup(popupAnswerURL, windowHeight, windowWidth,toolbar) {
          var height = "425";
          var width = "390";

          if (windowHeight) {
              height = windowHeight;
          }

          if (windowWidth) {
              width = windowWidth;
          }

          var left = Math.floor( (screen.width - width) / 2);
          var top = Math.floor( (screen.height - height) / 2);
          // If the window contains a toolbar, subtract 50 from location of the
          // top of the window to accomodate the size of the toolbar, so that
          // the window will still be centered in the screen.

          if (toolbar) {
              top = top - 50;
          }

          var winParams = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width + ",scrollbars,resizable";
          if (toolbar) {
              winParams = winParams + ",toolbar";
          }
          msgWindow = window.open('','targetname',winParams);

          msgWindow.location.href = popupAnswerURL;
          if (msgWindow.opener == null) msgWindow.opener = self;

          return false;

     } // end function ContextualHelpPopup

      function mapPopUp(url) {
       var mapWin = window.open(url,"OfotoMap","scrollbars,resizable,width=800,height=800,titlebar=false");
       mapWin.focus();
       return false;
    }
