Wrap time/place and map in collapsing regions
Wrap time/place and map in collapsing regions

--- a/busui/common.inc.php
+++ b/busui/common.inc.php
@@ -8,8 +8,6 @@
 
  // you have to open the session to be able to modify or remove it 
 session_start(); 
- 
-
 function isDebug()
 {
     return $_SERVER['SERVER_NAME'] == "10.0.1.154" || $_SERVER['SERVER_NAME'] == "localhost" || $_SERVER['SERVER_NAME'] == "127.0.0.1" || !$_SERVER['SERVER_NAME'];
@@ -228,8 +226,11 @@
         }
        $center = $totalLat/sizeof($mapPoints).",".$totalLon/sizeof($mapPoints);
     }
-    
-    return '<img src="staticmaplite/staticmap.php?center='.$center.'&zoom='.$zoom.'&size='.$width.'x'.$height.'&maptype=mapnik&markers='.$markers.'" width='.$width.' height='.$height.'>';
+    $output = "";
+    $output .= '<div data-role="collapsible" data-collapsed="true"><h3>Open Map...</h3>';
+    $output .= '<center><img src="staticmaplite/staticmap.php?center='.$center.'&zoom='.$zoom.'&size='.$width.'x'.$height.'&maptype=mapnik&markers='.$markers.'" width='.$width.' height='.$height.'></center>';
+    $output .= '</div>';
+    return $output;
 }
 
 function distance($lat1, $lng1, $lat2, $lng2)
@@ -392,6 +393,36 @@
     }
     return implode(", ",$pointNames);
 }
+
+function timePlaceSettings() {
+    global $service_periods;
+    echo '<div data-role="collapsible" data-collapsed="true">
+        <h3>Change Time/Place...</h3>
+        <div class="ui-body"> 
+		<div data-role="fieldcontain">
+	            <label for="geolocate"> Current Location: </label>
+			<input type="text" id="geolocate" name="geolocate" value="Enter co-ordinates or address here"/> <a href="#" style="display:none" name="here" id="here"/>Here?</a>
+	        </div>
+    		<div data-role="fieldcontain">
+		        <label for="time"> Time: </label>
+		    	<input type="time" value="'. date("H:m").'"/> <a href="#" style="display:none" name="currentTime" id="currentTime"/>Current Time?</a>
+	        </div>
+		<div data-role="fieldcontain">
+		    <label for="service_period"> Service Period:  </label>
+			<select name="service_period">';
+
+			   foreach ($service_periods as $service_period) {
+			    echo "<option value=\"$service_period\"".(service_period() === $service_period ? "SELECTED" : "").'>'.ucwords($service_period).'</option>';
+			   }
+			echo '</select>
+			<a href="#" style="display:none" name="currentPeriod" id="currentPeriod"/>Current Period?</a>
+		</div>
+		
+		<input type="submit" value="Update"/>
+            </div></div>';
+echo "	<script>
+$('#here').click(function(event) { $('#geolocate').val(getCookie('geolocate')); return false;});
+$('#here').show();
+        </script>";
+}
 ?>
-  
-

--- a/busui/index.php
+++ b/busui/index.php
@@ -30,34 +30,8 @@
 		<li><a href="routeList.php?bynumber=yes">Routes By Number</a></li>
 		<li><a href="routeList.php?nearby=yes">Nearby Routes</a></li>
             </ul>
-            <div class="ui-body ui-body-c">
-		<h3>Time/Place Settings</h3>
-		<div data-role="fieldcontain">
-	            <label for="geolocate"> Current Location: </label>
-			<input type="text" id="geolocate" name="geolocate"/> <a href="#" style="display:none" name="here" id="here"/>Here?</a>
-	        </div>
-    		<div data-role="fieldcontain">
-		        <label for="time"> Time: </label>
-		    	<input type="time" value="<?php echo date("H:m"); ?>"/> <a href="#" style="display:none" name="currentTime" id="currentTime"/>Current Time?</a>
-	        </div>
-		<div data-role="fieldcontain">
-		    <label for="service_period"> Service Period:  </label>
-			<select name="service_period">	
-			   <?php
-			   foreach ($service_periods as $service_period) {
-			    echo "<option value=\"$service_period\"".(service_period() === $service_period ? "SELECTED" : "").'>'.ucwords($service_period).'</option>';
-			   }?>
-			</select>
-			<a href="#" style="display:none" name="currentPeriod" id="currentPeriod"/>Current Period?</a>
-		</div>
-		
-		<input type="submit" value="Update"/>
-            </div>
-	<script>
-$('#here').click(function(event) { $('#geolocate').val(getCookie('geolocate')); return false;});
-$('#here').show();
-        </script>
-        </div>
+<?php echo timePlaceSettings();?>
+        
    </div>
  </body>
 </html>

--- a/busui/js/jquery.ui.datepicker.mobile.js
+++ b/busui/js/jquery.ui.datepicker.mobile.js
@@ -47,9 +47,12 @@
 	};
 		
 	//bind to pagecreate to automatically enhance date inputs	
-	$( ".ui-page" ).live( "pagecreate", function(){		
+	$( ".ui-page" ).live( "pagecreate", function(){     
 		$( "input[type='date'], input[data-type='date']" ).each(function(){
+		    if ($(this).hasClass("hasDatepicker") == false) {
 			$(this).after( $( "<div />" ).datepicker({ altField: "#" + $(this).attr( "id" ), showOtherMonths: true }) );
-		});	
-	});
+			$(this).addClass("hasDatepicker");
+		    }
+		}); 
+    });
 })( jQuery );

--- a/busui/tripPlanner.php
+++ b/busui/tripPlanner.php
@@ -6,7 +6,8 @@
       $from = (isset($_REQUEST['from']) ? $_REQUEST['from'] : "Brigalow");
       $to = (isset($_REQUEST['to']) ? $_REQUEST['to'] : "Barry");
       $date = (isset($_REQUEST['date']) ? $_REQUEST['date'] : date("m/d/Y"));
-      $time = (isset($_REQUEST['time']) ? $_REQUEST['time'] : date("h:ia"));
+      $time = (isset($_REQUEST['time']) ? $_REQUEST['time'] : date("H:m"));
+      # todo: convert date from form to h:ia?
       echo "<font color=red>$errorMessage</font>";
       echo '<form action="tripPlanner.php" method="post">
     <div data-role="fieldcontain">