[jQuery] Binding a function to a variable (Newbie question)

[jQuery] Binding a function to a variable (Newbie question)

I've fixed my own problem with a hack of a kind. which is a bit disappointing as I'm not sure what was causing it. I changed the values called to be 'form#fPollX', in order to pass that straight to the $() jQuery function and stripped the id value off the end. In order to pass that value to the function, the function's declared in the bind(), so it's a local variable.
Terrible I'm sure - if that's bad practice, I'd love to know why.
Cheers,
Dan.
$(document).ready(function(){
    initialiseForm("form#fPollX");
    initialiseForm("form#fPollY");
});
function initialiseForm(formID) {
    if (!document.getElementById) return false;
    var theForm = formID.split("#")[1];
    if(document.getElementById(theForm)){
        $(formID).bind("submit", function post() {
           switch(formName){
           case "fPollX":
            alert('hello X ' + formName);
            return false;
            break;
           case "fPollY":
            alert('hello Y ' + formName);
            return false;
            break;
           default:
            return false;
          }   
        });
    }
}<br clear="all">
--
Daniel Eastwell
Portfolio and articles:
<a href="http://www.thoughtballoon.co.uk">
http://www.thoughtballoon.co.uk</a>
Blog:
<a href="http://www.thoughtballoon.co.uk/blog">http://www.thoughtballoon.co.uk/blog</a>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/