title: using a function in custom javascript file in drupal
body: <p>i made a module that creates a block and using #attached i added my custom .js file to block content, without Drupal.behaviors and function($) things my code works like a clock in another page (outside of Drupal) but in Drupal, i have no idea how to add a function in .js file
  here are my codes:</p>
  
  <pre><code>(function($){
      Drupal.behaviors.mymodule = {
      attach:function(context, settings) {
                  function show_more(count){
                  var counter = count;
                  var id = document.getElementById("id").value;
                  var xmlhttp;
                  if (window.XMLHttpRequest)
                  {
                      xmlhttp=new XMLHttpRequest;
                  }
                  xmlhttp.onreadystatechange = function() {
                  if(xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) {
                      document.getElementById("div_id").innerHTML =xmlhttp.responseText;
                  }
                  }
                  xmlhttp.open("POST","some_page.php",true);
                  xmlhttp.setRequestHeader("Content-type","application/x-www-form-        urlencoded");
                 xmlhttp.send("counter="+encodeURIComponent(counter)+"&amp;id="+encodeURIComponent(id    ));
              $("#div_id").fadeToggle(2000);
                 }
          }
      }
         })(JQuery);
  </code></pre>
  
  <p>i am new to drupal and Jquery please help me
  and please tell me how can i call show_more function in my content
  Thank you in advance</p>