Explanation of this JavaScript Code
<p>I'm not too good on the whole JavaScript (I can do some basic validations) but this isn't my zone</p>

<p>I've got a piece of code below that I'm trying to understand what it does, I can read any code and understand a few parts, but this just stumped me.</p>

<p>Here:</p>

<pre><code>function tm_search_click() {
    if (document.getElementById('tm').value == 'Enter your trademark') {
        document.getElementById('tm').style.backgroundColor = '#fcc';
        return false;
    } else {
        window.location = '?tm=' + escape(document.getElementById('tm').value);
        return true;
    }
}
function qs(a) {
    a = a.replace(/[[]/, "\[").replace(/[]]/, "\]");
    var b = "[\?&amp;]" + a + "=([^&amp;#]*)";
    var c = new RegExp(b);
    var d = c.exec(window.location.href);
    return d == null ? "" : decodeURIComponent(d[1]).replace(/+/g, " ")
}
if (qs("tm") != "") {
    tm_trademark = document.getElementById("tm").value = unescape(qs("tm"));
    tm_partner = "migu2008";
    tm_frame_width = 630;
    tm_frame_height = "auto";
    tm_trademark_country_code = "GB";
    tm_css_url = "http://remarqueble.com/api/theme/search_corporate.css";
    document.getElementById("tmLoading").style.display = "block";
    tm_on_search_result = function () {
        document.getElementById("tmLoading").style.display = "none";
        document.getElementById("tmLoaded").style.display = "block"
    }
} else {
    tm_search_method = "none"
}
</code></pre>

<p>That is all of it without the <code>&lt;script&gt;</code> tags.</p>

<p>Could I also edit this code so that it searches are made based on what option the user inputs? </p>
