How to change the format of an URL with javascript?
<p>I am making a form that submits some values to a site for booking hotel rooms. The urls should look like this:</p>

<pre><code>https://secure.netbookerng.com/soahotel/zablijak/cs/hseoptx_UZ/hseoid_22959509.html?autosearch=true&amp;begindate=11/30/11&amp;enddate=12/16/11&amp;adults=1&amp;children=0&amp;rooms=1
</code></pre>

<p>I managed only to get a URL that looks like this:</p>

<pre><code>https://secure.netbookerng.com/soahotel/zablijak/cs/hseoptx_UZ/hseoid_22959509.html?begindate=11%2F30%2F2011&amp;enddate=12%2F15%2F2011&amp;rooms=1&amp;adults=1&amp;children=0&amp;Check=Check+Availability
</code></pre>

<p>Here is what I did:</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;

&lt;head&gt;
&lt;title&gt;Demo&lt;/title&gt;
&lt;link type="text/css" href="css/ui-lightness/jquery-ui-1.8.16.custom.css" rel="stylesheet" /&gt;   
&lt;script type="text/javascript" src="js/jquery-1.6.2.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"&gt;&lt;/script&gt;

&lt;script&gt;

    $(function() {
        $('#datepicker1').datepicker({minDate:0,dateFormat:'mm/dd/yy'});
        $("#datepicker2").datepicker({minDate:0,dateFormat:'mm/dd/yy'});
        $('#arrival').datepicker({dateFormat:'mm/dd/yy'});
        $("#departure").datepicker({dateFormat:'mm/dd/yy'});    

        $("#posalji").click(function(){
          var datum1=$('#datepicker1').val();
          var datum2=$('#datepicker2').val();
          var rooms=$('#rooms').val();
          var adults=$('#adults').val();
          var children=$('#children').val();
          datum1=datum1.substring(3,5)+"/"+datum1.substring(0,2)+"/"+datum1.substring(8,10);
          datum2=datum2.substring(3,5)+"/"+datum2.substring(0,2)+"/"+datum2.substring(8,10);
        });     
    }); 
&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;      

&lt;table border="0" cellspacing="1" cellpadding="1" style="background-color: #7a7c72; opacity: 0.8; margin-top: 15px; width: 230px;"&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td align="center" style="background-color: #61625b; color: #ffffff; font-weight: bold; padding: 3px; font-size: 13px;"&gt;CHECK AVAILABILITY&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="center"&gt;&lt;form id="availability" type="get" action="https://secure.netbookerng.com/soahotel/zablijak/cs/hseoptx_UZ/hseoid_22959509.html"&gt;

                &lt;table border="0" cellspacing="2" cellpadding="0" style="width: 200px;"&gt;
                    &lt;tbody&gt;
                        &lt;tr&gt;
                            &lt;td height="22" colspan="3" align="left" valign="bottom" style="font-size: 11px; font-weight: bold;"&gt;&lt;label&gt;Check in&lt;/label&gt;&lt;/td&gt;
                        &lt;/tr&gt;
                        &lt;tr&gt;
                            &lt;td height="17" colspan="3" align="left" valign="bottom"&gt;&lt;input name="begindate" type="text" id="datepicker1" /&gt;&lt;/td&gt;
                        &lt;/tr&gt;
                        &lt;tr&gt;
                            &lt;td height="17" colspan="3" align="left" valign="bottom" style="font-size: 11px; font-weight: bold;"&gt;&lt;label&gt;Check out&lt;/label&gt;&lt;/td&gt;
                        &lt;/tr&gt;
                        &lt;tr&gt;
                            &lt;td height="17" colspan="3" align="left" valign="bottom"&gt;&lt;input id="datepicker2" name="enddate" type="text" /&gt;&lt;/td&gt;
                        &lt;/tr&gt;
                        &lt;tr style="font-size: 11px; font-weight: bold;"&gt;
                            &lt;td width="65" height="17" align="left" valign="bottom"&gt;Rooms&lt;/td&gt;
                            &lt;td width="65" height="17" align="left" valign="bottom"&gt;Adults&lt;/td&gt;
                            &lt;td width="65" height="17" align="left" valign="bottom"&gt;Children&lt;/td&gt;
                        &lt;/tr&gt;
                        &lt;tr&gt;
                            &lt;td width="65" height="17" align="left" valign="bottom"&gt;&lt;select name="rooms" id="rooms"&gt; &lt;option value="1" selected="selected"&gt;1&lt;/option&gt; &lt;option value="2"&gt;2&lt;/option&gt; &lt;option value="3"&gt;3&lt;/option&gt; &lt;option value="4"&gt;4&lt;/option&gt; &lt;option value="5"&gt;5&lt;/option&gt; &lt;option value="6"&gt;6&lt;/option&gt; &lt;option value="7"&gt;7&lt;/option&gt; &lt;option value="8"&gt;8&lt;/option&gt; &lt;option value="9"&gt;9&lt;/option&gt; &lt;option value="10"&gt;10&lt;/option&gt; &lt;option value="11"&gt;11&lt;/option&gt; &lt;option value="12"&gt;12&lt;/option&gt; &lt;option value="13"&gt;13&lt;/option&gt; &lt;option value="14"&gt;14&lt;/option&gt; &lt;option value="15"&gt;15&lt;/option&gt; &lt;/select&gt;&lt;/td&gt;
                            &lt;td width="65" height="17" align="left" valign="bottom"&gt;&lt;select name="adults" id="adults"&gt; &lt;option value="1" selected="selected"&gt;1&lt;/option&gt; &lt;option value="2"&gt;2&lt;/option&gt; &lt;option value="3"&gt;3&lt;/option&gt; &lt;option value="4"&gt;4&lt;/option&gt; &lt;option value="5"&gt;5&lt;/option&gt; &lt;option value="6"&gt;6&lt;/option&gt; &lt;option value="7"&gt;7&lt;/option&gt; &lt;option value="8"&gt;8&lt;/option&gt; &lt;option value="9"&gt;9&lt;/option&gt; &lt;option value="10"&gt;10&lt;/option&gt; &lt;option value="11"&gt;11&lt;/option&gt; &lt;option value="12"&gt;12&lt;/option&gt; &lt;option value="13"&gt;13&lt;/option&gt; &lt;option value="14"&gt;14&lt;/option&gt; &lt;option value="15"&gt;15&lt;/option&gt; &lt;/select&gt;&lt;/td&gt;
                            &lt;td width="65" height="17" align="left" valign="bottom"&gt;&lt;select name="children" id="children"&gt; &lt;option value="0" selected="selected"&gt;0&lt;/option&gt; &lt;option value="1"&gt;1&lt;/option&gt; &lt;option value="2"&gt;2&lt;/option&gt; &lt;option value="3"&gt;3&lt;/option&gt; &lt;option value="4"&gt;4&lt;/option&gt; &lt;option value="5"&gt;5&lt;/option&gt; &lt;option value="6"&gt;6&lt;/option&gt; &lt;option value="7"&gt;7&lt;/option&gt; &lt;option value="8"&gt;8&lt;/option&gt; &lt;option value="9"&gt;9&lt;/option&gt; &lt;option value="10"&gt;10&lt;/option&gt; &lt;option value="11"&gt;11&lt;/option&gt; &lt;option value="12"&gt;12&lt;/option&gt; &lt;option value="13"&gt;13&lt;/option&gt; &lt;option value="14"&gt;14&lt;/option&gt; &lt;option value="15"&gt;15&lt;/option&gt; &lt;/select&gt;&lt;/td&gt;
                        &lt;/tr&gt;
                        &lt;tr&gt;
                            &lt;td height="40" colspan="3" align="center"&gt;
                            &lt;input id="posalji" name="Check" type="submit" value="Check Availability"&gt;
                            &lt;/td&gt;
                        &lt;/tr&gt;
                    &lt;/tbody&gt;
                &lt;/table&gt;

                &lt;/form&gt;&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;


&lt;/body&gt;

&lt;/html&gt;
</code></pre>

<p>In order to make it work I need:</p>

<ul>
<li>to replace <code>%2F</code> from the URL with just <code>/</code></li>
<li>I need to add <code>autosearch=true</code> after <code>?</code></li>
<li>I need to remove the last parameter called <code>Check</code></li>
</ul>

<p>I am not really good with javascript, I'll appreciate some help.</p>
