Q:

How to output variables such as the current page's entry_id in the script tag

One one of our sites, we have ChannelFiles add-on installed and in the control panel (when editing an entry) it outputs a useful set of variables (see attached). But this is only part of add-on and if it's not installed, those variables aren't outputted. Is there anyway I can output these variables without ChannelFiles?
Background: There are certain fields that I only want to ever appear when editing a specific entry so I include a bit of jquery in the field instruction to hide/show field by checking against the variables outputted by ChannelFiles add-on in the script tag.
http://imagebin.org/258416
Thanks 
UPDATE (to clarify): I need this when editing the entry in the control panel of EE (see Background section on why) and not in the front end. As far as I know, I don't have access to the templates for the control panel (or do I?).

A:

You can output entry ids from within the channel:entries tag pair like this:
{exp:channel:entries channel="my_channel"}
  entry_id: {entry_id}<br>
{/exp:channel:entries

The Channel Entries documenation at EllisLab provide all the variable options available to you.
Update
You can add this script to any of the field's Field Instructions section.
<script>
  $(document).ready(function() {
    entryId = (document.URL).split('entry_id=')[1].replace(/\D/g,'');
    $('.heading h2').append(' #' + entryId); // adds to heading at top of form
    alert("entry id = " + entryId);
  });
</script>

Second Update
The previous script wasn't removing numerical characters from the url that occurred after the entry_id. The problem is that EE encodes the & as &amp;. So here's this:
<script>
  $(document).ready(function() {
    firstPart = (document.URL).split('entry_id=')[0];
    entryId = (document.URL).split('entry_id=')[1].split(firstPart[firstPart.length -1])[0];
    $('.heading h2').append(' #' + entryId);
  });
</script>

