function call outside of jQuery

function call outside of jQuery

Hi Community,
i write this function:

  1. $(function() {
  2.     // Array erstellen
  3.     $.get("hallen.xml",{},function(xml){
  4.         $('address',xml).each(function(i) {
  5.             aHalle[$(this).find("nummer").text()] = new Array();
  6.             aHalle[$(this).find("nummer").text()]["Nummer"] = $(this).find("nummer").text();
  7.             aHalle[$(this).find("nummer").text()]["Halle"] = $(this).find("halle").text();
  8.             aHalle[$(this).find("nummer").text()]["Strasse"] = $(this).find("strasse").text();
  9.             aHalle[$(this).find("nummer").text()]["PLZ"] = $(this).find("PLZ").text();
  10.             aHalle[$(this).find("nummer").text()]["Ort"] = $(this).find("Ort").text();
  11.                 
  12.             $('<option value="' + aHalle[$(this).find("nummer").text()]["Nummer"] + '">' + aHalle[$(this).find("nummer").text()]["Halle"]+ '</option>').appendTo('#halle');
  13.             $('<option value="' + aHalle[$(this).find("nummer").text()]["Nummer"] + '">' + aHalle[$(this).find("nummer").text()]["Nummer"]+ '</option>').appendTo('#hallenr');
  14.         });
  15.     });
  16.     function selectOnChange(ref, id) {
  17.         reset();
  18.         if (id==null)
  19.             HallenID = $("#" + ref + " option:selected").val();
  20.         else
  21.             HallenID = id;
  22.         if (HallenID != "00") {
  23.         
  24.             if (ref == "halle") {
  25.                 $("#hallenr option[value='" + HallenID +"']").attr('selected','selected');
  26.             } else {
  27.                 $("#halle option[value='" + HallenID +"']").attr('selected','selected');
  28.             }
  29.         
  30.             $("#address").hide(0);
  31.             $('.address').remove();
  32.             
  33.             Address = aHalle[HallenID]["Strasse"] + ', ' + aHalle[HallenID]["PLZ"] + ' ' + aHalle[HallenID]["Ort"];
  34.             MapHTML = '<strong>' + aHalle[HallenID]["Halle"]+ ' #' + aHalle[HallenID]["Nummer"] + '</strong><br /><p style="line-height: 2em;">' + aHalle[HallenID]["Strasse"] + '<br />' + aHalle[HallenID]["PLZ"] + ' ' + aHalle[HallenID]["Ort"] + '<br /><a href="#" onclick="initRoute()">Rountenplaner</a></p>';
  35.             AddressHTML = '<p class="address"><strong>' + aHalle[HallenID]["Halle"] + ' #' + aHalle[HallenID]["Nummer"] + '</strong></p><p class="address">' + aHalle[HallenID]["Strasse"] + '<br />' + aHalle[HallenID]["PLZ"] + ' ' + aHalle[HallenID]["Ort"] + '</p>';
  36.             TitelMapHTML = aHalle[HallenID]["Halle"]+ ' #' + aHalle[HallenID]["Nummer"];
  37.             $('#addressHead').after(AddressHTML);
  38.             $("#address").show("slow");
  39.             searchAddress(Address);
  40.         }
  41.     };
  42.     $("#halle").change(function() { selectOnChange("halle",null) }); // Eventhandler SELECT #HALLE
  43.     $("#hallenr").change(function() { selectOnChange("hallenr",null) }); // Eventhandler SELECT #HALLENR
  44.     $("#sidebartoggle").click(    function() { // Eventhandler SIDEBAR
  45.         $("#sidebar").toggle(0);
  46.         var show = (flip++ % 2 == 0);
  47.         
  48.         if(show) {
  49.             $("#map").css("width", "780px");
  50.             $("#sidebartoggle").text('Sidebar ausklappen');
  51.         } else {
  52.             $("#map").css("width", "510px");
  53.             $("#sidebartoggle").html('Sidebar einklappen');
  54.         }
  55.         
  56.     });
  57.     $("#routenplanerstart").click(initRoute);
  58.     $(".routenplanerstart").click(initRoute);
  59.     reset();
  60. });
and this function is located in main.js.

Now i would like call the function in

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2.     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3.    
  4. <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
  5.     <head>
  6.         <title>Saarland Sporthallen</title>
  7.         <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
  8.         <link rel="stylesheet" type="text/css" href="./css/reset.css">
  9.         <link rel="stylesheet" type="text/css" href="./css/style.css">
  10.         <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  11.         <script type="text/javascript" src="http://www.google.com/jsapi?key=ABC"></script>
  12.         <script type="text/javascript" src="./js/main.js"></script>
  13.         <script type="text/javascript">
  14.             selectOnChange("halle","02")
  15.         </script>
  16. </head>

There is following error:

selectOnChange is not defined
Can someone help me?
Best regards
Klaus