Merge branch 'master' of ssh://apples.lambdacomplex.org/git/bus
Merge branch 'master' of ssh://apples.lambdacomplex.org/git/bus

file:a/busui/about.php (deleted)
<?php  
include('common.inc.php');  
?>  
<p>  
Busness Time - An ACT bus timetable webapp  
Based on the maxious-canberra-transit-feed  
Uses jQuery Mobile, PHP, Ruby, Python, Google Transit Feed Specification tools, OpenTripPlanner, OpenLayers, OpenStreetMap, Cloudmade Geocoder and Tile Service  
 
Feedback encouraged; contact maxious@lambdacomplex.org  
 
Some icons by Joseph Wain / glyphish.com  
 
 
Disclaimer: The content of this website is of a general and informative nature. Please check with printed timetables or those available on http://action.act.gov.au before your trip.  
Whilst every effort has been made to ensure the high quality and accuracy of the Site, the Author makes no warranty,  
express or implied concerning the topicality, correctness, completeness or quality of the information, which is provided  
"as is". The Author expressly disclaims all warranties, including but not limited to warranties of fitness for a particular purpose and warranties of merchantability.  
All offers are not binding and without obligation. The Author expressly reserves the right, in his discretion, to suspend,  
change, modify, add or remove portions of the Site and to restrict or terminate the use and accessibility of the Site  
without prior notice.  
<?  
include_footer();  
?>  
 
file:a/busui/common.inc.php (deleted)
<?php  
date_default_timezone_set('Australia/ACT');  
$APIurl = "http://localhost:8765";  
$cloudmadeAPIkey="daa03470bb8740298d4b10e3f03d63e6";  
$googleMapsAPIkey="ABQIAAAA95XYXN0cki3Yj_Sb71CFvBTPaLd08ONybQDjcH_VdYtHHLgZvRTw2INzI_m17_IoOUqH3RNNmlTk1Q";  
$otpAPIurl = 'http://10.1.0.243:5080/opentripplanner-api-webapp/';  
if (isDebug()) error_reporting(E_ALL ^ E_NOTICE);  
 
// SELECT array_to_string(array(SELECT REPLACE(name_2006, ',', '\,') as name FROM suburbs order by name), ',')  
$suburbs = explode(",","Acton,Ainslie,Amaroo,Aranda,Banks,Barton,Belconnen,Bonner,Bonython,Braddon,Bruce,Calwell,Campbell,Chapman,Charnwood,Chifley,Chisholm,City,Conder,Cook,Curtin,Deakin,Dickson,Downer,Duffy,Dunlop,Evatt,Fadden,Farrer,Fisher,Florey,Flynn,Forrest,Franklin,Fraser,Fyshwick,Garran,Gilmore,Giralang,Gordon,Gowrie,Greenway,Griffith,Gungahlin,Hackett,Hall,Harrison,Hawker,Higgins,Holder,Holt,Hughes,Hume,Isaacs,Isabella Plains,Kaleen,Kambah,Kingston,Latham,Lawson,Lyneham,Lyons,Macarthur,Macgregor,Macquarie,Mawson,McKellar,Melba,Mitchell,Monash,Narrabundah,Ngunnawal,Nicholls,Oaks Estate,O'Connor,O'Malley,Oxley,Page,Palmerston,Parkes,Pearce,Phillip,Pialligo,Red Hill,Reid,Richardson,Rivett,Russell,Scullin,Spence,Stirling,Symonston,Tharwa,Theodore,Torrens,Turner,Wanniassa,Waramanga,Watson,Weetangera,Weston,Yarralumla");  
 
// you have to open the session to be able to modify or remove it  
session_start();  
if (isset($_REQUEST['service_period'])) $_SESSION['service_period'] = filter_var($_REQUEST['service_period'],FILTER_SANITIZE_STRING);  
if (isset($_REQUEST['time'])) $_SESSION['time'] = filter_var($_REQUEST['time'],FILTER_SANITIZE_STRING);  
if (isset($_REQUEST['geolocate'])) {  
$contents = geocode(var_filter($_REQUEST['geolocate'],FILTER_SANITIZE_URL),true);  
if (isset($contents[0]->centroid)) {  
$session['lat'] = $contents[0]->centroid->coordinates[0];  
$session['lon'] = $contents[0]->centroid->coordinates[1];  
}  
else {  
$session['lat'] = "";  
$session['lon'] = "";  
}  
}  
//print_r ($_SESSION);  
function isDebug()  
{  
return $_SERVER['SERVER_NAME'] == "10.0.1.154" || $_SERVER['SERVER_NAME'] == "localhost" || $_SERVER['SERVER_NAME'] == "127.0.0.1" || !$_SERVER['SERVER_NAME'];  
}  
 
function debug($msg) {  
if (isDebug()) echo "<!-- $msg -->";  
}  
function isFastDevice() {  
return true;  
}  
 
function include_header($pageTitle, $opendiv = true, $geolocate = false) {  
echo '  
<!DOCTYPE html>  
<html>  
<head>  
<title>busness time - '.$pageTitle.'</title>  
';  
if (isDebug()) echo '<link rel="stylesheet" href="css/jquery-mobile-1.0a3.css" />  
<script type="text/javascript" src="js/jquery-1.5.js"></script>  
<script type="text/javascript" src="js/jquery-mobile-1.0a3.js"></script>';  
else echo '<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.css" />  
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.js"></script>  
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.js"></script>';  
echo '  
<link rel="stylesheet" href="css/jquery.ui.datepicker.mobile.css" />  
<script>  
//reset type=date inputs to text  
$( document ).bind( "mobileinit", function(){  
$.mobile.page.prototype.options.degradeInputs.date = true;  
});  
</script>  
<script src="js/jQuery.ui.datepicker.js"></script>  
<script src="js/jquery.ui.datepicker.mobile.js"></script>  
<style type="text/css">  
.ui-navbar {  
width: 100%;  
}  
.ui-btn-inner {  
white-space: normal !important;  
}  
.ui-li-heading {  
white-space: normal !important;  
}  
.ui-listview-filter {  
margin: 0 !important;  
}  
</style>  
<meta name="apple-mobile-web-app-capable" content="yes" />  
<meta name="apple-mobile-web-app-status-bar-style" content="black" />  
<link rel="apple-touch-startup-image" href="startup.png" />  
<link rel="apple-touch-icon" href="apple-touch-icon.png" />';  
if ($geolocate) {  
echo "<script>  
 
function success(position) {  
$('#geolocate').val(position.coords.latitude+','+position.coords.longitude);  
// setCookie('geolocate',position.coords.latitude+','+position.coords.longitude,1);  
$('#here').click(function(event) { $('#geolocate').val(doAJAXrequestForGeolocSessionHere()); return false;});  
$('#here').show();  
}  
function error(msg) {  
console.log(msg);  
}  
 
if (navigator.geolocation) {  
navigator.geolocation.getCurrentPosition(success, error);  
}  
 
</script> ";  
}  
echo '</head>  
<body>  
';  
if ($opendiv) {  
echo '<div data-role="page">  
 
<div data-role="header">  
<h1>'.$pageTitle.'</h1>  
</div><!-- /header -->  
<div data-role="content"> ';  
}  
}  
 
function include_footer()  
{  
if ($geolocate && isset($_SESSION['lat'])) {  
echo "<script>  
$('#here').click(function(event) { $('#geolocate').val(doAJAXrequestForGeolocSessionHere()); return false;});  
$('#here').show();  
</script>";  
}  
echo '</div>';  
}  
 
$service_periods = Array ('sunday','saturday','weekday');  
 
function service_period()  
{  
if (isset($_SESSION['service_period'])) return $_SESSION['service_period'];  
 
switch (date('w')){  
 
case 0:  
return 'sunday';  
case 6:  
return 'saturday';  
default:  
return 'weekday';  
}  
}  
 
function remove_spaces($string)  
{  
return str_replace(' ','',$string);  
}  
 
function midnight_seconds()  
{  
// from http://www.perturb.org/display/Perlfunc__Seconds_Since_Midnight.html  
if (isset($_SESSION['time'])) {  
$time = strtotime($_SESSION['time']);  
return (date("G",$time) * 3600) + (date("i",$time) * 60) + date("s",$time);  
}  
return (date("G") * 3600) + (date("i") * 60) + date("s");  
}  
 
function midnight_seconds_to_time($seconds)  
{  
if ($seconds > 0) {  
$midnight = mktime (0, 0, 0, date("n"), date("j"), date("Y"));  
return date("h:ia",$midnight+$seconds);  
} else {  
return "";  
}  
}  
function getPage($url)  
{  
debug($url);  
$ch = curl_init($url);  
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );  
curl_setopt( $ch, CURLOPT_HEADER, 0 );  
curl_setopt($ch,CURLOPT_TIMEOUT,30);  
$page = curl_exec($ch);  
if(curl_errno($ch)) echo "<font color=red> Database temporarily unavailable: ".curl_errno($ch)." ".curl_error($ch)."</font>";  
curl_close($ch);  
return $page;  
}  
function array_flatten($a,$f=array()){  
if(!$a||!is_array($a))return '';  
foreach($a as $k=>$v){  
if(is_array($v))$f=array_flatten($v,$f);  
else $f[$k]=$v;  
}  
return $f;  
}  
 
function staticmap($mapPoints, $zoom = 0, $markerImage = "iconb")  
{  
$width = 300;  
$height = 300;  
$metersperpixel[9]=305.492*$width;  
$metersperpixel[10]=152.746*$width;  
$metersperpixel[11]=76.373*$width;  
$metersperpixel[12]=38.187*$width;  
$metersperpixel[13]=19.093*$width;  
$metersperpixel[14]=9.547*$width;  
$metersperpixel[15]=4.773*$width;  
$metersperpixel[16]=2.387*$width;  
// $metersperpixel[17]=1.193*$width;  
$center = "";  
$markers = "";  
$minlat = 999;  
$minlon = 999;  
$maxlat = 0;  
$maxlon = 0;  
 
if (sizeof($mapPoints) < 1) return "map error";  
if (sizeof($mapPoints) === 1) {  
if ($zoom == 0) $zoom = 14;  
$markers .= "{$mapPoints[0][0]},{$mapPoints[0][1]},$markerimage";  
$center = "{$mapPoints[0][0]},{$mapPoints[0][1]}";  
} else {  
foreach ($mapPoints as $index => $mapPoint) {  
$markers .= $mapPoint[0].",".$mapPoint[1].",".$markerImage.($index+1);  
if ($index+1 != sizeof($mapPoints)) $markers .= "|";  
if ($mapPoint[0] < $minlat) $minlat = $mapPoint[0];  
if ($mapPoint[0] > $maxlat) $maxlat = $mapPoint[0];  
if ($mapPoint[1] < $minlon) $minlon = $mapPoint[1];  
if ($mapPoint[1] > $maxlon) $maxlon = $mapPoint[1];  
$totalLat += $mapPoint[0];  
$totalLon += $mapPoint[1];  
}  
if ($zoom == 0) {  
$mapwidthinmeters = distance($minlat,$minlon,$minlat,$maxlon);  
foreach (array_reverse($metersperpixel,true) as $zoomLevel => $maxdistance)  
{  
if ($zoom == 0 && $mapwidthinmeters < ($maxdistance + 50)) $zoom = $zoomLevel;  
}  
}  
$center = $totalLat/sizeof($mapPoints).",".$totalLon/sizeof($mapPoints);  
}  
$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)  
{  
$pi80 = M_PI / 180;  
$lat1 *= $pi80;  
$lng1 *= $pi80;  
$lat2 *= $pi80;  
$lng2 *= $pi80;  
 
$r = 6372.797; // mean radius of Earth in km  
$dlat = $lat2 - $lat1;  
$dlng = $lng2 - $lng1;  
$a = sin($dlat / 2) * sin($dlat / 2) + cos($lat1) * cos($lat2) * sin($dlng / 2) * sin($dlng / 2);  
$c = 2 * atan2(sqrt($a), sqrt(1 - $a));  
$km = $r * $c;  
 
return $km * 1000;  
}  
 
function decodePolylineToArray($encoded)  
{  
// source: http://latlongeeks.com/forum/viewtopic.php?f=4&t=5  
$length = strlen($encoded);  
$index = 0;  
$points = array();  
$lat = 0;  
$lng = 0;  
 
while ($index < $length)  
{  
// Temporary variable to hold each ASCII byte.  
$b = 0;  
 
// The encoded polyline consists of a latitude value followed by a  
// longitude value. They should always come in pairs. Read the  
// latitude value first.  
$shift = 0;  
$result = 0;  
do  
{  
// The `ord(substr($encoded, $index++))` statement returns the ASCII  
// code for the character at $index. Subtract 63 to get the original  
// value. (63 was added to ensure proper ASCII characters are displayed  
// in the encoded polyline string, which is `human` readable)  
$b = ord(substr($encoded, $index++)) - 63;  
 
// AND the bits of the byte with 0x1f to get the original 5-bit `chunk.  
// Then left shift the bits by the required amount, which increases  
// by 5 bits each time.  
// OR the value into $results, which sums up the individual 5-bit chunks  
// into the original value. Since the 5-bit chunks were reversed in  
// order during encoding, reading them in this way ensures proper  
// summation.  
$result |= ($b & 0x1f) << $shift;  
$shift += 5;  
}  
// Continue while the read byte is >= 0x20 since the last `chunk`  
// was not OR'd with 0x20 during the conversion process. (Signals the end)  
while ($b >= 0x20);  
 
// Check if negative, and convert. (All negative values have the last bit  
// set)  
$dlat = (($result & 1) ? ~($result >> 1) : ($result >> 1));  
 
// Compute actual latitude since value is offset from previous value.  
$lat += $dlat;  
 
// The next values will correspond to the longitude for this point.  
$shift = 0;  
$result = 0;  
do  
{  
$b = ord(substr($encoded, $index++)) - 63;  
$result |= ($b & 0x1f) << $shift;  
$shift += 5;  
}  
while ($b >= 0x20);  
 
$dlng = (($result & 1) ? ~($result >> 1) : ($result >> 1));  
$lng += $dlng;  
 
// The actual latitude and longitude values were multiplied by  
// 1e5 before encoding so that they could be converted to a 32-bit  
// integer representation. (With a decimal accuracy of 5 places)  
// Convert back to original values.  
$points[] = array($lat * 1e-5, $lng * 1e-5);  
}  
 
return $points;  
}  
 
function object2array($object) {  
if (is_object($object)) {  
foreach ($object as $key => $value) {  
$array[$key] = $value;  
}  
}  
else {  
$array = $object;  
}  
return $array;  
}  
 
function geocode($query, $giveOptions) {  
global $cloudmadeAPIkey;  
$url = "http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?query=".$query."&bbox=-35.5,149.00,-35.15,149.1930&return_location=true&bbox_only=true";  
$contents = json_decode(getPage($url));  
if ($giveOptions) return $contents->features;  
elseif (isset($contents->features[0]->centroid)) return $contents->features[0]->centroid->coordinates[0].",".$contents->features[0]->centroid->coordinates[1];  
else return "";  
}  
 
function reverseGeocode($lat,$lng) {  
global $cloudmadeAPIkey;  
$url = "http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?around=".$lat.",".$lng."&distance=closest&object_type=road";  
$contents = json_decode(getPage($url));  
return $contents->features[0]->properties->name;  
}  
 
function startsWith($haystack,$needle,$case=true) {  
if($case){return (strcmp(substr($haystack, 0, strlen($needle)),$needle)===0);}  
return (strcasecmp(substr($haystack, 0, strlen($needle)),$needle)===0);  
}  
 
function endsWith($haystack,$needle,$case=true) {  
if($case){return (strcmp(substr($haystack, strlen($haystack) - strlen($needle)),$needle)===0);}  
return (strcasecmp(substr($haystack, strlen($haystack) - strlen($needle)),$needle)===0);  
}  
function bracketsMeanNewLine($input) {  
return str_replace(")","</small>",str_replace("(","<br><small>",$input));  
}  
 
function viaPoints($tripid,$stopid, $timingPointsOnly = false) {  
global $APIurl;  
$url = $APIurl."/json/tripstoptimes?trip=".$tripid;  
 
$json = json_decode(getPage($url));  
debug(print_r($json,true));  
$stops = $json[0];  
$times = $json[1];  
$foundStop = false;  
$viaPoints = Array();  
foreach ($stops as $key => $row)  
{  
if ($foundStop) {  
if (!$timingPointsOnly || !startsWith($row[5],"Wj") ) {  
$viaPoints[] = Array("id" => $row[0], "name" => $row[1], "time" => $times[$key]);  
}  
} else {  
if ($row[0] == $stopid) $foundStop = true;  
}  
}  
return $viaPoints;  
}  
 
function viaPointNames($tripid,$stopid) {  
$points = viaPoints($tripid,$stopid,true);  
$pointNames = Array();  
foreach ($points as $point) {  
$pointNames[] = $point['name'];  
}  
return implode(", ",$pointNames);  
}  
 
function timePlaceSettings($geolocate = false) {  
global $service_periods;  
$geoerror = false;  
if ($geolocate == true) {  
$geoerror = !isset($_SESSION['lat']) || !isset($_SESSION['lat'])  
|| $_SESSION['lat'] == "" || $_SESSION['lon'] == "";  
}  
if ($geoerror) {  
echo '<div class="error">Sorry, but your location could not currently be detected.  
Please allow location permission, wait for your location to be detected,  
or enter an address/co-ordinates in the box below.</div>';  
}  
echo '<div data-role="collapsible" data-collapsed="'.!$geoerror.'">  
<h3>Change Time/Place...</h3>  
<form action="" method="post">  
<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" name="time" id="time" value="'. ($_SESSION['time'] ? $_SESSION['time'] : date("H:m")).'"/> <a href="#" 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"/>  
</form>  
</div></div>';  
}  
?>  
 Binary files a/busui/css/images/01-refresh.png and /dev/null differ
 Binary files a/busui/css/images/02-redo.png and /dev/null differ
 Binary files a/busui/css/images/06-magnify.png and /dev/null differ
 Binary files a/busui/css/images/07-map-marker.png and /dev/null differ
 Binary files a/busui/css/images/101-gameplan.png and /dev/null differ
 Binary files a/busui/css/images/102-walk.png and /dev/null differ
 Binary files a/busui/css/images/103-map.png and /dev/null differ
 Binary files a/busui/css/images/113-navigation.png and /dev/null differ
 Binary files a/busui/css/images/121-landscape.png and /dev/null differ
 Binary files a/busui/css/images/13-target.png and /dev/null differ
 Binary files a/busui/css/images/139-flags.png and /dev/null differ
 Binary files a/busui/css/images/145-persondot.png and /dev/null differ
 Binary files a/busui/css/images/184-warning.png and /dev/null differ
 Binary files a/busui/css/images/193-location-arrow.png and /dev/null differ
 Binary files a/busui/css/images/28-star.png and /dev/null differ
 Binary files a/busui/css/images/53-house.png and /dev/null differ
 Binary files a/busui/css/images/55-network.png and /dev/null differ
 Binary files a/busui/css/images/57-download.png and /dev/null differ
 Binary files a/busui/css/images/58-bookmark.png and /dev/null differ
 Binary files a/busui/css/images/59-flag.png and /dev/null differ
 Binary files a/busui/css/images/60-signpost.png and /dev/null differ
 Binary files a/busui/css/images/73-radar.png and /dev/null differ
 Binary files a/busui/css/images/74-location.png and /dev/null differ
 Binary files a/busui/css/images/83-calendar.png and /dev/null differ
/*!  
* jQuery Mobile v1.0a3  
* http://jquerymobile.com/  
*  
* Copyright 2010, jQuery Project  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*/  
/*!  
* jQuery Mobile v1.0a3  
* http://jquerymobile.com/  
*  
* Copyright 2010, jQuery Project  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*/.ui-bar-a{border:1px solid #2a2a2a;background:#111;color:#fff;font-weight:bold;text-shadow:0 -1px 1px #000;background-image:-moz-linear-gradient(top,#3c3c3c,#111);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#3c3c3c),color-stop(1,#111));-msfilter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#3c3c3c', EndColorStr='#111111')"}.ui-bar-a,.ui-bar-a input,.ui-bar-a select,.ui-bar-a textarea,.ui-bar-a button{font-family:Helvetica,Arial,sans-serif}.ui-bar-a .ui-link-inherit{color:#fff}.ui-bar-a .ui-link{color:#7cc4e7;font-weight:bold}.ui-body-a{border:1px solid #2a2a2a;background:#222;color:#fff;text-shadow:0 1px 0 #000;font-weight:normal;background-image:-moz-linear-gradient(top,#666,#222);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#666),color-stop(1,#222));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#666666', EndColorStr='#222222)')"}.ui-body-a,.ui-body-a input,.ui-body-a select,.ui-body-a textarea,.ui-body-a button{font-family:Helvetica,Arial,sans-serif}.ui-body-a .ui-link-inherit{color:#fff}.ui-body-a .ui-link{color:#2489ce;font-weight:bold}.ui-br{border-bottom:1px solid rgba(130,130,130,.3)}.ui-btn-up-a{border:1px solid #222;background:#333;font-weight:bold;color:#fff;cursor:pointer;text-shadow:0 -1px 1px #000;text-decoration:none;background-image:-moz-linear-gradient(top,#555,#333);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#555),color-stop(1,#333));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#555555', EndColorStr='#333333')"}.ui-btn-up-a a.ui-link-inherit{color:#fff}.ui-btn-hover-a{border:1px solid #000;background:#444;font-weight:bold;color:#fff;text-shadow:0 -1px 1px #000;text-decoration:none;background-image:-moz-linear-gradient(top,#666,#444);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#666),color-stop(1,#444));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#666666', EndColorStr='#444444')"}.ui-btn-hover-a a.ui-link-inherit{color:#fff}.ui-btn-down-a{border:1px solid #000;background:#3d3d3d;font-weight:bold;color:#fff;text-shadow:0 -1px 1px #000;background-image:-moz-linear-gradient(top,#333,#5a5a5a);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#333),color-stop(1,#5a5a5a));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#333333', EndColorStr='#5a5a5a')"}.ui-btn-down-a a.ui-link-inherit{color:#fff}.ui-btn-up-a,.ui-btn-hover-a,.ui-btn-down-a{font-family:Helvetica,Arial,sans-serif}.ui-bar-b{border:1px solid #456f9a;background:#5e87b0;color:#fff;font-weight:bold;text-shadow:0 -1px 1px #254f7a;background-image:-moz-linear-gradient(top,#81a8ce,#5e87b0);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#81a8ce),color-stop(1,#5e87b0));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#81a8ce', EndColorStr='#5e87b0')"}.ui-bar-b,.ui-bar-b input,.ui-bar-b select,.ui-bar-b textarea,.ui-bar-b button{font-family:Helvetica,Arial,sans-serif}.ui-bar-b .ui-link-inherit{color:#fff}.ui-bar-b .ui-link{color:#7cc4e7;font-weight:bold}.ui-body-b{border:1px solid #c6c6c6;background:#ccc;color:#333;text-shadow:0 1px 0 #fff;font-weight:normal;background-image:-moz-linear-gradient(top,#e6e6e6,#ccc);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#e6e6e6),color-stop(1,#ccc));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#e6e6e6', EndColorStr='#cccccc')"}.ui-body-b,.ui-body-b input,.ui-body-b select,.ui-body-b textarea,.ui-body-b button{font-family:Helvetica,Arial,sans-serif}.ui-body-b .ui-link-inherit{color:#333}.ui-body-b .ui-link{color:#2489ce;font-weight:bold}.ui-btn-up-b{border:1px solid #145072;background:#2567ab;font-weight:bold;color:#fff;cursor:pointer;text-shadow:0 -1px 1px #145072;text-decoration:none;background-image:-moz-linear-gradient(top,#4e89c5,#2567ab);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#5f9cc5),color-stop(1,#396b9e));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#4e89c5', EndColorStr='#2567ab')"}.ui-btn-up-b a.ui-link-inherit{color:#fff}.ui-btn-hover-b{border:1px solid #00516e;background:#4b88b6;font-weight:bold;color:#fff;text-shadow:0 -1px 1px #014d68;background-image:-moz-linear-gradient(top,#72b0d4,#4b88b6);text-decoration:none;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#72b0d4),color-stop(1,#4b88b6));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#72b0d4', EndColorStr='#4b88b6')"}.ui-btn-hover-b a.ui-link-inherit{color:#fff}.ui-btn-down-b{border:1px solid #225377;background:#4e89c5;font-weight:bold;color:#fff;text-shadow:0 -1px 1px #225377;background-image:-moz-linear-gradient(top,#396b9e,#4e89c5);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#396b9e),color-stop(1,#4e89c5));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#396b9e', EndColorStr='#4e89c5')"}.ui-btn-down-b a.ui-link-inherit{color:#fff}.ui-btn-up-b,.ui-btn-hover-b,.ui-btn-down-b{font-family:Helvetica,Arial,sans-serif}.ui-bar-c{border:1px solid #b3b3b3;background:#e9eaeb;color:#3e3e3e;font-weight:bold;text-shadow:0 1px 1px #fff;background-image:-moz-linear-gradient(top,#f0f0f0,#e9eaeb);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#f0f0f0),color-stop(1,#e9eaeb));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#f0f0f0', EndColorStr='#e9eaeb')"}.ui-bar-c,.ui-bar-c input,.ui-bar-c select,.ui-bar-c textarea,.ui-bar-c button{font-family:Helvetica,Arial,sans-serif}.ui-body-c{border:1px solid #b3b3b3;color:#333;text-shadow:0 1px 0 #fff;background:#f0f0f0;background-image:-moz-linear-gradient(top,#eee,#ddd);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#eee),color-stop(1,#ddd));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#eeeeee', EndColorStr='#dddddd')"}.ui-body-c,.ui-body-c input,.ui-body-c select,.ui-body-c textarea,.ui-body-c button{font-family:Helvetica,Arial,sans-serif}.ui-body-c .ui-link-inherit{color:#333}.ui-body-c .ui-link{color:#2489ce;font-weight:bold}.ui-btn-up-c{border:1px solid #ccc;background:#eee;font-weight:bold;color:#444;cursor:pointer;text-shadow:0 1px 1px #f6f6f6;text-decoration:none;background-image:-moz-linear-gradient(top,#fefefe,#eee);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fdfdfd),color-stop(1,#eee));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#fdfdfd', EndColorStr='#eeeeee')"}.ui-btn-up-c a.ui-link-inherit{color:#2f3e46}.ui-btn-hover-c{border:1px solid #bbb;background:#dadada;font-weight:bold;color:#101010;text-decoration:none;text-shadow:0 1px 1px #fff;background-image:-moz-linear-gradient(top,#ededed,#dadada);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#ededed),color-stop(1,#dadada));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#ededed', EndColorStr='#dadada')"}.ui-btn-hover-c a.ui-link-inherit{color:#2f3e46}.ui-btn-down-c{border:1px solid #808080;background:#fdfdfd;font-weight:bold;color:#111;text-shadow:0 1px 1px #fff;background-image:-moz-linear-gradient(top,#eee,#fdfdfd);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#eee),color-stop(1,#fdfdfd));-msfilter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#eeeeee', EndColorStr='#fdfdfd')"}.ui-btn-down-c a.ui-link-inherit{color:#2f3e46}.ui-btn-up-c,.ui-btn-hover-c,.ui-btn-down-c{font-family:Helvetica,Arial,sans-serif}.ui-bar-d{border:1px solid #ccc;background:#bbb;color:#333;text-shadow:0 1px 0 #eee;background-image:-moz-linear-gradient(top,#ddd,#bbb);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#ddd),color-stop(1,#bbb));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#dddddd', EndColorStr='#bbbbbb')"}.ui-bar-d,.ui-bar-d input,.ui-bar-d select,.ui-bar-d textarea,.ui-bar-d button{font-family:Helvetica,Arial,sans-serif}.ui-bar-d .ui-link-inherit{color:#333}.ui-bar-d .ui-link{color:#2489ce;font-weight:bold}.ui-body-d{border:1px solid #ccc;color:#333;text-shadow:0 1px 0 #fff;background:#fff}.ui-body-d,.ui-body-d input,.ui-body-d select,.ui-body-d textarea,.ui-body-d button{font-family:Helvetica,Arial,sans-serif}.ui-body-d .ui-link-inherit{color:#333}.ui-body-d .ui-link{color:#2489ce;font-weight:bold}.ui-btn-up-d{border:1px solid #ccc;background:#fff;font-weight:bold;color:#444;text-decoration:none;text-shadow:0 1px 1px #fff}.ui-btn-up-d a.ui-link-inherit{color:#333}.ui-btn-hover-d{border:1px solid #aaa;background:#eee;font-weight:bold;color:#222;cursor:pointer;text-shadow:0 1px 1px #fff;text-decoration:none;background-image:-moz-linear-gradient(top,#fdfdfd,#eee);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fdfdfd),color-stop(1,#eee));-msfilter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#fdfdfd', EndColorStr='#eeeeee')"}.ui-btn-hover-d a.ui-link-inherit{color:#222}.ui-btn-down-d{border:1px solid #aaa;background:#fff;font-weight:bold;color:#111;text-shadow:0 1px 1px #fff;background-image:-moz-linear-gradient(top,#eee,#fff);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#eee),color-stop(1,#fff));-msfilter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#eeeeee', EndColorStr='#ffffff')"}.ui-btn-down-d a.ui-link-inherit{border:1px solid #808080;background:#ced0d2;font-weight:bold;color:#111;text-shadow:none;background-image:-moz-linear-gradient(top,#ccc,#eee);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#ccc),color-stop(1,#eee));-msfilter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#cccccc', EndColorStr='#eeeeee')"}.ui-btn-up-d,.ui-btn-hover-d,.ui-btn-down-d{font-family:Helvetica,Arial,sans-serif}.ui-bar-e{border:1px solid #f7c942;background:#fadb4e;color:#333;text-shadow:0 1px 0 #fff;background-image:-moz-linear-gradient(top,#fceda7,#fadb4e);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fceda7),color-stop(1,#fadb4e));-msfilter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#fceda7', EndColorStr='#fadb4e')"}.ui-bar-e,.ui-bar-e input,.ui-bar-e select,.ui-bar-e textarea,.ui-bar-d button{font-family:Helvetica,Arial,sans-serif}.ui-bar-e .ui-link-inherit{color:#333}.ui-bar-e .ui-link{color:#2489ce;font-weight:bold}.ui-body-e{border:1px solid #f7c942;color:#333;text-shadow:0 1px 0 #fff;background:#faeb9e;background-image:-moz-linear-gradient(top,#fff,#faeb9e);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fff),color-stop(1,#faeb9e));-msfilter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffffff', EndColorStr='#faeb9e')"}.ui-body-e,.ui-body-e input,.ui-body-e select,.ui-body-e textarea,.ui-body-e button{font-family:Helvetica,Arial,sans-serif}.ui-body-e .ui-link-inherit{color:#333}.ui-body-e .ui-link{color:#2489ce;font-weight:bold}.ui-btn-up-e{border:1px solid #f7c942;background:#fadb4e;font-weight:bold;color:#333;cursor:pointer;text-shadow:0 1px 1px #fe3;text-decoration:none;text-shadow:0 1px 0 #fff;background-image:-moz-linear-gradient(top,#fceda7,#fadb4e);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fceda7),color-stop(1,#fadb4e));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#fceda7', EndColorStr='#fadb4e')"}.ui-btn-up-e a.ui-link-inherit{color:#333}.ui-btn-hover-e{border:1px solid #e79952;background:#fbe26f;font-weight:bold;color:#111;text-decoration:none;text-shadow:0 1px 1px #fff;background-image:-moz-linear-gradient(top,#fcf0b5,#fbe26f);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fcf0b5),color-stop(1,#fbe26f));-msfilter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#fcf0b5', EndColorStr='#fbe26f')"}.ui-btn-hover-e a.ui-link-inherit{color:#333}.ui-btn-down-e{border:1px solid #f7c942;background:#fceda7;font-weight:bold;color:#111;text-shadow:0 1px 1px #fff;background-image:-moz-linear-gradient(top,#fadb4e,#fceda7);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fadb4e),color-stop(1,#fceda7));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#fadb4e', EndColorStr='#fceda7')"}.ui-btn-down-e a.ui-link-inherit{color:#333}.ui-btn-up-e,.ui-btn-hover-e,.ui-btn-down-e{font-family:Helvetica,Arial,sans-serif}a.ui-link-inherit{text-decoration:none!important}.ui-btn-active{border:1px solid #155678;background:#4596ce;font-weight:bold;color:#fff;cursor:pointer;text-shadow:0 -1px 1px #145072;text-decoration:none;background-image:-moz-linear-gradient(top,#85bae4,#5393c5);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#85bae4),color-stop(1,#5393c5));-msfilter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#85bae4', EndColorStr='#5393c5')";outline:0}.ui-btn-active a.ui-link-inherit{color:#fff}.ui-btn-inner{border-top:1px solid #fff;border-color:rgba(255,255,255,.3)}.ui-corner-tl{-moz-border-radius-topleft:.6em;-webkit-border-top-left-radius:.6em;border-top-left-radius:.6em}.ui-corner-tr{-moz-border-radius-topright:.6em;-webkit-border-top-right-radius:.6em;border-top-right-radius:.6em}.ui-corner-bl{-moz-border-radius-bottomleft:.6em;-webkit-border-bottom-left-radius:.6em;border-bottom-left-radius:.6em}.ui-corner-br{-moz-border-radius-bottomright:.6em;-webkit-border-bottom-right-radius:.6em;border-bottom-right-radius:.6em}.ui-corner-top{-moz-border-radius-topleft:.6em;-webkit-border-top-left-radius:.6em;border-top-left-radius:.6em;-moz-border-radius-topright:.6em;-webkit-border-top-right-radius:.6em;border-top-right-radius:.6em}.ui-corner-bottom{-moz-border-radius-bottomleft:.6em;-webkit-border-bottom-left-radius:.6em;border-bottom-left-radius:.6em;-moz-border-radius-bottomright:.6em;-webkit-border-bottom-right-radius:.6em;border-bottom-right-radius:.6em}.ui-corner-right{-moz-border-radius-topright:.6em;-webkit-border-top-right-radius:.6em;border-top-right-radius:.6em;-moz-border-radius-bottomright:.6em;-webkit-border-bottom-right-radius:.6em;border-bottom-right-radius:.6em}.ui-corner-left{-moz-border-radius-topleft:.6em;-webkit-border-top-left-radius:.6em;border-top-left-radius:.6em;-moz-border-radius-bottomleft:.6em;-webkit-border-bottom-left-radius:.6em;border-bottom-left-radius:.6em}.ui-corner-all{-moz-border-radius:.6em;-webkit-border-radius:.6em;border-radius:.6em}.ui-disabled{opacity:.3}.ui-disabled,.ui-disabled a{cursor:default!important}.ui-icon{background-image:url(images/icons-18-white.png);background-repeat:no-repeat;background-color:#666;background-color:rgba(0,0,0,.4);-moz-border-radius:9px;-webkit-border-radius:9px;border-radius:9px}.ui-icon-disc{background-color:#666;background-color:rgba(0,0,0,.3);-moz-border-radius:9px;-webkit-border-radius:9px;border-radius:9px}.ui-icon-black{background-image:url(images/icons-18-black.png)}.ui-icon-black-disc{background-color:#fff;background-color:rgba(255,255,255,.3);-moz-border-radius:9px;-webkit-border-radius:9px;border-radius:9px}@media screen and (-webkit-min-device-pixel-ratio:2),screen and (max--moz-device-pixel-ratio:2){.ui-icon{background-image:url(images/icons-36-white.png);background-size:630px 18px}.ui-icon-black{background-image:url(images/icons-36-black.png)}}.ui-icon-plus{background-position:-0 0}.ui-icon-minus{background-position:-36px 0}.ui-icon-delete{background-position:-72px 0}.ui-icon-arrow-r{background-position:-108px 0}.ui-icon-arrow-l{background-position:-144px 0}.ui-icon-arrow-u{background-position:-180px 0}.ui-icon-arrow-d{background-position:-216px 0}.ui-icon-check{background-position:-252px 0}.ui-icon-gear{background-position:-288px 0}.ui-icon-refresh{background-position:-324px 0}.ui-icon-forward{background-position:-360px 0}.ui-icon-back{background-position:-396px 0}.ui-icon-grid{background-position:-432px 0}.ui-icon-star{background-position:-468px 0}.ui-icon-alert{background-position:-504px 0}.ui-icon-info{background-position:-540px 0}.ui-icon-home{background-position:-576px 0}.ui-icon-search{background-position:-612px 0}.ui-icon-checkbox-off,.ui-icon-checkbox-on,.ui-icon-radio-off,.ui-icon-radio-on{background-color:transparent;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;background-size:20px 20px}.ui-icon-checkbox-off{background-image:url(images/form-check-off.png)}.ui-icon-checkbox-on{background-image:url(images/form-check-on.png)}.ui-icon-radio-off{background-image:url(images/form-radio-off.png)}.ui-icon-radio-on{background-image:url(images/form-radio-on.png)}.ui-icon-searchfield{background-image:url(images/icon-search-black.png);background-size:16px 16px}.ui-icon-loading{background-image:url(images/ajax-loader.png);width:40px;height:40px;-moz-border-radius:20px;-webkit-border-radius:20px;border-radius:20px;background-size:35px 35px}.ui-btn-corner-tl{-moz-border-radius-topleft:1em;-webkit-border-top-left-radius:1em;border-top-left-radius:1em}.ui-btn-corner-tr{-moz-border-radius-topright:1em;-webkit-border-top-right-radius:1em;border-top-right-radius:1em}.ui-btn-corner-bl{-moz-border-radius-bottomleft:1em;-webkit-border-bottom-left-radius:1em;border-bottom-left-radius:1em}.ui-btn-corner-br{-moz-border-radius-bottomright:1em;-webkit-border-bottom-right-radius:1em;border-bottom-right-radius:1em}.ui-btn-corner-top{-moz-border-radius-topleft:1em;-webkit-border-top-left-radius:1em;border-top-left-radius:1em;-moz-border-radius-topright:1em;-webkit-border-top-right-radius:1em;border-top-right-radius:1em}.ui-btn-corner-bottom{-moz-border-radius-bottomleft:1em;-webkit-border-bottom-left-radius:1em;border-bottom-left-radius:1em;-moz-border-radius-bottomright:1em;-webkit-border-bottom-right-radius:1em;border-bottom-right-radius:1em}.ui-btn-corner-right{-moz-border-radius-topright:1em;-webkit-border-top-right-radius:1em;border-top-right-radius:1em;-moz-border-radius-bottomright:1em;-webkit-border-bottom-right-radius:1em;border-bottom-right-radius:1em}.ui-btn-corner-left{-moz-border-radius-topleft:1em;-webkit-border-top-left-radius:1em;border-top-left-radius:1em;-moz-border-radius-bottomleft:1em;-webkit-border-bottom-left-radius:1em;border-bottom-left-radius:1em}.ui-btn-corner-all{-moz-border-radius:1em;-webkit-border-radius:1em;border-radius:1em}.ui-corner-tl,.ui-corner-tr,.ui-corner-bl,.ui-corner-br,.ui-corner-top,.ui-corner-bottom,.ui-corner-right,.ui-corner-left,.ui-corner-all,.ui-btn-corner-tl,.ui-btn-corner-tr,.ui-btn-corner-bl,.ui-btn-corner-br,.ui-btn-corner-top,.ui-btn-corner-bottom,.ui-btn-corner-right,.ui-btn-corner-left,.ui-btn-corner-all{-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box}.ui-overlay{background:#666;opacity:.5;filter:Alpha(Opacity=50);position:absolute;width:100%;height:100%}.ui-overlay-shadow{-moz-box-shadow:0 0 12px rgba(0,0,0,.6);-webkit-box-shadow:0 0 12px rgba(0,0,0,.6);box-shadow:0 0 12px rgba(0,0,0,.6)}.ui-shadow{-moz-box-shadow:0 1px 4px rgba(0,0,0,.3);-webkit-box-shadow:0 1px 4px rgba(0,0,0,.3);box-shadow:0 1px 4px rgba(0,0,0,.3)}.ui-bar-a .ui-shadow,.ui-bar-b .ui-shadow,.ui-bar-c .ui-shadow{-moz-box-shadow:0 1px 0 rgba(255,255,255,.3);-webkit-box-shadow:0 1px 0 rgba(255,255,255,.3);box-shadow:0 1px 0 rgba(255,255,255,.3)}.ui-shadow-inset{-moz-box-shadow:inset 0 1px 4px rgba(0,0,0,.2);-webkit-box-shadow:inset 0 1px 4px rgba(0,0,0,.2);box-shadow:inset 0 1px 4px rgba(0,0,0,.2)}.ui-icon-shadow{-moz-box-shadow:0 1px 0 rgba(255,255,255,.4);-webkit-box-shadow:0 1px 0 rgba(255,255,255,.4);box-shadow:0 1px 0 rgba(255,255,255,.4)}.ui-focus{-moz-box-shadow:0 0 12px #387bbe;-webkit-box-shadow:0 0 12px #387bbe;box-shadow:0 0 12px #387bbe}.ui-mobile-nosupport-boxshadow *{-moz-box-shadow:none!important;-webkit-box-shadow:none!important;box-shadow:none!important}.ui-mobile-nosupport-boxshadow .ui-focus{outline-width:2px}.ui-mobile fieldset,.ui-page{padding:0;margin:0}.ui-mobile a img,.ui-mobile fieldset{border:0}.ui-mobile-viewport{margin:0;overflow-x:hidden;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}[data-role=page],[data-role=dialog],.ui-page{top:0;left:0;width:100%;min-height:100%;position:absolute;display:none;border:0}.ui-page-active{display:block;overflow:visible}.portrait,.portrait .ui-page{min-height:480px}.landscape,.landscape .ui-page{min-height:320px}.ui-loading .ui-mobile-viewport{overflow:hidden!important}.ui-loading .ui-loader{display:block}.ui-loading .ui-page{overflow:hidden}.ui-loader{display:none;position:absolute;opacity:.85;z-index:10;left:50%;width:200px;margin-left:-130px;margin-top:-35px;padding:10px 30px}.ui-loader h1{font-size:15px;text-align:center}.ui-loader .ui-icon{position:static;display:block;opacity:.9;margin:0 auto;width:35px;height:35px;background-color:transparent}.ui-mobile-rendering>*{visibility:hidden}.ui-bar,.ui-body{position:relative;padding:.4em 15px;overflow:hidden;display:block;clear:both}.ui-bar{font-size:16px;margin:0}.ui-bar h1,.ui-bar h2,.ui-bar h3,.ui-bar h4,.ui-bar h5,.ui-bar h6{margin:0;padding:0;font-size:16px;display:inline-block}.ui-header,.ui-footer{display:block}.ui-page .ui-header,.ui-page .ui-footer{position:relative}.ui-header .ui-btn-left{position:absolute;left:10px;top:.4em}.ui-header .ui-title,.ui-footer .ui-title{text-align:center;font-size:16px;display:block;margin:.6em 90px .8em;padding:0;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;outline:0!important}.ui-header .ui-btn-right{position:absolute;right:10px;top:.4em}.ui-content{border-width:0;overflow:visible;overflow-x:hidden;padding:15px}.ui-page-fullscreen .ui-content{padding:0}.ui-icon{width:18px;height:18px}.ui-fullscreen img{max-width:100%}.ui-nojs{position:absolute;left:-9999px}.spin{-webkit-transform:rotate(360deg);-webkit-animation-name:spin;-webkit-animation-duration:1s;-webkit-animation-iteration-count:infinite}@-webkit-keyframes spin{from{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(360deg)}}.in,.out{-webkit-animation-timing-function:ease-in-out;-webkit-animation-duration:350ms}.slide.in{-webkit-transform:translateX(0);-webkit-animation-name:slideinfromright}.slide.out{-webkit-transform:translateX(-100%);-webkit-animation-name:slideouttoleft}.slide.in.reverse{-webkit-transform:translateX(0);-webkit-animation-name:slideinfromleft}.slide.out.reverse{-webkit-transform:translateX(100%);-webkit-animation-name:slideouttoright}.slideup.in{-webkit-transform:translateY(0);-webkit-animation-name:slideinfrombottom;z-index:10}.slideup.out{-webkit-animation-name:dontmove;z-index:0}.slideup.out.reverse{-webkit-transform:translateY(100%);z-index:10;-webkit-animation-name:slideouttobottom}.slideup.in.reverse{z-index:0;-webkit-animation-name:dontmove}.slidedown.in{-webkit-transform:translateY(0);-webkit-animation-name:slideinfromtop;z-index:10}.slidedown.out{-webkit-animation-name:dontmove;z-index:0}.slidedown.out.reverse{-webkit-transform:translateY(-100%);z-index:10;-webkit-animation-name:slideouttotop}.slidedown.in.reverse{z-index:0;-webkit-animation-name:dontmove}@-webkit-keyframes slideinfromright{from{-webkit-transform:translateX(100%)}to{-webkit-transform:translateX(0)}}@-webkit-keyframes slideinfromleft{from{-webkit-transform:translateX(-100%)}to{-webkit-transform:translateX(0)}}@-webkit-keyframes slideouttoleft{from{-webkit-transform:translateX(0)}to{-webkit-transform:translateX(-100%)}}@-webkit-keyframes slideouttoright{from{-webkit-transform:translateX(0)}to{-webkit-transform:translateX(100%)}}@-webkit-keyframes slideinfromtop{from{-webkit-transform:translateY(-100%)}to{-webkit-transform:translateY(0)}}@-webkit-keyframes slideinfrombottom{from{-webkit-transform:translateY(100%)}to{-webkit-transform:translateY(0)}}@-webkit-keyframes slideouttobottom{from{-webkit-transform:translateY(0)}to{-webkit-transform:translateY(100%)}}@-webkit-keyframes slideouttotop{from{-webkit-transform:translateY(0)}to{-webkit-transform:translateY(-100%)}}@-webkit-keyframes fadein{from{opacity:0}to{opacity:1}}@-webkit-keyframes fadeout{from{opacity:1}to{opacity:0}}.fade.in{opacity:1;z-index:10;-webkit-animation-name:fadein}.fade.out{z-index:0;-webkit-animation-name:fadeout}.ui-mobile-viewport-perspective{-webkit-perspective:1000;position:absolute}.ui-mobile-viewport-transitioning,.ui-mobile-viewport-transitioning .ui-page{width:100%;height:100%;overflow:hidden}.flip{-webkit-animation-duration:.65s;-webkit-backface-visibility:hidden;-webkit-transform:translateX(0)}.flip.in{-webkit-transform:rotateY(0) scale(1);-webkit-animation-name:flipinfromleft}.flip.out{-webkit-transform:rotateY(-180deg) scale(.8);-webkit-animation-name:flipouttoleft}.flip.in.reverse{-webkit-transform:rotateY(0) scale(1);-webkit-animation-name:flipinfromright}.flip.out.reverse{-webkit-transform:rotateY(180deg) scale(.8);-webkit-animation-name:flipouttoright}@-webkit-keyframes flipinfromright{from{-webkit-transform:rotateY(-180deg) scale(.8)}to{-webkit-transform:rotateY(0) scale(1)}}@-webkit-keyframes flipinfromleft{from{-webkit-transform:rotateY(180deg) scale(.8)}to{-webkit-transform:rotateY(0) scale(1)}}@-webkit-keyframes flipouttoleft{from{-webkit-transform:rotateY(0) scale(1)}to{-webkit-transform:rotateY(-180deg) scale(.8)}}@-webkit-keyframes flipouttoright{from{-webkit-transform:rotateY(0) scale(1)}to{-webkit-transform:rotateY(180deg) scale(.8)}}@-webkit-keyframes dontmove{from{opacity:1}to{opacity:1}}.pop{-webkit-transform-origin:50% 50%}.pop.in{-webkit-transform:scale(1);opacity:1;-webkit-animation-name:popin;z-index:10}.pop.out.reverse{-webkit-transform:scale(.2);opacity:0;-webkit-animation-name:popout;z-index:10}.pop.in.reverse{z-index:0;-webkit-animation-name:dontmove}@-webkit-keyframes popin{from{-webkit-transform:scale(.2);opacity:0}to{-webkit-transform:scale(1);opacity:1}}@-webkit-keyframes popout{from{-webkit-transform:scale(1);opacity:1}to{-webkit-transform:scale(.2);opacity:0}}.ui-grid-a,.ui-grid-b,.ui-grid-c,.ui-grid-d{overflow:hidden}.ui-block-a,.ui-block-b,.ui-block-c,.ui-block-d,.ui-block-e{margin:0;padding:0;border:0;float:left}.ui-grid-a .ui-block-a,.ui-grid-a .ui-block-b{width:50%}.ui-grid-a .ui-block-a{clear:left}.ui-grid-b .ui-block-a,.ui-grid-b .ui-block-b,.ui-grid-b .ui-block-c{width:33.333%}.ui-grid-b .ui-block-a{clear:left}.ui-grid-c .ui-block-a,.ui-grid-c .ui-block-b,.ui-grid-c .ui-block-c,.ui-grid-c .ui-block-d{width:25%}.ui-grid-c .ui-block-a{clear:left}.ui-grid-d .ui-block-a,.ui-grid-d .ui-block-b,.ui-grid-d .ui-block-c,.ui-grid-d .ui-block-d,.ui-grid-d .ui-block-e{width:20%}.ui-grid-d .ui-block-a{clear:left}.ui-header,.ui-footer,.ui-page-fullscreen .ui-header,.ui-page-fullscreen .ui-footer{position:absolute;overflow:hidden;width:100%;border-left-width:0;border-right-width:0}.ui-header-fixed,.ui-footer-fixed{z-index:1000;-webkit-transform:translateZ(0)}.ui-footer-duplicate,.ui-page-fullscreen .ui-fixed-inline{display:none}.ui-page-fullscreen .ui-header,.ui-page-fullscreen .ui-footer{opacity:.9}.ui-navbar{overflow:hidden}.ui-navbar ul,.ui-navbar-expanded ul{list-style:none;padding:0;margin:0;position:relative;display:block;border:0}.ui-navbar-collapsed ul{float:left;width:75%;margin-right:-2px}.ui-navbar-collapsed .ui-navbar-toggle{float:left;width:25%}.ui-navbar li.ui-navbar-truncate{position:absolute;left:-9999px;top:-9999px}.ui-navbar li .ui-btn,.ui-navbar .ui-navbar-toggle .ui-btn{display:block;font-size:12px;text-align:center;margin:0;border-right-width:0}.ui-navbar li .ui-btn{margin-right:-1px}.ui-navbar li .ui-btn:last-child{margin-right:0}.ui-header .ui-navbar li .ui-btn,.ui-header .ui-navbar .ui-navbar-toggle .ui-btn,.ui-footer .ui-navbar li .ui-btn,.ui-footer .ui-navbar .ui-navbar-toggle .ui-btn{border-top-width:0;border-bottom-width:0}.ui-navbar .ui-btn-inner{padding-left:2px;padding-right:2px}.ui-navbar-noicons li .ui-btn .ui-btn-inner,.ui-navbar-noicons .ui-navbar-toggle .ui-btn-inner{padding-top:.8em;padding-bottom:.9em}.ui-navbar-expanded .ui-btn{margin:0;font-size:14px}.ui-navbar-expanded .ui-btn-inner{padding-left:5px;padding-right:5px}.ui-navbar-expanded .ui-btn-icon-top .ui-btn-inner{padding:45px 5px 15px;text-align:center}.ui-navbar-expanded .ui-btn-icon-top .ui-icon{top:15px}.ui-navbar-expanded .ui-btn-icon-bottom .ui-btn-inner{padding:15px 5px 45px;text-align:center}.ui-navbar-expanded .ui-btn-icon-bottom .ui-icon{bottom:15px}.ui-navbar-expanded li .ui-btn .ui-btn-inner{min-height:2.5em}.ui-navbar-expanded .ui-navbar-noicons .ui-btn .ui-btn-inner{padding-top:1.8em;padding-bottom:1.9em}.ui-btn{display:block;text-align:center;cursor:pointer;position:relative;margin:.5em 5px;padding:0}.ui-btn:focus,.ui-btn:active{outline:0}.ui-header .ui-btn,.ui-footer .ui-btn,.ui-bar .ui-btn{display:inline-block;font-size:13px;margin:0}.ui-btn-inline{display:inline-block}.ui-btn-inner{padding:.6em 25px;display:block;height:100%;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;position:relative}.ui-header .ui-btn-inner,.ui-footer .ui-btn-inner,.ui-bar .ui-btn-inner{padding:.4em 8px .5em}.ui-btn-icon-notext{display:inline-block;width:20px;height:20px;padding:2px 1px 2px 3px;text-indent:-9999px}.ui-btn-icon-notext .ui-btn-inner{padding:0}.ui-btn-icon-notext .ui-btn-text{position:absolute;left:-999px}.ui-btn-icon-left .ui-btn-inner{padding-left:33px}.ui-header .ui-btn-icon-left .ui-btn-inner,.ui-footer .ui-btn-icon-left .ui-btn-inner,.ui-bar .ui-btn-icon-left .ui-btn-inner{padding-left:27px}.ui-btn-icon-right .ui-btn-inner{padding-right:33px}.ui-header .ui-btn-icon-right .ui-btn-inner,.ui-footer .ui-btn-icon-right .ui-btn-inner,.ui-bar .ui-btn-icon-right .ui-btn-inner{padding-right:27px}.ui-btn-icon-top .ui-btn-inner{padding-top:33px}.ui-header .ui-btn-icon-top .ui-btn-inner,.ui-footer .ui-btn-icon-top .ui-btn-inner,.ui-bar .ui-btn-icon-top .ui-btn-inner{padding-top:27px}.ui-btn-icon-bottom .ui-btn-inner{padding-bottom:33px}.ui-header .ui-btn-icon-bottom .ui-btn-inner,.ui-footer .ui-btn-icon-bottom .ui-btn-inner,.ui-bar .ui-btn-icon-bottom .ui-btn-inner{padding-bottom:27px}.ui-btn-icon-notext .ui-icon{display:block}.ui-btn-icon-left .ui-icon,.ui-btn-icon-right .ui-icon{position:absolute;top:50%;margin-top:-9px}.ui-btn-icon-top .ui-icon,.ui-btn-icon-bottom .ui-icon{position:absolute;left:50%;margin-left:-9px}.ui-btn-icon-left .ui-icon{left:10px}.ui-btn-icon-right .ui-icon{right:10px}.ui-header .ui-btn-icon-left .ui-icon,.ui-footer .ui-btn-icon-left .ui-icon,.ui-bar .ui-btn-icon-left .ui-icon{left:4px}.ui-header .ui-btn-icon-right .ui-icon,.ui-footer .ui-btn-icon-right .ui-icon,.ui-bar .ui-btn-icon-right .ui-icon{right:4px}.ui-header .ui-btn-icon-top .ui-icon,.ui-footer .ui-btn-icon-top .ui-icon,.ui-bar .ui-btn-icon-top .ui-icon{top:4px}.ui-header .ui-btn-icon-bottom .ui-icon,.ui-footer .ui-btn-icon-bottom .ui-icon,.ui-bar .ui-btn-icon-bottom .ui-icon{bottom:4px}.ui-btn-icon-top .ui-icon{top:5px}.ui-btn-icon-bottom .ui-icon{bottom:5px}.ui-btn-hidden{position:absolute;top:0;left:0;width:100%;height:100%;-webkit-appearance:button;opacity:0;cursor:pointer}.ui-collapsible-contain{margin:.5em 0}.ui-collapsible-heading{font-size:16px;display:block;margin:0 -8px;padding:0;border-width:0 0 1px 0;position:relative}.ui-collapsible-heading a{text-align:left;margin:0}.ui-collapsible-heading a .ui-btn-inner{padding-left:40px}.ui-collapsible-heading a span.ui-btn{position:absolute;left:6px;top:50%;margin:-12px 0 0 0;width:20px;height:20px;padding:1px 0 1px 2px;text-indent:-9999px}.ui-collapsible-heading a span.ui-btn .ui-btn-inner{padding:0}.ui-collapsible-heading a span.ui-btn .ui-icon{left:0;margin-top:-10px}.ui-collapsible-heading-status{position:absolute;left:-9999px}.ui-collapsible-content{display:block;padding:10px 0 10px 8px}.ui-collapsible-content-collapsed{display:none}.ui-collapsible-set{margin:.5em 0}.ui-collapsible-set .ui-collapsible-contain{margin:-1px 0 0}.ui-controlgroup,fieldset.ui-controlgroup{padding:0;margin:.5em 0 1em}.ui-bar .ui-controlgroup{margin:0 .3em}.ui-controlgroup-label{font-size:16px;line-height:1.4;font-weight:normal;margin:0 0 .3em}.ui-controlgroup-controls{display:block;width:95%}.ui-controlgroup li{list-style:none}.ui-controlgroup-vertical .ui-btn,.ui-controlgroup-vertical .ui-checkbox,.ui-controlgroup-vertical .ui-radio{margin:0;border-bottom-width:0}.ui-controlgroup-vertical .ui-controlgroup-last{border-bottom-width:1px}.ui-controlgroup-horizontal{padding:0}.ui-controlgroup-horizontal .ui-btn,.ui-controlgroup-horizontal .ui-checkbox,.ui-controlgroup-horizontal .ui-radio{margin:0 -5px 0 0;display:inline-block}.ui-controlgroup-horizontal .ui-checkbox .ui-btn,.ui-controlgroup-horizontal .ui-radio .ui-btn,.ui-controlgroup-horizontal .ui-checkbox:last-child,.ui-controlgroup-horizontal .ui-radio:last-child{margin-right:0}.ui-controlgroup-horizontal .ui-controlgroup-last{margin-right:0}.ui-controlgroup .ui-checkbox label,.ui-controlgroup .ui-radio label{font-size:16px}.min-width-480px .ui-controlgroup-label{vertical-align:top;display:inline-block;width:20%;margin:0 2% 0 0}.min-width-480px .ui-controlgroup-controls{width:60%;display:inline-block}.ui-dialog{min-height:480px}.ui-dialog .ui-header,.ui-dialog .ui-content,.ui-dialog .ui-footer{margin:15px;position:relative}.ui-dialog .ui-header,.ui-dialog .ui-footer{z-index:10;width:auto}.ui-dialog .ui-content,.ui-dialog .ui-footer{margin-top:-15px}.ui-checkbox,.ui-radio{position:relative;margin:.2em 0 .5em;z-index:1}.ui-checkbox .ui-btn,.ui-radio .ui-btn{margin:0;text-align:left;z-index:2}.ui-checkbox .ui-btn-icon-left .ui-btn-inner,.ui-radio .ui-btn-icon-left .ui-btn-inner{padding-left:45px}.ui-checkbox .ui-btn-icon-right .ui-btn-inner,.ui-radio .ui-btn-icon-right .ui-btn-inner{padding-right:45px}.ui-checkbox .ui-btn-icon-left .ui-icon,.ui-radio .ui-btn-icon-left .ui-icon{left:15px}.ui-checkbox .ui-btn-icon-right .ui-icon,.ui-radio .ui-btn-icon-right .ui-icon{right:15px}.ui-checkbox input,.ui-radio input{position:absolute;left:20px;top:50%;width:10px;height:10px;margin:-5px 0 0 0;outline:0!important;z-index:1}.ui-field-contain{background:0;padding:1.5em 0;margin:0;border-bottom-width:1px;overflow:visible}.ui-field-contain:first-child{border-top-width:0}.min-width-480px .ui-field-contain{border-width:0;padding:0;margin:1em 0}.ui-select{display:block;position:relative}.ui-select select{position:absolute;left:-9999px;top:-9999px}.ui-select .ui-btn select{cursor:pointer;-webkit-appearance:button;left:0;top:0;width:100%;height:100%;opacity:.001}.ui-select .ui-btn select.ui-select-nativeonly{opacity:1}.ui-select .ui-btn-icon-right .ui-btn-inner{padding-right:45px}.ui-select .ui-btn-icon-right .ui-icon{right:15px}label.ui-select{font-size:16px;line-height:1.4;font-weight:normal;margin:0 0 .3em;display:block}.ui-select .ui-btn-text,.ui-selectmenu .ui-btn-text{display:inline-block;min-height:1em}.ui-select .ui-btn-text{text-overflow:ellipsis;overflow:hidden;width:85%}.ui-selectmenu{position:absolute;padding:0;z-index:100!important;width:80%;max-width:350px;padding:6px}.ui-selectmenu .ui-listview{margin:0}.ui-selectmenu .ui-btn.ui-li-divider{cursor:default}.ui-selectmenu-hidden{top:-9999px;left:-9999px}.ui-selectmenu-screen{position:absolute;top:0;left:0;width:100%;height:100%;z-index:99}.ui-screen-hidden,.ui-selectmenu-list .ui-li .ui-icon{display:none}.ui-selectmenu-list .ui-li .ui-icon{display:block}.ui-li.ui-selectmenu-placeholder{display:none}.min-width-480px label.ui-select{display:inline-block;width:20%;margin:0 2% 0 0}.min-width-480px .ui-select{width:60%;display:inline-block}.ui-selectmenu .ui-header h1:after{content:'.';visibility:hidden}label.ui-input-text{font-size:16px;line-height:1.4;display:block;font-weight:normal;margin:0 0 .3em}input.ui-input-text,textarea.ui-input-text{background-image:none;padding:.4em;line-height:1.4;font-size:16px;display:block;width:95%}input.ui-input-text{-webkit-appearance:none}textarea.ui-input-text{height:50px;-webkit-transition:height 200ms linear;-moz-transition:height 200ms linear;-o-transition:height 200ms linear;transition:height 200ms linear}.ui-input-search{padding:0 30px;width:77%;background-position:8px 50%;background-repeat:no-repeat;position:relative}.ui-input-search input.ui-input-text{border:0;width:98%;padding:.4em 0;margin:0;display:block;background:transparent none;outline:0!important}.ui-input-search .ui-input-clear{position:absolute;right:0;top:50%;margin-top:-14px}.ui-input-search .ui-input-clear-hidden{display:none}.min-width-480px label.ui-input-text{vertical-align:top}.min-width-480px label.ui-input-text{display:inline-block;width:20%;margin:0 2% 0 0}.min-width-480px input.ui-input-text,.min-width-480px textarea.ui-input-text,.min-width-480px .ui-input-search{width:60%;display:inline-block}.min-width-480px .ui-input-search{width:50%}.ui-listview{margin:0;counter-reset:listnumbering}.ui-content .ui-listview{margin:-15px}.ui-content .ui-listview-inset{margin:1em 0}.ui-listview,.ui-li{list-style:none;padding:0;zoom:1}.ui-li{display:block;margin:0;position:relative;overflow:hidden;text-align:left;border-width:0;border-top-width:1px}.ui-li .ui-btn-text{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ui-li-divider,.ui-li-static{padding:.5em 15px;font-size:14px;font-weight:bold;counter-reset:listnumbering}ol.ui-listview .ui-link-inherit:before,.ui-li-dec{font-size:.8em;display:inline-block;padding-right:.3em;font-weight:normal;counter-increment:listnumbering;content:counter(listnumbering) ". "}ol.ui-listview .ui-li-jsnumbering:before{content:""!important}.ui-listview-inset .ui-li{border-right-width:1px;border-left-width:1px}.ui-li:last-child{border-bottom-width:1px}.ui-li .ui-btn-inner{display:block;position:relative;padding:.7em 75px .7em 15px}.ui-li-has-thumb .ui-btn-inner{min-height:60px;padding-left:100px}.ui-li-has-icon .ui-btn-inner{min-height:20px;padding-left:40px}.ui-li-heading{font-size:16px;font-weight:bold;display:block;margin:.6em 0;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ui-li-desc{font-size:12px;font-weight:normal;display:block;margin:-.5em 0 .6em;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ui-li-thumb,.ui-li-icon{position:absolute;left:1px;top:0;max-height:80px;max-width:80px}.ui-li-icon{max-height:40px;max-width:40px;left:10px;top:.9em}.ui-li-thumb,.ui-li-icon,.ui-li-content{float:left;margin-right:10px}.ui-li-aside{float:right;width:50%;text-align:right;margin:.3em 0}.min-width-480px .ui-li-aside{width:45%}.ui-li-has-alt .ui-btn-inner{padding-right:95px}.ui-li-count{position:absolute;font-size:11px;font-weight:bold;padding:.2em .5em;top:50%;margin-top:-.9em;right:38px}.ui-li-divider .ui-li-count{right:10px}.ui-li-has-alt .ui-li-count{right:55px}.ui-li-link-alt{position:absolute;width:40px;height:100%;border-width:0;border-left-width:1px;top:0;right:0;margin:0;padding:0}.ui-li-link-alt .ui-btn{overflow:hidden;position:absolute;right:8px;top:50%;margin:-11px 0 0 0;border-bottom-width:1px}.ui-li-link-alt .ui-btn-inner{padding:0;position:static}.ui-li-link-alt .ui-btn .ui-icon{right:50%;margin-right:-9px}.ui-listview-filter{border-width:0;overflow:hidden;margin:-15px -15px 15px -15px}.ui-listview-filter .ui-input-search{margin:5px;width:auto;display:block}@media only screen and (min-device-width:768px) and (max-device-width:1024px){.ui-li .ui-btn-text{overflow:visible}}label.ui-slider{display:block}input.ui-slider-input,.min-width-480px input.ui-slider-input{display:inline-block;width:50px}select.ui-slider-switch{display:none}div.ui-slider{position:relative;display:inline-block;overflow:visible;height:15px;padding:0;margin:0 2% 0 20px;top:4px;width:66%}a.ui-slider-handle{position:absolute;z-index:10;top:50%;width:28px;height:28px;margin-top:-15px;margin-left:-15px}a.ui-slider-handle .ui-btn-inner{padding-left:0;padding-right:0}.min-width-480px label.ui-slider{display:inline-block;width:20%;margin:0 2% 0 0}.min-width-480px div.ui-slider{width:45%}div.ui-slider-switch{height:32px;overflow:hidden;margin-left:0}div.ui-slider-inneroffset{margin-left:50%;position:absolute;top:1px;height:100%;width:50%}div.ui-slider-handle-snapping{-webkit-transition:left 100ms linear}div.ui-slider-labelbg{position:absolute;top:0;margin:0;border-width:0}div.ui-slider-switch div.ui-slider-labelbg-a{width:60%;height:100%;left:0}div.ui-slider-switch div.ui-slider-labelbg-b{width:60%;height:100%;right:0}.ui-slider-switch-a div.ui-slider-labelbg-a,.ui-slider-switch-b div.ui-slider-labelbg-b{z-index:1}.ui-slider-switch-a div.ui-slider-labelbg-b,.ui-slider-switch-b div.ui-slider-labelbg-a{z-index:10}div.ui-slider-switch a.ui-slider-handle{z-index:20;width:101%;height:32px;margin-top:-18px;margin-left:-101%}span.ui-slider-label{width:100%;position:absolute;height:32px;font-size:16px;text-align:center;line-height:2;background:0;border-color:transparent}span.ui-slider-label-a{left:-100%;margin-right:-1px}span.ui-slider-label-b{right:-100%;margin-left:-1px}  
/*  
* jQuery UI Datepicker @VERSION  
*  
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*  
* http://docs.jquery.com/UI/Datepicker#theming  
*/  
div.hasDatepicker{ display: block; padding: 0; overflow: visible; margin: 8px 0; }  
.ui-datepicker { overflow: visible; margin: 0; max-width: 500px; }  
.ui-datepicker .ui-datepicker-header { position:relative; padding:.4em 0; border-bottom: 0; font-weight: bold; }  
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { padding: 1px 0 1px 2px; position:absolute; top: .5em; margin-top: 0; text-indent: -9999px; }  
 
.ui-datepicker .ui-datepicker-prev { left:6px; }  
.ui-datepicker .ui-datepicker-next { right:6px; }  
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }  
.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }  
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}  
.ui-datepicker select.ui-datepicker-month,  
.ui-datepicker select.ui-datepicker-year { width: 49%;}  
.ui-datepicker table {width: 100%; border-collapse: collapse; margin:0; }  
.ui-datepicker td { border-width: 1px; padding: 0; text-align: center; }  
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em 0; font-weight: bold; margin: 0; border-width: 0; text-align: center; text-decoration: none; }  
 
.ui-datepicker-calendar th { padding-top: .3em; padding-bottom: .3em; }  
.ui-datepicker-calendar th span, .ui-datepicker-calendar span.ui-state-default { opacity: .3; }  
.ui-datepicker-calendar td a { padding-top: .5em; padding-bottom: .5em; }  
 
.min-width-480px div.hasDatepicker { width: 63%; display: inline-block; margin: 0; }  
file:a/busui/index.php (deleted)
<?php  
include('common.inc.php');  
include_header("bus.lambdacomplex.org",false, true)  
?>  
<div data-role="page">  
<div data-role="content">  
<div id="jqm-homeheader">  
<center><h3>busness time</h3><br><small>Canberra Bus Timetables and Trip Planner</small></center>  
</div>  
<a href="tripPlanner.php" data-role="button">Launch Trip Planner...</a>  
<ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">  
<li data-role="list-divider">Timetables - Stops</li>  
<li><a href="stopList.php">Major (Timing Point) Stops</a></li>  
<li><a href="stopList.php">All Stops</a></li>  
<li><a href="stopList.php?suburbs=yes">Stops By Suburb</a></li>  
<li><a class="nearby" href="stopList.php?nearby=yes">Nearby Stops</a></li>  
</ul>  
<ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">  
<li data-role="list-divider">Timetables - Routes</li>  
<li><a href="routeList.php">Routes By Final Destination</a></li>  
<li><a href="routeList.php?bynumber=yes">Routes By Number</a></li>  
<li><a class="nearby" href="routeList.php?nearby=yes">Nearby Routes</a></li>  
</ul>  
<?php echo timePlaceSettings();?>  
 
</div>  
</body>  
</html>  
 
/*!  
* jQuery UI 1.8.5  
*  
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*  
* http://docs.jquery.com/UI  
*/  
(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.5",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,  
NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,  
"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");  
if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"));if(!isNaN(b)&&b!=0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind("mousedown.ui-disableSelection selectstart.ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f,  
"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c.style(this,h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c.style(this,  
h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}});  
c(function(){var a=document.createElement("div"),b=document.body;c.extend(a.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.appendChild(a).offsetHeight===100;b.removeChild(a).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,  
d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);  
;/*  
* jQuery UI Datepicker 1.8.5  
*  
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*  
* http://docs.jquery.com/UI/Datepicker  
*  
* Depends:  
* jquery.ui.core.js  
*/  
(function(d,G){function L(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=  
"ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su",  
"Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",  
minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false};d.extend(this._defaults,this.regional[""]);this.dpDiv=d('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>')}function E(a,b){d.extend(a,  
b);for(var c in b)if(b[c]==null||b[c]==G)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.5"}});var y=(new Date).getTime();d.extend(L.prototype,{markerClassName:"hasDatepicker",log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){E(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=  
f}}}e=a.nodeName.toLowerCase();f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_])/g,"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:d('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')}},  
_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&&  
b.append.remove();if(c){b.append=d('<span class="'+this._appendClass+'">'+c+"</span>");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c=="focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c=this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("<img/>").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('<button type="button"></button>').addClass(this._triggerClass).html(f==  
""?c:d("<img/>").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;g<f.length;g++)if(f[g].length>h){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a,  
c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b),  
true);this._updateDatepicker(b);this._updateAlternate(b)}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=1;this._dialogInput=d('<input type="text" id="'+("dp"+this.uuid)+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}E(a.settings,e||{});b=b&&b.constructor==  
Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);  
d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},  
_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().removeClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=  
d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().addClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;  
for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return true;return false},_getInst:function(a){try{return d.data(a,"datepicker")}catch(b){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(a,b,c){var e=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?d.extend({},d.datepicker._defaults):e?b=="all"?d.extend({},e.settings):this._get(e,b):null;var f=b||{};if(typeof b=="string"){f={};f[b]=c}if(e){this._curInst==e&&  
this._hideDatepicker();var h=this._getDateDatepicker(a,true);E(e.settings,f);this._attachments(d(a),e);this._autoSize(e);this._setDateDatepicker(a,h);this._updateDatepicker(e)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){(a=this._getInst(a))&&this._updateDatepicker(a)},_setDateDatepicker:function(a,b){if(a=this._getInst(a)){this._setDate(a,b);this._updateDatepicker(a);this._updateAlternate(a)}},_getDateDatepicker:function(a,b){(a=this._getInst(a))&&  
!a.inline&&this._setDateFromField(a,b);return a?this._getDate(a):null},_doKeyDown:function(a){var b=d.datepicker._getInst(a.target),c=true,e=b.dpDiv.is(".ui-datepicker-rtl");b._keyEvent=true;if(d.datepicker._datepickerShowing)switch(a.keyCode){case 9:d.datepicker._hideDatepicker();c=false;break;case 13:c=d("td."+d.datepicker._dayOverClass,b.dpDiv).add(d("td."+d.datepicker._currentClass,b.dpDiv));c[0]?d.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,c[0]):d.datepicker._hideDatepicker();  
return false;case 27:d.datepicker._hideDatepicker();break;case 33:d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 34:d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 35:if(a.ctrlKey||a.metaKey)d.datepicker._clearDate(a.target);c=a.ctrlKey||a.metaKey;break;case 36:if(a.ctrlKey||a.metaKey)d.datepicker._gotoToday(a.target);c=a.ctrlKey||  
a.metaKey;break;case 37:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?+1:-1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 38:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,-7,"D");c=a.ctrlKey||a.metaKey;break;case 39:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?-1:+1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,  
a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 40:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,+7,"D");c=a.ctrlKey||a.metaKey;break;default:c=false}else if(a.keyCode==36&&a.ctrlKey)d.datepicker._showDatepicker(this);else c=false;if(c){a.preventDefault();a.stopPropagation()}},_doKeyPress:function(a){var b=d.datepicker._getInst(a.target);if(d.datepicker._get(b,"constrainInput")){b=d.datepicker._possibleChars(d.datepicker._get(b,"dateFormat"));  
var c=String.fromCharCode(a.charCode==G?a.keyCode:a.charCode);return a.ctrlKey||c<" "||!b||b.indexOf(c)>-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a);d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||  
a;if(a.nodeName.toLowerCase()!="input")a=d("input",a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);d.datepicker._curInst&&d.datepicker._curInst!=b&&d.datepicker._curInst.dpDiv.stop(true,true);var c=d.datepicker._get(b,"beforeShow");E(b.settings,c?c.apply(a,[a,b]):{});b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value="";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);  
d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c={left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&  
d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");var f=d.datepicker._get(b,"duration"),h=function(){d.datepicker._datepickerShowing=true;var i=d.datepicker._getBorders(b.dpDiv);b.dpDiv.find("iframe.ui-datepicker-cover").css({left:-i[0],top:-i[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})};b.dpDiv.zIndex(d(a).zIndex()+1);d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,  
h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=b}}},_updateDatepicker:function(a){var b=this,c=d.datepicker._getBorders(a.dpDiv);a.dpDiv.empty().append(this._generateHTML(a)).find("iframe.ui-datepicker-cover").css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){d(this).removeClass("ui-state-hover");  
this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).removeClass("ui-datepicker-prev-hover");this.className.indexOf("ui-datepicker-next")!=-1&&d(this).removeClass("ui-datepicker-next-hover")}).bind("mouseover",function(){if(!b._isDisabledDatepicker(a.inline?a.dpDiv.parent()[0]:a.input[0])){d(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");d(this).addClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).addClass("ui-datepicker-prev-hover");  
this.className.indexOf("ui-datepicker-next")!=-1&&d(this).addClass("ui-datepicker-next-hover")}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();c=this._getNumberOfMonths(a);var e=c[1];e>1?a.dpDiv.addClass("ui-datepicker-multi-"+e).css("width",17*e+"em"):a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");a.dpDiv[(c[0]!=1||c[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");  
a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input.focus()},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]||c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),h=a.input?a.input.outerWidth():0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),  
k=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>k&&k>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1);)a=a[b?"previousSibling":"nextSibling"];  
a=d(a).offset();return[a.left,a.top]},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?c:null,e);a||e();if(a=this._get(b,"onClose"))a.apply(b.input?b.input[0]:null,[b.input?b.input.val():  
"",b]);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(d.datepicker._curInst){a=d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&  
!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;  
b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e._selectingMonthYear=false;e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_clickMonthYear:function(a){var b=  
this._getInst(d(a)[0]);b.input&&b._selectingMonthYear&&setTimeout(function(){b.input.focus()},0);b._selectingMonthYear=!b._selectingMonthYear},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth=b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=  
d(a);this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a);a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker();this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,  
"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a));d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b==  
"object"?b.toString():b+"";if(b=="")return null;for(var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff,f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,k=c=-1,l=-1,u=-1,j=false,o=function(p){(p=z+1<a.length&&a.charAt(z+1)==p)&&z++;return p},m=function(p){o(p);p=new RegExp("^\\d{1,"+(p=="@"?14:p=="!"?20:p=="y"?4:p=="o"?  
3:2)+"}");p=b.substring(s).match(p);if(!p)throw"Missing number at position "+s;s+=p[0].length;return parseInt(p[0],10)},n=function(p,w,H){p=o(p)?H:w;for(w=0;w<p.length;w++)if(b.substr(s,p[w].length).toLowerCase()==p[w].toLowerCase()){s+=p[w].length;return w+1}throw"Unknown name at position "+s;},r=function(){if(b.charAt(s)!=a.charAt(z))throw"Unexpected literal at position "+s;s++},s=0,z=0;z<a.length;z++)if(j)if(a.charAt(z)=="'"&&!o("'"))j=false;else r();else switch(a.charAt(z)){case "d":l=m("d");  
break;case "D":n("D",f,h);break;case "o":u=m("o");break;case "m":k=m("m");break;case "M":k=n("M",i,g);break;case "y":c=m("y");break;case "@":var v=new Date(m("@"));c=v.getFullYear();k=v.getMonth()+1;l=v.getDate();break;case "!":v=new Date((m("!")-this._ticksTo1970)/1E4);c=v.getFullYear();k=v.getMonth()+1;l=v.getDate();break;case "'":if(o("'"))r();else j=true;break;default:r()}if(c==-1)c=(new Date).getFullYear();else if(c<100)c+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c<=e?0:-100);if(u>  
-1){k=1;l=u;do{e=this._getDaysInMonth(c,k-1);if(l<=e)break;k++;l-=e}while(1)}v=this._daylightSavingAdjust(new Date(c,k-1,l));if(v.getFullYear()!=c||v.getMonth()+1!=k||v.getDate()!=l)throw"Invalid date";return v},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*  
60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:null)||this._defaults.monthNames;var i=function(o){(o=j+1<a.length&&a.charAt(j+1)==o)&&j++;return o},g=function(o,m,n){m=""+m;if(i(o))for(;m.length<n;)m="0"+m;return m},k=function(o,m,n,r){return i(o)?r[m]:n[m]},l="",u=false;if(b)for(var j=0;j<a.length;j++)if(u)if(a.charAt(j)==  
"'"&&!i("'"))u=false;else l+=a.charAt(j);else switch(a.charAt(j)){case "d":l+=g("d",b.getDate(),2);break;case "D":l+=k("D",b.getDay(),e,f);break;case "o":l+=g("o",(b.getTime()-(new Date(b.getFullYear(),0,0)).getTime())/864E5,3);break;case "m":l+=g("m",b.getMonth()+1,2);break;case "M":l+=k("M",b.getMonth(),h,c);break;case "y":l+=i("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case "@":l+=b.getTime();break;case "!":l+=b.getTime()*1E4+this._ticksTo1970;break;case "'":if(i("'"))l+=  
"'";else u=true;break;default:l+=a.charAt(j)}return l},_possibleChars:function(a){for(var b="",c=false,e=function(h){(h=f+1<a.length&&a.charAt(f+1)==h)&&f++;return h},f=0;f<a.length;f++)if(c)if(a.charAt(f)=="'"&&!e("'"))c=false;else b+=a.charAt(f);else switch(a.charAt(f)){case "d":case "m":case "y":case "@":b+="0123456789";break;case "D":case "M":return null;case "'":if(e("'"))b+="'";else c=true;break;default:b+=a.charAt(f)}return b},_get:function(a,b){return a.settings[b]!==G?a.settings[b]:this._defaults[b]},  
_setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var c=this._get(a,"dateFormat"),e=a.lastVal=a.input?a.input.val():null,f,h;f=h=this._getDefaultDate(a);var i=this._getFormatConfig(a);try{f=this.parseDate(c,e,i)||h}catch(g){this.log(g);e=b?"":e}a.selectedDay=f.getDate();a.drawMonth=a.selectedMonth=f.getMonth();a.drawYear=a.selectedYear=f.getFullYear();a.currentDay=e?f.getDate():0;a.currentMonth=e?f.getMonth():0;a.currentYear=e?f.getFullYear():0;this._adjustInstDate(a)}},_getDefaultDate:function(a){return this._restrictMinMax(a,  
this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,c){var e=function(h){var i=new Date;i.setDate(i.getDate()+h);return i},f=function(h){try{return d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),h,d.datepicker._getFormatConfig(a))}catch(i){}var g=(h.toLowerCase().match(/^c/)?d.datepicker._getDate(a):null)||new Date,k=g.getFullYear(),l=g.getMonth();g=g.getDate();for(var u=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,j=u.exec(h);j;){switch(j[2]||"d"){case "d":case "D":g+=  
parseInt(j[1],10);break;case "w":case "W":g+=parseInt(j[1],10)*7;break;case "m":case "M":l+=parseInt(j[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(k,l));break;case "y":case "Y":k+=parseInt(j[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(k,l));break}j=u.exec(h)}return new Date(k,l,g)};if(b=(b=b==null?c:typeof b=="string"?f(b):typeof b=="number"?isNaN(b)?c:e(b):b)&&b.toString()=="Invalid Date"?c:b){b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0)}return this._daylightSavingAdjust(b)},  
_daylightSavingAdjust:function(a){if(!a)return null;a.setHours(a.getHours()>12?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?  
"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),k=  
this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),j=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n=this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=j&&n<j?j:n;this._daylightSavingAdjust(new Date(m,g,1))>n;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,  
"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-k,1)),this._getFormatConfig(a));n=this._canAdjustMonth(a,-1,m,g)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+y+".datepicker._adjustDate('#"+a.id+"', -"+k+", 'M');\" title=\""+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>":f?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+  
n+"</span></a>";var r=this._get(a,"nextText");r=!h?r:this.formatDate(r,this._daylightSavingAdjust(new Date(m,g+k,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+y+".datepicker._adjustDate('#"+a.id+"', +"+k+", 'M');\" title=\""+r+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+r+"</span></a>":f?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+r+'"><span class="ui-icon ui-icon-circle-triangle-'+  
(c?"w":"e")+'">'+r+"</span></a>";k=this._get(a,"currentText");r=this._get(a,"gotoCurrent")&&a.currentDay?u:b;k=!h?k:this.formatDate(k,r,this._getFormatConfig(a));h=!a.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+y+'.datepicker._hideDatepicker();">'+this._get(a,"closeText")+"</button>":"";e=e?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?h:"")+(this._isInRange(a,r)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+  
y+".datepicker._gotoToday('#"+a.id+"');\">"+k+"</button>":"")+(c?"":h)+"</div>":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;k=this._get(a,"showWeek");r=this._get(a,"dayNames");this._get(a,"dayNamesShort");var s=this._get(a,"dayNamesMin"),z=this._get(a,"monthNames"),v=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),w=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var M=this._getDefaultDate(a),I="",C=0;C<i[0];C++){for(var N=  
"",D=0;D<i[1];D++){var J=this._daylightSavingAdjust(new Date(m,g,a.selectedDay)),t=" ui-corner-all",x="";if(l){x+='<div class="ui-datepicker-group';if(i[1]>1)switch(D){case 0:x+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right":"left");break;case i[1]-1:x+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:x+=" ui-datepicker-group-middle";t="";break}x+='">'}x+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+t+'">'+(/all|left/.test(t)&&C==0?c?  
f:n:"")+(/all|right/.test(t)&&C==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,j,o,C>0||D>0,z,v)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var A=k?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(t=0;t<7;t++){var q=(t+h)%7;A+="<th"+((t+h+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+r[q]+'">'+s[q]+"</span></th>"}x+=A+"</tr></thead><tbody>";A=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,  
A);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;A=l?6:Math.ceil((t+A)/7);q=this._daylightSavingAdjust(new Date(m,g,1-t));for(var O=0;O<A;O++){x+="<tr>";var P=!k?"":'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(q)+"</td>";for(t=0;t<7;t++){var F=p?p.apply(a.input?a.input[0]:null,[q]):[true,""],B=q.getMonth()!=g,K=B&&!H||!F[0]||j&&q<j||o&&q>o;P+='<td class="'+((t+h+6)%7>=5?" ui-datepicker-week-end":"")+(B?" ui-datepicker-other-month":"")+(q.getTime()==J.getTime()&&g==a.selectedMonth&&  
a._keyEvent||M.getTime()==q.getTime()&&M.getTime()==J.getTime()?" "+this._dayOverClass:"")+(K?" "+this._unselectableClass+" ui-state-disabled":"")+(B&&!w?"":" "+F[1]+(q.getTime()==u.getTime()?" "+this._currentClass:"")+(q.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!B||w)&&F[2]?' title="'+F[2]+'"':"")+(K?"":' onclick="DP_jQuery_'+y+".datepicker._selectDay('#"+a.id+"',"+q.getMonth()+","+q.getFullYear()+', this);return false;"')+">"+(B&&!w?"&#xa0;":K?'<span class="ui-state-default">'+q.getDate()+  
"</span>":'<a class="ui-state-default'+(q.getTime()==b.getTime()?" ui-state-highlight":"")+(q.getTime()==J.getTime()?" ui-state-active":"")+(B?" ui-priority-secondary":"")+'" href="#">'+q.getDate()+"</a>")+"</td>";q.setDate(q.getDate()+1);q=this._daylightSavingAdjust(q)}x+=P+"</tr>"}g++;if(g>11){g=0;m++}x+="</tbody></table>"+(l?"</div>"+(i[0]>0&&D==i[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");N+=x}I+=N}I+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':  
"");a._keyEvent=false;return I},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var k=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),j='<div class="ui-datepicker-title">',o="";if(h||!k)o+='<span class="ui-datepicker-month">'+i[b]+"</span>";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+y+".datepicker._selectMonthYear('#"+a.id+"', this, 'M');\" onclick=\"DP_jQuery_"+y+".datepicker._clickMonthYear('#"+  
a.id+"');\">";for(var n=0;n<12;n++)if((!i||n>=e.getMonth())&&(!m||n<=f.getMonth()))o+='<option value="'+n+'"'+(n==b?' selected="selected"':"")+">"+g[n]+"</option>";o+="</select>"}u||(j+=o+(h||!(k&&l)?"&#xa0;":""));if(h||!l)j+='<span class="ui-datepicker-year">'+c+"</span>";else{g=this._get(a,"yearRange").split(":");var r=(new Date).getFullYear();i=function(s){s=s.match(/c[+-].*/)?c+parseInt(s.substring(1),10):s.match(/[+-].*/)?r+parseInt(s,10):parseInt(s,10);return isNaN(s)?r:s};b=i(g[0]);g=Math.max(b,  
i(g[1]||""));b=e?Math.max(b,e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(j+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+y+".datepicker._selectMonthYear('#"+a.id+"', this, 'Y');\" onclick=\"DP_jQuery_"+y+".datepicker._clickMonthYear('#"+a.id+"');\">";b<=g;b++)j+='<option value="'+b+'"'+(b==c?' selected="selected"':"")+">"+b+"</option>";j+="</select>"}j+=this._get(a,"yearSuffix");if(u)j+=(h||!(k&&l)?"&#xa0;":"")+o;j+="</div>";return j},_adjustInstDate:function(a,b,c){var e=  
a.drawYear+(c=="Y"?b:0),f=a.drawMonth+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&b<c?c:b;return b=a&&b>a?a:b},_notifyChange:function(a){var b=this._get(a,  
"onChangeMonthYear");if(b)b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a);  
c=this._daylightSavingAdjust(new Date(c,e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,  
"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker=  
function(a){if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));  
return this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new L;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.5";window["DP_jQuery_"+y]=d})(jQuery);  
;  
file:a/busui/js/jquery-1.5.js (deleted)
/*!  
* jQuery JavaScript Library v1.5  
* http://jquery.com/  
*  
* Copyright 2011, John Resig  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*  
* Includes Sizzle.js  
* http://sizzlejs.com/  
* Copyright 2011, The Dojo Foundation  
* Released under the MIT, BSD, and GPL Licenses.  
*  
* Date: Mon Jan 31 08:31:29 2011 -0500  
*/  
(function( window, undefined ) {  
 
// Use the correct document accordingly with window argument (sandbox)  
var document = window.document;  
var jQuery = (function() {  
 
// Define a local copy of jQuery  
var jQuery = function( selector, context ) {  
// The jQuery object is actually just the init constructor 'enhanced'  
return new jQuery.fn.init( selector, context, rootjQuery );  
},  
 
// Map over jQuery in case of overwrite  
_jQuery = window.jQuery,  
 
// Map over the $ in case of overwrite  
_$ = window.$,  
 
// A central reference to the root jQuery(document)  
rootjQuery,  
 
// A simple way to check for HTML strings or ID strings  
// (both of which we optimize for)  
quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,  
 
// Check if a string has a non-whitespace character in it  
rnotwhite = /\S/,  
 
// Used for trimming whitespace  
trimLeft = /^\s+/,  
trimRight = /\s+$/,  
 
// Check for digits  
rdigit = /\d/,  
 
// Match a standalone tag  
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,  
 
// JSON RegExp  
rvalidchars = /^[\],:{}\s]*$/,  
rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,  
rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,  
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,  
 
// Useragent RegExp  
rwebkit = /(webkit)[ \/]([\w.]+)/,  
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,  
rmsie = /(msie) ([\w.]+)/,  
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,  
 
// Keep a UserAgent string for use with jQuery.browser  
userAgent = navigator.userAgent,  
 
// For matching the engine and version of the browser  
browserMatch,  
 
// Has the ready events already been bound?  
readyBound = false,  
 
// The deferred used on DOM ready  
readyList,  
 
// Promise methods  
promiseMethods = "then done fail isResolved isRejected promise".split( " " ),  
 
// The ready event handler  
DOMContentLoaded,  
 
// Save a reference to some core methods  
toString = Object.prototype.toString,  
hasOwn = Object.prototype.hasOwnProperty,  
push = Array.prototype.push,  
slice = Array.prototype.slice,  
trim = String.prototype.trim,  
indexOf = Array.prototype.indexOf,  
 
// [[Class]] -> type pairs  
class2type = {};  
 
jQuery.fn = jQuery.prototype = {  
constructor: jQuery,  
init: function( selector, context, rootjQuery ) {  
var match, elem, ret, doc;  
 
// Handle $(""), $(null), or $(undefined)  
if ( !selector ) {  
return this;  
}  
 
// Handle $(DOMElement)  
if ( selector.nodeType ) {  
this.context = this[0] = selector;  
this.length = 1;  
return this;  
}  
 
// The body element only exists once, optimize finding it  
if ( selector === "body" && !context && document.body ) {  
this.context = document;  
this[0] = document.body;  
this.selector = "body";  
this.length = 1;  
return this;  
}  
 
// Handle HTML strings  
if ( typeof selector === "string" ) {  
// Are we dealing with HTML string or an ID?  
match = quickExpr.exec( selector );  
 
// Verify a match, and that no context was specified for #id  
if ( match && (match[1] || !context) ) {  
 
// HANDLE: $(html) -> $(array)  
if ( match[1] ) {  
context = context instanceof jQuery ? context[0] : context;  
doc = (context ? context.ownerDocument || context : document);  
 
// If a single string is passed in and it's a single tag  
// just do a createElement and skip the rest  
ret = rsingleTag.exec( selector );  
 
if ( ret ) {  
if ( jQuery.isPlainObject( context ) ) {  
selector = [ document.createElement( ret[1] ) ];  
jQuery.fn.attr.call( selector, context, true );  
 
} else {  
selector = [ doc.createElement( ret[1] ) ];  
}  
 
} else {  
ret = jQuery.buildFragment( [ match[1] ], [ doc ] );  
selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;  
}  
 
return jQuery.merge( this, selector );  
 
// HANDLE: $("#id")  
} else {  
elem = document.getElementById( match[2] );  
 
// Check parentNode to catch when Blackberry 4.6 returns  
// nodes that are no longer in the document #6963  
if ( elem && elem.parentNode ) {  
// Handle the case where IE and Opera return items  
// by name instead of ID  
if ( elem.id !== match[2] ) {  
return rootjQuery.find( selector );  
}  
 
// Otherwise, we inject the element directly into the jQuery object  
this.length = 1;  
this[0] = elem;  
}  
 
this.context = document;  
this.selector = selector;  
return this;  
}  
 
// HANDLE: $(expr, $(...))  
} else if ( !context || context.jquery ) {  
return (context || rootjQuery).find( selector );  
 
// HANDLE: $(expr, context)  
// (which is just equivalent to: $(context).find(expr)  
} else {  
return this.constructor( context ).find( selector );  
}  
 
// HANDLE: $(function)  
// Shortcut for document ready  
} else if ( jQuery.isFunction( selector ) ) {  
return rootjQuery.ready( selector );  
}  
 
if (selector.selector !== undefined) {  
this.selector = selector.selector;  
this.context = selector.context;  
}  
 
return jQuery.makeArray( selector, this );  
},  
 
// Start with an empty selector  
selector: "",  
 
// The current version of jQuery being used  
jquery: "1.5",  
 
// The default length of a jQuery object is 0  
length: 0,  
 
// The number of elements contained in the matched element set  
size: function() {  
return this.length;  
},  
 
toArray: function() {  
return slice.call( this, 0 );  
},  
 
// Get the Nth element in the matched element set OR  
// Get the whole matched element set as a clean array  
get: function( num ) {  
return num == null ?  
 
// Return a 'clean' array  
this.toArray() :  
 
// Return just the object  
( num < 0 ? this[ this.length + num ] : this[ num ] );  
},  
 
// Take an array of elements and push it onto the stack  
// (returning the new matched element set)  
pushStack: function( elems, name, selector ) {  
// Build a new jQuery matched element set  
var ret = this.constructor();  
 
if ( jQuery.isArray( elems ) ) {  
push.apply( ret, elems );  
 
} else {  
jQuery.merge( ret, elems );  
}  
 
// Add the old object onto the stack (as a reference)  
ret.prevObject = this;  
 
ret.context = this.context;  
 
if ( name === "find" ) {  
ret.selector = this.selector + (this.selector ? " " : "") + selector;  
} else if ( name ) {  
ret.selector = this.selector + "." + name + "(" + selector + ")";  
}  
 
// Return the newly-formed element set  
return ret;  
},  
 
// Execute a callback for every element in the matched set.  
// (You can seed the arguments with an array of args, but this is  
// only used internally.)  
each: function( callback, args ) {  
return jQuery.each( this, callback, args );  
},  
 
ready: function( fn ) {  
// Attach the listeners  
jQuery.bindReady();  
 
// Add the callback  
readyList.done( fn );  
 
return this;  
},  
 
eq: function( i ) {  
return i === -1 ?  
this.slice( i ) :  
this.slice( i, +i + 1 );  
},  
 
first: function() {  
return this.eq( 0 );  
},  
 
last: function() {  
return this.eq( -1 );  
},  
 
slice: function() {  
return this.pushStack( slice.apply( this, arguments ),  
"slice", slice.call(arguments).join(",") );  
},  
 
map: function( callback ) {  
return this.pushStack( jQuery.map(this, function( elem, i ) {  
return callback.call( elem, i, elem );  
}));  
},  
 
end: function() {  
return this.prevObject || this.constructor(null);  
},  
 
// For internal use only.  
// Behaves like an Array's method, not like a jQuery method.  
push: push,  
sort: [].sort,  
splice: [].splice  
};  
 
// Give the init function the jQuery prototype for later instantiation  
jQuery.fn.init.prototype = jQuery.fn;  
 
jQuery.extend = jQuery.fn.extend = function() {  
var options, name, src, copy, copyIsArray, clone,  
target = arguments[0] || {},  
i = 1,  
length = arguments.length,  
deep = false;  
 
// Handle a deep copy situation  
if ( typeof target === "boolean" ) {  
deep = target;  
target = arguments[1] || {};  
// skip the boolean and the target  
i = 2;  
}  
 
// Handle case when target is a string or something (possible in deep copy)  
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {  
target = {};  
}  
 
// extend jQuery itself if only one argument is passed  
if ( length === i ) {  
target = this;  
--i;  
}  
 
for ( ; i < length; i++ ) {  
// Only deal with non-null/undefined values  
if ( (options = arguments[ i ]) != null ) {  
// Extend the base object  
for ( name in options ) {  
src = target[ name ];  
copy = options[ name ];  
 
// Prevent never-ending loop  
if ( target === copy ) {  
continue;  
}  
 
// Recurse if we're merging plain objects or arrays  
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {  
if ( copyIsArray ) {  
copyIsArray = false;  
clone = src && jQuery.isArray(src) ? src : [];  
 
} else {  
clone = src && jQuery.isPlainObject(src) ? src : {};  
}  
 
// Never move original objects, clone them  
target[ name ] = jQuery.extend( deep, clone, copy );  
 
// Don't bring in undefined values  
} else if ( copy !== undefined ) {  
target[ name ] = copy;  
}  
}  
}  
}  
 
// Return the modified object  
return target;  
};  
 
jQuery.extend({  
noConflict: function( deep ) {  
window.$ = _$;  
 
if ( deep ) {  
window.jQuery = _jQuery;  
}  
 
return jQuery;  
},  
 
// Is the DOM ready to be used? Set to true once it occurs.  
isReady: false,  
 
// A counter to track how many items to wait for before  
// the ready event fires. See #6781  
readyWait: 1,  
 
// Handle when the DOM is ready  
ready: function( wait ) {  
// A third-party is pushing the ready event forwards  
if ( wait === true ) {  
jQuery.readyWait--;  
}  
 
// Make sure that the DOM is not already loaded  
if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {  
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).  
if ( !document.body ) {  
return setTimeout( jQuery.ready, 1 );  
}  
 
// Remember that the DOM is ready  
jQuery.isReady = true;  
 
// If a normal DOM Ready event fired, decrement, and wait if need be  
if ( wait !== true && --jQuery.readyWait > 0 ) {  
return;  
}  
 
// If there are functions bound, to execute  
readyList.resolveWith( document, [ jQuery ] );  
 
// Trigger any bound ready events  
if ( jQuery.fn.trigger ) {  
jQuery( document ).trigger( "ready" ).unbind( "ready" );  
}  
}  
},  
 
bindReady: function() {  
if ( readyBound ) {  
return;  
}  
 
readyBound = true;  
 
// Catch cases where $(document).ready() is called after the  
// browser event has already occurred.  
if ( document.readyState === "complete" ) {  
// Handle it asynchronously to allow scripts the opportunity to delay ready  
return setTimeout( jQuery.ready, 1 );  
}  
 
// Mozilla, Opera and webkit nightlies currently support this event  
if ( document.addEventListener ) {  
// Use the handy event callback  
document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );  
 
// A fallback to window.onload, that will always work  
window.addEventListener( "load", jQuery.ready, false );  
 
// If IE event model is used  
} else if ( document.attachEvent ) {  
// ensure firing before onload,  
// maybe late but safe also for iframes  
document.attachEvent("onreadystatechange", DOMContentLoaded);  
 
// A fallback to window.onload, that will always work  
window.attachEvent( "onload", jQuery.ready );  
 
// If IE and not a frame  
// continually check to see if the document is ready  
var toplevel = false;  
 
try {  
toplevel = window.frameElement == null;  
} catch(e) {}  
 
if ( document.documentElement.doScroll && toplevel ) {  
doScrollCheck();  
}  
}  
},  
 
// See test/unit/core.js for details concerning isFunction.  
// Since version 1.3, DOM methods and functions like alert  
// aren't supported. They return false on IE (#2968).  
isFunction: function( obj ) {  
return jQuery.type(obj) === "function";  
},  
 
isArray: Array.isArray || function( obj ) {  
return jQuery.type(obj) === "array";  
},  
 
// A crude way of determining if an object is a window  
isWindow: function( obj ) {  
return obj && typeof obj === "object" && "setInterval" in obj;  
},  
 
isNaN: function( obj ) {  
return obj == null || !rdigit.test( obj ) || isNaN( obj );  
},  
 
type: function( obj ) {  
return obj == null ?  
String( obj ) :  
class2type[ toString.call(obj) ] || "object";  
},  
 
isPlainObject: function( obj ) {  
// Must be an Object.  
// Because of IE, we also have to check the presence of the constructor property.  
// Make sure that DOM nodes and window objects don't pass through, as well  
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {  
return false;  
}  
 
// Not own constructor property must be Object  
if ( obj.constructor &&  
!hasOwn.call(obj, "constructor") &&  
!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {  
return false;  
}  
 
// Own properties are enumerated firstly, so to speed up,  
// if last one is own, then all properties are own.  
 
var key;  
for ( key in obj ) {}  
 
return key === undefined || hasOwn.call( obj, key );  
},  
 
isEmptyObject: function( obj ) {  
for ( var name in obj ) {  
return false;  
}  
return true;  
},  
 
error: function( msg ) {  
throw msg;  
},  
 
parseJSON: function( data ) {  
if ( typeof data !== "string" || !data ) {  
return null;  
}  
 
// Make sure leading/trailing whitespace is removed (IE can't handle it)  
data = jQuery.trim( data );  
 
// Make sure the incoming data is actual JSON  
// Logic borrowed from http://json.org/json2.js  
if ( rvalidchars.test(data.replace(rvalidescape, "@")  
.replace(rvalidtokens, "]")  
.replace(rvalidbraces, "")) ) {  
 
// Try to use the native JSON parser first  
return window.JSON && window.JSON.parse ?  
window.JSON.parse( data ) :  
(new Function("return " + data))();  
 
} else {  
jQuery.error( "Invalid JSON: " + data );  
}  
},  
 
// Cross-browser xml parsing  
// (xml & tmp used internally)  
parseXML: function( data , xml , tmp ) {  
 
if ( window.DOMParser ) { // Standard  
tmp = new DOMParser();  
xml = tmp.parseFromString( data , "text/xml" );  
} else { // IE  
xml = new ActiveXObject( "Microsoft.XMLDOM" );  
xml.async = "false";  
xml.loadXML( data );  
}  
 
tmp = xml.documentElement;  
 
if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) {  
jQuery.error( "Invalid XML: " + data );  
}  
 
return xml;  
},  
 
noop: function() {},  
 
// Evalulates a script in a global context  
globalEval: function( data ) {  
if ( data && rnotwhite.test(data) ) {  
// Inspired by code by Andrea Giammarchi  
// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html  
var head = document.getElementsByTagName("head")[0] || document.documentElement,  
script = document.createElement("script");  
 
script.type = "text/javascript";  
 
if ( jQuery.support.scriptEval() ) {  
script.appendChild( document.createTextNode( data ) );  
} else {  
script.text = data;  
}  
 
// Use insertBefore instead of appendChild to circumvent an IE6 bug.  
// This arises when a base node is used (#2709).  
head.insertBefore( script, head.firstChild );  
head.removeChild( script );  
}  
},  
 
nodeName: function( elem, name ) {  
return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();  
},  
 
// args is for internal usage only  
each: function( object, callback, args ) {  
var name, i = 0,  
length = object.length,  
isObj = length === undefined || jQuery.isFunction(object);  
 
if ( args ) {  
if ( isObj ) {  
for ( name in object ) {  
if ( callback.apply( object[ name ], args ) === false ) {  
break;  
}  
}  
} else {  
for ( ; i < length; ) {  
if ( callback.apply( object[ i++ ], args ) === false ) {  
break;  
}  
}  
}  
 
// A special, fast, case for the most common use of each  
} else {  
if ( isObj ) {  
for ( name in object ) {  
if ( callback.call( object[ name ], name, object[ name ] ) === false ) {  
break;  
}  
}  
} else {  
for ( var value = object[0];  
i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}  
}  
}  
 
return object;  
},  
 
// Use native String.trim function wherever possible  
trim: trim ?  
function( text ) {  
return text == null ?  
"" :  
trim.call( text );  
} :  
 
// Otherwise use our own trimming functionality  
function( text ) {  
return text == null ?  
"" :  
text.toString().replace( trimLeft, "" ).replace( trimRight, "" );  
},  
 
// results is for internal usage only  
makeArray: function( array, results ) {  
var ret = results || [];  
 
if ( array != null ) {  
// The window, strings (and functions) also have 'length'  
// The extra typeof function check is to prevent crashes  
// in Safari 2 (See: #3039)  
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930  
var type = jQuery.type(array);  
 
if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {  
push.call( ret, array );  
} else {  
jQuery.merge( ret, array );  
}  
}  
 
return ret;  
},  
 
inArray: function( elem, array ) {  
if ( array.indexOf ) {  
return array.indexOf( elem );  
}  
 
for ( var i = 0, length = array.length; i < length; i++ ) {  
if ( array[ i ] === elem ) {  
return i;  
}  
}  
 
return -1;  
},  
 
merge: function( first, second ) {  
var i = first.length,  
j = 0;  
 
if ( typeof second.length === "number" ) {  
for ( var l = second.length; j < l; j++ ) {  
first[ i++ ] = second[ j ];  
}  
 
} else {  
while ( second[j] !== undefined ) {  
first[ i++ ] = second[ j++ ];  
}  
}  
 
first.length = i;  
 
return first;  
},  
 
grep: function( elems, callback, inv ) {  
var ret = [], retVal;  
inv = !!inv;  
 
// Go through the array, only saving the items  
// that pass the validator function  
for ( var i = 0, length = elems.length; i < length; i++ ) {  
retVal = !!callback( elems[ i ], i );  
if ( inv !== retVal ) {  
ret.push( elems[ i ] );  
}  
}  
 
return ret;  
},  
 
// arg is for internal usage only  
map: function( elems, callback, arg ) {  
var ret = [], value;  
 
// Go through the array, translating each of the items to their  
// new value (or values).  
for ( var i = 0, length = elems.length; i < length; i++ ) {  
value = callback( elems[ i ], i, arg );  
 
if ( value != null ) {  
ret[ ret.length ] = value;  
}  
}  
 
// Flatten any nested arrays  
return ret.concat.apply( [], ret );  
},  
 
// A global GUID counter for objects  
guid: 1,  
 
proxy: function( fn, proxy, thisObject ) {  
if ( arguments.length === 2 ) {  
if ( typeof proxy === "string" ) {  
thisObject = fn;  
fn = thisObject[ proxy ];  
proxy = undefined;  
 
} else if ( proxy && !jQuery.isFunction( proxy ) ) {  
thisObject = proxy;  
proxy = undefined;  
}  
}  
 
if ( !proxy && fn ) {  
proxy = function() {  
return fn.apply( thisObject || this, arguments );  
};  
}  
 
// Set the guid of unique handler to the same of original handler, so it can be removed  
if ( fn ) {  
proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;  
}  
 
// So proxy can be declared as an argument  
return proxy;  
},  
 
// Mutifunctional method to get and set values to a collection  
// The value/s can be optionally by executed if its a function  
access: function( elems, key, value, exec, fn, pass ) {  
var length = elems.length;  
 
// Setting many attributes  
if ( typeof key === "object" ) {  
for ( var k in key ) {  
jQuery.access( elems, k, key[k], exec, fn, value );  
}  
return elems;  
}  
 
// Setting one attribute  
if ( value !== undefined ) {  
// Optionally, function values get executed if exec is true  
exec = !pass && exec && jQuery.isFunction(value);  
 
for ( var i = 0; i < length; i++ ) {  
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );  
}  
 
return elems;  
}  
 
// Getting an attribute  
return length ? fn( elems[0], key ) : undefined;  
},  
 
now: function() {  
return (new Date()).getTime();  
},  
 
// Create a simple deferred (one callbacks list)  
_Deferred: function() {  
var // callbacks list  
callbacks = [],  
// stored [ context , args ]  
fired,  
// to avoid firing when already doing so  
firing,  
// flag to know if the deferred has been cancelled  
cancelled,  
// the deferred itself  
deferred = {  
 
// done( f1, f2, ...)  
done: function() {  
if ( !cancelled ) {  
var args = arguments,  
i,  
length,  
elem,  
type,  
_fired;  
if ( fired ) {  
_fired = fired;  
fired = 0;  
}  
for ( i = 0, length = args.length; i < length; i++ ) {  
elem = args[ i ];  
type = jQuery.type( elem );  
if ( type === "array" ) {  
deferred.done.apply( deferred, elem );  
} else if ( type === "function" ) {  
callbacks.push( elem );  
}  
}  
if ( _fired ) {  
deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );  
}  
}  
return this;  
},  
 
// resolve with given context and args  
resolveWith: function( context, args ) {  
if ( !cancelled && !fired && !firing ) {  
firing = 1;  
try {  
while( callbacks[ 0 ] ) {  
callbacks.shift().apply( context, args );  
}  
}  
finally {  
fired = [ context, args ];  
firing = 0;  
}  
}  
return this;  
},  
 
// resolve with this as context and given arguments  
resolve: function() {  
deferred.resolveWith( jQuery.isFunction( this.promise ) ? this.promise() : this, arguments );  
return this;  
},  
 
// Has this deferred been resolved?  
isResolved: function() {  
return !!( firing || fired );  
},  
 
// Cancel  
cancel: function() {  
cancelled = 1;  
callbacks = [];  
return this;  
}  
};  
 
return deferred;  
},  
 
// Full fledged deferred (two callbacks list)  
Deferred: function( func ) {  
var deferred = jQuery._Deferred(),  
failDeferred = jQuery._Deferred(),  
promise;  
// Add errorDeferred methods, then and promise  
jQuery.extend( deferred, {  
then: function( doneCallbacks, failCallbacks ) {  
deferred.done( doneCallbacks ).fail( failCallbacks );  
return this;  
},  
fail: failDeferred.done,  
rejectWith: failDeferred.resolveWith,  
reject: failDeferred.resolve,  
isRejected: failDeferred.isResolved,  
// Get a promise for this deferred  
// If obj is provided, the promise aspect is added to the object  
promise: function( obj , i /* internal */ ) {  
if ( obj == null ) {  
if ( promise ) {  
return promise;  
}  
promise = obj = {};  
}  
i = promiseMethods.length;  
while( i-- ) {  
obj[ promiseMethods[ i ] ] = deferred[ promiseMethods[ i ] ];  
}  
return obj;  
}  
} );  
// Make sure only one callback list will be used  
deferred.then( failDeferred.cancel, deferred.cancel );  
// Unexpose cancel  
delete deferred.cancel;  
// Call given func if any  
if ( func ) {  
func.call( deferred, deferred );  
}  
return deferred;  
},  
 
// Deferred helper  
when: function( object ) {  
var args = arguments,  
length = args.length,  
deferred = length <= 1 && object && jQuery.isFunction( object.promise ) ?  
object :  
jQuery.Deferred(),  
promise = deferred.promise(),  
resolveArray;  
 
if ( length > 1 ) {  
resolveArray = new Array( length );  
jQuery.each( args, function( index, element ) {  
jQuery.when( element ).then( function( value ) {  
resolveArray[ index ] = arguments.length > 1 ? slice.call( arguments, 0 ) : value;  
if( ! --length ) {  
deferred.resolveWith( promise, resolveArray );  
}  
}, deferred.reject );  
} );  
} else if ( deferred !== object ) {  
deferred.resolve( object );  
}  
return promise;  
},  
 
// Use of jQuery.browser is frowned upon.  
// More details: http://docs.jquery.com/Utilities/jQuery.browser  
uaMatch: function( ua ) {  
ua = ua.toLowerCase();  
 
var match = rwebkit.exec( ua ) ||  
ropera.exec( ua ) ||  
rmsie.exec( ua ) ||  
ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||  
[];  
 
return { browser: match[1] || "", version: match[2] || "0" };  
},  
 
sub: function() {  
function jQuerySubclass( selector, context ) {  
return new jQuerySubclass.fn.init( selector, context );  
}  
jQuery.extend( true, jQuerySubclass, this );  
jQuerySubclass.superclass = this;  
jQuerySubclass.fn = jQuerySubclass.prototype = this();  
jQuerySubclass.fn.constructor = jQuerySubclass;  
jQuerySubclass.subclass = this.subclass;  
jQuerySubclass.fn.init = function init( selector, context ) {  
if ( context && context instanceof jQuery && !(context instanceof jQuerySubclass) ) {  
context = jQuerySubclass(context);  
}  
 
return jQuery.fn.init.call( this, selector, context, rootjQuerySubclass );  
};  
jQuerySubclass.fn.init.prototype = jQuerySubclass.fn;  
var rootjQuerySubclass = jQuerySubclass(document);  
return jQuerySubclass;  
},  
 
browser: {}  
});  
 
// Create readyList deferred  
readyList = jQuery._Deferred();  
 
// Populate the class2type map  
jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {  
class2type[ "[object " + name + "]" ] = name.toLowerCase();  
});  
 
browserMatch = jQuery.uaMatch( userAgent );  
if ( browserMatch.browser ) {  
jQuery.browser[ browserMatch.browser ] = true;  
jQuery.browser.version = browserMatch.version;  
}  
 
// Deprecated, use jQuery.browser.webkit instead  
if ( jQuery.browser.webkit ) {  
jQuery.browser.safari = true;  
}  
 
if ( indexOf ) {  
jQuery.inArray = function( elem, array ) {  
return indexOf.call( array, elem );  
};  
}  
 
// IE doesn't match non-breaking spaces with \s  
if ( rnotwhite.test( "\xA0" ) ) {  
trimLeft = /^[\s\xA0]+/;  
trimRight = /[\s\xA0]+$/;  
}  
 
// All jQuery objects should point back to these  
rootjQuery = jQuery(document);  
 
// Cleanup functions for the document ready method  
if ( document.addEventListener ) {  
DOMContentLoaded = function() {  
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );  
jQuery.ready();  
};  
 
} else if ( document.attachEvent ) {  
DOMContentLoaded = function() {  
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).  
if ( document.readyState === "complete" ) {  
document.detachEvent( "onreadystatechange", DOMContentLoaded );  
jQuery.ready();  
}  
};  
}  
 
// The DOM ready check for Internet Explorer  
function doScrollCheck() {  
if ( jQuery.isReady ) {  
return;  
}  
 
try {  
// If IE is used, use the trick by Diego Perini  
// http://javascript.nwbox.com/IEContentLoaded/  
document.documentElement.doScroll("left");  
} catch(e) {  
setTimeout( doScrollCheck, 1 );  
return;  
}  
 
// and execute any waiting functions  
jQuery.ready();  
}  
 
// Expose jQuery to the global object  
return (window.jQuery = window.$ = jQuery);  
 
})();  
 
 
(function() {  
 
jQuery.support = {};  
 
var div = document.createElement("div");  
 
div.style.display = "none";  
div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";  
 
var all = div.getElementsByTagName("*"),  
a = div.getElementsByTagName("a")[0],  
select = document.createElement("select"),  
opt = select.appendChild( document.createElement("option") );  
 
// Can't get basic test support  
if ( !all || !all.length || !a ) {  
return;  
}  
 
jQuery.support = {  
// IE strips leading whitespace when .innerHTML is used  
leadingWhitespace: div.firstChild.nodeType === 3,  
 
// Make sure that tbody elements aren't automatically inserted  
// IE will insert them into empty tables  
tbody: !div.getElementsByTagName("tbody").length,  
 
// Make sure that link elements get serialized correctly by innerHTML  
// This requires a wrapper element in IE  
htmlSerialize: !!div.getElementsByTagName("link").length,  
 
// Get the style information from getAttribute  
// (IE uses .cssText insted)  
style: /red/.test( a.getAttribute("style") ),  
 
// Make sure that URLs aren't manipulated  
// (IE normalizes it by default)  
hrefNormalized: a.getAttribute("href") === "/a",  
 
// Make sure that element opacity exists  
// (IE uses filter instead)  
// Use a regex to work around a WebKit issue. See #5145  
opacity: /^0.55$/.test( a.style.opacity ),  
 
// Verify style float existence  
// (IE uses styleFloat instead of cssFloat)  
cssFloat: !!a.style.cssFloat,  
 
// Make sure that if no value is specified for a checkbox  
// that it defaults to "on".  
// (WebKit defaults to "" instead)  
checkOn: div.getElementsByTagName("input")[0].value === "on",  
 
// Make sure that a selected-by-default option has a working selected property.  
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)  
optSelected: opt.selected,  
 
// Will be defined later  
deleteExpando: true,  
optDisabled: false,  
checkClone: false,  
_scriptEval: null,  
noCloneEvent: true,  
boxModel: null,  
inlineBlockNeedsLayout: false,  
shrinkWrapBlocks: false,  
reliableHiddenOffsets: true  
};  
 
// Make sure that the options inside disabled selects aren't marked as disabled  
// (WebKit marks them as diabled)  
select.disabled = true;  
jQuery.support.optDisabled = !opt.disabled;  
 
jQuery.support.scriptEval = function() {  
if ( jQuery.support._scriptEval === null ) {  
var root = document.documentElement,  
script = document.createElement("script"),  
id = "script" + jQuery.now();  
 
script.type = "text/javascript";  
try {  
script.appendChild( document.createTextNode( "window." + id + "=1;" ) );  
} catch(e) {}  
 
root.insertBefore( script, root.firstChild );  
 
// Make sure that the execution of code works by injecting a script  
// tag with appendChild/createTextNode  
// (IE doesn't support this, fails, and uses .text instead)  
if ( window[ id ] ) {  
jQuery.support._scriptEval = true;  
delete window[ id ];  
} else {  
jQuery.support._scriptEval = false;  
}  
 
root.removeChild( script );  
// release memory in IE  
root = script = id = null;  
}  
 
return jQuery.support._scriptEval;  
};  
 
// Test to see if it's possible to delete an expando from an element  
// Fails in Internet Explorer  
try {  
delete div.test;  
 
} catch(e) {  
jQuery.support.deleteExpando = false;  
}  
 
if ( div.attachEvent && div.fireEvent ) {  
div.attachEvent("onclick", function click() {  
// Cloning a node shouldn't copy over any  
// bound event handlers (IE does this)  
jQuery.support.noCloneEvent = false;  
div.detachEvent("onclick", click);  
});  
div.cloneNode(true).fireEvent("onclick");  
}  
 
div = document.createElement("div");  
div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";  
 
var fragment = document.createDocumentFragment();  
fragment.appendChild( div.firstChild );  
 
// WebKit doesn't clone checked state correctly in fragments  
jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;  
 
// Figure out if the W3C box model works as expected  
// document.body must exist before we can do this  
jQuery(function() {  
var div = document.createElement("div"),  
body = document.getElementsByTagName("body")[0];  
 
// Frameset documents with no body should not run this code  
if ( !body ) {  
return;  
}  
 
div.style.width = div.style.paddingLeft = "1px";  
body.appendChild( div );  
jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;  
 
if ( "zoom" in div.style ) {  
// Check if natively block-level elements act like inline-block  
// elements when setting their display to 'inline' and giving  
// them layout  
// (IE < 8 does this)  
div.style.display = "inline";  
div.style.zoom = 1;  
jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;  
 
// Check if elements with layout shrink-wrap their children  
// (IE 6 does this)  
div.style.display = "";  
div.innerHTML = "<div style='width:4px;'></div>";  
jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;  
}  
 
div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";  
var tds = div.getElementsByTagName("td");  
 
// Check if table cells still have offsetWidth/Height when they are set  
// to display:none and there are still other visible table cells in a  
// table row; if so, offsetWidth/Height are not reliable for use when  
// determining if an element has been hidden directly using  
// display:none (it is still safe to use offsets if a parent element is  
// hidden; don safety goggles and see bug #4512 for more information).  
// (only IE 8 fails this test)  
jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;  
 
tds[0].style.display = "";  
tds[1].style.display = "none";  
 
// Check if empty table cells still have offsetWidth/Height  
// (IE < 8 fail this test)  
jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;  
div.innerHTML = "";  
 
body.removeChild( div ).style.display = "none";  
div = tds = null;  
});  
 
// Technique from Juriy Zaytsev  
// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/  
var eventSupported = function( eventName ) {  
var el = document.createElement("div");  
eventName = "on" + eventName;  
 
// We only care about the case where non-standard event systems  
// are used, namely in IE. Short-circuiting here helps us to  
// avoid an eval call (in setAttribute) which can cause CSP  
// to go haywire. See: https://developer.mozilla.org/en/Security/CSP  
if ( !el.attachEvent ) {  
return true;  
}  
 
var isSupported = (eventName in el);  
if ( !isSupported ) {  
el.setAttribute(eventName, "return;");  
isSupported = typeof el[eventName] === "function";  
}  
el = null;  
 
return isSupported;  
};  
 
jQuery.support.submitBubbles = eventSupported("submit");  
jQuery.support.changeBubbles = eventSupported("change");  
 
// release memory in IE  
div = all = a = null;  
})();  
 
 
 
var rbrace = /^(?:\{.*\}|\[.*\])$/;  
 
jQuery.extend({  
cache: {},  
 
// Please use with caution  
uuid: 0,  
 
// Unique for each copy of jQuery on the page  
// Non-digits removed to match rinlinejQuery  
expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),  
 
// The following elements throw uncatchable exceptions if you  
// attempt to add expando properties to them.  
noData: {  
"embed": true,  
// Ban all objects except for Flash (which handle expandos)  
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",  
"applet": true  
},  
 
hasData: function( elem ) {  
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];  
 
return !!elem && !jQuery.isEmptyObject(elem);  
},  
 
data: function( elem, name, data, pvt /* Internal Use Only */ ) {  
if ( !jQuery.acceptData( elem ) ) {  
return;  
}  
 
var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache,  
 
// We have to handle DOM nodes and JS objects differently because IE6-7  
// can't GC object references properly across the DOM-JS boundary  
isNode = elem.nodeType,  
 
// Only DOM nodes need the global jQuery cache; JS object data is  
// attached directly to the object so GC can occur automatically  
cache = isNode ? jQuery.cache : elem,  
 
// Only defining an ID for JS objects if its cache already exists allows  
// the code to shortcut on the same path as a DOM node with no cache  
id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;  
 
// Avoid doing any more work than we need to when trying to get data on an  
// object that has no data at all  
if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) {  
return;  
}  
 
if ( !id ) {  
// Only DOM nodes need a new unique ID for each element since their data  
// ends up in the global cache  
if ( isNode ) {  
elem[ jQuery.expando ] = id = ++jQuery.uuid;  
} else {  
id = jQuery.expando;  
}  
}  
 
if ( !cache[ id ] ) {  
cache[ id ] = {};  
}  
 
// An object can be passed to jQuery.data instead of a key/value pair; this gets  
// shallow copied over onto the existing cache  
if ( typeof name === "object" ) {  
if ( pvt ) {  
cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);  
} else {  
cache[ id ] = jQuery.extend(cache[ id ], name);  
}  
}  
 
thisCache = cache[ id ];  
 
// Internal jQuery data is stored in a separate object inside the object's data  
// cache in order to avoid key collisions between internal data and user-defined  
// data  
if ( pvt ) {  
if ( !thisCache[ internalKey ] ) {  
thisCache[ internalKey ] = {};  
}  
 
thisCache = thisCache[ internalKey ];  
}  
 
if ( data !== undefined ) {  
thisCache[ name ] = data;  
}  
 
// TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should  
// not attempt to inspect the internal events object using jQuery.data, as this  
// internal data object is undocumented and subject to change.  
if ( name === "events" && !thisCache[name] ) {  
return thisCache[ internalKey ] && thisCache[ internalKey ].events;  
}  
 
return getByName ? thisCache[ name ] : thisCache;  
},  
 
removeData: function( elem, name, pvt /* Internal Use Only */ ) {  
if ( !jQuery.acceptData( elem ) ) {  
return;  
}  
 
var internalKey = jQuery.expando, isNode = elem.nodeType,  
 
// See jQuery.data for more information  
cache = isNode ? jQuery.cache : elem,  
 
// See jQuery.data for more information  
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;  
 
// If there is already no cache entry for this object, there is no  
// purpose in continuing  
if ( !cache[ id ] ) {  
return;  
}  
 
if ( name ) {  
var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];  
 
if ( thisCache ) {  
delete thisCache[ name ];  
 
// If there is no data left in the cache, we want to continue  
// and let the cache object itself get destroyed  
if ( !jQuery.isEmptyObject(thisCache) ) {  
return;  
}  
}  
}  
 
// See jQuery.data for more information  
if ( pvt ) {  
delete cache[ id ][ internalKey ];  
 
// Don't destroy the parent cache unless the internal data object  
// had been the only thing left in it  
if ( !jQuery.isEmptyObject(cache[ id ]) ) {  
return;  
}  
}  
 
var internalCache = cache[ id ][ internalKey ];  
 
// Browsers that fail expando deletion also refuse to delete expandos on  
// the window, but it will allow it on all other JS objects; other browsers  
// don't care  
if ( jQuery.support.deleteExpando || cache != window ) {  
delete cache[ id ];  
} else {  
cache[ id ] = null;  
}  
 
// We destroyed the entire user cache at once because it's faster than  
// iterating through each key, but we need to continue to persist internal  
// data if it existed  
if ( internalCache ) {  
cache[ id ] = {};  
cache[ id ][ internalKey ] = internalCache;  
 
// Otherwise, we need to eliminate the expando on the node to avoid  
// false lookups in the cache for entries that no longer exist  
} else if ( isNode ) {  
// IE does not allow us to delete expando properties from nodes,  
// nor does it have a removeAttribute function on Document nodes;  
// we must handle all of these cases  
if ( jQuery.support.deleteExpando ) {  
delete elem[ jQuery.expando ];  
} else if ( elem.removeAttribute ) {  
elem.removeAttribute( jQuery.expando );  
} else {  
elem[ jQuery.expando ] = null;  
}  
}  
},  
 
// For internal use only.  
_data: function( elem, name, data ) {  
return jQuery.data( elem, name, data, true );  
},  
 
// A method for determining if a DOM node can handle the data expando  
acceptData: function( elem ) {  
if ( elem.nodeName ) {  
var match = jQuery.noData[ elem.nodeName.toLowerCase() ];  
 
if ( match ) {  
return !(match === true || elem.getAttribute("classid") !== match);  
}  
}  
 
return true;  
}  
});  
 
jQuery.fn.extend({  
data: function( key, value ) {  
var data = null;  
 
if ( typeof key === "undefined" ) {  
if ( this.length ) {  
data = jQuery.data( this[0] );  
 
if ( this[0].nodeType === 1 ) {  
var attr = this[0].attributes, name;  
for ( var i = 0, l = attr.length; i < l; i++ ) {  
name = attr[i].name;  
 
if ( name.indexOf( "data-" ) === 0 ) {  
name = name.substr( 5 );  
dataAttr( this[0], name, data[ name ] );  
}  
}  
}  
}  
 
return data;  
 
} else if ( typeof key === "object" ) {  
return this.each(function() {  
jQuery.data( this, key );  
});  
}  
 
var parts = key.split(".");  
parts[1] = parts[1] ? "." + parts[1] : "";  
 
if ( value === undefined ) {  
data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);  
 
// Try to fetch any internally stored data first  
if ( data === undefined && this.length ) {  
data = jQuery.data( this[0], key );  
data = dataAttr( this[0], key, data );  
}  
 
return data === undefined && parts[1] ?  
this.data( parts[0] ) :  
data;  
 
} else {  
return this.each(function() {  
var $this = jQuery( this ),  
args = [ parts[0], value ];  
 
$this.triggerHandler( "setData" + parts[1] + "!", args );  
jQuery.data( this, key, value );  
$this.triggerHandler( "changeData" + parts[1] + "!", args );  
});  
}  
},  
 
removeData: function( key ) {  
return this.each(function() {  
jQuery.removeData( this, key );  
});  
}  
});  
 
function dataAttr( elem, key, data ) {  
// If nothing was found internally, try to fetch any  
// data from the HTML5 data-* attribute  
if ( data === undefined && elem.nodeType === 1 ) {  
data = elem.getAttribute( "data-" + key );  
 
if ( typeof data === "string" ) {  
try {  
data = data === "true" ? true :  
data === "false" ? false :  
data === "null" ? null :  
!jQuery.isNaN( data ) ? parseFloat( data ) :  
rbrace.test( data ) ? jQuery.parseJSON( data ) :  
data;  
} catch( e ) {}  
 
// Make sure we set the data so it isn't changed later  
jQuery.data( elem, key, data );  
 
} else {  
data = undefined;  
}  
}  
 
return data;  
}  
 
 
 
 
jQuery.extend({  
queue: function( elem, type, data ) {  
if ( !elem ) {  
return;  
}  
 
type = (type || "fx") + "queue";  
var q = jQuery._data( elem, type );  
 
// Speed up dequeue by getting out quickly if this is just a lookup  
if ( !data ) {  
return q || [];  
}  
 
if ( !q || jQuery.isArray(data) ) {  
q = jQuery._data( elem, type, jQuery.makeArray(data) );  
 
} else {  
q.push( data );  
}  
 
return q;  
},  
 
dequeue: function( elem, type ) {  
type = type || "fx";  
 
var queue = jQuery.queue( elem, type ),  
fn = queue.shift();  
 
// If the fx queue is dequeued, always remove the progress sentinel  
if ( fn === "inprogress" ) {  
fn = queue.shift();  
}  
 
if ( fn ) {  
// Add a progress sentinel to prevent the fx queue from being  
// automatically dequeued  
if ( type === "fx" ) {  
queue.unshift("inprogress");  
}  
 
fn.call(elem, function() {  
jQuery.dequeue(elem, type);  
});  
}  
 
if ( !queue.length ) {  
jQuery.removeData( elem, type + "queue", true );  
}  
}  
});  
 
jQuery.fn.extend({  
queue: function( type, data ) {  
if ( typeof type !== "string" ) {  
data = type;  
type = "fx";  
}  
 
if ( data === undefined ) {  
return jQuery.queue( this[0], type );  
}  
return this.each(function( i ) {  
var queue = jQuery.queue( this, type, data );  
 
if ( type === "fx" && queue[0] !== "inprogress" ) {  
jQuery.dequeue( this, type );  
}  
});  
},  
dequeue: function( type ) {  
return this.each(function() {  
jQuery.dequeue( this, type );  
});  
},  
 
// Based off of the plugin by Clint Helfers, with permission.  
// http://blindsignals.com/index.php/2009/07/jquery-delay/  
delay: function( time, type ) {  
time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;  
type = type || "fx";  
 
return this.queue( type, function() {  
var elem = this;  
setTimeout(function() {  
jQuery.dequeue( elem, type );  
}, time );  
});  
},  
 
clearQueue: function( type ) {  
return this.queue( type || "fx", [] );  
}  
});  
 
 
 
 
var rclass = /[\n\t\r]/g,  
rspaces = /\s+/,  
rreturn = /\r/g,  
rspecialurl = /^(?:href|src|style)$/,  
rtype = /^(?:button|input)$/i,  
rfocusable = /^(?:button|input|object|select|textarea)$/i,  
rclickable = /^a(?:rea)?$/i,  
rradiocheck = /^(?:radio|checkbox)$/i;  
 
jQuery.props = {  
"for": "htmlFor",  
"class": "className",  
readonly: "readOnly",  
maxlength: "maxLength",  
cellspacing: "cellSpacing",  
rowspan: "rowSpan",  
colspan: "colSpan",  
tabindex: "tabIndex",  
usemap: "useMap",  
frameborder: "frameBorder"  
};  
 
jQuery.fn.extend({  
attr: function( name, value ) {  
return jQuery.access( this, name, value, true, jQuery.attr );  
},  
 
removeAttr: function( name, fn ) {  
return this.each(function(){  
jQuery.attr( this, name, "" );  
if ( this.nodeType === 1 ) {  
this.removeAttribute( name );  
}  
});  
},  
 
addClass: function( value ) {  
if ( jQuery.isFunction(value) ) {  
return this.each(function(i) {  
var self = jQuery(this);  
self.addClass( value.call(this, i, self.attr("class")) );  
});  
}  
 
if ( value && typeof value === "string" ) {  
var classNames = (value || "").split( rspaces );  
 
for ( var i = 0, l = this.length; i < l; i++ ) {  
var elem = this[i];  
 
if ( elem.nodeType === 1 ) {  
if ( !elem.className ) {  
elem.className = value;  
 
} else {  
var className = " " + elem.className + " ",  
setClass = elem.className;  
 
for ( var c = 0, cl = classNames.length; c < cl; c++ ) {  
if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {  
setClass += " " + classNames[c];  
}  
}  
elem.className = jQuery.trim( setClass );  
}  
}  
}  
}  
 
return this;  
},  
 
removeClass: function( value ) {  
if ( jQuery.isFunction(value) ) {  
return this.each(function(i) {  
var self = jQuery(this);  
self.removeClass( value.call(this, i, self.attr("class")) );  
});  
}  
 
if ( (value && typeof value === "string") || value === undefined ) {  
var classNames = (value || "").split( rspaces );  
 
for ( var i = 0, l = this.length; i < l; i++ ) {  
var elem = this[i];  
 
if ( elem.nodeType === 1 && elem.className ) {  
if ( value ) {  
var className = (" " + elem.className + " ").replace(rclass, " ");  
for ( var c = 0, cl = classNames.length; c < cl; c++ ) {  
className = className.replace(" " + classNames[c] + " ", " ");  
}  
elem.className = jQuery.trim( className );  
 
} else {  
elem.className = "";  
}  
}  
}  
}  
 
return this;  
},  
 
toggleClass: function( value, stateVal ) {  
var type = typeof value,  
isBool = typeof stateVal === "boolean";  
 
if ( jQuery.isFunction( value ) ) {  
return this.each(function(i) {  
var self = jQuery(this);  
self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );  
});  
}  
 
return this.each(function() {  
if ( type === "string" ) {  
// toggle individual class names  
var className,  
i = 0,  
self = jQuery( this ),  
state = stateVal,  
classNames = value.split( rspaces );  
 
while ( (className = classNames[ i++ ]) ) {  
// check each className given, space seperated list  
state = isBool ? state : !self.hasClass( className );  
self[ state ? "addClass" : "removeClass" ]( className );  
}  
 
} else if ( type === "undefined" || type === "boolean" ) {  
if ( this.className ) {  
// store className if set  
jQuery._data( this, "__className__", this.className );  
}  
 
// toggle whole className  
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";  
}  
});  
},  
 
hasClass: function( selector ) {  
var className = " " + selector + " ";  
for ( var i = 0, l = this.length; i < l; i++ ) {  
if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {  
return true;  
}  
}  
 
return false;  
},  
 
val: function( value ) {  
if ( !arguments.length ) {  
var elem = this[0];  
 
if ( elem ) {  
if ( jQuery.nodeName( elem, "option" ) ) {  
// attributes.value is undefined in Blackberry 4.7 but  
// uses .value. See #6932  
var val = elem.attributes.value;  
return !val || val.specified ? elem.value : elem.text;  
}  
 
// We need to handle select boxes special  
if ( jQuery.nodeName( elem, "select" ) ) {  
var index = elem.selectedIndex,  
values = [],  
options = elem.options,  
one = elem.type === "select-one";  
 
// Nothing was selected  
if ( index < 0 ) {  
return null;  
}  
 
// Loop through all the selected options  
for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {  
var option = options[ i ];  
 
// Don't return options that are disabled or in a disabled optgroup  
if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&  
(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {  
 
// Get the specific value for the option  
value = jQuery(option).val();  
 
// We don't need an array for one selects  
if ( one ) {  
return value;  
}  
 
// Multi-Selects return an array  
values.push( value );  
}  
}  
 
return values;  
}  
 
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified  
if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {  
return elem.getAttribute("value") === null ? "on" : elem.value;  
}  
 
// Everything else, we just grab the value  
return (elem.value || "").replace(rreturn, "");  
 
}  
 
return undefined;  
}  
 
var isFunction = jQuery.isFunction(value);  
 
return this.each(function(i) {  
var self = jQuery(this), val = value;  
 
if ( this.nodeType !== 1 ) {  
return;  
}  
 
if ( isFunction ) {  
val = value.call(this, i, self.val());  
}  
 
// Treat null/undefined as ""; convert numbers to string  
if ( val == null ) {  
val = "";  
} else if ( typeof val === "number" ) {  
val += "";  
} else if ( jQuery.isArray(val) ) {  
val = jQuery.map(val, function (value) {  
return value == null ? "" : value + "";  
});  
}  
 
if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {  
this.checked = jQuery.inArray( self.val(), val ) >= 0;  
 
} else if ( jQuery.nodeName( this, "select" ) ) {  
var values = jQuery.makeArray(val);  
 
jQuery( "option", this ).each(function() {  
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;  
});  
 
if ( !values.length ) {  
this.selectedIndex = -1;  
}  
 
} else {  
this.value = val;  
}  
});  
}  
});  
 
jQuery.extend({  
attrFn: {  
val: true,  
css: true,  
html: true,  
text: true,  
data: true,  
width: true,  
height: true,  
offset: true  
},  
 
attr: function( elem, name, value, pass ) {  
// don't get/set attributes on text, comment and attribute nodes  
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || elem.nodeType === 2 ) {  
return undefined;  
}  
 
if ( pass && name in jQuery.attrFn ) {  
return jQuery(elem)[name](value);  
}  
 
var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),  
// Whether we are setting (or getting)  
set = value !== undefined;  
 
// Try to normalize/fix the name  
name = notxml && jQuery.props[ name ] || name;  
 
// Only do all the following if this is a node (faster for style)  
if ( elem.nodeType === 1 ) {  
// These attributes require special treatment  
var special = rspecialurl.test( name );  
 
// Safari mis-reports the default selected property of an option  
// Accessing the parent's selectedIndex property fixes it  
if ( name === "selected" && !jQuery.support.optSelected ) {  
var parent = elem.parentNode;  
if ( parent ) {  
parent.selectedIndex;  
 
// Make sure that it also works with optgroups, see #5701  
if ( parent.parentNode ) {  
parent.parentNode.selectedIndex;  
}  
}  
}  
 
// If applicable, access the attribute via the DOM 0 way  
// 'in' checks fail in Blackberry 4.7 #6931  
if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {  
if ( set ) {  
// We can't allow the type property to be changed (since it causes problems in IE)  
if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {  
jQuery.error( "type property can't be changed" );  
}  
 
if ( value === null ) {  
if ( elem.nodeType === 1 ) {  
elem.removeAttribute( name );  
}  
 
} else {  
elem[ name ] = value;  
}  
}  
 
// browsers index elements by id/name on forms, give priority to attributes.  
if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {  
return elem.getAttributeNode( name ).nodeValue;  
}  
 
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set  
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/  
if ( name === "tabIndex" ) {  
var attributeNode = elem.getAttributeNode( "tabIndex" );  
 
return attributeNode && attributeNode.specified ?  
attributeNode.value :  
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?  
0 :  
undefined;  
}  
 
return elem[ name ];  
}  
 
if ( !jQuery.support.style && notxml && name === "style" ) {  
if ( set ) {  
elem.style.cssText = "" + value;  
}  
 
return elem.style.cssText;  
}  
 
if ( set ) {  
// convert the value to a string (all browsers do this but IE) see #1070  
elem.setAttribute( name, "" + value );  
}  
 
// Ensure that missing attributes return undefined  
// Blackberry 4.7 returns "" from getAttribute #6938  
if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {  
return undefined;  
}  
 
var attr = !jQuery.support.hrefNormalized && notxml && special ?  
// Some attributes require a special call on IE  
elem.getAttribute( name, 2 ) :  
elem.getAttribute( name );  
 
// Non-existent attributes return null, we normalize to undefined  
return attr === null ? undefined : attr;  
}  
// Handle everything which isn't a DOM element node  
if ( set ) {  
elem[ name ] = value;  
}  
return elem[ name ];  
}  
});  
 
 
 
 
var rnamespaces = /\.(.*)$/,  
rformElems = /^(?:textarea|input|select)$/i,  
rperiod = /\./g,  
rspace = / /g,  
rescape = /[^\w\s.|`]/g,  
fcleanup = function( nm ) {  
return nm.replace(rescape, "\\$&");  
},  
eventKey = "events";  
 
/*  
* A number of helper functions used for managing events.  
* Many of the ideas behind this code originated from  
* Dean Edwards' addEvent library.  
*/  
jQuery.event = {  
 
// Bind an event to an element  
// Original by Dean Edwards  
add: function( elem, types, handler, data ) {  
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {  
return;  
}  
 
// For whatever reason, IE has trouble passing the window object  
// around, causing it to be cloned in the process  
if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {  
elem = window;  
}  
 
if ( handler === false ) {  
handler = returnFalse;  
} else if ( !handler ) {  
// Fixes bug #7229. Fix recommended by jdalton  
return;  
}  
 
var handleObjIn, handleObj;  
 
if ( handler.handler ) {  
handleObjIn = handler;  
handler = handleObjIn.handler;  
}  
 
// Make sure that the function being executed has a unique ID  
if ( !handler.guid ) {  
handler.guid = jQuery.guid++;  
}  
 
// Init the element's event structure  
var elemData = jQuery._data( elem );  
 
// If no elemData is found then we must be trying to bind to one of the  
// banned noData elements  
if ( !elemData ) {  
return;  
}  
 
var events = elemData[ eventKey ],  
eventHandle = elemData.handle;  
 
if ( typeof events === "function" ) {  
// On plain objects events is a fn that holds the the data  
// which prevents this data from being JSON serialized  
// the function does not need to be called, it just contains the data  
eventHandle = events.handle;  
events = events.events;  
 
} else if ( !events ) {  
if ( !elem.nodeType ) {  
// On plain objects, create a fn that acts as the holder  
// of the values to avoid JSON serialization of event data  
elemData[ eventKey ] = elemData = function(){};  
}  
 
elemData.events = events = {};  
}  
 
if ( !eventHandle ) {  
elemData.handle = eventHandle = function() {  
// Handle the second event of a trigger and when  
// an event is called after a page has unloaded  
return typeof jQuery !== "undefined" && !jQuery.event.triggered ?  
jQuery.event.handle.apply( eventHandle.elem, arguments ) :  
undefined;  
};  
}  
 
// Add elem as a property of the handle function  
// This is to prevent a memory leak with non-native events in IE.  
eventHandle.elem = elem;  
 
// Handle multiple events separated by a space  
// jQuery(...).bind("mouseover mouseout", fn);  
types = types.split(" ");  
 
var type, i = 0, namespaces;  
 
while ( (type = types[ i++ ]) ) {  
handleObj = handleObjIn ?  
jQuery.extend({}, handleObjIn) :  
{ handler: handler, data: data };  
 
// Namespaced event handlers  
if ( type.indexOf(".") > -1 ) {  
namespaces = type.split(".");  
type = namespaces.shift();  
handleObj.namespace = namespaces.slice(0).sort().join(".");  
 
} else {  
namespaces = [];  
handleObj.namespace = "";  
}  
 
handleObj.type = type;  
if ( !handleObj.guid ) {  
handleObj.guid = handler.guid;  
}  
 
// Get the current list of functions bound to this event  
var handlers = events[ type ],  
special = jQuery.event.special[ type ] || {};  
 
// Init the event handler queue  
if ( !handlers ) {  
handlers = events[ type ] = [];  
 
// Check for a special event handler  
// Only use addEventListener/attachEvent if the special  
// events handler returns false  
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {  
// Bind the global event handler to the element  
if ( elem.addEventListener ) {  
elem.addEventListener( type, eventHandle, false );  
 
} else if ( elem.attachEvent ) {  
elem.attachEvent( "on" + type, eventHandle );  
}  
}  
}  
 
if ( special.add ) {  
special.add.call( elem, handleObj );  
 
if ( !handleObj.handler.guid ) {  
handleObj.handler.guid = handler.guid;  
}  
}  
 
// Add the function to the element's handler list  
handlers.push( handleObj );  
 
// Keep track of which events have been used, for global triggering  
jQuery.event.global[ type ] = true;  
}  
 
// Nullify elem to prevent memory leaks in IE  
elem = null;  
},  
 
global: {},  
 
// Detach an event or set of events from an element  
remove: function( elem, types, handler, pos ) {  
// don't do events on text and comment nodes  
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {  
return;  
}  
 
if ( handler === false ) {  
handler = returnFalse;  
}  
 
var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,  
elemData = jQuery.hasData( elem ) && jQuery._data( elem ),  
events = elemData && elemData[ eventKey ];  
 
if ( !elemData || !events ) {  
return;  
}  
 
if ( typeof events === "function" ) {  
elemData = events;  
events = events.events;  
}  
 
// types is actually an event object here  
if ( types && types.type ) {  
handler = types.handler;  
types = types.type;  
}  
 
// Unbind all events for the element  
if ( !types || typeof types === "string" && types.charAt(0) === "." ) {  
types = types || "";  
 
for ( type in events ) {  
jQuery.event.remove( elem, type + types );  
}  
 
return;  
}  
 
// Handle multiple events separated by a space  
// jQuery(...).unbind("mouseover mouseout", fn);  
types = types.split(" ");  
 
while ( (type = types[ i++ ]) ) {  
origType = type;  
handleObj = null;  
all = type.indexOf(".") < 0;  
namespaces = [];  
 
if ( !all ) {  
// Namespaced event handlers  
namespaces = type.split(".");  
type = namespaces.shift();  
 
namespace = new RegExp("(^|\\.)" +  
jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");  
}  
 
eventType = events[ type ];  
 
if ( !eventType ) {  
continue;  
}  
 
if ( !handler ) {  
for ( j = 0; j < eventType.length; j++ ) {  
handleObj = eventType[ j ];  
 
if ( all || namespace.test( handleObj.namespace ) ) {  
jQuery.event.remove( elem, origType, handleObj.handler, j );  
eventType.splice( j--, 1 );  
}  
}  
 
continue;  
}  
 
special = jQuery.event.special[ type ] || {};  
 
for ( j = pos || 0; j < eventType.length; j++ ) {  
handleObj = eventType[ j ];  
 
if ( handler.guid === handleObj.guid ) {  
// remove the given handler for the given type  
if ( all || namespace.test( handleObj.namespace ) ) {  
if ( pos == null ) {  
eventType.splice( j--, 1 );  
}  
 
if ( special.remove ) {  
special.remove.call( elem, handleObj );  
}  
}  
 
if ( pos != null ) {  
break;  
}  
}  
}  
 
// remove generic event handler if no more handlers exist  
if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {  
if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {  
jQuery.removeEvent( elem, type, elemData.handle );  
}  
 
ret = null;  
delete events[ type ];  
}  
}  
 
// Remove the expando if it's no longer used  
if ( jQuery.isEmptyObject( events ) ) {  
var handle = elemData.handle;  
if ( handle ) {  
handle.elem = null;  
}  
 
delete elemData.events;  
delete elemData.handle;  
 
if ( typeof elemData === "function" ) {  
jQuery.removeData( elem, eventKey, true );  
 
} else if ( jQuery.isEmptyObject( elemData ) ) {  
jQuery.removeData( elem, undefined, true );  
}  
}  
},  
 
// bubbling is internal  
trigger: function( event, data, elem /*, bubbling */ ) {  
// Event object or event type  
var type = event.type || event,  
bubbling = arguments[3];  
 
if ( !bubbling ) {  
event = typeof event === "object" ?  
// jQuery.Event object  
event[ jQuery.expando ] ? event :  
// Object literal  
jQuery.extend( jQuery.Event(type), event ) :  
// Just the event type (string)  
jQuery.Event(type);  
 
if ( type.indexOf("!") >= 0 ) {  
event.type = type = type.slice(0, -1);  
event.exclusive = true;  
}  
 
// Handle a global trigger  
if ( !elem ) {  
// Don't bubble custom events when global (to avoid too much overhead)  
event.stopPropagation();  
 
// Only trigger if we've ever bound an event for it  
if ( jQuery.event.global[ type ] ) {  
// XXX This code smells terrible. event.js should not be directly  
// inspecting the data cache  
jQuery.each( jQuery.cache, function() {  
// internalKey variable is just used to make it easier to find  
// and potentially change this stuff later; currently it just  
// points to jQuery.expando  
var internalKey = jQuery.expando,  
internalCache = this[ internalKey ];  
if ( internalCache && internalCache.events && internalCache.events[type] ) {  
jQuery.event.trigger( event, data, internalCache.handle.elem );  
}  
});  
}  
}  
 
// Handle triggering a single element  
 
// don't do events on text and comment nodes  
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {  
return undefined;  
}  
 
// Clean up in case it is reused  
event.result = undefined;  
event.target = elem;  
 
// Clone the incoming data, if any  
data = jQuery.makeArray( data );  
data.unshift( event );  
}  
 
event.currentTarget = elem;  
 
// Trigger the event, it is assumed that "handle" is a function  
var handle = elem.nodeType ?  
jQuery._data( elem, "handle" ) :  
(jQuery._data( elem, eventKey ) || {}).handle;  
 
if ( handle ) {  
handle.apply( elem, data );  
}  
 
var parent = elem.parentNode || elem.ownerDocument;  
 
// Trigger an inline bound script  
try {  
if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {  
if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {  
event.result = false;  
event.preventDefault();  
}  
}  
 
// prevent IE from throwing an error for some elements with some event types, see #3533  
} catch (inlineError) {}  
 
if ( !event.isPropagationStopped() && parent ) {  
jQuery.event.trigger( event, data, parent, true );  
 
} else if ( !event.isDefaultPrevented() ) {  
var old,  
target = event.target,  
targetType = type.replace( rnamespaces, "" ),  
isClick = jQuery.nodeName( target, "a" ) && targetType === "click",  
special = jQuery.event.special[ targetType ] || {};  
 
if ( (!special._default || special._default.call( elem, event ) === false) &&  
!isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {  
 
try {  
if ( target[ targetType ] ) {  
// Make sure that we don't accidentally re-trigger the onFOO events  
old = target[ "on" + targetType ];  
 
if ( old ) {  
target[ "on" + targetType ] = null;  
}  
 
jQuery.event.triggered = true;  
target[ targetType ]();  
}  
 
// prevent IE from throwing an error for some elements with some event types, see #3533  
} catch (triggerError) {}  
 
if ( old ) {  
target[ "on" + targetType ] = old;  
}  
 
jQuery.event.triggered = false;  
}  
}  
},  
 
handle: function( event ) {  
var all, handlers, namespaces, namespace_re, events,  
namespace_sort = [],  
args = jQuery.makeArray( arguments );  
 
event = args[0] = jQuery.event.fix( event || window.event );  
event.currentTarget = this;  
 
// Namespaced event handlers  
all = event.type.indexOf(".") < 0 && !event.exclusive;  
 
if ( !all ) {  
namespaces = event.type.split(".");  
event.type = namespaces.shift();  
namespace_sort = namespaces.slice(0).sort();  
namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)");  
}  
 
event.namespace = event.namespace || namespace_sort.join(".");  
 
events = jQuery._data(this, eventKey);  
 
if ( typeof events === "function" ) {  
events = events.events;  
}  
 
handlers = (events || {})[ event.type ];  
 
if ( events && handlers ) {  
// Clone the handlers to prevent manipulation  
handlers = handlers.slice(0);  
 
for ( var j = 0, l = handlers.length; j < l; j++ ) {  
var handleObj = handlers[ j ];  
 
// Filter the functions by class  
if ( all || namespace_re.test( handleObj.namespace ) ) {  
// Pass in a reference to the handler function itself  
// So that we can later remove it  
event.handler = handleObj.handler;  
event.data = handleObj.data;  
event.handleObj = handleObj;  
 
var ret = handleObj.handler.apply( this, args );  
 
if ( ret !== undefined ) {  
event.result = ret;  
if ( ret === false ) {  
event.preventDefault();  
event.stopPropagation();  
}  
}  
 
if ( event.isImmediatePropagationStopped() ) {  
break;  
}  
}  
}  
}  
 
return event.result;  
},  
 
props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),  
 
fix: function( event ) {  
if ( event[ jQuery.expando ] ) {  
return event;  
}  
 
// store a copy of the original event object  
// and "clone" to set read-only properties  
var originalEvent = event;  
event = jQuery.Event( originalEvent );  
 
for ( var i = this.props.length, prop; i; ) {  
prop = this.props[ --i ];  
event[ prop ] = originalEvent[ prop ];  
}  
 
// Fix target property, if necessary  
if ( !event.target ) {  
// Fixes #1925 where srcElement might not be defined either  
event.target = event.srcElement || document;  
}  
 
// check if target is a textnode (safari)  
if ( event.target.nodeType === 3 ) {  
event.target = event.target.parentNode;  
}  
 
// Add relatedTarget, if necessary  
if ( !event.relatedTarget && event.fromElement ) {  
event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;  
}  
 
// Calculate pageX/Y if missing and clientX/Y available  
if ( event.pageX == null && event.clientX != null ) {  
var doc = document.documentElement,  
body = document.body;  
 
event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);  
event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);  
}  
 
// Add which for key events  
if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {  
event.which = event.charCode != null ? event.charCode : event.keyCode;  
}  
 
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)  
if ( !event.metaKey && event.ctrlKey ) {  
event.metaKey = event.ctrlKey;  
}  
 
// Add which for click: 1 === left; 2 === middle; 3 === right  
// Note: button is not normalized, so don't use it  
if ( !event.which && event.button !== undefined ) {  
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));  
}  
 
return event;  
},  
 
// Deprecated, use jQuery.guid instead  
guid: 1E8,  
 
// Deprecated, use jQuery.proxy instead  
proxy: jQuery.proxy,  
 
special: {  
ready: {  
// Make sure the ready event is setup  
setup: jQuery.bindReady,  
teardown: jQuery.noop  
},  
 
live: {  
add: function( handleObj ) {  
jQuery.event.add( this,  
liveConvert( handleObj.origType, handleObj.selector ),  
jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );  
},  
 
remove: function( handleObj ) {  
jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );  
}  
},  
 
beforeunload: {  
setup: function( data, namespaces, eventHandle ) {  
// We only want to do this special case on windows  
if ( jQuery.isWindow( this ) ) {  
this.onbeforeunload = eventHandle;  
}  
},  
 
teardown: function( namespaces, eventHandle ) {  
if ( this.onbeforeunload === eventHandle ) {  
this.onbeforeunload = null;  
}  
}  
}  
}  
};  
 
jQuery.removeEvent = document.removeEventListener ?  
function( elem, type, handle ) {  
if ( elem.removeEventListener ) {  
elem.removeEventListener( type, handle, false );  
}  
} :  
function( elem, type, handle ) {  
if ( elem.detachEvent ) {  
elem.detachEvent( "on" + type, handle );  
}  
};  
 
jQuery.Event = function( src ) {  
// Allow instantiation without the 'new' keyword  
if ( !this.preventDefault ) {  
return new jQuery.Event( src );  
}  
 
// Event object  
if ( src && src.type ) {  
this.originalEvent = src;  
this.type = src.type;  
 
// Events bubbling up the document may have been marked as prevented  
// by a handler lower down the tree; reflect the correct value.  
this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||  
src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;  
 
// Event type  
} else {  
this.type = src;  
}  
 
// timeStamp is buggy for some events on Firefox(#3843)  
// So we won't rely on the native value  
this.timeStamp = jQuery.now();  
 
// Mark it as fixed  
this[ jQuery.expando ] = true;  
};  
 
function returnFalse() {  
return false;  
}  
function returnTrue() {  
return true;  
}  
 
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding  
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html  
jQuery.Event.prototype = {  
preventDefault: function() {  
this.isDefaultPrevented = returnTrue;  
 
var e = this.originalEvent;  
if ( !e ) {  
return;  
}  
 
// if preventDefault exists run it on the original event  
if ( e.preventDefault ) {  
e.preventDefault();  
 
// otherwise set the returnValue property of the original event to false (IE)  
} else {  
e.returnValue = false;  
}  
},  
stopPropagation: function() {  
this.isPropagationStopped = returnTrue;  
 
var e = this.originalEvent;  
if ( !e ) {  
return;  
}  
// if stopPropagation exists run it on the original event  
if ( e.stopPropagation ) {  
e.stopPropagation();  
}  
// otherwise set the cancelBubble property of the original event to true (IE)  
e.cancelBubble = true;  
},  
stopImmediatePropagation: function() {  
this.isImmediatePropagationStopped = returnTrue;  
this.stopPropagation();  
},  
isDefaultPrevented: returnFalse,  
isPropagationStopped: returnFalse,  
isImmediatePropagationStopped: returnFalse  
};  
 
// Checks if an event happened on an element within another element  
// Used in jQuery.event.special.mouseenter and mouseleave handlers  
var withinElement = function( event ) {  
// Check if mouse(over|out) are still within the same parent element  
var parent = event.relatedTarget;  
 
// Firefox sometimes assigns relatedTarget a XUL element  
// which we cannot access the parentNode property of  
try {  
// Traverse up the tree  
while ( parent && parent !== this ) {  
parent = parent.parentNode;  
}  
 
if ( parent !== this ) {  
// set the correct event type  
event.type = event.data;  
 
// handle event if we actually just moused on to a non sub-element  
jQuery.event.handle.apply( this, arguments );  
}  
 
// assuming we've left the element since we most likely mousedover a xul element  
} catch(e) { }  
},  
 
// In case of event delegation, we only need to rename the event.type,  
// liveHandler will take care of the rest.  
delegate = function( event ) {  
event.type = event.data;  
jQuery.event.handle.apply( this, arguments );  
};  
 
// Create mouseenter and mouseleave events  
jQuery.each({  
mouseenter: "mouseover",  
mouseleave: "mouseout"  
}, function( orig, fix ) {  
jQuery.event.special[ orig ] = {  
setup: function( data ) {  
jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );  
},  
teardown: function( data ) {  
jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );  
}  
};  
});  
 
// submit delegation  
if ( !jQuery.support.submitBubbles ) {  
 
jQuery.event.special.submit = {  
setup: function( data, namespaces ) {  
if ( this.nodeName && this.nodeName.toLowerCase() !== "form" ) {  
jQuery.event.add(this, "click.specialSubmit", function( e ) {  
var elem = e.target,  
type = elem.type;  
 
if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {  
e.liveFired = undefined;  
return trigger( "submit", this, arguments );  
}  
});  
 
jQuery.event.add(this, "keypress.specialSubmit", function( e ) {  
var elem = e.target,  
type = elem.type;  
 
if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {  
e.liveFired = undefined;  
return trigger( "submit", this, arguments );  
}  
});  
 
} else {  
return false;  
}  
},  
 
teardown: function( namespaces ) {  
jQuery.event.remove( this, ".specialSubmit" );  
}  
};  
 
}  
 
// change delegation, happens here so we have bind.  
if ( !jQuery.support.changeBubbles ) {  
 
var changeFilters,  
 
getVal = function( elem ) {  
var type = elem.type, val = elem.value;  
 
if ( type === "radio" || type === "checkbox" ) {  
val = elem.checked;  
 
} else if ( type === "select-multiple" ) {  
val = elem.selectedIndex > -1 ?  
jQuery.map( elem.options, function( elem ) {  
return elem.selected;  
}).join("-") :  
"";  
 
} else if ( elem.nodeName.toLowerCase() === "select" ) {  
val = elem.selectedIndex;  
}  
 
return val;  
},  
 
testChange = function testChange( e ) {  
var elem = e.target, data, val;  
 
if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {  
return;  
}  
 
data = jQuery._data( elem, "_change_data" );  
val = getVal(elem);  
 
// the current data will be also retrieved by beforeactivate  
if ( e.type !== "focusout" || elem.type !== "radio" ) {  
jQuery._data( elem, "_change_data", val );  
}  
 
if ( data === undefined || val === data ) {  
return;  
}  
 
if ( data != null || val ) {  
e.type = "change";  
e.liveFired = undefined;  
return jQuery.event.trigger( e, arguments[1], elem );  
}  
};  
 
jQuery.event.special.change = {  
filters: {  
focusout: testChange,  
 
beforedeactivate: testChange,  
 
click: function( e ) {  
var elem = e.target, type = elem.type;  
 
if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {  
return testChange.call( this, e );  
}  
},  
 
// Change has to be called before submit  
// Keydown will be called before keypress, which is used in submit-event delegation  
keydown: function( e ) {  
var elem = e.target, type = elem.type;  
 
if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||  
(e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||  
type === "select-multiple" ) {  
return testChange.call( this, e );  
}  
},  
 
// Beforeactivate happens also before the previous element is blurred  
// with this event you can't trigger a change event, but you can store  
// information  
beforeactivate: function( e ) {  
var elem = e.target;  
jQuery._data( elem, "_change_data", getVal(elem) );  
}  
},  
 
setup: function( data, namespaces ) {  
if ( this.type === "file" ) {  
return false;  
}  
 
for ( var type in changeFilters ) {  
jQuery.event.add( this, type + ".specialChange", changeFilters[type] );  
}  
 
return rformElems.test( this.nodeName );  
},  
 
teardown: function( namespaces ) {  
jQuery.event.remove( this, ".specialChange" );  
 
return rformElems.test( this.nodeName );  
}  
};  
 
changeFilters = jQuery.event.special.change.filters;  
 
// Handle when the input is .focus()'d  
changeFilters.focus = changeFilters.beforeactivate;  
}  
 
function trigger( type, elem, args ) {  
args[0].type = type;  
return jQuery.event.handle.apply( elem, args );  
}  
 
// Create "bubbling" focus and blur events  
if ( document.addEventListener ) {  
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {  
jQuery.event.special[ fix ] = {  
setup: function() {  
this.addEventListener( orig, handler, true );  
},  
teardown: function() {  
this.removeEventListener( orig, handler, true );  
}  
};  
 
function handler( e ) {  
e = jQuery.event.fix( e );  
e.type = fix;  
return jQuery.event.handle.call( this, e );  
}  
});  
}  
 
jQuery.each(["bind", "one"], function( i, name ) {  
jQuery.fn[ name ] = function( type, data, fn ) {  
// Handle object literals  
if ( typeof type === "object" ) {  
for ( var key in type ) {  
this[ name ](key, data, type[key], fn);  
}  
return this;  
}  
 
if ( jQuery.isFunction( data ) || data === false ) {  
fn = data;  
data = undefined;  
}  
 
var handler = name === "one" ? jQuery.proxy( fn, function( event ) {  
jQuery( this ).unbind( event, handler );  
return fn.apply( this, arguments );  
}) : fn;  
 
if ( type === "unload" && name !== "one" ) {  
this.one( type, data, fn );  
 
} else {  
for ( var i = 0, l = this.length; i < l; i++ ) {  
jQuery.event.add( this[i], type, handler, data );  
}  
}  
 
return this;  
};  
});  
 
jQuery.fn.extend({  
unbind: function( type, fn ) {  
// Handle object literals  
if ( typeof type === "object" && !type.preventDefault ) {  
for ( var key in type ) {  
this.unbind(key, type[key]);  
}  
 
} else {  
for ( var i = 0, l = this.length; i < l; i++ ) {  
jQuery.event.remove( this[i], type, fn );  
}  
}  
 
return this;  
},  
 
delegate: function( selector, types, data, fn ) {  
return this.live( types, data, fn, selector );  
},  
 
undelegate: function( selector, types, fn ) {  
if ( arguments.length === 0 ) {  
return this.unbind( "live" );  
 
} else {  
return this.die( types, null, fn, selector );  
}  
},  
 
trigger: function( type, data ) {  
return this.each(function() {  
jQuery.event.trigger( type, data, this );  
});  
},  
 
triggerHandler: function( type, data ) {  
if ( this[0] ) {  
var event = jQuery.Event( type );  
event.preventDefault();  
event.stopPropagation();  
jQuery.event.trigger( event, data, this[0] );  
return event.result;  
}  
},  
 
toggle: function( fn ) {  
// Save reference to arguments for access in closure  
var args = arguments,  
i = 1;  
 
// link all the functions, so any of them can unbind this click handler  
while ( i < args.length ) {  
jQuery.proxy( fn, args[ i++ ] );  
}  
 
return this.click( jQuery.proxy( fn, function( event ) {  
// Figure out which function to execute  
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;  
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );  
 
// Make sure that clicks stop  
event.preventDefault();  
 
// and execute the function  
return args[ lastToggle ].apply( this, arguments ) || false;  
}));  
},  
 
hover: function( fnOver, fnOut ) {  
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );  
}  
});  
 
var liveMap = {  
focus: "focusin",  
blur: "focusout",  
mouseenter: "mouseover",  
mouseleave: "mouseout"  
};  
 
jQuery.each(["live", "die"], function( i, name ) {  
jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {  
var type, i = 0, match, namespaces, preType,  
selector = origSelector || this.selector,  
context = origSelector ? this : jQuery( this.context );  
 
if ( typeof types === "object" && !types.preventDefault ) {  
for ( var key in types ) {  
context[ name ]( key, data, types[key], selector );  
}  
 
return this;  
}  
 
if ( jQuery.isFunction( data ) ) {  
fn = data;  
data = undefined;  
}  
 
types = (types || "").split(" ");  
 
while ( (type = types[ i++ ]) != null ) {  
match = rnamespaces.exec( type );  
namespaces = "";  
 
if ( match ) {  
namespaces = match[0];  
type = type.replace( rnamespaces, "" );  
}  
 
if ( type === "hover" ) {  
types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );  
continue;  
}  
 
preType = type;  
 
if ( type === "focus" || type === "blur" ) {  
types.push( liveMap[ type ] + namespaces );  
type = type + namespaces;  
 
} else {  
type = (liveMap[ type ] || type) + namespaces;  
}  
 
if ( name === "live" ) {  
// bind live handler  
for ( var j = 0, l = context.length; j < l; j++ ) {  
jQuery.event.add( context[j], "live." + liveConvert( type, selector ),  
{ data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );  
}  
 
} else {  
// unbind live handler  
context.unbind( "live." + liveConvert( type, selector ), fn );  
}  
}  
 
return this;  
};  
});  
 
function liveHandler( event ) {  
var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,  
elems = [],  
selectors = [],  
events = jQuery._data( this, eventKey );  
 
if ( typeof events === "function" ) {  
events = events.events;  
}  
 
// Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911)  
if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) {  
return;  
}  
 
if ( event.namespace ) {  
namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");  
}  
 
event.liveFired = this;  
 
var live = events.live.slice(0);  
 
for ( j = 0; j < live.length; j++ ) {  
handleObj = live[j];  
 
if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {  
selectors.push( handleObj.selector );  
 
} else {  
live.splice( j--, 1 );  
}  
}  
 
match = jQuery( event.target ).closest( selectors, event.currentTarget );  
 
for ( i = 0, l = match.length; i < l; i++ ) {  
close = match[i];  
 
for ( j = 0; j < live.length; j++ ) {  
handleObj = live[j];  
 
if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) {  
elem = close.elem;  
related = null;  
 
// Those two events require additional checking  
if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {  
event.type = handleObj.preType;  
related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];  
}  
 
if ( !related || related !== elem ) {  
elems.push({ elem: elem, handleObj: handleObj, level: close.level });  
}  
}  
}  
}  
 
for ( i = 0, l = elems.length; i < l; i++ ) {  
match = elems[i];  
 
if ( maxLevel && match.level > maxLevel ) {  
break;  
}  
 
event.currentTarget = match.elem;  
event.data = match.handleObj.data;  
event.handleObj = match.handleObj;  
 
ret = match.handleObj.origHandler.apply( match.elem, arguments );  
 
if ( ret === false || event.isPropagationStopped() ) {  
maxLevel = match.level;  
 
if ( ret === false ) {  
stop = false;  
}  
if ( event.isImmediatePropagationStopped() ) {  
break;  
}  
}  
}  
 
return stop;  
}  
 
function liveConvert( type, selector ) {  
return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");  
}  
 
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +  
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +  
"change select submit keydown keypress keyup error").split(" "), function( i, name ) {  
 
// Handle event binding  
jQuery.fn[ name ] = function( data, fn ) {  
if ( fn == null ) {  
fn = data;  
data = null;  
}  
 
return arguments.length > 0 ?  
this.bind( name, data, fn ) :  
this.trigger( name );  
};  
 
if ( jQuery.attrFn ) {  
jQuery.attrFn[ name ] = true;  
}  
});  
 
 
/*!  
* Sizzle CSS Selector Engine  
* Copyright 2011, The Dojo Foundation  
* Released under the MIT, BSD, and GPL Licenses.  
* More information: http://sizzlejs.com/  
*/  
(function(){  
 
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,  
done = 0,  
toString = Object.prototype.toString,  
hasDuplicate = false,  
baseHasDuplicate = true;  
 
// Here we check if the JavaScript engine is using some sort of  
// optimization where it does not always call our comparision  
// function. If that is the case, discard the hasDuplicate value.  
// Thus far that includes Google Chrome.  
[0, 0].sort(function() {  
baseHasDuplicate = false;  
return 0;  
});  
 
var Sizzle = function( selector, context, results, seed ) {  
results = results || [];  
context = context || document;  
 
var origContext = context;  
 
if ( context.nodeType !== 1 && context.nodeType !== 9 ) {  
return [];  
}  
 
if ( !selector || typeof selector !== "string" ) {  
return results;  
}  
 
var m, set, checkSet, extra, ret, cur, pop, i,  
prune = true,  
contextXML = Sizzle.isXML( context ),  
parts = [],  
soFar = selector;  
 
// Reset the position of the chunker regexp (start from head)  
do {  
chunker.exec( "" );  
m = chunker.exec( soFar );  
 
if ( m ) {  
soFar = m[3];  
 
parts.push( m[1] );  
 
if ( m[2] ) {  
extra = m[3];  
break;  
}  
}  
} while ( m );  
 
if ( parts.length > 1 && origPOS.exec( selector ) ) {  
 
if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {  
set = posProcess( parts[0] + parts[1], context );  
 
} else {  
set = Expr.relative[ parts[0] ] ?  
[ context ] :  
Sizzle( parts.shift(), context );  
 
while ( parts.length ) {  
selector = parts.shift();  
 
if ( Expr.relative[ selector ] ) {  
selector += parts.shift();  
}  
 
set = posProcess( selector, set );  
}  
}  
 
} else {  
// Take a shortcut and set the context if the root selector is an ID  
// (but not if it'll be faster if the inner selector is an ID)  
if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&  
Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {  
 
ret = Sizzle.find( parts.shift(), context, contextXML );  
context = ret.expr ?  
Sizzle.filter( ret.expr, ret.set )[0] :  
ret.set[0];  
}  
 
if ( context ) {  
ret = seed ?  
{ expr: parts.pop(), set: makeArray(seed) } :  
Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );  
 
set = ret.expr ?  
Sizzle.filter( ret.expr, ret.set ) :  
ret.set;  
 
if ( parts.length > 0 ) {  
checkSet = makeArray( set );  
 
} else {  
prune = false;  
}  
 
while ( parts.length ) {  
cur = parts.pop();  
pop = cur;  
 
if ( !Expr.relative[ cur ] ) {  
cur = "";  
} else {  
pop = parts.pop();  
}  
 
if ( pop == null ) {  
pop = context;  
}  
 
Expr.relative[ cur ]( checkSet, pop, contextXML );  
}  
 
} else {  
checkSet = parts = [];  
}  
}  
 
if ( !checkSet ) {  
checkSet = set;  
}  
 
if ( !checkSet ) {  
Sizzle.error( cur || selector );  
}  
 
if ( toString.call(checkSet) === "[object Array]" ) {  
if ( !prune ) {  
results.push.apply( results, checkSet );  
 
} else if ( context && context.nodeType === 1 ) {  
for ( i = 0; checkSet[i] != null; i++ ) {  
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {  
results.push( set[i] );  
}  
}  
 
} else {  
for ( i = 0; checkSet[i] != null; i++ ) {  
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {  
results.push( set[i] );  
}  
}  
}  
 
} else {  
makeArray( checkSet, results );  
}  
 
if ( extra ) {  
Sizzle( extra, origContext, results, seed );  
Sizzle.uniqueSort( results );  
}  
 
return results;  
};  
 
Sizzle.uniqueSort = function( results ) {  
if ( sortOrder ) {  
hasDuplicate = baseHasDuplicate;  
results.sort( sortOrder );  
 
if ( hasDuplicate ) {  
for ( var i = 1; i < results.length; i++ ) {  
if ( results[i] === results[ i - 1 ] ) {  
results.splice( i--, 1 );  
}  
}  
}  
}  
 
return results;  
};  
 
Sizzle.matches = function( expr, set ) {  
return Sizzle( expr, null, null, set );  
};  
 
Sizzle.matchesSelector = function( node, expr ) {  
return Sizzle( expr, null, null, [node] ).length > 0;  
};  
 
Sizzle.find = function( expr, context, isXML ) {  
var set;  
 
if ( !expr ) {  
return [];  
}  
 
for ( var i = 0, l = Expr.order.length; i < l; i++ ) {  
var match,  
type = Expr.order[i];  
 
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {  
var left = match[1];  
match.splice( 1, 1 );  
 
if ( left.substr( left.length - 1 ) !== "\\" ) {  
match[1] = (match[1] || "").replace(/\\/g, "");  
set = Expr.find[ type ]( match, context, isXML );  
 
if ( set != null ) {  
expr = expr.replace( Expr.match[ type ], "" );  
break;  
}  
}  
}  
}  
 
if ( !set ) {  
set = typeof context.getElementsByTagName !== "undefined" ?  
context.getElementsByTagName( "*" ) :  
[];  
}  
 
return { set: set, expr: expr };  
};  
 
Sizzle.filter = function( expr, set, inplace, not ) {  
var match, anyFound,  
old = expr,  
result = [],  
curLoop = set,  
isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );  
 
while ( expr && set.length ) {  
for ( var type in Expr.filter ) {  
if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {  
var found, item,  
filter = Expr.filter[ type ],  
left = match[1];  
 
anyFound = false;  
 
match.splice(1,1);  
 
if ( left.substr( left.length - 1 ) === "\\" ) {  
continue;  
}  
 
if ( curLoop === result ) {  
result = [];  
}  
 
if ( Expr.preFilter[ type ] ) {  
match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );  
 
if ( !match ) {  
anyFound = found = true;  
 
} else if ( match === true ) {  
continue;  
}  
}  
 
if ( match ) {  
for ( var i = 0; (item = curLoop[i]) != null; i++ ) {  
if ( item ) {  
found = filter( item, match, i, curLoop );  
var pass = not ^ !!found;  
 
if ( inplace && found != null ) {  
if ( pass ) {  
anyFound = true;  
 
} else {  
curLoop[i] = false;  
}  
 
} else if ( pass ) {  
result.push( item );  
anyFound = true;  
}  
}  
}  
}  
 
if ( found !== undefined ) {  
if ( !inplace ) {  
curLoop = result;  
}  
 
expr = expr.replace( Expr.match[ type ], "" );  
 
if ( !anyFound ) {  
return [];  
}  
 
break;  
}  
}  
}  
 
// Improper expression  
if ( expr === old ) {  
if ( anyFound == null ) {  
Sizzle.error( expr );  
 
} else {  
break;  
}  
}  
 
old = expr;  
}  
 
return curLoop;  
};  
 
Sizzle.error = function( msg ) {  
throw "Syntax error, unrecognized expression: " + msg;  
};  
 
var Expr = Sizzle.selectors = {  
order: [ "ID", "NAME", "TAG" ],  
 
match: {  
ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,  
CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,  
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,  
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,  
TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,  
CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,  
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,  
PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/  
},  
 
leftMatch: {},  
 
attrMap: {  
"class": "className",  
"for": "htmlFor"  
},  
 
attrHandle: {  
href: function( elem ) {  
return elem.getAttribute( "href" );  
}  
},  
 
relative: {  
"+": function(checkSet, part){  
var isPartStr = typeof part === "string",  
isTag = isPartStr && !/\W/.test( part ),  
isPartStrNotTag = isPartStr && !isTag;  
 
if ( isTag ) {  
part = part.toLowerCase();  
}  
 
for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {  
if ( (elem = checkSet[i]) ) {  
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}  
 
checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?  
elem || false :  
elem === part;  
}  
}  
 
if ( isPartStrNotTag ) {  
Sizzle.filter( part, checkSet, true );  
}  
},  
 
">": function( checkSet, part ) {  
var elem,  
isPartStr = typeof part === "string",  
i = 0,  
l = checkSet.length;  
 
if ( isPartStr && !/\W/.test( part ) ) {  
part = part.toLowerCase();  
 
for ( ; i < l; i++ ) {  
elem = checkSet[i];  
 
if ( elem ) {  
var parent = elem.parentNode;  
checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;  
}  
}  
 
} else {  
for ( ; i < l; i++ ) {  
elem = checkSet[i];  
 
if ( elem ) {  
checkSet[i] = isPartStr ?  
elem.parentNode :  
elem.parentNode === part;  
}  
}  
 
if ( isPartStr ) {  
Sizzle.filter( part, checkSet, true );  
}  
}  
},  
 
"": function(checkSet, part, isXML){  
var nodeCheck,  
doneName = done++,  
checkFn = dirCheck;  
 
if ( typeof part === "string" && !/\W/.test(part) ) {  
part = part.toLowerCase();  
nodeCheck = part;  
checkFn = dirNodeCheck;  
}  
 
checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );  
},  
 
"~": function( checkSet, part, isXML ) {  
var nodeCheck,  
doneName = done++,  
checkFn = dirCheck;  
 
if ( typeof part === "string" && !/\W/.test( part ) ) {  
part = part.toLowerCase();  
nodeCheck = part;  
checkFn = dirNodeCheck;  
}  
 
checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );  
}  
},  
 
find: {  
ID: function( match, context, isXML ) {  
if ( typeof context.getElementById !== "undefined" && !isXML ) {  
var m = context.getElementById(match[1]);  
// Check parentNode to catch when Blackberry 4.6 returns  
// nodes that are no longer in the document #6963  
return m && m.parentNode ? [m] : [];  
}  
},  
 
NAME: function( match, context ) {  
if ( typeof context.getElementsByName !== "undefined" ) {  
var ret = [],  
results = context.getElementsByName( match[1] );  
 
for ( var i = 0, l = results.length; i < l; i++ ) {  
if ( results[i].getAttribute("name") === match[1] ) {  
ret.push( results[i] );  
}  
}  
 
return ret.length === 0 ? null : ret;  
}  
},  
 
TAG: function( match, context ) {  
if ( typeof context.getElementsByTagName !== "undefined" ) {  
return context.getElementsByTagName( match[1] );  
}  
}  
},  
preFilter: {  
CLASS: function( match, curLoop, inplace, result, not, isXML ) {  
match = " " + match[1].replace(/\\/g, "") + " ";  
 
if ( isXML ) {  
return match;  
}  
 
for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {  
if ( elem ) {  
if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {  
if ( !inplace ) {  
result.push( elem );  
}  
 
} else if ( inplace ) {  
curLoop[i] = false;  
}  
}  
}  
 
return false;  
},  
 
ID: function( match ) {  
return match[1].replace(/\\/g, "");  
},  
 
TAG: function( match, curLoop ) {  
return match[1].toLowerCase();  
},  
 
CHILD: function( match ) {  
if ( match[1] === "nth" ) {  
if ( !match[2] ) {  
Sizzle.error( match[0] );  
}  
 
match[2] = match[2].replace(/^\+|\s*/g, '');  
 
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'  
var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(  
match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||  
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);  
 
// calculate the numbers (first)n+(last) including if they are negative  
match[2] = (test[1] + (test[2] || 1)) - 0;  
match[3] = test[3] - 0;  
}  
else if ( match[2] ) {  
Sizzle.error( match[0] );  
}  
 
// TODO: Move to normal caching system  
match[0] = done++;  
 
return match;  
},  
 
ATTR: function( match, curLoop, inplace, result, not, isXML ) {  
var name = match[1] = match[1].replace(/\\/g, "");  
 
if ( !isXML && Expr.attrMap[name] ) {  
match[1] = Expr.attrMap[name];  
}  
 
// Handle if an un-quoted value was used  
match[4] = ( match[4] || match[5] || "" ).replace(/\\/g, "");  
 
if ( match[2] === "~=" ) {  
match[4] = " " + match[4] + " ";  
}  
 
return match;  
},  
 
PSEUDO: function( match, curLoop, inplace, result, not ) {  
if ( match[1] === "not" ) {  
// If we're dealing with a complex expression, or a simple one  
if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {  
match[3] = Sizzle(match[3], null, null, curLoop);  
 
} else {  
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);  
 
if ( !inplace ) {  
result.push.apply( result, ret );  
}  
 
return false;  
}  
 
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {  
return true;  
}  
 
return match;  
},  
 
POS: function( match ) {  
match.unshift( true );  
 
return match;  
}  
},  
 
filters: {  
enabled: function( elem ) {  
return elem.disabled === false && elem.type !== "hidden";  
},  
 
disabled: function( elem ) {  
return elem.disabled === true;  
},  
 
checked: function( elem ) {  
return elem.checked === true;  
},  
 
selected: function( elem ) {  
// Accessing this property makes selected-by-default  
// options in Safari work properly  
elem.parentNode.selectedIndex;  
 
return elem.selected === true;  
},  
 
parent: function( elem ) {  
return !!elem.firstChild;  
},  
 
empty: function( elem ) {  
return !elem.firstChild;  
},  
 
has: function( elem, i, match ) {  
return !!Sizzle( match[3], elem ).length;  
},  
 
header: function( elem ) {  
return (/h\d/i).test( elem.nodeName );  
},  
 
text: function( elem ) {  
return "text" === elem.type;  
},  
radio: function( elem ) {  
return "radio" === elem.type;  
},  
 
checkbox: function( elem ) {  
return "checkbox" === elem.type;  
},  
 
file: function( elem ) {  
return "file" === elem.type;  
},  
password: function( elem ) {  
return "password" === elem.type;  
},  
 
submit: function( elem ) {  
return "submit" === elem.type;  
},  
 
image: function( elem ) {  
return "image" === elem.type;  
},  
 
reset: function( elem ) {  
return "reset" === elem.type;  
},  
 
button: function( elem ) {  
return "button" === elem.type || elem.nodeName.toLowerCase() === "button";  
},  
 
input: function( elem ) {  
return (/input|select|textarea|button/i).test( elem.nodeName );  
}  
},  
setFilters: {  
first: function( elem, i ) {  
return i === 0;  
},  
 
last: function( elem, i, match, array ) {  
return i === array.length - 1;  
},  
 
even: function( elem, i ) {  
return i % 2 === 0;  
},  
 
odd: function( elem, i ) {  
return i % 2 === 1;  
},  
 
lt: function( elem, i, match ) {  
return i < match[3] - 0;  
},  
 
gt: function( elem, i, match ) {  
return i > match[3] - 0;  
},  
 
nth: function( elem, i, match ) {  
return match[3] - 0 === i;  
},  
 
eq: function( elem, i, match ) {  
return match[3] - 0 === i;  
}  
},  
filter: {  
PSEUDO: function( elem, match, i, array ) {  
var name = match[1],  
filter = Expr.filters[ name ];  
 
if ( filter ) {  
return filter( elem, i, match, array );  
 
} else if ( name === "contains" ) {  
return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;  
 
} else if ( name === "not" ) {  
var not = match[3];  
 
for ( var j = 0, l = not.length; j < l; j++ ) {  
if ( not[j] === elem ) {  
return false;  
}  
}  
 
return true;  
 
} else {  
Sizzle.error( name );  
}  
},  
 
CHILD: function( elem, match ) {  
var type = match[1],  
node = elem;  
 
switch ( type ) {  
case "only":  
case "first":  
while ( (node = node.previousSibling) ) {  
if ( node.nodeType === 1 ) {  
return false;  
}  
}  
 
if ( type === "first" ) {  
return true;  
}  
 
node = elem;  
 
case "last":  
while ( (node = node.nextSibling) ) {  
if ( node.nodeType === 1 ) {  
return false;  
}  
}  
 
return true;  
 
case "nth":  
var first = match[2],  
last = match[3];  
 
if ( first === 1 && last === 0 ) {  
return true;  
}  
 
var doneName = match[0],  
parent = elem.parentNode;  
 
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {  
var count = 0;  
 
for ( node = parent.firstChild; node; node = node.nextSibling ) {  
if ( node.nodeType === 1 ) {  
node.nodeIndex = ++count;  
}  
}  
 
parent.sizcache = doneName;  
}  
 
var diff = elem.nodeIndex - last;  
 
if ( first === 0 ) {  
return diff === 0;  
 
} else {  
return ( diff % first === 0 && diff / first >= 0 );  
}  
}  
},  
 
ID: function( elem, match ) {  
return elem.nodeType === 1 && elem.getAttribute("id") === match;  
},  
 
TAG: function( elem, match ) {  
return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;  
},  
 
CLASS: function( elem, match ) {  
return (" " + (elem.className || elem.getAttribute("class")) + " ")  
.indexOf( match ) > -1;  
},  
 
ATTR: function( elem, match ) {  
var name = match[1],  
result = Expr.attrHandle[ name ] ?  
Expr.attrHandle[ name ]( elem ) :  
elem[ name ] != null ?  
elem[ name ] :  
elem.getAttribute( name ),  
value = result + "",  
type = match[2],  
check = match[4];  
 
return result == null ?  
type === "!=" :  
type === "=" ?  
value === check :  
type === "*=" ?  
value.indexOf(check) >= 0 :  
type === "~=" ?  
(" " + value + " ").indexOf(check) >= 0 :  
!check ?  
value && result !== false :  
type === "!=" ?  
value !== check :  
type === "^=" ?  
value.indexOf(check) === 0 :  
type === "$=" ?  
value.substr(value.length - check.length) === check :  
type === "|=" ?  
value === check || value.substr(0, check.length + 1) === check + "-" :  
false;  
},  
 
POS: function( elem, match, i, array ) {  
var name = match[2],  
filter = Expr.setFilters[ name ];  
 
if ( filter ) {  
return filter( elem, i, match, array );  
}  
}  
}  
};  
 
var origPOS = Expr.match.POS,  
fescape = function(all, num){  
return "\\" + (num - 0 + 1);  
};  
 
for ( var type in Expr.match ) {  
Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );  
Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );  
}  
 
var makeArray = function( array, results ) {  
array = Array.prototype.slice.call( array, 0 );  
 
if ( results ) {  
results.push.apply( results, array );  
return results;  
}  
 
return array;  
};  
 
// Perform a simple check to determine if the browser is capable of  
// converting a NodeList to an array using builtin methods.  
// Also verifies that the returned array holds DOM nodes  
// (which is not the case in the Blackberry browser)  
try {  
Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;  
 
// Provide a fallback method if it does not work  
} catch( e ) {  
makeArray = function( array, results ) {  
var i = 0,  
ret = results || [];  
 
if ( toString.call(array) === "[object Array]" ) {  
Array.prototype.push.apply( ret, array );  
 
} else {  
if ( typeof array.length === "number" ) {  
for ( var l = array.length; i < l; i++ ) {  
ret.push( array[i] );  
}  
 
} else {  
for ( ; array[i]; i++ ) {  
ret.push( array[i] );  
}  
}  
}  
 
return ret;  
};  
}  
 
var sortOrder, siblingCheck;  
 
if ( document.documentElement.compareDocumentPosition ) {  
sortOrder = function( a, b ) {  
if ( a === b ) {  
hasDuplicate = true;  
return 0;  
}  
 
if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {  
return a.compareDocumentPosition ? -1 : 1;  
}  
 
return a.compareDocumentPosition(b) & 4 ? -1 : 1;  
};  
 
} else {  
sortOrder = function( a, b ) {  
var al, bl,  
ap = [],  
bp = [],  
aup = a.parentNode,  
bup = b.parentNode,  
cur = aup;  
 
// The nodes are identical, we can exit early  
if ( a === b ) {  
hasDuplicate = true;  
return 0;  
 
// If the nodes are siblings (or identical) we can do a quick check  
} else if ( aup === bup ) {  
return siblingCheck( a, b );  
 
// If no parents were found then the nodes are disconnected  
} else if ( !aup ) {  
return -1;  
 
} else if ( !bup ) {  
return 1;  
}  
 
// Otherwise they're somewhere else in the tree so we need  
// to build up a full list of the parentNodes for comparison  
while ( cur ) {  
ap.unshift( cur );  
cur = cur.parentNode;  
}  
 
cur = bup;  
 
while ( cur ) {  
bp.unshift( cur );  
cur = cur.parentNode;  
}  
 
al = ap.length;  
bl = bp.length;  
 
// Start walking down the tree looking for a discrepancy  
for ( var i = 0; i < al && i < bl; i++ ) {  
if ( ap[i] !== bp[i] ) {  
return siblingCheck( ap[i], bp[i] );  
}  
}  
 
// We ended someplace up the tree so do a sibling check  
return i === al ?  
siblingCheck( a, bp[i], -1 ) :  
siblingCheck( ap[i], b, 1 );  
};  
 
siblingCheck = function( a, b, ret ) {  
if ( a === b ) {  
return ret;  
}  
 
var cur = a.nextSibling;  
 
while ( cur ) {  
if ( cur === b ) {  
return -1;  
}  
 
cur = cur.nextSibling;  
}  
 
return 1;  
};  
}  
 
// Utility function for retreiving the text value of an array of DOM nodes  
Sizzle.getText = function( elems ) {  
var ret = "", elem;  
 
for ( var i = 0; elems[i]; i++ ) {  
elem = elems[i];  
 
// Get the text from text nodes and CDATA nodes  
if ( elem.nodeType === 3 || elem.nodeType === 4 ) {  
ret += elem.nodeValue;  
 
// Traverse everything else, except comment nodes  
} else if ( elem.nodeType !== 8 ) {  
ret += Sizzle.getText( elem.childNodes );  
}  
}  
 
return ret;  
};  
 
// Check to see if the browser returns elements by name when  
// querying by getElementById (and provide a workaround)  
(function(){  
// We're going to inject a fake input element with a specified name  
var form = document.createElement("div"),  
id = "script" + (new Date()).getTime(),  
root = document.documentElement;  
 
form.innerHTML = "<a name='" + id + "'/>";  
 
// Inject it into the root element, check its status, and remove it quickly  
root.insertBefore( form, root.firstChild );  
 
// The workaround has to do additional checks after a getElementById  
// Which slows things down for other browsers (hence the branching)  
if ( document.getElementById( id ) ) {  
Expr.find.ID = function( match, context, isXML ) {  
if ( typeof context.getElementById !== "undefined" && !isXML ) {  
var m = context.getElementById(match[1]);  
 
return m ?  
m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?  
[m] :  
undefined :  
[];  
}  
};  
 
Expr.filter.ID = function( elem, match ) {  
var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");  
 
return elem.nodeType === 1 && node && node.nodeValue === match;  
};  
}  
 
root.removeChild( form );  
 
// release memory in IE  
root = form = null;  
})();  
 
(function(){  
// Check to see if the browser returns only elements  
// when doing getElementsByTagName("*")  
 
// Create a fake element  
var div = document.createElement("div");  
div.appendChild( document.createComment("") );  
 
// Make sure no comments are found  
if ( div.getElementsByTagName("*").length > 0 ) {  
Expr.find.TAG = function( match, context ) {  
var results = context.getElementsByTagName( match[1] );  
 
// Filter out possible comments  
if ( match[1] === "*" ) {  
var tmp = [];  
 
for ( var i = 0; results[i]; i++ ) {  
if ( results[i].nodeType === 1 ) {  
tmp.push( results[i] );  
}  
}  
 
results = tmp;  
}  
 
return results;  
};  
}  
 
// Check to see if an attribute returns normalized href attributes  
div.innerHTML = "<a href='#'></a>";  
 
if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&  
div.firstChild.getAttribute("href") !== "#" ) {  
 
Expr.attrHandle.href = function( elem ) {  
return elem.getAttribute( "href", 2 );  
};  
}  
 
// release memory in IE  
div = null;  
})();  
 
if ( document.querySelectorAll ) {  
(function(){  
var oldSizzle = Sizzle,  
div = document.createElement("div"),  
id = "__sizzle__";  
 
div.innerHTML = "<p class='TEST'></p>";  
 
// Safari can't handle uppercase or unicode characters when  
// in quirks mode.  
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {  
return;  
}  
 
Sizzle = function( query, context, extra, seed ) {  
context = context || document;  
 
// Only use querySelectorAll on non-XML documents  
// (ID selectors don't work in non-HTML documents)  
if ( !seed && !Sizzle.isXML(context) ) {  
// See if we find a selector to speed up  
var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );  
 
if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {  
// Speed-up: Sizzle("TAG")  
if ( match[1] ) {  
return makeArray( context.getElementsByTagName( query ), extra );  
 
// Speed-up: Sizzle(".CLASS")  
} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {  
return makeArray( context.getElementsByClassName( match[2] ), extra );  
}  
}  
 
if ( context.nodeType === 9 ) {  
// Speed-up: Sizzle("body")  
// The body element only exists once, optimize finding it  
if ( query === "body" && context.body ) {  
return makeArray( [ context.body ], extra );  
 
// Speed-up: Sizzle("#ID")  
} else if ( match && match[3] ) {  
var elem = context.getElementById( match[3] );  
 
// Check parentNode to catch when Blackberry 4.6 returns  
// nodes that are no longer in the document #6963  
if ( elem && elem.parentNode ) {  
// Handle the case where IE and Opera return items  
// by name instead of ID  
if ( elem.id === match[3] ) {  
return makeArray( [ elem ], extra );  
}  
 
} else {  
return makeArray( [], extra );  
}  
}  
 
try {  
return makeArray( context.querySelectorAll(query), extra );  
} catch(qsaError) {}  
 
// qSA works strangely on Element-rooted queries  
// We can work around this by specifying an extra ID on the root  
// and working up from there (Thanks to Andrew Dupont for the technique)  
// IE 8 doesn't work on object elements  
} else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {  
var old = context.getAttribute( "id" ),  
nid = old || id,  
hasParent = context.parentNode,  
relativeHierarchySelector = /^\s*[+~]/.test( query );  
 
if ( !old ) {  
context.setAttribute( "id", nid );  
} else {  
nid = nid.replace( /'/g, "\\$&" );  
}  
if ( relativeHierarchySelector && hasParent ) {  
context = context.parentNode;  
}  
 
try {  
if ( !relativeHierarchySelector || hasParent ) {  
return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );  
}  
 
} catch(pseudoError) {  
} finally {  
if ( !old ) {  
context.removeAttribute( "id" );  
}  
}  
}  
}  
 
return oldSizzle(query, context, extra, seed);  
};  
 
for ( var prop in oldSizzle ) {  
Sizzle[ prop ] = oldSizzle[ prop ];  
}  
 
// release memory in IE  
div = null;  
})();  
}  
 
(function(){  
var html = document.documentElement,  
matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,  
pseudoWorks = false;  
 
try {  
// This should fail with an exception  
// Gecko does not error, returns false instead  
matches.call( document.documentElement, "[test!='']:sizzle" );  
 
} catch( pseudoError ) {  
pseudoWorks = true;  
}  
 
if ( matches ) {  
Sizzle.matchesSelector = function( node, expr ) {  
// Make sure that attribute selectors are quoted  
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");  
 
if ( !Sizzle.isXML( node ) ) {  
try {  
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {  
return matches.call( node, expr );  
}  
} catch(e) {}  
}  
 
return Sizzle(expr, null, null, [node]).length > 0;  
};  
}  
})();  
 
(function(){  
var div = document.createElement("div");  
 
div.innerHTML = "<div class='test e'></div><div class='test'></div>";  
 
// Opera can't find a second classname (in 9.6)  
// Also, make sure that getElementsByClassName actually exists  
if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {  
return;  
}  
 
// Safari caches class attributes, doesn't catch changes (in 3.2)  
div.lastChild.className = "e";  
 
if ( div.getElementsByClassName("e").length === 1 ) {  
return;  
}  
 
Expr.order.splice(1, 0, "CLASS");  
Expr.find.CLASS = function( match, context, isXML ) {  
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {  
return context.getElementsByClassName(match[1]);  
}  
};  
 
// release memory in IE  
div = null;  
})();  
 
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {  
for ( var i = 0, l = checkSet.length; i < l; i++ ) {  
var elem = checkSet[i];  
 
if ( elem ) {  
var match = false;  
 
elem = elem[dir];  
 
while ( elem ) {  
if ( elem.sizcache === doneName ) {  
match = checkSet[elem.sizset];  
break;  
}  
 
if ( elem.nodeType === 1 && !isXML ){  
elem.sizcache = doneName;  
elem.sizset = i;  
}  
 
if ( elem.nodeName.toLowerCase() === cur ) {  
match = elem;  
break;  
}  
 
elem = elem[dir];  
}  
 
checkSet[i] = match;  
}  
}  
}  
 
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {  
for ( var i = 0, l = checkSet.length; i < l; i++ ) {  
var elem = checkSet[i];  
 
if ( elem ) {  
var match = false;  
 
elem = elem[dir];  
 
while ( elem ) {  
if ( elem.sizcache === doneName ) {  
match = checkSet[elem.sizset];  
break;  
}  
 
if ( elem.nodeType === 1 ) {  
if ( !isXML ) {  
elem.sizcache = doneName;  
elem.sizset = i;  
}  
 
if ( typeof cur !== "string" ) {  
if ( elem === cur ) {  
match = true;  
break;  
}  
 
} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {  
match = elem;  
break;  
}  
}  
 
elem = elem[dir];  
}  
 
checkSet[i] = match;  
}  
}  
}  
 
if ( document.documentElement.contains ) {  
Sizzle.contains = function( a, b ) {  
return a !== b && (a.contains ? a.contains(b) : true);  
};  
 
} else if ( document.documentElement.compareDocumentPosition ) {  
Sizzle.contains = function( a, b ) {  
return !!(a.compareDocumentPosition(b) & 16);  
};  
 
} else {  
Sizzle.contains = function() {  
return false;  
};  
}  
 
Sizzle.isXML = function( elem ) {  
// documentElement is verified for cases where it doesn't yet exist  
// (such as loading iframes in IE - #4833)  
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;  
 
return documentElement ? documentElement.nodeName !== "HTML" : false;  
};  
 
var posProcess = function( selector, context ) {  
var match,  
tmpSet = [],  
later = "",  
root = context.nodeType ? [context] : context;  
 
// Position selectors must be done after the filter  
// And so must :not(positional) so we move all PSEUDOs to the end  
while ( (match = Expr.match.PSEUDO.exec( selector )) ) {  
later += match[0];  
selector = selector.replace( Expr.match.PSEUDO, "" );  
}  
 
selector = Expr.relative[selector] ? selector + "*" : selector;  
 
for ( var i = 0, l = root.length; i < l; i++ ) {  
Sizzle( selector, root[i], tmpSet );  
}  
 
return Sizzle.filter( later, tmpSet );  
};  
 
// EXPOSE  
jQuery.find = Sizzle;  
jQuery.expr = Sizzle.selectors;  
jQuery.expr[":"] = jQuery.expr.filters;  
jQuery.unique = Sizzle.uniqueSort;  
jQuery.text = Sizzle.getText;  
jQuery.isXMLDoc = Sizzle.isXML;  
jQuery.contains = Sizzle.contains;  
 
 
})();  
 
 
var runtil = /Until$/,  
rparentsprev = /^(?:parents|prevUntil|prevAll)/,  
// Note: This RegExp should be improved, or likely pulled from Sizzle  
rmultiselector = /,/,  
isSimple = /^.[^:#\[\.,]*$/,  
slice = Array.prototype.slice,  
POS = jQuery.expr.match.POS,  
// methods guaranteed to produce a unique set when starting from a unique set  
guaranteedUnique = {  
children: true,  
contents: true,  
next: true,  
prev: true  
};  
 
jQuery.fn.extend({  
find: function( selector ) {  
var ret = this.pushStack( "", "find", selector ),  
length = 0;  
 
for ( var i = 0, l = this.length; i < l; i++ ) {  
length = ret.length;  
jQuery.find( selector, this[i], ret );  
 
if ( i > 0 ) {  
// Make sure that the results are unique  
for ( var n = length; n < ret.length; n++ ) {  
for ( var r = 0; r < length; r++ ) {  
if ( ret[r] === ret[n] ) {  
ret.splice(n--, 1);  
break;  
}  
}  
}  
}  
}  
 
return ret;  
},  
 
has: function( target ) {  
var targets = jQuery( target );  
return this.filter(function() {  
for ( var i = 0, l = targets.length; i < l; i++ ) {  
if ( jQuery.contains( this, targets[i] ) ) {  
return true;  
}  
}  
});  
},  
 
not: function( selector ) {  
return this.pushStack( winnow(this, selector, false), "not", selector);  
},  
 
filter: function( selector ) {  
return this.pushStack( winnow(this, selector, true), "filter", selector );  
},  
 
is: function( selector ) {  
return !!selector && jQuery.filter( selector, this ).length > 0;  
},  
 
closest: function( selectors, context ) {  
var ret = [], i, l, cur = this[0];  
 
if ( jQuery.isArray( selectors ) ) {  
var match, selector,  
matches = {},  
level = 1;  
 
if ( cur && selectors.length ) {  
for ( i = 0, l = selectors.length; i < l; i++ ) {  
selector = selectors[i];  
 
if ( !matches[selector] ) {  
matches[selector] = jQuery.expr.match.POS.test( selector ) ?  
jQuery( selector, context || this.context ) :  
selector;  
}  
}  
 
while ( cur && cur.ownerDocument && cur !== context ) {  
for ( selector in matches ) {  
match = matches[selector];  
 
if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {  
ret.push({ selector: selector, elem: cur, level: level });  
}  
}  
 
cur = cur.parentNode;  
level++;  
}  
}  
 
return ret;  
}  
 
var pos = POS.test( selectors ) ?  
jQuery( selectors, context || this.context ) : null;  
 
for ( i = 0, l = this.length; i < l; i++ ) {  
cur = this[i];  
 
while ( cur ) {  
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {  
ret.push( cur );  
break;  
 
} else {  
cur = cur.parentNode;  
if ( !cur || !cur.ownerDocument || cur === context ) {  
break;  
}  
}  
}  
}  
 
ret = ret.length > 1 ? jQuery.unique(ret) : ret;  
 
return this.pushStack( ret, "closest", selectors );  
},  
 
// Determine the position of an element within  
// the matched set of elements  
index: function( elem ) {  
if ( !elem || typeof elem === "string" ) {  
return jQuery.inArray( this[0],  
// If it receives a string, the selector is used  
// If it receives nothing, the siblings are used  
elem ? jQuery( elem ) : this.parent().children() );  
}  
// Locate the position of the desired element  
return jQuery.inArray(  
// If it receives a jQuery object, the first element is used  
elem.jquery ? elem[0] : elem, this );  
},  
 
add: function( selector, context ) {  
var set = typeof selector === "string" ?  
jQuery( selector, context ) :  
jQuery.makeArray( selector ),  
all = jQuery.merge( this.get(), set );  
 
return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?  
all :  
jQuery.unique( all ) );  
},  
 
andSelf: function() {  
return this.add( this.prevObject );  
}  
});  
 
// A painfully simple check to see if an element is disconnected  
// from a document (should be improved, where feasible).  
function isDisconnected( node ) {  
return !node || !node.parentNode || node.parentNode.nodeType === 11;  
}  
 
jQuery.each({  
parent: function( elem ) {  
var parent = elem.parentNode;  
return parent && parent.nodeType !== 11 ? parent : null;  
},  
parents: function( elem ) {  
return jQuery.dir( elem, "parentNode" );  
},  
parentsUntil: function( elem, i, until ) {  
return jQuery.dir( elem, "parentNode", until );  
},  
next: function( elem ) {  
return jQuery.nth( elem, 2, "nextSibling" );  
},  
prev: function( elem ) {  
return jQuery.nth( elem, 2, "previousSibling" );  
},  
nextAll: function( elem ) {  
return jQuery.dir( elem, "nextSibling" );  
},  
prevAll: function( elem ) {  
return jQuery.dir( elem, "previousSibling" );  
},  
nextUntil: function( elem, i, until ) {  
return jQuery.dir( elem, "nextSibling", until );  
},  
prevUntil: function( elem, i, until ) {  
return jQuery.dir( elem, "previousSibling", until );  
},  
siblings: function( elem ) {  
return jQuery.sibling( elem.parentNode.firstChild, elem );  
},  
children: function( elem ) {  
return jQuery.sibling( elem.firstChild );  
},  
contents: function( elem ) {  
return jQuery.nodeName( elem, "iframe" ) ?  
elem.contentDocument || elem.contentWindow.document :  
jQuery.makeArray( elem.childNodes );  
}  
}, function( name, fn ) {  
jQuery.fn[ name ] = function( until, selector ) {  
var ret = jQuery.map( this, fn, until ),  
// The variable 'args' was introduced in  
// https://github.com/jquery/jquery/commit/52a0238  
// to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.  
// http://code.google.com/p/v8/issues/detail?id=1050  
args = slice.call(arguments);  
 
if ( !runtil.test( name ) ) {  
selector = until;  
}  
 
if ( selector && typeof selector === "string" ) {  
ret = jQuery.filter( selector, ret );  
}  
 
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;  
 
if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {  
ret = ret.reverse();  
}  
 
return this.pushStack( ret, name, args.join(",") );  
};  
});  
 
jQuery.extend({  
filter: function( expr, elems, not ) {  
if ( not ) {  
expr = ":not(" + expr + ")";  
}  
 
return elems.length === 1 ?  
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :  
jQuery.find.matches(expr, elems);  
},  
 
dir: function( elem, dir, until ) {  
var matched = [],  
cur = elem[ dir ];  
 
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {  
if ( cur.nodeType === 1 ) {  
matched.push( cur );  
}  
cur = cur[dir];  
}  
return matched;  
},  
 
nth: function( cur, result, dir, elem ) {  
result = result || 1;  
var num = 0;  
 
for ( ; cur; cur = cur[dir] ) {  
if ( cur.nodeType === 1 && ++num === result ) {  
break;  
}  
}  
 
return cur;  
},  
 
sibling: function( n, elem ) {  
var r = [];  
 
for ( ; n; n = n.nextSibling ) {  
if ( n.nodeType === 1 && n !== elem ) {  
r.push( n );  
}  
}  
 
return r;  
}  
});  
 
// Implement the identical functionality for filter and not  
function winnow( elements, qualifier, keep ) {  
if ( jQuery.isFunction( qualifier ) ) {  
return jQuery.grep(elements, function( elem, i ) {  
var retVal = !!qualifier.call( elem, i, elem );  
return retVal === keep;  
});  
 
} else if ( qualifier.nodeType ) {  
return jQuery.grep(elements, function( elem, i ) {  
return (elem === qualifier) === keep;  
});  
 
} else if ( typeof qualifier === "string" ) {  
var filtered = jQuery.grep(elements, function( elem ) {  
return elem.nodeType === 1;  
});  
 
if ( isSimple.test( qualifier ) ) {  
return jQuery.filter(qualifier, filtered, !keep);  
} else {  
qualifier = jQuery.filter( qualifier, filtered );  
}  
}  
 
return jQuery.grep(elements, function( elem, i ) {  
return (jQuery.inArray( elem, qualifier ) >= 0) === keep;  
});  
}  
 
 
 
 
var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,  
rleadingWhitespace = /^\s+/,  
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,  
rtagName = /<([\w:]+)/,  
rtbody = /<tbody/i,  
rhtml = /<|&#?\w+;/,  
rnocache = /<(?:script|object|embed|option|style)/i,  
// checked="checked" or checked (html5)  
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,  
wrapMap = {  
option: [ 1, "<select multiple='multiple'>", "</select>" ],  
legend: [ 1, "<fieldset>", "</fieldset>" ],  
thead: [ 1, "<table>", "</table>" ],  
tr: [ 2, "<table><tbody>", "</tbody></table>" ],  
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],  
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],  
area: [ 1, "<map>", "</map>" ],  
_default: [ 0, "", "" ]  
};  
 
wrapMap.optgroup = wrapMap.option;  
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;  
wrapMap.th = wrapMap.td;  
 
// IE can't serialize <link> and <script> tags normally  
if ( !jQuery.support.htmlSerialize ) {  
wrapMap._default = [ 1, "div<div>", "</div>" ];  
}  
 
jQuery.fn.extend({  
text: function( text ) {  
if ( jQuery.isFunction(text) ) {  
return this.each(function(i) {  
var self = jQuery( this );  
 
self.text( text.call(this, i, self.text()) );  
});  
}  
 
if ( typeof text !== "object" && text !== undefined ) {  
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );  
}  
 
return jQuery.text( this );  
},  
 
wrapAll: function( html ) {  
if ( jQuery.isFunction( html ) ) {  
return this.each(function(i) {  
jQuery(this).wrapAll( html.call(this, i) );  
});  
}  
 
if ( this[0] ) {  
// The elements to wrap the target around  
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);  
 
if ( this[0].parentNode ) {  
wrap.insertBefore( this[0] );  
}  
 
wrap.map(function() {  
var elem = this;  
 
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {  
elem = elem.firstChild;  
}  
 
return elem;  
}).append(this);  
}  
 
return this;  
},  
 
wrapInner: function( html ) {  
if ( jQuery.isFunction( html ) ) {  
return this.each(function(i) {  
jQuery(this).wrapInner( html.call(this, i) );  
});  
}  
 
return this.each(function() {  
var self = jQuery( this ),  
contents = self.contents();  
 
if ( contents.length ) {  
contents.wrapAll( html );  
 
} else {  
self.append( html );  
}  
});  
},  
 
wrap: function( html ) {  
return this.each(function() {  
jQuery( this ).wrapAll( html );  
});  
},  
 
unwrap: function() {  
return this.parent().each(function() {  
if ( !jQuery.nodeName( this, "body" ) ) {  
jQuery( this ).replaceWith( this.childNodes );  
}  
}).end();  
},  
 
append: function() {  
return this.domManip(arguments, true, function( elem ) {  
if ( this.nodeType === 1 ) {  
this.appendChild( elem );  
}  
});  
},  
 
prepend: function() {  
return this.domManip(arguments, true, function( elem ) {  
if ( this.nodeType === 1 ) {  
this.insertBefore( elem, this.firstChild );  
}  
});  
},  
 
before: function() {  
if ( this[0] && this[0].parentNode ) {  
return this.domManip(arguments, false, function( elem ) {  
this.parentNode.insertBefore( elem, this );  
});  
} else if ( arguments.length ) {  
var set = jQuery(arguments[0]);  
set.push.apply( set, this.toArray() );  
return this.pushStack( set, "before", arguments );  
}  
},  
 
after: function() {  
if ( this[0] && this[0].parentNode ) {  
return this.domManip(arguments, false, function( elem ) {  
this.parentNode.insertBefore( elem, this.nextSibling );  
});  
} else if ( arguments.length ) {  
var set = this.pushStack( this, "after", arguments );  
set.push.apply( set, jQuery(arguments[0]).toArray() );  
return set;  
}  
},  
 
// keepData is for internal use only--do not document  
remove: function( selector, keepData ) {  
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {  
if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {  
if ( !keepData && elem.nodeType === 1 ) {  
jQuery.cleanData( elem.getElementsByTagName("*") );  
jQuery.cleanData( [ elem ] );  
}  
 
if ( elem.parentNode ) {  
elem.parentNode.removeChild( elem );  
}  
}  
}  
 
return this;  
},  
 
empty: function() {  
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {  
// Remove element nodes and prevent memory leaks  
if ( elem.nodeType === 1 ) {  
jQuery.cleanData( elem.getElementsByTagName("*") );  
}  
 
// Remove any remaining nodes  
while ( elem.firstChild ) {  
elem.removeChild( elem.firstChild );  
}  
}  
 
return this;  
},  
 
clone: function( dataAndEvents, deepDataAndEvents ) {  
dataAndEvents = dataAndEvents == null ? true : dataAndEvents;  
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;  
 
return this.map( function () {  
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );  
});  
},  
 
html: function( value ) {  
if ( value === undefined ) {  
return this[0] && this[0].nodeType === 1 ?  
this[0].innerHTML.replace(rinlinejQuery, "") :  
null;  
 
// See if we can take a shortcut and just use innerHTML  
} else if ( typeof value === "string" && !rnocache.test( value ) &&  
(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&  
!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {  
 
value = value.replace(rxhtmlTag, "<$1></$2>");  
 
try {  
for ( var i = 0, l = this.length; i < l; i++ ) {  
// Remove element nodes and prevent memory leaks  
if ( this[i].nodeType === 1 ) {  
jQuery.cleanData( this[i].getElementsByTagName("*") );  
this[i].innerHTML = value;  
}  
}  
 
// If using innerHTML throws an exception, use the fallback method  
} catch(e) {  
this.empty().append( value );  
}  
 
} else if ( jQuery.isFunction( value ) ) {  
this.each(function(i){  
var self = jQuery( this );  
 
self.html( value.call(this, i, self.html()) );  
});  
 
} else {  
this.empty().append( value );  
}  
 
return this;  
},  
 
replaceWith: function( value ) {  
if ( this[0] && this[0].parentNode ) {  
// Make sure that the elements are removed from the DOM before they are inserted  
// this can help fix replacing a parent with child elements  
if ( jQuery.isFunction( value ) ) {  
return this.each(function(i) {  
var self = jQuery(this), old = self.html();  
self.replaceWith( value.call( this, i, old ) );  
});  
}  
 
if ( typeof value !== "string" ) {  
value = jQuery( value ).detach();  
}  
 
return this.each(function() {  
var next = this.nextSibling,  
parent = this.parentNode;  
 
jQuery( this ).remove();  
 
if ( next ) {  
jQuery(next).before( value );  
} else {  
jQuery(parent).append( value );  
}  
});  
} else {  
return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );  
}  
},  
 
detach: function( selector ) {  
return this.remove( selector, true );  
},  
 
domManip: function( args, table, callback ) {  
var results, first, fragment, parent,  
value = args[0],  
scripts = [];  
 
// We can't cloneNode fragments that contain checked, in WebKit  
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {  
return this.each(function() {  
jQuery(this).domManip( args, table, callback, true );  
});  
}  
 
if ( jQuery.isFunction(value) ) {  
return this.each(function(i) {  
var self = jQuery(this);  
args[0] = value.call(this, i, table ? self.html() : undefined);  
self.domManip( args, table, callback );  
});  
}  
 
if ( this[0] ) {  
parent = value && value.parentNode;  
 
// If we're in a fragment, just use that instead of building a new one  
if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {  
results = { fragment: parent };  
 
} else {  
results = jQuery.buildFragment( args, this, scripts );  
}  
 
fragment = results.fragment;  
 
if ( fragment.childNodes.length === 1 ) {  
first = fragment = fragment.firstChild;  
} else {  
first = fragment.firstChild;  
}  
 
if ( first ) {  
table = table && jQuery.nodeName( first, "tr" );  
 
for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {  
callback.call(  
table ?  
root(this[i], first) :  
this[i],  
// Make sure that we do not leak memory by inadvertently discarding  
// the original fragment (which might have attached data) instead of  
// using it; in addition, use the original fragment object for the last  
// item instead of first because it can end up being emptied incorrectly  
// in certain situations (Bug #8070).  
// Fragments from the fragment cache must always be cloned and never used  
// in place.  
results.cacheable || (l > 1 && i < lastIndex) ?  
jQuery.clone( fragment, true, true ) :  
fragment  
);  
}  
}  
 
if ( scripts.length ) {  
jQuery.each( scripts, evalScript );  
}  
}  
 
return this;  
}  
});  
 
function root( elem, cur ) {  
return jQuery.nodeName(elem, "table") ?  
(elem.getElementsByTagName("tbody")[0] ||  
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :  
elem;  
}  
 
function cloneCopyEvent( src, dest ) {  
 
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {  
return;  
}  
 
var internalKey = jQuery.expando,  
oldData = jQuery.data( src ),  
curData = jQuery.data( dest, oldData );  
 
// Switch to use the internal data object, if it exists, for the next  
// stage of data copying  
if ( (oldData = oldData[ internalKey ]) ) {  
var events = oldData.events;  
curData = curData[ internalKey ] = jQuery.extend({}, oldData);  
 
if ( events ) {  
delete curData.handle;  
curData.events = {};  
 
for ( var type in events ) {  
for ( var i = 0, l = events[ type ].length; i < l; i++ ) {  
jQuery.event.add( dest, type, events[ type ][ i ], events[ type ][ i ].data );  
}  
}  
}  
}  
}  
 
function cloneFixAttributes(src, dest) {  
// We do not need to do anything for non-Elements  
if ( dest.nodeType !== 1 ) {  
return;  
}  
 
var nodeName = dest.nodeName.toLowerCase();  
 
// clearAttributes removes the attributes, which we don't want,  
// but also removes the attachEvent events, which we *do* want  
dest.clearAttributes();  
 
// mergeAttributes, in contrast, only merges back on the  
// original attributes, not the events  
dest.mergeAttributes(src);  
 
// IE6-8 fail to clone children inside object elements that use  
// the proprietary classid attribute value (rather than the type  
// attribute) to identify the type of content to display  
if ( nodeName === "object" ) {  
dest.outerHTML = src.outerHTML;  
 
} else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {  
// IE6-8 fails to persist the checked state of a cloned checkbox  
// or radio button. Worse, IE6-7 fail to give the cloned element  
// a checked appearance if the defaultChecked value isn't also set  
if ( src.checked ) {  
dest.defaultChecked = dest.checked = src.checked;  
}  
 
// IE6-7 get confused and end up setting the value of a cloned  
// checkbox/radio button to an empty string instead of "on"  
if ( dest.value !== src.value ) {  
dest.value = src.value;  
}  
 
// IE6-8 fails to return the selected option to the default selected  
// state when cloning options  
} else if ( nodeName === "option" ) {  
dest.selected = src.defaultSelected;  
 
// IE6-8 fails to set the defaultValue to the correct value when  
// cloning other types of input fields  
} else if ( nodeName === "input" || nodeName === "textarea" ) {  
dest.defaultValue = src.defaultValue;  
}  
 
// Event data gets referenced instead of copied if the expando  
// gets copied too  
dest.removeAttribute( jQuery.expando );  
}  
 
jQuery.buildFragment = function( args, nodes, scripts ) {  
var fragment, cacheable, cacheresults,  
doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);  
 
// Only cache "small" (1/2 KB) HTML strings that are associated with the main document  
// Cloning options loses the selected state, so don't cache them  
// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment  
// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache  
if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&  
args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {  
 
cacheable = true;  
cacheresults = jQuery.fragments[ args[0] ];  
if ( cacheresults ) {  
if ( cacheresults !== 1 ) {  
fragment = cacheresults;  
}  
}  
}  
 
if ( !fragment ) {  
fragment = doc.createDocumentFragment();  
jQuery.clean( args, doc, fragment, scripts );  
}  
 
if ( cacheable ) {  
jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;  
}  
 
return { fragment: fragment, cacheable: cacheable };  
};  
 
jQuery.fragments = {};  
 
jQuery.each({  
appendTo: "append",  
prependTo: "prepend",  
insertBefore: "before",  
insertAfter: "after",  
replaceAll: "replaceWith"  
}, function( name, original ) {  
jQuery.fn[ name ] = function( selector ) {  
var ret = [],  
insert = jQuery( selector ),  
parent = this.length === 1 && this[0].parentNode;  
 
if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {  
insert[ original ]( this[0] );  
return this;  
 
} else {  
for ( var i = 0, l = insert.length; i < l; i++ ) {  
var elems = (i > 0 ? this.clone(true) : this).get();  
jQuery( insert[i] )[ original ]( elems );  
ret = ret.concat( elems );  
}  
 
return this.pushStack( ret, name, insert.selector );  
}  
};  
});  
 
jQuery.extend({  
clone: function( elem, dataAndEvents, deepDataAndEvents ) {  
var clone = elem.cloneNode(true),  
srcElements,  
destElements,  
i;  
 
if ( !jQuery.support.noCloneEvent && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {  
// IE copies events bound via attachEvent when using cloneNode.  
// Calling detachEvent on the clone will also remove the events  
// from the original. In order to get around this, we use some  
// proprietary methods to clear the events. Thanks to MooTools  
// guys for this hotness.  
 
// Using Sizzle here is crazy slow, so we use getElementsByTagName  
// instead  
srcElements = elem.getElementsByTagName("*");  
destElements = clone.getElementsByTagName("*");  
 
// Weird iteration because IE will replace the length property  
// with an element if you are cloning the body and one of the  
// elements on the page has a name or id of "length"  
for ( i = 0; srcElements[i]; ++i ) {  
cloneFixAttributes( srcElements[i], destElements[i] );  
}  
 
cloneFixAttributes( elem, clone );  
}  
 
// Copy the events from the original to the clone  
if ( dataAndEvents ) {  
 
cloneCopyEvent( elem, clone );  
 
if ( deepDataAndEvents && "getElementsByTagName" in elem ) {  
 
srcElements = elem.getElementsByTagName("*");  
destElements = clone.getElementsByTagName("*");  
 
if ( srcElements.length ) {  
for ( i = 0; srcElements[i]; ++i ) {  
cloneCopyEvent( srcElements[i], destElements[i] );  
}  
}  
}  
}  
// Return the cloned set  
return clone;  
},  
clean: function( elems, context, fragment, scripts ) {  
context = context || document;  
 
// !context.createElement fails in IE with an error but returns typeof 'object'  
if ( typeof context.createElement === "undefined" ) {  
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;  
}  
 
var ret = [];  
 
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {  
if ( typeof elem === "number" ) {  
elem += "";  
}  
 
if ( !elem ) {  
continue;  
}  
 
// Convert html string into DOM nodes  
if ( typeof elem === "string" && !rhtml.test( elem ) ) {  
elem = context.createTextNode( elem );  
 
} else if ( typeof elem === "string" ) {  
// Fix "XHTML"-style tags in all browsers  
elem = elem.replace(rxhtmlTag, "<$1></$2>");  
 
// Trim whitespace, otherwise indexOf won't work as expected  
var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),  
wrap = wrapMap[ tag ] || wrapMap._default,  
depth = wrap[0],  
div = context.createElement("div");  
 
// Go to html and back, then peel off extra wrappers  
div.innerHTML = wrap[1] + elem + wrap[2];  
 
// Move to the right depth  
while ( depth-- ) {  
div = div.lastChild;  
}  
 
// Remove IE's autoinserted <tbody> from table fragments  
if ( !jQuery.support.tbody ) {  
 
// String was a <table>, *may* have spurious <tbody>  
var hasBody = rtbody.test(elem),  
tbody = tag === "table" && !hasBody ?  
div.firstChild && div.firstChild.childNodes :  
 
// String was a bare <thead> or <tfoot>  
wrap[1] === "<table>" && !hasBody ?  
div.childNodes :  
[];  
 
for ( var j = tbody.length - 1; j >= 0 ; --j ) {  
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {  
tbody[ j ].parentNode.removeChild( tbody[ j ] );  
}  
}  
 
}  
 
// IE completely kills leading whitespace when innerHTML is used  
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {  
div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );  
}  
 
elem = div.childNodes;  
}  
 
if ( elem.nodeType ) {  
ret.push( elem );  
} else {  
ret = jQuery.merge( ret, elem );  
}  
}  
 
if ( fragment ) {  
for ( i = 0; ret[i]; i++ ) {  
if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {  
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );  
 
} else {  
if ( ret[i].nodeType === 1 ) {  
ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );  
}  
fragment.appendChild( ret[i] );  
}  
}  
}  
 
return ret;  
},  
 
cleanData: function( elems ) {  
var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special,  
deleteExpando = jQuery.support.deleteExpando;  
 
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {  
if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {  
continue;  
}  
 
id = elem[ jQuery.expando ];  
 
if ( id ) {  
data = cache[ id ] && cache[ id ][ internalKey ];  
 
if ( data && data.events ) {  
for ( var type in data.events ) {  
if ( special[ type ] ) {  
jQuery.event.remove( elem, type );  
 
// This is a shortcut to avoid jQuery.event.remove's overhead  
} else {  
jQuery.removeEvent( elem, type, data.handle );  
}  
}  
 
// Null the DOM reference to avoid IE6/7/8 leak (#7054)  
if ( data.handle ) {  
data.handle.elem = null;  
}  
}  
 
if ( deleteExpando ) {  
delete elem[ jQuery.expando ];  
 
} else if ( elem.removeAttribute ) {  
elem.removeAttribute( jQuery.expando );  
}  
 
delete cache[ id ];  
}  
}  
}  
});  
 
function evalScript( i, elem ) {  
if ( elem.src ) {  
jQuery.ajax({  
url: elem.src,  
async: false,  
dataType: "script"  
});  
} else {  
jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );  
}  
 
if ( elem.parentNode ) {  
elem.parentNode.removeChild( elem );  
}  
}  
 
 
 
 
var ralpha = /alpha\([^)]*\)/i,  
ropacity = /opacity=([^)]*)/,  
rdashAlpha = /-([a-z])/ig,  
rupper = /([A-Z])/g,  
rnumpx = /^-?\d+(?:px)?$/i,  
rnum = /^-?\d/,  
 
cssShow = { position: "absolute", visibility: "hidden", display: "block" },  
cssWidth = [ "Left", "Right" ],  
cssHeight = [ "Top", "Bottom" ],  
curCSS,  
 
getComputedStyle,  
currentStyle,  
 
fcamelCase = function( all, letter ) {  
return letter.toUpperCase();  
};  
 
jQuery.fn.css = function( name, value ) {  
// Setting 'undefined' is a no-op  
if ( arguments.length === 2 && value === undefined ) {  
return this;  
}  
 
return jQuery.access( this, name, value, true, function( elem, name, value ) {  
return value !== undefined ?  
jQuery.style( elem, name, value ) :  
jQuery.css( elem, name );  
});  
};  
 
jQuery.extend({  
// Add in style property hooks for overriding the default  
// behavior of getting and setting a style property  
cssHooks: {  
opacity: {  
get: function( elem, computed ) {  
if ( computed ) {  
// We should always get a number back from opacity  
var ret = curCSS( elem, "opacity", "opacity" );  
return ret === "" ? "1" : ret;  
 
} else {  
return elem.style.opacity;  
}  
}  
}  
},  
 
// Exclude the following css properties to add px  
cssNumber: {  
"zIndex": true,  
"fontWeight": true,  
"opacity": true,  
"zoom": true,  
"lineHeight": true  
},  
 
// Add in properties whose names you wish to fix before  
// setting or getting the value  
cssProps: {  
// normalize float css property  
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"  
},  
 
// Get and set the style property on a DOM Node  
style: function( elem, name, value, extra ) {  
// Don't set styles on text and comment nodes  
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {  
return;  
}  
 
// Make sure that we're working with the right name  
var ret, origName = jQuery.camelCase( name ),  
style = elem.style, hooks = jQuery.cssHooks[ origName ];  
 
name = jQuery.cssProps[ origName ] || origName;  
 
// Check if we're setting a value  
if ( value !== undefined ) {  
// Make sure that NaN and null values aren't set. See: #7116  
if ( typeof value === "number" && isNaN( value ) || value == null ) {  
return;  
}  
 
// If a number was passed in, add 'px' to the (except for certain CSS properties)  
if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) {  
value += "px";  
}  
 
// If a hook was provided, use that value, otherwise just set the specified value  
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {  
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided  
// Fixes bug #5509  
try {  
style[ name ] = value;  
} catch(e) {}  
}  
 
} else {  
// If a hook was provided get the non-computed value from there  
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {  
return ret;  
}  
 
// Otherwise just get the value from the style object  
return style[ name ];  
}  
},  
 
css: function( elem, name, extra ) {  
// Make sure that we're working with the right name  
var ret, origName = jQuery.camelCase( name ),  
hooks = jQuery.cssHooks[ origName ];  
 
name = jQuery.cssProps[ origName ] || origName;  
 
// If a hook was provided get the computed value from there  
if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {  
return ret;  
 
// Otherwise, if a way to get the computed value exists, use that  
} else if ( curCSS ) {  
return curCSS( elem, name, origName );  
}  
},  
 
// A method for quickly swapping in/out CSS properties to get correct calculations  
swap: function( elem, options, callback ) {  
var old = {};  
 
// Remember the old values, and insert the new ones  
for ( var name in options ) {  
old[ name ] = elem.style[ name ];  
elem.style[ name ] = options[ name ];  
}  
 
callback.call( elem );  
 
// Revert the old values  
for ( name in options ) {  
elem.style[ name ] = old[ name ];  
}  
},  
 
camelCase: function( string ) {  
return string.replace( rdashAlpha, fcamelCase );  
}  
});  
 
// DEPRECATED, Use jQuery.css() instead  
jQuery.curCSS = jQuery.css;  
 
jQuery.each(["height", "width"], function( i, name ) {  
jQuery.cssHooks[ name ] = {  
get: function( elem, computed, extra ) {  
var val;  
 
if ( computed ) {  
if ( elem.offsetWidth !== 0 ) {  
val = getWH( elem, name, extra );  
 
} else {  
jQuery.swap( elem, cssShow, function() {  
val = getWH( elem, name, extra );  
});  
}  
 
if ( val <= 0 ) {  
val = curCSS( elem, name, name );  
 
if ( val === "0px" && currentStyle ) {  
val = currentStyle( elem, name, name );  
}  
 
if ( val != null ) {  
// Should return "auto" instead of 0, use 0 for  
// temporary backwards-compat  
return val === "" || val === "auto" ? "0px" : val;  
}  
}  
 
if ( val < 0 || val == null ) {  
val = elem.style[ name ];  
 
// Should return "auto" instead of 0, use 0 for  
// temporary backwards-compat  
return val === "" || val === "auto" ? "0px" : val;  
}  
 
return typeof val === "string" ? val : val + "px";  
}  
},  
 
set: function( elem, value ) {  
if ( rnumpx.test( value ) ) {  
// ignore negative width and height values #1599  
value = parseFloat(value);  
 
if ( value >= 0 ) {  
return value + "px";  
}  
 
} else {  
return value;  
}  
}  
};  
});  
 
if ( !jQuery.support.opacity ) {  
jQuery.cssHooks.opacity = {  
get: function( elem, computed ) {  
// IE uses filters for opacity  
return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?  
(parseFloat(RegExp.$1) / 100) + "" :  
computed ? "1" : "";  
},  
 
set: function( elem, value ) {  
var style = elem.style;  
 
// IE has trouble with opacity if it does not have layout  
// Force it by setting the zoom level  
style.zoom = 1;  
 
// Set the alpha filter to set the opacity  
var opacity = jQuery.isNaN(value) ?  
"" :  
"alpha(opacity=" + value * 100 + ")",  
filter = style.filter || "";  
 
style.filter = ralpha.test(filter) ?  
filter.replace(ralpha, opacity) :  
style.filter + ' ' + opacity;  
}  
};  
}  
 
if ( document.defaultView && document.defaultView.getComputedStyle ) {  
getComputedStyle = function( elem, newName, name ) {  
var ret, defaultView, computedStyle;  
 
name = name.replace( rupper, "-$1" ).toLowerCase();  
 
if ( !(defaultView = elem.ownerDocument.defaultView) ) {  
return undefined;  
}  
 
if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {  
ret = computedStyle.getPropertyValue( name );  
if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {  
ret = jQuery.style( elem, name );  
}  
}  
 
return ret;  
};  
}  
 
if ( document.documentElement.currentStyle ) {  
currentStyle = function( elem, name ) {  
var left,  
ret = elem.currentStyle && elem.currentStyle[ name ],  
rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ],  
style = elem.style;  
 
// From the awesome hack by Dean Edwards  
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291  
 
// If we're not dealing with a regular pixel number  
// but a number that has a weird ending, we need to convert it to pixels  
if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {  
// Remember the original values  
left = style.left;  
 
// Put in the new values to get a computed value out  
if ( rsLeft ) {  
elem.runtimeStyle.left = elem.currentStyle.left;  
}  
style.left = name === "fontSize" ? "1em" : (ret || 0);  
ret = style.pixelLeft + "px";  
 
// Revert the changed values  
style.left = left;  
if ( rsLeft ) {  
elem.runtimeStyle.left = rsLeft;  
}  
}  
 
return ret === "" ? "auto" : ret;  
};  
}  
 
curCSS = getComputedStyle || currentStyle;  
 
function getWH( elem, name, extra ) {  
var which = name === "width" ? cssWidth : cssHeight,  
val = name === "width" ? elem.offsetWidth : elem.offsetHeight;  
 
if ( extra === "border" ) {  
return val;  
}  
 
jQuery.each( which, function() {  
if ( !extra ) {  
val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;  
}  
 
if ( extra === "margin" ) {  
val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;  
 
} else {  
val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;  
}  
});  
 
return val;  
}  
 
if ( jQuery.expr && jQuery.expr.filters ) {  
jQuery.expr.filters.hidden = function( elem ) {  
var width = elem.offsetWidth,  
height = elem.offsetHeight;  
 
return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");  
};  
 
jQuery.expr.filters.visible = function( elem ) {  
return !jQuery.expr.filters.hidden( elem );  
};  
}  
 
 
 
 
var r20 = /%20/g,  
rbracket = /\[\]$/,  
rCRLF = /\r?\n/g,  
rhash = /#.*$/,  
rheaders = /^(.*?):\s*(.*?)\r?$/mg, // IE leaves an \r character at EOL  
rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,  
rnoContent = /^(?:GET|HEAD)$/,  
rprotocol = /^\/\//,  
rquery = /\?/,  
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,  
rselectTextarea = /^(?:select|textarea)/i,  
rspacesAjax = /\s+/,  
rts = /([?&])_=[^&]*/,  
rurl = /^(\w+:)\/\/([^\/?#:]+)(?::(\d+))?/,  
 
// Keep a copy of the old load method  
_load = jQuery.fn.load,  
 
/* Prefilters  
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)  
* 2) These are called:  
* - BEFORE asking for a transport  
* - AFTER param serialization (s.data is a string if s.processData is true)  
* 3) key is the dataType  
* 4) the catchall symbol "*" can be used  
* 5) execution will start with transport dataType and THEN continue down to "*" if needed  
*/  
prefilters = {},  
 
/* Transports bindings  
* 1) key is the dataType  
* 2) the catchall symbol "*" can be used  
* 3) selection will start with transport dataType and THEN go to "*" if needed  
*/  
transports = {};  
 
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport  
function addToPrefiltersOrTransports( structure ) {  
 
// dataTypeExpression is optional and defaults to "*"  
return function( dataTypeExpression, func ) {  
 
if ( typeof dataTypeExpression !== "string" ) {  
func = dataTypeExpression;  
dataTypeExpression = "*";  
}  
 
if ( jQuery.isFunction( func ) ) {  
var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),  
i = 0,  
length = dataTypes.length,  
dataType,  
list,  
placeBefore;  
 
// For each dataType in the dataTypeExpression  
for(; i < length; i++ ) {  
dataType = dataTypes[ i ];  
// We control if we're asked to add before  
// any existing element  
placeBefore = /^\+/.test( dataType );  
if ( placeBefore ) {  
dataType = dataType.substr( 1 ) || "*";  
}  
list = structure[ dataType ] = structure[ dataType ] || [];  
// then we add to the structure accordingly  
list[ placeBefore ? "unshift" : "push" ]( func );  
}  
}  
};  
}  
 
//Base inspection function for prefilters and transports  
function inspectPrefiltersOrTransports( structure, options, originalOptions, jXHR,  
dataType /* internal */, inspected /* internal */ ) {  
 
dataType = dataType || options.dataTypes[ 0 ];  
inspected = inspected || {};  
 
inspected[ dataType ] = true;  
 
var list = structure[ dataType ],  
i = 0,  
length = list ? list.length : 0,  
executeOnly = ( structure === prefilters ),  
selection;  
 
for(; i < length && ( executeOnly || !selection ); i++ ) {  
selection = list[ i ]( options, originalOptions, jXHR );  
// If we got redirected to another dataType  
// we try there if not done already  
if ( typeof selection === "string" ) {  
if ( inspected[ selection ] ) {  
selection = undefined;  
} else {  
options.dataTypes.unshift( selection );  
selection = inspectPrefiltersOrTransports(  
structure, options, originalOptions, jXHR, selection, inspected );  
}  
}  
}  
// If we're only executing or nothing was selected  
// we try the catchall dataType if not done already  
if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {  
selection = inspectPrefiltersOrTransports(  
structure, options, originalOptions, jXHR, "*", inspected );  
}  
// unnecessary when only executing (prefilters)  
// but it'll be ignored by the caller in that case  
return selection;  
}  
 
jQuery.fn.extend({  
load: function( url, params, callback ) {  
if ( typeof url !== "string" && _load ) {  
return _load.apply( this, arguments );  
 
// Don't do a request if no elements are being requested  
} else if ( !this.length ) {  
return this;  
}  
 
var off = url.indexOf( " " );  
if ( off >= 0 ) {  
var selector = url.slice( off, url.length );  
url = url.slice( 0, off );  
}  
 
// Default to a GET request  
var type = "GET";  
 
// If the second parameter was provided  
if ( params ) {  
// If it's a function  
if ( jQuery.isFunction( params ) ) {  
// We assume that it's the callback  
callback = params;  
params = null;  
 
// Otherwise, build a param string  
} else if ( typeof params === "object" ) {  
params = jQuery.param( params, jQuery.ajaxSettings.traditional );  
type = "POST";  
}  
}  
 
var self = this;  
 
// Request the remote document  
jQuery.ajax({  
url: url,  
type: type,  
dataType: "html",  
data: params,  
// Complete callback (responseText is used internally)  
complete: function( jXHR, status, responseText ) {  
// Store the response as specified by the jXHR object  
responseText = jXHR.responseText;  
// If successful, inject the HTML into all the matched elements  
if ( jXHR.isResolved() ) {  
// #4825: Get the actual response in case  
// a dataFilter is present in ajaxSettings  
jXHR.done(function( r ) {  
responseText = r;  
});  
// See if a selector was specified  
self.html( selector ?  
// Create a dummy div to hold the results  
jQuery("<div>")  
// inject the contents of the document in, removing the scripts  
// to avoid any 'Permission Denied' errors in IE  
.append(responseText.replace(rscript, ""))  
 
// Locate the specified elements  
.find(selector) :  
 
// If not, just inject the full result  
responseText );  
}  
 
if ( callback ) {  
self.each( callback, [ responseText, status, jXHR ] );  
}  
}  
});  
 
return this;  
},  
 
serialize: function() {  
return jQuery.param( this.serializeArray() );  
},  
 
serializeArray: function() {  
return this.map(function(){  
return this.elements ? jQuery.makeArray( this.elements ) : this;  
})  
.filter(function(){  
return this.name && !this.disabled &&  
( this.checked || rselectTextarea.test( this.nodeName ) ||  
rinput.test( this.type ) );  
})  
.map(function( i, elem ){  
var val = jQuery( this ).val();  
 
return val == null ?  
null :  
jQuery.isArray( val ) ?  
jQuery.map( val, function( val, i ){  
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };  
}) :  
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };  
}).get();  
}  
});  
 
// Attach a bunch of functions for handling common AJAX events  
jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){  
jQuery.fn[ o ] = function( f ){  
return this.bind( o, f );  
};  
} );  
 
jQuery.each( [ "get", "post" ], function( i, method ) {  
jQuery[ method ] = function( url, data, callback, type ) {  
// shift arguments if data argument was omitted  
if ( jQuery.isFunction( data ) ) {  
type = type || callback;  
callback = data;  
data = null;  
}  
 
return jQuery.ajax({  
type: method,  
url: url,  
data: data,  
success: callback,  
dataType: type  
});  
};  
} );  
 
jQuery.extend({  
 
getScript: function( url, callback ) {  
return jQuery.get( url, null, callback, "script" );  
},  
 
getJSON: function( url, data, callback ) {  
return jQuery.get( url, data, callback, "json" );  
},  
 
ajaxSetup: function( settings ) {  
jQuery.extend( true, jQuery.ajaxSettings, settings );  
if ( settings.context ) {  
jQuery.ajaxSettings.context = settings.context;  
}  
},  
 
ajaxSettings: {  
url: location.href,  
global: true,  
type: "GET",  
contentType: "application/x-www-form-urlencoded",  
processData: true,  
async: true,  
/*  
timeout: 0,  
data: null,  
dataType: null,  
username: null,  
password: null,  
cache: null,  
traditional: false,  
headers: {},  
crossDomain: null,  
*/  
 
accepts: {  
xml: "application/xml, text/xml",  
html: "text/html",  
text: "text/plain",  
json: "application/json, text/javascript",  
"*": "*/*"  
},  
 
contents: {  
xml: /xml/,  
html: /html/,  
json: /json/  
},  
 
responseFields: {  
xml: "responseXML",  
text: "responseText"  
},  
 
// List of data converters  
// 1) key format is "source_type destination_type" (a single space in-between)  
// 2) the catchall symbol "*" can be used for source_type  
converters: {  
 
// Convert anything to text  
"* text": window.String,  
 
// Text to html (true = no transformation)  
"text html": true,  
 
// Evaluate text as a json expression  
"text json": jQuery.parseJSON,  
 
// Parse text as xml  
"text xml": jQuery.parseXML  
}  
},  
 
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),  
ajaxTransport: addToPrefiltersOrTransports( transports ),  
 
// Main method  
ajax: function( url, options ) {  
 
// If options is not an object,  
// we simulate pre-1.5 signature  
if ( typeof options !== "object" ) {  
options = url;  
url = undefined;  
}  
 
// Force options to be an object  
options = options || {};  
 
var // Create the final options object  
s = jQuery.extend( true, {}, jQuery.ajaxSettings, options ),  
// Callbacks contexts  
// We force the original context if it exists  
// or take it from jQuery.ajaxSettings otherwise  
// (plain objects used as context get extended)  
callbackContext =  
( s.context = ( "context" in options ? options : jQuery.ajaxSettings ).context ) || s,  
globalEventContext = callbackContext === s ? jQuery.event : jQuery( callbackContext ),  
// Deferreds  
deferred = jQuery.Deferred(),  
completeDeferred = jQuery._Deferred(),  
// Status-dependent callbacks  
statusCode = s.statusCode || {},  
// Headers (they are sent all at once)  
requestHeaders = {},  
// Response headers  
responseHeadersString,  
responseHeaders,  
// transport  
transport,  
// timeout handle  
timeoutTimer,  
// Cross-domain detection vars  
loc = document.location,  
protocol = loc.protocol || "http:",  
parts,  
// The jXHR state  
state = 0,  
// Loop variable  
i,  
// Fake xhr  
jXHR = {  
 
readyState: 0,  
 
// Caches the header  
setRequestHeader: function( name, value ) {  
if ( state === 0 ) {  
requestHeaders[ name.toLowerCase() ] = value;  
}  
return this;  
},  
 
// Raw string  
getAllResponseHeaders: function() {  
return state === 2 ? responseHeadersString : null;  
},  
 
// Builds headers hashtable if needed  
getResponseHeader: function( key ) {  
var match;  
if ( state === 2 ) {  
if ( !responseHeaders ) {  
responseHeaders = {};  
while( ( match = rheaders.exec( responseHeadersString ) ) ) {  
responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];  
}  
}  
match = responseHeaders[ key.toLowerCase() ];  
}  
return match || null;  
},  
 
// Cancel the request  
abort: function( statusText ) {  
statusText = statusText || "abort";  
if ( transport ) {  
transport.abort( statusText );  
}  
done( 0, statusText );  
return this;  
}  
};  
 
// Callback for when everything is done  
// It is defined here because jslint complains if it is declared  
// at the end of the function (which would be more logical and readable)  
function done( status, statusText, responses, headers) {  
 
// Called once  
if ( state === 2 ) {  
return;  
}  
 
// State is "done" now  
state = 2;  
 
// Clear timeout if it exists  
if ( timeoutTimer ) {  
clearTimeout( timeoutTimer );  
}  
 
// Dereference transport for early garbage collection  
// (no matter how long the jXHR object will be used)  
transport = undefined;  
 
// Cache response headers  
responseHeadersString = headers || "";  
 
// Set readyState  
jXHR.readyState = status ? 4 : 0;  
 
var isSuccess,  
success,  
error,  
response = responses ? ajaxHandleResponses( s, jXHR, responses ) : undefined,  
lastModified,  
etag;  
 
// If successful, handle type chaining  
if ( status >= 200 && status < 300 || status === 304 ) {  
 
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.  
if ( s.ifModified ) {  
 
if ( ( lastModified = jXHR.getResponseHeader( "Last-Modified" ) ) ) {  
jQuery.lastModified[ s.url ] = lastModified;  
}  
if ( ( etag = jXHR.getResponseHeader( "Etag" ) ) ) {  
jQuery.etag[ s.url ] = etag;  
}  
}  
 
// If not modified  
if ( status === 304 ) {  
 
statusText = "notmodified";  
isSuccess = true;  
 
// If we have data  
} else {  
 
try {  
success = ajaxConvert( s, response );  
statusText = "success";  
isSuccess = true;  
} catch(e) {  
// We have a parsererror  
statusText = "parsererror";  
error = e;  
}  
}  
} else {  
// We extract error from statusText  
// then normalize statusText and status for non-aborts  
error = statusText;  
if( status ) {  
statusText = "error";  
if ( status < 0 ) {  
status = 0;  
}  
}  
}  
 
// Set data for the fake xhr object  
jXHR.status = status;  
jXHR.statusText = statusText;  
 
// Success/Error  
if ( isSuccess ) {  
deferred.resolveWith( callbackContext, [ success, statusText, jXHR ] );  
} else {  
deferred.rejectWith( callbackContext, [ jXHR, statusText, error ] );  
}  
 
// Status-dependent callbacks  
jXHR.statusCode( statusCode );  
statusCode = undefined;  
 
if ( s.global ) {  
globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),  
[ jXHR, s, isSuccess ? success : error ] );  
}  
 
// Complete  
completeDeferred.resolveWith( callbackContext, [ jXHR, statusText ] );  
 
if ( s.global ) {  
globalEventContext.trigger( "ajaxComplete", [ jXHR, s] );  
// Handle the global AJAX counter  
if ( !( --jQuery.active ) ) {  
jQuery.event.trigger( "ajaxStop" );  
}  
}  
}  
 
// Attach deferreds  
deferred.promise( jXHR );  
jXHR.success = jXHR.done;  
jXHR.error = jXHR.fail;  
jXHR.complete = completeDeferred.done;  
 
// Status-dependent callbacks  
jXHR.statusCode = function( map ) {  
if ( map ) {  
var tmp;  
if ( state < 2 ) {  
for( tmp in map ) {  
statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];  
}  
} else {  
tmp = map[ jXHR.status ];  
jXHR.then( tmp, tmp );  
}  
}  
return this;  
};  
 
// Remove hash character (#7531: and string promotion)  
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)  
// We also use the url parameter if available  
s.url = ( "" + ( url || s.url ) ).replace( rhash, "" ).replace( rprotocol, protocol + "//" );  
 
// Extract dataTypes list  
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );  
 
// Determine if a cross-domain request is in order  
if ( !s.crossDomain ) {  
parts = rurl.exec( s.url.toLowerCase() );  
s.crossDomain = !!( parts &&  
( parts[ 1 ] != protocol || parts[ 2 ] != loc.hostname ||  
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=  
( loc.port || ( protocol === "http:" ? 80 : 443 ) ) )  
);  
}  
 
// Convert data if not already a string  
if ( s.data && s.processData && typeof s.data !== "string" ) {  
s.data = jQuery.param( s.data, s.traditional );  
}  
 
// Apply prefilters  
inspectPrefiltersOrTransports( prefilters, s, options, jXHR );  
 
// Uppercase the type  
s.type = s.type.toUpperCase();  
 
// Determine if request has content  
s.hasContent = !rnoContent.test( s.type );  
 
// Watch for a new set of requests  
if ( s.global && jQuery.active++ === 0 ) {  
jQuery.event.trigger( "ajaxStart" );  
}  
 
// More options handling for requests with no content  
if ( !s.hasContent ) {  
 
// If data is available, append data to url  
if ( s.data ) {  
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;  
}  
 
// Add anti-cache in url if needed  
if ( s.cache === false ) {  
 
var ts = jQuery.now(),  
// try replacing _= if it is there  
ret = s.url.replace( rts, "$1_=" + ts );  
 
// if nothing was replaced, add timestamp to the end  
s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );  
}  
}  
 
// Set the correct header, if data is being sent  
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {  
requestHeaders[ "content-type" ] = s.contentType;  
}  
 
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.  
if ( s.ifModified ) {  
if ( jQuery.lastModified[ s.url ] ) {  
requestHeaders[ "if-modified-since" ] = jQuery.lastModified[ s.url ];  
}  
if ( jQuery.etag[ s.url ] ) {  
requestHeaders[ "if-none-match" ] = jQuery.etag[ s.url ];  
}  
}  
 
// Set the Accepts header for the server, depending on the dataType  
requestHeaders.accept = s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?  
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) :  
s.accepts[ "*" ];  
 
// Check for headers option  
for ( i in s.headers ) {  
requestHeaders[ i.toLowerCase() ] = s.headers[ i ];  
}  
 
// Allow custom headers/mimetypes and early abort  
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jXHR, s ) === false || state === 2 ) ) {  
// Abort if not done already  
done( 0, "abort" );  
// Return false  
jXHR = false;  
 
} else {  
 
// Install callbacks on deferreds  
for ( i in { success: 1, error: 1, complete: 1 } ) {  
jXHR[ i ]( s[ i ] );  
}  
 
// Get transport  
transport = inspectPrefiltersOrTransports( transports, s, options, jXHR );  
 
// If no transport, we auto-abort  
if ( !transport ) {  
done( -1, "No Transport" );  
} else {  
// Set state as sending  
state = jXHR.readyState = 1;  
// Send global event  
if ( s.global ) {  
globalEventContext.trigger( "ajaxSend", [ jXHR, s ] );  
}  
// Timeout  
if ( s.async && s.timeout > 0 ) {  
timeoutTimer = setTimeout( function(){  
jXHR.abort( "timeout" );  
}, s.timeout );  
}  
 
try {  
transport.send( requestHeaders, done );  
} catch (e) {  
// Propagate exception as error if not done  
if ( status < 2 ) {  
done( -1, e );  
// Simply rethrow otherwise  
} else {  
jQuery.error( e );  
}  
}  
}  
}  
return jXHR;  
},  
 
// Serialize an array of form elements or a set of  
// key/values into a query string  
param: function( a, traditional ) {  
var s = [],  
add = function( key, value ) {  
// If value is a function, invoke it and return its value  
value = jQuery.isFunction( value ) ? value() : value;  
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );  
};  
 
// Set traditional to true for jQuery <= 1.3.2 behavior.  
if ( traditional === undefined ) {  
traditional = jQuery.ajaxSettings.traditional;  
}  
 
// If an array was passed in, assume that it is an array of form elements.  
if ( jQuery.isArray( a ) || a.jquery ) {  
// Serialize the form elements  
jQuery.each( a, function() {  
add( this.name, this.value );  
} );  
 
} else {  
// If traditional, encode the "old" way (the way 1.3.2 or older  
// did it), otherwise encode params recursively.  
for ( var prefix in a ) {  
buildParams( prefix, a[ prefix ], traditional, add );  
}  
}  
 
// Return the resulting serialization  
return s.join( "&" ).replace( r20, "+" );  
}  
});  
 
function buildParams( prefix, obj, traditional, add ) {  
if ( jQuery.isArray( obj ) && obj.length ) {  
// Serialize array item.  
jQuery.each( obj, function( i, v ) {  
if ( traditional || rbracket.test( prefix ) ) {  
// Treat each array item as a scalar.  
add( prefix, v );  
 
} else {  
// If array item is non-scalar (array or object), encode its  
// numeric index to resolve deserialization ambiguity issues.  
// Note that rack (as of 1.0.0) can't currently deserialize  
// nested arrays properly, and attempting to do so may cause  
// a server error. Possible fixes are to modify rack's  
// deserialization algorithm or to provide an option or flag  
// to force array serialization to be shallow.  
buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );  
}  
});  
 
} else if ( !traditional && obj != null && typeof obj === "object" ) {  
// If we see an array here, it is empty and should be treated as an empty  
// object  
if ( jQuery.isArray( obj ) || jQuery.isEmptyObject( obj ) ) {  
add( prefix, "" );  
 
// Serialize object item.  
} else {  
jQuery.each( obj, function( k, v ) {  
buildParams( prefix + "[" + k + "]", v, traditional, add );  
});  
}  
 
} else {  
// Serialize scalar item.  
add( prefix, obj );  
}  
}  
 
// This is still on the jQuery object... for now  
// Want to move this to jQuery.ajax some day  
jQuery.extend({  
 
// Counter for holding the number of active queries  
active: 0,  
 
// Last-Modified header cache for next request  
lastModified: {},  
etag: {}  
 
});  
 
/* Handles responses to an ajax request:  
* - sets all responseXXX fields accordingly  
* - finds the right dataType (mediates between content-type and expected dataType)  
* - returns the corresponding response  
*/  
function ajaxHandleResponses( s, jXHR, responses ) {  
 
var contents = s.contents,  
dataTypes = s.dataTypes,  
responseFields = s.responseFields,  
ct,  
type,  
finalDataType,  
firstDataType;  
 
// Fill responseXXX fields  
for( type in responseFields ) {  
if ( type in responses ) {  
jXHR[ responseFields[type] ] = responses[ type ];  
}  
}  
 
// Remove auto dataType and get content-type in the process  
while( dataTypes[ 0 ] === "*" ) {  
dataTypes.shift();  
if ( ct === undefined ) {  
ct = jXHR.getResponseHeader( "content-type" );  
}  
}  
 
// Check if we're dealing with a known content-type  
if ( ct ) {  
for ( type in contents ) {  
if ( contents[ type ] && contents[ type ].test( ct ) ) {  
dataTypes.unshift( type );  
break;  
}  
}  
}  
 
// Check to see if we have a response for the expected dataType  
if ( dataTypes[ 0 ] in responses ) {  
finalDataType = dataTypes[ 0 ];  
} else {  
// Try convertible dataTypes  
for ( type in responses ) {  
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {  
finalDataType = type;  
break;  
}  
if ( !firstDataType ) {  
firstDataType = type;  
}  
}  
// Or just use first one  
finalDataType = finalDataType || firstDataType;  
}  
 
// If we found a dataType  
// We add the dataType to the list if needed  
// and return the corresponding response  
if ( finalDataType ) {  
if ( finalDataType !== dataTypes[ 0 ] ) {  
dataTypes.unshift( finalDataType );  
}  
return responses[ finalDataType ];  
}  
}  
 
// Chain conversions given the request and the original response  
function ajaxConvert( s, response ) {  
 
// Apply the dataFilter if provided  
if ( s.dataFilter ) {  
response = s.dataFilter( response, s.dataType );  
}  
 
var dataTypes = s.dataTypes,  
converters = s.converters,  
i,  
length = dataTypes.length,  
tmp,  
// Current and previous dataTypes  
current = dataTypes[ 0 ],  
prev,  
// Conversion expression  
conversion,  
// Conversion function  
conv,  
// Conversion functions (transitive conversion)  
conv1,  
conv2;  
 
// For each dataType in the chain  
for( i = 1; i < length; i++ ) {  
 
// Get the dataTypes  
prev = current;  
current = dataTypes[ i ];  
 
// If current is auto dataType, update it to prev  
if( current === "*" ) {  
current = prev;  
// If no auto and dataTypes are actually different  
} else if ( prev !== "*" && prev !== current ) {  
 
// Get the converter  
conversion = prev + " " + current;  
conv = converters[ conversion ] || converters[ "* " + current ];  
 
// If there is no direct converter, search transitively  
if ( !conv ) {  
conv2 = undefined;  
for( conv1 in converters ) {  
tmp = conv1.split( " " );  
if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {  
conv2 = converters[ tmp[1] + " " + current ];  
if ( conv2 ) {  
conv1 = converters[ conv1 ];  
if ( conv1 === true ) {  
conv = conv2;  
} else if ( conv2 === true ) {  
conv = conv1;  
}  
break;  
}  
}  
}  
}  
// If we found no converter, dispatch an error  
if ( !( conv || conv2 ) ) {  
jQuery.error( "No conversion from " + conversion.replace(" "," to ") );  
}  
// If found converter is not an equivalence  
if ( conv !== true ) {  
// Convert with 1 or 2 converters accordingly  
response = conv ? conv( response ) : conv2( conv1(response) );  
}  
}  
}  
return response;  
}  
 
 
 
 
var jsc = jQuery.now(),  
jsre = /(\=)\?(&|$)|()\?\?()/i;  
 
// Default jsonp settings  
jQuery.ajaxSetup({  
jsonp: "callback",  
jsonpCallback: function() {  
return jQuery.expando + "_" + ( jsc++ );  
}  
});  
 
// Detect, normalize options and install callbacks for jsonp requests  
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, dataIsString /* internal */ ) {  
 
dataIsString = ( typeof s.data === "string" );  
 
if ( s.dataTypes[ 0 ] === "jsonp" ||  
originalSettings.jsonpCallback ||  
originalSettings.jsonp != null ||  
s.jsonp !== false && ( jsre.test( s.url ) ||  
dataIsString && jsre.test( s.data ) ) ) {  
 
var responseContainer,  
jsonpCallback = s.jsonpCallback =  
jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,  
previous = window[ jsonpCallback ],  
url = s.url,  
data = s.data,  
replace = "$1" + jsonpCallback + "$2";  
 
if ( s.jsonp !== false ) {  
url = url.replace( jsre, replace );  
if ( s.url === url ) {  
if ( dataIsString ) {  
data = data.replace( jsre, replace );  
}  
if ( s.data === data ) {  
// Add callback manually  
url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;  
}  
}  
}  
 
s.url = url;  
s.data = data;  
 
window[ jsonpCallback ] = function( response ) {  
responseContainer = [ response ];  
};  
 
s.complete = [ function() {  
 
// Set callback back to previous value  
window[ jsonpCallback ] = previous;  
 
// Call if it was a function and we have a response  
if ( previous) {  
if ( responseContainer && jQuery.isFunction( previous ) ) {  
window[ jsonpCallback ] ( responseContainer[ 0 ] );  
}  
} else {  
// else, more memory leak avoidance  
try{  
delete window[ jsonpCallback ];  
} catch( e ) {}  
}  
 
}, s.complete ];  
 
// Use data converter to retrieve json after script execution  
s.converters["script json"] = function() {  
if ( ! responseContainer ) {  
jQuery.error( jsonpCallback + " was not called" );  
}  
return responseContainer[ 0 ];  
};  
 
// force json dataType  
s.dataTypes[ 0 ] = "json";  
 
// Delegate to script  
return "script";  
}  
} );  
 
 
 
 
// Install script dataType  
jQuery.ajaxSetup({  
accepts: {  
script: "text/javascript, application/javascript"  
},  
contents: {  
script: /javascript/  
},  
converters: {  
"text script": function( text ) {  
jQuery.globalEval( text );  
return text;  
}  
}  
});  
 
// Handle cache's special case and global  
jQuery.ajaxPrefilter( "script", function( s ) {  
if ( s.cache === undefined ) {  
s.cache = false;  
}  
if ( s.crossDomain ) {  
s.type = "GET";  
s.global = false;  
}  
} );  
 
// Bind script tag hack transport  
jQuery.ajaxTransport( "script", function(s) {  
 
// This transport only deals with cross domain requests  
if ( s.crossDomain ) {  
 
var script,  
head = document.getElementsByTagName( "head" )[ 0 ] || document.documentElement;  
 
return {  
 
send: function( _, callback ) {  
 
script = document.createElement( "script" );  
 
script.async = "async";  
 
if ( s.scriptCharset ) {  
script.charset = s.scriptCharset;  
}  
 
script.src = s.url;  
 
// Attach handlers for all browsers  
script.onload = script.onreadystatechange = function( _, isAbort ) {  
 
if ( !script.readyState || /loaded|complete/.test( script.readyState ) ) {  
 
// Handle memory leak in IE  
script.onload = script.onreadystatechange = null;  
 
// Remove the script  
if ( head && script.parentNode ) {  
head.removeChild( script );  
}  
 
// Dereference the script  
script = undefined;  
 
// Callback if not abort  
if ( !isAbort ) {  
callback( 200, "success" );  
}  
}  
};  
// Use insertBefore instead of appendChild to circumvent an IE6 bug.  
// This arises when a base node is used (#2709 and #4378).  
head.insertBefore( script, head.firstChild );  
},  
 
abort: function() {  
if ( script ) {  
script.onload( 0, 1 );  
}  
}  
};  
}  
} );  
 
 
 
 
var // Next active xhr id  
xhrId = jQuery.now(),  
 
// active xhrs  
xhrs = {},  
 
// #5280: see below  
xhrUnloadAbortInstalled,  
 
// XHR used to determine supports properties  
testXHR;  
 
// Create the request object  
// (This is still attached to ajaxSettings for backward compatibility)  
jQuery.ajaxSettings.xhr = window.ActiveXObject ?  
/* Microsoft failed to properly  
* implement the XMLHttpRequest in IE7 (can't request local files),  
* so we use the ActiveXObject when it is available  
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so  
* we need a fallback.  
*/  
function() {  
if ( window.location.protocol !== "file:" ) {  
try {  
return new window.XMLHttpRequest();  
} catch( xhrError ) {}  
}  
 
try {  
return new window.ActiveXObject("Microsoft.XMLHTTP");  
} catch( activeError ) {}  
} :  
// For all other browsers, use the standard XMLHttpRequest object  
function() {  
return new window.XMLHttpRequest();  
};  
 
// Test if we can create an xhr object  
try {  
testXHR = jQuery.ajaxSettings.xhr();  
} catch( xhrCreationException ) {}  
 
//Does this browser support XHR requests?  
jQuery.support.ajax = !!testXHR;  
 
// Does this browser support crossDomain XHR requests  
jQuery.support.cors = testXHR && ( "withCredentials" in testXHR );  
 
// No need for the temporary xhr anymore  
testXHR = undefined;  
 
// Create transport if the browser can provide an xhr  
if ( jQuery.support.ajax ) {  
 
jQuery.ajaxTransport(function( s ) {  
// Cross domain only allowed if supported through XMLHttpRequest  
if ( !s.crossDomain || jQuery.support.cors ) {  
 
var callback;  
 
return {  
send: function( headers, complete ) {  
 
// #5280: we need to abort on unload or IE will keep connections alive  
if ( !xhrUnloadAbortInstalled ) {  
 
xhrUnloadAbortInstalled = 1;  
 
jQuery(window).bind( "unload", function() {  
 
// Abort all pending requests  
jQuery.each( xhrs, function( _, xhr ) {  
if ( xhr.onreadystatechange ) {  
xhr.onreadystatechange( 1 );  
}  
} );  
 
} );  
}  
 
// Get a new xhr  
var xhr = s.xhr(),  
handle;  
 
// Open the socket  
// Passing null username, generates a login popup on Opera (#2865)  
if ( s.username ) {  
xhr.open( s.type, s.url, s.async, s.username, s.password );  
} else {  
xhr.open( s.type, s.url, s.async );  
}  
 
// Requested-With header  
// Not set for crossDomain requests with no content  
// (see why at http://trac.dojotoolkit.org/ticket/9486)  
// Won't change header if already provided  
if ( !( s.crossDomain && !s.hasContent ) && !headers["x-requested-with"] ) {  
headers[ "x-requested-with" ] = "XMLHttpRequest";  
}  
 
// Need an extra try/catch for cross domain requests in Firefox 3  
try {  
jQuery.each( headers, function( key, value ) {  
xhr.setRequestHeader( key, value );  
} );  
} catch( _ ) {}  
 
// Do send the request  
// This may raise an exception which is actually  
// handled in jQuery.ajax (so no try/catch here)  
xhr.send( ( s.hasContent && s.data ) || null );  
 
// Listener  
callback = function( _, isAbort ) {  
 
// Was never called and is aborted or complete  
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {  
 
// Only called once  
callback = 0;  
 
// Do not keep as active anymore  
if ( handle ) {  
xhr.onreadystatechange = jQuery.noop;  
delete xhrs[ handle ];  
}  
 
// If it's an abort  
if ( isAbort ) {  
// Abort it manually if needed  
if ( xhr.readyState !== 4 ) {  
xhr.abort();  
}  
} else {  
// Get info  
var status = xhr.status,  
statusText,  
responseHeaders = xhr.getAllResponseHeaders(),  
responses = {},  
xml = xhr.responseXML;  
 
// Construct response list  
if ( xml && xml.documentElement /* #4958 */ ) {  
responses.xml = xml;  
}  
responses.text = xhr.responseText;  
 
// Firefox throws an exception when accessing  
// statusText for faulty cross-domain requests  
try {  
statusText = xhr.statusText;  
} catch( e ) {  
// We normalize with Webkit giving an empty statusText  
statusText = "";  
}  
 
// Filter status for non standard behaviours  
status =  
// Opera returns 0 when it should be 304  
// Webkit returns 0 for failing cross-domain no matter the real status  
status === 0 ?  
(  
// Webkit, Firefox: filter out faulty cross-domain requests  
!s.crossDomain || statusText ?  
(  
// Opera: filter out real aborts #6060  
responseHeaders ?  
304 :  
0  
) :  
// We assume 302 but could be anything cross-domain related  
302  
) :  
(  
// IE sometimes returns 1223 when it should be 204 (see #1450)  
status == 1223 ?  
204 :  
status  
);  
 
// Call complete  
complete( status, statusText, responses, responseHeaders );  
}  
}  
};  
 
// if we're in sync mode or it's in cache  
// and has been retrieved directly (IE6 & IE7)  
// we need to manually fire the callback  
if ( !s.async || xhr.readyState === 4 ) {  
callback();  
} else {  
// Add to list of active xhrs  
handle = xhrId++;  
xhrs[ handle ] = xhr;  
xhr.onreadystatechange = callback;  
}  
},  
 
abort: function() {  
if ( callback ) {  
callback(0,1);  
}  
}  
};  
}  
});  
}  
 
 
 
 
var elemdisplay = {},  
rfxtypes = /^(?:toggle|show|hide)$/,  
rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,  
timerId,  
fxAttrs = [  
// height animations  
[ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],  
// width animations  
[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],  
// opacity animations  
[ "opacity" ]  
];  
 
jQuery.fn.extend({  
show: function( speed, easing, callback ) {  
var elem, display;  
 
if ( speed || speed === 0 ) {  
return this.animate( genFx("show", 3), speed, easing, callback);  
 
} else {  
for ( var i = 0, j = this.length; i < j; i++ ) {  
elem = this[i];  
display = elem.style.display;  
 
// Reset the inline display of this element to learn if it is  
// being hidden by cascaded rules or not  
if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {  
display = elem.style.display = "";  
}  
 
// Set elements which have been overridden with display: none  
// in a stylesheet to whatever the default browser style is  
// for such an element  
if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {  
jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName));  
}  
}  
 
// Set the display of most of the elements in a second loop  
// to avoid the constant reflow  
for ( i = 0; i < j; i++ ) {  
elem = this[i];  
display = elem.style.display;  
 
if ( display === "" || display === "none" ) {  
elem.style.display = jQuery._data(elem, "olddisplay") || "";  
}  
}  
 
return this;  
}  
},  
 
hide: function( speed, easing, callback ) {  
if ( speed || speed === 0 ) {  
return this.animate( genFx("hide", 3), speed, easing, callback);  
 
} else {  
for ( var i = 0, j = this.length; i < j; i++ ) {  
var display = jQuery.css( this[i], "display" );  
 
if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) {  
jQuery._data( this[i], "olddisplay", display );  
}  
}  
 
// Set the display of the elements in a second loop  
// to avoid the constant reflow  
for ( i = 0; i < j; i++ ) {  
this[i].style.display = "none";  
}  
 
return this;  
}  
},  
 
// Save the old toggle function  
_toggle: jQuery.fn.toggle,  
 
toggle: function( fn, fn2, callback ) {  
var bool = typeof fn === "boolean";  
 
if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {  
this._toggle.apply( this, arguments );  
 
} else if ( fn == null || bool ) {  
this.each(function() {  
var state = bool ? fn : jQuery(this).is(":hidden");  
jQuery(this)[ state ? "show" : "hide" ]();  
});  
 
} else {  
this.animate(genFx("toggle", 3), fn, fn2, callback);  
}  
 
return this;  
},  
 
fadeTo: function( speed, to, easing, callback ) {  
return this.filter(":hidden").css("opacity", 0).show().end()  
.animate({opacity: to}, speed, easing, callback);  
},  
 
animate: function( prop, speed, easing, callback ) {  
var optall = jQuery.speed(speed, easing, callback);  
 
if ( jQuery.isEmptyObject( prop ) ) {  
return this.each( optall.complete );  
}  
 
return this[ optall.queue === false ? "each" : "queue" ](function() {  
// XXX 'this' does not always have a nodeName when running the  
// test suite  
 
var opt = jQuery.extend({}, optall), p,  
isElement = this.nodeType === 1,  
hidden = isElement && jQuery(this).is(":hidden"),  
self = this;  
 
for ( p in prop ) {  
var name = jQuery.camelCase( p );  
 
if ( p !== name ) {  
prop[ name ] = prop[ p ];  
delete prop[ p ];  
p = name;  
}  
 
if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) {  
return opt.complete.call(this);  
}  
 
if ( isElement && ( p === "height" || p === "width" ) ) {  
// Make sure that nothing sneaks out  
// Record all 3 overflow attributes because IE does not  
// change the overflow attribute when overflowX and  
// overflowY are set to the same value  
opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];  
 
// Set display property to inline-block for height/width  
// animations on inline elements that are having width/height  
// animated  
if ( jQuery.css( this, "display" ) === "inline" &&  
jQuery.css( this, "float" ) === "none" ) {  
if ( !jQuery.support.inlineBlockNeedsLayout ) {  
this.style.display = "inline-block";  
 
} else {  
var display = defaultDisplay(this.nodeName);  
 
// inline-level elements accept inline-block;  
// block-level elements need to be inline with layout  
if ( display === "inline" ) {  
this.style.display = "inline-block";  
 
} else {  
this.style.display = "inline";  
this.style.zoom = 1;  
}  
}  
}  
}  
 
if ( jQuery.isArray( prop[p] ) ) {  
// Create (if needed) and add to specialEasing  
(opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1];  
prop[p] = prop[p][0];  
}  
}  
 
if ( opt.overflow != null ) {  
this.style.overflow = "hidden";  
}  
 
opt.curAnim = jQuery.extend({}, prop);  
 
jQuery.each( prop, function( name, val ) {  
var e = new jQuery.fx( self, opt, name );  
 
if ( rfxtypes.test(val) ) {  
e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop );  
 
} else {  
var parts = rfxnum.exec(val),  
start = e.cur() || 0;  
 
if ( parts ) {  
var end = parseFloat( parts[2] ),  
unit = parts[3] || "px";  
 
// We need to compute starting value  
if ( unit !== "px" ) {  
jQuery.style( self, name, (end || 1) + unit);  
start = ((end || 1) / e.cur()) * start;  
jQuery.style( self, name, start + unit);  
}  
 
// If a +=/-= token was provided, we're doing a relative animation  
if ( parts[1] ) {  
end = ((parts[1] === "-=" ? -1 : 1) * end) + start;  
}  
 
e.custom( start, end, unit );  
 
} else {  
e.custom( start, val, "" );  
}  
}  
});  
 
// For JS strict compliance  
return true;  
});  
},  
 
stop: function( clearQueue, gotoEnd ) {  
var timers = jQuery.timers;  
 
if ( clearQueue ) {  
this.queue([]);  
}  
 
this.each(function() {  
// go in reverse order so anything added to the queue during the loop is ignored  
for ( var i = timers.length - 1; i >= 0; i-- ) {  
if ( timers[i].elem === this ) {  
if (gotoEnd) {  
// force the next step to be the last  
timers[i](true);  
}  
 
timers.splice(i, 1);  
}  
}  
});  
 
// start the next in the queue if the last step wasn't forced  
if ( !gotoEnd ) {  
this.dequeue();  
}  
 
return this;  
}  
 
});  
 
function genFx( type, num ) {  
var obj = {};  
 
jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {  
obj[ this ] = type;  
});  
 
return obj;  
}  
 
// Generate shortcuts for custom animations  
jQuery.each({  
slideDown: genFx("show", 1),  
slideUp: genFx("hide", 1),  
slideToggle: genFx("toggle", 1),  
fadeIn: { opacity: "show" },  
fadeOut: { opacity: "hide" },  
fadeToggle: { opacity: "toggle" }  
}, function( name, props ) {  
jQuery.fn[ name ] = function( speed, easing, callback ) {  
return this.animate( props, speed, easing, callback );  
};  
});  
 
jQuery.extend({  
speed: function( speed, easing, fn ) {  
var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {  
complete: fn || !fn && easing ||  
jQuery.isFunction( speed ) && speed,  
duration: speed,  
easing: fn && easing || easing && !jQuery.isFunction(easing) && easing  
};  
 
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :  
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;  
 
// Queueing  
opt.old = opt.complete;  
opt.complete = function() {  
if ( opt.queue !== false ) {  
jQuery(this).dequeue();  
}  
if ( jQuery.isFunction( opt.old ) ) {  
opt.old.call( this );  
}  
};  
 
return opt;  
},  
 
easing: {  
linear: function( p, n, firstNum, diff ) {  
return firstNum + diff * p;  
},  
swing: function( p, n, firstNum, diff ) {  
return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;  
}  
},  
 
timers: [],  
 
fx: function( elem, options, prop ) {  
this.options = options;  
this.elem = elem;  
this.prop = prop;  
 
if ( !options.orig ) {  
options.orig = {};  
}  
}  
 
});  
 
jQuery.fx.prototype = {  
// Simple function for setting a style value  
update: function() {  
if ( this.options.step ) {  
this.options.step.call( this.elem, this.now, this );  
}  
 
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );  
},  
 
// Get the current size  
cur: function() {  
if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {  
return this.elem[ this.prop ];  
}  
 
var r = parseFloat( jQuery.css( this.elem, this.prop ) );  
return r || 0;  
},  
 
// Start an animation from one number to another  
custom: function( from, to, unit ) {  
var self = this,  
fx = jQuery.fx;  
 
this.startTime = jQuery.now();  
this.start = from;  
this.end = to;  
this.unit = unit || this.unit || "px";  
this.now = this.start;  
this.pos = this.state = 0;  
 
function t( gotoEnd ) {  
return self.step(gotoEnd);  
}  
 
t.elem = this.elem;  
 
if ( t() && jQuery.timers.push(t) && !timerId ) {  
timerId = setInterval(fx.tick, fx.interval);  
}  
},  
 
// Simple 'show' function  
show: function() {  
// Remember where we started, so that we can go back to it later  
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );  
this.options.show = true;  
 
// Begin the animation  
// Make sure that we start at a small width/height to avoid any  
// flash of content  
this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());  
 
// Start by showing the element  
jQuery( this.elem ).show();  
},  
 
// Simple 'hide' function  
hide: function() {  
// Remember where we started, so that we can go back to it later  
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );  
this.options.hide = true;  
 
// Begin the animation  
this.custom(this.cur(), 0);  
},  
 
// Each step of an animation  
step: function( gotoEnd ) {  
var t = jQuery.now(), done = true;  
 
if ( gotoEnd || t >= this.options.duration + this.startTime ) {  
this.now = this.end;  
this.pos = this.state = 1;  
this.update();  
 
this.options.curAnim[ this.prop ] = true;  
 
for ( var i in this.options.curAnim ) {  
if ( this.options.curAnim[i] !== true ) {  
done = false;  
}  
}  
 
if ( done ) {  
// Reset the overflow  
if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {  
var elem = this.elem,  
options = this.options;  
 
jQuery.each( [ "", "X", "Y" ], function (index, value) {  
elem.style[ "overflow" + value ] = options.overflow[index];  
} );  
}  
 
// Hide the element if the "hide" operation was done  
if ( this.options.hide ) {  
jQuery(this.elem).hide();  
}  
 
// Reset the properties, if the item has been hidden or shown  
if ( this.options.hide || this.options.show ) {  
for ( var p in this.options.curAnim ) {  
jQuery.style( this.elem, p, this.options.orig[p] );  
}  
}  
 
// Execute the complete function  
this.options.complete.call( this.elem );  
}  
 
return false;  
 
} else {  
var n = t - this.startTime;  
this.state = n / this.options.duration;  
 
// Perform the easing function, defaults to swing  
var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];  
var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear");  
this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);  
this.now = this.start + ((this.end - this.start) * this.pos);  
 
// Perform the next step of the animation  
this.update();  
}  
 
return true;  
}  
};  
 
jQuery.extend( jQuery.fx, {  
tick: function() {  
var timers = jQuery.timers;  
 
for ( var i = 0; i < timers.length; i++ ) {  
if ( !timers[i]() ) {  
timers.splice(i--, 1);  
}  
}  
 
if ( !timers.length ) {  
jQuery.fx.stop();  
}  
},  
 
interval: 13,  
 
stop: function() {  
clearInterval( timerId );  
timerId = null;  
},  
 
speeds: {  
slow: 600,  
fast: 200,  
// Default speed  
_default: 400  
},  
 
step: {  
opacity: function( fx ) {  
jQuery.style( fx.elem, "opacity", fx.now );  
},  
 
_default: function( fx ) {  
if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {  
fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;  
} else {  
fx.elem[ fx.prop ] = fx.now;  
}  
}  
}  
});  
 
if ( jQuery.expr && jQuery.expr.filters ) {  
jQuery.expr.filters.animated = function( elem ) {  
return jQuery.grep(jQuery.timers, function( fn ) {  
return elem === fn.elem;  
}).length;  
};  
}  
 
function defaultDisplay( nodeName ) {  
if ( !elemdisplay[ nodeName ] ) {  
var elem = jQuery("<" + nodeName + ">").appendTo("body"),  
display = elem.css("display");  
 
elem.remove();  
 
if ( display === "none" || display === "" ) {  
display = "block";  
}  
 
elemdisplay[ nodeName ] = display;  
}  
 
return elemdisplay[ nodeName ];  
}  
 
 
 
 
var rtable = /^t(?:able|d|h)$/i,  
rroot = /^(?:body|html)$/i;  
 
if ( "getBoundingClientRect" in document.documentElement ) {  
jQuery.fn.offset = function( options ) {  
var elem = this[0], box;  
 
if ( options ) {  
return this.each(function( i ) {  
jQuery.offset.setOffset( this, options, i );  
});  
}  
 
if ( !elem || !elem.ownerDocument ) {  
return null;  
}  
 
if ( elem === elem.ownerDocument.body ) {  
return jQuery.offset.bodyOffset( elem );  
}  
 
try {  
box = elem.getBoundingClientRect();  
} catch(e) {}  
 
var doc = elem.ownerDocument,  
docElem = doc.documentElement;  
 
// Make sure we're not dealing with a disconnected DOM node  
if ( !box || !jQuery.contains( docElem, elem ) ) {  
return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };  
}  
 
var body = doc.body,  
win = getWindow(doc),  
clientTop = docElem.clientTop || body.clientTop || 0,  
clientLeft = docElem.clientLeft || body.clientLeft || 0,  
scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ),  
scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),  
top = box.top + scrollTop - clientTop,  
left = box.left + scrollLeft - clientLeft;  
 
return { top: top, left: left };  
};  
 
} else {  
jQuery.fn.offset = function( options ) {  
var elem = this[0];  
 
if ( options ) {  
return this.each(function( i ) {  
jQuery.offset.setOffset( this, options, i );  
});  
}  
 
if ( !elem || !elem.ownerDocument ) {  
return null;  
}  
 
if ( elem === elem.ownerDocument.body ) {  
return jQuery.offset.bodyOffset( elem );  
}  
 
jQuery.offset.initialize();  
 
var computedStyle,  
offsetParent = elem.offsetParent,  
prevOffsetParent = elem,  
doc = elem.ownerDocument,  
docElem = doc.documentElement,  
body = doc.body,  
defaultView = doc.defaultView,  
prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,  
top = elem.offsetTop,  
left = elem.offsetLeft;  
 
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {  
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {  
break;  
}  
 
computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;  
top -= elem.scrollTop;  
left -= elem.scrollLeft;  
 
if ( elem === offsetParent ) {  
top += elem.offsetTop;  
left += elem.offsetLeft;  
 
if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {  
top += parseFloat( computedStyle.borderTopWidth ) || 0;  
left += parseFloat( computedStyle.borderLeftWidth ) || 0;  
}  
 
prevOffsetParent = offsetParent;  
offsetParent = elem.offsetParent;  
}  
 
if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {  
top += parseFloat( computedStyle.borderTopWidth ) || 0;  
left += parseFloat( computedStyle.borderLeftWidth ) || 0;  
}  
 
prevComputedStyle = computedStyle;  
}  
 
if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {  
top += body.offsetTop;  
left += body.offsetLeft;  
}  
 
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {  
top += Math.max( docElem.scrollTop, body.scrollTop );  
left += Math.max( docElem.scrollLeft, body.scrollLeft );  
}  
 
return { top: top, left: left };  
};  
}  
 
jQuery.offset = {  
initialize: function() {  
var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,  
html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";  
 
jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );  
 
container.innerHTML = html;  
body.insertBefore( container, body.firstChild );  
innerDiv = container.firstChild;  
checkDiv = innerDiv.firstChild;  
td = innerDiv.nextSibling.firstChild.firstChild;  
 
this.doesNotAddBorder = (checkDiv.offsetTop !== 5);  
this.doesAddBorderForTableAndCells = (td.offsetTop === 5);  
 
checkDiv.style.position = "fixed";  
checkDiv.style.top = "20px";  
 
// safari subtracts parent border width here which is 5px  
this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);  
checkDiv.style.position = checkDiv.style.top = "";  
 
innerDiv.style.overflow = "hidden";  
innerDiv.style.position = "relative";  
 
this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);  
 
this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);  
 
body.removeChild( container );  
body = container = innerDiv = checkDiv = table = td = null;  
jQuery.offset.initialize = jQuery.noop;  
},  
 
bodyOffset: function( body ) {  
var top = body.offsetTop,  
left = body.offsetLeft;  
 
jQuery.offset.initialize();  
 
if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {  
top += parseFloat( jQuery.css(body, "marginTop") ) || 0;  
left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;  
}  
 
return { top: top, left: left };  
},  
 
setOffset: function( elem, options, i ) {  
var position = jQuery.css( elem, "position" );  
 
// set position first, in-case top/left are set even on static elem  
if ( position === "static" ) {  
elem.style.position = "relative";  
}  
 
var curElem = jQuery( elem ),  
curOffset = curElem.offset(),  
curCSSTop = jQuery.css( elem, "top" ),  
curCSSLeft = jQuery.css( elem, "left" ),  
calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),  
props = {}, curPosition = {}, curTop, curLeft;  
 
// need to be able to calculate position if either top or left is auto and position is absolute  
if ( calculatePosition ) {  
curPosition = curElem.position();  
}  
 
curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0;  
curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;  
 
if ( jQuery.isFunction( options ) ) {  
options = options.call( elem, i, curOffset );  
}  
 
if (options.top != null) {  
props.top = (options.top - curOffset.top) + curTop;  
}  
if (options.left != null) {  
props.left = (options.left - curOffset.left) + curLeft;  
}  
 
if ( "using" in options ) {  
options.using.call( elem, props );  
} else {  
curElem.css( props );  
}  
}  
};  
 
 
jQuery.fn.extend({  
position: function() {  
if ( !this[0] ) {  
return null;  
}  
 
var elem = this[0],  
 
// Get *real* offsetParent  
offsetParent = this.offsetParent(),  
 
// Get correct offsets  
offset = this.offset(),  
parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();  
 
// Subtract element margins  
// note: when an element has margin: auto the offsetLeft and marginLeft  
// are the same in Safari causing offset.left to incorrectly be 0  
offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;  
offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;  
 
// Add offsetParent borders  
parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;  
parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;  
 
// Subtract the two offsets  
return {  
top: offset.top - parentOffset.top,  
left: offset.left - parentOffset.left  
};  
},  
 
offsetParent: function() {  
return this.map(function() {  
var offsetParent = this.offsetParent || document.body;  
while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {  
offsetParent = offsetParent.offsetParent;  
}  
return offsetParent;  
});  
}  
});  
 
 
// Create scrollLeft and scrollTop methods  
jQuery.each( ["Left", "Top"], function( i, name ) {  
var method = "scroll" + name;  
 
jQuery.fn[ method ] = function(val) {  
var elem = this[0], win;  
 
if ( !elem ) {  
return null;  
}  
 
if ( val !== undefined ) {  
// Set the scroll offset  
return this.each(function() {  
win = getWindow( this );  
 
if ( win ) {  
win.scrollTo(  
!i ? val : jQuery(win).scrollLeft(),  
i ? val : jQuery(win).scrollTop()  
);  
 
} else {  
this[ method ] = val;  
}  
});  
} else {  
win = getWindow( elem );  
 
// Return the scroll offset  
return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :  
jQuery.support.boxModel && win.document.documentElement[ method ] ||  
win.document.body[ method ] :  
elem[ method ];  
}  
};  
});  
 
function getWindow( elem ) {  
return jQuery.isWindow( elem ) ?  
elem :  
elem.nodeType === 9 ?  
elem.defaultView || elem.parentWindow :  
false;  
}  
 
 
 
 
// Create innerHeight, innerWidth, outerHeight and outerWidth methods  
jQuery.each([ "Height", "Width" ], function( i, name ) {  
 
var type = name.toLowerCase();  
 
// innerHeight and innerWidth  
jQuery.fn["inner" + name] = function() {  
return this[0] ?  
parseFloat( jQuery.css( this[0], type, "padding" ) ) :  
null;  
};  
 
// outerHeight and outerWidth  
jQuery.fn["outer" + name] = function( margin ) {  
return this[0] ?  
parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :  
null;  
};  
 
jQuery.fn[ type ] = function( size ) {  
// Get window width or height  
var elem = this[0];  
if ( !elem ) {  
return size == null ? null : this;  
}  
 
if ( jQuery.isFunction( size ) ) {  
return this.each(function( i ) {  
var self = jQuery( this );  
self[ type ]( size.call( this, i, self[ type ]() ) );  
});  
}  
 
if ( jQuery.isWindow( elem ) ) {  
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode  
// 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat  
var docElemProp = elem.document.documentElement[ "client" + name ];  
return elem.document.compatMode === "CSS1Compat" && docElemProp ||  
elem.document.body[ "client" + name ] || docElemProp;  
 
// Get document width or height  
} else if ( elem.nodeType === 9 ) {  
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater  
return Math.max(  
elem.documentElement["client" + name],  
elem.body["scroll" + name], elem.documentElement["scroll" + name],  
elem.body["offset" + name], elem.documentElement["offset" + name]  
);  
 
// Get or set width or height on the element  
} else if ( size === undefined ) {  
var orig = jQuery.css( elem, type ),  
ret = parseFloat( orig );  
 
return jQuery.isNaN( ret ) ? orig : ret;  
 
// Set the width or height on the element (default to pixels if value is unitless)  
} else {  
return this.css( type, typeof size === "string" ? size : size + "px" );  
}  
};  
 
});  
 
 
})(window);  
 
/*!  
* jQuery Mobile v1.0a3  
* http://jquerymobile.com/  
*  
* Copyright 2010, jQuery Project  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*/  
(function(a,d){if(a.cleanData){var c=a.cleanData;a.cleanData=function(b){for(var g=0,e;(e=b[g])!=null;g++)a(e).triggerHandler("remove");c(b)}}else{var f=a.fn.remove;a.fn.remove=function(b,g){return this.each(function(){if(!g)if(!b||a.filter(b,[this]).length)a("*",this).add([this]).each(function(){a(this).triggerHandler("remove")});return f.call(a(this),b,g)})}}a.widget=function(b,g,e){var i=b.split(".")[0],h;b=b.split(".")[1];h=i+"-"+b;if(!e){e=g;g=a.Widget}a.expr[":"][h]=function(k){return!!a.data(k,  
b)};a[i]=a[i]||{};a[i][b]=function(k,j){arguments.length&&this._createWidget(k,j)};g=new g;g.options=a.extend(true,{},g.options);a[i][b].prototype=a.extend(true,g,{namespace:i,widgetName:b,widgetEventPrefix:a[i][b].prototype.widgetEventPrefix||b,widgetBaseClass:h},e);a.widget.bridge(b,a[i][b])};a.widget.bridge=function(b,g){a.fn[b]=function(e){var i=typeof e==="string",h=Array.prototype.slice.call(arguments,1),k=this;e=!i&&h.length?a.extend.apply(null,[true,e].concat(h)):e;if(i&&e.charAt(0)==="_")return k;  
i?this.each(function(){var j=a.data(this,b);if(!j)throw"cannot call methods on "+b+" prior to initialization; attempted to call method '"+e+"'";if(!a.isFunction(j[e]))throw"no such method '"+e+"' for "+b+" widget instance";var o=j[e].apply(j,h);if(o!==j&&o!==d){k=o;return false}}):this.each(function(){var j=a.data(this,b);j?j.option(e||{})._init():a.data(this,b,new g(e,this))});return k}};a.Widget=function(b,g){arguments.length&&this._createWidget(b,g)};a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",  
options:{disabled:false},_createWidget:function(b,g){a.data(g,this.widgetName,this);this.element=a(g);this.options=a.extend(true,{},this.options,this._getCreateOptions(),b);var e=this;this.element.bind("remove."+this.widgetName,function(){e.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){var b={};if(a.metadata)b=a.metadata.get(element)[this.widgetName];return b},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);  
this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(b,g){var e=b;if(arguments.length===0)return a.extend({},this.options);if(typeof b==="string"){if(g===d)return this.options[b];e={};e[b]=g}this._setOptions(e);return this},_setOptions:function(b){var g=this;a.each(b,function(e,i){g._setOption(e,i)});return this},_setOption:function(b,g){this.options[b]=g;if(b===  
"disabled")this.widget()[g?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",g);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(b,g,e){var i=this.options[b];g=a.Event(g);g.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase();e=e||{};if(g.originalEvent){b=a.event.props.length;for(var h;b;){h=a.event.props[--b];g[h]=g.originalEvent[h]}}this.element.trigger(g,  
e);return!(a.isFunction(i)&&i.call(this.element[0],g,e)===false||g.isDefaultPrevented())}}})(jQuery);(function(a,d){a.widget("mobile.widget",{_getCreateOptions:function(){var c=this.element,f={};a.each(this.options,function(b){var g=c.data(b.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()}));if(g!==d)f[b]=g});return f}})})(jQuery);  
(function(a){function d(){var g=c.width(),e=[],i=[],h;f.removeClass("min-width-"+b.join("px min-width-")+"px max-width-"+b.join("px max-width-")+"px");a.each(b,function(k,j){g>=j&&e.push("min-width-"+j+"px");g<=j&&i.push("max-width-"+j+"px")});if(e.length)h=e.join(" ");if(i.length)h+=" "+i.join(" ");f.addClass(h)}var c=a(window),f=a("html"),b=[320,480,768,1024];a.mobile.media=function(){var g={},e=a("<div id='jquery-mediatest'>"),i=a("<body>").append(e);return function(h){if(!(h in g)){var k=document.createElement("style"),  
j="@media "+h+" { #jquery-mediatest { position:absolute; } }";k.type="text/css";if(k.styleSheet)k.styleSheet.cssText=j;else k.appendChild(document.createTextNode(j));f.prepend(i).prepend(k);g[h]=e.css("position")==="absolute";i.add(k).remove()}return g[h]}}();a.mobile.addResolutionBreakpoints=function(g){if(a.type(g)==="array")b=b.concat(g);else b.push(g);b.sort(function(e,i){return e-i});d()};a(document).bind("mobileinit.htmlclass",function(){c.bind("orientationchange.htmlclass resize.htmlclass",  
function(g){g.orientation&&f.removeClass("portrait landscape").addClass(g.orientation);d()})});a(function(){c.trigger("orientationchange.htmlclass")})})(jQuery);  
(function(a,d){function c(h){var k=h.charAt(0).toUpperCase()+h.substr(1);h=(h+" "+g.join(k+" ")+k).split(" ");for(var j in h)if(b[j]!==d)return true}var f=a("<body>").prependTo("html"),b=f[0].style,g=["webkit","moz","o"],e=window.palmGetResource||window.PalmServiceBridge,i=window.blackberry;a.extend(a.support,{orientation:"orientation"in window,touch:"ontouchend"in document,cssTransitions:"WebKitTransitionEvent"in window,pushState:!!history.pushState,mediaquery:a.mobile.media("only all"),cssPseudoElement:!!c("content"),  
boxShadow:!!c("boxShadow")&&!i,scrollTop:("pageXOffset"in window||"scrollTop"in document.documentElement||"scrollTop"in f[0])&&!e,dynamicBaseTag:function(){var h=location.protocol+"//"+location.host+location.pathname+"ui-dir/",k=a("head base"),j=null,o="";if(k.length)o=k.attr("href");else k=j=a("<base>",{href:h}).appendTo("head");var p=a("<a href='testurl'></a>").prependTo(f)[0].href;k[0].href=o?o:location.pathname;j&&j.remove();return p.indexOf(h)===0}()});f.remove();a.support.boxShadow||a("html").addClass("ui-mobile-nosupport-boxshadow")})(jQuery);  
(function(a,d){a.each("touchstart touchmove touchend orientationchange tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(e,i){a.fn[i]=function(h){return h?this.bind(i,h):this.trigger(i)};a.attrFn[i]=true});var c=a.support.touch,f=c?"touchstart":"mousedown",b=c?"touchend":"mouseup",g=c?"touchmove":"mousemove";a.event.special.scrollstart={enabled:true,setup:function(){function e(j,o){h=o;var p=j.type;j.type=h?"scrollstart":"scrollstop";a.event.handle.call(i,j);j.type=  
p}var i=this,h,k;a(i).bind("touchmove scroll",function(j){if(a.event.special.scrollstart.enabled){h||e(j,true);clearTimeout(k);k=setTimeout(function(){e(j,false)},50)}})}};a.event.special.tap={setup:function(){var e=this,i=a(e);i.bind("mousedown touchstart",function(h){function k(n){if(n.type=="scroll")j=true;else{n=n.type=="touchmove"?n.originalEvent.touches[0]:n;if(Math.abs(v[0]-n.pageX)>10||Math.abs(v[1]-n.pageY)>10)j=true}}if(h.which&&h.which!==1||i.data("prevEvent")&&i.data("prevEvent")!==h.type)return false;  
i.data("prevEvent",h.type);setTimeout(function(){i.removeData("prevEvent")},800);var j=false,o=true,p=h.target,t=h.originalEvent,v=h.type=="touchstart"?[t.touches[0].pageX,t.touches[0].pageY]:[h.pageX,h.pageY],m,r;r=setTimeout(function(){if(o&&!j){m=h.type;h.type="taphold";a.event.handle.call(e,h);h.type=m}},750);a(window).one("scroll",k);i.bind("mousemove touchmove",k).one("mouseup touchend",function(n){i.unbind("mousemove touchmove",k);a(window).unbind("scroll",k);clearTimeout(r);o=false;if(!j&&  
p==n.target){m=n.type;n.type="tap";a.event.handle.call(e,n);n.type=m}})})}};a.event.special.swipe={setup:function(){var e=a(this);e.bind(f,function(i){function h(p){if(j){var t=p.originalEvent.touches?p.originalEvent.touches[0]:p;o={time:(new Date).getTime(),coords:[t.pageX,t.pageY]};Math.abs(j.coords[0]-o.coords[0])>10&&p.preventDefault()}}var k=i.originalEvent.touches?i.originalEvent.touches[0]:i,j={time:(new Date).getTime(),coords:[k.pageX,k.pageY],origin:a(i.target)},o;e.bind(g,h).one(b,function(){e.unbind(g,  
h);if(j&&o)if(o.time-j.time<1E3&&Math.abs(j.coords[0]-o.coords[0])>30&&Math.abs(j.coords[1]-o.coords[1])<75)j.origin.trigger("swipe").trigger(j.coords[0]>o.coords[0]?"swipeleft":"swiperight");j=o=d})})}};(function(e){function i(){var o=k();if(o!==j){j=o;h.trigger("orientationchange")}}var h=e(window),k,j;e.event.special.orientationchange={setup:function(){if(e.support.orientation)return false;j=k();h.bind("resize",i)},teardown:function(){if(e.support.orientation)return false;h.unbind("resize",i)},  
add:function(o){var p=o.handler;o.handler=function(t){t.orientation=k();return p.apply(this,arguments)}}};k=function(){var o=document.documentElement;return o&&o.clientWidth/o.clientHeight<1.1?"portrait":"landscape"}})(jQuery);a.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe",swiperight:"swipe"},function(e,i){a.event.special[e]={setup:function(){a(this).bind(i,a.noop)}}})})(jQuery);  
(function(a,d,c){function f(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}var b="hashchange",g=document,e,i=a.event.special,h=g.documentMode,k="on"+b in d&&(h===c||h>7);a.fn[b]=function(j){return j?this.bind(b,j):this.trigger(b)};a.fn[b].delay=50;i[b]=a.extend(i[b],{setup:function(){if(k)return false;a(e.start)},teardown:function(){if(k)return false;a(e.stop)}});e=function(){function j(){var n=f(),u=r(t);if(n!==t){m(t=n,u);a(d).trigger(b)}else if(u!==t)location.href=location.href.replace(/#.*/,  
"")+u;p=setTimeout(j,a.fn[b].delay)}var o={},p,t=f(),v=function(n){return n},m=v,r=v;o.start=function(){p||j()};o.stop=function(){p&&clearTimeout(p);p=c};a.browser.msie&&!k&&function(){var n,u;o.start=function(){if(!n){u=(u=a.fn[b].src)&&u+f();n=a('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){u||m(f());j()}).attr("src",u||"javascript:0").insertAfter("body")[0].contentWindow;g.onpropertychange=function(){try{if(event.propertyName==="title")n.document.title=g.title}catch(l){}}}};  
o.stop=v;r=function(){return f(n.location.href)};m=function(l,s){var q=n.document,w=a.fn[b].domain;if(l!==s){q.title=g.title;q.open();w&&q.write('<script>document.domain="'+w+'"<\/script>');q.close();n.location.hash=l}}}();return o}()})(jQuery,this);  
(function(a){a.widget("mobile.page",a.mobile.widget,{options:{backBtnText:"Back",addBackBtn:true,degradeInputs:{color:false,date:false,datetime:false,"datetime-local":false,email:false,month:false,number:false,range:"number",search:true,tel:false,time:false,url:false,week:false},keepNative:null},_create:function(){var d=this.element,c=this.options;this.keepNative="[data-role='none'], [data-role='nojs']"+(c.keepNative?", "+c.keepNative:"");if(this._trigger("beforeCreate")!==false){d.find("[data-role='page'], [data-role='content']").andSelf().each(function(){a(this).addClass("ui-"+  
a(this).data("role"))});d.find("[data-role='nojs']").addClass("ui-nojs");d.find("[data-role]").andSelf().each(function(){var f=a(this),b=f.data("role"),g=f.data("theme");if(b==="header"||b==="footer"){f.addClass("ui-bar-"+(g||f.parent("[data-role=page]").data("theme")||"a"));f.attr("role",b==="header"?"banner":"contentinfo");g=f.children("a");var e=g.hasClass("ui-btn-left"),i=g.hasClass("ui-btn-right");if(!e)e=g.eq(0).not(".ui-btn-right").addClass("ui-btn-left").length;i||g.eq(1).addClass("ui-btn-right");  
c.addBackBtn&&b==="header"&&a(".ui-page").length>1&&d.data("url")!==a.mobile.path.stripHash(location.hash)&&!e&&f.data("backbtn")!==false&&a("<a href='#' class='ui-btn-left' data-rel='back' data-icon='arrow-l'>"+c.backBtnText+"</a>").prependTo(f);f.children("h1, h2, h3, h4, h5, h6").addClass("ui-title").attr({tabindex:"0",role:"heading","aria-level":"1"})}else if(b==="content"){g&&f.addClass("ui-body-"+g);f.attr("role","main")}else if(b==="page")f.addClass("ui-body-"+(g||"c"));switch(b){case "header":case "footer":case "page":case "content":f.addClass("ui-"+  
b);break;case "collapsible":case "fieldcontain":case "navbar":case "listview":case "dialog":f[b]()}});this._enhanceControls();d.find("[data-role='button'], .ui-bar > a, .ui-header > a, .ui-footer > a").not(".ui-btn").not(this.keepNative).buttonMarkup();d.find("[data-role='controlgroup']").controlgroup();d.find("a:not(.ui-btn):not(.ui-link-inherit)").not(this.keepNative).addClass("ui-link");d.fixHeaderFooter()}},_enhanceControls:function(){var d=this.options;this.element.find("input").not(this.keepNative).each(function(){var b=  
this.getAttribute("type"),g=d.degradeInputs[b]||"text";d.degradeInputs[b]&&a(this).replaceWith(a("<div>").html(a(this).clone()).html().replace(/type="([a-zA-Z]+)"/,"type="+g+" data-type='$1'"))});var c=this.element.find("input, textarea, select, button"),f=c.not(this.keepNative);c=c.filter("input[type=text]");c.length&&typeof c[0].autocorrect!=="undefined"&&c.each(function(){this.setAttribute("autocorrect","off");this.setAttribute("autocomplete","off")});f.filter("[type='radio'], [type='checkbox']").checkboxradio();  
f.filter("button, [type='button'], [type='submit'], [type='reset'], [type='image']").button();f.filter("input, textarea").not("[type='radio'], [type='checkbox'], [type='button'], [type='submit'], [type='reset'], [type='image'], [type='hidden']").textinput();f.filter("input, select").filter("[data-role='slider'], [data-type='range']").slider();f.filter("select:not([data-role='slider'])").selectmenu()}})})(jQuery);  
(function(a,d,c){a.extend(a.mobile,{subPageUrlKey:"ui-page",nonHistorySelectors:"dialog",activePageClass:"ui-page-active",activeBtnClass:"ui-btn-active",ajaxEnabled:true,hashListeningEnabled:true,ajaxLinksEnabled:true,ajaxFormsEnabled:true,defaultTransition:"slide",loadingMessage:"loading",metaViewportContent:"width=device-width, minimum-scale=1, maximum-scale=1",gradeA:function(){return a.support.mediaquery},autoInitialize:true,keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,  
COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});a(d.document).trigger("mobileinit");if(a.mobile.gradeA()){var f=a(d),b=a("html"),g=a("head"),e=a.mobile.loadingMessage?a("<div class='ui-loader ui-body-a ui-corner-all'><span class='ui-icon ui-icon-loading spin'></span><h1>"+  
a.mobile.loadingMessage+"</h1></div>"):c;b.addClass("ui-mobile ui-mobile-rendering");a.mobile.metaViewportContent&&a("<meta>",{name:"viewport",content:a.mobile.metaViewportContent}).prependTo(g);a.extend(a.mobile,{pageLoading:function(i){if(i)b.removeClass("ui-loading");else{if(a.mobile.loadingMessage){i=a("."+a.mobile.activeBtnClass).first();e.appendTo(a.mobile.pageContainer).css({top:a.support.scrollTop&&a(d).scrollTop()+a(d).height()/2||i.length&&i.offset().top||100})}b.addClass("ui-loading")}},  
silentScroll:function(i){i=i||0;a.event.special.scrollstart.enabled=false;setTimeout(function(){d.scrollTo(0,i);a(document).trigger("silentscroll",{x:0,y:i})},20);setTimeout(function(){a.event.special.scrollstart.enabled=true},150)},initializePage:function(){var i=a("[data-role='page']");i.add("[data-role='dialog']").each(function(){a(this).attr("data-url",a(this).attr("id"))});a.mobile.firstPage=i.first();a.mobile.pageContainer=i.first().parent().addClass("ui-mobile-viewport");a.mobile.pageLoading();  
!a.mobile.hashListeningEnabled||!a.mobile.path.stripHash(location.hash)?a.mobile.changePage(a.mobile.firstPage,false,true,false,true):f.trigger("hashchange",[true])}});a.mobile.autoInitialize&&a(a.mobile.initializePage);f.load(a.mobile.silentScroll)}})(jQuery,this);  
(function(a,d){function c(l){if(i&&(!i.closest(".ui-page-active").length||l))i.removeClass(a.mobile.activeBtnClass);i=null}var f=a(window),b=a("html"),g=a("head"),e={get:function(l){if(l==d)l=location.hash;return e.stripHash(l).replace(/[^\/]*\.[^\/*]+$/,"")},getFilePath:function(l){var s="&"+a.mobile.subPageUrlKey;return l&&l.split(s)[0].split(t)[0]},set:function(l){location.hash=l},origin:"",setOrigin:function(){e.origin=e.get(location.protocol+"//"+location.host+location.pathname)},makeAbsolute:function(l){return e.get()+  
l},clean:function(l){return l.replace(location.protocol+"//"+location.host,"")},stripHash:function(l){return l.replace(/^#/,"")},isExternal:function(l){return e.hasProtocol(e.clean(l))},hasProtocol:function(l){return/^(:?\w+:)/.test(l)},isRelative:function(l){return/^[^\/|#]/.test(l)&&!e.hasProtocol(l)},isEmbeddedPage:function(l){return/^#/.test(l)}},i=null,h={stack:[],activeIndex:0,getActive:function(){return h.stack[h.activeIndex]},getPrev:function(){return h.stack[h.activeIndex-1]},getNext:function(){return h.stack[h.activeIndex+  
1]},addNew:function(l,s){h.getNext()&&h.clearForward();h.stack.push({url:l,transition:s});h.activeIndex=h.stack.length-1},clearForward:function(){h.stack=h.stack.slice(0,h.activeIndex+1)},ignoreNextHashChange:true},k="[tabindex],a,button:visible,select:visible,input",j=null,o=[],p=false,t="&ui-state=dialog",v=g.children("base"),m=location.protocol+"//"+location.host,r=e.get(m+location.pathname),n=r;if(v.length){var u=v.attr("href");if(u)n=u.search(/^[^:/]+:\/\/[^/]+\/?/)==-1?u.charAt(0)=="/"?m+u:  
r+u:u;n+=n.charAt(n.length-1)=="/"?" ":"/"}base=a.support.dynamicBaseTag?{element:v.length?v:a("<base>",{href:n}).prependTo(g),set:function(l){base.element.attr("href",n+e.get(l))},reset:function(){base.element.attr("href",n)}}:d;e.setOrigin();a.fn.animationComplete=function(l){if(a.support.cssTransitions)return a(this).one("webkitAnimationEnd",l);else setTimeout(l,0)};a.mobile.updateHash=e.set;a.mobile.path=e;a.mobile.base=base;a.mobile.urlstack=h.stack;a.mobile.urlHistory=h;a.mobile.changePage=  
function(l,s,q,w,z){function F(){function A(){if(w!==false&&x){h.ignoreNextHashChange=false;e.set(x)}!I&&!K&&h.addNew(x,s);c();a.mobile.silentScroll(l.data("lastScroll"));var G=l,P=G.find(".ui-title:eq(0)");P.length?P.focus():G.find(k).eq(0).focus();y&&y.data("page")._trigger("hide",null,{nextPage:l});l.data("page")._trigger("show",null,{prevPage:y||a("")});a.mobile.activePage=l;L!=null&&L.remove();b.removeClass("ui-mobile-rendering");p=false;o.length>0&&a.mobile.changePage.apply(a.mobile,o.pop())}  
function B(G){a.mobile.pageContainer.addClass(G);D.push(G)}a.mobile.silentScroll();var M=f.scrollTop(),J=["flip"],D=[];if(x.indexOf("&"+a.mobile.subPageUrlKey)>-1)l=a("[data-url='"+x+"']");if(y){y.data("lastScroll",M);y.data("page")._trigger("beforehide",{nextPage:l})}l.data("page")._trigger("beforeshow",{prevPage:y||a("")});if(s&&s!=="none"){a.mobile.pageLoading(true);a.inArray(s,J)>=0&&B("ui-mobile-viewport-perspective");B("ui-mobile-viewport-transitioning");if(y)y.addClass(s+" out "+(q?"reverse":  
""));l.addClass(a.mobile.activePageClass+" "+s+" in "+(q?"reverse":""));l.animationComplete(function(){y.add(l).removeClass("out in reverse "+s);y&&y.removeClass(a.mobile.activePageClass);A();a.mobile.pageContainer.removeClass(D.join(" "));D=[]})}else{a.mobile.pageLoading(true);y&&y.removeClass(a.mobile.activePageClass);l.addClass(a.mobile.activePageClass);A()}}function Q(){if(j||l.data("role")=="dialog"){x=h.getActive().url+t;if(j){l.attr("data-role",j);j=null}}l.page()}var E=a.type(l)==="array",  
H=a.type(l)==="object",y=E?l[0]:a.mobile.activePage;l=E?l[1]:l;var x=fileUrl=a.type(l)==="string"?e.stripHash(l):"",C=d,N="get",R=false,L=null,O=h.getActive(),I=false,K=false;if(!(O&&h.stack.length>1&&O.url===x&&!E&&!H))if(p)o.unshift(arguments);else{p=true;if(z){a.each(h.stack,function(A){if(this.url==x){urlIndex=A;I=A<h.activeIndex;K=!I;h.activeIndex=A}});if(I){q=true;s=s||O.transition}else if(K)s=s||h.getActive().transition}if(H&&l.url){x=l.url;C=l.data;N=l.type;R=true;if(C&&N=="get"){if(a.type(C)==  
"object")C=a.param(C);x+="?"+C;C=d}}base&&base.reset();a(window.document.activeElement).add("input:focus, textarea:focus, select:focus").blur();if(x){l=a("[data-url='"+x+"']");fileUrl=e.getFilePath(x)}else{E=l.attr("data-url");H=e.getFilePath(E);if(E!=H)fileUrl=H}if(s===d)s=a.mobile.defaultTransition;if(l.length&&!R){fileUrl&&base&&base.set(fileUrl);Q();F()}else{if(l.length)L=l;a.mobile.pageLoading();a.ajax({url:fileUrl,type:N,data:C,success:function(A){var B=/ data-url="(.*)"/.test(A)&&RegExp.$1;  
if(B){base&&base.set(B);x=fileUrl=e.getFilePath(B)}else base&&base.set(fileUrl);B=a("<div></div>");B.get(0).innerHTML=A;l=B.find('[data-role="page"], [data-role="dialog"]').first();if(!a.support.dynamicBaseTag){var M=e.get(fileUrl);l.find("[src],link[href]").each(function(){var J=a(this).is("[href]")?"href":"src",D=a(this).attr(J);D.replace(location.protocol+"//"+location.host+location.pathname,"");/^(\w+:|#|\/)/.test(D)||a(this).attr(J,M+D)})}l.attr("data-url",fileUrl).appendTo(a.mobile.pageContainer);  
Q();setTimeout(function(){F()},0)},error:function(){a.mobile.pageLoading(true);c(true);base&&base.set(e.get());a("<div class='ui-loader ui-overlay-shadow ui-body-e ui-corner-all'><h1>Error Loading Page</h1></div>").css({display:"block",opacity:0.96,top:a(window).scrollTop()+100}).appendTo(a.mobile.pageContainer).delay(800).fadeOut(400,function(){a(this).remove()})}})}}};a("form[data-ajax!='false']").live("submit",function(l){if(a.mobile.ajaxEnabled&&a.mobile.ajaxFormsEnabled){var s=a(this).attr("method"),  
q=e.clean(a(this).attr("action"));if(!e.isExternal(q)){if(e.isRelative(q))q=e.makeAbsolute(q);a.mobile.changePage({url:q,type:s,data:a(this).serialize()},d,d,true);l.preventDefault()}}});a("a").live("click",function(l){var s=a(this),q=s.attr("href")||"#";q=e.clean(q);var w=s.is("[rel='external']"),z=e.isEmbeddedPage(q);w=e.isExternal(q)||w&&!z;z=s.is("[target]");var F=s.is("[data-ajax='false']");if(s.is("[data-rel='back']")){window.history.back();return false}if(q==="#")return false;i=s.closest(".ui-btn").addClass(a.mobile.activeBtnClass);  
if(w||F||z||!a.mobile.ajaxEnabled||!a.mobile.ajaxLinksEnabled){c(true);if(z)window.open(q);else if(F)return;else location.href=q}else{w=s.data("transition");z=(z=s.data("direction"))&&z=="reverse"||s.data("back");j=s.attr("data-rel");if(e.isRelative(q))q=e.makeAbsolute(q);q=e.stripHash(q);a.mobile.changePage(q,w,z)}l.preventDefault()});f.bind("hashchange",function(){var l=e.stripHash(location.hash),s=a.mobile.urlHistory.stack.length===0?false:d;if(!a.mobile.hashListeningEnabled||!h.ignoreNextHashChange||  
h.stack.length>1&&l.indexOf(t)>-1&&!a.mobile.activePage.is(".ui-dialog")){if(!h.ignoreNextHashChange)h.ignoreNextHashChange=true}else l?a.mobile.changePage(l,s,d,false,true):a.mobile.changePage(a.mobile.firstPage,s,true,false,true)})})(jQuery);  
(function(a,d){a.fn.fixHeaderFooter=function(){if(!a.support.scrollTop)return this;return this.each(function(){var c=a(this);c.data("fullscreen")&&c.addClass("ui-page-fullscreen");c.find('.ui-header[data-position="fixed"]').addClass("ui-header-fixed ui-fixed-inline fade");c.find('.ui-footer[data-position="fixed"]').addClass("ui-footer-fixed ui-fixed-inline fade")})};a.fixedToolbars=function(){function c(){if(!e&&g=="overlay"){i||a.fixedToolbars.hide(true);a.fixedToolbars.startShowTimer()}}function f(m){var r=  
0;if(m){var n=m.offsetParent,u=document.body;for(r=m.offsetTop;m&&m!=u;){r+=m.scrollTop||0;if(m==n){r+=n.offsetTop;n=m.offsetParent}m=m.parentNode}}return r}function b(m){var r=a(window).scrollTop(),n=f(m[0]),u=m.css("top")=="auto"?0:parseFloat(m.css("top")),l=window.innerHeight,s=m.outerHeight(),q=m.parents(".ui-page:not(.ui-page-fullscreen)").length;if(m.is(".ui-header-fixed")){u=r-n+u;if(u<n)u=0;return m.css("top",q?u:r)}else{u=r+l-s-(n-u);return m.css("top",q?u:r+l-s)}}if(a.support.scrollTop){var g=  
"inline",e=false,i,h,k=a.support.touch,j=k?"touchstart":"mousedown",o=k?"touchend":"mouseup",p=null,t=false,v=true;a(function(){a(document).bind(j,function(m){if(v)a(m.target).closest("a,input,textarea,select,button,label,.ui-header-fixed,.ui-footer-fixed").length||(p=g)}).bind(o,function(m){if(v)if(!a(m.target).closest("a,input,textarea,select,button,label,.ui-header-fixed,.ui-footer-fixed").length)if(!t){a.fixedToolbars.toggle(p);p=null}}).bind("scrollstart",function(m){if(!a(m.target).closest("a,input,textarea,select,button,label,.ui-header-fixed,.ui-footer-fixed").length){t=  
true;if(p==null)p=g;if(e=(m=p=="overlay")||!!i){a.fixedToolbars.clearShowTimer();m&&a.fixedToolbars.hide(true)}}}).bind("scrollstop",function(m){if(!a(m.target).closest("a,input,textarea,select,button,label,.ui-header-fixed,.ui-footer-fixed").length){t=false;if(e){e=false;a.fixedToolbars.startShowTimer()}p=null}}).bind("silentscroll",c);a(window).bind("resize",c)});a(".ui-page").live("pagebeforeshow",function(m){m=a(m.target).find('[data-role="footer"]:not(.ui-sticky-footer)');var r=m.data("id");  
h=null;if(r){h=a('.ui-footer[data-id="'+r+'"].ui-sticky-footer');if(h.length==0){h=m;m=h.clone();h.addClass("ui-sticky-footer").before(m)}m.addClass("ui-footer-duplicate");h.appendTo(a.pageContainer).css("top",0);b(h)}});a(".ui-page").live("pageshow",function(m){h&&h.length&&h.appendTo(m.target).css("top",0);a.fixedToolbars.show(true,this)});return{show:function(m,r){a.fixedToolbars.clearShowTimer();g="overlay";return(r?a(r):a.mobile.activePage?a.mobile.activePage:a(".ui-page-active")).children(".ui-header-fixed:first, .ui-footer-fixed:not(.ui-footer-duplicate):last").each(function(){var n=  
a(this),u=a(window).scrollTop(),l=f(n[0]),s=window.innerHeight,q=n.outerHeight();u=n.is(".ui-header-fixed")&&u<=l+q||n.is(".ui-footer-fixed")&&l<=u+s;n.addClass("ui-fixed-overlay").removeClass("ui-fixed-inline");!u&&!m&&n.animationComplete(function(){n.removeClass("in")}).addClass("in");b(n)})},hide:function(m){g="inline";return(a.mobile.activePage?a.mobile.activePage:a(".ui-page-active")).children(".ui-header-fixed:first, .ui-footer-fixed:not(.ui-footer-duplicate):last").each(function(){var r=a(this),  
n=r.css("top");n=n=="auto"?0:parseFloat(n);r.addClass("ui-fixed-inline").removeClass("ui-fixed-overlay");if(n<0||r.is(".ui-header-fixed")&&n!=0)if(m)r.css("top",0);else r.css("top")!=="auto"&&parseFloat(r.css("top"))!==0&&r.animationComplete(function(){r.removeClass("out reverse");r.css("top",0)}).addClass("out reverse")})},startShowTimer:function(){a.fixedToolbars.clearShowTimer();var m=a.makeArray(arguments);i=setTimeout(function(){i=d;a.fixedToolbars.show.apply(null,m)},100)},clearShowTimer:function(){i&&  
clearTimeout(i);i=d},toggle:function(m){if(m)g=m;return g=="overlay"?a.fixedToolbars.hide():a.fixedToolbars.show()},setTouchToggleEnabled:function(m){v=m}}}}()})(jQuery);  
(function(a,d){a.widget("mobile.checkboxradio",a.mobile.widget,{options:{theme:null},_create:function(){var c=this,f=this.element,b=f.closest("form,fieldset,[data-role='page']").find("label[for='"+f.attr("id")+"']"),g=f.attr("type"),e="ui-icon-"+g+"-off";if(!(g!="checkbox"&&g!="radio")){if(!this.options.theme)this.options.theme=this.element.data("theme");b.buttonMarkup({theme:this.options.theme,icon:this.element.parents("[data-type='horizontal']").length?d:e,shadow:false});f.add(b).wrapAll("<div class='ui-"+  
g+"'></div>");b.bind({mouseover:function(){if(a(this).parent().is(".ui-disabled"))return false},touchmove:function(i){i=i.originalEvent.touches[0];if(b.data("movestart")){if(Math.abs(b.data("movestart")[0]-i.pageX)>10||Math.abs(abel.data("movestart")[1]-i.pageY)>10)b.data("moved",true)}else b.data("movestart",[parseFloat(i.pageX),parseFloat(i.pageY)])},"touchend mouseup":function(i){b.removeData("movestart");if(b.data("etype")&&b.data("etype")!==i.type||b.data("moved")){b.removeData("etype").removeData("moved");  
b.data("moved")&&b.removeData("moved");return false}b.data("etype",i.type);c._cacheVals();f.attr("checked",g==="radio"&&true||!f.is(":checked"));c._updateAll();i.preventDefault()},click:false});f.bind({mousedown:function(){this._cacheVals()},click:function(){c._updateAll()},focus:function(){b.addClass("ui-focus")},blur:function(){b.removeClass("ui-focus")}});this.refresh()}},_cacheVals:function(){this._getInputSet().each(function(){a(this).data("cacheVal",a(this).is(":checked"))})},_getInputSet:function(){return this.element.closest("form,fieldset,[data-role='page']").find("input[name='"+  
this.element.attr("name")+"'][type='"+this.element.attr("type")+"']")},_updateAll:function(){this._getInputSet().each(function(){var c=a(this).data("cacheVal");if(c&&c!==a(this).is(":checked")||a(this).is("[type='checkbox']"))a(this).trigger("change")}).checkboxradio("refresh")},refresh:function(){var c=this.element,f=c.closest("form,fieldset,[data-role='page']").find("label[for='"+c.attr("id")+"']"),b=c.attr("type"),g=f.find(".ui-icon"),e="ui-icon-"+b+"-on";b="ui-icon-"+b+"-off";if(c[0].checked){f.addClass("ui-btn-active");  
g.addClass(e);g.removeClass(b)}else{f.removeClass("ui-btn-active");g.removeClass(e);g.addClass(b)}c.is(":disabled")?this.disable():this.enable()},disable:function(){this.element.attr("disabled",true).parent().addClass("ui-disabled")},enable:function(){this.element.attr("disabled",false).parent().removeClass("ui-disabled")}})})(jQuery);  
(function(a){a.widget("mobile.textinput",a.mobile.widget,{options:{theme:null},_create:function(){var d=this.element,c=this.options,f=c.theme;if(!f){f=this.element.closest("[class*='ui-bar-'],[class*='ui-body-']");f=f.length?/ui-(bar|body)-([a-z])/.exec(f.attr("class"))[2]:"c"}f=" ui-body-"+f;a("label[for="+d.attr("id")+"]").addClass("ui-input-text");d.addClass("ui-input-text ui-body-"+c.theme);var b=d;if(d.is('[type="search"],[data-type="search"]')){b=d.wrap('<div class="ui-input-search ui-shadow-inset ui-btn-corner-all ui-btn-shadow ui-icon-searchfield'+  
f+'"></div>').parent();var g=a('<a href="#" class="ui-input-clear" title="clear text">clear text</a>').tap(function(h){d.val("").focus();d.trigger("change");g.addClass("ui-input-clear-hidden");h.preventDefault()}).appendTo(b).buttonMarkup({icon:"delete",iconpos:"notext",corners:true,shadow:true});c=function(){d.val()==""?g.addClass("ui-input-clear-hidden"):g.removeClass("ui-input-clear-hidden")};c();d.keyup(c)}else d.addClass("ui-corner-all ui-shadow-inset"+f);d.focus(function(){b.addClass("ui-focus")}).blur(function(){b.removeClass("ui-focus")});  
if(d.is("textarea")){var e=function(){var h=d[0].scrollHeight;d[0].clientHeight<h&&d.css({height:h+15})},i;d.keyup(function(){clearTimeout(i);i=setTimeout(e,100)})}},disable:function(){(this.element.attr("disabled",true).is('[type="search"],[data-type="search"]')?this.element.parent():this.element).addClass("ui-disabled")},enable:function(){(this.element.attr("disabled",false).is('[type="search"],[data-type="search"]')?this.element.parent():this.element).removeClass("ui-disabled")}})})(jQuery);  
(function(a){a.widget("mobile.selectmenu",a.mobile.widget,{options:{theme:null,disabled:false,icon:"arrow-d",iconpos:"right",inline:null,corners:true,shadow:true,iconshadow:true,menuPageTheme:"b",overlayTheme:"a",hidePlaceholderMenuItems:true,closeText:"Close",nativeMenu:false},_create:function(){var d=this,c=this.options,f=this.element.wrap("<div class='ui-select'>"),b=f.attr("id"),g=a("label[for="+b+"]").addClass("ui-select"),e=(d.options.nativeMenu?a("<div/>"):a("<a>",{href:"#",role:"button",id:k,  
"aria-haspopup":"true","aria-owns":j})).text(a(f[0].options.item(f[0].selectedIndex)).text()).insertBefore(f).buttonMarkup({theme:c.theme,icon:c.icon,iconpos:c.iconpos,inline:c.inline,corners:c.corners,shadow:c.shadow,iconshadow:c.iconshadow}),i=d.isMultiple=f[0].multiple;c.nativeMenu&&window.opera&&window.opera.version&&f.addClass("ui-select-nativeonly");if(!c.nativeMenu){var h=f.find("option"),k=b+"-button",j=b+"-menu",o=f.closest(".ui-page"),p=/ui-btn-up-([a-z])/.exec(e.attr("class"))[1],t=a("<div data-role='dialog' data-theme='"+  
c.menuPageTheme+"'><div data-role='header'><div class='ui-title'>"+g.text()+"</div></div><div data-role='content'></div></div>").appendTo(a.mobile.pageContainer).page(),v=t.find(".ui-content"),m=t.find(".ui-header a"),r=a("<div>",{"class":"ui-selectmenu-screen ui-screen-hidden"}).appendTo(o),n=a("<div>",{"class":"ui-selectmenu ui-selectmenu-hidden ui-overlay-shadow ui-corner-all pop ui-body-"+c.overlayTheme}).insertAfter(r),u=a("<ul>",{"class":"ui-selectmenu-list",id:j,role:"listbox","aria-labelledby":k,  
"data-theme":p}).appendTo(n);p=a("<div>",{"class":"ui-header ui-bar-"+p}).prependTo(n);var l=a("<h1>",{"class":"ui-title"}).appendTo(p),s=a("<a>",{"data-iconpos":"notext","data-icon":"delete",text:c.closeText,href:"#","class":"ui-btn-left"}).appendTo(p).buttonMarkup()}if(i)d.buttonCount=a("<span>").addClass("ui-li-count ui-btn-up-c ui-btn-corner-all").hide().appendTo(e);c.disabled&&this.disable();f.change(function(){d.refresh()});a.extend(d,{select:f,optionElems:h,selectID:b,label:g,buttonId:k,menuId:j,  
thisPage:o,button:e,menuPage:t,menuPageContent:v,screen:r,listbox:n,list:u,menuType:void 0,header:p,headerClose:s,headerTitle:l,placeholder:""});if(c.nativeMenu){f.appendTo(e).bind("touchstart mousedown",function(){e.addClass(a.mobile.activeBtnClass)}).bind("focus mouseover",function(){e.trigger("mouseover")}).bind("touchmove",function(){e.removeClass(a.mobile.activeBtnClass)}).bind("change blur mouseout",function(){e.trigger("mouseout").removeClass(a.mobile.activeBtnClass)});e.attr("tabindex","-1")}else{d.refresh();  
f.attr("tabindex","-1").focus(function(){a(this).blur();e.focus()});e.bind("touchstart",function(q){a(this).data("startTouches",a.extend({},q.originalEvent.touches[0]))}).bind(a.support.touch?"touchend":"mouseup",function(q){a(this).data("moved")?a(this).removeData("moved"):d.open();q.preventDefault()}).bind("touchmove",function(q){q=q.originalEvent.touches[0];var w=a(this).data("startTouches"),z=Math.abs(q.pageY-w.pageY);if(Math.abs(q.pageX-w.pageX)>10||z>10)a(this).data("moved",true)});u.delegate("li:not(.ui-disabled, .ui-li-divider)",  
"click",function(q){if(a(q.target).is("a")){var w=u.find("li:not(.ui-li-divider)").index(this);w=d.optionElems.eq(w)[0];w.selected=i?!w.selected:true;i&&a(this).find(".ui-icon").toggleClass("ui-icon-checkbox-on",w.selected).toggleClass("ui-icon-checkbox-off",!w.selected);f.trigger("change");i||d.close();q.preventDefault()}});r.add(s).add(m).bind("click",function(q){d.close();q.preventDefault();a.contains(m[0],q.target)&&q.stopImmediatePropagation()})}},_buildList:function(){var d=this,c=this.options,  
f=this.placeholder,b=[],g=[],e=d.isMultiple?"checkbox-off":"false";d.list.empty().filter(".ui-listview").listview("destroy");d.select.find("option").each(function(){var i=a(this),h=i.parent(),k=i.text(),j="<a href='#'>"+k+"</a>",o=[],p=[];if(h.is("optgroup")){h=h.attr("label");if(a.inArray(h,b)===-1){g.push("<li data-role='list-divider'>"+h+"</li>");b.push(h)}}if(!this.getAttribute("value")||k.length==0||i.data("placeholder")){c.hidePlaceholderMenuItems&&o.push("ui-selectmenu-placeholder");f=d.placeholder=  
k}if(this.disabled){o.push("ui-disabled");p.push("aria-disabled='true'")}g.push("<li data-icon='"+e+"' class='"+o.join(" ")+"' "+p.join(" ")+">"+j+"</li>")});d.list.html(g.join(" "));this.isMultiple||this.headerClose.hide();!this.isMultiple&&!f.length?this.header.hide():this.headerTitle.text(this.placeholder);d.list.listview()},refresh:function(d){var c=this,f=this.element,b=this.isMultiple,g=this.optionElems=f.find("option"),e=g.filter(":selected"),i=e.map(function(){return g.index(this)}).get();  
if(!c.options.nativeMenu&&(d||f[0].options.length>c.list.find("li").length))c._buildList();c.button.find(".ui-btn-text").text(function(){if(!b)return e.text();return e.length?e.map(function(){return a(this).text()}).get().join(", "):c.placeholder});if(b)c.buttonCount[e.length>1?"show":"hide"]().text(e.length);c.options.nativeMenu||c.list.find("li:not(.ui-li-divider)").removeClass(a.mobile.activeBtnClass).attr("aria-selected",false).each(function(h){if(a.inArray(h,i)>-1){h=a(this).addClass(a.mobile.activeBtnClass);  
h.find("a").attr("aria-selected",true);b&&h.find(".ui-icon").removeClass("ui-icon-checkbox-off").addClass("ui-icon-checkbox-on")}})},open:function(){function d(){c.list.find(".ui-btn-active").focus()}if(!(this.options.disabled||this.options.nativeMenu)){var c=this,f=c.list.outerHeight(),b=c.list.outerWidth(),g=a(window).scrollTop(),e=c.button.offset().top,i=window.innerHeight,h=c.list.parents(".ui-dialog").length;c.button.addClass(a.mobile.activeBtnClass);if(h||f>i-80||!a.support.scrollTop){g==0&&  
e>i&&c.thisPage.one("pagehide",function(){a(this).data("lastScroll",e)});c.menuPage.one("pageshow",function(){a(window).one("silentscroll",function(){d()})});c.menuType="page";c.menuPageContent.append(c.list);a.mobile.changePage(c.menuPage,"pop",false,true)}else{c.menuType="overlay";c.screen.height(a(document).height()).removeClass("ui-screen-hidden");h=e-g;var k=g+i-e,j=f/2;f=h>f/2&&k>f/2?e+c.button.outerHeight()/2-j:h>k?g+i-f-30:g+30;b=c.button.offset().left+c.button.outerWidth()/2-b/2;c.listbox.append(c.list).removeClass("ui-selectmenu-hidden").css({top:f,  
left:b}).addClass("in");d()}setTimeout(function(){c.isOpen=true},400)}},close:function(){function d(){setTimeout(function(){c.button.focus();c.button.removeClass(a.mobile.activeBtnClass)},40);c.listbox.removeAttr("style").append(c.list)}if(!(this.options.disabled||!this.isOpen||this.options.nativeMenu)){var c=this;if(c.menuType=="page"){a.mobile.changePage([c.menuPage,c.thisPage],"pop",true,false);c.menuPage.one("pagehide",d)}else{c.screen.addClass("ui-screen-hidden");c.listbox.addClass("ui-selectmenu-hidden").removeAttr("style").removeClass("in");  
d()}this.isOpen=false}},disable:function(){this.element.attr("disabled",true);this.button.addClass("ui-disabled").attr("aria-disabled",true);return this._setOption("disabled",true)},enable:function(){this.element.attr("disabled",false);this.button.removeClass("ui-disabled").attr("aria-disabled",false);return this._setOption("disabled",false)}})})(jQuery);  
(function(a){a.fn.buttonMarkup=function(c){return this.each(function(){var f=a(this),b=a.extend({},a.fn.buttonMarkup.defaults,f.data(),c),g,e="ui-btn-inner",i;d&&d();if(!b.theme){g=f.closest("[class*='ui-bar-'],[class*='ui-body-']");b.theme=g.length?/ui-(bar|body)-([a-z])/.exec(g.attr("class"))[2]:"c"}g="ui-btn ui-btn-up-"+b.theme;if(b.inline)g+=" ui-btn-inline";if(b.icon){b.icon="ui-icon-"+b.icon;b.iconpos=b.iconpos||"left";i="ui-icon "+b.icon;if(b.shadow)i+=" ui-icon-shadow"}if(b.iconpos){g+=" ui-btn-icon-"+  
b.iconpos;b.iconpos=="notext"&&!f.attr("title")&&f.attr("title",f.text())}if(b.corners){g+=" ui-btn-corner-all";e+=" ui-btn-corner-all"}if(b.shadow)g+=" ui-shadow";f.attr("data-theme",b.theme).addClass(g);b=("<D class='"+e+"'><D class='ui-btn-text'></D>"+(b.icon?"<span class='"+i+"'></span>":"")+"</D>").replace(/D/g,b.wrapperEls);f.wrapInner(b)})};a.fn.buttonMarkup.defaults={corners:true,shadow:true,iconshadow:true,wrapperEls:"span"};var d=function(){a(".ui-btn:not(.ui-disabled)").live({"touchstart mousedown":function(){var c=  
a(this).attr("data-theme");a(this).removeClass("ui-btn-up-"+c).addClass("ui-btn-down-"+c)},"touchmove touchend mouseup":function(){var c=a(this).attr("data-theme");a(this).removeClass("ui-btn-down-"+c).addClass("ui-btn-up-"+c)},"mouseover focus":function(){var c=a(this).attr("data-theme");a(this).removeClass("ui-btn-up-"+c).addClass("ui-btn-hover-"+c)},"mouseout blur":function(){var c=a(this).attr("data-theme");a(this).removeClass("ui-btn-hover-"+c).addClass("ui-btn-up-"+c)}});d=null}})(jQuery);  
(function(a){a.widget("mobile.button",a.mobile.widget,{options:{theme:null,icon:null,iconpos:null,inline:null,corners:true,shadow:true,iconshadow:true},_create:function(){var d=this.element,c=this.options;this.button=a("<div></div>").text(d.text()||d.val()).buttonMarkup({theme:c.theme,icon:c.icon,iconpos:c.iconpos,inline:c.inline,corners:c.corners,shadow:c.shadow,iconshadow:c.iconshadow}).insertBefore(d).append(d.addClass("ui-btn-hidden"));d.attr("type")!=="reset"&&d.click(function(){var f=a("<input>",  
{type:"hidden",name:d.attr("name"),value:d.attr("value")}).insertBefore(d);a(document).submit(function(){f.remove()})})},enable:function(){this.element.attr("disabled",false);this.button.removeClass("ui-disabled").attr("aria-disabled",false);return this._setOption("disabled",false)},disable:function(){this.element.attr("disabled",true);this.button.addClass("ui-disabled").attr("aria-disabled",true);return this._setOption("disabled",true)}})})(jQuery);  
(function(a){a.widget("mobile.slider",a.mobile.widget,{options:{theme:null,trackTheme:null,disabled:false},_create:function(){var d=this,c=this.element,f=c.parents("[class*=ui-bar-],[class*=ui-body-]").eq(0);f=f.length?f.attr("class").match(/ui-(bar|body)-([a-z])/)[2]:"c";var b=this.options.theme?this.options.theme:f,g=this.options.trackTheme?this.options.trackTheme:f,e=c[0].nodeName.toLowerCase();f=e=="select"?"ui-slider-switch":"";var i=c.attr("id"),h=i+"-label";i=a("[for="+i+"]").attr("id",h);  
var k=function(){return e=="input"?parseFloat(c.val()):c[0].selectedIndex},j=e=="input"?parseFloat(c.attr("min")):0,o=e=="input"?parseFloat(c.attr("max")):c.find("option").length-1,p=window.parseFloat(c.attr("step")||1),t=a('<div class="ui-slider '+f+" ui-btn-down-"+g+' ui-btn-corner-all" role="application"></div>'),v=a('<a href="#" class="ui-slider-handle"></a>').appendTo(t).buttonMarkup({corners:true,theme:b,shadow:true}).attr({role:"slider","aria-valuemin":j,"aria-valuemax":o,"aria-valuenow":k(),  
"aria-valuetext":k(),title:k(),"aria-labelledby":h});a.extend(this,{slider:t,handle:v,dragging:false,beforeStart:null});if(e=="select"){t.wrapInner('<div class="ui-slider-inneroffset"></div>');c.find("option");c.find("option").each(function(m){var r=m==0?"b":"a",n=m==0?"right":"left";m=m==0?" ui-btn-down-"+g:" ui-btn-active";a('<div class="ui-slider-labelbg ui-slider-labelbg-'+r+m+" ui-btn-corner-"+n+'"></div>').prependTo(t);a('<span class="ui-slider-label ui-slider-label-'+r+m+" ui-btn-corner-"+  
n+'" role="img">'+a(this).text()+"</span>").prependTo(v)})}i.addClass("ui-slider");c.addClass(e=="input"?"ui-slider-input":"ui-slider-switch").change(function(){d.refresh(k(),true)}).keyup(function(){d.refresh(k(),true,true)}).blur(function(){d.refresh(k(),true)});a(document).bind("touchmove mousemove",function(m){if(d.dragging){d.refresh(m);return false}});t.bind("touchstart mousedown",function(m){d.dragging=true;if(e==="select")d.beforeStart=c[0].selectedIndex;d.refresh(m);return false});t.add(document).bind("touchend mouseup",  
function(){if(d.dragging){d.dragging=false;if(e==="select"){if(d.beforeStart===c[0].selectedIndex)d.refresh(d.beforeStart===0?1:0);var m=k();m=Math.round(m/(o-j)*100);v.addClass("ui-slider-handle-snapping").css("left",m+"%").animationComplete(function(){v.removeClass("ui-slider-handle-snapping")})}return false}});t.insertAfter(c);this.handle.bind("touchstart mousedown",function(){a(this).focus()});this.handle.bind("keydown",function(m){var r=k();if(!d.options.disabled){switch(m.keyCode){case a.mobile.keyCode.HOME:case a.mobile.keyCode.END:case a.mobile.keyCode.PAGE_UP:case a.mobile.keyCode.PAGE_DOWN:case a.mobile.keyCode.UP:case a.mobile.keyCode.RIGHT:case a.mobile.keyCode.DOWN:case a.mobile.keyCode.LEFT:m.preventDefault();  
if(!d._keySliding){d._keySliding=true;a(this).addClass("ui-state-active")}}switch(m.keyCode){case a.mobile.keyCode.HOME:d.refresh(j);break;case a.mobile.keyCode.END:d.refresh(o);break;case a.mobile.keyCode.PAGE_UP:case a.mobile.keyCode.UP:case a.mobile.keyCode.RIGHT:d.refresh(r+p);break;case a.mobile.keyCode.PAGE_DOWN:case a.mobile.keyCode.DOWN:case a.mobile.keyCode.LEFT:d.refresh(r-p)}}}).keyup(function(){if(d._keySliding){d._keySliding=false;a(this).removeClass("ui-state-active")}});this.refresh()},  
refresh:function(d,c,f){if(!this.options.disabled){var b=this.element,g=b[0].nodeName.toLowerCase(),e=g==="input"?parseFloat(b.attr("min")):0,i=g==="input"?parseFloat(b.attr("max")):b.find("option").length-1;if(typeof d==="object"){d=d.originalEvent.touches?d.originalEvent.touches[0]:d;if(!this.dragging||d.pageX<this.slider.offset().left-8||d.pageX>this.slider.offset().left+this.slider.width()+8)return;d=Math.round((d.pageX-this.slider.offset().left)/this.slider.width()*100)}else{if(d==null)d=g===  
"input"?parseFloat(b.val()):b[0].selectedIndex;d=(parseFloat(d)-e)/(i-e)*100}if(!isNaN(d)){if(d<0)d=0;if(d>100)d=100;var h=Math.round(d/100*(i-e))+e;if(h<e)h=e;if(h>i)h=i;this.handle.css("left",d+"%");this.handle.attr({"aria-valuenow":g==="input"?h:b.find("option").eq(h).attr("value"),"aria-valuetext":g==="input"?h:b.find("option").eq(h).text(),title:h});if(g==="select")h===0?this.slider.addClass("ui-slider-switch-a").removeClass("ui-slider-switch-b"):this.slider.addClass("ui-slider-switch-b").removeClass("ui-slider-switch-a");  
if(!f){if(g==="input")b.val(h);else b[0].selectedIndex=h;c||b.trigger("change")}}}},enable:function(){this.element.attr("disabled",false);this.slider.removeClass("ui-disabled").attr("aria-disabled",false);return this._setOption("disabled",false)},disable:function(){this.element.attr("disabled",true);this.slider.addClass("ui-disabled").attr("aria-disabled",true);return this._setOption("disabled",true)}})})(jQuery);  
(function(a){a.widget("mobile.collapsible",a.mobile.widget,{options:{expandCueText:" click to expand contents",collapseCueText:" click to collapse contents",collapsed:false,heading:">:header,>legend",theme:null,iconTheme:"d"},_create:function(){var d=this.element,c=this.options,f=d.addClass("ui-collapsible-contain"),b=d.find(c.heading).eq(0),g=f.wrapInner('<div class="ui-collapsible-content"></div>').find(".ui-collapsible-content");d=d.closest('[data-role="collapsible-set"]').addClass("ui-collapsible-set");  
if(b.is("legend")){b=a('<div role="heading">'+b.html()+"</div>").insertBefore(b);b.next().remove()}b.insertBefore(g);b.addClass("ui-collapsible-heading").append('<span class="ui-collapsible-heading-status"></span>').wrapInner('<a href="#" class="ui-collapsible-heading-toggle"></a>').find("a:eq(0)").buttonMarkup({shadow:!!!d.length,corners:false,iconPos:"left",icon:"plus",theme:c.theme}).find(".ui-icon").removeAttr("class").buttonMarkup({shadow:true,corners:true,iconPos:"notext",icon:"plus",theme:c.iconTheme});  
if(d.length)f.data("collapsible-last")&&b.find("a:eq(0), .ui-btn-inner").addClass("ui-corner-bottom");else b.find("a:eq(0)").addClass("ui-corner-all").find(".ui-btn-inner").addClass("ui-corner-all");f.bind("collapse",function(e){if(!e.isDefaultPrevented()){e.preventDefault();b.addClass("ui-collapsible-heading-collapsed").find(".ui-collapsible-heading-status").text(c.expandCueText);b.find(".ui-icon").removeClass("ui-icon-minus").addClass("ui-icon-plus");g.addClass("ui-collapsible-content-collapsed").attr("aria-hidden",  
true);f.data("collapsible-last")&&b.find("a:eq(0), .ui-btn-inner").addClass("ui-corner-bottom")}}).bind("expand",function(e){if(!e.isDefaultPrevented()){e.preventDefault();b.removeClass("ui-collapsible-heading-collapsed").find(".ui-collapsible-heading-status").text(c.collapseCueText);b.find(".ui-icon").removeClass("ui-icon-plus").addClass("ui-icon-minus");g.removeClass("ui-collapsible-content-collapsed").attr("aria-hidden",false);f.data("collapsible-last")&&b.find("a:eq(0), .ui-btn-inner").removeClass("ui-corner-bottom")}}).trigger(c.collapsed?  
"collapse":"expand");if(d.length&&!d.data("collapsiblebound")){d.data("collapsiblebound",true).bind("expand",function(e){a(this).find(".ui-collapsible-contain").not(a(e.target).closest(".ui-collapsible-contain")).not("> .ui-collapsible-contain .ui-collapsible-contain").trigger("collapse")});d=d.find("[data-role=collapsible]");d.first().find("a:eq(0)").addClass("ui-corner-top").find(".ui-btn-inner").addClass("ui-corner-top");d.last().data("collapsible-last",true)}b.bind(a.support.touch?"touchstart":  
"click",function(){b.is(".ui-collapsible-heading-collapsed")?f.trigger("expand"):f.trigger("collapse");return false})}})})(jQuery);  
(function(a){a.fn.controlgroup=function(d){return this.each(function(){function c(e){e.removeClass("ui-btn-corner-all ui-shadow").eq(0).addClass(g[0]).end().filter(":last").addClass(g[1]).addClass("ui-controlgroup-last")}var f=a.extend({direction:a(this).data("type")||"vertical",shadow:false},d),b=a(this).find(">legend"),g=f.direction=="horizontal"?["ui-corner-left","ui-corner-right"]:["ui-corner-top","ui-corner-bottom"];a(this).find("input:eq(0)").attr("type");if(b.length){a(this).wrapInner('<div class="ui-controlgroup-controls"></div>');  
a('<div role="heading" class="ui-controlgroup-label">'+b.html()+"</div>").insertBefore(a(this).children(0));b.remove()}a(this).addClass("ui-corner-all ui-controlgroup ui-controlgroup-"+f.direction);c(a(this).find(".ui-btn"));c(a(this).find(".ui-btn-inner"));f.shadow&&a(this).addClass("ui-shadow")})}})(jQuery);(function(a){a.fn.fieldcontain=function(){return this.addClass("ui-field-contain ui-body ui-br")}})(jQuery);  
(function(a){a.widget("mobile.listview",a.mobile.widget,{options:{theme:"c",countTheme:"c",headerTheme:"b",dividerTheme:"b",splitIcon:"arrow-r",splitTheme:"b",inset:false},_create:function(){var d=this.element,c=this.options;d.addClass("ui-listview").attr("role","listbox");c.inset&&d.addClass("ui-listview-inset ui-corner-all ui-shadow");d.delegate(".ui-li","focusin",function(){a(this).attr("tabindex","0")});this._itemApply(d,d);this.refresh(true);d.keydown(function(f){var b=a(f.target),g=b.closest("li");  
switch(f.keyCode){case 38:f=g.prev();if(f.length){b.blur().attr("tabindex","-1");f.find("a").first().focus()}return false;case 40:f=g.next();if(f.length){b.blur().attr("tabindex","-1");f.find("a").first().focus()}return false;case 39:f=g.find("a.ui-li-link-alt");if(f.length){b.blur();f.first().focus()}return false;case 37:f=g.find("a.ui-link-inherit");if(f.length){b.blur();f.first().focus()}return false;case 13:case 32:b.trigger("click");return false}});d.delegate("li","click",function(f){if(!a(f.target).closest("a").length){a(this).find("a").first().trigger("click");  
return false}})},_itemApply:function(d,c){c.find(".ui-li-count").addClass("ui-btn-up-"+(d.data("counttheme")||this.options.countTheme)+" ui-btn-corner-all");c.find("h1, h2, h3, h4, h5, h6").addClass("ui-li-heading");c.find("p, dl").addClass("ui-li-desc");c.find("li").find("img:eq(0)").addClass("ui-li-thumb").each(function(){a(this).closest("li").addClass(a(this).is(".ui-li-icon")?"ui-li-has-icon":"ui-li-has-thumb")});var f=c.find(".ui-li-aside");f.length&&f.each(function(b,g){a(g).prependTo(a(g).parent())});  
a.support.cssPseudoElement||a.nodeName(c[0],"ol")},_removeCorners:function(d){d.add(d.find(".ui-btn-inner, .ui-li-link-alt, .ui-li-thumb")).removeClass("ui-corner-top ui-corner-bottom ui-corner-br ui-corner-bl ui-corner-tr ui-corner-tl")},refresh:function(d){this._createSubPages();var c=this.options,f=this.element,b=this,g=f.data("dividertheme")||c.dividerTheme,e=f.children("li"),i=a.support.cssPseudoElement||!a.nodeName(f[0],"ol")?0:1;i&&f.find(".ui-li-dec").remove();e.attr({role:"option",tabindex:"-1"});  
e.first().attr("tabindex","0");e.each(function(h){var k=a(this),j="ui-li";if(!(!d&&k.hasClass("ui-li"))){var o=k.data("theme")||c.theme,p=k.find("a");if(p.length){var t=k.data("icon");k.buttonMarkup({wrapperEls:"div",shadow:false,corners:false,iconpos:"right",icon:p.length>1||t===false?false:t||"arrow-r",theme:o});p.first().addClass("ui-link-inherit");if(p.length>1){j+=" ui-li-has-alt";p=p.last();t=f.data("splittheme")||p.data("theme")||c.splitTheme;p.appendTo(k).attr("title",p.text()).addClass("ui-li-link-alt").empty().buttonMarkup({shadow:false,  
corners:false,theme:o,icon:false,iconpos:false}).find(".ui-btn-inner").append(a("<span>").buttonMarkup({shadow:true,corners:true,theme:t,iconpos:"notext",icon:f.data("spliticon")||p.data("icon")||c.splitIcon}))}}else if(k.data("role")==="list-divider"){j+=" ui-li-divider ui-btn ui-bar-"+g;k.attr("role","heading");if(i)i=1}else j+=" ui-li-static ui-btn-up-"+o;if(c.inset){if(h===0){j+=" ui-corner-top";k.add(k.find(".ui-btn-inner")).find(".ui-li-link-alt").addClass("ui-corner-tr").end().find(".ui-li-thumb").addClass("ui-corner-tl");  
k.next().next().length&&b._removeCorners(k.next())}if(h===e.length-1){j+=" ui-corner-bottom";k.add(k.find(".ui-btn-inner")).find(".ui-li-link-alt").addClass("ui-corner-br").end().find(".ui-li-thumb").addClass("ui-corner-bl");k.prev().prev().length&&b._removeCorners(k.prev())}}i&&j.indexOf("ui-li-divider")<0&&k.find(".ui-link-inherit").first().addClass("ui-li-jsnumbering").prepend("<span class='ui-li-dec'>"+i++ +". </span>");k.addClass(j);d||b._itemApply(f,k)}})},_idStringEscape:function(d){return d.replace(/[^a-zA-Z0-9]/g,  
"-")},_createSubPages:function(){var d=this.element,c=d.closest(".ui-page"),f=c.data("url"),b=this.options,g=this,e=c.find("[data-role='footer']").data("id");a(d.find("ul, ol").toArray().reverse()).each(function(i){var h=a(this),k=h.parent(),j=a.trim(k.contents()[0].nodeValue)||k.find("a:first").text();i=f+"&"+a.mobile.subPageUrlKey+"="+g._idStringEscape(j+" "+i);var o=h.data("theme")||b.theme,p=h.data("counttheme")||d.data("counttheme")||b.countTheme;h.wrap("<div data-role='page'><div data-role='content'></div></div>").parent().before("<div data-role='header' data-theme='"+  
b.headerTheme+"'><div class='ui-title'>"+j+"</div></div>").after(e?a("<div>",{"data-role":"footer","data-id":e,"class":"ui-footer-duplicate"}):"").parent().attr({"data-url":i,"data-theme":o,"data-count-theme":p}).appendTo(a.mobile.pageContainer).page();h=k.find("a:first");h.length||(h=a("<a></a>").html(j).prependTo(k.empty()));h.attr("href","#"+i)}).listview()}})})(jQuery);  
(function(a){a.mobile.listview.prototype.options.filter=false;a("[data-role='listview']").live("listviewcreate",function(){var d=a(this);if(d.data("listview").options.filter){var c=a("<form>",{"class":"ui-listview-filter ui-bar-c",role:"search"});a("<input>",{placeholder:"Filter results...","data-type":"search"}).bind("keyup change",function(){var f=this.value.toLowerCase();d.children().show();f&&d.children().filter(function(){return a(this).text().toLowerCase().indexOf(f)===-1}).hide()}).appendTo(c).textinput();  
c.insertBefore(d)}})})(jQuery);  
(function(a){a.widget("mobile.dialog",a.mobile.widget,{options:{},_create:function(){this.element.attr("role","dialog").addClass("ui-page ui-dialog ui-body-a").find("[data-role=header]").addClass("ui-corner-top ui-overlay-shadow").prepend('<a href="#" data-icon="delete" data-rel="back" data-iconpos="notext">Close</a>').end().find('.ui-content:not([class*="ui-body-"])').addClass("ui-body-c").end().find(".ui-content,[data-role=footer]").last().addClass("ui-corner-bottom ui-overlay-shadow");this.element.bind("click submit",  
function(d){d=d.type=="click"?a(d.target).closest("a"):a(d.target).closest("form");d.length&&!d.data("transition")&&d.attr("data-transition",a.mobile.urlHistory.getActive().transition).attr("data-direction","reverse")})},close:function(){window.history.back()}})})(jQuery);  
(function(a,d){a.widget("mobile.navbar",a.mobile.widget,{options:{iconpos:"top",grid:null},_create:function(){var c=this.element,f=c.find("a"),b=f.filter("[data-icon]").length?this.options.iconpos:d;c.addClass("ui-navbar").attr("role","navigation").find("ul").grid({grid:this.options.grid});b||c.addClass("ui-navbar-noicons");f.buttonMarkup({corners:false,shadow:false,iconpos:b});c.delegate("a","click",function(){f.removeClass("ui-btn-active");a(this).addClass("ui-btn-active")})}})})(jQuery);  
(function(a){a.fn.grid=function(d){return this.each(function(){var c=a.extend({grid:null},d),f=a(this).children(),b={a:2,b:3,c:4,d:5};c=c.grid;if(!c)if(f.length<=5)for(var g in b){if(b[g]==f.length)c=g}else c="a";b=b[c];a(this).addClass("ui-grid-"+c);f.filter(":nth-child("+b+"n+1)").addClass("ui-block-a");f.filter(":nth-child("+b+"n+2)").addClass("ui-block-b");b>2&&f.filter(":nth-child(3n+3)").addClass("ui-block-c");b>3&&f.filter(":nth-child(4n+4)").addClass("ui-block-d");b>4&&f.filter(":nth-child(5n+5)").addClass("ui-block-e")})}})(jQuery);  
 
/*  
* jQuery UI Effects @VERSION  
*  
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*  
* http://docs.jquery.com/UI/Effects/  
*/  
;jQuery.effects || (function($, undefined) {  
 
$.effects = {};  
 
 
 
/******************************************************************************/  
/****************************** COLOR ANIMATIONS ******************************/  
/******************************************************************************/  
 
// override the animation for color styles  
$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',  
'borderRightColor', 'borderTopColor', 'borderColor', 'color', 'outlineColor'],  
function(i, attr) {  
$.fx.step[attr] = function(fx) {  
if (!fx.colorInit) {  
fx.start = getColor(fx.elem, attr);  
fx.end = getRGB(fx.end);  
fx.colorInit = true;  
}  
 
fx.elem.style[attr] = 'rgb(' +  
Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +  
Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +  
Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';  
};  
});  
 
// Color Conversion functions from highlightFade  
// By Blair Mitchelmore  
// http://jquery.offput.ca/highlightFade/  
 
// Parse strings looking for color tuples [255,255,255]  
function getRGB(color) {  
var result;  
 
// Check if we're already dealing with an array of colors  
if ( color && color.constructor == Array && color.length == 3 )  
return color;  
 
// Look for rgb(num,num,num)  
if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))  
return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];  
 
// Look for rgb(num%,num%,num%)  
if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))  
return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];  
 
// Look for #a0b1c2  
if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))  
return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];  
 
// Look for #fff  
if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))  
return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];  
 
// Look for rgba(0, 0, 0, 0) == transparent in Safari 3  
if (result = /rgba\(0, 0, 0, 0\)/.exec(color))  
return colors['transparent'];  
 
// Otherwise, we're most likely dealing with a named color  
return colors[$.trim(color).toLowerCase()];  
}  
 
function getColor(elem, attr) {  
var color;  
 
do {  
color = $.curCSS(elem, attr);  
 
// Keep going until we find an element that has color, or we hit the body  
if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )  
break;  
 
attr = "backgroundColor";  
} while ( elem = elem.parentNode );  
 
return getRGB(color);  
};  
 
// Some named colors to work with  
// From Interface by Stefan Petre  
// http://interface.eyecon.ro/  
 
var colors = {  
aqua:[0,255,255],  
azure:[240,255,255],  
beige:[245,245,220],  
black:[0,0,0],  
blue:[0,0,255],  
brown:[165,42,42],  
cyan:[0,255,255],  
darkblue:[0,0,139],  
darkcyan:[0,139,139],  
darkgrey:[169,169,169],  
darkgreen:[0,100,0],  
darkkhaki:[189,183,107],  
darkmagenta:[139,0,139],  
darkolivegreen:[85,107,47],  
darkorange:[255,140,0],  
darkorchid:[153,50,204],  
darkred:[139,0,0],  
darksalmon:[233,150,122],  
darkviolet:[148,0,211],  
fuchsia:[255,0,255],  
gold:[255,215,0],  
green:[0,128,0],  
indigo:[75,0,130],  
khaki:[240,230,140],  
lightblue:[173,216,230],  
lightcyan:[224,255,255],  
lightgreen:[144,238,144],  
lightgrey:[211,211,211],  
lightpink:[255,182,193],  
lightyellow:[255,255,224],  
lime:[0,255,0],  
magenta:[255,0,255],  
maroon:[128,0,0],  
navy:[0,0,128],  
olive:[128,128,0],  
orange:[255,165,0],  
pink:[255,192,203],  
purple:[128,0,128],  
violet:[128,0,128],  
red:[255,0,0],  
silver:[192,192,192],  
white:[255,255,255],  
yellow:[255,255,0],  
transparent: [255,255,255]  
};  
 
 
 
/******************************************************************************/  
/****************************** CLASS ANIMATIONS ******************************/  
/******************************************************************************/  
 
var classAnimationActions = ['add', 'remove', 'toggle'],  
shorthandStyles = {  
border: 1,  
borderBottom: 1,  
borderColor: 1,  
borderLeft: 1,  
borderRight: 1,  
borderTop: 1,  
borderWidth: 1,  
margin: 1,  
padding: 1  
};  
 
function getElementStyles() {  
var style = document.defaultView  
? document.defaultView.getComputedStyle(this, null)  
: this.currentStyle,  
newStyle = {},  
key,  
camelCase;  
 
// webkit enumerates style porperties  
if (style && style.length && style[0] && style[style[0]]) {  
var len = style.length;  
while (len--) {  
key = style[len];  
if (typeof style[key] == 'string') {  
camelCase = key.replace(/\-(\w)/g, function(all, letter){  
return letter.toUpperCase();  
});  
newStyle[camelCase] = style[key];  
}  
}  
} else {  
for (key in style) {  
if (typeof style[key] === 'string') {  
newStyle[key] = style[key];  
}  
}  
}  
 
return newStyle;  
}  
 
function filterStyles(styles) {  
var name, value;  
for (name in styles) {  
value = styles[name];  
if (  
// ignore null and undefined values  
value == null ||  
// ignore functions (when does this occur?)  
$.isFunction(value) ||  
// shorthand styles that need to be expanded  
name in shorthandStyles ||  
// ignore scrollbars (break in IE)  
(/scrollbar/).test(name) ||  
 
// only colors or values that can be converted to numbers  
(!(/color/i).test(name) && isNaN(parseFloat(value)))  
) {  
delete styles[name];  
}  
}  
 
return styles;  
}  
 
function styleDifference(oldStyle, newStyle) {  
var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459  
name;  
 
for (name in newStyle) {  
if (oldStyle[name] != newStyle[name]) {  
diff[name] = newStyle[name];  
}  
}  
 
return diff;  
}  
 
$.effects.animateClass = function(value, duration, easing, callback) {  
if ($.isFunction(easing)) {  
callback = easing;  
easing = null;  
}  
 
return this.queue('fx', function() {  
var that = $(this),  
originalStyleAttr = that.attr('style') || ' ',  
originalStyle = filterStyles(getElementStyles.call(this)),  
newStyle,  
className = that.attr('className');  
 
$.each(classAnimationActions, function(i, action) {  
if (value[action]) {  
that[action + 'Class'](value[action]);  
}  
});  
newStyle = filterStyles(getElementStyles.call(this));  
that.attr('className', className);  
 
that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() {  
$.each(classAnimationActions, function(i, action) {  
if (value[action]) { that[action + 'Class'](value[action]); }  
});  
// work around bug in IE by clearing the cssText before setting it  
if (typeof that.attr('style') == 'object') {  
that.attr('style').cssText = '';  
that.attr('style').cssText = originalStyleAttr;  
} else {  
that.attr('style', originalStyleAttr);  
}  
if (callback) { callback.apply(this, arguments); }  
});  
 
// $.animate adds a function to the end of the queue  
// but we want it at the front  
var queue = $.queue(this),  
anim = queue.splice(queue.length - 1, 1)[0];  
queue.splice(1, 0, anim);  
$.dequeue(this);  
});  
};  
 
$.fn.extend({  
_addClass: $.fn.addClass,  
addClass: function(classNames, speed, easing, callback) {  
return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);  
},  
 
_removeClass: $.fn.removeClass,  
removeClass: function(classNames,speed,easing,callback) {  
return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);  
},  
 
_toggleClass: $.fn.toggleClass,  
toggleClass: function(classNames, force, speed, easing, callback) {  
if ( typeof force == "boolean" || force === undefined ) {  
if ( !speed ) {  
// without speed parameter;  
return this._toggleClass(classNames, force);  
} else {  
return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]);  
}  
} else {  
// without switch parameter;  
return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]);  
}  
},  
 
switchClass: function(remove,add,speed,easing,callback) {  
return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);  
}  
});  
 
 
 
/******************************************************************************/  
/*********************************** EFFECTS **********************************/  
/******************************************************************************/  
 
$.extend($.effects, {  
version: "@VERSION",  
 
// Saves a set of properties in a data storage  
save: function(element, set) {  
for(var i=0; i < set.length; i++) {  
if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);  
}  
},  
 
// Restores a set of previously saved properties from a data storage  
restore: function(element, set) {  
for(var i=0; i < set.length; i++) {  
if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));  
}  
},  
 
setMode: function(el, mode) {  
if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle  
return mode;  
},  
 
getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value  
// this should be a little more flexible in the future to handle a string & hash  
var y, x;  
switch (origin[0]) {  
case 'top': y = 0; break;  
case 'middle': y = 0.5; break;  
case 'bottom': y = 1; break;  
default: y = origin[0] / original.height;  
};  
switch (origin[1]) {  
case 'left': x = 0; break;  
case 'center': x = 0.5; break;  
case 'right': x = 1; break;  
default: x = origin[1] / original.width;  
};  
return {x: x, y: y};  
},  
 
// Wraps the element around a wrapper that copies position properties  
createWrapper: function(element) {  
 
// if the element is already wrapped, return it  
if (element.parent().is('.ui-effects-wrapper')) {  
return element.parent();  
}  
 
// wrap the element  
var props = {  
width: element.outerWidth(true),  
height: element.outerHeight(true),  
'float': element.css('float')  
},  
wrapper = $('<div></div>')  
.addClass('ui-effects-wrapper')  
.css({  
fontSize: '100%',  
background: 'transparent',  
border: 'none',  
margin: 0,  
padding: 0  
});  
 
element.wrap(wrapper);  
wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element  
 
// transfer positioning properties to the wrapper  
if (element.css('position') == 'static') {  
wrapper.css({ position: 'relative' });  
element.css({ position: 'relative' });  
} else {  
$.extend(props, {  
position: element.css('position'),  
zIndex: element.css('z-index')  
});  
$.each(['top', 'left', 'bottom', 'right'], function(i, pos) {  
props[pos] = element.css(pos);  
if (isNaN(parseInt(props[pos], 10))) {  
props[pos] = 'auto';  
}  
});  
element.css({position: 'relative', top: 0, left: 0, right: 'auto', bottom: 'auto' });  
}  
 
return wrapper.css(props).show();  
},  
 
removeWrapper: function(element) {  
if (element.parent().is('.ui-effects-wrapper'))  
return element.parent().replaceWith(element);  
return element;  
},  
 
setTransition: function(element, list, factor, value) {  
value = value || {};  
$.each(list, function(i, x){  
unit = element.cssUnit(x);  
if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];  
});  
return value;  
}  
});  
 
 
function _normalizeArguments(effect, options, speed, callback) {  
// shift params for method overloading  
if (typeof effect == 'object') {  
callback = options;  
speed = null;  
options = effect;  
effect = options.effect;  
}  
if ($.isFunction(options)) {  
callback = options;  
speed = null;  
options = {};  
}  
if (typeof options == 'number' || $.fx.speeds[options]) {  
callback = speed;  
speed = options;  
options = {};  
}  
if ($.isFunction(speed)) {  
callback = speed;  
speed = null;  
}  
 
options = options || {};  
 
speed = speed || options.duration;  
speed = $.fx.off ? 0 : typeof speed == 'number'  
? speed : speed in $.fx.speeds ? $.fx.speeds[speed] : $.fx.speeds._default;  
 
callback = callback || options.complete;  
 
return [effect, options, speed, callback];  
}  
 
function standardSpeed( speed ) {  
// valid standard speeds  
if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) {  
return true;  
}  
 
// invalid strings - treat as "normal" speed  
if ( typeof speed === "string" && !$.effects[ speed ] ) {  
return true;  
}  
 
return false;  
}  
 
$.fn.extend({  
effect: function(effect, options, speed, callback) {  
var args = _normalizeArguments.apply(this, arguments),  
// TODO: make effects take actual parameters instead of a hash  
args2 = {  
options: args[1],  
duration: args[2],  
callback: args[3]  
},  
mode = args2.options.mode,  
effectMethod = $.effects[effect];  
 
if ( $.fx.off || !effectMethod ) {  
// delegate to the original method (e.g., .show()) if possible  
if ( mode ) {  
return this[ mode ]( args2.duration, args2.callback );  
} else {  
return this.each(function() {  
if ( args2.callback ) {  
args2.callback.call( this );  
}  
});  
}  
}  
 
return effectMethod.call(this, args2);  
},  
 
_show: $.fn.show,  
show: function(speed) {  
if ( standardSpeed( speed ) ) {  
return this._show.apply(this, arguments);  
} else {  
var args = _normalizeArguments.apply(this, arguments);  
args[1].mode = 'show';  
return this.effect.apply(this, args);  
}  
},  
 
_hide: $.fn.hide,  
hide: function(speed) {  
if ( standardSpeed( speed ) ) {  
return this._hide.apply(this, arguments);  
} else {  
var args = _normalizeArguments.apply(this, arguments);  
args[1].mode = 'hide';  
return this.effect.apply(this, args);  
}  
},  
 
// jQuery core overloads toggle and creates _toggle  
__toggle: $.fn.toggle,  
toggle: function(speed) {  
if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) {  
return this.__toggle.apply(this, arguments);  
} else {  
var args = _normalizeArguments.apply(this, arguments);  
args[1].mode = 'toggle';  
return this.effect.apply(this, args);  
}  
},  
 
// helper functions  
cssUnit: function(key) {  
var style = this.css(key), val = [];  
$.each( ['em','px','%','pt'], function(i, unit){  
if(style.indexOf(unit) > 0)  
val = [parseFloat(style), unit];  
});  
return val;  
}  
});  
 
 
 
/******************************************************************************/  
/*********************************** EASING ***********************************/  
/******************************************************************************/  
 
/*  
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/  
*  
* Uses the built in easing capabilities added In jQuery 1.1  
* to offer multiple easing options  
*  
* TERMS OF USE - jQuery Easing  
*  
* Open source under the BSD License.  
*  
* Copyright 2008 George McGinley Smith  
* All rights reserved.  
*  
* Redistribution and use in source and binary forms, with or without modification,  
* are permitted provided that the following conditions are met:  
*  
* Redistributions of source code must retain the above copyright notice, this list of  
* conditions and the following disclaimer.  
* Redistributions in binary form must reproduce the above copyright notice, this list  
* of conditions and the following disclaimer in the documentation and/or other materials  
* provided with the distribution.  
*  
* Neither the name of the author nor the names of contributors may be used to endorse  
* or promote products derived from this software without specific prior written permission.  
*  
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY  
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF  
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE  
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE  
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING  
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED  
* OF THE POSSIBILITY OF SUCH DAMAGE.  
*  
*/  
 
// t: current time, b: begInnIng value, c: change In value, d: duration  
$.easing.jswing = $.easing.swing;  
 
$.extend($.easing,  
{  
def: 'easeOutQuad',  
swing: function (x, t, b, c, d) {  
//alert($.easing.default);  
return $.easing[$.easing.def](x, t, b, c, d);  
},  
easeInQuad: function (x, t, b, c, d) {  
return c*(t/=d)*t + b;  
},  
easeOutQuad: function (x, t, b, c, d) {  
return -c *(t/=d)*(t-2) + b;  
},  
easeInOutQuad: function (x, t, b, c, d) {  
if ((t/=d/2) < 1) return c/2*t*t + b;  
return -c/2 * ((--t)*(t-2) - 1) + b;  
},  
easeInCubic: function (x, t, b, c, d) {  
return c*(t/=d)*t*t + b;  
},  
easeOutCubic: function (x, t, b, c, d) {  
return c*((t=t/d-1)*t*t + 1) + b;  
},  
easeInOutCubic: function (x, t, b, c, d) {  
if ((t/=d/2) < 1) return c/2*t*t*t + b;  
return c/2*((t-=2)*t*t + 2) + b;  
},  
easeInQuart: function (x, t, b, c, d) {  
return c*(t/=d)*t*t*t + b;  
},  
easeOutQuart: function (x, t, b, c, d) {  
return -c * ((t=t/d-1)*t*t*t - 1) + b;  
},  
easeInOutQuart: function (x, t, b, c, d) {  
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;  
return -c/2 * ((t-=2)*t*t*t - 2) + b;  
},  
easeInQuint: function (x, t, b, c, d) {  
return c*(t/=d)*t*t*t*t + b;  
},  
easeOutQuint: function (x, t, b, c, d) {  
return c*((t=t/d-1)*t*t*t*t + 1) + b;  
},  
easeInOutQuint: function (x, t, b, c, d) {  
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;  
return c/2*((t-=2)*t*t*t*t + 2) + b;  
},  
easeInSine: function (x, t, b, c, d) {  
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;  
},  
easeOutSine: function (x, t, b, c, d) {  
return c * Math.sin(t/d * (Math.PI/2)) + b;  
},  
easeInOutSine: function (x, t, b, c, d) {  
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;  
},  
easeInExpo: function (x, t, b, c, d) {  
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;  
},  
easeOutExpo: function (x, t, b, c, d) {  
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;  
},  
easeInOutExpo: function (x, t, b, c, d) {  
if (t==0) return b;  
if (t==d) return b+c;  
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;  
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;  
},  
easeInCirc: function (x, t, b, c, d) {  
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;  
},  
easeOutCirc: function (x, t, b, c, d) {  
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;  
},  
easeInOutCirc: function (x, t, b, c, d) {  
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;  
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;  
},  
easeInElastic: function (x, t, b, c, d) {  
var s=1.70158;var p=0;var a=c;  
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;  
if (a < Math.abs(c)) { a=c; var s=p/4; }  
else var s = p/(2*Math.PI) * Math.asin (c/a);  
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;  
},  
easeOutElastic: function (x, t, b, c, d) {  
var s=1.70158;var p=0;var a=c;  
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;  
if (a < Math.abs(c)) { a=c; var s=p/4; }  
else var s = p/(2*Math.PI) * Math.asin (c/a);  
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;  
},  
easeInOutElastic: function (x, t, b, c, d) {  
var s=1.70158;var p=0;var a=c;  
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);  
if (a < Math.abs(c)) { a=c; var s=p/4; }  
else var s = p/(2*Math.PI) * Math.asin (c/a);  
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;  
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;  
},  
easeInBack: function (x, t, b, c, d, s) {  
if (s == undefined) s = 1.70158;  
return c*(t/=d)*t*((s+1)*t - s) + b;  
},  
easeOutBack: function (x, t, b, c, d, s) {  
if (s == undefined) s = 1.70158;  
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;  
},  
easeInOutBack: function (x, t, b, c, d, s) {  
if (s == undefined) s = 1.70158;  
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;  
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;  
},  
easeInBounce: function (x, t, b, c, d) {  
return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;  
},  
easeOutBounce: function (x, t, b, c, d) {  
if ((t/=d) < (1/2.75)) {  
return c*(7.5625*t*t) + b;  
} else if (t < (2/2.75)) {  
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;  
} else if (t < (2.5/2.75)) {  
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;  
} else {  
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;  
}  
},  
easeInOutBounce: function (x, t, b, c, d) {  
if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;  
return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;  
}  
});  
 
/*  
*  
* TERMS OF USE - EASING EQUATIONS  
*  
* Open source under the BSD License.  
*  
* Copyright 2001 Robert Penner  
* All rights reserved.  
*  
* Redistribution and use in source and binary forms, with or without modification,  
* are permitted provided that the following conditions are met:  
*  
* Redistributions of source code must retain the above copyright notice, this list of  
* conditions and the following disclaimer.  
* Redistributions in binary form must reproduce the above copyright notice, this list  
* of conditions and the following disclaimer in the documentation and/or other materials  
* provided with the distribution.  
*  
* Neither the name of the author nor the names of contributors may be used to endorse  
* or promote products derived from this software without specific prior written permission.  
*  
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY  
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF  
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE  
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE  
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING  
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED  
* OF THE POSSIBILITY OF SUCH DAMAGE.  
*  
*/  
 
})(jQuery);  
 
/*  
* jQuery UI Autocomplete @VERSION  
*  
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*  
* http://docs.jquery.com/UI/Autocomplete  
*  
* Depends:  
* jquery.ui.core.js  
* jquery.ui.widget.js  
* jquery.ui.position.js  
* jquery.ui.menu.js  
*/  
(function( $, undefined ) {  
 
// used to prevent race conditions with remote data sources  
var requestIndex = 0;  
 
$.widget( "ui.autocomplete", {  
defaultElement: "<input>",  
options: {  
appendTo: "body",  
delay: 300,  
minLength: 1,  
position: {  
my: "left top",  
at: "left bottom",  
collision: "none"  
},  
source: null  
},  
 
pending: 0,  
 
_create: function() {  
var self = this,  
doc = this.element[ 0 ].ownerDocument,  
suppressKeyPress;  
 
this.element  
.addClass( "ui-autocomplete-input" )  
.attr( "autocomplete", "off" )  
// TODO verify these actually work as intended  
.attr({  
role: "textbox",  
"aria-autocomplete": "list",  
"aria-haspopup": "true"  
})  
.bind( "keydown.autocomplete", function( event ) {  
if ( self.options.disabled || self.element.attr( "readonly" ) ) {  
return;  
}  
 
suppressKeyPress = false;  
var keyCode = $.ui.keyCode;  
switch( event.keyCode ) {  
case keyCode.PAGE_UP:  
self._move( "previousPage", event );  
break;  
case keyCode.PAGE_DOWN:  
self._move( "nextPage", event );  
break;  
case keyCode.UP:  
self._move( "previous", event );  
// prevent moving cursor to beginning of text field in some browsers  
event.preventDefault();  
break;  
case keyCode.DOWN:  
self._move( "next", event );  
// prevent moving cursor to end of text field in some browsers  
event.preventDefault();  
break;  
case keyCode.ENTER:  
case keyCode.NUMPAD_ENTER:  
// when menu is open and has focus  
if ( self.menu.active ) {  
// #6055 - Opera still allows the keypress to occur  
// which causes forms to submit  
suppressKeyPress = true;  
event.preventDefault();  
}  
//passthrough - ENTER and TAB both select the current element  
case keyCode.TAB:  
if ( !self.menu.active ) {  
return;  
}  
self.menu.select( event );  
break;  
case keyCode.ESCAPE:  
self.element.val( self.term );  
self.close( event );  
break;  
default:  
// keypress is triggered before the input value is changed  
clearTimeout( self.searching );  
self.searching = setTimeout(function() {  
// only search if the value has changed  
if ( self.term != self.element.val() ) {  
self.selectedItem = null;  
self.search( null, event );  
}  
}, self.options.delay );  
break;  
}  
})  
.bind( "keypress.autocomplete", function( event ) {  
if ( suppressKeyPress ) {  
suppressKeyPress = false;  
event.preventDefault();  
}  
})  
.bind( "focus.autocomplete", function() {  
if ( self.options.disabled ) {  
return;  
}  
 
self.selectedItem = null;  
self.previous = self.element.val();  
})  
.bind( "blur.autocomplete", function( event ) {  
if ( self.options.disabled ) {  
return;  
}  
 
clearTimeout( self.searching );  
// clicks on the menu (or a button to trigger a search) will cause a blur event  
self.closing = setTimeout(function() {  
self.close( event );  
self._change( event );  
}, 150 );  
});  
this._initSource();  
this.response = function() {  
return self._response.apply( self, arguments );  
};  
this.menu = $( "<ul></ul>" )  
.addClass( "ui-autocomplete" )  
.appendTo( $( this.options.appendTo || "body", doc )[0] )  
// prevent the close-on-blur in case of a "slow" click on the menu (long mousedown)  
.mousedown(function( event ) {  
// clicking on the scrollbar causes focus to shift to the body  
// but we can't detect a mouseup or a click immediately afterward  
// so we have to track the next mousedown and close the menu if  
// the user clicks somewhere outside of the autocomplete  
var menuElement = self.menu.element[ 0 ];  
if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {  
setTimeout(function() {  
$( document ).one( 'mousedown', function( event ) {  
if ( event.target !== self.element[ 0 ] &&  
event.target !== menuElement &&  
!$.contains( menuElement, event.target ) ) {  
self.close();  
}  
});  
}, 1 );  
}  
 
// use another timeout to make sure the blur-event-handler on the input was already triggered  
setTimeout(function() {  
clearTimeout( self.closing );  
}, 13);  
})  
.menu({  
// custom key handling for now  
input: $(),  
focus: function( event, ui ) {  
var item = ui.item.data( "item.autocomplete" );  
if ( false !== self._trigger( "focus", event, { item: item } ) ) {  
// use value to match what will end up in the input, if it was a key event  
if ( /^key/.test(event.originalEvent.type) ) {  
self.element.val( item.value );  
}  
}  
},  
select: function( event, ui ) {  
var item = ui.item.data( "item.autocomplete" ),  
previous = self.previous;  
 
// only trigger when focus was lost (click on menu)  
if ( self.element[0] !== doc.activeElement ) {  
self.element.focus();  
self.previous = previous;  
// #6109 - IE triggers two focus events and the second  
// is asynchronous, so we need to reset the previous  
// term synchronously and asynchronously :-(  
setTimeout(function() {  
self.previous = previous;  
self.selectedItem = item;  
}, 1);  
}  
 
if ( false !== self._trigger( "select", event, { item: item } ) ) {  
self.element.val( item.value );  
}  
// reset the term after the select event  
// this allows custom select handling to work properly  
self.term = self.element.val();  
 
self.close( event );  
self.selectedItem = item;  
},  
blur: function( event, ui ) {  
// don't set the value of the text field if it's already correct  
// this prevents moving the cursor unnecessarily  
if ( self.menu.element.is(":visible") &&  
( self.element.val() !== self.term ) ) {  
self.element.val( self.term );  
}  
}  
})  
.zIndex( this.element.zIndex() + 1 )  
.hide()  
.data( "menu" );  
if ( $.fn.bgiframe ) {  
this.menu.element.bgiframe();  
}  
},  
 
_destroy: function() {  
this.element  
.removeClass( "ui-autocomplete-input" )  
.removeAttr( "autocomplete" )  
.removeAttr( "role" )  
.removeAttr( "aria-autocomplete" )  
.removeAttr( "aria-haspopup" );  
this.menu.element.remove();  
},  
 
_setOption: function( key, value ) {  
this._super( "_setOption", key, value );  
if ( key === "source" ) {  
this._initSource();  
}  
if ( key === "appendTo" ) {  
this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] )  
}  
if ( key === "disabled" && value && this.xhr ) {  
this.xhr.abort();  
}  
},  
 
_initSource: function() {  
var self = this,  
array,  
url;  
if ( $.isArray(this.options.source) ) {  
array = this.options.source;  
this.source = function( request, response ) {  
response( $.ui.autocomplete.filter(array, request.term) );  
};  
} else if ( typeof this.options.source === "string" ) {  
url = this.options.source;  
this.source = function( request, response ) {  
if ( self.xhr ) {  
self.xhr.abort();  
}  
self.xhr = $.ajax({  
url: url,  
data: request,  
dataType: "json",  
autocompleteRequest: ++requestIndex,  
success: function( data, status ) {  
if ( this.autocompleteRequest === requestIndex ) {  
response( data );  
}  
},  
error: function() {  
if ( this.autocompleteRequest === requestIndex ) {  
response( [] );  
}  
}  
});  
};  
} else {  
this.source = this.options.source;  
}  
},  
 
search: function( value, event ) {  
value = value != null ? value : this.element.val();  
 
// always save the actual value, not the one passed as an argument  
this.term = this.element.val();  
 
if ( value.length < this.options.minLength ) {  
return this.close( event );  
}  
 
clearTimeout( this.closing );  
if ( this._trigger( "search", event ) === false ) {  
return;  
}  
 
return this._search( value );  
},  
 
_search: function( value ) {  
this.pending++;  
this.element.addClass( "ui-autocomplete-loading" );  
 
this.source( { term: value }, this.response );  
},  
 
_response: function( content ) {  
if ( !this.options.disabled && content && content.length ) {  
content = this._normalize( content );  
this._suggest( content );  
this._trigger( "open" );  
} else {  
this.close();  
}  
this.pending--;  
if ( !this.pending ) {  
this.element.removeClass( "ui-autocomplete-loading" );  
}  
},  
 
close: function( event ) {  
clearTimeout( this.closing );  
if ( this.menu.element.is(":visible") ) {  
this.menu.element.hide();  
this.menu.deactivate();  
this._trigger( "close", event );  
}  
},  
 
_change: function( event ) {  
if ( this.previous !== this.element.val() ) {  
this._trigger( "change", event, { item: this.selectedItem } );  
}  
},  
 
_normalize: function( items ) {  
// assume all items have the right format when the first item is complete  
if ( items.length && items[0].label && items[0].value ) {  
return items;  
}  
return $.map( items, function(item) {  
if ( typeof item === "string" ) {  
return {  
label: item,  
value: item  
};  
}  
return $.extend({  
label: item.label || item.value,  
value: item.value || item.label  
}, item );  
});  
},  
 
_suggest: function( items ) {  
var ul = this.menu.element  
.empty()  
.zIndex( this.element.zIndex() + 1 );  
this._renderMenu( ul, items );  
// TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate  
this.menu.deactivate();  
this.menu.refresh();  
 
// size and position menu  
ul.show();  
this._resizeMenu();  
ul.position( $.extend({  
of: this.element  
}, this.options.position ));  
},  
 
_resizeMenu: function() {  
var ul = this.menu.element;  
ul.outerWidth( Math.max(  
ul.width( "" ).outerWidth(),  
this.element.outerWidth()  
) );  
},  
 
_renderMenu: function( ul, items ) {  
var self = this;  
$.each( items, function( index, item ) {  
self._renderItem( ul, item );  
});  
},  
 
_renderItem: function( ul, item) {  
return $( "<li></li>" )  
.data( "item.autocomplete", item )  
.append( $( "<a></a>" ).text( item.label ) )  
.appendTo( ul );  
},  
 
_move: function( direction, event ) {  
if ( !this.menu.element.is(":visible") ) {  
this.search( null, event );  
return;  
}  
if ( this.menu.first() && /^previous/.test(direction) ||  
this.menu.last() && /^next/.test(direction) ) {  
this.element.val( this.term );  
this.menu.deactivate();  
return;  
}  
this.menu[ direction ]( event );  
},  
 
widget: function() {  
return this.menu.element;  
}  
});  
 
$.extend( $.ui.autocomplete, {  
version: "@VERSION",  
escapeRegex: function( value ) {  
return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");  
},  
filter: function(array, term) {  
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );  
return $.grep( array, function(value) {  
return matcher.test( value.label || value.value || value );  
});  
}  
});  
 
}( jQuery ));  
 
/*  
* jQuery Mobile Framework : temporary extension to port jQuery UI's datepicker for mobile  
* Copyright (c) jQuery Project  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*/  
(function($, undefined ) {  
 
//cache previous datepicker ui method  
var prevDp = $.fn.datepicker;  
 
//rewrite datepicker  
$.fn.datepicker = function( options ){  
 
var dp = this;  
 
//call cached datepicker plugin  
prevDp.call( this, options );  
 
//extend with some dom manipulation to update the markup for jQM  
//call immediately  
function updateDatepicker(){  
$( ".ui-datepicker-header", dp ).addClass("ui-body-c ui-corner-top").removeClass("ui-corner-all");  
$( ".ui-datepicker-prev, .ui-datepicker-next", dp ).attr("href", "#");  
$( ".ui-datepicker-prev", dp ).buttonMarkup({iconpos: "notext", icon: "arrow-l", shadow: true, corners: true});  
$( ".ui-datepicker-next", dp ).buttonMarkup({iconpos: "notext", icon: "arrow-r", shadow: true, corners: true});  
$( ".ui-datepicker-calendar th", dp ).addClass("ui-bar-c");  
$( ".ui-datepicker-calendar td", dp ).addClass("ui-body-c");  
$( ".ui-datepicker-calendar a", dp ).buttonMarkup({corners: false, shadow: false});  
$( ".ui-datepicker-calendar a.ui-state-active", dp ).addClass("ui-btn-active"); // selected date  
$( ".ui-datepicker-calendar a.ui-state-highlight", dp ).addClass("ui-btn-up-e"); // today"s date  
$( ".ui-datepicker-calendar .ui-btn", dp ).each(function(){  
var el = $(this);  
// remove extra button markup - necessary for date value to be interpreted correctly  
el.html( el.find( ".ui-btn-text" ).text() );  
});  
};  
 
//update now  
updateDatepicker();  
 
// and on click  
$( dp ).click( updateDatepicker );  
 
//return jqm obj  
return this;  
};  
 
//bind to pagecreate to automatically enhance date inputs  
$( ".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 );  
/*  
* jQuery UI Position @VERSION  
*  
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*  
* http://docs.jquery.com/UI/Position  
*/  
(function( $, undefined ) {  
 
$.ui = $.ui || {};  
 
var horizontalPositions = /left|center|right/,  
verticalPositions = /top|center|bottom/,  
center = "center",  
_position = $.fn.position,  
_offset = $.fn.offset;  
 
$.fn.position = function( options ) {  
if ( !options || !options.of ) {  
return _position.apply( this, arguments );  
}  
 
// make a copy, we don't want to modify arguments  
options = $.extend( {}, options );  
 
var target = $( options.of ),  
targetElem = target[0],  
collision = ( options.collision || "flip" ).split( " " ),  
offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],  
targetWidth,  
targetHeight,  
basePosition;  
 
if ( targetElem.nodeType === 9 ) {  
targetWidth = target.width();  
targetHeight = target.height();  
basePosition = { top: 0, left: 0 };  
} else if ( $.isWindow( targetElem ) ) {  
targetWidth = target.width();  
targetHeight = target.height();  
basePosition = { top: target.scrollTop(), left: target.scrollLeft() };  
} else if ( targetElem.preventDefault ) {  
// force left top to allow flipping  
options.at = "left top";  
targetWidth = targetHeight = 0;  
basePosition = { top: options.of.pageY, left: options.of.pageX };  
} else {  
targetWidth = target.outerWidth();  
targetHeight = target.outerHeight();  
basePosition = target.offset();  
}  
 
// force my and at to have valid horizontal and veritcal positions  
// if a value is missing or invalid, it will be converted to center  
$.each( [ "my", "at" ], function() {  
var pos = ( options[this] || "" ).split( " " );  
if ( pos.length === 1) {  
pos = horizontalPositions.test( pos[0] ) ?  
pos.concat( [center] ) :  
verticalPositions.test( pos[0] ) ?  
[ center ].concat( pos ) :  
[ center, center ];  
}  
pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center;  
pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center;  
options[ this ] = pos;  
});  
 
// normalize collision option  
if ( collision.length === 1 ) {  
collision[ 1 ] = collision[ 0 ];  
}  
 
// normalize offset option  
offset[ 0 ] = parseInt( offset[0], 10 ) || 0;  
if ( offset.length === 1 ) {  
offset[ 1 ] = offset[ 0 ];  
}  
offset[ 1 ] = parseInt( offset[1], 10 ) || 0;  
 
if ( options.at[0] === "right" ) {  
basePosition.left += targetWidth;  
} else if ( options.at[0] === center ) {  
basePosition.left += targetWidth / 2;  
}  
 
if ( options.at[1] === "bottom" ) {  
basePosition.top += targetHeight;  
} else if ( options.at[1] === center ) {  
basePosition.top += targetHeight / 2;  
}  
 
basePosition.left += offset[ 0 ];  
basePosition.top += offset[ 1 ];  
 
return this.each(function() {  
var elem = $( this ),  
elemWidth = elem.outerWidth(),  
elemHeight = elem.outerHeight(),  
marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0,  
marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0,  
collisionWidth = elemWidth + marginLeft +  
( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ),  
collisionHeight = elemHeight + marginTop +  
( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ),  
position = $.extend( {}, basePosition ),  
collisionPosition;  
 
if ( options.my[0] === "right" ) {  
position.left -= elemWidth;  
} else if ( options.my[0] === center ) {  
position.left -= elemWidth / 2;  
}  
 
if ( options.my[1] === "bottom" ) {  
position.top -= elemHeight;  
} else if ( options.my[1] === center ) {  
position.top -= elemHeight / 2;  
}  
 
// prevent fractions (see #5280)  
position.left = Math.round( position.left );  
position.top = Math.round( position.top );  
 
collisionPosition = {  
left: position.left - marginLeft,  
top: position.top - marginTop  
};  
 
$.each( [ "left", "top" ], function( i, dir ) {  
if ( $.ui.position[ collision[i] ] ) {  
$.ui.position[ collision[i] ][ dir ]( position, {  
targetWidth: targetWidth,  
targetHeight: targetHeight,  
elemWidth: elemWidth,  
elemHeight: elemHeight,  
collisionPosition: collisionPosition,  
collisionWidth: collisionWidth,  
collisionHeight: collisionHeight,  
offset: offset,  
my: options.my,  
at: options.at  
});  
}  
});  
 
if ( $.fn.bgiframe ) {  
elem.bgiframe();  
}  
elem.offset( $.extend( position, { using: options.using } ) );  
});  
};  
 
$.ui.position = {  
fit: {  
left: function( position, data ) {  
var win = $( window ),  
over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft();  
position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left );  
},  
top: function( position, data ) {  
var win = $( window ),  
over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop();  
position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top );  
}  
},  
 
flip: {  
left: function( position, data ) {  
if ( data.at[0] === center ) {  
return;  
}  
var win = $( window ),  
over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(),  
myOffset = data.my[ 0 ] === "left" ?  
-data.elemWidth :  
data.my[ 0 ] === "right" ?  
data.elemWidth :  
0,  
atOffset = data.at[ 0 ] === "left" ?  
data.targetWidth :  
-data.targetWidth,  
offset = -2 * data.offset[ 0 ];  
position.left += data.collisionPosition.left < 0 ?  
myOffset + atOffset + offset :  
over > 0 ?  
myOffset + atOffset + offset :  
0;  
},  
top: function( position, data ) {  
if ( data.at[1] === center ) {  
return;  
}  
var win = $( window ),  
over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(),  
myOffset = data.my[ 1 ] === "top" ?  
-data.elemHeight :  
data.my[ 1 ] === "bottom" ?  
data.elemHeight :  
0,  
atOffset = data.at[ 1 ] === "top" ?  
data.targetHeight :  
-data.targetHeight,  
offset = -2 * data.offset[ 1 ];  
position.top += data.collisionPosition.top < 0 ?  
myOffset + atOffset + offset :  
over > 0 ?  
myOffset + atOffset + offset :  
0;  
}  
}  
};  
 
// offset setter from jQuery 1.4  
if ( !$.offset.setOffset ) {  
$.offset.setOffset = function( elem, options ) {  
// set position first, in-case top/left are set even on static elem  
if ( /static/.test( $.curCSS( elem, "position" ) ) ) {  
elem.style.position = "relative";  
}  
var curElem = $( elem ),  
curOffset = curElem.offset(),  
curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,  
curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,  
props = {  
top: (options.top - curOffset.top) + curTop,  
left: (options.left - curOffset.left) + curLeft  
};  
 
if ( 'using' in options ) {  
options.using.call( elem, props );  
} else {  
curElem.css( props );  
}  
};  
 
$.fn.offset = function( options ) {  
var elem = this[ 0 ];  
if ( !elem || !elem.ownerDocument ) { return null; }  
if ( options ) {  
return this.each(function() {  
$.offset.setOffset( this, options );  
});  
}  
return _offset.call( this );  
};  
}  
 
}( jQuery ));  
 
/*!  
* jQuery UI Widget @VERSION  
*  
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*  
* http://docs.jquery.com/UI/Widget  
*/  
(function( $, undefined ) {  
 
var slice = Array.prototype.slice;  
 
var _cleanData = $.cleanData;  
$.cleanData = function( elems ) {  
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {  
$( elem ).triggerHandler( "remove" );  
}  
_cleanData( elems );  
};  
 
$.widget = function( name, base, prototype ) {  
var namespace = name.split( "." )[ 0 ],  
fullName;  
name = name.split( "." )[ 1 ];  
fullName = namespace + "-" + name;  
 
if ( !prototype ) {  
prototype = base;  
base = $.Widget;  
}  
 
// create selector for plugin  
$.expr[ ":" ][ fullName ] = function( elem ) {  
return !!$.data( elem, name );  
};  
 
$[ namespace ] = $[ namespace ] || {};  
$[ namespace ][ name ] = $[ namespace ][ name ] || function( options, element ) {  
// allow instantiation without "new" keyword  
if ( !this._createWidget ) {  
return new $[ namespace ][ name ]( options, element );  
}  
 
// allow instantiation without initializing for simple inheritance  
// must use "new" keyword (the code above always passes args)  
if ( arguments.length ) {  
this._createWidget( options, element );  
}  
};  
 
var basePrototype = new base();  
// we need to make the options hash a property directly on the new instance  
// otherwise we'll modify the options hash on the prototype that we're  
// inheriting from  
basePrototype.options = $.extend( true, {}, basePrototype.options );  
$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {  
namespace: namespace,  
widgetName: name,  
widgetEventPrefix: name,  
widgetBaseClass: fullName,  
base: base.prototype  
}, prototype );  
 
$.widget.bridge( name, $[ namespace ][ name ] );  
};  
 
$.widget.bridge = function( name, object ) {  
$.fn[ name ] = function( options ) {  
var isMethodCall = typeof options === "string",  
args = slice.call( arguments, 1 ),  
returnValue = this;  
 
// allow multiple hashes to be passed on init  
options = !isMethodCall && args.length ?  
$.extend.apply( null, [ true, options ].concat(args) ) :  
options;  
 
// prevent calls to internal methods  
if ( isMethodCall && options.charAt( 0 ) === "_" ) {  
return returnValue;  
}  
 
if ( isMethodCall ) {  
this.each(function() {  
var instance = $.data( this, name );  
if ( !instance ) {  
return $.error( "cannot call methods on " + name + " prior to initialization; " +  
"attempted to call method '" + options + "'" );  
}  
if ( !$.isFunction( instance[options] ) ) {  
return $.error( "no such method '" + options + "' for " + name + " widget instance" );  
}  
var methodValue = instance[ options ].apply( instance, args );  
if ( methodValue !== instance && methodValue !== undefined ) {  
returnValue = methodValue;  
return false;  
}  
});  
} else {  
this.each(function() {  
var instance = $.data( this, name );  
if ( instance ) {  
instance.option( options || {} )._init();  
} else {  
object( options, this );  
}  
});  
}  
 
return returnValue;  
};  
};  
 
$.Widget = function( options, element ) {  
// allow instantiation without "new" keyword  
if ( !this._createWidget ) {  
return new $[ namespace ][ name ]( options, element );  
}  
 
// allow instantiation without initializing for simple inheritance  
// must use "new" keyword (the code above always passes args)  
if ( arguments.length ) {  
this._createWidget( options, element );  
}  
};  
 
$.Widget.prototype = {  
widgetName: "widget",  
widgetEventPrefix: "",  
defaultElement: "<div>",  
options: {  
disabled: false  
},  
_createWidget: function( options, element ) {  
element = $( element || this.defaultElement || this )[ 0 ];  
this.element = $( element );  
this.options = $.extend( true, {},  
this.options,  
this._getCreateOptions(),  
options );  
 
this.bindings = $();  
this.hoverable = $();  
this.focusable = $();  
 
if ( element !== this ) {  
$.data( element, this.widgetName, this );  
this._bind({ remove: "destroy" });  
}  
 
this._create();  
this._trigger( "create" );  
this._init();  
},  
_getCreateOptions: function() {  
return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];  
},  
_create: $.noop,  
_init: $.noop,  
 
_super: function( method ) {  
return this.base[ method ].apply( this, slice.call( arguments, 1 ) );  
},  
_superApply: function( method, args ) {  
return this.base[ method ].apply( this, args );  
},  
 
destroy: function() {  
this._destroy();  
// we can probably remove the unbind calls in 2.0  
// all event bindings should go through this._bind()  
this.element  
.unbind( "." + this.widgetName )  
.removeData( this.widgetName );  
this.widget()  
.unbind( "." + this.widgetName )  
.removeAttr( "aria-disabled" )  
.removeClass(  
this.widgetBaseClass + "-disabled " +  
"ui-state-disabled" );  
 
// clean up events and states  
this.bindings.unbind( "." + this.widgetName );  
this.hoverable.removeClass( "ui-state-hover" );  
this.focusable.removeClass( "ui-state-focus" );  
},  
_destroy: $.noop,  
 
widget: function() {  
return this.element;  
},  
 
option: function( key, value ) {  
var options = key;  
 
if ( arguments.length === 0 ) {  
// don't return a reference to the internal hash  
return $.extend( {}, this.options );  
}  
 
if (typeof key === "string" ) {  
if ( value === undefined ) {  
return this.options[ key ];  
}  
options = {};  
options[ key ] = value;  
}  
 
this._setOptions( options );  
 
return this;  
},  
_setOptions: function( options ) {  
var self = this;  
$.each( options, function( key, value ) {  
self._setOption( key, value );  
});  
 
return this;  
},  
_setOption: function( key, value ) {  
this.options[ key ] = value;  
 
if ( key === "disabled" ) {  
this.widget()  
.toggleClass( this.widgetBaseClass + "-disabled ui-state-disabled", !!value )  
.attr( "aria-disabled", value );  
this.hoverable.removeClass( "ui-state-hover" );  
this.focusable.removeClass( "ui-state-focus" );  
}  
 
return this;  
},  
 
enable: function() {  
return this._setOption( "disabled", false );  
},  
disable: function() {  
return this._setOption( "disabled", true );  
},  
 
_bind: function( element, handlers ) {  
// no element argument, shuffle and use this.element  
if ( !handlers ) {  
handlers = element;  
element = this.element;  
} else {  
this.bindings = this.bindings.add( element );  
}  
var instance = this;  
$.each( handlers, function( event, handler ) {  
element.bind( event + "." + instance.widgetName, function() {  
// allow widgets to customize the disabled handling  
// - disabled as an array instead of boolean  
// - disabled class as method for disabling individual parts  
if ( instance.options.disabled === true ||  
$( this ).hasClass( "ui-state-disabled" ) ) {  
return;  
}  
return ( typeof handler === "string" ? instance[ handler ] : handler )  
.apply( instance, arguments );  
});  
});  
},  
 
_hoverable: function( element ) {  
this.hoverable = this.hoverable.add( element );  
this._bind( element, {  
mouseenter: function( event ) {  
$( event.currentTarget ).addClass( "ui-state-hover" );  
},  
mouseleave: function( event ) {  
$( event.currentTarget ).removeClass( "ui-state-hover" );  
}  
});  
},  
 
_focusable: function( element ) {  
this.focusable = this.focusable.add( element );  
this._bind( element, {  
focusin: function( event ) {  
$( event.currentTarget ).addClass( "ui-state-focus" );  
},  
focusout: function( event ) {  
$( event.currentTarget ).removeClass( "ui-state-focus" );  
}  
});  
},  
 
_trigger: function( type, event, data ) {  
var callback = this.options[ type ],  
args;  
 
event = $.Event( event );  
event.type = ( type === this.widgetEventPrefix ?  
type :  
this.widgetEventPrefix + type ).toLowerCase();  
data = data || {};  
 
// copy original event properties over to the new event  
// this would happen if we could call $.event.fix instead of $.Event  
// but we don't have a way to force an event to be fixed multiple times  
if ( event.originalEvent ) {  
for ( var i = $.event.props.length, prop; i; ) {  
prop = $.event.props[ --i ];  
event[ prop ] = event.originalEvent[ prop ];  
}  
}  
 
this.element.trigger( event, data );  
 
args = $.isArray( data ) ?  
[ event ].concat( data ) :  
[ event, data ];  
 
return !( $.isFunction( callback ) &&  
callback.apply( this.element[0], args ) === false ||  
event.isDefaultPrevented() );  
}  
};  
 
})( jQuery );  
 
file:a/busui/readme.txt (deleted)
# input location (via GPS or favourites or search) and destination (via searchable list, optional)  
# http://10.0.1.153:8765/json/boundboxstops?n=-35.27568499917103&e=149.1346514225006&s=-35.279495003493516  
&w=149.12622928619385&limit=50  
# http://10.0.1.153:8765/json/stoptrips?stop=43&time=64440 # recursively call to show all services nearby, sort by distance, need to filter by service period  
# Hey, can pick destination again from a list filtered to places these stops go if you're curious!  
# http://10.0.1.153:8765/json/tripstoptimes?trip=2139 # Can recursively call and parse based on intended destination to show ETA  
# http://10.0.1.153:8765/json/triprows?trip=2139 # For pretty maps  
 
have to do  
/usr/sbin/setsebool -P httpd_can_network_connect=1  
on fedora  
 
might need http://forum.jquery.com/topic/google-maps-inside-jquery-mobile  
 
some extras  
/json/routes = all routes  
/json/neareststops?lat/lng/number  
TODO  
Destinations  
Favourites  
OOP stops/routes  
Stop sorting/search-filter  
 
static maps  
https://code.google.com/apis/maps/documentation/staticmaps/  
http://www.multimap.com/openapidocs/1.2/web_service/staticmaps.htm  
http://dev.openstreetmap.de/staticmap/ (os @ http://sourceforge.net/projects/staticmaplite/)  
(php and open source @ http://trac.openstreetmap.org/browser/sites/other/StaticMap?rev=16348)  
http://pafciu17.dev.openstreetmap.org/  
 
file:a/busui/routeList.php (deleted)
<?php  
include('common.inc.php');  
include_header("Routes");  
echo'  
<div data-role="navbar">  
<ul>  
<li><a href="routeList.php">By Final Destination...</a></li>  
<li><a href="routeList.php?bynumber=yes">By Number... </a></li>  
<li><a href="routeList.php?bysuburb=yes">By Suburb... </a></li>  
<li><a href="routeList.php?nearby=yes">Nearby... </a></li>  
</ul>  
</div>  
';  
echo ' <ul data-role="listview" data-inset="true">';  
$url = $APIurl."/json/routes";  
$contents = json_decode(getPage($url));  
debug(print_r($contents,true));  
 
function printRoutes($routes){  
foreach($routes as $row) {  
echo '<li>'.$row[1].' <a href="trip.php?routeid='.$row[0].'">'.$row[2]." (".ucwords($row[3]).")</a></li>\n";  
}  
}  
 
if ($_REQUEST['bynumber']) {  
$routeSeries = Array();  
$seriesRange = Array();  
foreach ($contents as $key => $row) {  
foreach (explode(" ",$row[1]) as $routeNumber ) {  
$seriesNum = substr($routeNumber, 0, -1)."0";  
if ($seriesNum == "0") $seriesNum = $routeNumber;  
$finalDigit = substr($routeNumber, sizeof($routeNumber)-1, 1);  
if (isset($seriesRange[$seriesNum])) {  
if ($finalDigit < $seriesRange[$seriesNum]['max'])  
$seriesRange[$seriesNum]['max'] = $routeNumber;  
if ($finalDigit > $seriesRange[$seriesNum]['min'])  
$seriesRange[$seriesNum]['min'] = $routeNumber;  
} else {  
$seriesRange[$seriesNum]['max'] = $routeNumber;  
$seriesRange[$seriesNum]['min'] = $routeNumber;  
}  
$routeSeries[$seriesNum][$seriesNum."-".$row[1]."-".$row[0]] = $row;  
}  
}  
ksort($routeSeries);  
ksort($seriesRange);  
echo '<div class="noscriptnav"> Go to route numbers: ';  
foreach ($seriesRange as $series => $range)  
{  
if ($range['min'] == $range['max']) echo "<a href=\"#$series\">$series</a>&nbsp;";  
else echo "<a href=\"#$series\">{$range['min']}-{$range['max']}</a>&nbsp;";  
}  
echo "</div>  
<script>  
$('.noscriptnav').hide();  
</script>";  
foreach ($routeSeries as $series => $routes)  
{  
echo '<a name="'.$series.'"></a>';  
if ($series <= 9) echo '<li>'.$series."<ul>\n";  
else echo "<li>{$seriesRange[$series]['min']}-{$seriesRange[$series]['max']}<ul>\n";  
printRoutes($routes);  
echo "</ul></li>\n";  
}  
} else {  
foreach ($contents as $key => $row) {  
$routeDestinations[$row[2]][] = $row;  
}  
echo '<div class="noscriptnav"> Go to Destination: ';  
foreach(ksort($routeDestinations) as $destination => $routes)  
{  
echo "<a href=\"#$destination\">$destination</a>&nbsp;";  
}  
echo "</div>  
<script>  
$('.noscriptnav').hide();  
</script>";  
foreach ($routeDestinations as $destination => $routes)  
{  
echo '<a name="'.$destination.'"></a>';  
echo '<li>'.$destination."... <ul>\n";  
printRoutes($routes);  
echo "</ul></li>\n";  
}  
}  
echo "</ul>\n";  
 
 
include_footer();  
?>  
 
#!/usr/bin/python2.5  
 
# Copyright (C) 2007 Google Inc.  
#  
# Licensed under the Apache License, Version 2.0 (the "License");  
# you may not use this file except in compliance with the License.  
# You may obtain a copy of the License at  
#  
# http://www.apache.org/licenses/LICENSE-2.0  
#  
# Unless required by applicable law or agreed to in writing, software  
# distributed under the License is distributed on an "AS IS" BASIS,  
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
# See the License for the specific language governing permissions and  
# limitations under the License.  
 
"""  
An example application that uses the transitfeed module.  
 
You must provide a Google Maps API key.  
"""  
 
 
import BaseHTTPServer, sys, urlparse  
import bisect  
from gtfsscheduleviewer.marey_graph import MareyGraph  
import gtfsscheduleviewer  
import mimetypes  
import os.path  
import re  
import signal  
import simplejson  
import socket  
import time  
import transitfeed  
from transitfeed import util  
import urllib  
 
 
# By default Windows kills Python with Ctrl+Break. Instead make Ctrl+Break  
# raise a KeyboardInterrupt.  
if hasattr(signal, 'SIGBREAK'):  
signal.signal(signal.SIGBREAK, signal.default_int_handler)  
 
 
mimetypes.add_type('text/plain', '.vbs')  
 
 
class ResultEncoder(simplejson.JSONEncoder):  
def default(self, obj):  
try:  
iterable = iter(obj)  
except TypeError:  
pass  
else:  
return list(iterable)  
return simplejson.JSONEncoder.default(self, obj)  
 
# Code taken from  
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/425210/index_txt  
# An alternate approach is shown at  
# http://mail.python.org/pipermail/python-list/2003-July/212751.html  
# but it requires multiple threads. A sqlite object can only be used from one  
# thread.  
class StoppableHTTPServer(BaseHTTPServer.HTTPServer):  
def server_bind(self):  
BaseHTTPServer.HTTPServer.server_bind(self)  
self.socket.settimeout(1)  
self._run = True  
 
def get_request(self):  
while self._run:  
try:  
sock, addr = self.socket.accept()  
sock.settimeout(None)  
return (sock, addr)  
except socket.timeout:  
pass  
 
def stop(self):  
self._run = False  
 
def serve(self):  
while self._run:  
self.handle_request()  
 
 
def StopToTuple(stop):  
"""Return tuple as expected by javascript function addStopMarkerFromList"""  
return (stop.stop_id, stop.stop_name, float(stop.stop_lat),  
float(stop.stop_lon), stop.location_type, stop.stop_code)  
def StopZoneToTuple(stop):  
"""Return tuple as expected by javascript function addStopMarkerFromList"""  
return (stop.stop_id, stop.stop_name, float(stop.stop_lat),  
float(stop.stop_lon), stop.location_type, stop.stop_code, stop.zone_id)  
 
class ScheduleRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):  
def do_GET(self):  
scheme, host, path, x, params, fragment = urlparse.urlparse(self.path)  
parsed_params = {}  
for k in params.split('&'):  
k = urllib.unquote(k)  
if '=' in k:  
k, v = k.split('=', 1)  
parsed_params[k] = unicode(v, 'utf8')  
else:  
parsed_params[k] = ''  
 
if path == '/':  
return self.handle_GET_home()  
 
m = re.match(r'/json/([a-z]{1,64})', path)  
if m:  
handler_name = 'handle_json_GET_%s' % m.group(1)  
handler = getattr(self, handler_name, None)  
if callable(handler):  
return self.handle_json_wrapper_GET(handler, parsed_params)  
 
# Restrict allowable file names to prevent relative path attacks etc  
m = re.match(r'/file/([a-z0-9_-]{1,64}\.?[a-z0-9_-]{1,64})$', path)  
if m and m.group(1):  
try:  
f, mime_type = self.OpenFile(m.group(1))  
return self.handle_static_file_GET(f, mime_type)  
except IOError, e:  
print "Error: unable to open %s" % m.group(1)  
# Ignore and treat as 404  
 
m = re.match(r'/([a-z]{1,64})', path)  
if m:  
handler_name = 'handle_GET_%s' % m.group(1)  
handler = getattr(self, handler_name, None)  
if callable(handler):  
return handler(parsed_params)  
 
return self.handle_GET_default(parsed_params, path)  
 
def OpenFile(self, filename):  
"""Try to open filename in the static files directory of this server.  
Return a tuple (file object, string mime_type) or raise an exception."""  
(mime_type, encoding) = mimetypes.guess_type(filename)  
assert mime_type  
# A crude guess of when we should use binary mode. Without it non-unix  
# platforms may corrupt binary files.  
if mime_type.startswith('text/'):  
mode = 'r'  
else:  
mode = 'rb'  
return open(os.path.join(self.server.file_dir, filename), mode), mime_type  
 
def handle_GET_default(self, parsed_params, path):  
self.send_error(404)  
 
def handle_static_file_GET(self, fh, mime_type):  
content = fh.read()  
self.send_response(200)  
self.send_header('Content-Type', mime_type)  
self.send_header('Content-Length', str(len(content)))  
self.end_headers()  
self.wfile.write(content)  
 
def AllowEditMode(self):  
return False  
 
def handle_GET_home(self):  
schedule = self.server.schedule  
(min_lat, min_lon, max_lat, max_lon) = schedule.GetStopBoundingBox()  
forbid_editing = ('true', 'false')[self.AllowEditMode()]  
 
agency = ', '.join(a.agency_name for a in schedule.GetAgencyList()).encode('utf-8')  
 
key = self.server.key  
host = self.server.host  
 
# A very simple template system. For a fixed set of values replace [xxx]  
# with the value of local variable xxx  
f, _ = self.OpenFile('index.html')  
content = f.read()  
for v in ('agency', 'min_lat', 'min_lon', 'max_lat', 'max_lon', 'key',  
'host', 'forbid_editing'):  
content = content.replace('[%s]' % v, str(locals()[v]))  
 
self.send_response(200)  
self.send_header('Content-Type', 'text/html')  
self.send_header('Content-Length', str(len(content)))  
self.end_headers()  
self.wfile.write(content)  
 
def handle_json_GET_routepatterns(self, params):  
"""Given a route_id generate a list of patterns of the route. For each  
pattern include some basic information and a few sample trips."""  
schedule = self.server.schedule  
route = schedule.GetRoute(params.get('route', None))  
if not route:  
self.send_error(404)  
return  
time = int(params.get('time', 0))  
sample_size = 10 # For each pattern return the start time for this many trips  
 
pattern_id_trip_dict = route.GetPatternIdTripDict()  
patterns = []  
 
for pattern_id, trips in pattern_id_trip_dict.items():  
time_stops = trips[0].GetTimeStops()  
if not time_stops:  
continue  
has_non_zero_trip_type = False;  
for trip in trips:  
if trip['trip_type'] and trip['trip_type'] != '0':  
has_non_zero_trip_type = True  
name = u'%s to %s, %d stops' % (time_stops[0][2].stop_name, time_stops[-1][2].stop_name, len(time_stops))  
transitfeed.SortListOfTripByTime(trips)  
 
num_trips = len(trips)  
if num_trips <= sample_size:  
start_sample_index = 0  
num_after_sample = 0  
else:  
# Will return sample_size trips that start after the 'time' param.  
 
# Linear search because I couldn't find a built-in way to do a binary  
# search with a custom key.  
start_sample_index = len(trips)  
for i, trip in enumerate(trips):  
if trip.GetStartTime() >= time:  
start_sample_index = i  
break  
 
num_after_sample = num_trips - (start_sample_index + sample_size)  
if num_after_sample < 0:  
# Less than sample_size trips start after 'time' so return all the  
# last sample_size trips.  
num_after_sample = 0  
start_sample_index = num_trips - sample_size  
 
sample = []  
for t in trips[start_sample_index:start_sample_index + sample_size]:  
sample.append( (t.GetStartTime(), t.trip_id) )  
 
patterns.append((name, pattern_id, start_sample_index, sample,  
num_after_sample, (0,1)[has_non_zero_trip_type]))  
 
patterns.sort()  
return patterns  
 
def handle_json_wrapper_GET(self, handler, parsed_params):  
"""Call handler and output the return value in JSON."""  
schedule = self.server.schedule  
result = handler(parsed_params)  
content = ResultEncoder().encode(result)  
self.send_response(200)  
self.send_header('Content-Type', 'text/plain')  
self.send_header('Content-Length', str(len(content)))  
self.end_headers()  
self.wfile.write(content)  
 
def handle_json_GET_routes(self, params):  
"""Return a list of all routes."""  
schedule = self.server.schedule  
result = []  
for r in schedule.GetRouteList():  
servicep = None  
for t in schedule.GetTripList():  
if t.route_id == r.route_id:  
servicep = t.service_period  
break  
result.append( (r.route_id, r.route_short_name, r.route_long_name, servicep.service_id) )  
result.sort(key = lambda x: x[1:3])  
return result  
 
def handle_json_GET_routerow(self, params):  
schedule = self.server.schedule  
route = schedule.GetRoute(params.get('route', None))  
return [transitfeed.Route._FIELD_NAMES, route.GetFieldValuesTuple()]  
 
def handle_json_GET_routetrips(self, params):  
""" Get a trip for a route_id (preferablly the next one) """  
schedule = self.server.schedule  
query = params.get('route_id', None).lower()  
result = []  
for t in schedule.GetTripList():  
if t.route_id == query:  
result.append ( (t.GetStartTime(), t.trip_id) )  
return sorted(result, key=lambda trip: trip[0])  
 
def handle_json_GET_triprows(self, params):  
"""Return a list of rows from the feed file that are related to this  
trip."""  
schedule = self.server.schedule  
try:  
trip = schedule.GetTrip(params.get('trip', None))  
except KeyError:  
# if a non-existent trip is searched for, the return nothing  
return  
route = schedule.GetRoute(trip.route_id)  
trip_row = dict(trip.iteritems())  
route_row = dict(route.iteritems())  
return [['trips.txt', trip_row], ['routes.txt', route_row]]  
 
def handle_json_GET_tripstoptimes(self, params):  
schedule = self.server.schedule  
try:  
trip = schedule.GetTrip(params.get('trip'))  
except KeyError:  
# if a non-existent trip is searched for, the return nothing  
return  
time_stops = trip.GetTimeInterpolatedStops()  
stops = []  
times = []  
for arr,ts,is_timingpoint in time_stops:  
stops.append(StopToTuple(ts.stop))  
times.append(arr)  
return [stops, times]  
 
def handle_json_GET_tripshape(self, params):  
schedule = self.server.schedule  
try:  
trip = schedule.GetTrip(params.get('trip'))  
except KeyError:  
# if a non-existent trip is searched for, the return nothing  
return  
points = []  
if trip.shape_id:  
shape = schedule.GetShape(trip.shape_id)  
for (lat, lon, dist) in shape.points:  
points.append((lat, lon))  
else:  
time_stops = trip.GetTimeStops()  
for arr,dep,stop in time_stops:  
points.append((stop.stop_lat, stop.stop_lon))  
return points  
 
def handle_json_GET_neareststops(self, params):  
"""Return a list of the nearest 'limit' stops to 'lat', 'lon'"""  
schedule = self.server.schedule  
lat = float(params.get('lat'))  
lon = float(params.get('lon'))  
limit = int(params.get('limit'))  
stops = schedule.GetNearestStops(lat=lat, lon=lon, n=limit)  
return [StopToTuple(s) for s in stops]  
 
def handle_json_GET_boundboxstops(self, params):  
"""Return a list of up to 'limit' stops within bounding box with 'n','e'  
and 's','w' in the NE and SW corners. Does not handle boxes crossing  
longitude line 180."""  
schedule = self.server.schedule  
n = float(params.get('n'))  
e = float(params.get('e'))  
s = float(params.get('s'))  
w = float(params.get('w'))  
limit = int(params.get('limit'))  
stops = schedule.GetStopsInBoundingBox(north=n, east=e, south=s, west=w, n=limit)  
return [StopToTuple(s) for s in stops]  
 
def handle_json_GET_stops(self, params):  
schedule = self.server.schedule  
return [StopToTuple(s) for s in schedule.GetStopList()]  
 
def handle_json_GET_timingpoints(self, params):  
schedule = self.server.schedule  
matches = []  
for s in schedule.GetStopList():  
if s.stop_code.find("Wj") == -1:  
matches.append(StopToTuple(s))  
return matches  
 
def handle_json_GET_stopsearch(self, params):  
schedule = self.server.schedule  
query = params.get('q', None).lower()  
matches = []  
for s in schedule.GetStopList():  
if s.stop_name.lower().find(query) != -1 or s.stop_code.lower().find(query) != -1:  
matches.append(StopToTuple(s))  
return matches  
 
def handle_json_GET_stopnamesearch(self, params):  
schedule = self.server.schedule  
query = params.get('q', None).lower()  
matches = []  
for s in schedule.GetStopList():  
if s.stop_name.lower().find(query) != -1:  
matches.append(StopToTuple(s))  
return matches  
 
def handle_json_GET_stopcodesearch(self, params):  
schedule = self.server.schedule  
query = params.get('q', None).lower()  
matches = []  
for s in schedule.GetStopList():  
if s.stop_code.lower().find(query) != -1:  
matches.append(StopToTuple(s))  
return matches  
 
def handle_json_GET_stopzonesearch(self, params):  
schedule = self.server.schedule  
query = params.get('q', None).lower()  
matches = []  
for s in schedule.GetStopList():  
if s.zone_id != None and s.zone_id.lower().find(query) != -1:  
matches.append(StopToTuple(s))  
return matches  
 
def handle_json_GET_stop(self, params):  
schedule = self.server.schedule  
query = params.get('stop_id', None).lower()  
for s in schedule.GetStopList():  
if s.stop_id.lower() == query:  
return StopToTuple(s)  
return []  
 
def handle_json_GET_stoptrips(self, params):  
"""Given a stop_id and time in seconds since midnight return the next  
trips to visit the stop."""  
schedule = self.server.schedule  
stop = schedule.GetStop(params.get('stop', None))  
time = int(params.get('time', 0))  
service_period = params.get('service_period', None)  
time_trips = stop.GetStopTimeTrips(schedule)  
time_trips.sort() # OPT: use bisect.insort to make this O(N*ln(N)) -> O(N)  
# Keep the first 15 after param 'time'.  
# Need make a tuple to find correct bisect point  
time_trips = time_trips[bisect.bisect_left(time_trips, (time, 0)):]  
time_trips = time_trips[:15]  
result = []  
for time, (trip, index), tp in time_trips:  
headsign = None  
# Find the most recent headsign from the StopTime objects  
for stoptime in trip.GetStopTimes()[index::-1]:  
if stoptime.stop_headsign:  
headsign = stoptime.stop_headsign  
break  
# If stop_headsign isn't found, look for a trip_headsign  
if not headsign:  
headsign = trip.trip_headsign  
route = schedule.GetRoute(trip.route_id)  
trip_name = ''  
if route.route_short_name:  
trip_name += route.route_short_name  
if route.route_long_name:  
if len(trip_name):  
trip_name += " - "  
trip_name += route.route_long_name  
# comment out directions because we already have them in the long name  
#if headsign:  
# trip_name += " (Direction: %s)" % headsign  
if service_period == None or trip.service_id == service_period:  
result.append((time, (trip.trip_id, trip_name, trip.service_id), tp))  
return result  
 
def handle_GET_ttablegraph(self,params):  
"""Draw a Marey graph in SVG for a pattern (collection of trips in a route  
that visit the same sequence of stops)."""  
schedule = self.server.schedule  
marey = MareyGraph()  
trip = schedule.GetTrip(params.get('trip', None))  
route = schedule.GetRoute(trip.route_id)  
height = int(params.get('height', 300))  
 
if not route:  
print 'no such route'  
self.send_error(404)  
return  
 
pattern_id_trip_dict = route.GetPatternIdTripDict()  
pattern_id = trip.pattern_id  
if pattern_id not in pattern_id_trip_dict:  
print 'no pattern %s found in %s' % (pattern_id, pattern_id_trip_dict.keys())  
self.send_error(404)  
return  
triplist = pattern_id_trip_dict[pattern_id]  
 
pattern_start_time = min((t.GetStartTime() for t in triplist))  
pattern_end_time = max((t.GetEndTime() for t in triplist))  
 
marey.SetSpan(pattern_start_time,pattern_end_time)  
marey.Draw(triplist[0].GetPattern(), triplist, height)  
 
content = marey.Draw()  
 
self.send_response(200)  
self.send_header('Content-Type', 'image/svg+xml')  
self.send_header('Content-Length', str(len(content)))  
self.end_headers()  
self.wfile.write(content)  
 
 
def FindPy2ExeBase():  
"""If this is running in py2exe return the install directory else return  
None"""  
# py2exe puts gtfsscheduleviewer in library.zip. For py2exe setup.py is  
# configured to put the data next to library.zip.  
windows_ending = gtfsscheduleviewer.__file__.find('\\library.zip\\')  
if windows_ending != -1:  
return transitfeed.__file__[:windows_ending]  
else:  
return None  
 
 
def FindDefaultFileDir():  
"""Return the path of the directory containing the static files. By default  
the directory is called 'files'. The location depends on where setup.py put  
it."""  
base = FindPy2ExeBase()  
if base:  
return os.path.join(base, 'schedule_viewer_files')  
else:  
# For all other distributions 'files' is in the gtfsscheduleviewer  
# directory.  
base = os.path.dirname(gtfsscheduleviewer.__file__) # Strip __init__.py  
return os.path.join(base, 'files')  
 
 
def GetDefaultKeyFilePath():  
"""In py2exe return absolute path of file in the base directory and in all  
other distributions return relative path 'key.txt'"""  
windows_base = FindPy2ExeBase()  
if windows_base:  
return os.path.join(windows_base, 'key.txt')  
else:  
return 'key.txt'  
 
 
def main(RequestHandlerClass = ScheduleRequestHandler):  
usage = \  
'''%prog [options] [<input GTFS.zip>]  
 
Runs a webserver that lets you explore a <input GTFS.zip> in your browser.  
 
If <input GTFS.zip> is omited the filename is read from the console. Dragging  
a file into the console may enter the filename.  
'''  
parser = util.OptionParserLongError(  
usage=usage, version='%prog '+transitfeed.__version__)  
parser.add_option('--feed_filename', '--feed', dest='feed_filename',  
help='file name of feed to load')  
parser.add_option('--key', dest='key',  
help='Google Maps API key or the name '  
'of a text file that contains an API key')  
parser.add_option('--host', dest='host', help='Host name of Google Maps')  
parser.add_option('--port', dest='port', type='int',  
help='port on which to listen')  
parser.add_option('--file_dir', dest='file_dir',  
help='directory containing static files')  
parser.add_option('-n', '--noprompt', action='store_false',  
dest='manual_entry',  
help='disable interactive prompts')  
parser.set_defaults(port=8765,  
host='maps.google.com',  
file_dir=FindDefaultFileDir(),  
manual_entry=True)  
(options, args) = parser.parse_args()  
 
if not os.path.isfile(os.path.join(options.file_dir, 'index.html')):  
print "Can't find index.html with --file_dir=%s" % options.file_dir  
exit(1)  
 
if not options.feed_filename and len(args) == 1:  
options.feed_filename = args[0]  
 
if not options.feed_filename and options.manual_entry:  
options.feed_filename = raw_input('Enter Feed Location: ').strip('"')  
 
default_key_file = GetDefaultKeyFilePath()  
if not options.key and os.path.isfile(default_key_file):  
options.key = open(default_key_file).read().strip()  
 
if options.key and os.path.isfile(options.key):  
options.key = open(options.key).read().strip()  
 
schedule = transitfeed.Schedule(problem_reporter=transitfeed.ProblemReporter())  
print 'Loading data from feed "%s"...' % options.feed_filename  
print '(this may take a few minutes for larger cities)'  
schedule.Load(options.feed_filename)  
 
server = StoppableHTTPServer(server_address=('', options.port),  
RequestHandlerClass=RequestHandlerClass)  
server.key = options.key  
server.schedule = schedule  
server.file_dir = options.file_dir  
server.host = options.host  
server.feed_path = options.feed_filename  
 
print ("To view, point your browser at http://localhost:%d/" %  
(server.server_port))  
server.serve_forever()  
 
 
if __name__ == '__main__':  
main()  
 
cache/tiles  
cache/map  
 
[InternetShortcut]  
URL=http://gplotter.offwhite.net/  
 
[InternetShortcut]  
URL=http://brennan.offwhite.net/blog/2005/07/23/new-google-maps-icons-free/  
 
 Binary files a/busui/staticmaplite/images/markers/Thumbs.db and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb1.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb10.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb11.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb12.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb13.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb14.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb15.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb16.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb17.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb18.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb19.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb2.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb20.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb21.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb22.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb23.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb24.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb25.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb3.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb4.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb5.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb6.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb7.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb8.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb9.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong1.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong10.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong11.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong12.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong13.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong14.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong15.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong16.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong17.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong18.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong19.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong2.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong20.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong21.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong22.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong23.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong24.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong25.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong3.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong4.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong5.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong6.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong7.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong8.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong9.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr1.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr10.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr11.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr12.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr13.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr14.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr15.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr16.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr17.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr18.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr19.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr2.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr20.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr21.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr22.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr23.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr24.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr25.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr3.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr4.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr5.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr6.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr7.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr8.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr9.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icons.psd and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/lightblue1.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/lightblue2.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/lightblue3.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/lightblue4.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/lightblue5.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/ol-marker-blue.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/ol-marker-gold.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/ol-marker-green.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/ol-marker.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/osm_logo.png and /dev/null differ
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de-de" lang="de-de">  
<head>  
<!--  
CSS based on template of Dandelion wiki engine by Radomir Dopieralski who released this  
template under the terms of GNU GPL. http://dandelion.sheep.art.pl/  
-->  
<meta http-equiv="content-type" content="text/html; charset=utf-8" />  
<title>staticMapLite</title>  
<style type="text/css">  
html{font:96% sans-serif;color:#000;background:#f7f7f7;line-height:1.4;}  
body{color:#333;}  
#wrapper{margin:auto;width:60em;position:relative;}  
#header{padding:0px 0px 7px 0px; height: 1em;}  
#header h1 { float:left; width: 40%; }  
#content{background:white;padding:1em;border:1px solid #e0d78a;outline:0.5em solid #fef4a4; margin:0.5em 0;padding:20px;min-height:20em;}  
h1{margin-top:0px;}  
h1,h2,h3,h4,h5,h6{letter-spacing:0.05em;color:#1474CA;font-weight:normal;}  
h1 a:hover,h2 a:hover,h3 a:hover,h4 a:hover,h5 a:hover,h6 a:hover{text-decoration:none;}  
a{color:#1474CA;text-decoration:none;}  
a:visited{color:#1474CA;}  
a.pending{color:#c174a0;}  
a:hover{text-decoration:underline;}  
a img{border:none;}  
input,textarea{font-size:94%;border:1px solid #999;background:#fff;color:#666;outline:0.2em solid #eee;padding:0px;line-height:1.2;margin:0.5em;vertical-align:middle;}  
textarea{display:block;margin:0.5em auto;width:100%;}  
pre{outline:0.4em solid #eee;padding:0.5em;margin:0.5em;border:1px solid #e0d78a;background:#fef4a4;color:#644e22;}  
img{border:1px solid #ccc;outline:0.25em solid #eee;padding:0.25em;margin:0.25em 0 0.25em 0.5em;background:#fff;}  
hr{height:0;border:none;color:#fff;background:transparent;border-bottom:1px solid #ccc; margin:0.5em 0;}  
#diff {outline:none;border:none;}  
#diff ins{color:green;text-decoration:none;font-weight:bold;}  
#diff del{color:red;text-decoration:line-through;}  
#diff{background:#fff;line-height:1.25;padding:1em;white-space:pre-wrap;word-wrap:break-word; white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;width:97%;}  
hr{margin:10px 0 10px 0;height:0px;overflow:hidden;border:0px;border-top:2px solid #ccc;}  
.error{color:#F25A5A;font-weight:bold;}  
form{display:inline;}  
#contentTextarea{height:44em;}  
#toc{margin:5px 0 5px 10px;padding:6px 5px 7px 0px;float:right;list-style:none;outline:0.4em solid #eee;background:#fef4a4;border:1px solid #e0d78a;}  
#toc ul{list-style:none;padding:3px 0 3px 10px;}  
#toc li{font-size:11px;padding-left:10px;}  
#toc ul li{font-size:10px;}  
#toc ul ul li{font-size:9px;}  
#toc ul ul ul li{font-size:8px;}  
#toc ul ul ul ul li{font-size:7px;}  
.pageVersionsList{letter-spacing:0px;font-variant:normal;font-size:12px;}  
#renameForm{float:left;}  
.clear{clear:both;}  
.tagList{padding:0.2em 0.4em 0.2em 0.4em;margin-top:0.5em;border:1px dashed #e0d78a;background:#fef4a4;color:#644e22;}  
.tagCloud{float:right;width:200px;padding:0.5em;margin:1em;border:1px dashed #e0d78a;background:#fef4a4;color:#644e22;}  
#fileTable{border-collapse:collapse;}  
#fileTable td{border:1px solid #FEF4A4;padding:2px 6px 2px 6px;}  
h2 span.par-edit, h3 span.par-edit, h4 span.par-edit, h5 span.par-edit, h6 span.par-edit {display:none;}  
h2:hover span.par-edit, h3:hover span.par-edit, h4:hover span.par-edit, h5:hover span.par-edit, h6:hover span.par-edit {display:inline;font-size:x-small;}  
.comment-item { border:1px solid #999;color:#666;outline:0.2em solid #eee; }  
.resizeTextareaDiv { margin-top: 5px;}  
a.toolbarTextareaItem { padding-right: 10px; }  
a.external:after { content: "\2197";}  
</style>  
</head>  
 
<body>  
<div id="wrapper">  
<div id="header">  
</div>  
<div id="content">  
 
<div class="par-div">  
<h2>  
staticMapLite - simple map for your website  
</h2>  
<p>  
<img src="staticmap.php?center=40.714728,-73.998672&zoom=14&size=865x512&maptype=mapnik" width="865" height="512" /></p>  
<p>  
This image was created using the following simple &lt;img> tag:  
<pre>&lt;img src="staticmap.php?center=40.714728,-73.998672&amp;zoom=14&amp;size=865x512&amp;maptype=mapnik" /&gt;</pre>  
</p>  
</div>  
<hr />  
<div class="par-div">  
<h3>  
Place Markers  
</h3>  
 
<p>  
<img src="staticmap.php?center=40.714728,-73.998672&zoom=14&size=865x512&maptype=mapnik&markers=40.702147,-74.015794,lightblue1|40.711614,-74.012318,lightblue2|40.718217,-73.998284,lightblue3" width="865" height="512" />  
</p><p> Add markers by appending them to the image URL:  
<pre>markers=40.702147,-74.015794,lightblue1|40.711614,-74.012318,lightblue2|40.718217,-73.998284,lightblue3</pre>  
</p>  
</div>  
<hr />  
<div class="par-div">  
<h3>  
Use Different Map Styles (Tile Sources)  
</h3>  
 
<p>  
<div style="float:left; margin-right: 10px">  
<img src="staticmap.php?center=40.714728,-73.998672&zoom=14&size=256x256&maptype=mapnik" width="256" height="256" />  
<pre>maptype=mapnik</pre>  
</div>  
<div style="float:left; margin-right: 10px">  
<img src="staticmap.php?center=40.714728,-73.998672&zoom=14&size=256x256&maptype=osmarenderer" width="256" height="256" />  
<pre>maptype=osmarenderer</pre>  
</div>  
<div style="float:left; margin-right: 10px">  
<img src="staticmap.php?center=40.714728,-73.998672&zoom=14&size=256x256&maptype=cycle" width="256" height="256" />  
<pre>maptype=cycle</pre>  
</div>  
<br style="clear:both" />  
</p>  
</div>  
 
</div>  
<div id="footer">  
<div style="text-align:center;padding:7px;color:#ccc">  
sponsored by <a href="http://dfacts.de">dFacts Network</a>  
</div>  
</div>  
</div>  
</body>  
</html>  
chcon -R -t httpd_sys_content_rw_t cache  
 
 
<?php  
 
/**  
* staticMapLite 0.02  
*  
* Copyright 2009 Gerhard Koch  
*  
* Licensed under the Apache License, Version 2.0 (the "License");  
* you may not use this file except in compliance with the License.  
* You may obtain a copy of the License at  
*  
* http://www.apache.org/licenses/LICENSE-2.0  
*  
* Unless required by applicable law or agreed to in writing, software  
* distributed under the License is distributed on an "AS IS" BASIS,  
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
* See the License for the specific language governing permissions and  
* limitations under the License.  
*  
* @author Gerhard Koch <gerhard.koch AT ymail.com>  
*  
* USAGE:  
*  
* staticmap.php?center=40.714728,-73.998672&zoom=14&size=512x512&maptype=mapnik&markers=40.702147,-74.015794,blues|40.711614,-74.012318,greeng|40.718217,-73.998284,redc  
*  
*/  
 
error_reporting(0);  
ini_set('display_errors','off');  
 
Class staticMapLite {  
 
protected $tileSize = 256;  
protected $tileSrcUrl = array( 'mapnik' => 'http://tile.openstreetmap.org/{Z}/{X}/{Y}.png',  
'osmarenderer' => 'http://c.tah.openstreetmap.org/Tiles/tile/{Z}/{X}/{Y}.png',  
'cycle' => 'http://c.andy.sandbox.cloudmade.com/tiles/cycle/{Z}/{X}/{Y}.png'  
);  
 
protected $tileDefaultSrc = 'mapnik';  
protected $markerBaseDir = 'images/markers';  
protected $osmLogo = 'images/osm_logo.png';  
 
protected $useTileCache = true;  
protected $tileCacheBaseDir = './cache/tiles';  
 
protected $useMapCache = true;  
protected $mapCacheBaseDir = './cache/maps';  
protected $mapCacheID = '';  
protected $mapCacheFile = '';  
protected $mapCacheExtension = 'png';  
 
protected $zoom, $lat, $lon, $width, $height, $markers, $image, $maptype;  
protected $centerX, $centerY, $offsetX, $offsetY;  
 
public function __construct(){  
$this->zoom = 0;  
$this->lat = 0;  
$this->lon = 0;  
$this->width = 500;  
$this->height = 350;  
$this->markers = array();  
$this->maptype = $this->tileDefaultSrc;  
}  
 
public function parseParams(){  
global $_GET;  
 
// get zoom from GET paramter  
$this->zoom = $_GET['zoom']?intval($_GET['zoom']):0;  
if($this->zoom>18)$this->zoom = 18;  
 
// get lat and lon from GET paramter  
list($this->lat,$this->lon) = split(',',$_GET['center']);  
$this->lat = floatval($this->lat);  
$this->lon = floatval($this->lon);  
 
// get zoom from GET paramter  
if($_GET['size']){  
list($this->width, $this->height) = split('x',$_GET['size']);  
$this->width = intval($this->width);  
$this->height = intval($this->height);  
}  
if($_GET['markers']){  
$markers = split('%7C|\|',$_GET['markers']);  
foreach($markers as $marker){  
list($markerLat, $markerLon, $markerImage) = split(',',$marker);  
$markerLat = floatval($markerLat);  
$markerLon = floatval($markerLon);  
$markerImage = basename($markerImage);  
$this->markers[] = array('lat'=>$markerLat, 'lon'=>$markerLon, 'image'=>$markerImage);  
}  
 
}  
if($_GET['maptype']){  
if(array_key_exists($_GET['maptype'],$this->tileSrcUrl)) $this->maptype = $_GET['maptype'];  
}  
}  
 
public function lonToTile($long, $zoom){  
return (($long + 180) / 360) * pow(2, $zoom);  
}  
 
public function latToTile($lat, $zoom){  
return (1 - log(tan($lat * pi()/180) + 1 / cos($lat* pi()/180)) / pi()) /2 * pow(2, $zoom);  
}  
 
public function initCoords(){  
$this->centerX = $this->lonToTile($this->lon, $this->zoom);  
$this->centerY = $this->latToTile($this->lat, $this->zoom);  
$this->offsetX = floor((floor($this->centerX)-$this->centerX)*$this->tileSize);  
$this->offsetY = floor((floor($this->centerY)-$this->centerY)*$this->tileSize);  
}  
 
public function createBaseMap(){  
$this->image = imagecreatetruecolor($this->width, $this->height);  
$startX = floor($this->centerX-($this->width/$this->tileSize)/2);  
$startY = floor($this->centerY-($this->height/$this->tileSize)/2);  
$endX = ceil($this->centerX+($this->width/$this->tileSize)/2);  
$endY = ceil($this->centerY+($this->height/$this->tileSize)/2);  
$this->offsetX = -floor(($this->centerX-floor($this->centerX))*$this->tileSize);  
$this->offsetY = -floor(($this->centerY-floor($this->centerY))*$this->tileSize);  
$this->offsetX += floor($this->width/2);  
$this->offsetY += floor($this->height/2);  
$this->offsetX += floor($startX-floor($this->centerX))*$this->tileSize;  
$this->offsetY += floor($startY-floor($this->centerY))*$this->tileSize;  
 
for($x=$startX; $x<=$endX; $x++){  
for($y=$startY; $y<=$endY; $y++){  
$url = str_replace(array('{Z}','{X}','{Y}'),array($this->zoom, $x, $y), $this->tileSrcUrl[$this->maptype]);  
$tileImage = imagecreatefromstring($this->fetchTile($url));  
$destX = ($x-$startX)*$this->tileSize+$this->offsetX;  
$destY = ($y-$startY)*$this->tileSize+$this->offsetY;  
imagecopy($this->image, $tileImage, $destX, $destY, 0, 0, $this->tileSize, $this->tileSize);  
}  
}  
}  
 
 
public function placeMarkers(){  
foreach($this->markers as $marker){  
$markerLat = $marker['lat'];  
$markerLon = $marker['lon'];  
$markerImage = $marker['image'];  
$markerIndex++;  
$markerFilename = $markerImage?(file_exists($this->markerBaseDir.'/'.$markerImage.".png")?$markerImage:'lightblue'.$markerIndex):'lightblue'.$markerIndex;  
if(file_exists($this->markerBaseDir.'/'.$markerFilename.".png")){  
$markerImg = imagecreatefrompng($this->markerBaseDir.'/'.$markerFilename.".png");  
} else {  
$markerImg = imagecreatefrompng($this->markerBaseDir.'/lightblue1.png');  
}  
$destX = floor(($this->width/2)-$this->tileSize*($this->centerX-$this->lonToTile($markerLon, $this->zoom)));  
$destY = floor(($this->height/2)-$this->tileSize*($this->centerY-$this->latToTile($markerLat, $this->zoom)));  
$destY = $destY - imagesy($markerImg);  
 
imagecopy($this->image, $markerImg, $destX, $destY, 0, 0, imagesx($markerImg), imagesy($markerImg));  
 
};  
}  
 
 
 
public function tileUrlToFilename($url){  
return $this->tileCacheBaseDir."/".str_replace(array('http://'),'',$url);  
}  
 
public function checkTileCache($url){  
$filename = $this->tileUrlToFilename($url);  
if(file_exists($filename)){  
return file_get_contents($filename);  
}  
}  
 
public function checkMapCache(){  
$this->mapCacheID = md5($this->serializeParams());  
$filename = $this->mapCacheIDToFilename();  
if(file_exists($filename)) return true;  
}  
 
public function serializeParams(){  
return join("&",array($this->zoom,$this->lat,$this->lon,$this->width,$this->height, serialize($this->markers),$this->maptype));  
}  
 
public function mapCacheIDToFilename(){  
if(!$this->mapCacheFile){  
$this->mapCacheFile = $this->mapCacheBaseDir."/".substr($this->mapCacheID,0,2)."/".substr($this->mapCacheID,2,2)."/".substr($this->mapCacheID,4);  
}  
return $this->mapCacheFile.".".$this->mapCacheExtension;  
}  
 
 
 
public function mkdir_recursive($pathname, $mode){  
return mkdir($pathname, $mode, true);  
}  
public function writeTileToCache($url, $data){  
$filename = $this->tileUrlToFilename($url);  
$this->mkdir_recursive(dirname($filename),0777);  
file_put_contents($filename, $data);  
}  
 
public function fetchTile($url){  
if($this->useTileCache && ($cached = $this->checkTileCache($url))) return $cached;  
$ch = curl_init();  
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0");  
curl_setopt($ch, CURLOPT_URL, $url);  
$tile = curl_exec($ch);  
curl_close($ch);  
if($this->useTileCache){  
$this->writeTileToCache($url,$tile);  
}  
return $tile;  
 
}  
 
public function copyrightNotice(){  
$logoImg = imagecreatefrompng($this->osmLogo);  
imagecopy($this->image, $logoImg, imagesx($this->image)-imagesx($logoImg), imagesy($this->image)-imagesy($logoImg), 0, 0, imagesx($logoImg), imagesy($logoImg));  
 
}  
 
public function sendHeader(){  
header('Content-Type: image/png');  
$expires = 60*60*24*14;  
header("Pragma: public");  
header("Cache-Control: maxage=".$expires);  
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');  
}  
 
public function makeMap(){  
$this->initCoords();  
$this->createBaseMap();  
if(count($this->markers))$this->placeMarkers();  
if($this->osmLogo) $this->copyrightNotice();  
}  
 
public function showMap(){  
$this->parseParams();  
if($this->useMapCache){  
// use map cache, so check cache for map  
if(!$this->checkMapCache()){  
// map is not in cache, needs to be build  
$this->makeMap();  
$this->mkdir_recursive(dirname($this->mapCacheIDToFilename()),0777);  
imagepng($this->image,$this->mapCacheIDToFilename(),9);  
$this->sendHeader();  
if(file_exists($this->mapCacheIDToFilename())){  
return file_get_contents($this->mapCacheIDToFilename());  
} else {  
return imagepng($this->image);  
}  
} else {  
// map is in cache  
$this->sendHeader();  
return file_get_contents($this->mapCacheIDToFilename());  
}  
 
} else {  
// no cache, make map, send headers and deliver png  
$this->makeMap();  
$this->sendHeader();  
return imagepng($this->image);  
 
}  
}  
 
}  
 
$map = new staticMapLite();  
print $map->showMap();  
 
?>  
 
file:a/busui/stop.php (deleted)
<?php  
include('common.inc.php');  
$url = $APIurl."/json/stop?stop_id=".$_REQUEST['stopid'];  
$stop = json_decode(getPage($url));  
 
include_header($stop[1]);  
timePlaceSettings();  
echo '<div data-role="content" class="ui-content" role="main"><p>'.staticmap(Array(0 => Array($stop[2],$stop[3]))).'</p>';  
echo ' <ul data-role="listview" data-inset="true">';  
$url = $APIurl."/json/stoptrips?stop=".$_REQUEST['stopid']."&time=".midnight_seconds()."&service_period=".service_period();  
$trips = json_decode(getPage($url));  
debug(print_r($trips,true));  
foreach ($trips as $row)  
{  
echo '<li>';  
echo '<h3><a href="trip.php?stopid='.$_REQUEST['stopid'].'&tripid='.$row[1][0].'">'.$row[1][1];  
echo '<br><small>Via: '.viaPointNames($row[1][0],$_REQUEST['stopid']).'</small> </a></h3>';  
echo '<p class="ui-li-aside"><strong>'.midnight_seconds_to_time($row[0]).'</strong></p>';  
echo '</li>';  
}  
if (sizeof($trips) == 0) echo "<li> <center>No trips in the near future.</center> </li>";  
echo '</ul></div>';  
include_footer();  
?>  
 
file:a/busui/stopList.php (deleted)
<?php  
include('common.inc.php');  
 
function navbar() {  
echo'  
<div data-role="navbar">  
<ul>  
<li><a href="stopList.php">Timing Points</a></li>  
<li><a href="stopList.php?suburbs=yes">By Suburb</a></li>  
<li><a href="stopList.php?nearby=yes">Nearby Stops</a></li>  
<li><a href="stopList.php?allstops=yes">All Stops</a></li>  
</ul>  
</div>  
';  
timePlaceSettings();  
}  
// By suburb  
if (isset($_REQUEST['suburbs'])) {  
include_header("Stops by Suburb");  
navbar();  
echo ' <ul data-role="listview" data-filter="true" data-inset="true" >';  
foreach ($suburbs as $suburb) {  
echo '<li><a href="stopList.php?suburb='.urlencode($suburb).'">'.$suburb.'</a></li>';  
}  
echo '</ul>';  
} else {  
// Timing Points / All stops  
 
if ($_REQUEST['allstops']) {  
$url = $APIurl."/json/stops";  
include_header("All Stops");  
navbar();  
} else if ($_REQUEST['nearby']) {  
$url = $APIurl."/json/neareststops?lat={$_SESSION['lat']}&lon={$_SESSION['lon']}&limit=15";  
include_header("Nearby Stops");  
navbar();  
timePlaceSettings();  
} else if ($_REQUEST['suburb']) {  
$url = $APIurl."/json/stopzonesearch?q=".filter_var($_REQUEST['suburb'], FILTER_SANITIZE_STRING);  
include_header("Stops in ".ucwords(filter_var($_REQUEST['suburb'], FILTER_SANITIZE_STRING)));  
navbar();  
} else {  
$url = $APIurl."/json/timingpoints";  
include_header("Timing Points / Major Stops");  
navbar();  
}  
echo '<div class="noscriptnav"> Go to letter: ';  
foreach(range('A','Z') as $letter)  
{  
echo "<a href=\"#$letter\">$letter</a>&nbsp;";  
}  
echo "</div>  
<script>  
$('.noscriptnav').hide();  
</script>";  
echo ' <ul data-role="listview" data-filter="true" data-inset="true" >';  
$contents = json_decode(getPage($url));  
debug(print_r($contents,true));  
foreach ($contents as $key => $row) {  
$stopName[$key] = $row[1];  
}  
 
// Sort the stops by name  
array_multisort($stopName, SORT_ASC, $contents);  
 
$firstletter = "";  
foreach ($contents as $row)  
{  
if (substr($row[1],0,1) != $firstletter){  
echo "<a name=$firstletter></a>";  
$firstletter = substr($row[1],0,1);  
}  
echo '<li><a href="stop.php?stopid='.$row[0].'">'.bracketsMeanNewLine($row[1]).'</a></li>';  
}  
echo '</ul>';  
}  
include_footer();  
?>  
 
 
file:a/busui/trip.php (deleted)
<?php  
include('common.inc.php');  
$tripid = filter_var($_REQUEST['tripid'],FILTER_SANITIZE_NUMBER_INT);  
$stopid = filter_var($_REQUEST['stopid'],FILTER_SANITIZE_NUMBER_INT);  
if ($_REQUEST['routeid']) {  
$url = $APIurl."/json/routetrips?route_id=".filter_var($_REQUEST['routeid'],FILTER_SANITIZE_NUMBER_INT);  
$trips = json_decode(getPage($url));  
debug(print_r($trips,true));  
foreach ($trips as $trip)  
{  
if ($trip[0] < midnight_seconds()) {  
$tripid = $trip[1];  
break;  
}  
}  
if (!($tripid > 0)) $tripid = $trips[0][1];  
}  
$url = $APIurl."/json/triprows?trip=".$tripid;  
$trips = array_flatten(json_decode(getPage($url)));  
debug(print_r($trips,true));  
include_header("Stops on ". $trips[1]->route_short_name . ' '. $trips[1]->route_long_name);  
timePlaceSettings();  
echo ' <ul data-role="listview" data-inset="true">';  
 
 
$url = $APIurl."/json/tripstoptimes?trip=".$tripid;  
 
$json = json_decode(getPage($url));  
debug(print_r($json,true));  
$stops = $json[0];  
$times = $json[1];  
foreach ($stops as $key => $row)  
{  
echo '<li>';  
echo '<h3><a href="stop.php?stopid='.$row[0].'">'.bracketsMeanNewLine($row[1]);  
if ($row[0] == $stopid) echo "<br><small> Current Location</small>";  
echo '</a></h3>';  
echo '<p class="ui-li-aside">'.midnight_seconds_to_time($times[$key]).'</p>';  
echo '</li>';  
}  
echo '</ul>';  
include_footer();  
?>  
 
file:a/busui/tripPlanner.php (deleted)
<?php  
include('common.inc.php');  
include_header("Trip Planner", true, true);  
$from = (isset($_REQUEST['from']) ? filter_var($_REQUEST['from'],FILTER_SANITIZE_STRING) : "Brigalow");  
$to = (isset($_REQUEST['to']) ? filter_var($_REQUEST['to'],FILTER_SANITIZE_STRING) : "Barry");  
$date = (isset($_REQUEST['date']) ? filter_var($_REQUEST['date'],FILTER_SANITIZE_STRING) : date("m/d/Y"));  
$time = (isset($_REQUEST['time']) ? filter_var($_REQUEST['time'],FILTER_SANITIZE_STRING) : date("H:m"));  
# todo: convert date from form to h:ia?  
 
function tripPlanForm($errorMessage = "")  
{  
global $date,$time,$from,$to;  
echo "<font color=red>$errorMessage</font>";  
echo '<form action="tripPlanner.php" method="post">  
<div data-role="fieldcontain">  
<label for="from">I would like to go from</label>  
<input type="text" name="from" id="from" value="' . $from . '" />  
<a href="#" style="display:none" name="fromHere" id="fromHere"/>Here?</a>  
</div>  
<div data-role="fieldcontain">  
<label for="to"> to </label>  
<input type="text" name="to" id="to" value="' . $to . '" />  
<a href="#" style="display:none" name="toHere" id="toHere"/>Here?</a>  
</div>  
<div data-role="fieldcontain">  
<label for="date"> on </label>  
<input type="date" name="date" id="date" value="' . $date . '" />  
</div>  
<div data-role="fieldcontain">  
<label for="time"> at </label>  
<input type="time" name="time" id="time" value="' . $time . '" />  
</div>  
<input type="submit" value="Go!"></form>';  
echo "<script>  
$('#toHere').click(function(event) { $('#to').val(getCookie('geolocate')); return false;});  
$('#toHere').show();  
$('#fromHere').click(function(event) { $('#from').val(getCookie('geolocate')); return false;});  
$('#fromHere').show();  
 
</script>";  
}  
 
function processItinerary($itineraryNumber, $itinerary)  
{  
echo '<div data-role="collapsible" ' . ($itineraryNumber > 0 ? 'data-collapsed="true"' : "") . '> <h3> Option #' . ($itineraryNumber + 1) . ": " . floor($itinerary->duration / 60000) . " minutes ({$itinerary->startTime} to {$itinerary->endTime})</h3><p>";  
echo "Walking time: " . floor($itinerary->walkTime / 60000) . " minutes (" . floor($itinerary->walkDistance) . " meters)<br>\n";  
echo "Transit time: " . floor($itinerary->transitTime / 60000) . " minutes<br>\n";  
echo "Waiting time: " . floor($itinerary->waitingTime / 60000) . " minutes<br>\n";  
 
 
 
if (is_array($itinerary->legs->leg)) {  
$legMarkers = array();  
foreach ($itinerary->legs->leg as $legNumber => $leg) {  
$legMarkers[] = array($leg->from->lat, $leg->from->lon);  
}  
echo '' . staticmap($legMarkers) . "<br>\n";  
echo '<ul>';  
foreach ($itinerary->legs->leg as $legNumber => $leg) {  
echo '<li>';  
processLeg($legNumber, $leg);  
echo "</li>";  
}  
echo "</ul>";  
} else {  
echo '' . staticmap(array(array($itinerary->legs->leg->from->lat, $itinerary->legs->leg->from->lon))) . "<br>\n";  
processLeg(0, $itinerary->legs->leg);  
}  
 
echo "</p></div>";  
}  
 
function processLeg($legNumber, $leg) {  
$legArray = object2array($leg);  
echo '<h3>Leg #' . ($legNumber + 1) . " ( {$legArray['@mode']} from: {$leg->from->name} to {$leg->to->name}, " . floor($leg->duration / 60000) . " minutes) </h3>\n";  
if ($legArray["@mode"] === "BUS") {  
echo "Take bus {$legArray['@route']} " . str_replace("To", "towards", $legArray['@headsign']) . "<br>";  
} else {  
$walkStepMarkers = array();  
foreach ($leg->steps->walkSteps as $stepNumber => $step) {  
$walkStepMarkers[] = array($step->lat, $step->lon);  
}  
echo "" . staticmap($walkStepMarkers, "icong") . "<br>\n";  
foreach ($leg->steps->walkSteps as $stepNumber => $step) {  
echo "Walking step " . ($stepNumber + 1) . " $step->absoluteDirection / $step->relativeDirection on $step->streetName for " . floor($step->distance) . " meters<br>\n";  
}  
}  
}  
 
if ($_REQUEST['time']) {  
$toPlace = (startsWith($to, "-") ? $to : geocode($to, false));  
$fromPlace = (startsWith($from, "-") ? $from : geocode($from, false));  
if ($toPlace == "" || $fromPlace == "") {  
$errorMessage = "";  
if ($toPlace === "")  
$errorMessage .= urlencode($to) . " not found.<br>\n";  
if ($fromPlace === "")  
$errorMessage .= urlencode($from) . " not found.<br>\n";  
tripPlanForm($errorMessage);  
} else {  
$url = $otpAPIurl."ws/plan?date=" . urlencode($_REQUEST['date']) . "&time=" . urlencode($_REQUEST['time']) . "&mode=TRANSIT%2CWALK&optimize=QUICK&maxWalkDistance=840&wheelchair=false&toPlace=$toPlace&fromPlace=$fromPlace&intermediatePlaces=";  
$ch = curl_init($url);  
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
curl_setopt($ch, CURLOPT_HEADER, 0);  
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/json"));  
curl_setopt($ch,CURLOPT_TIMEOUT,5);  
$page = curl_exec($ch);  
 
if(curl_errno($ch)) { tripPlanForm("Trip planner temporarily unavailable: ".curl_errno($ch)." ".curl_error($ch));}  
else {  
$tripplan = json_decode($page);  
debug(print_r($triplan,true));  
echo "<h1> From: {$tripplan->plan->from->name} To: {$tripplan->plan->to->name} </h1>";  
echo "<h1> At: {$tripplan->plan->date} </h1>";  
 
if (is_array($tripplan->plan->itineraries->itinerary)) {  
echo '<div data-role="collapsible-set">';  
foreach ($tripplan->plan->itineraries->itinerary as $itineraryNumber => $itinerary) {  
processItinerary($itineraryNumber, $itinerary);  
}  
echo "</div>";  
} else {  
processItinerary(0, $tripplan->plan->itineraries->itinerary);  
}  
}  
curl_close($ch);  
}  
} else {  
tripPlanForm();  
}  
include_footer();  
?>  
 
file:a/busui/view.sh (deleted)
python schedule_viewer.py --feed=../maxious-canberra-transit-feed/cbrfeed.zip --key=ABQIAAAA95XYXN0cki3Yj_Sb71CFvBTPaLd08ONybQDjcH_VdYtHHLgZvRTw2INzI_m17_IoOUqH3RNNmlTk1Q  
 
<html>  
<head>  
<link rel="stylesheet" href="main.css" type="text/css">  
<title>Graphserver - The Open-Source Multi-Modal Trip Planner</title>  
</head>  
 
<body>  
<div id='container'>  
<a href="gallery.html"><img src="img/graphbanner.png"></a>  
<h1>Graphserver</h1>  
The open-source multi-modal trip planner.  
 
<h2>Code Repository</h2>  
<a href="http://github.com/bmander/graphserver/tree/master">http://github.com/bmander/graphserver/tree/master</a>  
 
<h2>Mailing List</h2>  
 
Direct questions and comments to the <a href="http://groups.google.com/group/graphserver">Graphserver Google Group</a>.  
 
<h2>Download</h2>  
 
<pre style="background-color:#F5F5F5"> $ wget http://github.com/bmander/graphserver/zipball/08132009</pre>  
 
Or, for the stout of heart, get a copy of the current working branch  
 
<pre style="background-color:#F5F5F5"> $ git clone git://github.com/bmander/graphserver.git </pre>  
 
<h2>Install</h2>  
 
<h3>Cold Start</h3>  
<p>You'll need a computer running linux. The following setup was tested and checked on <a href="http://aws.amazon.com/console/">Amazon EC2</a> small instance running Fedora, built from an image with id "ami-48aa4921", at a cost of $0.20/hour.<p>  
<p>You'll need to get git:</p>  
<p>On Ubuntu:</p>  
<pre style="background-color:#F5F5F5"> $ sudo apt-get install git-core </pre>  
<p>On Fedora:</p>  
<pre style="background-color:#F5F5F5"> $ yum install git-core</pre>  
 
<h3>Get The Prerequisites</h3>  
 
<p>You're about to compile C code against python development libraries. You need to prepare for that.</p>  
 
On Ubuntu:  
<pre style="background-color:#F5F5F5">$ sudo apt-get install python-setuptools  
$ sudo apt-get install build-essential  
$ sudo apt-get install python-dev  
</pre>  
 
On Fedora:  
<pre style="background-color:#F5F5F5">  
$ yum install python-setuptools-devel  
$ yum install gcc  
$ yum install gcc-c++  
$ yum install python-devel  
$ easy_install simplejson  
</pre>  
 
<h3>One-step Install</h3>  
<p>Get a copy of Graphserver</p>  
<pre style="background-color:#F5F5F5">$ git clone git://github.com/bmander/graphserver.git</pre>  
 
This will download and compile the core, download and install package dependencies, and install the python wrappers in one go.  
 
<pre style="background-color:#F5F5F5">$ cd graphserver/pygs  
$ sudo python setup.py install  
</pre>  
 
<h3>Install RTree</h3>  
<p>If you want to load OSM Data (and you probably do), you have to laboriously install RTree</p>  
<pre style="background-color:#F5F5F5"> $ wget http://download.osgeo.org/libspatialindex/spatialindex-1.4.0.tar.gz  
$ gunzip spatialindex-1.4.0.tar.gz  
$ tar -xvf spatialindex-1.4.0.tar  
$ cd spatialindex-1.4.0  
$ ./configure --prefix=/usr  
$ make  
$ make install  
$ easy_install RTree  
$ cp /usr/lib/python2.5/site-packages/Rtree-0.5.0-py2.5-linux-i686.egg/libsidx.so /usr/lib  
</pre>  
 
<h2>A Quick Tour of the Basics</h2>  
 
<pre style="background-color:#F5F5F5">  
$ python  
&gt;&gt;&gt; from graphserver.core import Graph, Street, State  
&gt;&gt;&gt; gg = Graph()  
&gt;&gt;&gt; gg.add_vertex("A")  
<span class="computeroutput">&lt;graphserver.core.Vertex object at 0xb7d9608c&gt;</span>  
&gt;&gt;&gt; gg.add_vertex("B")  
<span class="computeroutput">&lt;graphserver.core.Vertex object at 0xb7c397cc&gt;</span>  
&gt;&gt;&gt; gg.add_edge( "A", "B", Street("1", 100) )  
<span class="computeroutput">&lt;graphserver.core.Edge object at 0xb7c4a92c&gt;</span>  
&gt;&gt;&gt; gg.add_edge( "A", "B", Street("2", 50 ) )  
<span class="computeroutput">&lt;graphserver.core.Edge object at 0xb7da708c&gt;</span>  
&gt;&gt;&gt; gg.size #the graph is quite small  
<span class="computeroutput">2</span>  
&gt;&gt;&gt; gg.get_vertex("A").outgoing <span class="pycomment"># the graph is directional</span>  
<span class="computeroutput">[&lt;graphserver.core.Edge object at 0xb7b9accc&gt;, &lt;graphserver.core.Edge object at 0xb7b9acac&gt;]</span>  
&gt;&gt;&gt; gg.get_vertex("A").incoming  
<span class="computeroutput">[]</span>  
&gt;&gt;&gt; spt = gg.shortest_path_tree( "A", "B", State(1,0) )  
&gt;&gt;&gt; spt  
<span class="computeroutput">&lt;graphserver.core.ShortestPathTree object at 0xb7c45b8c&gt;</span>  
&gt;&gt;&gt; spt.get_vertex("A") <span class="pycomment"># the shortest path tree is a partial copy of the graph</span>  
<span class="computeroutput">&lt;graphserver.core.Vertex object at 0xb7c4a92c&gt;</span>  
&gt;&gt;&gt; spt.get_vertex("A").outgoing <span class="pycomment"># which only contains the shortest paths to all points closer than 'B' </span>  
<span class="computeroutput">[&lt;graphserver.core.Edge object at 0xb7b9adec&gt;]</span>  
&gt;&gt;&gt; vertices, edges = spt.path("B") <span class="pycomment"># you can get the path 'A' to 'B' from the shortest path tree</span>  
&gt;&gt;&gt; vertices <span class="pycomment"># a list of references to the SPT vertices along the shortest path</span>  
<span class="computeroutput">[&lt;graphserver.core.Vertex object at 0xb7b9ae4c&gt;, &lt;graphserver.core.Vertex object at 0xb7b9adec&gt;]</span>  
&gt;&gt;&gt; edges <span class="pycomment"># a list of references to the SPT edges along the shortest path</span>  
<span class="computeroutput">[&lt;graphserver.core.Edge object at 0xb7b9accc&gt;]</span>  
&gt;&gt;&gt; edges[0].payload <span class="pycomment"># the edge payload contains information about the edge</span>  
<span class="computeroutput">&lt;Street name='2' length=50.000000 rise=0.000000 fall=0.000000 way=0&gt;</span>  
&gt;&gt;&gt; vertices[-1].payload <span class="pycomment"># the payload of the final vertex has useful information</span>  
<span class="computeroutput">&lt;graphserver.core.State object at 0xb7c4a92c&gt;</span>  
&gt;&gt;&gt; vertices[-1].payload.time <span class="pycomment"># it takes 58 seconds to get from "A" to "B"</span>  
<span class="computeroutput">58</span>  
&gt;&gt;&gt; spt.destroy() <span class="pycomment"># these functions are thin wrappers around C functions</span>  
&gt;&gt;&gt; gg.destroy() <span class="pycomment"># so we have to perform garbage collection explicitly</span>  
&gt;&gt;&gt; exit()  
</pre>  
<h2>Compiling Graphs</h2>  
<h3>Loading OpenStreetMap Data</h3>  
 
Grab some OSM data. Here, we download an area around of Redding, CA, US from the OpenStreetMap HTTP API.  
<pre style="background-color:#F5F5F5"> $ wget http://api.openstreetmap.org/api/0.6/map?bbox=-122.4624,40.5505,-122.2876,40.6334 -O map.osm  
</pre>  
<p>Compile the OSM file into an OSMDB file, and then load that OSMDB file into a graph.</p>  
<pre style="background-color:#F5F5F5"> $ gs_osmdb_compile map.osm map.osmdb  
$ gs_import_osm map.gdb map.osmdb  
</pre>  
<p>Take a look at your new graph. This prints every vertex label in the graph:</p>  
<pre style="background-color:#F5F5F5"> $ gs_gdb_inspect map.gdb</pre>  
<p>Pick one and see all edges outgoing from that vertex:</p>  
<pre style="background-color:#F5F5F5"> $ gs_gdb_inspect map.gdb osm-92080455</pre>  
Prints:  
<pre style="background-color:#F5F5F5">osm-92080455 -> osm-91938757  
&lt;Street name='10585937-1' length=136.119463 rise=0.000000 fall=0.000000 way=849&gt;  
osm-92080455 -> osm-92080457  
&lt;Street name='10585937-2' length=139.452776 rise=0.000000 fall=0.000000 way=849&gt;  
osm-92080455 -> osm-92601143  
&lt;Street name='10596654-0' length=126.551782 rise=0.000000 fall=0.000000 way=1809&gt;  
osm-92080455 -> osm-92080381  
&lt;Street name='10596654-1' length=6.382770 rise=0.000000 fall=0.000000 way=1809&gt;</pre>  
 
<h3>Loading Public Transit Data</h3>  
 
Grab the GTFS file for your favorite transit agency. Here, we grab the GTFS for the transit system in Redding, CA:  
<pre style="background-color:#F5F5F5"> $ wget http://trilliumtransit.com/transit_feeds/redding/google_transit.zip -O redding_gtfs.zip</pre>  
<p>Compile the GTFS into a GTFSDB, and then compile that GTFSDB into a graph<p>  
<pre style="background-color:#F5F5F5"> $ gs_gtfsdb_build redding_gtfs.zip redding.gtfsdb  
$ gs_import_gtfs redding.gdb redding.gtfsdb</pre>  
<p>Use gs_gdb_inspect to check that your new transit graph is in good shape</p>  
<pre style="background-color:#F5F5F5"> $ gs_gdb_inspect redding.gdb sta-3622</pre>  
should print  
<pre style="background-color:#F5F5F5">sta-3622 -> psv-0-000-004  
&lt;TripBoard int_sid=0 sid=105A166 agency=0 calendar=165157760 timezone=164034504 boardings=[('1572A105B166', 23964), ('1598A105B166', 27564), ('1602A105B166', 31164), ('1607A105B166', 34764), ('1600A105B166', 38364), ('1605A105B166', 41964), ('1603A105B166', 45564), ('1608A105B166', 49164), ('1601A105B166', 52764), ('1606A105B166', 56364), ('1599A105B166', 59964), ('1604A105B166', 63564), ('1609A105B166', 67164)]&gt;  
sta-3622 -> psv-0-000-004  
&lt;TripBoard int_sid=1 sid=106A166 agency=0 calendar=165157760 timezone=164034504 boardings=[('2459A106B166', 34764), ('1635A106B166', 38364), ('1640A106B166', 41964), ('1638A106B166', 45564), ('1643A106B166', 49164), ('1636A106B166', 52764), ('1641A106B166', 56364), ('1634A106B166', 59964), ('1639A106B166', 63564), ('1637A106B166', 67164)]&gt;  
</pre>  
 
<h3>Intermingling Public Transit and Street Data</h3>  
<p>You can load both OSM and GTFS data into the same graph, then run a command to link them.</p>  
<pre style="background-color:#F5F5F5"> $ gs_import_gtfs redding_all.gdb redding.gtfsdb  
$ gs_import_osm redding_all.gdb map.osmdb  
$ gs_link_osm_gtfs redding_all.gdb map.osmdb redding.gtfsdb</pre>  
<p>Inspect:</p>  
<pre style="background-color:#F5F5F5"> $ gs_gdb_inspect redding.gdb sta-3622</pre>  
<p>prints:</p>  
<pre style="background-color:#F5F5F5">sta-3622 -> osm-92366549  
&lt;graphserver.core.Link object at 0x9a0b20c&gt;  
sta-3622 -> psv-0-000-004  
&lt;TripBoard int_sid=0 sid=105A166 agency=0 calendar=163855912 timezone=161122808 boardings=[('1572A105B166', 23964), ('1598A105B166', 27564), ('1602A105B166', 31164), ('1607A105B166', 34764), ('1600A105B166', 38364), ('1605A105B166', 41964), ('1603A105B166', 45564), ('1608A105B166', 49164), ('1601A105B166', 52764), ('1606A105B166', 56364), ('1599A105B166', 59964), ('1604A105B166', 63564), ('1609A105B166', 67164)]&gt;  
sta-3622 -> psv-0-000-004  
&lt;TripBoard int_sid=1 sid=106A166 agency=0 calendar=163855912 timezone=161122808 boardings=[('2459A106B166', 34764), ('1635A106B166', 38364), ('1640A106B166', 41964), ('1638A106B166', 45564), ('1643A106B166', 49164), ('1636A106B166', 52764), ('1641A106B166', 56364), ('1634A106B166', 59964), ('1639A106B166', 63564), ('1637A106B166', 67164)]&gt;</pre>  
 
<h3>Inspecting the graph with gs_crawl</h3>  
<p>Start gs_crawl, a little graph inspection web service</p>  
<pre style="background-color:#F5F5F5"> $ gs_crawl redding.gdb 80</pre>  
<p>Then steer your web browser to the appropriate location.<p>  
<p>If you're using Amazon EC2, using your own public DNS:</p>  
<pre style="background-color:#F5F5F5">http://YOUR-EC2-ADDRESS.compute-1.amazonaws.com/</pre>  
<p>Or if you're simply running on your local machine:</p>  
<pre style="background-color:#F5F5F5">http://localhost:80/</pre>  
 
<h3 id="routeserver">Getting routes with gs_routeserver</h3>  
<p>First, you'll need PyYAML</p>  
<pre style="background-color:#F5F5F5"> $ sudo easy_install pyyaml</pre>  
<p>The routeserver finds a path, and then uses a series of "handlers" to convert that path into a human-readable format. Those handlers are enumearted and set up by a configuration file called handlers.yaml. Graphserver comes with an example handlers.yaml which you can use to get started</p>  
<pre style="background-color:#F5F5F5"> $ cp /path/to/graphserver/pygs/graphserver/ext/routeserver/handlers.yaml .</pre>  
<p>This handlers.yaml file is filled with "CHANGEME" stubs. Replace every "CHANGEME.gtfsdb" with "redding.gtfsdb" and every "CHANGEME.osmdb" with "redding.osmdb"</p>  
<p>Fire up a routeserver on the compiled graph</p>  
<pre style="background-color:#F5F5F5"> $ gs_routeserver redding.gdb handlers.yaml -p 80</pre>  
<p>Get a list of all vertices in the system</p>  
<pre style="background-color:#F5F5F5">http://YOUR_DOMAIN_NAME/vertices</pre>  
<p>Get a route narrative</p>  
<pre style="background-color:#F5F5F5">http://YOUR_DOMAIN_NAME/path?origin="osm-92011649"&amp;dest="sta-3803"&amp;currtime=1260839444</pre>  
<p>or</p>  
<pre style="background-color:#F5F5F5">http://YOUR_DOMAIN_NAME/path_raw?origin="osm-92011649"&amp;dest="sta-3803"&amp;currtime=1260839444</pre>  
 
<h3>What about a really big city?</h3>  
<p>First, get Java 1.6. Or Java6. I think they're the same thing. Get the JDK, but not the JVM, the JRE, SDK, SDN, or the JCE. Note Java SE comes with Jave EE, which is apparently at version 5, and may or may not have anything to do with J2EE. I don't know what those have to do with anything. Google it or something. I don't know. They don't make it particularly easy for you. It's like, they've got more money than god and nothing pleases them better than pouring all that expertise into baffling the hell out of you. Honestly, I can't stand Java, but you need it to run Osmosis.</p>  
<p>Then, get Osmosis</p>  
<pre style="background-color:#F5F5F5"> $ wget http://gweb.bretth.com/osmosis-latest.zip  
$ unzip osmosis-latest.zip  
$ chmod a+x ./osmosis-0.30/bin/osmosis</pre>  
<p>Download a biggie GTFS file. Here's the one for the Seattle area:</p>  
<pre style="background-color:#F5F5F5"> $ wget http://www.gtfs-data-exchange.com/gtfs/badhill_20091208_1910.zip</pre>  
<p>Compile it into a GTFSDB. This will take a few minutes</p>  
<pre style="background-color:#F5F5F5"> $ gs_gtfsdb_build badhill_20091208_1910.zip kingco.gtfsdb</pre>  
<p>Check the bounds of the GTFSDB</p>  
<pre style="background-color:#F5F5F5"> $ sqlite3 kingco.gtfsdb "select min(stop_lon),min(stop_lat),max(stop_lon),max(stop_lat) from stops"</pre>  
returns:  
<pre style="background-color:#F5F5F5">-122.506729|47.1553345|-121.78244|47.9323654</pre>  
This will come in handy soon.  
<p>Get a huge chunk of OSM data from the CloudMade state files. Here's Washington State:</p>  
<pre style="background-color:#F5F5F5"> $ wget http://downloads.cloudmade.com/north_america/united_states/washington/washington.osm.highway.bz2  
$ bunzip2 washington.osm.highway.bz2</pre>  
<p>Then, use the bounding box coordinates we just got to cut down the OSM file to the area surrounding the agency. Check it:<p>  
<pre style="background-color:#F5F5F5"> $ /path/to/osmosis-0.30/bin/osmosis --read-xml washington.osm.highway --bounding-box left=-122.506729 bottom=47.1553345 right=-121.78244 top=47.9323654 --write-xml kingco.osm</pre>  
<p>Then, compile and set it up like normal. It's a trip-planning bonanza.</p>  
 
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">  
</script>  
<script type="text/javascript">  
_uacct = "UA-1815162-1";  
urchinTracker();  
</script>  
</body>  
 
 
</html>  
 
file:a/origin-src/hbus.ca.html (deleted)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">  
 
<head profile="http://gmpg.org/xfn/11">  
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />  
 
<title> hbus.ca: Blog</title>  
 
<link rel="icon" type="image/png" href="http://hbus.ca/site_media/images/favico_bus.png"/>.  
<link href="http://hbus.ca/site_media/stylesheets/scaffold.css" rel="stylesheet" type="text/css" />  
<link href="http://hbus.ca/site_media/stylesheets/style.css" rel="stylesheet" type="text/css" />  
<link rel="stylesheet" href="http://hbus.ca/blog/wp-content/themes/hbus/style.css" type="text/css" media="screen" />  
 
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/yahoo/yahoo-min.js"></script>  
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>  
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/element/element-beta-min.js"></script>  
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/layout/layout-min.js"></script>  
 
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/event/event-min.js"></script>  
 
 
<link rel="alternate" type="application/rss+xml" title="hbus.ca: Blog RSS Feed" href="http://hbus.ca/blog/?feed=rss2" />  
<link rel="alternate" type="application/atom+xml" title="hbus.ca: Blog Atom Feed" href="http://hbus.ca/blog/?feed=atom" />  
<link rel="pingback" href="http://hbus.ca/blog/xmlrpc.php" />  
 
 
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://hbus.ca/blog/xmlrpc.php?rsd" />  
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://hbus.ca/blog/wp-includes/wlwmanifest.xml" />  
<meta name="generator" content="WordPress 2.7.1" />  
 
</head>  
<body id="nav_blog">  
<div id="header">  
<h1><a href="/">hbus<span>.ca</span></a>&nbsp;<span class="beta">beta</span></h1>  
 
<p>Plan trips on Halifax Metro Transit</p>  
<ul class="nav">  
<li class="nav_home"><a href="http://hbus.ca/">Home</a></li>  
<li class="nav_about"><a href="http://hbus.ca/about">About</a></li>  
<li class="nav_help"><a href="http://hbus.ca/help">Help</a></li>  
<li class="nav_blog"><a href="http://hbus.ca/blog">Blog</a></li>  
<li class="nav_privacy"><a href="http://hbus.ca/privacy">Privacy</a></li>  
<ul>  
</div>  
 
<div class="container" id="content">  
 
<div class="container">  
<div id="sidebar">  
<ul>  
 
<!-- Author information is disabled per default. Uncomment and fill in your details if you want to use it.  
<li><h2>Author</h2>  
<p>A little something about you, the author. Nothing lengthy, just an overview.</p>  
</li>  
-->  
 
 
<li><h2>Archives</h2>  
<ul>  
<li><a href='http://hbus.ca/blog/?m=200904' title='April 2009'>April 2009</a></li>  
</ul>  
</li>  
<!--  
<li class="categories"><h2>Categories</h2><ul> <li class="cat-item cat-item-1"><a href="http://hbus.ca/blog/?cat=1" title="View all posts filed under Uncategorized">Uncategorized</a> (1)  
</li>  
</ul></li>-->  
<li id="linkcat-3" class="linkcat"><h2>Contributors</h2>  
<ul class='xoxo blogroll'>  
<li><a href="http://masalalabs.ca">Ginger Tea and Channa Masala » hbus</a></li>  
 
</ul>  
</li>  
<li id="linkcat-5" class="linkcat"><h2>Friends</h2>  
<ul class='xoxo blogroll'>  
<li><a href="http://carsharehfx.ca" title="Car sharing for Halifax">Car Share Halifax</a></li>  
<li><a href="http://thehubhalifax.ca" title="Coworking space in Halifax">The Hub Halifax</a></li>  
 
</ul>  
</li>  
<li id="linkcat-4" class="linkcat"><h2>Sponsors</h2>  
<ul class='xoxo blogroll'>  
<li><a href="http://navarra.ca" title="The Navarra Group">The Navarra Group</a></li>  
 
</ul>  
</li>  
 
<li><h2>Meta</h2>  
<ul>  
<li><a href="http://hbus.ca/blog/wp-login.php">Log in</a></li>  
<li><a href="http://validator.w3.org/check/referer" title="This page validates as XHTML 1.0 Transitional">Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr></a></li>  
<li><a href="http://gmpg.org/xfn/"><abbr title="XHTML Friends Network">XFN</abbr></a></li>  
<li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress</a></li>  
</ul>  
</li>  
 
</ul>  
</div>  
 
 
<div id="posts">  
 
 
<div class="post hentry category-uncategorized" id="post-9">  
<h2><a href="http://hbus.ca/blog/?p=9" rel="bookmark" title="Permanent Link to Creating a google transit feed for fun and profit">Creating a google transit feed for fun and profit</a></h2>  
<small>April 23rd, 2009 <!-- by admin --></small>  
 
<div class="entry">  
<p>People frequently ask me how I manage to collect and input the data that is used by hbus.ca, given Metro Transit&#8217;s intransigence. The &#8220;bike and GPS&#8221; angle is well known <a href="http://www.thecoast.ca/halifax/beta-the-public-transit-day-tripper/Content?oid=1098826">by now</a>, but what about the rest of the process? How do I get the data into a format that hbus.ca can consume?</p>  
<p>The defacto standard for the interchange of transit information is <a href="http://code.google.com/p/googletransitdatafeed">Google Transit Feed</a> (GTFS). This exceedingly simple comma seperated value format is now supported by a plethora of software, including <a href="http://google.com/transit">Google Transit</a>, <a href="http://github.com/bmander/graphserver">graphserver</a>, as well as my very own <a href="http://github.com/wlach/libroutez">libroutez</a> (used by hbus.ca). It was obvious to me right from the beginning that the first step to building hbus.ca would be to create one of these feeds. </p>  
<p>Manipulating a GTFS by hand is probably not a great idea. It&#8217;s basically a dump of a relational database, and is pretty inscrutable from the point of view of a human being. What I really want to be able to do is be able<br />  
to manipulate things on the level of stops, service periods, and routes&#8211; and let some kind of abstraction layer take care of the low-level details. Fortunately, the awesome engineers at google created a python library called <a href="http://code.google.com/p/googletransitdatafeed">Google Transit Data Feed</a>, which can help with creating one of these things by providing abstractions of the key elements of a google transit feed (stops, service periods, etc.). You can then write a program which uses these abstractions to create and save a GTFS.</p>  
<p>Of course, providing the library appropriate information is easier said than done. Metro Transit&#8217;s PDF schedules are not readily computer parsable (being designed to be printed out, after all). I needed some kind of semi-automated way of converting a Metro Transit schedule into GTFS, or this whole project was<br />  
going nowhere fast. </p>  
<p>As an initial step, it turns out that it&#8217;s quite possible to extract textual information from a PDF using the open source <a href="http://poppler.freedesktop.org/">popplar</a> library. From there, it&#8217;s possible to extract the stopping times for an individual bus route. Let&#8217;s give an example. For example, let&#8217;s take the case of adding the 60 (Portland Hill&#8217;s route), something I&#8217;m currently working on. All I had to do was download the PDF file from Metro Transit&#8217;s site and then run the following on the command line:<br />  
<code><br />  
pdftotext -raw route60.pdf<br />  
</code><br />  
The raw option basically makes sure the raw strings are dumped to disk, and that no attempt is made to preserve formatting. The result is a text file with content like this in it:<br />  
<code><br />  
842a 847a 855a 858a 903a 906a 912a -<br />  
857a 902a 910a 913a 918a 921a - 925a<br />  
910a 915a 923a 926a 931a 934a 940a -<br />  
940a 945a 953a - 1000a 1003a 1009a -<br />  
...and every 30 minutes until<br />  
210p 215p 223p - 230p 233p 239p -<br />  
</code><br />  
This type of format can be parsed easily enough. To create a proper transit feed though, schedule information isn&#8217;t enough: you also need to know the locations of the stops, names of routes, etc. After some deliberation, I came to the determination that I needed some kind of intermediate format to store the above schedule information and this additional information. It would be readable both by humans (to ease its creation) and machines.</p>  
<p>The obvious markup for something like this is <a href="http://yaml.org">YAML</a> (if you&#8217;re still using XML to store structured information, run, don&#8217;t walk, and look at YAML: you can thank me later). Simple, clean, effective. GTFS is still the better choice for using the information in another application as its representation is much more amenable to being stored in a graph. Here&#8217;s a few examples of my YAML format in action:</p>  
<p><a href="http://github.com/wlach/halifax-transit-feed/blob/fef68c18928272670b3c57ae5530260deed85883/7-robie-to-gottingen.yml">7 (Robie to Gottingen)</a><br />  
<a href="http://github.com/wlach/halifax-transit-feed/blob/fef68c18928272670b3c57ae5530260deed85883/10-to-westphal.yml">10 (Westphal)</a></p>  
<p>Besides the scheduling information, the other main interesting component of a GTFS is the location of the stops. As anyone who&#8217;s used a Metro Transit schedule has noticed, only major timepoints are covered in the PDF schedules. What of all the stops in between? This is where the bike and GPS come in.</p>  
<p>What I did was take a standard GPS from Mountain Equipment Co-op (The Garmin GPSMap 60x), get on my bike, take the readings of individual gotime numbers and positioning information, of the individual stops between the major timepoints. I then took this device back to my computer and, using a utility called <a href="http://gpsbabel.org">GPSBabel</a>, dumped out the stop information in a format called &#8220;comma seperated value&#8221;. It looks like this:<br />  
<code><br />  
44.65825, -63.59252, 6785-21-31-33-34-35-3-7<br />  
44.65982, -63.59452, 6768-21-31-33-35-86-3-7<br />  
44.66113, -63.59659, 6782-21-31-33-34-35-3-7<br />  
</code><br />  
The first two items are latitude and longitude, providing the positioning of the stop. The last item is a gotime number, followed by the set of buses which pass by the stop. Turning this into YAML is a matter of applying<br />  
the following regular expression to the input:<br />  
<code><br />  
\([0-9]+.[0-9]+\), \(-63.[0-9]+\), \([0-9]+\)- -> - { name: xxx, stop_code: \3, lat: \1, lng: \2 }<br />  
</code><br />  
To get an actual name for the stop (i.e.: &#8220;Gottingen and Young&#8221;), I wrote a simple script which finds the nearest intersection close to the stop in the <a href="http://geobase.ca">GeoBase</a> dataset. I then (at my discretion) corrected it based on my on-the-street knowledge of the layout of Halifax as well as adding certain details to help the user (e.g. bus stops on the way to the south end of Halifax are marked &#8220;south bound&#8221;).</p>  
<p>With these two elements in place (a format for creating human-readable transit information and a library for creating GTFS), the only thing left to do is create a program which bridges the gap. Behold, the magic of<br />  
<a href="http://github.com/wlach/halifax-transit-feed/blob/fef68c18928272670b3c57ae5530260deed85883/createfeed.py">createfeed.py</a>. With all of this in place, creating a google transit feed for Halifax is a simple matter of typing &#8220;make&#8221;.</p>  
<p>Is this a ridiculous amount of work? I wouldn&#8217;t say so. The vast, vast majority of my work on hbus.ca has been in creating the pathfinding code and geocoding functionality. This is work that can be translated to many different municipalities, and can easily be extended and made more useful in a myriad of ways.</p>  
<p>What does seem a little intimidating to me is completing what I started. Capturing bus stop information for the Halifax peninsula is one thing, but covering the outlying areas (Bayer&#8217;s Lake, Sackville, etc.) is quite<br />  
another. There&#8217;s a lot of biking involved there, more perhaps than what one person can reasonably be expected to do. It was my hope that the initial release of hbus would validate the model of community-developed transit software to Metro Transit and they would see the benefit of releasing their internal copy of this data to the public, but unfortunately that doesn&#8217;t seem to have happened. </p>  
<p>Getting that problem solved seems to be more a political problem than a technical one, and it&#8217;s not my specialty. It really does make me wonder if I shouldn&#8217;t reconsider the option of crowd sourcing, which I had<br />  
<a href="http://masalalabs.ca/2009/03/hbusca-and-thoughts-about-crowdsourcing/">rejected</a> earlier.</p>  
</div>  
 
<p class="postmetadata"> Posted in <a href="http://hbus.ca/blog/?cat=1" title="View all posts in Uncategorized" rel="category">Uncategorized</a> | <a href="http://hbus.ca/blog/?p=9#respond" title="Comment on Creating a google transit feed for fun and profit">No Comments &#187;</a></p>  
</div>  
 
 
<div class="navigation">  
<div class="alignleft"></div>  
<div class="alignright"></div>  
</div>  
 
 
</div>  
</div>  
 
<div id="footer">  
<!-- If you'd like to support WordPress, having the "powered by" link somewhere on your blog is the best way; it's our only promotion or advertising. -->  
<p>  
hbus.ca: Blog is proudly powered by  
<a href="http://wordpress.org/">WordPress</a>  
<br /><a href="http://hbus.ca/blog/?feed=rss2">Entries (RSS)</a>  
and <a href="http://hbus.ca/blog/?feed=comments-rss2">Comments (RSS)</a>.  
<!-- 22 queries. 0.225 seconds. -->  
</p>  
</div>  
</div>  
 
<script>  
(function() {  
var Dom = YAHOO.util.Dom,  
Event = YAHOO.util.Event;  
 
Event.onDOMReady(function() {  
var layout = new YAHOO.widget.Layout({  
units: [  
{ position: 'top', body: 'header', gutter: '0', height: 60 },  
{ position: 'center', body: 'content', gutter: '0' },  
]  
});  
layout.render();  
});  
})();  
</script>  
</body>  
</html>  
</div>  
 
 
 Binary files a/origin-src/wlach-halifax-transit-feed-fef68c1.tar.gz and /dev/null differ
hfxfeed.zip  
hfxtable.yml  
*~  
short_name: 1  
long_name: To Dartmouth  
time_points: [ 7284, 7412, 6087, 7351, 7151 ]  
between_stops:  
7284-7412: [ 6203, 7423 ]  
7412-6087: [ 7419, 7409, 7402, 6453, 6447, 6449, 6454, 6452, 8328, 8337, 8333, 8336, 8327, 8338, 6121, 6106 ]  
6087-7351: [ 6455, 6773, 6778, 6779, 6775, 6787 ]  
stop_times: [  
[ -, -, -, 604a, 607a],  
[ 600a, 611a, 625a, 633a, 637a],  
[ 610a, 621a, 635a, 643a, 647a],  
[ 620a, 631a, 645a, 653a, 657a],  
[ 630a, 641a, 655a, 703a, 707a],  
[ 640a, 651a, 705a, 713a, 717a],  
[ 650a, 701a, 716a, 724a, 728a],  
[ 700a, 713a, 728a, 736a, 740a],  
[ 710a, 723a, 738a, 746a, 750a],  
[ 720a, 733a, 748a, 756a, 800a],  
[ 730a, 743a, 758a, 806a, 810a],  
[ 740a, 753a, 808a, 816a, 820a],  
[ 750a, 803a, 818a, 826a, 830a],  
[ 800a, 813a, 828a, 836a, 840a],  
[ 810a, 823a, 838a, 846a, 850a],  
[ 820a, 833a, 848a, 856a, 900a],  
[ 830a, 843a, 858a, 906a, 910a],  
[ 840a, 853a, 908a, 916a, 920a],  
[ 855a, 908a, 923a, 931a, 935a],  
[ 910a, 923a, 938a, 946a, 950a],  
[ 925a, 938a, 953a, 1001a, 1005a],  
[ 940a, 953a, 1008a, 1016a, 1020a],  
[ 955a, 1008a, 1023a, 1031a, 1035a],  
[ 1010a, 1023a, 1038a, 1046a, 1050a],  
[ 1025a, 1038a, 1053a, 1101a, 1105a],  
[ 1040a, 1053a, 1108a, 1116a, 1120a],  
[ 1055a, 1108a, 1123a, 1131a, 1135a],  
[ 1110a, 1123a, 1138a, 1146a, 1150a],  
[ 1125a, 1138a, 1153a, 1201p, 1205p],  
[ 1140a, 1153a, 1208p, 1216p, 1220p],  
[ 1155a, 1208p, 1223p, 1231p, 1235p],  
[ 1210p, 1223p, 1238p, 1246p, 1250p],  
[ 1225p, 1238p, 1253p, 101p, 105p],  
[ 1240p, 1253p, 108p, 116p, 120p],  
[ 1255p, 108p, 123p, 131p, 135p],  
[ 110p, 123p, 138p, 146p, 150p],  
[ 125p, 138p, 153p, 201p, 205p],  
[ 140p, 153p, 208p, 216p, 220p],  
[ 155p, 208p, 223p, 231p, 235p],  
[ 210p, 223p, 238p, 246p, 250p],  
[ 225p, 238p, 253p, 301p, 305p],  
[ 240p, 253p, 308p, 316p, 320p],  
[ 255p, 308p, 323p, 331p, 335p],  
[ 320p, 333p, 348p, 356p, 400p],  
[ 340p, 353p, 408p, 416p, 420p],  
[ 400p, 413p, 428p, 436p, 440p],  
[ 420p, 433p, 448p, 456p, 500p],  
[ 430p, 443p, 458p, 506p, 510p],  
[ 450p, 503p, 518p, 526p, 530p],  
[ 500p, 513p, 528p, 536p, 540p],  
[ 510p, 523p, 538p, 546p, 550p],  
[ 520p, 533p, 548p, 556p, 600p],  
[ 530p, 543p, 558p, 606p, 610p],  
[ 540p, 553p, 608p, 616p, 620p],  
[ 550p, 603p, 618p, 626p, 630p],  
[ 600p, 613p, 627p, 635p, 639p],  
[ 615p, 626p, 640p, 648p, 652p],  
[ 630p, 641p, 655p, 703p, 707p],  
[ 645p, 656p, 710p, 718p, 722p],  
[ 700p, 711p, 725p, 733p, 737p],  
[ 715p, 726p, 740p, 748p, 752p],  
[ 730p, 741p, 755p, 803p, 807p],  
[ 745p, 756p, 810p, 818p, 822p],  
[ 800p, 811p, 825p, 833p, 837p],  
[ 815p, 826p, 840p, 848p, 852p],  
[ 830p, 841p, 855p, 903p, 907p],  
[ 845p, 856p, 910p, 918p, 922p],  
[ 900p, 911p, 925p, 933p, 937p],  
[ 915p, 926p, 940p, 948p, 952p],  
[ 930p, 941p, 955p, 1003p, 1007p],  
[ 945p, 956p, 1010p, 1018p, 1022p],  
[ 1000p, 1011p, 1025p, 1033p, 1037p],  
[ 1015p, 1026p, 1040p, 1048p, 1052p],  
[ 1030p, 1041p, 1055p, 1103p, 1107p],  
[ 1045p, 1056p, 1110p, 1118p, 1122p],  
[ 1115p, 1126p, 1140p, 1148p, 1152p],  
[ 1150p, 1201x, 1215x, 1221x, 1225x],  
[ 1215x, 1226x, 1240x, 1248x, 1252x]  
]  
stop_times_saturday: [  
[ -, -, -, 602a, 605a],  
[ -, -, -, -, -],  
[ 605a, 616a, 628a, 634a, 637a],  
[ 620a, 631a, 643a, 649a, 652a],  
[ 635a, 646a, 658a, 704a, 707a],  
[ 650a, 701a, 713a, 719a, 722a],  
[ 705a, 716a, 728a, 734a, 737a],  
[ 720a, 731a, 743a, 749a, 752a],  
[ 735a, 746a, 758a, 804a, 807a],  
[ 750a, 801a, 813a, 819a, 822a],  
[ 805a, 816a, 828a, 834a, 837a],  
[ 820a, 831a, 843a, 849a, 852a],  
[ 835a, 846a, 858a, 904a, 907a],  
[ 850a, 901a, 913a, 919a, 922a],  
[ 905a, 916a, 928a, 934a, 937a],  
[ 920a, 931a, 943a, 949a, 952a],  
[ 935a, 946a, 958a, 1004a, 1007a],  
[ 950a, 1001a, 1013a, 1019a, 1022a],  
[ 1005a, 1016a, 1028a, 1034a, 1037a],  
[ 1020a, 1031a, 1043a, 1049a, 1052a],  
[ 1035a, 1046a, 1058a, 1104a, 1107a],  
[ 1050a, 1101a, 1113a, 1119a, 1122a],  
[ 1105a, 1116a, 1128a, 1134a, 1137a],  
[ 1120a, 1131a, 1143a, 1149a, 1152a],  
[ 1135a, 1146a, 1158a, 1204p, 1207p],  
[ 1150a, 1201p, 1213p, 1219p, 1222p],  
[ 1205p, 1216p, 1228p, 1234p, 1237p],  
[ 1220p, 1231p, 1243p, 1249p, 1253p],  
[ 1233p, 1244p, 1258p, 105p, 109p],  
[ 1245p, 1257p, 113p, 120p, 124p],  
[ 100p, 112p, 128p, 135p, 139p],  
[ 115p, 127p, 143p, 150p, 154p],  
[ 130p, 142p, 158p, 205p, 209p],  
[ 145p, 157p, 213p, 220p, 224p],  
[ 200p, 212p, 228p, 235p, 239p],  
[ 215p, 227p, 243p, 250p, 254p],  
[ 230p, 242p, 258p, 305p, 309p],  
[ 245p, 257p, 313p, 320p, 324p],  
[ 300p, 312p, 328p, 335p, 339p],  
[ 315p, 327p, 343p, 350p, 354p],  
[ 330p, 342p, 359p, 405p, 409p],  
[ 345p, 357p, 413p, 420p, 424p],  
[ 400p, 412p, 428p, 435p, 439p],  
[ 415p, 427p, 443p, 450p, 454p],  
[ 430p, 442p, 458p, 505p, 509p],  
[ 445p, 457p, 513p, 520p, 524p],  
[ 500p, 511p, 528p, 535p, 539p],  
[ 515p, 527p, 543p, 550p, 554p],  
[ 530p, 542p, 559p, 604p, 607p],  
[ 545p, 556p, 610p, 614p, 618p],  
[ 600p, 611p, 623p, 629p, 632p],  
[ 615p, 626p, 638p, 644p, 647p],  
[ 635p, 646p, 658p, 704p, 707p],  
[ 650p, 701p, 713p, 719p, 722p],  
[ 705p, 716p, 728p, 734p, 737p],  
[ 720p, 731p, 743p, 749p, 752p],  
[ 735p, 746p, 758p, 804p, 807p],  
[ 750p, 801p, 813p, 819p, 822p],  
[ 805p, 816p, 828p, 834p, 837p],  
[ 820p, 831p, 843p, 849p, 852p],  
[ 835p, 846p, 858p, 904p, 907p],  
[ 850p, 901p, 913p, 919p, 922p],  
[ 905p, 916p, 928p, 934p, 937p],  
[ 920p, 931p, 943p, 949p, 952p],  
[ 935p, 946p, 958p, 1004p, 1007p],  
[ 950p, 1001p, 1013p, 1019p, 1022p],  
[ 1005p, 1016p, 1028p, 1034p, 1037p],  
[ 1020p, 1031p, 1043p, 1049p, 1052p],  
[ 1035p, 1046p, 1058p, 1104p, 1107p],  
[ 1050p, 1101p, 1113p, 1119p, 1122p],  
[ 1105p, 1116p, 1128p, 1134p, 1137p],  
[ 1135p, 1146p, 1158p, 1204x, 1207x],  
[ 1205x, 1216x, 1228x, 1234x, 1237x]]  
stop_times_sunday: [  
[ 640a, 649a, 700a, 705a, 709a],  
[ 710a, 719a, 730a, 735a, 739a],  
[ 740a, 749a, 800a, 805a, 809a],  
[ 810a, 819a, 830a, 835a, 839a],  
[ 840a, 849a, 900a, 905a, 909a],  
[ 910a, 919a, 930a, 935a, 939a],  
[ 940a, 949a, 1000a, 1005a, 1009a],  
[ 1010a, 1019a, 1030a, 1035a, 1039a],  
[ 1040a, 1049a, 1100a, 1105a, 1109a],  
[ 1055a, 1104a, 1115a, 1120a, 1124a],  
[ 1110a, 1119a, 1130a, 1135a, 1139a],  
[ 1125a, 1134a, 1145a, 1150a, 1154a],  
[ 1140a, 1149a, 1200p, 1205p, 1209p],  
[ 1155a, 1204p, 1215p, 1220p, 1224p],  
[ 1210p, 1219p, 1230p, 1235p, 1239p],  
[ 1225p, 1234p, 1245p, 1250p, 1254p],  
[ 1240p, 1249p, 100p, 105p, 109p],  
[ 1255p, 104p, 115p, 120p, 124p],  
[ 110p, 119p, 130p, 135p, 139p],  
[ 125p, 134p, 145p, 150p, 154p],  
[ 140p, 149p, 200p, 205p, 209p],  
[ 155p, 204p, 215p, 220p, 224p],  
[ 210p, 219p, 230p, 235p, 239p],  
[ 225p, 234p, 245p, 250p, 254p],  
[ 240p, 249p, 300p, 305p, 309p],  
[ 255p, 304p, 315p, 320p, 324p],  
[ 310p, 319p, 330p, 335p, 339p],  
[ 325p, 334p, 345p, 350p, 354p],  
[ 340p, 349p, 400p, 405p, 409p],  
[ 355p, 404p, 415p, 420p, 424p],  
[ 410p, 419p, 430p, 435p, 439p],  
[ 425p, 434p, 445p, 450p, 454p],  
[ 440p, 449p, 500p, 505p, 509p],  
[ 455p, 504p, 515p, 520p, 524p],  
[ 510p, 519p, 530p, 535p, 539p],  
[ 525p, 534p, 545p, 550p, 554p],  
[ 540p, 549p, 600p, 605p, 609p],  
[ 555p, 604p, 615p, 620p, 624p],  
[ 610p, 619p, 630p, 635p, 639p],  
[ 640p, 649p, 700p, 705p, 709p],  
[ 710p, 719p, 730p, 735p, 739p],  
[ 740p, 749p, 800p, 805p, 809p],  
[ 810p, 819p, 830p, 835p, 839p],  
[ 840p, 849p, 900p, 905p, 909p],  
[ 910p, 919p, 930p, 935p, 939p],  
[ 940p, 949p, 1000p, 1005p, 1009p],  
[ 1010p, 1019p, 1030p, 1035p, 1039p],  
[ 1040p, 1049p, 1100p, 1105p, 1109p],  
[ 1110p, 1119p, 1130p, 1135p, 1139p],  
[ 1140p, 1149p, 1200x, 1205x, 1209x]  
]  
 
short_name: 1  
long_name: To Mumford  
time_points: [ 7151, 6105, 7421, 7284 ]  
between_stops:  
7151-6105: [ 8638, 6088, 6104, 6125 ]  
6105-7421: [ 6108, 6103, 6102, 6122, 8331, 8330, 8334, 8335, 8329, 8332, 6448, 6450, 6451, 7401, 7403, 7410, 7406 ]  
7421-7284: [ 7404, 6201, 6200 ]  
stop_times: [  
[ 610a, 620a, 633a, 644a],  
[ 640a, 650a, 703a, 714a],  
[ 705a, 715a, 728a, 742a],  
[ 715a, 725a, 738a, 752a],  
[ 735a, 745a, 758a, 812a],  
[ 755a, 805a, 818a, 832a],  
[ 815a, 825a, 838a, 852a],  
[ 836a, 846a, 859a, 913a],  
[ 845a, 855a, 908a, 922a],  
[ 855a, 905a, 918a, 932a],  
[ 905a, 915a, 928a, 942a],  
[ 915a, 925a, 938a, 952a],  
[ 925a, 935a, 948a, 1002a],  
[ 940a, 950a, 1003a, 1017a],  
[ 955a, 1005a, 1018a, 1032a],  
[ 1010a, 1020a, 1033a, 1047a],  
[ 1025a, 1035a, 1048a, 1102a],  
[ 1040a, 1050a, 1103a, 1117a],  
[ 1055a, 1105a, 1118a, 1132a],  
[ 1110a, 1120a, 1133a, 1147a],  
[ 1125a, 1135a, 1148a, 1202p],  
[ 1140a, 1150a, 1203p, 1217p],  
[ 1155a, 1205p, 1218p, 1232p],  
[ 1210p, 1220p, 1233p, 1247p],  
[ 1225p, 1235p, 1248p, 102p],  
[ 1240p, 1250p, 103p, 117p],  
[ 1255p, 105p, 118p, 132p],  
[ 110p, 120p, 133p, 147p],  
[ 125p, 135p, 148p, 202p],  
[ 140p, 150p, 203p, 217p],  
[ 155p, 205p, 218p, 232p],  
[ 210p, 220p, 233p, 247p],  
[ 225p, 235p, 248p, 302p],  
[ 240p, 250p, 303p, 317p],  
[ 255p, 305p, 318p, 332p],  
[ 310p, 320p, 333p, 347p],  
[ 325p, 335p, 351p, 405p],  
[ 335p, 345p, 401p, 415p],  
[ 345p, 355p, 411p, 425p],  
[ 355p, 405p, 421p, 435p],  
[ 405p, 415p, 431p, 445p],  
[ 415p, 425p, 441p, 455p],  
[ 425p, 435p, 451p, 505p],  
[ 435p, 445p, 501p, 515p],  
[ 445p, 455p, 511p, 525p],  
[ 455p, 505p, 521p, 535p],  
[ 505p, 515p, 531p, 545p],  
[ 515p, 525p, 541p, 555p],  
[ 525p, 535p, 551p, 605p],  
[ 540p, 550p, 606p, 620p],  
[ 555p, 605p, 621p, 635p],  
[ 610p, 620p, 636p, 650p],  
[ 625p, 635p, 651p, 705p],  
[ 640p, 650p, 706p, 720p],  
[ 655p, 705p, 721p, 735p],  
[ 710p, 720p, 736p, 750p],  
[ 725p, 735p, 751p, 805p],  
[ 740p, 750p, 804p, 818p],  
[ 755p, 805p, 818p, 832p],  
[ 810p, 820p, 833p, 847p],  
[ 825p, 835p, 848p, 902p],  
[ 840p, 850p, 903p, 917p],  
[ 855p, 905p, 918p, 932p],  
[ 910p, 920p, 933p, 947p],  
[ 925p, 935p, 948p, 1002p],  
[ 940p, 950p, 1003p, 1017p],  
[ 955p, 1005p, 1018p, 1032p],  
[ 1010p, 1020p, 1033p, 1047p],  
[ 1025p, 1035p, 1048p, 1102p],  
[ 1040p, 1050p, 1103p, 1114p],  
[ 1055p, 1105p, 1116p, 1127p],  
[ 1125p, 1135p, 1146p, 1157p],  
[ 1155p, 1205x, 1216x, 1227x],  
[ 1226x, 1236x, 1247x, 1258x]  
]  
stop_times_saturday: [  
[ 600a, 608a, 621a, 632a],  
[ 620a, 628a, 641a, 652a],  
[ 640a, 648a, 701a, 712a],  
[ 655a, 703a, 716a, 727a],  
[ 710a, 718a, 731a, 742a],  
[ 725a, 733a, 746a, 757a],  
[ 740a, 748a, 801a, 812a],  
[ 755a, 803a, 816a, 827a],  
[ 810a, 818a, 831a, 842a],  
[ 825a, 833a, 846a, 857a],  
[ 840a, 848a, 901a, 912a],  
[ 855a, 903a, 916a, 927a],  
[ 910a, 918a, 931a, 942a],  
[ 925a, 933a, 946a, 957a],  
[ 940a, 948a, 1001a, 1012a],  
[ 955a, 1003a, 1016a, 1027a],  
[ 1010a, 1018a, 1031a, 1042a],  
[ 1025a, 1033a, 1046a, 1057a],  
[ 1040a, 1049a, 1102a, 1113a],  
[ 1055a, 1104a, 1117a, 1128a],  
[ 1110a, 1119a, 1132a, 1143a],  
[ 1125a, 1134a, 1147a, 1158a],  
[ 1140a, 1149a, 1202p, 1215p],  
[ 1155a, 1204p, 1219p, 1232p],  
[ 1210p, 1220p, 1235p, 1248p],  
[ 1225p, 1235p, 1250p, 103p],  
[ 1240p, 1250p, 105p, 118p],  
[ 1255p, 105p, 120p, 133p],  
[ 110p, 120p, 135p, 148p],  
[ 125p, 135p, 150p, 203p],  
[ 140p, 150p, 205p, 218p],  
[ 155p, 205p, 220p, 233p],  
[ 210p, 220p, 235p, 248p],  
[ 225p, 235p, 250p, 303p],  
[ 240p, 250p, 305p, 318p],  
[ 255p, 305p, 320p, 333p],  
[ 310p, 320p, 335p, 348p],  
[ 325p, 335p, 350p, 403p],  
[ 340p, 350p, 405p, 418p],  
[ 355p, 405p, 420p, 433p],  
[ 410p, 420p, 435p, 448p],  
[ 425p, 435p, 450p, 459p],  
[ 440p, 450p, 504p, 514p],  
[ 455p, 505p, 518p, 529p],  
[ 510p, 520p, 532p, 543p],  
[ 525p, 535p, 547p, 558p],  
[ 540p, 550p, 602p, 613p],  
[ 555p, 605p, 617p, 628p],  
[ 610p, 620p, 632p, 643p],  
[ 625p, 635p, 647p, 658p],  
[ 640p, 650p, 702p, 713p],  
[ 710p, 720p, 732p, 743p],  
[ 725p, 735p, 747p, 758p],  
[ 740p, 750p, 802p, 813p],  
[ 755p, 805p, 817p, 828p],  
[ 810p, 820p, 832p, 843p],  
[ 825p, 835p, 847p, 858p],  
[ 840p, 850p, 902p, 913p],  
[ 855p, 905p, 917p, 928p],  
[ 910p, 920p, 932p, 943p],  
[ 925p, 935p, 947p, 958p],  
[ 940p, 950p, 1002p, 1013p],  
[ 955p, 1005p, 1017p, 1028p],  
[ 1010p, 1020p, 1032p, 1043p],  
[ 1025p, 1035p, 1047p, 1058p],  
[ 1040p, 1050p, 1102p, 1113p],  
[ 1055p, 1105p, 1117p, 1128p],  
[ 1125p, 1135p, 1147p, 1158p],  
[ 1155p, 1205x, 1217x, 1228x],  
[ 1225x, 1235x, 1247x, 1258x]  
]  
stop_times_sunday: [  
[ 655a, 709a, 720a, 729a],  
[ 716a, 730a, 741a, 750a],  
[ 746a, 800a, 811a, 820a],  
[ 816a, 830a, 841a, 850a],  
[ 846a, 900a, 911a, 920a],  
[ 916a, 930a, 941a, 950a],  
[ 946a, 1000a, 1011a, 1020a],  
[ 1016a, 1030a, 1041a, 1050a],  
[ 1031a, 1045a, 1056a, 1105a],  
[ 1046a, 1100a, 1111a, 1120a],  
[ 1101a, 1115a, 1126a, 1135a],  
[ 1116a, 1130a, 1141a, 1150a],  
[ 1131a, 1145a, 1156a, 1205p],  
[ 1146a, 1200p, 1211p, 1220p],  
[ 1201p, 1215p, 1226p, 1235p],  
[ 1216p, 1230p, 1241p, 1250p],  
[ 1231p, 1245p, 1256p, 105p],  
[ 1246p, 100p, 111p, 120p],  
[ 101p, 115p, 126p, 135p],  
[ 116p, 130p, 141p, 150p],  
[ 131p, 145p, 156p, 205p],  
[ 146p, 200p, 211p, 220p],  
[ 201p, 215p, 226p, 235p],  
[ 216p, 230p, 241p, 250p],  
[ 231p, 245p, 256p, 305p],  
[ 246p, 300p, 311p, 320p],  
[ 301p, 315p, 326p, 335p],  
[ 316p, 330p, 341p, 350p],  
[ 331p, 345p, 356p, 405p],  
[ 346p, 400p, 411p, 420p],  
[ 401p, 415p, 426p, 435p],  
[ 416p, 430p, 441p, 450p],  
[ 431p, 445p, 456p, 505p],  
[ 446p, 500p, 511p, 520p],  
[ 501p, 515p, 526p, 535p],  
[ 516p, 530p, 541p, 550p],  
[ 531p, 545p, 556p, 605p],  
[ 546p, 600p, 611p, 620p],  
[ 616p, 630p, 641p, 650p],  
[ 646p, 700p, 711p, 720p],  
[ 716p, 730p, 741p, 750p],  
[ 746p, 800p, 811p, 820p],  
[ 816p, 830p, 841p, 850p],  
[ 846p, 900p, 911p, 920p],  
[ 916p, 930p, 941p, 950p],  
[ 946p, 1000p, 1011p, 1020p],  
[ 1016p, 1030p, 1041p, 1050p],  
[ 1046p, 1100p, 1111p, 1120p],  
[ 1116p, 1130p, 1141p, 1150p],  
[ 1146p, 1200x, 1211x, 1220x]  
]  
 
short_name: 10  
long_name: To Dalhousie  
time_points: [ 6974, 8368, 7218, 6842, 6105, 6966, 7144 ]  
between_stops:  
6974-8368: [ 8160, 8161, 8162, 8483, 8484, 8482, 8319 ]  
8368-7218: [ 6835, 7175, 7209 ]  
7218-6842: [ 7211, 7215, 8581, 8583, 8584, 8585, 8424, 8419, 8429, 8427, 8389, 8392, 8614 ]  
6842-6105: [ 7351, 6088, 6104, 6125 ]  
6105-6966: [ 6108, 6103, 6102, 6122, 8331, 8330, 8334, 8313, 8311, 8315, 6960 ]  
stop_times: [  
[ 544a, 553a, 558a, 608a, 618a, 626a, 638a],  
[ 613a, 622a, 628a, 638a, 648a, 656a, 708a],  
[ 638a, 647a, 654a, 705a, 715a, 723a, 735a],  
[ 653a, 702a, 709a, 720a, 730a, 738a, 750a],  
[ -, 715a, 722a, 733a, 743a, 751a, 803a],  
[ 708a, 717a, 724a, 735a, 745a, 753a, 805a],  
[ 723a, 732a, 739a, 750a, 800a, 808a, 820a],  
[ -, -, 749a, 800a, 810a, 818a, 830a],  
[ 738a, 747a, 754a, 805a, 815a, 823a, 835a],  
[ -, -, 801a, 812a, 822a, 830a, 842a],  
[ 753a, 802a, 809a, 820a, 830a, 838a, 850a],  
[ -, -, 816a, 827a, 837a, 845a, 857a],  
[ 808a, 817a, 824a, 835a, 845a, 853a, 905a],  
[ 823a, 832a, 839a, 850a, 900a, 908a, 920a],  
[ 838a, 847a, 854a, 905a, 915a, 923a, 935a],  
[ 908a, 917a, 924a, 935a, 945a, 953a, 1005a],  
[ 938a, 947a, 954a, 1005a, 1015a, 1023a, 1035a],  
[ 1008a, 1017a, 1024a, 1035a, 1045a, 1053a, 1105a],  
[ 1038a, 1047a, 1054a, 1105a, 1115a, 1123a, 1135a],  
[ 1108a, 1117a, 1124a, 1135a, 1145a, 1153a, 1205p],  
[ 1138a, 1147a, 1154a, 1205p, 1215p, 1223p, 1235p],  
[ 1208p, 1217p, 1224p, 1235p, 1245p, 1253p, 105p],  
[ 1238p, 1247p, 1254p, 105p, 115p, 123p, 135p],  
[ 108p, 117p, 124p, 135p, 145p, 153p, 205p],  
[ 138p, 147p, 154p, 205p, 215p, 223p, 235p],  
[ 208p, 217p, 224p, 235p, 245p, 253p, 305p],  
[ 238p, 247p, 254p, 305p, 315p, 323p, 335p],  
[ 308p, 317p, 324p, 335p, 345p, 353p, 405p],  
[ 338p, 347p, 354p, 405p, 415p, 423p, 435p],  
[ 408p, 417p, 424p, 435p, 445p, 453p, 505p],  
[ 423p, 432p, 439p, 450p, 500p, 508p, 520p],  
[ 438p, 447p, 454p, 505p, 515p, 523p, 535p],  
[ 449p, 458p, 505p, 516p, -, -, -],  
[ 453p, 502p, 509p, 520p, 530p, 538p, 550p],  
[ 508p, 517p, 524p, 535p, 545p, 553p, 605p],  
[ 523p, 532p, 539p, 550p, -, -, -],  
[ 538p, 547p, 554p, 605p, 615p, 623p, 635p],  
[ 547p, 556p, 602p, 613p, -, -, -],  
[ 553p, 602p, 607p, 618p, -, -, -],  
[ 605p, 614p, 619p, 630p, 640p, 648p, 700p],  
[ 622p, 631p, 636p, 647p, -, -, -],  
[ 640p, 649p, 654p, 705p, 715p, 723p, 735p],  
[ 700p, 709p, 714p, 725p, 735p, 743p, 755p],  
[ 730p, 739p, 744p, 755p, 805p, 813p, 825p],  
[ 800p, 809p, 814p, 825p, 835p, 843p, 855p],  
[ 830p, 839p, 844p, 855p, 905p, 913p, 925p],  
[ 900p, 909p, 914p, 925p, 935p, 943p, 955p],  
[ 930p, 939p, 944p, 955p, 1005p, 1013p, 1025p],  
[ 1000p, 1009p, 1014p, 1025p, 1035p, 1043p, 1055p],  
[ 1030p, 1039p, 1044p, 1055p, 1105p, 1113p, 1125p],  
[ 1100p, 1109p, 1114p, 1125p, 1135p, 1143p, 1155p],  
[ 1130p, 1139p, 1144p, 1155p, -, -, -],  
[ 1200x, 1209x, 1214x, 1225x, -, -, -]  
]  
stop_times_saturday: [  
[ 603a, 612a, 620a, 630a, 640a, 648a, 700a],  
[ 633a, 642a, 650a, 700a, 710a, 718a, 730a],  
[ 703a, 712a, 720a, 730a, 740a, 748a, 800a],  
[ 733a, 742a, 750a, 800a, 810a, 818a, 830a],  
[ 803a, 812a, 820a, 830a, 840a, 848a, 900a],  
[ 833a, 842a, 850a, 900a, 910a, 918a, 930a],  
[ 903a, 912a, 920a, 930a, 940a, 948a, 1000a],  
[ 933a, 942a, 950a, 1000a, 1010a, 1018a, 1030a],  
[ 1003a, 1012a, 1020a, 1030a, 1040a, 1048a, 1100a],  
[ 1033a, 1042a, 1050a, 1100a, 1110a, 1118a, 1130a],  
[ 1103a, 1112a, 1120a, 1130a, 1140a, 1148a, 1200p],  
[ 1133a, 1142a, 1150a, 1200p, 1210p, 1218p, 1230p],  
[ 1203p, 1212p, 1220p, 1230p, 1240p, 1248p, 100p],  
[ 1233p, 1242p, 1250p, 100p, 110p, 118p, 130p],  
[ 103p, 112p, 120p, 130p, 140p, 148p, 200p],  
[ 133p, 142p, 150p, 200p, 210p, 218p, 230p],  
[ 203p, 212p, 220p, 230p, 240p, 248p, 300p],  
[ 233p, 242p, 250p, 300p, 310p, 318p, 330p],  
[ 303p, 312p, 320p, 330p, 340p, 348p, 400p],  
[ 333p, 342p, 350p, 400p, 410p, 418p, 430p],  
[ 403p, 412p, 420p, 430p, 440p, 448p, 500p],  
[ 433p, 442p, 450p, 500p, 510p, 518p, 530p],  
[ 503p, 512p, 520p, 530p, 540p, 548p, 600p],  
[ 533p, 542p, 550p, 600p, 610p, 618p, 630p],  
[ 603p, 612p, 620p, 630p, 640p, 648p, 700p],  
[ 633p, 642p, 650p, 700p, 710p, 718p, 730p],  
[ 703p, 712p, 720p, 730p, 740p, 748p, 800p],  
[ 733p, 742p, 750p, 800p, 810p, 818p, 830p],  
[ 803p, 812p, 820p, 830p, 840p, 848p, 900p],  
[ 833p, 842p, 850p, 900p, 910p, 918p, 930p],  
[ 903p, 912p, 920p, 930p, 940p, 948p, 1000p],  
[ 933p, 942p, 950p, 1000p, 1010p, 1018p, 1030p],  
[ 1003p, 1012p, 1020p, 1030p, 1040p, 1048p, 1100p],  
[ 1033p, 1042p, 1050p, 1100p, 1110p, 1118p, 1130p],  
[ 1103p, 1112p, 1120p, 1130p, 1140p, 1148p, 1200x],  
[ 1133p, 1142p, 1150p, 1200x, 1210x, 1218x, 1230x],  
[ 1200x, 1207x, 1215x, 1225x, -, -, -]  
]  
stop_times_sunday: [  
[ 712a, 721a, 729a, 740a, 750a, 759a, 809a],  
[ 812a, 821a, 829a, 840a, 850a, 859a, 909a],  
[ 912a, 921a, 929a, 940a, 950a, 959a, 1009a],  
[ 1012a, 1021a, 1029a, 1040a, 1050a, 1059a, 1109a],  
[ 1112a, 1121a, 1129a, 1140a, 1150a, 1159a, 1209p],  
[ 1212p, 1221p, 1229p, 1240p, 1250p, 1259p, 109p],  
[ 112p, 121p, 129p, 140p, 150p, 159p, 209p],  
[ 212p, 221p, 229p, 240p, 250p, 259p, 309p],  
[ 312p, 321p, 329p, 340p, 350p, 359p, 409p],  
[ 412p, 421p, 429p, 440p, 450p, 459p, 509p],  
[ 512p, 521p, 529p, 540p, 550p, 559p, 609p],  
[ 612p, 621p, 629p, 640p, 650p, 659p, 709p],  
[ 712p, 721p, 729p, 740p, 750p, 759p, 809p],  
[ 812p, 821p, 829p, 840p, 850p, 859p, 909p],  
[ 912p, 921p, 929p, 940p, 950p, 959p, 1009p],  
[ 1012p, 1021p, 1029p, 1040p, 1050p, 1059p, 1109p],  
[ 1112p, 1121p, 1129p, 1140p, -, -, -],  
[ 1212x, 1221x, -, -, -, -, -]  
]  
 
short_name: 10  
long_name: To Westphal  
time_points: [ 7144, 6965, 8312, 6087, 8640, 7219, 8369, 8598, 6974 ]  
between_stops:  
7144-6965: [ 8304, 6206, 6209, 6208, 6961, 6962, 6965 ]  
6965-8312: [ 6969, 8314, 8306, 8307, 8309, 8312 ]  
8312-6087: [ 8336, 8327, 8338, 6121, 6106 ]  
6087-8640: [ 6455, 6773, 6778, 6779, 6775, 6787, 7351 ]  
8640-7219: [ 8616, 6304, 6303, 8428, 8587, 8580, 8586, 8582, 7214, 7213 ]  
7219-8369: [ 7210, 7173, 6834, 8369 ]  
8369-8598: [ 8416, 8323, 8320, 8603 ]  
8598-6974: [ 6306, 6305, 7053, 7052, 7051, 6369, 6591, 6592, 7057 ]  
stop_times: [  
[ -, -, -, -, -, -, 535a, 539a, 543a],  
[ -, -, -, -, 553a, 559a, 604a, 608a, 612a],  
[ -, -, -, -, -, -, 629a, 633a, 637a],  
[ -, -, -, -, -, -, 644a, 648a, 652a],  
[ -, -, -, -, 643a, 650a, 657a, 701a, 707a],  
[ -, -, -, -, 656a, 704a, 711a, 715a, 721a],  
[ 641a, 646a, 651a, 658a, 709a, 719a, 726a, 730a, 736a],  
[ -, -, -, -, 725a, 735a, 742a, 746a, 752a],  
[ 710a, 715a, 721a, 728a, 740a, 750a, 757a, 801a, 807a],  
[ 725a, 730a, 736a, 743a, 755a, 805a, 812a, 816a, 822a],  
[ 740a, 745a, 751a, 758a, 810a, 820a, 827a, 831a, 837a],  
[ 810a, 815a, 821a, 828a, 840a, 850a, 857a, 901a, 907a],  
[ 825a, 830a, 836a, 843a, 855a, -, -, -, -],  
[ 840a, 845a, 851a, 858a, 910a, 920a, 927a, 931a, 937a],  
[ 910a, 915a, 921a, 928a, 940a, 950a, 957a, 1001a, 1007a],  
[ 940a, 945a, 951a, 958a, 1010a, 1020a, 1027a, 1031a, 1037a],  
[ 1010a, 1015a, 1021a, 1028a, 1040a, 1050a, 1057a, 1101a, 1107a],  
[ 1040a, 1045a, 1051a, 1058a, 1110a, 1120a, 1127a, 1131a, 1137a],  
[ 1110a, 1115a, 1121a, 1128a, 1140a, 1150a, 1157a, 1201p, 1207p],  
[ 1140a, 1145a, 1151a, 1158a, 1210p, 1220p, 1227p, 1231p, 1237p],  
[ 1210p, 1215p, 1221p, 1228p, 1240p, 1250p, 1257p, 101p, 107p],  
[ 1240p, 1245p, 1251p, 1258p, 110p, 120p, 127p, 131p, 137p],  
[ 110p, 115p, 121p, 128p, 140p, 150p, 157p, 201p, 207p],  
[ 140p, 145p, 151p, 158p, 210p, 220p, 227p, 231p, 237p],  
[ 210p, 215p, 221p, 228p, 240p, 250p, 257p, 301p, 307p],  
[ 240p, 245p, 251p, 258p, 310p, 320p, 327p, 331p, 337p],  
[ 310p, 315p, 321p, 328p, 340p, 350p, 357p, 401p, 407p],  
[ -, 325p, 331p, 338p, 350p, 400p, 407p, 411p, 417p],  
[ 325p, 330p, 336p, 343p, 355p, 405p, 412p, 416p, 422p],  
[ 340p, 345p, 351p, 358p, 410p, 420p, 427p, 431p, 437p],  
[ 350p, 355p, 401p, 408p, 420p, 430p, 437p, 441p, 447p],  
[ 355p, 400p, 406p, 413p, 425p, 435p, 442p, 446p, 452p],  
[ 403p, 408p, 414p, 421p, 433p, 443p, 450p, 454p, 500p],  
[ 410p, 415p, 421p, 428p, 440p, 450p, 457p, 501p, 507p],  
[ 417p, 422p, 428p, 435p, 447p, 457p, 504p, 508p, 514p],  
[ 425p, 430p, 436p, 443p, 455p, 505p, 512p, 516p, 522p],  
[ 440p, 445p, 451p, 458p, 510p, 520p, 527p, 531p, 537p],  
[ -, -, 500p, 507p, 519p, 529p, 536p, 540p, 547p],  
[ 455p, 500p, 506p, 513p, 525p, 535p, 542p, 546p, 552p],  
[ 510p, 515p, 521p, 528p, 540p, 550p, 556p, 600p, 605p],  
[ 530p, 535p, 541p, 548p, 600p, 607p, 613p, 617p, 621p],  
[ 550p, 555p, 601p, 608p, 618p, 625p, 631p, 635p, 639p],  
[ 610p, 615p, 621p, 628p, 638p, 645p, 651p, 655p, 659p],  
[ 640p, 645p, 651p, 658p, 708p, 715p, 721p, 725p, 729p],  
[ 710p, 715p, 721p, 728p, 738p, 745p, 751p, 755p, 759p],  
[ 740p, 745p, 751p, 758p, 808p, 815p, 821p, 825p, 829p],  
[ 810p, 815p, 821p, 828p, 838p, 845p, 851p, 855p, 859p],  
[ 840p, 845p, 851p, 858p, 908p, 915p, 921p, 925p, 929p],  
[ 910p, 915p, 921p, 928p, 938p, 945p, 951p, 955p, 959p],  
[ 940p, 945p, 951p, 958p, 1008p, 1015p, 1021p, 1025p, 1029p],  
[ 1010p, 1015p, 1021p, 1028p, 1038p, 1045p, 1051p, 1055p, 1059p],  
[ 1040p, 1045p, 1051p, 1058p, 1108p, 1115p, 1121p, 1125p, 1129p],  
[ 1110p, 1115p, 1121p, 1128p, 1138p, 1145p, 1151p, 1155p, 1159p]  
]  
stop_times_saturday: [  
[ 603a, 612a, 620a, 630a, 640a, 648a, 700a],  
[ 633a, 642a, 650a, 700a, 710a, 718a, 730a],  
[ 703a, 712a, 720a, 730a, 740a, 748a, 800a],  
[ 733a, 742a, 750a, 800a, 810a, 818a, 830a],  
[ 803a, 812a, 820a, 830a, 840a, 848a, 900a],  
[ 833a, 842a, 850a, 900a, 910a, 918a, 930a],  
[ 903a, 912a, 920a, 930a, 940a, 948a, 1000a],  
[ 933a, 942a, 950a, 1000a, 1010a, 1018a, 1030a],  
[ 1003a, 1012a, 1020a, 1030a, 1040a, 1048a, 1100a],  
[ 1033a, 1042a, 1050a, 1100a, 1110a, 1118a, 1130a],  
[ 1103a, 1112a, 1120a, 1130a, 1140a, 1148a, 1200p],  
[ 1133a, 1142a, 1150a, 1200p, 1210p, 1218p, 1230p],  
[ 1203p, 1212p, 1220p, 1230p, 1240p, 1248p, 100p],  
[ 1233p, 1242p, 1250p, 100p, 110p, 118p, 130p],  
[ 103p, 112p, 120p, 130p, 140p, 148p, 200p],  
[ 133p, 142p, 150p, 200p, 210p, 218p, 230p],  
[ 203p, 212p, 220p, 230p, 240p, 248p, 300p],  
[ 233p, 242p, 250p, 300p, 310p, 318p, 330p],  
[ 303p, 312p, 320p, 330p, 340p, 348p, 400p],  
[ 333p, 342p, 350p, 400p, 410p, 418p, 430p],  
[ 403p, 412p, 420p, 430p, 440p, 448p, 500p],  
[ 433p, 442p, 450p, 500p, 510p, 518p, 530p],  
[ 503p, 512p, 520p, 530p, 540p, 548p, 600p],  
[ 533p, 542p, 550p, 600p, 610p, 618p, 630p],  
[ 603p, 612p, 620p, 630p, 640p, 648p, 700p],  
[ 633p, 642p, 650p, 700p, 710p, 718p, 730p],  
[ 703p, 712p, 720p, 730p, 740p, 748p, 800p],  
[ 733p, 742p, 750p, 800p, 810p, 818p, 830p],  
[ 803p, 812p, 820p, 830p, 840p, 848p, 900p],  
[ 833p, 842p, 850p, 900p, 910p, 918p, 930p],  
[ 903p, 912p, 920p, 930p, 940p, 948p, 1000p],  
[ 933p, 942p, 950p, 1000p, 1010p, 1018p, 1030p],  
[ 1003p, 1012p, 1020p, 1030p, 1040p, 1048p, 1100p],  
[ 1033p, 1042p, 1050p, 1100p, 1110p, 1118p, 1130p],  
[ 1103p, 1112p, 1120p, 1130p, 1140p, 1148p, 1200x],  
[ 1133p, 1142p, 1150p, 1200x, 1210x, 1218x, 1230x],  
[ 1200x, 1207x, 1215x, 1225x, -, -, -]  
]  
stop_times_sunday: [  
[ 712a, 721a, 729a, 740a, 750a, 759a, 809a],  
[ 812a, 821a, 829a, 840a, 850a, 859a, 909a],  
[ 912a, 921a, 929a, 940a, 950a, 959a, 1009a],  
[ 1012a, 1021a, 1029a, 1040a, 1050a, 1059a, 1109a],  
[ 1112a, 1121a, 1129a, 1140a, 1150a, 1159a, 1209p],  
[ 1212p, 1221p, 1229p, 1240p, 1250p, 1259p, 109p],  
[ 112p, 121p, 129p, 140p, 150p, 159p, 209p],  
[ 212p, 221p, 229p, 240p, 250p, 259p, 309p],  
[ 312p, 321p, 329p, 340p, 350p, 359p, 409p],  
[ 412p, 421p, 429p, 440p, 450p, 459p, 509p],  
[ 512p, 521p, 529p, 540p, 550p, 559p, 609p],  
[ 612p, 621p, 629p, 640p, 650p, 659p, 709p],  
[ 712p, 721p, 729p, 740p, 750p, 759p, 809p],  
[ 812p, 821p, 829p, 840p, 850p, 859p, 909p],  
[ 912p, 921p, 929p, 940p, 950p, 959p, 1009p],  
[ 1012p, 1021p, 1029p, 1040p, 1050p, 1059p, 1109p],  
[ 1112p, 1121p, 1129p, 1140p, -, -, -],  
[ 1212x, 1221x, -, -, -, -, -]  
]  
 
short_name: 14  
long_name: To Leiblin Park  
time_points: [ 6105, 6966, 7421, 8643, 8168, 7143 ]  
between_stops:  
6105-6966: [ 6108, 6103, 6102, 6122, 8331, 8330, 8334, 8313, 8311, 8315, 6960 ]  
6966-7421: [ 8317, 7401, 7403, 7410, 7406 ]  
7421-8643: [ 7404, 6405, 6404, 6413, 6414, 7275 ]  
stop_times: [  
[ -, -, -, 637a, 649a, 701a],  
[ 618a, 630a, 637a, 648a, 700a, 712a],  
[ 655a, 707a, 714a, 725a, 737a, 749a],  
[ 713a, 725a, 732a, 743a, -, -],  
[ 715a, 727a, 734a, 745a, -, -],  
[ 735a, 747a, 754a, 805a, 817a, 829a],  
[ 755a, 807a, 814a, 825a, 837a, 849a],  
[ 816a, 828a, 835a, 846a, -, -],  
[ 835a, 847a, 854a, 905a, 917a, 929a],  
[ 902a, 914a, 921a, 932a, 944a, 956a],  
[ 912a, 924a, 931a, 942a, -, -],  
[ 930a, 942a, 949a, 1000a, -, -],  
[ 932a, 944a, 951a, 1002a, 1014a, 1026a],  
[ 1002a, 1014a, 1021a, 1032a, 1044a, 1056a],  
[ 1032a, 1044a, 1051a, 1102a, 1114a, 1126a],  
[ 1102a, 1114a, 1121a, 1132a, 1144a, 1156a],  
[ 1132a, 1144a, 1151a, 1202p, 1214p, 1226p],  
[ 1202p, 1214p, 1221p, 1232p, 1244p, 1256p],  
[ 1232p, 1244p, 1251p, 102p, 114p, 126p],  
[ 102p, 114p, 121p, 132p, 144p, 156p],  
[ 132p, 144p, 151p, 202p, 214p, 226p],  
[ 202p, 214p, 221p, 232p, 244p, 256p],  
[ 232p, 244p, 251p, 302p, 314p, 326p],  
[ 302p, 314p, 321p, 332p, 344p, 356p],  
[ 332p, 344p, 351p, 402p, 414p, 426p],  
[ 402p, 414p, 421p, 432p, 444p, 456p],  
[ 432p, 444p, 451p, 502p, 514p, 526p],  
[ 458p, 510p, 517p, 528p, -, -],  
[ 502p, 514p, 521p, 532p, 544p, 556p],  
[ 532p, 544p, 551p, 602p, 614p, 626p],  
[ 602p, 614p, 621p, 632p, 644p, 656p],  
[ 632p, 644p, 651p, 702p, 714p, 726p],  
[ 732p, 744p, 751p, 802p, 814p, 826p],  
[ 832p, 844p, 851p, 902p, 914p, 926p],  
[ 932p, 944p, 951p, 1002p, 1014p, 1026p],  
[ 1032p, 1044p, 1051p, 1102p, 1114p, 1126p],  
[ -, -, -, 1210x, 1222x, 1234x]  
]  
stop_times_saturday: [  
[ -, -, -, 618a, 627a, 640a],  
[ -, -, -, 718a, 727a, 740a],  
[ 748a, 800a, 807a, 818a, 827a, 840a],  
[ 848a, 900a, 907a, 918a, 927a, 940a],  
[ 948a, 1000a, 1007a, 1018a, 1027a, 1040a],  
[ 1048a, 1100a, 1107a, 1118a, 1127a, 1140a],  
[ 1148a, 1200p, 1207p, 1218p, 1227p, 1240p],  
[ 1248p, 100p, 107p, 118p, 127p, 140p],  
[ 148p, 200p, 207p, 218p, 227p, 240p],  
[ 248p, 300p, 307p, 318p, 327p, 340p],  
[ 348p, 400p, 407p, 418p, 427p, 440p],  
[ 448p, 500p, 507p, 518p, 527p, 540p],  
[ 548p, 600p, 607p, 618p, 627p, 640p],  
[ 648p, 700p, 707p, 718p, 727p, 740p],  
[ 748p, 800p, 807p, 818p, 827p, 840p],  
[ 848p, 900p, 907p, 918p, 927p, 940p],  
[ 948p, 1000p, 1007p, 1018p, 1027p, 1040p]  
]  
stop_times_sunday: [  
[ 636a, 645a, 652a, 705a, 712a, 722a],  
[ 736a, 745a, 752a, 805a, 812a, 822a],  
[ 836a, 845a, 852a, 905a, 912a, 922a],  
[ 936a, 945a, 952a, 1005a, 1012a, 1022a],  
[ 1036a, 1045a, 1052a, 1105a, 1112a, 1122a],  
[ 1136a, 1145a, 1152a, 1205p, 1212p, 1222p],  
[ 1236p, 1245p, 1252p, 105p, 112p, 122p],  
[ 136p, 145p, 152p, 205p, 212p, 222p],  
[ 236p, 245p, 252p, 305p, 312p, 322p],  
[ 336p, 345p, 352p, 405p, 412p, 422p],  
[ 436p, 445p, 452p, 505p, 512p, 522p],  
[ 536p, 545p, 552p, 605p, 612p, 622p],  
[ 636p, 645p, 652p, 705p, 712p, 722p],  
[ 736p, 745p, 752p, 805p, 812p, 822p],  
[ 836p, 845p, 852p, 905p, 912p, 922p],  
[ 936p, 945p, 952p, 1005p, 1012p, 1022p]  
]  
 
short_name: 14  
long_name: To Universities / Downtown  
time_points: [ 7143, 8167, 7285, 7412, 6965, 6087 ]  
between_stops:  
7285-7412: [ 7274, 6409, 6403, 6407, 6406, 7355 ]  
7412-6965: [ 7419, 7409, 7402, 8304, 6962 ]  
6965-6087: [ 6969, 8314, 8306, 8307, 8309, 8312, 8336, 8327, 8338, 6121, 6106 ]  
stop_times: [  
[ 632a, 642a, 657a, 708a, 715a, 727a],  
[ 702a, 712a, 727a, 738a, 745a, 757a],  
[ -, -, 755a, 806a, 813a, 825a],  
[ 732a, 742a, 757a, 808a, 815a, 827a],  
[ 802a, 812a, 827a, 838a, 845a, 857a],  
[ 832a, 842a, 857a, 908a, 915a, 927a],  
[ 902a, 912a, 927a, 938a, 945a, 957a],  
[ 932a, 942a, 957a, 1008a, 1015a, 1027a],  
[ 1002a, 1012a, 1027a, 1038a, 1045a, 1057a],  
[ 1032a, 1042a, 1057a, 1108a, 1115a, 1127a],  
[ 1102a, 1112a, 1127a, 1138a, 1145a, 1157a],  
[ 1132a, 1142a, 1157a, 1208p, 1215p, 1227p],  
[ 1202p, 1212p, 1227p, 1238p, 1245p, 1257p],  
[ 1232p, 1242p, 1257p, 108p, 115p, 127p],  
[ 102p, 112p, 127p, 138p, 145p, 157p],  
[ 132p, 142p, 157p, 208p, 215p, 227p],  
[ 202p, 212p, 227p, 238p, 245p, 257p],  
[ 232p, 242p, 257p, 308p, 315p, 327p],  
[ 302p, 312p, 327p, 338p, 345p, 357p],  
[ -, -, 340p, 351p, 358p, 410p],  
[ -, -, -, -, 407p, 419p],  
[ 332p, 342p, 357p, 408p, 415p, 427p],  
[ -, -, -, -, 428p, 440p],  
[ 359p, 409p, 424p, 435p, 442p, 454p],  
[ 432p, 442p, 457p, 508p, 515p, 527p],  
[ 502p, 512p, 527p, 538p, 545p, 557p],  
[ 532p, 542p, 557p, 608p, 615p, 627p],  
[ 602p, 612p, 627p, 638p, 645p, 657p],  
[ 632p, 642p, 657p, 708p, 715p, 727p],  
[ 702p, 712p, 727p, 738p, 745p, 757p],  
[ 732p, 742p, 757p, 808p, 815p, 827p],  
[ 832p, 842p, 857p, 908p, 915p, 927p],  
[ 932p, 942p, 957p, 1008p, 1015p, 1027p],  
[ 1032p, 1042p, 1057p, -, -, -],  
[ 1132p, 1142p, 1157p, -, -, -],  
[ 1235x, 1245x, 100x, -, -, -]  
]  
stop_times_saturday: [  
[ 646a, 655a, 710a, 721a, 728a, 740a],  
[ 746a, 755a, 810a, 821a, 828a, 840a],  
[ 846a, 855a, 910a, 921a, 928a, 940a],  
[ 946a, 955a, 1010a, 1021a, 1028a, 1040a],  
[ 1046a, 1055a, 1110a, 1121a, 1128a, 1140a],  
[ 1146a, 1155a, 1210p, 1221p, 1228p, 1240p],  
[ 1246p, 1255p, 110p, 121p, 128p, 140p],  
[ 146p, 155p, 210p, 221p, 228p, 240p],  
[ 246p, 255p, 310p, 321p, 328p, 340p],  
[ 346p, 355p, 410p, 421p, 428p, 440p],  
[ 446p, 455p, 510p, 521p, 528p, 540p],  
[ 546p, 555p, 610p, 621p, 628p, 640p],  
[ 646p, 655p, 710p, 721p, 728p, 740p],  
[ 746p, 755p, 810p, 821p, 828p, 840p],  
[ 846p, 855p, 910p, 921p, 928p, 940p],  
[ 946p, 955p, 1010p, 1021p, 1028p, 1040p],  
[ 1046p, 1055p, 1107p, -, -, -]  
]  
stop_times_sunday: [  
[ 728a, 736a, 750a, 801a, 808a, 817a],  
[ 828a, 836a, 850a, 901a, 908a, 917a],  
[ 928a, 936a, 950a, 1001a, 1008a, 1017a],  
[ 1028a, 1036a, 1050a, 1101a, 1108a, 1117a],  
[ 1128a, 1136a, 1150a, 1201p, 1208p, 1217p],  
[ 1228p, 1236p, 1250p, 101p, 108p, 117p],  
[ 128p, 136p, 150p, 201p, 208p, 217p],  
[ 228p, 236p, 250p, 301p, 308p, 317p],  
[ 328p, 336p, 350p, 401p, 408p, 417p],  
[ 428p, 436p, 450p, 501p, 508p, 517p],  
[ 528p, 536p, 550p, 601p, 608p, 617p],  
[ 628p, 636p, 650p, 701p, 708p, 717p],  
[ 728p, 736p, 750p, 801p, 808p, 817p],  
[ 828p, 836p, 850p, 901p, 908p, 917p],  
[ 928p, 936p, 950p, 1001p, 1008p, 1017p],  
[ 1028p, 1036p, 1050p, 1101p, 1108p, 1117p]  
]  
 
short_name: 17  
long_name: "To Hospitals / Universities"  
time_points: [ 7087, 7166, 6564, 8561, 8214, 8308, 6966 ]  
between_stops:  
6564-8561: [ 6197, 6193, 6203 ]  
8561-8214: [ 8564, 8557, 8566, 8559, 6545, 8205, 8190 ]  
8214-8308: [ 8183, 8196, 8195, 8194, 8328, 8337, 8333 ]  
8308-6966: [ 8313, 8311, 8315, 6960 ]  
stop_times: [  
[ 625a, 634a, 638a, 645a, 652a, 658a, 702a],  
[ 655a, 704a, 708a, 715a, 722a, 728a, 732a],  
[ 725a, 734a, 738a, 745a, 752a, 758a, 802a],  
[ 755a, 804a, 808a, 815a, 822a, 828a, 832a],  
[ -, -, 825a, 832a, 839a, 845a, 849a],  
[ 825a, 834a, 838a, 845a, 852a, 858a, 902a],  
[ 838a, 847a, 851a, 858a, 905a, 911a, 915a],  
[ 855a, 904a, 908a, 915a, 922a, 928a, 932a],  
[ -, -, 910a, 917a, 924a, 930a, 934a],  
[ 925a, 934a, 938a, 945a, 952a, 958a, 1002a],  
[ 955a, 1004a, 1008a, 1015a, 1022a, 1028a, 1032a],  
[ 1025a, 1034a, 1038a, 1045a, 1052a, 1058a, 1102a],  
[ 1055a, 1104a, 1108a, 1115a, 1122a, 1128a, 1132a],  
[ 1125a, 1134a, 1138a, 1145a, 1152a, 1158a, 1202p],  
[ 1155a, 1204p, 1208p, 1215p, 1222p, 1228p, 1232p],  
[ 1225p, 1234p, 1238p, 1245p, 1252p, 1258p, 102p],  
[ 1255p, 104p, 108p, 115p, 122p, 128p, 132p],  
[ 125p, 134p, 138p, 145p, 152p, 158p, 202p],  
[ 155p, 204p, 208p, 215p, 222p, 228p, 232p],  
[ 225p, 234p, 238p, 245p, 252p, 258p, 302p],  
[ 255p, 304p, 308p, 315p, 322p, 328p, 332p],  
[ 325p, 334p, 338p, 345p, 352p, 358p, 402p],  
[ 355p, 404p, 408p, 415p, 422p, 428p, 432p],  
[ 425p, 434p, 438p, 445p, 452p, 458p, 502p],  
[ 455p, 504p, 508p, 515p, 522p, 528p, 532p],  
[ 525p, 534p, 538p, 545p, 552p, 558p, 602p],  
[ 555p, 604p, 608p, 615p, 622p, 628p, 632p]  
]  
 
short_name: 17  
long_name: To Lacewood  
time_points: [ 6966, 8185, 8184, 8571, 6563, 6032, 7087 ]  
between_stops:  
6966-8185: [ 8220, 8187 ]  
8185-8184: [ 8219, 8179 ]  
8184-8571: [ 8206, 6544, 8558, 8554, 8568, 8556, 8572 ]  
8571-6563: [ 6192, 6196, 6201, 6200, 6199, 6198 ]  
6563-6032: [ 6565, 6984 ]  
stop_times: [  
[ 705a, 709a, 711a, 718a, 726a, 731a, 738a],  
[ 735a, 739a, 741a, 748a, 756a, 801a, 808a],  
[ 805a, 809a, 811a, 818a, 826a, 831a, 838a],  
[ 835a, 839a, 841a, 848a, 856a, 901a, 908a],  
[ 905a, 909a, 911a, 918a, 926a, 931a, 938a],  
[ 935a, 939a, 941a, 948a, 956a, 1001a, 1008a],  
[ 1005a, 1009a, 1011a, 1018a, 1026a, 1031a, 1038a],  
[ 1035a, 1039a, 1041a, 1048a, 1056a, 1101a, 1108a],  
[ 1105a, 1109a, 1111a, 1118a, 1126a, 1131a, 1138a],  
[ 1135a, 1139a, 1141a, 1148a, 1156a, 1201p, 1208p],  
[ 1205p, 1209p, 1211p, 1218p, 1226p, 1231p, 1238p],  
[ 1235p, 1239p, 1241p, 1248p, 1256p, 101p, 108p],  
[ 105p, 109p, 111p, 118p, 126p, 131p, 138p],  
[ 135p, 139p, 141p, 148p, 156p, 201p, 208p],  
[ 205p, 209p, 211p, 218p, 226p, 231p, 238p],  
[ 235p, 239p, 241p, 248p, 256p, 301p, 308p],  
[ 305p, 309p, 311p, 318p, 326p, 331p, 338p],  
[ 335p, 339p, 341p, 348p, 356p, 401p, 408p],  
[ 405p, 409p, 411p, 418p, 426p, 431p, 438p],  
[ 435p, 439p, 441p, 448p, 456p, 501p, 508p],  
[ 505p, 509p, 511p, 518p, 526p, 531p, 538p],  
[ 535p, 539p, 541p, 548p, 556p, 601p, 608p],  
[ 605p, 609p, 611p, 618p, 626p, 631p, 638p],  
[ 635p, 639p, 641p, 648p, 656p, 701p, 708p]  
 
]  
 
short_name: 18  
long_name: To Lacewood  
time_points: [ 6966, 8184, 6219, 7086 ]  
between_stops:  
6966-8184: [ 8220, 8187, 8185, 8219, 8179 ]  
8184-6219: [ 8206, 6544, 8558, 8554, 8568, 8556, 8572, 8571, 8574, 8550, 8549, 8567, 8570, 8552 ]  
stop_times: [  
[ -, -, 612a, 625a],  
[ -, -, 642a, 655a],  
[ 650a, 658a, 715a, 728a],  
[ 720a, 728a, 745a, 758a],  
[ 750a, 758a, 815a, 828a],  
[ 820a, 828a, 845a, 858a],  
[ 850a, 858a, 914a, 926a],  
[ 921a, 927a, 944a, 956a],  
[ 950a, 956a, 1013a, 1025a],  
[ 1020a, 1026a, 1043a, 1055a],  
[ 1050a, 1056a, 1113a, 1125a],  
[ 1120a, 1126a, 1143a, 1155a],  
[ 1150a, 1156a, 1213p, 1225p],  
[ 1220p, 1226p, 1243p, 1255p],  
[ 1250p, 1256p, 113p, 125p],  
[ 120p, 126p, 143p, 155p],  
[ 150p, 156p, 213p, 225p],  
[ 220p, 226p, 248p, 301p],  
[ 227p, 234p, 256p, 309p],  
[ 247p, 255p, 317p, 330p],  
[ 257p, 305p, 327p, 340p],  
[ 320p, 328p, 350p, 403p],  
[ 340p, 348p, 410p, 423p],  
[ 350p, 358p, 420p, 433p],  
[ 419p, 427p, 449p, 502p],  
[ 450p, 458p, 520p, 533p],  
[ 520p, 528p, 550p, 603p],  
[ 550p, 558p, 615p, 627p],  
[ 621p, 627p, 644p, 656p],  
[ 650p, 656p, 713p, 725p],  
[ 720p, 726p, 743p, 755p],  
[ 750p, 756p, 813p, 825p],  
[ 820p, 826p, 843p, 855p],  
[ 850p, 856p, 913p, 925p],  
[ 920p, 926p, 943p, 955p],  
[ 950p, 956p, 1013p, 1025p],  
[ 1020p, 1026p, 1043p, 1055p],  
[ 1050p, 1056p, 1113p, 1125p],  
[ 1120p, 1126p, 1143p, 1155p],  
[ 1150p, 1156p, 1213x, 1225x]  
]  
stop_times_saturday: [  
[ 702a, 713a, 730a, 740a],  
[ 802a, 813a, 830a, 840a],  
[ 832a, 843a, 900a, 910a],  
[ 902a, 913a, 930a, 940a],  
[ 932a, 943a, 1000a, 1010a],  
[ 1002a, 1013a, 1030a, 1040a],  
[ 1032a, 1043a, 1100a, 1110a],  
[ 1102a, 1113a, 1130a, 1140a],  
[ 1132a, 1143a, 1200p, 1210p],  
[ 1202p, 1213p, 1230p, 1240p],  
[ 1232p, 1243p, 100p, 110p],  
[ 102p, 113p, 130p, 140p],  
[ 132p, 143p, 200p, 210p],  
[ 202p, 213p, 230p, 240p],  
[ 232p, 243p, 300p, 310p],  
[ 302p, 313p, 330p, 340p],  
[ 332p, 343p, 400p, 410p],  
[ 402p, 413p, 430p, 440p],  
[ 432p, 443p, 500p, 510p],  
[ 502p, 513p, 530p, 540p],  
[ 532p, 543p, 600p, 610p],  
[ 602p, 613p, 630p, 640p],  
[ 632p, 643p, 700p, 710p],  
[ 702p, 713p, 730p, 740p],  
[ 732p, 743p, 800p, 810p],  
[ 802p, 813p, 830p, 840p],  
[ 832p, 843p, 900p, 910p],  
[ 902p, 913p, 930p, 940p],  
[ 932p, 943p, 1000p, 1010p],  
[ 1002p, 1013p, 1030p, 1040p],  
[ 1102p, 1113p, 1130p, 1140p],  
[ 1202x, 1213x, 1230x, 1240x]  
]  
stop_times_sunday: [  
[ -, -, 655a, 705a],  
[ 738a, 742a, 755a, 805a],  
[ 838a, 842a, 855a, 905a],  
[ 938a, 942a, 955a, 1005a],  
[ 1038a, 1042a, 1055a, 1105a],  
[ 1138a, 1142a, 1155a, 1205p],  
[ 1238p, 1242p, 1255p, 105p],  
[ 138p, 142p, 155p, 205p],  
[ 238p, 242p, 255p, 305p],  
[ 338p, 342p, 355p, 405p],  
[ 438p, 442p, 455p, 505p],  
[ 538p, 542p, 555p, 605p],  
[ 638p, 642p, 655p, 705p],  
[ 738p, 742p, 755p, 805p],  
[ 838p, 842p, 855p, 905p],  
[ 938p, 942p, 955p, 1005p],  
[ 1038p, 1042p, 1055p, 1105p],  
[ 1138p, 1142p, 1155p, 1205x]  
]  
 
short_name: 18  
long_name: To SMU  
time_points: [ 7087, 6216, 8214, 6966 ]  
between_stops:  
6216-8214: [ 8551, 8562, 8565, 8573, 8555, 8561, 8564, 8557, 8566, 8559, 6545, 8205, 8190 ]  
8214-6966: [ 8183, 8196, 8195, 8194, 8328, 8337, 8333, 8308, 8313, 8311, 8315, 6960 ]  
stop_times: [  
[ 610a, 622a, 641a, 649a],  
[ 640a, 652a, 711a, 719a],  
[ 710a, 722a, 741a, 749a],  
[ 740a, 752a, 811a, 819a],  
[ 810a, 822a, 841a, 849a],  
[ 840a, 852a, 911a, 921a],  
[ 910a, 922a, 939a, 949a],  
[ 940a, 952a, 1009a, 1019a],  
[ 1010a, 1022a, 1039a, 1049a],  
[ 1040a, 1052a, 1109a, 1119a],  
[ 1110a, 1122a, 1139a, 1149a],  
[ 1140a, 1152a, 1209p, 1219p],  
[ 1210p, 1222p, 1239p, 1249p],  
[ 1240p, 1252p, 109p, 119p],  
[ 110p, 122p, 139p, 149p],  
[ 140p, 152p, 209p, 219p],  
[ -, -, 214p, 224p],  
[ 210p, 222p, 237p, 244p],  
[ -, -, 240p, 247p],  
[ 240p, 253p, 310p, 317p],  
[ -, -, 330p, 337p],  
[ 310p, 323p, 340p, 347p],  
[ 340p, 353p, 410p, 417p],  
[ 410p, 423p, 440p, 447p],  
[ 440p, 453p, 510p, 517p],  
[ 510p, 523p, 540p, 547p],  
[ 540p, 553p, 611p, 621p],  
[ 610p, 622p, 639p, 649p],  
[ 640p, 652p, 709p, 719p],  
[ 710p, 722p, 739p, 749p],  
[ 740p, 752p, 809p, 819p],  
[ 810p, 822p, 839p, 849p],  
[ 840p, 852p, 909p, 919p],  
[ 910p, 922p, 939p, 949p],  
[ 940p, 952p, 1009p, 1019p],  
[ 1010p, 1022p, 1039p, 1049p],  
[ 1040p, 1052p, 1109p, 1119p],  
[ 1110p, 1122p, 1139p, 1149p],  
[ 1140p, 1152p, 1209x, 1219x],  
[ 1210x, 1222x, -, -],  
[ 1225x, 1237x, -, -]  
]  
stop_times_saturday: [  
[ 620a, 630a, 649a, 702a],  
[ 720a, 730a, 749a, 802a],  
[ 750a, 800a, 819a, 832a],  
[ 820a, 830a, 849a, 902a],  
[ 850a, 900a, 919a, 932a],  
[ 920a, 930a, 949a, 1002a],  
[ 950a, 1000a, 1019a, 1032a],  
[ 1020a, 1030a, 1049a, 1102a],  
[ 1050a, 1100a, 1119a, 1132a],  
[ 1120a, 1130a, 1149a, 1202p],  
[ 1150a, 1200p, 1219p, 1232p],  
[ 1220p, 1230p, 1249p, 102p],  
[ 1250p, 100p, 119p, 132p],  
[ 120p, 130p, 149p, 202p],  
[ 150p, 200p, 219p, 232p],  
[ 220p, 230p, 249p, 302p],  
[ 250p, 300p, 319p, 332p],  
[ 320p, 330p, 349p, 402p],  
[ 350p, 400p, 419p, 432p],  
[ 420p, 430p, 449p, 502p],  
[ 450p, 500p, 519p, 532p],  
[ 520p, 530p, 549p, 602p],  
[ 550p, 600p, 619p, 632p],  
[ 620p, 630p, 649p, 702p],  
[ 650p, 700p, 719p, 732p],  
[ 720p, 730p, 749p, 802p],  
[ 750p, 800p, 819p, 832p],  
[ 820p, 830p, 849p, 902p],  
[ 850p, 900p, 919p, 932p],  
[ 920p, 930p, 949p, 1002p],  
[ 1020p, 1030p, 1049p, 1102p],  
[ 1120p, 1130p, 1149p, 1202x],  
[ 1220x, 1230x, -, -]  
]  
stop_times_sunday: [  
[ 705a, 715a, 731a, 738a],  
[ 805a, 815a, 831a, 838a],  
[ 905a, 915a, 931a, 938a],  
[ 1005a, 1015a, 1031a, 1038a],  
[ 1105a, 1115a, 1131a, 1138a],  
[ 1205p, 1215p, 1231p, 1238p],  
[ 105p, 115p, 131p, 138p],  
[ 205p, 215p, 231p, 238p],  
[ 305p, 315p, 331p, 338p],  
[ 405p, 415p, 431p, 438p],  
[ 505p, 515p, 531p, 538p],  
[ 605p, 615p, 631p, 638p],  
[ 705p, 715p, 731p, 738p],  
[ 805p, 815p, 831p, 838p],  
[ 905p, 915p, 931p, 938p],  
[ 1005p, 1015p, 1031p, 1038p],  
[ 1105p, 1115p, 1131p, 1138p],  
[ 1205x, 1215x, -, -]  
]  
 
short_name: 2  
long_name: To Downtown via North Street  
time_points: [ 7019, 7023, 7087, 6564, 6612, 7284, 7351, 6105, 8435 ]  
between_stops:  
6564-7284: [ 6197, 6193 ]  
7284-7351: [ 7274, 6409, 6403, 6407, 6406, 7355, 7345, 7357, 7352, 7342, 7354, 7347 ]  
7351-6105: [ 7343, 6088, 6104, 6125 ]  
6105-8435: [ 6108, 6733 ]  
stop_times: [  
[ 557a, 601a, 610a, 624a, -, 632a, 642a, 646a, 649a],  
[ 637a, 641a, 650a, 704a, -, 712a, 722a, 727a, 730a],  
[ 707a, 711a, 720a, 734a, -, 742a, 752a, 757a, 800a],  
[ 737a, 741a, 750a, 804a, -, 812a, 822a, 827a, 830a],  
[ 807a, 811a, 820a, 834a, -, 842a, 852a, 857a, 900a],  
[ 837a, 841a, 850a, 904a, -, 912a, 922a, 928a, 931a],  
[ 907a, 911a, 920a, 935a, -, 943a, 953a, 959a, 1002a],  
[ 937a, 941a, 950a, 1005a, -, 1013a, 1023a, 1029a, 1032a],  
[ 1007a, 1011a, 1020a, 1035a, -, 1043a, 1053a, 1059a, 1102a],  
[ 1037a, 1041a, 1050a, 1105a, -, 1113a, 1123a, 1129a, 1132a],  
[ 1107a, 1111a, 1120a, 1135a, -, 1143a, 1153a, 1159a, 1202p],  
[ 1137a, 1141a, 1150a, 1205p, -, 1213p, 1223p, 1229p, 1232p],  
[ 1207p, 1211p, 1220p, 1235p, -, 1243p, 1253p, 1259p, 102p],  
[ 1237p, 1241p, 1250p, 105p, -, 113p, 123p, 129p, 132p],  
[ 107p, 111p, 120p, 135p, -, 143p, 153p, 159p, 202p],  
[ 137p, 141p, 150p, 205p, -, 213p, 223p, 229p, 232p],  
[ 207p, 211p, 220p, 235p, -, 243p, 253p, 259p, 302p],  
[ 237p, 241p, 250p, 305p, -, 313p, 323p, 329p, 332p],  
[ 307p, 311p, 320p, 335p, -, 343p, 353p, 359p, 402p],  
[ 337p, 341p, 350p, 405p, -, 413p, 423p, 429p, 432p],  
[ 407p, 411p, 420p, 435p, -, 443p, 453p, 459p, 502p],  
[ 437p, 441p, 450p, 505p, -, 513p, 523p, 529p, 532p],  
[ 507p, 511p, 520p, 535p, -, 543p, 553p, 559p, 602p],  
[ 537p, 541p, 550p, 604p, -, 610p, 618p, 622p, 625p],  
[ 607p, 611p, 620p, 633p, -, 639p, 647p, 651p, 654p],  
[ 637p, 641p, 650p, 703p, -, 709p, 717p, 721p, 724p],  
[ 737p, 741p, 750p, 803p, -, 809p, 817p, 821p, 824p],  
[ 837p, 841p, 850p, 903p, -, 909p, 917p, 921p, 924p],  
[ 937p, 941p, 950p, 1003p, 1005p, 1009p, 1017p, 1021p, 1024p],  
[ 1037p, 1041p, 1050p, 1103p, 1105p, 1109p, 1117p, 1121p, 1124p],  
[ 1137p, 1141p, 1150p, 1203x, 1205x, 1209x, 1217x, 1221x, 1224x],  
[ 1237x, 1241x, 1250x, -, -, -, -, -, -]  
]  
stop_times_saturday: [  
[ 632a, 637a, 645a, 659a, -, 705a, 713a, 716a, 718a],  
[ 732a, 737a, 745a, 759a, -, 805a, 813a, 816a, 818a],  
[ 832a, 837a, 845a, 859a, -, 905a, 915a, 917a, 920a],  
[ 932a, 937a, 945a, 1000a, -, 1006a, 1015a, 1018a, 1021a],  
[ 1032a, 1037a, 1045a, 1100a, -, 1106a, 1115a, 1118a, 1121a],  
[ 1102a, 1107a, 1115a, 1130a, -, 1136a, 1145a, 1148a, 1151a],  
[ 1132a, 1137a, 1145a, 1200a, -, 1206p, 1215p, 1218p, 1221p],  
[ 1202p, 1207p, 1215p, 1230p, -, 1236p, 1245p, 1248p, 1251p],  
[ 1232p, 1237p, 1245p, 100p, -, 106p, 115p, 118p, 121p],  
[ 102p, 107p, 115p, 130p, -, 136p, 145p, 148p, 151p],  
[ 132p, 137p, 145p, 200p, -, 206p, 215p, 218p, 221p],  
[ 202p, 207p, 215p, 230p, -, 236p, 245p, 248p, 251p],  
[ 232p, 237p, 245p, 300p, -, 306p, 315p, 318p, 321p],  
[ 302p, 307p, 315p, 330p, -, 336p, 345p, 348p, 351p],  
[ 332p, 337p, 345p, 400p, -, 406p, 415p, 418p, 421p],  
[ 402p, 407p, 415p, 430p, -, 436p, 445p, 448p, 451p],  
[ 432p, 437p, 445p, 500p, -, 506p, 515p, 518p, 521p],  
[ 502p, 507p, 515p, 530p, -, 536p, 545p, 548p, 551p],  
[ 532p, 537p, 545p, 600p, -, 606p, 615p, 618p, 619p],  
[ 602p, 607p, 615p, 628p, -, 634p, 642p, 645p, 647p],  
[ 632p, 637p, 645p, 658p, -, 704p, 712p, 715p, 717p],  
[ 737p, 742p, 750p, 803p, -, 809p, 817p, 820p, 822p],  
[ 837p, 842p, 850p, 903p, -, 909p, 917p, 920p, 922p],  
[ 937p, 942p, 950p, 1003p, 1005p, 1009p, 1017p, 1020p, 1022p],  
[ 1037p, 1042p, 1050p, 1103p, 1105p, 1109p, 1117p, 1120p, 1122p],  
[ 1137p, 1142p, 1150p, 1203x, 1205x, 1209x, 1217x, 1220x, 1222x],  
[ 1237x, 1242x, 1250x, -, -, -, -, -]  
]  
stop_times_sunday: [  
[ 740a, 743a, 750a, 800a, -, 808a, 818a, 821a, 823a],  
[ 840a, 843a, 850a, 900a, -, 908a, 918a, 921a, 923a],  
[ 940a, 943a, 950a, 1000a, -, 1008a, 1018a, 1021a, 1023a],  
[ 1040a, 1043a, 1050a, 1100a, -, 1108a, 1118a, 1121a, 1123a],  
[ 1140a, 1143a, 1150a, 1200p, -, 1208p, 1218p, 1221p, 1223p],  
[ 1240p, 1243p, 1250p, 100p, -, 108p, 118p, 121p, 123p],  
[ 140p, 143p, 150p, 200p, -, 208p, 218p, 221p, 223p],  
[ 240p, 243p, 250p, 300p, -, 308p, 318p, 318p, 323p],  
[ 340p, 343p, 350p, 400p, -, 408p, 418p, 421p, 423p],  
[ 440p, 443p, 450p, 500p, -, 508p, 518p, 521p, 523p],  
[ 540p, 543p, 550p, 600p, -, 606p, 616p, 619p, 621p],  
[ 640p, 643p, 650p, 700p, -, 706p, 716p, 719p, 721p],  
[ 740p, 743p, 750p, 800p, -, 806p, 816p, 819p, 821p],  
[ 840p, 843p, 850p, 900p, -, 906p, 916p, 919p, 921p],  
[ 940p, 943p, 950p, 1000p, 1002p, 1005p, 1015p, 1018p, 1020p],  
[ 1040p, 1043p, 1050p, 1100p, 1102p, 1105p, 1115p, 1118p, 1120p],  
[ 1140p, 1143p, 1150p, -, -, -, -, -, -]  
]  
 
short_name: 2  
long_name: To Wedgewood via Main  
time_points: [ 8435, 7348, 8643, 6612, 6563, 6032, 6597, 7087, 7019 ]  
between_stops:  
8435-7348: [ 6089, 6116 ]  
7348-8643: [ 7346, 7341, 7353, 7358, 7344, 7356, 6405, 6404, 6413, 6414, 7275 ]  
8643-6563: [ 6199, 6198 ]  
6563-6032: [ 6563, 6565, 6984 ]  
stop_times: [  
[ -, -, -, -, -, 540a, 545a, 550a, 556a],  
[ -, -, 610a, -, 616a, 620a, 625a, 630a, 636a],  
[ 625a, 631a, 640a, -, 646a, 650a, 655a, 700a, 706a],  
[ 655a, 701a, 710a, -, 716a, 720a, 725a, 730a, 736a],  
[ 725a, 731a, 740a, -, 746a, 750a, 755a, 800a, 806a],  
[ 755a, 801a, 810a, -, 816a, 820a, 825a, 830a, 836a],  
[ 818a, 824a, 837a, -, 844a, 849a, 856a, 857a, 906a],  
[ 847a, 854a, 907a, -, 914a, 919a, 926a, 930a, 936a],  
[ 917a, 924a, 937a, -, 944a, 949a, 956a, 1000a, 1006a],  
[ 947a, 954a, 1007a, -, 1014a, 1019a, 1026a, 1030a, 1036a],  
[ 1017a, 1024a, 1037a, -, 1044a, 1049a, 1056a, 1100a, 1106a],  
[ 1047a, 1054a, 1107a, -, 1114a, 1119a, 1126a, 1130a, 1136a],  
[ 1117a, 1124a, 1137a, -, 1144a, 1149a, 1156a, 1200p, 1206p],  
[ 1147a, 1154a, 1207p, -, 1214p, 1219p, 1226p, 1230p, 1236p],  
[ 1217p, 1224p, 1237p, -, 1244p, 1249p, 1256p, 100p, 106p],  
[ 1247p, 1254p, 107p, -, 114p, 119p, 126p, 130p, 136p],  
[ 117p, 124p, 137p, -, 144p, 149p, 156p, 200p, 206p],  
[ 146p, 153p, 206p, -, 213p, 218p, 225p, 229p, 236p],  
[ 216p, 223p, 237p, -, 244p, 249p, 256p, 300p, 306p],  
[ 246p, 253p, 307p, -, 314p, 319p, 326p, 330p, 336p],  
[ 314p, 322p, 337p, -, 344p, 349p, 356p, 400p, 406p],  
[ 344p, 352p, 407p, -, 414p, 419p, 426p, 430p, 436p],  
[ 414p, 422p, 437p, -, 444p, 449p, 456p, 500p, 506p],  
[ 444p, 452p, 507p, -, 514p, 519p, 526p, 530p, 536p],  
[ 514p, 522p, 537p, -, 544p, 549p, 556p, 600p, 606p],  
[ 553p, 601p, 610p, -, 616p, 620p, 625p, 630p, 636p],  
[ 653p, 700p, 710p, -, 716p, 720p, 725p, 729p, 736p],  
[ 753p, 800p, 810p, -, 816p, 820p, 825p, 829p, 836p],  
[ 854p, 901p, 910p, -, 916p, 920p, 925p, 930p, 936p],  
[ 954p, 1001p, 1010p, 1011p, 1016p, 1020p, 1025p, 1030p, 1036p],  
[ 1054p, 1101p, 1110p, 1111p, 1116p, 1120p, 1125p, 1130p, 1136p],  
[ 1154p, 1201x, 1210x, 1211x, 1216x, 1220x, 1225x, 1230x, 1236x]  
]  
stop_times_saturday: [  
[ -, -, 607a, -, 613a, 617a, 622a, 625a, 631a],  
[ 652a, 658a, 707a, -, 713a, 717a, 722a, 725a, 731a],  
[ 752a, 758a, 807a, -, 813a, 817a, 822a, 825a, 831a],  
[ 852a, 858a, 907a, -, 914a, 918a, 923a, 926a, 932a],  
[ 944a, 950a, 1004a, -, 1010a, 1015a, 1021a, 1024a, 1030a],  
[ 1014a, 1020a, 1034a, -, 1040a, 1045a, 1051a, 1054a, 1100a],  
[ 1044a, 1050a, 1104a, -, 1110a, 1115a, 1121a, 1124a, 1130a],  
[ 1114a, 1120a, 1134a, -, 1140a, 1145a, 1151a, 1154a, 1200p],  
[ 1144a, 1150a, 1204p, -, 1210p, 1215p, 1221p, 1224p, 1230p],  
[ 1214p, 1220p, 1234p, -, 1240p, 1245p, 1251p, 1254p, 100p],  
[ 1244p, 1250p, 104p, -, 110p, 115p, 121p, 124p, 130p],  
[ 114p, 120p, 134p, -, 140p, 145p, 151p, 154p, 200p],  
[ 144p, 150p, 204p, -, 210p, 215p, 221p, 224p, 230p],  
[ 214p, 220p, 234p, -, 240p, 245p, 251p, 254p, 300p],  
[ 244p, 250p, 304p, -, 310p, 315p, 321p, 324p, 330p],  
[ 314p, 320p, 334p, -, 340p, 345p, 351p, 354p, 400p],  
[ 344p, 350p, 404p, -, 410p, 415p, 421p, 424p, 430p],  
[ 414p, 420p, 434p, -, 440p, 445p, 451p, 454p, 500p],  
[ 444p, 450p, 504p, -, 510p, 515p, 521p, 524p, 530p],  
[ 514p, 520p, 534p, -, 540p, 545p, 551p, 554p, 600p],  
[ 553p, 559p, 608p, -, 614p, 617p, 622p, 625p, 631p],  
[ 658p, 704p, 713p, -, 719p, 722p, 727p, 730p, 736p],  
[ 758p, 804p, 813p, -, 819p, 822p, 827p, 830p, 836p],  
[ 858p, 904p, 913p, -, 919p, 921p, 927p, 930p, 936p],  
[ 958p, 1004p, 1013p, 1014p, 1018p, 1021p, 1026p, 1029p, 1035p],  
[ 1058p, 1104p, 1113p, 1114p, 1118p, 1121p, 1126p, 1129p, 1135p],  
[ 1158p, 1204x, 1213x, 1214x, 1218x, 1221x, 1226x, 1229x, 1235x]  
]  
stop_times_sunday: [  
[ 700a, 705a, 715a, -, 722a, 725a, 730a, 733a, 740a],  
[ 800a, 805a, 815a, -, 822a, 825a, 830a, 833a, 840a],  
[ 900a, 905a, 915a, -, 922a, 925a, 930a, 933a, 940a],  
[ 1000a, 1005a, 1015a, -, 1022a, 1025a, 1030a, 1033a, 1040a],  
[ 1100a, 1105a, 1115a, -, 1122a, 1125a, 1130a, 1133a, 1140a],  
[ 1200p, 1205p, 1215p, -, 1222p, 1225p, 1230p, 1233p, 1240p],  
[ 100p, 105p, 115p, -, 122p, 125p, 130p, 133p, 140p],  
[ 200p, 205p, 215p, -, 222p, 225p, 230p, 233p, 240p],  
[ 300p, 305p, 315p, -, 322p, 325p, 330p, 333p, 340p],  
[ 400p, 405p, 415p, -, 422p, 425p, 430p, 433p, 440p],  
[ 500p, 505p, 515p, -, 522p, 525p, 530p, 533p, 540p],  
[ 600p, 605p, 615p, -, 622p, 625p, 630p, 633p, 640p],  
[ 700p, 705p, 715p, -, 722p, 725p, 730p, 733p, 740p],  
[ 800p, 805p, 815p, -, 822p, 825p, 830p, 833p, 840p],  
[ 900p, 905p, 915p, -, 922p, 925p, 930p, 933p, 940p],  
[ 1000p, 1005p, 1015p, 1016p, 1022p, 1025p, 1030p, 1033p, 1040p],  
[ 1100p, 1105p, 1115p, 1116p, 1122p, 1125p, 1130p, 1133p, 1140p]  
]  
 
short_name: 20  
long_name: To Herring Cove  
time_points: [ 8414, 6568, 6105, 8151, 8643, 6797, 6851, 7121 ]  
between_stops:  
8151-8643: [ 8138, 8148, 8137, 8134, 8146, 6413, 6414, 7275 ]  
stop_times: [  
[ -, -, -, -, 510a, 527a, 532a, 539a],  
[ -, -, -, -, 530a, 547a, 552a, 559a],  
[ -, -, -, -, 600a, 617a, 622a, 629a],  
[ 607a, -, 610a, 619a, 635a, 652a, 657a, 704a],  
[ 637a, -, 640a, 649a, 705a, 722a, 727a, 734a],  
[ 707a, -, 710a, 719a, 735a, 752a, 757a, 804a],  
[ 737a, -, 740a, 749a, 805a, 822a, 827a, 834a],  
[ 805a, -, 808a, 817a, 833a, 850a, 855a, 902a],  
[ 837a, -, 840a, 849a, 905a, 922a, 927a, 934a],  
[ 907a, -, 910a, 919a, 935a, 952a, 957a, 1004a],  
[ 937a, -, 940a, 949a, 1005a, 1022a, 1027a, 1034a],  
[ 1007a, -, 1010a, 1019a, 1035a, 1052a, 1057a, 1104a],  
[ 1037a, -, 1040a, 1049a, 1105a, 1122a, 1127a, 1134a],  
[ 1107a, -, 1110a, 1119a, 1135a, 1152a, 1157a, 1204p],  
[ 1137a, -, 1140a, 1149a, 1205p, 1222p, 1227p, 1234p],  
[ 1205p, -, 1208p, 1217p, 1233p, 1250p, 1255p, 102p],  
[ 1237p, -, 1240p, 1249p, 105p, 122p, 127p, 134p],  
[ 107p, -, 110p, 119p, 135p, 152p, 157p, 204p],  
[ 137p, -, 140p, 149p, 205p, 222p, 227p, 234p],  
[ 207p, -, 210p, 219p, 235p, 252p, 257p, 304p],  
[ 237p, -, 240p, 249p, 305p, 322p, 327p, 334p],  
[ 257p, -, 300p, 309p, 325p, 342p, 347p, 354p],  
[ 317p, -, 320p, 329p, 345p, 402p, 407p, 414p],  
[ 332p, 336p, 341p, 350p, 406p, 423p, 428p, 435p],  
[ 357p, -, 400p, 409p, 425p, 442p, 447p, 454p],  
[ 412p, 416p, 421p, 430p, 446p, 503p, 508p, 515p],  
[ 437p, -, 440p, 449p, 505p, 522p, 527p, 534p],  
[ 507p, -, 510p, 519p, 535p, 552p, 557p, 604p],  
[ 537p, -, 540p, 549p, 605p, 622p, 627p, 634p],  
[ 607p, -, 610p, 619p, 635p, 652p, 657p, 704p],  
[ 642p, -, 645p, 654p, 710p, 727p, 732p, 739p],  
[ 712p, -, 715p, 724p, 740p, 756p, 801p, 808p],  
[ 742p, -, 745p, 754p, 810p, 826p, 831p, 838p],  
[ 812p, -, 815p, 824p, 840p, 856p, 901p, 908p],  
[ 842p, -, 845p, 854p, 910p, 926p, 931p, 938p],  
[ 912p, -, 915p, 924p, 940p, 956p, 1001p, 1008p],  
[ 942p, -, 945p, 954p, 1010p, 1026p, 1031p, 1038p],  
[ 1012p, -, 1015p, 1024p, 1040p, 1056p, 1101p, 1108p],  
[ 1042p, -, 1045p, 1054p, 1110p, 1126p, 1131p, 1138p],  
[ 1112p, -, 1115p, 1124p, 1140p, 1156p, 1201x, 1208x]]  
stop_times_saturday: [  
[ -, -, -, -, 530a, 545a, 550a, 600a],  
[ -, -, -, -, 635a, 650a, 655a, 705a],  
[ -, -, -, -, 705a, 720a, 725a, 735a],  
[ -, -, -, -, 735a, 750a, 755a, 805a],  
[ -, -, -, -, 805a, 820a, 825a, 835a],  
[ -, -, -, -, 835a, 850a, 855a, 905a],  
[ -, -, -, -, 905a, 920a, 925a, 935a],  
[ -, -, -, -, 935a, 950a, 955a, 1005a],  
[ -, -, -, -, 1005a, 1020a, 1025a, 1035a],  
[ -, -, -, -, 1035a, 1050a, 1055a, 1105a],  
[ -, -, -, -, 1105a, 1120a, 1125a, 1135a],  
[ -, -, -, -, 1135a, 1150a, 1155a, 1205p],  
[ -, -, -, -, 1205p, 1220p, 1225p, 1235p],  
[ -, -, -, -, 1235p, 1250p, 1255p, 105p],  
[ -, -, -, -, 105p, 120p, 125p, 135p],  
[ -, -, -, -, 135p, 150p, 155p, 205p],  
[ -, -, -, -, 205p, 220p, 225p, 235p],  
[ -, -, -, -, 235p, 250p, 255p, 305p],  
[ -, -, -, -, 305p, 320p, 325p, 335p],  
[ -, -, -, -, 335p, 350p, 355p, 405p],  
[ -, -, -, -, 405p, 420p, 425p, 435p],  
[ -, -, -, -, 435p, 450p, 455p, 505p],  
[ -, -, -, -, 505p, 520p, 525p, 535p],  
[ -, -, -, -, 535p, 550p, 555p, 605p],  
[ -, -, -, -, 605p, 620p, 625p, 635p],  
[ -, -, -, -, 635p, 650p, 655p, 705p],  
[ -, -, -, -, 710p, 725p, 730p, 740p],  
[ -, -, -, -, 740p, 755p, 800p, 810p],  
[ -, -, -, -, 810p, 825p, 830p, 840p],  
[ -, -, -, -, 840p, 855p, 900p, 910p],  
[ -, -, -, -, 910p, 925p, 930p, 940p],  
[ -, -, -, -, 940p, 955p, 1000p, 1010p],  
[ -, -, -, -, 1040p, 1055p, 1100p, 1110p],  
[ -, -, -, -, 1140p, 1155p, 1200x, 1210x]  
]  
stop_times_sunday: [  
[ -, -, -, -, 635a, 652a, 657a, 705a],  
[ -, -, -, -, 735a, 752a, 757a, 805a],  
[ -, -, -, -, 835a, 852a, 857a, 905a],  
[ -, -, -, -, 905a, 922a, 927a, 935a],  
[ -, -, -, -, 935a, 952a, 957a, 1005a],  
[ -, -, -, -, 1005a, 1022a, 1027a, 1035a],  
[ -, -, -, -, 1035a, 1052a, 1057a, 1105a],  
[ -, -, -, -, 1105a, 1122a, 1127a, 1135a],  
[ -, -, -, -, 1135a, 1152a, 1157a, 1205p],  
[ -, -, -, -, 1205p, 1222p, 1227p, 1235p],  
[ -, -, -, -, 1235p, 1252p, 1257p, 105p],  
[ -, -, -, -, 105p, 122p, 127p, 135p],  
[ -, -, -, -, 135p, 152p, 157p, 205p],  
[ -, -, -, -, 205p, 222p, 227p, 235p],  
[ -, -, -, -, 235p, 252p, 257p, 305p],  
[ -, -, -, -, 305p, 322p, 327p, 335p],  
[ -, -, -, -, 335p, 352p, 357p, 405p],  
[ -, -, -, -, 405p, 422p, 427p, 435p],  
[ -, -, -, -, 435p, 452p, 457p, 505p],  
[ -, -, -, -, 505p, 522p, 527p, 535p],  
[ -, -, -, -, 535p, 552p, 557p, 605p],  
[ -, -, -, -, 605p, 622p, 627p, 635p],  
[ -, -, -, -, 635p, 652p, 657p, 705p],  
[ -, -, -, -, 735p, 752p, 757p, 805p],  
[ -, -, -, -, 835p, 852p, 857p, 905p],  
[ -, -, -, -, 935p, 952p, 957p, 1005p],  
[ -, -, -, -, 1035p, 1052p, 1057p, 1105p],  
[ -, -, -, -, 1135p, 1152p, 1157p, 1205x]  
]  
 
short_name: 20  
long_name: To Mumford / Downtown  
time_points: [ 7121, 6859, 6800, 7284, 8150, 6087, 8414, 6572 ]  
between_stops:  
7284-8150: [ 7274, 6409, 6403, 6407, 8135, 8133, 8136, 8147, 8149 ]  
stop_times: [  
[ 540a, 547a, 552a, 610a, 618a, 630a, 632a, -],  
[ 600a, 607a, 612a, 630a, 638a, 650a, 652a, -],  
[ -, 622a, 627a, 645a, 653a, 705a, 707a, -],  
[ 630a, 637a, 642a, 700a, 708a, 720a, 722a, 725a],  
[ -, 652a, 657a, 715a, 723a, 735a, 737a, -],  
[ 705a, 712a, 717a, 735a, 743a, 755a, 757a, -],  
[ -, 727a, 732a, 750a, 758a, 810a, 812a, -],  
[ 735a, 742a, 747a, 805a, 813a, 825a, 827a, -],  
[ -, 757a, 802a, 820a, 828a, 840a, 842a, -],  
[ 805a, 812a, 817a, 835a, 843a, 855a, 857a, -],  
[ -, 825a, 830a, 848a, 856a, 908a, 910a, -],  
[ 835a, 842a, 847a, 905a, 913a, 925a, 927a, -],  
[ -, 857a, 902a, 920a, 928a, 940a, 942a, -],  
[ 905a, 912a, 917a, 935a, 943a, 955a, 957a, -],  
[ 935a, 942a, 947a, 1005a, 1013a, 1025a, 1027a, -],  
[ 1005a, 1012a, 1017a, 1035a, 1043a, 1055a, 1057a, -],  
[ 1035a, 1042a, 1047a, 1105a, 1113a, 1125a, 1127a, -],  
[ 1105a, 1112a, 1117a, 1135a, 1143a, 1155a, 1157a, -],  
[ 1135a, 1142a, 1147a, 1205p, 1213p, 1225p, 1227p, -],  
[ 1205p, 1212p, 1217p, 1235p, 1243p, 1255p, 1257p, -],  
[ 1235p, 1242p, 1247p, 105p, 113p, 125p, 127p, -],  
[ 104p, 111p, 116p, 134p, 142p, 154p, 156p, -],  
[ 135p, 142p, 147p, 205p, 213p, 225p, 227p, -],  
[ 205p, 212p, 217p, 235p, 243p, 255p, 257p, -],  
[ 235p, 242p, 247p, 305p, 313p, 325p, 327p, -],  
[ 305p, 312p, 317p, 335p, 343p, 355p, 357p, -],  
[ 335p, 342p, 347p, 405p, 413p, 425p, 427p, -],  
[ 355p, 402p, 407p, 425p, 433p, 445p, 447p, -],  
[ 415p, 422p, 427p, 445p, 453p, 505p, 507p, -],  
[ 435p, 442p, 447p, 505p, 513p, 525p, 527p, -],  
[ 455p, 502p, 507p, 525p, 533p, 545p, 547p, -],  
[ 515p, 522p, 527p, 545p, 553p, 605p, 607p, -],  
[ 535p, 542p, 547p, 605p, 613p, 625p, 627p, -],  
[ 605p, 612p, 617p, 635p, 643p, 655p, 657p, -],  
[ 635p, 642p, 647p, 705p, 713p, 725p, 727p, -],  
[ 705p, 711p, 716p, 733p, 741p, 753p, 755p, -],  
[ 740p, 746p, 751p, 808p, 816p, 828p, 830p, -],  
[ 809p, 815p, 820p, 837p, 845p, 857p, 859p, -],  
[ 839p, 845p, 850p, 907p, 915p, 927p, 929p, -],  
[ 909p, 915p, 920p, 937p, 945p, 957p, 959p, -],  
[ 939p, 945p, 950p, 1007p, 1015p, 1027p, 1029p, -],  
[ 1009p, 1015p, 1020p, 1037p, 1045p, 1057p, 1059p, -],  
[ 1039p, 1045p, 1050p, 1107p, 1115p, 1127p, 1129p, -],  
[ 1109p, 1115p, 1120p, 1137p, 1145p, 1157p, 1159p, -],  
[ 1139p, 1145p, 1150p, 1207x, 1215x, 1227x, 1229x, -],  
[ 1209x, 1215x, 1220x, 1237x, -, -, -, -]  
]  
stop_times_saturday: [  
[ 600a, 605a, 610a, 627a, -, -, -, -],  
[ 705a, 710a, 715a, 732a, -, -, -, -],  
[ 735a, 740a, 745a, 802a, -, -, -, -],  
[ 805a, 810a, 815a, 832a, -, -, -, -],  
[ 835a, 840a, 845a, 902a, -, -, -, -],  
[ 905a, 910a, 915a, 932a, -, -, -, -],  
[ 935a, 940a, 945a, 1002a, -, -, -, -],  
[ 1005a, 1010a, 1015a, 1032a, -, -, -, -],  
[ 1035a, 1040a, 1045a, 1102a, -, -, -, -],  
[ 1105a, 1110a, 1115a, 1132a, -, -, -, -],  
[ 1135a, 1140a, 1145a, 1202p, -, -, -, -],  
[ 1205p, 1210p, 1215p, 1232p, -, -, -, -],  
[ 1235p, 1240p, 1245p, 102p, -, -, -, -],  
[ 105p, 110p, 115p, 132p, -, -, -, -],  
[ 135p, 140p, 145p, 202p, -, -, -, -],  
[ 205p, 210p, 215p, 232p, -, -, -, -],  
[ 235p, 240p, 245p, 302p, -, -, -, -],  
[ 305p, 310p, 315p, 332p, -, -, -, -],  
[ 335p, 340p, 345p, 402p, -, -, -, -],  
[ 405p, 410p, 415p, 432p, -, -, -, -],  
[ 435p, 440p, 445p, 502p, -, -, -, -],  
[ 505p, 510p, 515p, 532p, -, -, -, -],  
[ 535p, 540p, 545p, 602p, -, -, -, -],  
[ 605p, 610p, 615p, 632p, -, -, -, -],  
[ 635p, 640p, 645p, 702p, -, -, -, -],  
[ 705p, 710p, 715p, 732p, -, -, -, -],  
[ 740p, 745p, 750p, 807p, -, -, -, -],  
[ 810p, 815p, 820p, 837p, -, -, -, -],  
[ 840p, 845p, 850p, 907p, -, -, -, -],  
[ 910p, 915p, 920p, 937p, -, -, -, -],  
[ 940p, 945p, 950p, 1007p, -, -, -, -],  
[ 1010p, 1015p, 1020p, 1037p, -, -, -, -],  
[ 1110p, 1115p, 1120p, 1137p, -, -, -, -],  
[ 1210x, 1215x, 1220x, 1237x, -, -, -, -]  
]  
stop_times_sunday: [  
[ 705a, 710a, 715a, 730a, -, -, -, -],  
[ 805a, 810a, 815a, 830a, -, -, -, -],  
[ 905a, 910a, 915a, 930a, -, -, -, -],  
[ 935a, 940a, 945a, 1000a, -, -, -, -],  
[ 1005a, 1010a, 1015a, 1030a, -, -, -, -],  
[ 1035a, 1040a, 1045a, 1100a, -, -, -, -],  
[ 1105a, 1110a, 1115a, 1130a, -, -, -, -],  
[ 1135a, 1140a, 1145a, 1200p, -, -, -, -],  
[ 1205p, 1210p, 1215p, 1230p, -, -, -, -],  
[ 1235p, 1240p, 1245p, 100p, -, -, -, -],  
[ 105p, 110p, 115p, 130p, -, -, -, -],  
[ 135p, 140p, 145p, 200p, -, -, -, -],  
[ 205p, 210p, 215p, 230p, -, -, -, -],  
[ 235p, 240p, 245p, 300p, -, -, -, -],  
[ 305p, 310p, 315p, 330p, -, -, -, -],  
[ 335p, 340p, 345p, 400p, -, -, -, -],  
[ 405p, 410p, 415p, 430p, -, -, -, -],  
[ 435p, 440p, 445p, 500p, -, -, -, -],  
[ 505p, 510p, 515p, 530p, -, -, -, -],  
[ 535p, 540p, 545p, 600p, -, -, -, -],  
[ 605p, 610p, 615p, 630p, -, -, -, -],  
[ 635p, 640p, 645p, 700p, -, -, -, -],  
[ 705p, 710p, 715p, 730p, -, -, -, -],  
[ 805p, 810p, 815p, 830p, -, -, -, -],  
[ 905p, 910p, 915p, 930p, -, -, -, -],  
[ 1005p, 1010p, 1015p, 1030p, -, -, -, -],  
[ 1105p, 1110p, 1115p, 1130p, -, -, -, -],  
[ 1205x, 1210x, 1215x, 1230x, -, -, -, -]  
]  
 
short_name: 21  
long_name: To Lacewood / Halifax  
time_points: [ 6317, 6189, 7087, 8364 ]  
# FIXME: should start at 6722, 5 minutes before  
between_stops:  
7087-8364: [ 6983, 8631, 6783, 6776, 6777, 6781, 6774, 6780, 6786, 6790, 6771, 6084, 6103, 6122, 8331, 8330, 8334, 8335 ]  
stop_times: [  
[ 550a, 602a, 615a, 651a],  
[ 625a, 637a, 650a, 726a],  
[ 655a, 707a, 720a, 756a],  
[ 730a, 742a, 755a, 831a],  
[ 755a, 807a, 820a, 856a],  
[ 825a, 837a, 850a, -],  
[ 855a, 907a, 920a, -],  
[ 925a, 937a, 950a, -],  
[ 955a, 1007a, 1020a, -],  
[ 1025a, 1037a, 1050a, -],  
[ 1055a, 1107a, 1120a, -],  
[ 1125a, 1137a, 1150a, -],  
[ 1155a, 1207p, 1220p, -],  
[ 1229p, 1241p, 1254p, -],  
[ 103p, 111p, 123p, -],  
[ 133p, 141p, 153p, -],  
[ 203p, 211p, 223p, -],  
[ 233p, 241p, 253p, -],  
[ 303p, 311p, 323p, -],  
[ 333p, 341p, 353p, -],  
[ 403p, 411p, 423p, -],  
[ 443p, 451p, 503p, -],  
[ 513p, 521p, 533p, -],  
[ 543p, 551p, 603p, -],  
[ 613p, 621p, 633p, -],  
[ 643p, 651p, 703p, -],  
[ 713p, 721p, 733p, -],  
[ 737p, 745p, 757p, -],  
[ 803p, 811p, 823p, -],  
[ 833p, 841p, 853p, -],  
[ 903p, 911p, 923p, -],  
[ 933p, 941p, 953p, -],  
[ 1003p, 1011p, 1023p, -],  
[ 1033p, 1041p, 1053p, -],  
[ 1103p, 1111p, 1123p, -],  
[ 1133p, 1141p, 1153p, -],  
[ 1203a, 1211x, 1223x, -],  
[ 1233a, 1241x, 1253x, -]  
]  
stop_times_saturday: [  
[ 625a, 633a, 645a, -],  
[ 655a, 703a, 715a, -],  
[ 725a, 733a, 745a, -],  
[ 755a, 803a, 815a, -],  
[ 825a, 833a, 845a, -],  
[ 855a, 903a, 915a, -],  
[ 925a, 933a, 945a, -],  
[ 955a, 1003a, 1015a, -],  
[ 1025a, 1033a, 1045a, -],  
[ 1055a, 1103a, 1115a, -],  
[ 1125a, 1133a, 1145a, -],  
[ 1155a, 1203p, 1215p, -],  
[ 1225p, 1233p, 1245p, -],  
[ 1255p, 103p, 115p, -],  
[ 125p, 133p, 145p, -],  
[ 155p, 203p, 215p, -],  
[ 225p, 233p, 245p, -],  
[ 255p, 303p, 315p, -],  
[ 325p, 333p, 345p, -],  
[ 355p, 403p, 415p, -],  
[ 425p, 433p, 445p, -],  
[ 455p, 503p, 515p, -],  
[ 525p, 533p, 545p, -],  
[ 555p, 603p, 615p, -],  
[ 625p, 633p, 645p, -],  
[ 655p, 703p, 715p, -],  
[ 725p, 733p, 745p, -],  
[ 800p, 808p, 820p, -],  
[ 830p, 838p, 850p, -],  
[ 900p, 908p, 920p, -],  
[ 930p, 938p, 950p, -],  
[ 1000p, 1008p, 1020p, -],  
[ 1030p, 1038p, 1050p, -],  
[ 1100p, 1108p, 1120p, -],  
[ 1130p, 1138p, 1150p, -],  
[ 1200x, 1208x, 1220x, -],  
[ 1230x, 1238x, 1250x, -]  
]  
stop_times_sunday: [  
[ 645a, 653a, 705a, -],  
[ 745a, 753a, 805a, -],  
[ 845a, 853a, 905a, -],  
[ 945a, 953a, 1005a, -],  
[ 1045a, 1053a, 1105a, -],  
[ 1145a, 1153a, 1205p, -],  
[ 1245p, 1253p, 105p, -],  
[ 145p, 153p, 205p, -],  
[ 245p, 253p, 305p, -],  
[ 345p, 353p, 405p, -],  
[ 445p, 453p, 505p, -],  
[ 545p, 553p, 605p, -],  
[ 645p, 653p, 705p, -],  
[ 745p, 753p, 805p, -],  
[ 845p, 853p, 905p, -],  
[ 945p, 953p, 1005p, -],  
[ 1045p, 1053p, 1105p, -],  
[ 1145p, 1153p, 1205x, -]  
]  
 
short_name: 21  
long_name: To Timberlea  
time_points: [ 8363, 7086, 6160, 6315, 6722 ]  
between_stops:  
8363-7086: [ 8337, 8333, 8336, 8327, 8338, 6121, 6086, 6106, 6455, 6773, 6778, 6779, 6775, 6787, 6769, 6785, 6768, 6782, 8632, 8192 ]  
stop_times: [  
[ -, 525a, 531a, 540a, 545a],  
[ -, 600a, 606a, 615a, 620a],  
[ -, 627a, 633a, 642a, 650a],  
[ -, 705a, 711a, 720a, 725a],  
[ -, 727a, 733a, 742a, 750a],  
[ -, 800a, 806a, 815a, 820a],  
[ -, 830a, 836a, 845a, 850a],  
[ -, 900a, 906a, 915a, 920a],  
[ -, 930a, 936a, 945a, 950a],  
[ -, 1000a, 1006a, 1015a, 1020a],  
[ -, 1030a, 1036a, 1045a, 1050a],  
[ -, 1100a, 1106a, 1115a, 1120a],  
[ -, 1130a, 1136a, 1145a, 1150a],  
[ -, 1200p, 1206p, 1215p, 1224p],  
[ -, 1230p, 1236p, 1245p, 1254p],  
[ -, 100p, 106p, 115p, 124p],  
[ -, 130p, 136p, 145p, 154p],  
[ -, 200p, 206p, 215p, 224p],  
[ -, 230p, 236p, 245p, 254p],  
[ -, 300p, 308p, 321p, 328p],  
[ -, 330p, 338p, 351p, 358p],  
[ 331p, 410p, 418p, 431p, 438p],  
[ 401p, 440p, 448p, 501p, 508p],  
[ 431p, 510p, 518p, 531p, 538p],  
[ 501p, 540p, 548p, 601p, 608p],  
[ 531p, 610p, 618p, 631p, 638p],  
[ 601p, 640p, 648p, 701p, 708p],  
[ -, 705p, 713p, 726p, 732p],  
[ -, 735p, 743p, 753p, 758p],  
[ -, 805p, 813p, 823p, 828p],  
[ -, 835p, 843p, 853p, 858p],  
[ -, 905p, 913p, 923p, 928p],  
[ -, 935p, 943p, 953p, 958p],  
[ -, 1005p, 1013p, 1023p, 1028p],  
[ -, 1035p, 1043p, 1053p, 1058p],  
[ -, 1105p, 1113p, 1123p, 1128p],  
[ -, 1135p, 1143p, 1153p, 1158p],  
[ -, 1205x, 1213x, 1223x, 1228x]  
]  
stop_times_saturday: [  
[ -, 555a, 602a, 615a, 620a],  
[ -, 625a, 632a, 645a, 650a],  
[ -, 655a, 702a, 715a, 720a],  
[ -, 725a, 732a, 745a, 750a],  
[ -, 755a, 802a, 815a, 820a],  
[ -, 825a, 832a, 845a, 850a],  
[ -, 855a, 902a, 915a, 920a],  
[ -, 925a, 932a, 945a, 950a],  
[ -, 955a, 1002a, 1015a, 1020a],  
[ -, 1025a, 1032a, 1045a, 1050a],  
[ -, 1055a, 1102a, 1115a, 1120a],  
[ -, 1055a, 1102a, 1115a, 1120a],  
[ -, 1125a, 1132a, 1145a, 1150a],  
[ -, 1155a, 1202p, 1215p, 1220p],  
[ -, 1225p, 1232p, 1245p, 1250p],  
[ -, 1255p, 102p, 115p, 120p],  
[ -, 125p, 132p, 145p, 150p],  
[ -, 155p, 202p, 215p, 220p],  
[ -, 225p, 232p, 245p, 250p],  
[ -, 255p, 302p, 315p, 320p],  
[ -, 325p, 332p, 345p, 350p],  
[ -, 355p, 402p, 415p, 420p],  
[ -, 425p, 432p, 445p, 450p],  
[ -, 455p, 502p, 515p, 520p],  
[ -, 525p, 532p, 545p, 550p],  
[ -, 555p, 602p, 615p, 620p],  
[ -, 625p, 632p, 645p, 650p],  
[ -, 655p, 702p, 715p, 720p],  
[ -, 730p, 737p, 750p, 755p],  
[ -, 800p, 807p, 820p, 825p],  
[ -, 830p, 837p, 850p, 855p],  
[ -, 900p, 907p, 920p, 925p],  
[ -, 930p, 937p, 950p, 955p],  
[ -, 1000p, 1007p, 1020p, 1025p],  
[ -, 1030p, 1037p, 1050p, 1055p],  
[ -, 1100p, 1107p, 1120p, 1125p],  
[ -, 1130p, 1137p, 1150p, 1155p],  
[ -, 1200x, 1207x, 1220x, 1225x]  
]  
stop_times_sunday: [  
[ -, 615a, 622a, 635a, 640a],  
[ -, 715a, 722a, 735a, 740a],  
[ -, 815a, 822a, 835a, 840a],  
[ -, 915a, 922a, 935a, 940a],  
[ -, 1015a, 1022a, 1035a, 1040a],  
[ -, 1115a, 1122a, 1135a, 1140a],  
[ -, 1115a, 1122a, 1135a, 1140a],  
[ -, 1215p, 1222p, 1235p, 1240p],  
[ -, 115p, 122p, 135p, 140p],  
[ -, 215p, 222p, 235p, 240p],  
[ -, 315p, 322p, 335p, 340p],  
[ -, 415p, 422p, 435p, 440p],  
[ -, 515p, 522p, 535p, 540p],  
[ -, 615p, 622p, 635p, 640p],  
[ -, 715p, 722p, 735p, 740p],  
[ -, 815p, 822p, 835p, 840p],  
[ -, 915p, 922p, 935p, 940p],  
[ -, 1115p, 1122p, 1135p, 1140p]  
]  
 
short_name: 23  
long_name: To Mumford / Halifax  
time_points: [ 6722, 6317, 6189, 7284, 8414 ]  
between_stops:  
6189-7284: [ 7276 ]  
7284-8414: [ 7274, 6409, 6403, 6407, 6406, 6545, 8205, 8337, 8333, 8336, 8327, 8338, 6087 ]  
stop_times: [  
[ 605a, 610a, 617a, 632a, 656a],  
[ 635a, 640a, 647a, 703a, 729a],  
[ 705a, 710a, 717a, 737a, 803a],  
[ 735a, 740a, 747a, 807a, 833a],  
[ 805a, 810a, 817a, 837a, 903a],  
[ 835a, 840a, 847a, 907a, 933a],  
[ 447p, 452p, 459p, 514p, -],  
[ 517p, 522p, 529p, 544p, -],  
[ 547p, 552p, 559p, 614p, -],  
[ 617p, 622p, 629p, 644p, -],  
[ 645p, 650p, 657p, 712p, -],  
[ 714p, 719p, 726p, 741p, -]  
]  
 
short_name: 23  
long_name: To Timberlea  
time_points: [ 8414, 8643, 6160, 6315, 6722 ]  
between_stops:  
8414-8643: [ 6125, 6105, 6108, 6103, 6122, 8331, 8330, 8334, 8335, 8184, 8206, 6544, 6405, 6404, 6413, 6414, 7275 ]  
8643-6160: [ 7273 ]  
 
stop_times: [  
[ -, 533a, 548a, 554a, 600a],  
[ -, 603a, 618a, 624a, 630a],  
[ -, 633a, 648a, 654a, 700a],  
[ -, 703a, 718a, 724a, 730a],  
[ -, 733a, 748a, 754a, 800a],  
[ -, 803a, 818a, 824a, 830a],  
[ 346p, 417p, 432p, 438p, 444p],  
[ 416p, 447p, 502p, 508p, 514p],  
[ 446p, 517p, 532p, 538p, 544p],  
[ 516p, 547p, 602p, 608p, 614p],  
[ 546p, 614p, 629p, 635p, 641p],  
[ 616p, 644p, 659p, 705p, 711p]  
]  
 
short_name: 3  
long_name: To Manors  
time_points: [ 7284, 6563, 8164, 6505, 6105, 8334, 8430 ]  
between_stops:  
8164-6505: [ 7367, 7382, 7364, 6770, 6783, 6776, 6777, 6781, 6774, 6780, 6786 ]  
6105-8337: [ 6108, 6103, 6102, 6122, 8331, 8330, 8334 ]  
stop_times: [  
[ 957a, 1012a, 1026a, 1037a, 1040a, 1047a, 1055a],  
[ 1207p, 1222p, 1236p, 1247p, 1250p, 1257p, 105p],  
[ 217p, 232p, 246p, 257p, 300p, 307p, 315p],  
[ 247p, 302p, 316p, 327p, 330p, 337p, 345p]  
]  
 
short_name: 3  
long_name: To Shopping Malls  
time_points: [ 8430, 6791, 8337, 6087, 6505, 8165, 6564, 7284 ]  
between_stops:  
6791-8337: [ 8328 ]  
8337-6087: [ 8333, 8336, 8327, 8338 ]  
6505-8165: [ 6775, 6787, 6769, 6785, 6768, 6782, 7377, 7381, 7373, 7376, 7380 ]  
6564-7284: [ 6197, 6193 ]  
6087-6505: [ 6455, 6773, 6778 ]  
8165-6564: [ 6199, 6198, 6564, 6563, 6565, 6984 ]  
stop_times: [  
[ 855a, 858a, 904a, 913a, 916a, 927a, 941a, 950a],  
[ 1105a, 1108a, 1114a, 1123a, 1126a, 1137a, 1151a, 1200p],  
[ 115p, 118p, 124p, 133p, 136p, 147p, 201p, 210p],  
[ 145p, 148p, 154p, 203p, 206p, 217p, 231p, 240p],  
[ 317p, 320p, -, -, -, -, -, -],  
[ 347p, 350p, -, -, -, -, -, -]  
]  
 
short_name: 4  
long_name: To Downtown via North  
time_points: [ 6601, 7087, 6611, 6564, 7284, 7351, 6105, 8435 ]  
between_stops:  
7284-7351: [ 7274, 6409, 6403, 6407, 6406, 7355, 7345, 7357, 7352, 7342, 7354, 7347 ]  
7351-6105: [ 7343, 6088, 6104, 6125 ]  
6105-8435: [ 6108, 6733 ]  
stop_times: [  
[ 538a, 549a, 558a, 602a, 611a, 620a, 625a, 628a],  
[ 624a, 635a, 645a, 649a, 657a, 707a, 712a, 715a],  
[ 654a, 705a, 715a, 719a, 727a, 737a, 742a, 745a],  
[ 724a, 735a, 745a, 749a, 757a, 807a, 812a, 815a],  
[ 754a, 805a, 815a, 819a, 827a, 837a, 842a, 845a],  
[ 824a, 835a, 845a, 849a, 857a, 907a, 913a, 916a],  
[ 854a, 905a, 915a, 920a, 928a, 938a, 944a, 947a],  
[ 924a, 935a, 945a, 950a, 958a, 1008a, 1014a, 1017a],  
[ 954a, 1005a, 1015a, 1020a, 1028a, 1038a, 1044a, 1047a],  
[ 1024a, 1035a, 1045a, 1050a, 1058a, 1108a, 1114a, 1117a],  
[ 1054a, 1105a, 1115a, 1120a, 1128a, 1138a, 1144a, 1147a],  
[ 1124a, 1135a, 1145a, 1150a, 1158a, 1208p, 1214p, 1217p],  
[ 1154a, 1205p, 1215p, 1220p, 1228p, 1238p, 1244p, 1247p],  
[ 1224p, 1235p, 1245p, 1250p, 1258p, 108p, 114p, 117p],  
[ 1254p, 105p, 115p, 120p, 128p, 138p, 144p, 147p],  
[ 124p, 135p, 145p, 150p, 158p, 208p, 214p, 217p],  
[ 154p, 205p, 215p, 220p, 228p, 238p, 244p, 247p],  
[ 224p, 235p, 245p, 250p, 258p, 308p, 314p, 317p],  
[ 254p, 305p, 315p, 320p, 328p, 338p, 344p, 347p],  
[ 324p, 335p, 345p, 350p, 358p, 408p, 414p, 417p],  
[ 354p, 405p, 415p, 420p, 428p, 438p, 444p, 447p],  
[ 424p, 435p, 445p, 450p, 458p, 508p, 514p, 517p],  
[ 454p, 505p, 515p, 520p, 528p, 538p, 543p, 546p],  
[ 524p, 535p, 545p, 550p, 558p, 606p, 610p, 614p],  
[ 554p, 605p, 615p, 618p, 624p, 632p, 636p, 640p],  
[ 626p, 637p, 647p, 650p, 656p, 704p, 708p, 712p],  
[ 709p, 720p, 730p, 733p, 739p, 747p, 751p, 755p],  
[ 809p, 820p, 830p, 833p, 839p, 847p, 851p, 855p],  
[ 909p, 920p, 930p, 933p, 939p, 947p, 951p, 955p],  
[ 1009p, 1020p, 1030p, 1033p, 1039p, 1047p, 1051p, 1055p],  
[ 1109p, 1120p, 1130p, 1133p, 1139p, 1147p, 1151p, 1155p],  
[ 1209x, 1220x, -, -, -, -, -, -]  
]  
 
short_name: 4  
long_name: To Farnham Gate via Rosedale  
time_points: [ 8435, 7348, 7284, 6563, 6611, 7087, 6601 ]  
between_stops:  
8435-7348: [ 6089, 6116 ]  
7348-7284: [ 7346, 7341, 7353, 7358, 7344, 7356, 6405, 6404, 6413, 6414, 7275 ]  
6563-6611: [ 6565, 6984 ]  
stop_times: [  
[ -, -, -, -, 520a, 529a, 537a],  
[ -, -, -, -, 606a, 615a, 623a],  
[ 610a, 617a, 626a, 632a, 636a, 645a, 653a],  
[ 640a, 647a, 656a, 702a, 706a, 715a, 723a],  
[ 710a, 717a, 726a, 732a, 736a, 745a, 753a],  
[ 740a, 747a, 756a, 802a, 806a, 815a, 823a],  
[ 807a, 814a, 823a, 829a, 834a, 845a, 853a],  
[ 832a, 839a, 852a, 859a, 904a, 915a, 923a],  
[ 902a, 909a, 922a, 929a, 934a, 945a, 953a],  
[ 932a, 939a, 952a, 959a, 1004a, 1015a, 1023a],  
[ 1002a, 1009a, 1022a, 1029a, 1034a, 1045a, 1053a],  
[ 1032a, 1039a, 1052a, 1059a, 1104a, 1115a, 1123a],  
[ 1102a, 1109a, 1122a, 1129a, 1134a, 1145a, 1153a],  
[ 1132a, 1139a, 1152a, 1159a, 1204p, 1215p, 1223p],  
[ 1202p, 1209p, 1222p, 1229p, 1234p, 1245p, 1253p],  
[ 1232p, 1239p, 1252p, 1259p, 104p, 115p, 123p],  
[ 102p, 109p, 122p, 129p, 134p, 145p, 153p],  
[ 132p, 139p, 152p, 159p, 204p, 215p, 223p],  
[ 201p, 208p, 222p, 229p, 234p, 245p, 253p],  
[ 231p, 238p, 252p, 259p, 304p, 315p, 323p],  
[ 300p, 307p, 322p, 329p, 334p, 344p, 353p],  
[ 329p, 337p, 352p, 359p, 404p, 415p, 423p],  
[ 359p, 407p, 422p, 429p, 434p, 445p, 453p],  
[ 429p, 437p, 452p, 459p, 504p, 515p, 523p],  
[ 459p, 507p, 522p, 529p, 534p, 545p, 553p],  
[ 533p, 540p, 554p, 600p, 605p, 617p, 625p],  
[ 624p, 631p, 640p, 646p, 650p, 700p, 708p],  
[ 724p, 731p, 740p, 746p, 750p, 800p, 808p],  
[ 824p, 831p, 840p, 846p, 850p, 900p, 908p],  
[ 924p, 931p, 940p, 946p, 950p, 1000p, 1008p],  
[ 1024p, 1031p, 1040p, 1046p, 1050p, 1100p, 1108p],  
[ 1124p, 1131p, 1140p, 1146p, 1150p, 1200x, 1208x]  
]  
 
short_name: 41  
long_name: To Bridge Terminal  
time_points: [ 7144, 6096, 6087, 8642 ]  
between_stops:  
7144-6096: [ 8296, 8303, 8305, 8295, 8299, 8293 ]  
6096-6087: [ 6113, 6124, 6121, 6106 ]  
6087-8642: [ 6455, 6773, 6778, 6779, 6775, 6787, 7351 ]  
stop_times: [  
[ 715a, 721a, 728a, 738a],  
[ 807a, 813a, 820a, 830a],  
[ 827a, 833a, 840a, 850a],  
[ 845a, 851a, 858a, 908a],  
[ 907a, 913a, 920a, 930a],  
[ 924a, 930a, 937a, 947a],  
[ 944a, 950a, 957a, 1007a],  
[ 1004a, 1010a, 1017a, 1027a],  
[ 1024a, 1030a, 1037a, 1047a],  
[ 1044a, 1050a, 1057a, 1107a],  
[ 1104a, 1110a, 1117a, 1127a],  
[ 1124a, 1130a, 1137a, 1147a],  
[ 1144a, 1150a, 1157a, 1207p],  
[ 1204p, 1210p, 1217p, 1227p],  
[ 1224p, 1230p, 1237p, 1247p],  
[ 1244p, 1250p, 1257p, 107p],  
[ 104p, 110p, 117p, 127p],  
[ 124p, 130p, 137p, 147p],  
[ 144p, 150p, 157p, 207p],  
[ 204p, 210p, 217p, 227p],  
[ 224p, 230p, 237p, 247p],  
[ 244p, 250p, 257p, 307p],  
[ 304p, 310p, 317p, 327p],  
[ 324p, 330p, 337p, 347p],  
[ 344p, 350p, 357p, 407p],  
[ 407p, 413p, 420p, 430p],  
[ 427p, 433p, 440p, 450p],  
[ 447p, 453p, 500p, 510p],  
[ 507p, 513p, 520p, 530p],  
[ 527p, 533p, 540p, 550p],  
[ 547p, 553p, 600p, 610p],  
[ 629p, 635p, 642p, 652p],  
[ 649p, 655p, 702p, 712p],  
[ 709p, 715p, 722p, 732p]  
]  
 
# No service Saturdays, Sundays or Holidays  
 
short_name: 41  
long_name: To Dalhousie  
time_points: [ 8642, 6105, 6114, 7144 ]  
between_stops:  
8642-6105: [ 8638, 6088, 6104, 6125 ]  
6105-6114: [ 6108, 6103, 6102 ]  
6114-7144: [ 6097, 8294, 8292, 8300, 8301, 8298, 8297, 8317 ]  
stop_times: [  
[ 650a, 700a, 707a, 713a],  
[ 745a, 755a, 802a, 807a],  
[ 815a, 825a, 832a, 838a],  
[ 835a, 845a, 852a, 858a],  
[ 855a, 905a, 912a, 918a],  
[ 915a, 925a, 932a, 938a],  
[ 935a, 945a, 952a, 958a],  
[ 952a, 1002a, 1009a, 1015a],  
[ 1012a, 1022a, 1029a, 1035a],  
[ 1032a, 1042a, 1049a, 1055a],  
[ 1052a, 1102a, 1109a, 1115a],  
[ 1112a, 1122a, 1129a, 1135a],  
[ 1132a, 1142a, 1149a, 1155a],  
[ 1152a, 1202p, 1209p, 1215p],  
[ 1212p, 1222p, 1229p, 1235p],  
[ 1232p, 1242p, 1249p, 1255p],  
[ 1252p, 102p, 109p, 115p],  
[ 112p, 122p, 129p, 135p],  
[ 132p, 142p, 149p, 155p],  
[ 152p, 202p, 209p, 215p],  
[ 212p, 222p, 229p, 235p],  
[ 232p, 242p, 249p, 255p],  
[ 252p, 302p, 309p, 315p],  
[ 312p, 322p, 329p, 335p],  
[ 332p, 342p, 349p, 355p],  
[ 352p, 402p, 409p, 415p],  
[ 412p, 422p, 429p, 435p],  
[ 435p, 445p, 452p, 458p],  
[ 455p, 505p, 512p, 518p],  
[ 515p, 525p, 532p, 538p],  
[ 535p, 545p, 552p, 558p],  
[ 555p, 605p, 612p, 618p]  
]  
 
# No service Saturdays, Sundays or Holidays  
 
short_name: 42  
long_name: To Dalhousie  
time_points: [ 7086, 7166, 8193, 8214, 7144 ]  
between_stops:  
8193-8214: [ 8202, 8182, 8213, 8178, 8205, 8190 ]  
8214-7144: [ 8183, 8196, 8195, 8194, 8186, 8188, 8317 ]  
stop_times: [  
[ 655a, 701a, 708a, 716a, 722a],  
[ 755a, 801a, 808a, 816a, 822a],  
[ 815a, 821a, 828a, 836a, 842a],  
[ 835a, 841a, 848a, 856a, 902a],  
[ 855a, 901a, 906a, 913a, 919a],  
[ 915a, 921a, 926a, 933a, 939a],  
[ 935a, 941a, 946a, 953a, 959a],  
[ 955a, 1001a, 1006a, 1013a, 1019a],  
[ 1015a, 1021a, 1026a, 1033a, 1039a],  
[ 1035a, 1041a, 1046a, 1053a, 1059a],  
[ 1055a, 1101a, 1106a, 1113a, 1119a],  
[ 1115a, 1121a, 1126a, 1133a, 1139a],  
[ 1135a, 1141a, 1146a, 1153a, 1159a],  
[ 1155a, 1201p, 1206p, 1213p, 1219p],  
[ 1215p, 1221p, 1226p, 1233p, 1239p],  
[ 1235p, 1241p, 1246p, 1253p, 1259p],  
[ 1255p, 101p, 106p, 113p, 119p],  
[ 115p, 121p, 126p, 133p, 139p],  
[ 135p, 141p, 146p, 153p, 159p],  
[ 155p, 201p, 206p, 213p, 219p],  
[ 215p, 221p, 226p, 233p, 239p],  
[ 235p, 241p, 246p, 253p, 259p],  
[ 255p, 301p, 306p, 313p, 319p],  
[ 315p, 321p, 326p, 333p, 339p],  
[ 335p, 341p, 348p, 356p, 402p],  
[ 355p, 401p, 408p, 416p, 422p],  
[ 415p, 421p, 428p, 436p, 442p],  
[ 435p, 441p, 448p, 456p, 502p],  
[ 455p, 501p, 508p, 516p, 522p],  
[ 515p, 521p, 528p, 536p, 542p],  
[ 537p, 543p, 550p, 558p, 604p],  
[ 557p, 603p, 610p, 618p, 624p],  
[ 617p, 623p, 630p, 638p, 644p],  
[ 637p, 643p, 650p, 658p, 704p]  
]  
 
# No service Saturdays, Sundays or Holidays  
 
short_name: 42  
long_name: To Lacewood  
time_points: [ 7144, 8184, 8629, 6032, 7086 ]  
between_stops:  
7144-8184: [ 8220, 8187, 8185, 8219, 8179 ]  
8184-8629: [ 8206, 8221, 8222, 8181, 8210, 8201, 8251 ]  
stop_times: [  
[ 722a, 728a, 736a, 744a, 751a],  
[ 843a, 849a, 857a, 904a, 911a],  
[ 903a, 909a, 916a, 922a, 929a],  
[ 923a, 929a, 936a, 942a, 949a],  
[ 943a, 949a, 956a, 1002a, 1009a],  
[ 1003a, 1009a, 1016a, 1022a, 1029a],  
[ 1020a, 1026a, 1033a, 1039a, 1046a],  
[ 1040a, 1046a, 1053a, 1059a, 1106a],  
[ 1100a, 1106a, 1113a, 1119a, 1126a],  
[ 1120a, 1126a, 1133a, 1139a, 1146a],  
[ 1140a, 1146a, 1153a, 1159a, 1206p],  
[ 1200p, 1206p, 1213p, 1219p, 1226p],  
[ 1220p, 1226p, 1233p, 1239p, 1246p],  
[ 1240p, 1246p, 1253p, 1259p, 106p],  
[ 100p, 106p, 113p, 119p, 126p],  
[ 120p, 126p, 133p, 139p, 146p],  
[ 140p, 146p, 153p, 159p, 206p],  
[ 200p, 206p, 213p, 219p, 226p],  
[ 220p, 226p, 233p, 239p, 246p],  
[ 240p, 246p, 253p, 259p, 306p],  
[ 300p, 306p, 313p, 319p, 326p],  
[ 320p, 326p, 333p, 341p, 348p],  
[ 340p, 346p, 354p, 402p, 409p],  
[ 400p, 406p, 414p, 422p, 429p],  
[ 420p, 426p, 434p, 442p, 449p],  
[ 440p, 446p, 454p, 502p, 509p],  
[ 503p, 509p, 517p, 525p, 532p],  
[ 523p, 529p, 537p, 545p, 552p],  
[ 543p, 549p, 557p, 605p, 612p],  
[ 603p, 609p, 617p, 625p, 632p],  
[ 623p, 629p, 637p, 645p, 652p]  
]  
 
# No service Saturdays, Sundays or Holidays  
 
short_name: 5  
long_name: To Downtown  
time_points: [ 6578, 7284, 6397, 8435 ]  
between_stops:  
7284-6397: [ 6409, 6403, 6407, 6406 ]  
6397-8435: [ 6545, 6108 ]  
stop_times: [  
[ 720a, 730a, 735a, 745a],  
[ 750a, 800a, 805a, 815a],  
[ 822a, 832a, 837a, 847a],  
[ 405p, 415p, -, -],  
[ 435p, 445p, -, -],  
[ 540p, 550p, -, -]  
]  
 
short_name: 5  
long_name: To Springvale  
time_points: [ 8435, 6396, 7284, 6578 ]  
between_stops:  
8435-6396: [ 6544 ]  
6396-7284: [ 6404, 6413, 6414, 7275 ]  
stop_times: [  
[ -, -, 710a, 720a],  
[ -, -, 740a, 750a],  
[ -, -, 817a, 822a],  
[ -, -, 355p, 405p],  
[ 410p, 420p, 425p, 435p],  
[ 515p, 525p, 530p, 540p]  
]  
 
short_name: 52  
long_name: To Bridge Terminal - Burnside  
time_points: [ 6390, 7087, 7285, 7351, 8641, 6923, 6949, 7153, 6767 ]  
between_stops:  
7285-7351: [ 7274, 6409, 6403, 6407, 6406, 7355, 7345, 7357, 7352, 7342, 7354, 7347 ]  
stop_times: [  
[ -, 553a, 609a, 619a, 625a, 636a, 642a, 646a, -],  
[ 608a, 623a, 639a, 649a, 655a, 706a, 712a, 716a, -],  
[ -, 638a, 654a, 704a, 710a, 721a, 727a, 731a, -],  
[ 638a, 653a, 709a, 719a, 725a, 736a, 742a, 746a, -],  
[ -, 708a, 724a, 734a, 740a, 751a, 757a, 801a, -],  
[ 708a, 723a, 739a, 749a, 755a, 806a, 812a, 816a, -],  
[ -, 738a, 754a, 804a, 810a, 820a, 825a, 829a, -],  
[ 738a, 753a, 809a, 819a, 825a, 836a, 842a, 843a, -],  
[ 753a, 808a, 823a, 832a, 838a, 848a, 853a, 857a, -],  
[ 810a, 825a, 840a, 849a, 855a, 905a, 910a, -, 921a],  
[ 820a, 834a, -, -, -, -, -, -, -],  
[ 840a, 855a, 910a, 919a, 925a, 935a, 940a, -, 951a],  
[ 850a, 904a, -, -, -, -, -, -, -],  
[ 910a, 925a, 940a, 949a, 955a, 1005a, 1010a, -, 1021a],  
[ 920a, 934a, -, -, -, -, -, -, -],  
[ 940a, 955a, 1010a, 1019a, 1025a, 1035a, 1040a, -, 1051a],  
[ 945a, 959a, -, -, -, -, -, -, -],  
[ 958a, 1012a, -, -, -, -, -, -, -],  
[ 1010a, 1025a, 1040a, 1049a, 1055a, 1105a, 1110a, -, 1121a],  
[ 1040a, 1055a, 1110a, 1119a, 1125a, 1135a, 1140a, -, 1151a],  
[ 1110a, 1125a, 1140a, 1149a, 1155a, 1205p, 1210p, -, 1221p],  
[ 1140a, 1155a, 1210p, 1219p, 1225p, 1235p, 1240p, -, 1251p],  
[ 1210p, 1225p, 1240p, 1249p, 1255p, 105p, 110p, -, 121p],  
[ 1240p, 1255p, 110p, 119p, 125p, 135p, 140p, -, 151p],  
[ 110p, 125p, 140p, 149p, 155p, 205p, 210p, -, 221p],  
[ 140p, 155p, 210p, 219p, 225p, 235p, 240p, -, 251p],  
[ 210p, 225p, 240p, 249p, 255p, 305p, 310p, -, 321p],  
[ 238p, 253p, 309p, 319p, 325p, 336p, 342p, 346p, -],  
[ -, -, -, -, -, -, 357p, 401p, -],  
[ 308p, 323p, 339p, 349p, 355p, 406p, 412p, 416p, -],  
[ -, -, -, -, -, -, 427p, 431p, -],  
[ 338p, 353p, 409p, 419p, 425p, 436p, 442p, 446p, -],  
[ -, -, -, -, -, -, 457p, 501p, -],  
[ 408p, 423p, 439p, 449p, 455p, 506p, 512p, 516p, -],  
[ -, -, -, -, -, -, 527p, 531p, -],  
[ 438p, 453p, 509p, 519p, 525p, 536p, 542p, 543p, -],  
[ -, -, -, -, -, -, 557p, 601p, -],  
[ 510p, 525p, 540p, 549p, 555p, 605p, 610p, -, 621p],  
[ 525p, 540p, 555p, 604p, 610p, 620p, 625p, -, -],  
[ 540p, 555p, 610p, 619p, 625p, 635p, 640p, -, 651p],  
[ 555p, 610p, 625p, 634p, 640p, 650p, 655p, -, -],  
[ 610p, 625p, 640p, 649p, 655p, 705p, 710p, -, 721p],  
[ 625p, 640p, 655p, 704p, 710p, 720p, 725p, -, -],  
[ 640p, 655p, 710p, 719p, 725p, 735p, 740p, -, 751p],  
[ 650p, 704p, -, -, -, -, -, -, -],  
[ 700p, 714p, -, -, -, -, -, -, -],  
[ 710p, 725p, 740p, 749p, 755p, 805p, 810p, -, 821p],  
[ 740p, 755p, 810p, 819p, 825p, 835p, 840p, -, 851p],  
[ 810p, 825p, 840p, 849p, 855p, 905p, 910p, -, 921p],  
[ 840p, 855p, 910p, 919p, 925p, 935p, 940p, -, 951p],  
[ 910p, 925p, 940p, 949p, 955p, 1005p, 1010p, -, -],  
[ 940p, 955p, 1010p, 1019p, 1025p, 1035p, 1040p, -, -],  
[ 1010p, 1025p, 1040p, 1049p, 1055p, 1105p, 1110p, -, -],  
[ 1110p, 1125p, 1140p, 1149p, 1155p, 1205x, 1210x, -, -],  
[ 1210x, 1225x, 1240x, 1249x, 1255x, 105x, 110x, -, -]  
]  
stop_times_saturday: [  
[ -, -, 640a, 649a, 655a, 705a, 710a, -, 721a],  
[ 710a, 725a, 740a, 749a, 755a, 805a, 810a, -, 821a],  
[ 810a, 825a, 840a, 849a, 855a, 905a, 910a, -, 921a],  
[ 840a, 855a, 910a, 919a, 925a, 935a, 940a, -, 951a],  
[ 910a, 925a, 940a, 949a, 955a, 1005a, 1010a, -, 1021a],  
[ 940a, 955a, 1010a, 1019a, 1025a, 1035a, 1040a, -, 1051a],  
[ 1010a, 1025a, 1040a, 1049a, 1055a, 1105a, 1110a, -, 1121a],  
[ 1040a, 1055a, 1110a, 1119a, 1125a, 1135a, 1140a, -, 1151a],  
[ 1110a, 1125a, 1140a, 1149a, 1155a, 1205p, 1210p, -, 1221p],  
[ 1140a, 1155a, 1210p, 1219p, 1225p, 1235p, 1240p, -, 1251p],  
[ 1210p, 1225p, 1240p, 1249p, 1255p, 105p, 110p, -, 121p],  
[ 1240p, 1255p, 110p, 119p, 125p, 135p, 140p, -, 151p],  
[ 110p, 125p, 140p, 149p, 155p, 205p, 210p, -, 221p],  
[ 140p, 155p, 210p, 219p, 225p, 235p, 240p, -, 251p],  
[ 210p, 225p, 240p, 249p, 255p, 305p, 310p, -, 321p],  
[ 240p, 255p, 310p, 319p, 325p, 335p, 340p, -, 351p],  
[ 310p, 325p, 340p, 349p, 355p, 405p, 410p, -, 421p],  
[ 340p, 355p, 410p, 419p, 425p, 435p, 440p, -, 451p],  
[ 410p, 425p, 440p, 449p, 455p, 505p, 510p, -, 521p],  
[ 440p, 455p, 510p, 519p, 525p, 535p, 540p, -, 551p],  
[ 510p, 525p, 540p, 549p, 555p, 605p, 610p, -, 621p],  
[ 540p, 555p, 610p, 619p, 625p, 635p, 640p, -, 651p],  
[ 610p, 625p, 640p, 649p, 655p, 705p, 710p, -, 721p],  
[ 640p, 655p, 710p, 719p, 725p, 735p, 740p, -, 751p],  
[ 710p, 725p, 740p, 749p, 755p, 805p, 810p, -, 821p],  
[ 740p, 755p, 810p, 819p, 825p, 835p, 840p, -, -],  
[ 810p, 825p, 840p, 849p, 855p, 905p, 910p, -, 921p],  
[ 910p, 925p, 940p, 949p, 955p, 1005p, 1010p, -, 1021p],  
[ 1010p, 1025p, 1040p, 1049p, 1055p, 1105p, 1110p, -, 1121p],  
[ 1110p, 1125p, 1140p, 1149p, 1155p, 1205x, 1210x, -, -],  
[ 1210x, 1225x, 1240x, 1249x, 1255x, 105x, 110x, -, -]  
]  
stop_times_sunday: [  
[ -, 745a, 800a, 809a, 815a, 823a, 828a, -, -],  
[ 800a, 815a, 830a, 839a, 845a, 853a, 858a, -, -],  
[ 830a, 845a, 900a, 909a, 915a, 923a, 928a, -, -],  
[ 900a, 915a, 930a, 939a, 945a, 953a, 958a, -, -],  
[ 930a, 945a, 1000a, 1009a, 1015a, 1023a, 1028a, -, -],  
[ 1000a, 1015a, 1030a, 1039a, 1045a, 1053a, 1058a, -, -],  
[ 1030a, 1045a, 1100a, 1109a, 1115a, 1123a, 1128a, -, -],  
[ 1100a, 1115a, 1130a, 1139a, 1145a, 1153a, 1158a, -, -],  
[ 1130a, 1145a, 1200p, 1209p, 1215p, 1223p, 1228p, -, -],  
[ 1200p, 1215p, 1230p, 1239p, 1245p, 1253p, 1258p, -, -],  
[ 1230p, 1245p, 100p, 109p, 115p, 123p, 128p, -, -],  
[ 100p, 115p, 130p, 139p, 145p, 153p, 158p, -, -],  
[ 130p, 145p, 200p, 209p, 215p, 223p, 228p, -, -],  
[ 200p, 215p, 230p, 239p, 245p, 253p, 258p, -, -],  
[ 230p, 245p, 300p, 309p, 315p, 323p, 328p, -, -],  
[ 300p, 315p, 330p, 339p, 345p, 353p, 358p, -, -],  
[ 330p, 345p, 400p, 409p, 415p, 423p, 428p, -, -],  
[ 400p, 415p, 430p, 439p, 445p, 453p, 458p, -, -],  
[ 430p, 445p, 500p, 509p, 515p, 523p, 528p, -, -],  
[ 500p, 515p, 530p, 539p, 545p, 553p, 558p, -, -],  
[ 530p, 545p, 600p, 609p, 615p, 623p, 628p, -, -],  
[ 600p, 615p, 630p, 639p, 645p, 653p, 658p, -, -],  
[ 630p, 645p, 700p, 709p, 715p, 723p, 728p, -, -],  
[ 700p, 715p, 730p, 739p, 745p, 753p, 758p, -, -],  
[ 730p, 745p, 800p, 809p, 815p, 823p, 828p, -, -],  
[ 800p, 815p, 830p, 839p, 845p, 853p, 858p, -, -],  
[ 830p, 845p, 900p, 909p, 915p, 923p, 928p, -, -],  
[ 900p, 915p, 930p, 939p, 945p, 953p, 958p, -, -],  
[ 930p, 945p, 1000p, 1009p, 1015p, 1023p, 1028p, -, -],  
[ 1000p, 1015p, 1030p, 1039p, 1045p, 1053p, 1058p, -, -],  
[ 1030p, 1045p, 1100p, 1109p, 1115p, 1123p, 1128p, -, -],  
[ 1100p, 1115p, 1130p, 1139p, 1145p, 1153p, 1158p, -, -],  
[ 1130p, 1145p, 1200x, 1209x, 1215x, 1223x, 1228x, -, -],  
[ 1200x, 1215x, 1230x, 1239x, 1245x, 1253x, 1258x, -, -],  
[ 1230x, 1245x, 100x, 109x, 115x, 123x, 128x, -, -]  
]  
 
short_name: 52  
long_name: To Lacewood - Chain Lake Drive  
time_points: [ 6767, 7153, 7205, 6918, 7151, 7285, 6032, 7086, 6390 ]  
between_stops:  
7151-7285: [ 7346, 7341, 7353, 7358, 7344, 7356, 6405, 6404, 6413, 6414, 7275 ]  
7285-6032: [ 6984 ]  
stop_times: [  
[ -, -, -, -, -, -, -, 558a, 608a],  
[ -, -, -, -, -, -, -, 628a, 638a],  
[ -, -, 550a, 601a, 612a, 632a, 639a, 649a, 659a],  
[ -, -, 620a, 631a, 642a, 702a, 709a, 719a, 729a],  
[ -, -, 635a, 646a, 657a, 717a, 724a, 734a, 744a],  
[ -, 646a, 653a, 704a, 715a, 735a, 742a, 752a, 802a],  
[ -, -, 706a, 717a, 728a, 748a, 755a, 805a, 815a],  
[ -, 716a, 723a, 734a, 745a, 805a, 812a, 822a, 832a],  
[ -, 731a, 738a, 749a, 800a, 820a, 827a, 837a, 847a],  
[ -, 746a, 753a, 804a, 815a, 835a, 842a, 852a, 902a],  
[ -, 801a, 808a, 819a, 830a, 850a, 857a, 907a, 917a],  
[ -, 816a, 823a, 834a, 845a, 905a, 912a, 922a, 932a],  
[ -, 829a, 836a, 847a, 858a, 918a, 925a, 932a, 942a],  
[ -, 843a, 850a, 901a, 912a, 930a, 938a, 945a, 955a],  
[ -, 857a, 904a, 915a, 926a, 941a, 949a, 956a, 1006a],  
[ 921a, 929a, 940a, 945a, 955a, 1010a, 1018a, 1025a, 1035a],  
[ 951a, 959a, 1010a, 1015a, 1025a, 1040a, 1048a, 1055a, 1105a],  
[ 1021a, 1029a, 1040a, 1045a, 1055a, 1110a, 1118a, 1125a, 1135a],  
[ 1051a, 1059a, 1110a, 1115a, 1125a, 1140a, 1148a, 1155a, 1205p],  
[ 1121a, 1129a, 1140a, 1145a, 1155a, 1210p, 1218p, 1225p, 1235p],  
[ 1151a, 1159p, 1210p, 1215p, 1225p, 1240p, 1248p, 1255p, 105p],  
[ 1221p, 1229p, 1240p, 1245p, 1255p, 110p, 118p, 125p, 135p],  
[ 1251p, 1259p, 110p, 115p, 125p, 140p, 148p, 155p, 205p],  
[ 121p, 129p, 140p, 145p, 155p, 210p, 218p, 225p, 235p],  
[ 151p, 159p, 210p, 215p, 225p, 240p, 248p, 255p, 305p],  
[ 221p, 229p, 240p, 245p, 255p, 310p, 318p, 325p, 335p],  
[ 251p, 259p, 310p, 315p, 325p, 340p, 348p, 358p, 405p],  
[ 321p, 329p, 340p, 345p, 355p, 416p, 419p, 433p, 435p],  
[ -, 346p, 353p, 404p, 415p, 435p, 442p, 452p, 502p],  
[ -, 401p, 408p, 419p, 430p, 450p, 457p, 507p, 517p],  
[ -, 416p, 423p, 434p, 445p, 505p, 512p, 522p, 532p],  
[ -, 431p, 438p, 449p, 500p, 520p, 527p, 537p, 547p],  
[ -, 446p, 453p, 504p, 515p, 535p, 542p, 552p, 602p],  
[ -, 501p, 508p, 519p, 530p, 550p, 557p, 607p, 617p],  
[ -, 516p, 523p, 534p, 545p, 605p, 612p, 622p, 632p],  
[ -, 531p, 538p, 549p, 600p, 620p, 627p, 634p, 644p],  
[ -, 543p, 550p, 601p, 612p, 630p, 638p, 645p, 655p],  
[ -, 601p, 608p, 619p, 630p, 645p, 653p, 700p, 710p],  
[ 621p, 629p, 640p, 645p, 655p, 710p, 718p, 725p, 735p],  
[ 651p, 659p, 710p, 715p, 725p, 740p, 748p, 755p, 805p],  
[ 721p, 729p, 740p, 745p, 755p, 810p, 818p, 825p, 835p],  
[ 751p, 759p, 810p, 815p, 825p, 840p, 848p, 855p, 905p],  
[ 821p, 829p, 840p, 845p, 855p, 910p, 918p, 925p, 935p],  
[ 851p, 859p, 910p, 915p, 925p, 940p, 948p, 955p, 1005p],  
[ 951p, 959p, 1010p, 1015p, 1025p, 1040p, 1048p, 1055p, 1105p],  
[ -, -, 1110p, 1115p, 1125p, 1140p, 1148p, 1155p, 1205x]  
]  
stop_times_saturday: [  
[ -, -, 610a, 615a, 625a, 640a, 648a, 655a, 705a],  
[ -, -, 710a, 715a, 725a, 740a, 748a, 755a, 805a],  
[ 721a, 731a, 740a, 745a, 755a, 810a, 818a, 825a, 835a],  
[ 751a, 801a, 810a, 815a, 825a, 840a, 848a, 855a, 905a],  
[ 821a, 831a, 840a, 845a, 855a, 910a, 918a, 925a, 935a],  
[ 851a, 901a, 910a, 915a, 925a, 940a, 948a, 955a, 1005a],  
[ 921a, 931a, 940a, 945a, 955a, 1010a, 1018a, 1025a, 1035a],  
[ 951a, 1001a, 1010a, 1015a, 1025a, 1040a, 1048a, 1055a, 1105a],  
[ 1021a, 1031a, 1040a, 1045a, 1055a, 1110a, 1118a, 1125a, 1135a],  
[ 1051a, 1101a, 1110a, 1115a, 1125a, 1140a, 1148a, 1155a, 1205p],  
[ 1121a, 1131a, 1140a, 1145a, 1155a, 1210p, 1218p, 1225p, 1235p],  
[ 1151a, 1201p, 1210p, 1215p, 1225p, 1240p, 1248p, 1255p, 105p],  
[ 1221p, 1231p, 1240p, 1245p, 1255p, 110p, 118p, 125p, 135p],  
[ 1251p, 101p, 110p, 115p, 125p, 140p, 148p, 155p, 205p],  
[ 121p, 131p, 140p, 145p, 155p, 210p, 218p, 225p, 235p],  
[ 151p, 201p, 210p, 215p, 225p, 240p, 248p, 255p, 305p],  
[ 221p, 231p, 240p, 245p, 255p, 310p, 318p, 325p, 335p],  
[ 251p, 301p, 310p, 315p, 325p, 340p, 348p, 355p, 405p],  
[ 321p, 331p, 340p, 345p, 355p, 410p, 418p, 425p, 435p],  
[ 351p, 401p, 410p, 415p, 425p, 440p, 448p, 455p, 505p],  
[ 421p, 431p, 440p, 445p, 455p, 510p, 518p, 525p, 535p],  
[ 451p, 501p, 510p, 515p, 525p, 540p, 548p, 555p, 605p],  
[ 521p, 531p, 540p, 545p, 555p, 610p, 618p, 625p, 635p],  
[ 551p, 601p, 610p, 615p, 625p, 640p, 648p, 655p, 705p],  
[ 621p, 631p, 640p, 645p, 655p, 710p, 718p, 725p, 735p],  
[ 651p, 701p, 710p, 715p, 725p, 740p, 748p, 755p, 805p],  
[ 721p, 731p, 740p, 745p, 752p, -, -, -, -],  
[ 751p, 801p, 810p, 815p, 825p, 840p, 848p, 855p, 905p],  
[ 821p, 831p, 840p, 845p, 852p, -, -, -, -],  
[ 851p, 901p, 910p, 915p, 925p, 940p, 948p, 955p, 1005p],  
[ 951p, 1001p, 1010p, 1015p, 1025p, 1040p, 1048p, 1055p, 1105p],  
[ 1051p, 1101p, 1110p, 1115p, 1125p, 1140p, 1148p, 1155p, 1205x]  
]  
stop_times_sunday: [  
[ -, -, 700a, 705a, 715a, 730a, 738a, 745a, 755a],  
[ -, -, 730a, 735a, 745a, 800a, 808a, 815a, 825a],  
[ -, -, 800a, 805a, 815a, 830a, 838a, 845a, 855a],  
[ -, -, 830a, 835a, 845a, 900a, 908a, 915a, 925a],  
[ -, -, 900a, 905a, 915a, 930a, 938a, 945a, 955a],  
[ -, -, 930a, 935a, 945a, 1000a, 1008a, 1015a, 1025a],  
[ -, -, 1000a, 1005a, 1015a, 1030a, 1038a, 1045a, 1055a],  
[ -, -, 1030a, 1035a, 1045a, 1100a, 1108a, 1115a, 1125a],  
[ -, -, 1100a, 1105a, 1115a, 1130a, 1138a, 1145a, 1155a],  
[ -, -, 1130a, 1135a, 1145a, 1200p, 1208p, 1215p, 1225p],  
[ -, -, 1200p, 1205p, 1215p, 1230p, 1238p, 1245p, 1255p],  
[ -, -, 1230p, 1235p, 1245p, 100p, 108p, 115p, 125p],  
[ -, -, 100p, 105p, 115p, 130p, 138p, 145p, 155p],  
[ -, -, 130p, 135p, 145p, 200p, 208p, 215p, 225p],  
[ -, -, 200p, 205p, 215p, 230p, 238p, 245p, 255p],  
[ -, -, 230p, 235p, 245p, 300p, 308p, 315p, 325p],  
[ -, -, 300p, 305p, 315p, 330p, 338p, 345p, 355p],  
[ -, -, 330p, 335p, 345p, 400p, 408p, 415p, 425p],  
[ -, -, 400p, 405p, 415p, 430p, 438p, 445p, 455p],  
[ -, -, 430p, 435p, 445p, 500p, 508p, 515p, 525p],  
[ -, -, 500p, 505p, 515p, 530p, 538p, 545p, 555p],  
[ -, -, 530p, 535p, 545p, 600p, 608p, 615p, 625p],  
[ -, -, 600p, 605p, 615p, 630p, 638p, 645p, 655p],  
[ -, -, 630p, 635p, 645p, 700p, 708p, 715p, 725p],  
[ -, -, 700p, 705p, 715p, 730p, 738p, 745p, 755p],  
[ -, -, 730p, 735p, 745p, 800p, 808p, 815p, 825p],  
[ -, -, 800p, 805p, 815p, 830p, 838p, 845p, 855p],  
[ -, -, 830p, 835p, 845p, 900p, 908p, 915p, 925p],  
[ -, -, 900p, 905p, 915p, 930p, 938p, 945p, 955p],  
[ -, -, 930p, 935p, 945p, 1000p, 1008p, 1015p, 1025p],  
[ -, -, 1000p, 1005p, 1015p, 1030p, 1038p, 1045p, 1055p],  
[ -, -, 1030p, 1035p, 1045p, 1100p, 1108p, 1115p, 1125p],  
[ -, -, 1100p, 1105p, 1115p, 1130p, 1138p, 1145p, 1155p],  
[ -, -, 1130p, 1135p, 1145p, 1200x, 1208x, 1215x, 1225x]  
]  
 
short_name: 58  
long_name: To Lucien Drive  
time_points: [ 7284, 7412, 6087, 8640, 6031, 7445, 6575 ]  
between_stops:  
7284-7412: [ 6203, 7423 ]  
# nb: I haven't checked that 8328-6106 actually are served by the #58, but I'd  
# be shocked if they weren't  
7412-6087: [ 7419, 7409, 7402, 6453, 6447, 6449, 6454, 6452, 8328, 8337, 8333, 8336, 8327, 8338, 6121, 6106 ]  
stop_times: [  
[ -, -, -, -, -, 540a, 552a],  
[ -, -, -, 555a, 600a, 610a, 622a],  
[ -, -, -, 625a, 630a, 640a, 652a],  
[ -, -, -, 645a, 650a, 700a, 712a],  
[ -, -, -, 705a, 710a, 720a, 732a],  
[ -, -, -, 725a, 730a, 740a, 752a],  
[ -, -, -, 755a, 800a, 810a, 822a],  
[ -, -, -, 825a, 830a, 840a, 852a],  
[ -, -, -, 855a, 900a, 910a, 922a],  
[ -, -, -, 955a, 1000a, 1010a, 1022a],  
[ -, -, -, 1055a, 1100a, 1110a, 1122a],  
[ -, -, -, 1155a, 1200p, 1210p, 1222p],  
[ -, -, -, 1255p, 100p, 110p, 122p],  
[ -, -, -, 155p, 200p, 210p, 222p],  
[ -, -, -, 255p, 300p, 310p, 322p],  
[ -, -, -, 325p, 330p, 340p, 352p],  
[ 310p, 323p, 340p, 352p, 357p, 407p, 419p],  
[ 330p, 343p, 400p, 412p, 417p, 427p, 439p],  
[ 350p, 403p, 420p, 432p, 437p, 447p, 459p],  
[ 410p, 423p, 440p, 452p, 457p, 507p, 519p],  
[ 440p, 453p, 510p, 522p, 527p, 537p, 549p],  
[ -, -, -, 555p, 600p, 610p, 622p],  
[ -, -, -, 655p, 700p, 710p, 722p],  
[ -, -, -, 755p, 800p, 810p, 822p],  
[ -, -, -, 855p, 900p, 910p, 922p],  
[ -, -, -, 955p, 1000p, 1010p, 1022p],  
[ -, -, -, 1055p, 1100p, 1110p, 1122p],  
[ -, -, -, 1155p, 1200x, 1210x, 1222x]  
]  
 
short_name: 6  
long_name: To Downtown  
time_points: [ 8361, 7285, 8136, 6105, 8435 ]  
between_stops:  
7285-8136: [ 7274, 8135, 8133 ]  
8136-6105: [ 8147, 8149, 8150 ]  
6105-8435: [ 6108 ]  
stop_times: [  
[ 615a, 627a, 634a, 645a, 648a],  
[ 645a, 657a, 704a, 715a, 718a],  
[ 716a, 728a, 735a, 746a, 749a],  
[ 748a, 800a, 807a, 818a, 821a],  
[ 818a, 830a, 837a, 848a, 851a],  
[ 903a, 913a, 920a, 931a, 934a],  
[ 932a, 942a, 949a, 1000a, 1003a],  
[ 1032a, 1042a, 1049a, 1100a, 1103a],  
[ 1132a, 1142a, 1149a, 1200p, 1203p],  
[ 1232p, 1242p, 1249p, 100p, 103p],  
[ 132p, 142p, 149p, 200p, 203p],  
[ 232p, 242p, 249p, 300p, 303p],  
[ 336p, 348p, 355p, 406p, 409p],  
[ 406p, 418p, 425p, 436p, 439p],  
[ 436p, 448p, 455p, 506p, 509p],  
[ 506p, 518p, 525p, 536p, 539p],  
[ 536p, 548p, 555p, 604p, 607p],  
[ 606p, 616p, 623p, 630p, 633p],  
[ 632p, 642p, 649p, 656p, 659p],  
[ 732p, 742p, 749p, 756p, 759p],  
[ 832p, 842p, 849p, 856p, 859p],  
[ 932p, 942p, 949p, 956p, 959p],  
[ 1032p, 1042p, 1049p, 1056p, 1059p],  
[ 1132p, 1142p, 1149p, 1156p, 1159p],  
[ 1232x, 1242x, -, -, -]  
]  
 
short_name: 6  
long_name: To Stonehaven  
time_points: [ 8435, 8137, 8643, 8361 ]  
between_stops:  
8435-8137: [ 8138, 8148 ]  
8137-8643: [ 8134, 8146, 7275 ]  
stop_times: [  
[ -, -, 604a, 614a],  
[ -, -, 634a, 644a],  
[ 648a, 658a, 705a, 715a],  
[ 722a, 730a, 737a, 747a],  
[ 752a, 800a, 807a, 817a],  
[ 835a, 845a, 852a, 901a],  
[ 905a, 915a, 922a, 931a],  
[ 1005a, 1015a, 1022a, 1031a],  
[ 1105a, 1115a, 1122a, 1131a],  
[ 1205p, 1215p, 1222p, 1231p],  
[ 105p, 115p, 122p, 131p],  
[ 205p, 215p, 222p, 231p],  
[ 308p, 318p, 325p, 335p],  
[ 338p, 348p, 355p, 405p],  
[ 408p, 418p, 425p, 435p],  
[ 438p, 448p, 455p, 505p],  
[ 508p, 518p, 525p, 535p],  
[ 538p, 548p, 555p, 605p],  
[ 605p, 615p, 622p, 631p],  
[ 705p, 715p, 722p, 731p],  
[ 805p, 815p, 822p, 831p],  
[ 905p, 915p, 922p, 931p],  
[ 1005p, 1015p, 1022p, 1031p],  
[ 1105p, 1115p, 1122p, 1131p],  
[ 1205x, 1215x, 1222x, 1231x]  
]  
 
short_name: 7  
long_name: Gottingen to Robie via Downtown and South Street  
time_points: [ 7378, 6770, 6105, 6114, 8184, 8180, 8165 ]  
between_stops:  
7378-6770: [ 7368, 7361, 7382, 7370, 7362, 7365, 7364 ]  
6770-6105: [ 6783, 6776, 6777, 6781, 6774, 6780, 6786, 6790, 6771 ]  
6105-6114: [ 6108, 6103, 6102 ]  
6114-8184: [ 6097, 8294, 8292, 8300, 8301, 8298, 8297, 8220, 8187, 8185, 8219, 8179 ]  
8184-8180: [ 8206, 8221, 8222, 8181, 8210, 8201, 8251, 8192, 8209, 8217, 8204, 8207 ]  
8180-8165: [ 8211, 7131 ]  
stop_times: [  
[ 605a, 612a, 620a, 627a, 636a, 643a, 647a],  
[ 625a, 632a, 640a, 647a, 656a, 703a, 707a],  
[ 650a, 657a, 705a, 712a, 721a, 728a, 732a],  
[ 710a, 717a, 725a, 732a, 741a, 748a, 752a],  
[ 730a, 737a, 745a, 752a, 801a, 808a, 812a],  
[ 750a, 757a, 805a, 812a, 821a, 828a, 832a],  
[ 810a, 817a, 825a, 832a, 841a, 848a, 852a],  
[ 830a, 837a, 845a, 852a, 901a, 908a, 912a],  
[ 850a, 857a, 905a, 912a, 921a, 928a, 932a],  
[ 920a, 927a, 937a, 944a, 952a, 1001a, 1005a],  
[ 950a, 957a, 1007a, 1014a, 1023a, 1031a, 1035a],  
[ 1020a, 1027a, 1037a, 1044a, 1053a, 1101a, 1105a],  
[ 1050a, 1057a, 1107a, 1114a, 1123a, 1131a, 1135a],  
[ 1120a, 1127a, 1137a, 1144a, 1153a, 1201p, 1205p],  
[ 1150a, 1157a, 1207p, 1214p, 1223p, 1231p, 1235p],  
[ 1220p, 1227p, 1237p, 1244p, 1253p, 102p, 106p],  
[ 1250p, 1257p, 107p, 114p, 124p, 136p, 140p],  
[ 120p, 127p, 137p, 144p, 154p, 206p, 210p],  
[ 150p, 157p, 207p, 214p, 224p, 236p, 240p],  
[ 220p, 227p, 237p, 244p, 254p, 306p, 310p],  
[ 240p, 247p, 257p, 304p, 314p, 326p, 330p],  
[ 300p, 307p, 317p, 324p, 334p, 346p, 350p],  
[ 320p, 327p, 337p, 344p, 354p, 406p, 410p],  
[ 340p, 347p, 357p, 404p, 414p, 426p, 430p],  
[ 400p, 407p, 417p, 424p, 434p, 446p, 450p],  
[ 420p, 427p, 437p, 444p, 454p, 506p, 510p],  
[ 440p, 447p, 457p, 504p, 514p, 526p, 530p],  
[ 500p, 507p, 517p, 524p, 534p, 540p, 544p],  
[ 520p, 527p, 535p, 541p, 551p, 556p, 600p],  
[ 550p, 557p, 605p, 611p, 620p, 626p, 630p],  
[ 620p, 627p, 635p, 641p, 650p, 656p, 700p],  
[ 650p, 657p, 705p, 711p, 720p, 726p, 730p],  
[ 720p, 727p, 735p, 741p, 750p, 756p, 800p],  
[ 750p, 757p, 805p, 811p, 820p, 826p, 830p],  
[ 820p, 827p, 835p, 841p, 850p, 856p, 900p],  
[ 850p, 857p, 905p, 911p, 920p, 926p, 930p],  
[ 920p, 927p, 935p, 941p, 950p, 956p, 1000p],  
[ 950p, 957p, 1005p, 1011p, 1020p, 1026p, 1030p],  
[ 1020p, 1027p, 1035p, 1041p, 1050p, 1056p, 1100p],  
[ 1050p, 1057p, 1105p, 1111p, 1120p, 1126p, 1130p],  
[ 1120p, 1127p, 1135p, 1141p, 1150p, 1156p, 1200x],  
[ 1150p, 1157p, 1205x, 1211x, 1220x, 1226x, 1230x]  
]  
stop_times_saturday: [  
[ 655a, 702a, 710a, 716a, 725a, 731a, 735a],  
[ 755a, 802a, 810a, 816a, 825a, 831a, 835a],  
[ 825a, 832a, 840a, 846a, 855a, 901a, 905a],  
[ 855a, 902a, 910a, 916a, 925a, 931a, 935a],  
[ 925a, 932a, 940a, 946a, 955a, 1001a, 1005a],  
[ 955a, 1002a, 1010a, 1016a, 1025a, 1031a, 1035a],  
[ 1025a, 1032a, 1040a, 1046a, 1055a, 1101a, 1105a],  
[ 1055a, 1102a, 1110a, 1116a, 1125a, 1131a, 1135a],  
[ 1125a, 1132a, 1140a, 1146a, 1155a, 1201p, 1205p],  
[ 1155a, 1202p, 1210p, 1216p, 1225p, 1231p, 1235p],  
[ 1225p, 1232p, 1240p, 1246p, 1255p, 101p, 105p],  
[ 1255p, 102p, 110p, 116p, 125p, 131p, 135p],  
[ 125p, 132p, 140p, 146p, 155p, 201p, 205p],  
[ 155p, 202p, 210p, 216p, 225p, 231p, 235p],  
[ 225p, 232p, 240p, 246p, 255p, 301p, 305p],  
[ 255p, 302p, 310p, 316p, 325p, 331p, 335p],  
[ 325p, 332p, 340p, 346p, 355p, 401p, 405p],  
[ 355p, 402p, 410p, 416p, 425p, 431p, 435p],  
[ 425p, 432p, 440p, 446p, 455p, 501p, 505p],  
[ 455p, 502p, 510p, 516p, 525p, 531p, 535p],  
[ 525p, 532p, 540p, 546p, 555p, 601p, 605p],  
[ 555p, 602p, 610p, 616p, 625p, 631p, 635p],  
[ 625p, 632p, 640p, 646p, 655p, 701p, 705p],  
[ 655p, 702p, 710p, 716p, 725p, 731p, 735p],  
[ 725p, 732p, 740p, 746p, 755p, 801p, 805p],  
[ 755p, 802p, 810p, 816p, 825p, 831p, 835p],  
[ 825p, 832p, 840p, 846p, 855p, 901p, 905p],  
[ 855p, 902p, 910p, 916p, 925p, 931p, 935p],  
[ 925p, 932p, 940p, 946p, 955p, 1001p, 1005p],  
[ 955p, 1002p, 1010p, 1016p, 1025p, 1031p, 1035p],  
[ 1025p, 1032p, 1040p, 1046p, 1055p, 1101p, 1105p],  
[ 1055p, 1102p, 1110p, 1116p, 1125p, 1131p, 1135p],  
[ 1155p, 1202x, 1210x, 1216x, 1225x, 1231x, 1235x]  
]  
stop_times_sunday: [  
[ 745a, 752a, 800a, 805a, 814a, 820a, 824a],  
[ 830a, 837a, 845a, 850a, 859a, 905a, 909a],  
[ 915a, 922a, 930a, 935a, 944a, 950a, 954a],  
[ 1000a, 1007a, 1015a, 1020a, 1029a, 1035a, 1039a],  
[ 1045a, 1052a, 1100a, 1105a, 1114a, 1120a, 1124a],  
[ 1130a, 1137a, 1145a, 1150a, 1159a, 1205p, 1209p],  
[ 1215p, 1222p, 1230p, 1235p, 1244p, 1250p, 1254p],  
[ 100p, 107p, 115p, 120p, 129p, 135p, 139p],  
[ 145p, 152p, 200p, 205p, 214p, 220p, 224p],  
[ 230p, 237p, 245p, 250p, 259p, 305p, 309p],  
[ 315p, 322p, 330p, 335p, 344p, 350p, 354p],  
[ 400p, 407p, 415p, 420p, 429p, 435p, 439p],  
[ 445p, 452p, 500p, 505p, 514p, 520p, 524p],  
[ 530p, 537p, 545p, 550p, 559p, 605p, 609p],  
[ 615p, 622p, 630p, 635p, 644p, 650p, 654p],  
[ 700p, 707p, 715p, 720p, 729p, 735p, 739p],  
[ 745p, 752p, 800p, 805p, 814p, 820p, 824p],  
[ 830p, 837p, 845p, 850p, 859p, 905p, 909p],  
[ 915p, 922p, 930p, 935p, 944p, 950p, 954p],  
[ 1000p, 1007p, 1015p, 1020p, 1029p, 1035p, 1039p],  
[ 1045p, 1052p, 1100p, 1105p, 1114p, 1120p, 1124p],  
[ 1130p, 1137p, 1145p, 1150p, 1159p, 1205x, 1209x]  
]  
 
short_name: 7  
long_name: Robie to Gottingen via South Street and Downtown  
time_points: [ 8165, 8208, 8214, 6096, 6087, 7366, 7378 ]  
between_stops:  
8165-8208: [ 7133, 8212 ]  
8208-8214: [ 8203, 8197, 8218, 8193, 8202, 8182, 8213, 8178, 8205, 8190 ]  
8214-6096: [ 8183, 8196, 8195, 8194, 8186, 8188, 8296, 8303, 8305, 8295, 8299, 8293 ]  
6096-6087: [ 6113, 6124 ]  
6087-7366: [ 6455, 6773, 6778, 6779, 6775, 6787, 6769, 6785, 6768, 6782 ]  
7366-7378: [ 7377, 7381, 7374, 7369, 7373, 7376, 7360 ]  
 
stop_times: [  
[ 600a, 604a, 614a, 621a, 628a, 637a, 645a],  
[ 620a, 624a, 634a, 641a, 648a, 657a, 705a],  
[ 640a, 644a, 654a, 701a, 708a, 717a, 725a],  
[ 700a, 704a, 714a, 721a, 728a, 737a, 745a],  
[ 720a, 724a, 734a, 741a, 748a, 757a, 805a],  
[ 740a, 744a, 754a, 801a, 808a, 817a, 825a],  
[ 800a, 804a, 814a, 821a, 828a, 837a, 845a],  
[ 820a, 824a, 834a, 841a, 848a, 857a, 905a],  
[ 840a, 844a, 854a, 901a, 908a, 917a, 925a],  
[ 900a, 904a, 914a, 921a, 928a, 937a, 945a],  
[ 930a, 934a, 944a, 951a, 958a, 1007a, 1015a],  
[ 1000a, 1004a, 1014a, 1021a, 1028a, 1037a, 1045a],  
[ 1030a, 1034a, 1044a, 1051a, 1058a, 1107a, 1115a],  
[ 1100a, 1104a, 1114a, 1121a, 1128a, 1137a, 1145a],  
[ 1130a, 1134a, 1144a, 1151a, 1158a, 1207p, 1215p],  
[ 1200p, 1204p, 1214p, 1221p, 1228p, 1237p, 1245p],  
[ 1230p, 1234p, 1244p, 1251p, 1258p, 108p, 116p],  
[ 100p, 104p, 116p, 124p, 132p, 142p, 150p],  
[ 130p, 134p, 146p, 154p, 202p, 212p, 220p],  
[ 200p, 204p, 216p, 224p, 232p, 242p, 250p],  
[ 230p, 234p, 246p, 254p, 302p, 312p, 320p],  
[ 250p, 254p, 306p, 314p, 322p, 332p, 340p],  
[ 310p, 314p, 326p, 334p, 342p, 352p, 400p],  
[ 330p, 334p, 346p, 354p, 402p, 412p, 420p],  
[ 350p, 354p, 406p, 414p, 422p, 432p, 440p],  
[ 410p, 414p, 426p, 434p, 442p, 452p, 500p],  
[ 430p, 434p, 446p, 454p, 502p, 512p, 520p],  
[ 450p, 454p, 506p, 514p, 522p, 531p, 539p],  
[ 510p, 514p, 526p, 534p, 540p, 547p, 555p],  
[ 530p, 534p, 541p, 548p, 555p, 602p, 610p],  
[ 550p, 554p, 601p, 608p, 615p, 622p, 630p],  
[ 610p, 614p, 621p, 628p, 635p, 642p, 650p],  
[ 640p, 644p, 651p, 658p, 705p, 712p, 720p],  
[ 710p, 714p, 721p, 728p, 735p, 742p, 750p],  
[ 740p, 744p, 751p, 758p, 805p, 812p, 820p],  
[ 810p, 814p, 821p, 828p, 835p, 842p, 850p],  
[ 840p, 844p, 851p, 858p, 905p, 912p, 920p],  
[ 910p, 914p, 921p, 928p, 935p, 942p, 950p],  
[ 940p, 944p, 951p, 958p, 1005p, 1012p, 1020p],  
[ 1010p, 1014p, 1021p, 1028p, 1035p, 1042p, 1050p],  
[ 1040p, 1044p, 1051p, 1058p, 1105p, 1112p, 1120p],  
[ 1110p, 1114p, 1121p, 1128p, 1135p, 1142p, 1150p],  
[ 1140p, 1144p, 1151p, 1158p, 1205x, 1212x, 1220x],  
[ 1210x, 1214x, 1221x, 1228x, 1235x, 1242x, 1250x]  
]  
 
short_name: 80  
long_name: To Bedford - Halifax  
time_points: [ 8260, 8646, 6236, 6216, 6564, 8214, 6087, 8414 ]  
between_stops:  
6216-6564: [ 6982, 6985, 8262 ]  
6564-8214: [ 6197, 6193, 6203, 8633, 8193, 8202, 8182, 8213, 8178, 8205, 8190 ]  
8214-6087: [ 8183, 8196, 8195, 8194, 8328, 8337, 8333, 8336, 8327, 8338, 6121, 6106 ]  
stop_times: [  
[ 542a, 554a, 602a, 618a, 625a, 635a, 645a, 647a],  
[ 633a, 645a, 653a, 708a, 718a, 729a, 746a, 748a],  
[ 706a, 721a, 728a, 743a, 753a, 804a, 821a, 823a],  
[ 733a, 748a, 755a, 810a, 820a, 831a, 848a, 850a],  
[ 800a, 815a, 822a, 837a, 845a, 856a, 913a, 915a],  
[ 829a, 844a, 851a, 906a, 914a, 925a, 942a, 944a],  
[ 859a, 914a, 921a, 936a, 944a, 955a, 1012a, 1014a],  
[ 929a, 944a, 951a, 1006a, 1014a, 1025a, 1042a, 1044a],  
[ 959a, 1014a, 1021a, 1036a, 1044a, 1055a, 1112a, 1114a],  
[ 1029a, 1044a, 1051a, 1106a, 1114a, 1125a, 1142a, 1144a],  
[ 1059a, 1114a, 1121a, 1136a, 1144a, 1155a, 1212p, 1214p],  
[ 1129a, 1144a, 1151a, 1206p, 1214p, 1225p, 1242p, 1244p],  
[ 1159a, 1214p, 1221p, 1236p, 1244p, 1255p, 112p, 114p],  
[ 1229p, 1244p, 1251p, 106p, 114p, 125p, 142p, 144p],  
[ 1259p, 114p, 121p, 136p, 144p, 155p, 212p, 214p],  
[ 129p, 144p, 151p, 206p, 214p, 225p, 242p, 244p],  
[ 159p, 214p, 221p, 236p, 244p, 255p, 312p, 314p],  
[ 229p, 244p, 251p, 306p, 314p, 325p, 342p, 344p],  
[ 259p, 314p, 321p, 336p, 344p, 355p, 412p, 414p],  
[ 329p, 344p, 351p, 406p, 414p, 425p, 442p, 444p],  
[ 359p, 414p, 421p, 436p, 444p, 455p, 512p, 514p],  
[ 429p, 444p, 451p, 506p, 514p, 525p, 542p, 544p],  
[ 459p, 514p, 521p, 536p, 544p, 555p, 607p, 609p],  
[ 526p, 541p, 548p, 603p, 607p, 618p, 628p, 630p],  
[ 551p, 605p, 610p, 626p, 630p, 641p, 651p, 653p],  
[ 621p, 633p, 638p, 654p, 658p, 709p, 719p, 721p],  
[ 651p, 703p, 708p, 724p, 728p, 739p, 749p, 751p],  
[ 721p, 733p, 738p, 754p, 758p, 809p, 819p, 821p],  
[ 751p, 803p, 808p, 824p, 828p, 839p, 849p, 851p],  
[ 821p, 833p, 838p, 854p, 858p, 909p, 919p, 921p],  
[ 851p, 903p, 908p, 924p, 928p, 939p, 949p, 951p],  
[ 921p, 933p, 938p, 954p, 958p, 1009p, 1019p, 1021p],  
[ 951p, 1003p, 1008p, 1024p, 1028p, 1039p, 1049p, 1051p],  
[ 1021p, 1033p, 1038p, 1054p, 1058p, 1109p, 1119p, 1121p],  
[ 1121p, 1133p, 1138p, 1154p, 1158p, 1209x, 1219x, 1221x],  
[ 1216x, 1228x, -, -, -, -, -, -],  
[ 116x, 128x, -, -, -, -, -, -]  
]  
stop_times_saturday: [  
[ 545a, 557a, 603a, 613a, 622a, 633a, 643a, 645a],  
[ 615a, 627a, 633a, 643a, 652a, 703a, 713a, 715a],  
[ 645a, 657a, 703a, 713a, 722a, 734a, 744a, 745a],  
[ 725a, 738a, 744a, 754a, 803a, 815a, 825a, 827a],  
[ 755a, 808a, 814a, 824a, 833a, 845a, 855a, 857a],  
[ 825a, 838a, 844a, 854a, 903a, 915a, 925a, 927a],  
[ 855a, 908a, 914a, 924a, 933a, 945a, 955a, 957a],  
[ 925a, 938a, 944a, 954a, 1003a, 1015a, 1025a, 1027a],  
[ 955a, 1008a, 1014a, 1024a, 1033a, 1045a, 1055a, 1057a],  
[ 1025a, 1038a, 1044a, 1054a, 1103a, 1115a, 1125a, 1127a],  
[ 1055a, 1108a, 1114a, 1124a, 1133a, 1145a, 1155a, 1157a],  
[ 1125a, 1138a, 1144a, 1154a, 1203p, 1215p, 1225p, 1227p],  
[ 1155a, 1208p, 1214p, 1224p, 1233p, 1245p, 1255p, 1257p],  
[ 1225p, 1238p, 1244p, 1254p, 103p, 115p, 125p, 127p],  
[ 1255p, 108p, 114p, 124p, 133p, 145p, 155p, 157p],  
[ 125p, 138p, 144p, 154p, 203p, 215p, 225p, 227p],  
[ 155p, 208p, 214p, 224p, 233p, 245p, 255p, 257p],  
[ 225p, 238p, 244p, 254p, 303p, 315p, 325p, 327p],  
[ 255p, 308p, 314p, 324p, 333p, 345p, 355p, 357p],  
[ 325p, 338p, 344p, 354p, 403p, 415p, 425p, 427p],  
[ 355p, 408p, 414p, 424p, 433p, 445p, 455p, 457p],  
[ 425p, 438p, 444p, 454p, 503p, 515p, 525p, 527p],  
[ 455p, 508p, 514p, 524p, 533p, 545p, 555p, 557p],  
[ 525p, 538p, 544p, 554p, 603p, 615p, 625p, 627p],  
[ 555p, 608p, 614p, 624p, 633p, 645p, 655p, 657p],  
[ 635p, 648p, 654p, 704p, 713p, 725p, 735p, 737p],  
[ 705p, 718p, 724p, 734p, 743p, 755p, 805p, 807p],  
[ 735p, 748p, 754p, 804p, 813p, 825p, 835p, 837p],  
[ 805p, 818p, 824p, 834p, 843p, 855p, 905p, 907p],  
[ 835p, 848p, 854p, 904p, 913p, 925p, 935p, 937p],  
[ 905p, 918p, 924p, 934p, 943p, 955p, 1005p, 1007p],  
[ 935p, 948p, 954p, 1004p, 1013p, 1023p, 1033p, 1035p],  
[ 1005p, 1017p, 1023p, 1033p, 1042p, 1052p, 1102p, 1104p],  
[ 1107p, 1119p, 1125p, 1135p, 1144p, 1154p, 1204x, 1206x],  
[ 1207x, 1219x, 1225x, -, -, -, -, -],  
[ 107x, 119x, 125x, -, -, -, -, -]  
]  
stop_times_sunday: [  
[ 545a, 605a, 610a, 622a, 630a, 640a, 650a, 652a],  
[ 645a, 705a, 710a, 722a, 730a, 740a, 750a, 752a],  
[ 715a, 735a, 740a, 752a, 800a, 810a, 820a, 822a],  
[ 745a, 805a, 810a, 822a, 830a, 840a, 850a, 852a],  
[ 815a, 835a, 840a, 852a, 900a, 910a, 920a, 922a],  
[ 845a, 905a, 910a, 922a, 930a, 940a, 950a, 952a],  
[ 915a, 935a, 940a, 952a, 1000a, 1010a, 1020a, 1022a],  
[ 945a, 1005a, 1010a, 1022a, 1030a, 1040a, 1050a, 1052a],  
[ 1015a, 1035a, 1040a, 1052a, 1100a, 1110a, 1120a, 1122a],  
[ 1045a, 1105a, 1110a, 1122a, 1130a, 1140a, 1150a, 1152a],  
[ 1115a, 1135a, 1140a, 1152a, 1200p, 1210p, 1220p, 1222p],  
[ 1135a, 1155a, 1200p, 1212p, 1220p, 1230p, 1240p, 1242p],  
[ 1155a, 1215p, 1220p, 1232p, 1240p, 1250p, 100p, 102p],  
[ 1215p, 1235p, 1240p, 1252p, 100p, 110p, 120p, 122p],  
[ 1235p, 1255p, 100p, 112p, 120p, 130p, 140p, 142p],  
[ 1255p, 115p, 120p, 132p, 140p, 150p, 200p, 202p],  
[ 115p, 135p, 140p, 152p, 200p, 210p, 220p, 222p],  
[ 135p, 155p, 200p, 212p, 220p, 230p, 240p, 242p],  
[ 155p, 215p, 220p, 232p, 240p, 250p, 300p, 302p],  
[ 215p, 235p, 240p, 252p, 300p, 310p, 320p, 322p],  
[ 235p, 255p, 300p, 312p, 320p, 330p, 340p, 342p],  
[ 255p, 315p, 320p, 332p, 340p, 350p, 400p, 402p],  
[ 315p, 335p, 340p, 352p, 400p, 410p, 420p, 422p],  
[ 335p, 355p, 400p, 412p, 420p, 430p, 440p, 442p],  
[ 355p, 415p, 420p, 432p, 440p, 450p, 500p, 502p],  
[ 415p, 435p, 440p, 452p, 500p, 510p, 520p, 522p],  
[ 435p, 455p, 500p, 512p, 520p, 530p, 540p, 542p],  
[ 455p, 515p, 520p, 532p, 540p, 550p, 600p, 602p],  
[ 515p, 535p, 540p, 552p, 600p, 610p, 620p, 622p],  
[ 535p, 555p, 600p, 612p, 620p, 630p, 640p, 642p],  
[ 555p, 615p, 620p, 632p, 640p, 650p, 700p, 702p],  
[ 615p, 635p, 640p, 652p, 700p, 710p, 720p, 722p],  
[ 635p, 655p, 700p, 712p, 720p, 730p, 740p, 742p],  
[ 655p, 715p, 720p, 732p, 740p, 750p, 800p, 802p],  
[ 715p, 735p, 740p, 752p, 800p, 810p, 820p, 822p],  
[ 735p, 755p, 800p, 812p, 820p, 830p, 840p, 842p],  
[ 755p, 815p, 820p, 832p, 840p, 850p, 900p, 902p],  
[ 815p, 835p, 840p, 852p, 900p, 910p, 920p, 922p],  
[ 835p, 855p, 900p, 912p, 920p, 930p, 940p, 942p],  
[ 855p, 915p, 920p, 932p, 940p, 950p, 1000p, 1002p],  
[ 915p, 935p, 940p, 952p, 1000p, 1010p, 1020p, 1022p],  
[ 945p, 1005p, 1010p, 1022p, 1030p, 1040p, 1050p, 1052p],  
[ 1015p, 1035p, 1040p, 1052p, 1100p, 1110p, 1120p, 1122p],  
[ 1115p, 1135p, 1140p, 1152p, 1200x, 1210x, 1220x, 1222x],  
[ 1215x, 1235x, 1240x, -, -, -, -, -]  
]  
 
short_name: 80  
long_name: To Bedford - Sackville  
time_points: [ 8414, 6105, 8184, 6563, 6219, 6238, 6445, 8260 ]  
between_stops:  
6105-8184: [ 6108, 6103, 6102, 6122, 8331, 8330, 8334, 8335, 8329, 8185, 8219, 8179 ]  
8184-6563: [ 8206, 8221, 8222, 8181, 8210, 8201, 8251, 8629, 8634, 6192, 6196, 6201, 6200, 6199, 6198 ]  
6563-6219: [ 6565, 6984, 6983 ]  
stop_times: [  
[ -, -, -, -, -, 519a, 525a, -],  
[ -, -, -, -, -, 608a, 615a, 628a],  
[ 552a, 555a, 605a, 615a, 619a, 634a, 640a, 658a],  
[ 618a, 621a, 631a, 641a, 645a, 701a, 709a, 725a],  
[ 642a, 645a, 655a, 708a, 713a, 731a, 738a, 752a],  
[ 707a, 710a, 722a, 737a, 742a, 800a, 808a, 821a],  
[ 737a, 740a, 752a, 807a, 812a, 830a, 838a, 851a],  
[ 807a, 810a, 822a, 837a, 842a, 900a, 908a, 921a],  
[ 837a, 840a, 852a, 907a, 912a, 930a, 938a, 951a],  
[ 907a, 910a, 922a, 937a, 942a, 1000a, 1008a, 1021a],  
[ 937a, 940a, 952a, 1007a, 1012a, 1030a, 1038a, 1051a],  
[ 1007a, 1010a, 1022a, 1037a, 1042a, 1100a, 1108a, 1121a],  
[ 1037a, 1040a, 1052a, 1107a, 1112a, 1130a, 1138a, 1151a],  
[ 1107a, 1110a, 1122a, 1137a, 1142a, 1200p, 1208p, 1221p],  
[ 1137a, 1140a, 1152a, 1207p, 1212p, 1230p, 1238p, 1251p],  
[ 1207p, 1210p, 1222p, 1237p, 1242p, 100p, 108p, 121p],  
[ 1237p, 1240p, 1252p, 107p, 112p, 130p, 138p, 151p],  
[ 107p, 110p, 122p, 137p, 142p, 200p, 208p, 221p],  
[ 127p, 130p, 142p, 157p, 202p, 220p, 228p, 241p],  
[ 147p, 150p, 202p, 217p, 222p, 240p, 248p, 301p],  
[ 207p, 210p, 222p, 237p, 242p, 300p, 308p, 321p],  
[ 222p, 225p, 237p, 252p, 257p, 315p, 323p, 336p],  
[ 235p, 238p, 250p, 305p, 310p, 328p, 338p, 351p],  
[ 249p, 252p, 304p, 319p, 324p, 343p, 353p, 406p],  
[ 303p, 306p, 318p, 334p, 342p, 401p, 411p, 424p],  
[ 316p, 319p, 331p, 350p, 358p, 417p, 427p, 440p],  
[ 331p, 334p, 346p, 405p, 413p, 432p, 442p, 455p],  
[ 346p, 349p, 401p, 420p, 428p, 447p, 457p, 510p],  
[ 401p, 404p, 416p, 435p, 443p, 502p, 512p, 525p],  
[ 416p, 419p, 431p, 450p, 458p, 517p, 527p, 540p],  
[ 431p, 434p, 446p, 505p, 513p, 532p, 542p, 555p],  
[ 446p, 449p, 501p, 520p, 528p, 546p, 553p, 606p],  
[ 502p, 505p, 517p, 536p, 544p, 557p, 604p, 617p],  
[ 522p, 525p, 537p, 553p, 558p, 611p, 618p, 631p],  
[ 542p, 545p, 555p, 608p, 613p, 626p, 633p, 646p],  
[ 608p, 610p, 620p, 633p, 638p, 651p, 658p, 711p],  
[ 638p, 640p, 650p, 703p, 708p, 721p, 728p, 741p],  
[ 708p, 710p, 720p, 733p, 738p, 751p, 758p, 811p],  
[ 738p, 740p, 750p, 803p, 808p, 821p, 828p, 841p],  
[ 808p, 810p, 820p, 833p, 838p, 851p, 858p, 911p],  
[ 838p, 840p, 850p, 903p, 908p, 921p, 928p, 941p],  
[ 908p, 910p, 920p, 933p, 938p, 951p, 958p, 1011p],  
[ 1008p, 1010p, 1020p, 1033p, 1038p, 1051p, 1058p, 1111p],  
[ 1108p, 1110p, 1120p, 1133p, 1138p, 1151p, 1158p, 1211x],  
[ 1208x, 1210x, 1220x, 1233x, 1238x, 1251x, 1258x, 111x]  
]  
stop_times_saturday: [  
[ -, -, -, -, -, 553a, 602a, 615a],  
[ -, -, -, -, -, 623a, 632a, 645a],  
[ 615a, 618a, 626a, 638a, 644a, 653a, 702a, 714a],  
[ 645a, 648a, 658a, 710a, 716a, 725a, 734a, 747a],  
[ 715a, 718a, 726a, 738a, 744a, 753a, 802a, 814a],  
[ 745a, 748a, 758a, 810a, 816a, 825a, 834a, 847a],  
[ 813a, 816a, 826a, 838a, 844a, 853a, 902a, 914a],  
[ 837a, 840a, 852a, 907a, 913a, 922a, 931a, 944a],  
[ 907a, 910a, 922a, 937a, 943a, 952a, 1001a, 1014a],  
[ 937a, 940a, 952a, 1007a, 1013a, 1022a, 1031a, 1044a],  
[ 1007a, 1010a, 1022a, 1037a, 1043a, 1052a, 1101a, 1114a],  
[ 1037a, 1040a, 1052a, 1107a, 1113a, 1122a, 1131a, 1144a],  
[ 1107a, 1110a, 1122a, 1137a, 1143a, 1152a, 1201p, 1214p],  
[ 1137a, 1140a, 1152a, 1207p, 1213p, 1222p, 1231p, 1244p],  
[ 1207p, 1210p, 1222p, 1237p, 1243p, 1252p, 101p, 114p],  
[ 1237p, 1240p, 1252p, 107p, 113p, 122p, 131p, 144p],  
[ 107p, 110p, 122p, 137p, 143p, 152p, 201p, 214p],  
[ 137p, 140p, 152p, 207p, 213p, 222p, 231p, 244p],  
[ 207p, 210p, 222p, 237p, 243p, 252p, 301p, 314p],  
[ 237p, 240p, 252p, 307p, 313p, 322p, 331p, 344p],  
[ 307p, 310p, 322p, 337p, 343p, 352p, 401p, 414p],  
[ 337p, 340p, 352p, 407p, 413p, 422p, 431p, 444p],  
[ 407p, 410p, 422p, 437p, 443p, 452p, 501p, 514p],  
[ 437p, 440p, 452p, 507p, 513p, 522p, 531p, 544p],  
[ 507p, 510p, 522p, 537p, 543p, 552p, 601p, 614p],  
[ 537p, 540p, 552p, 607p, 613p, 622p, 631p, 644p],  
[ 607p, 610p, 622p, 637p, 643p, 652p, 701p, 714p],  
[ 637p, 640p, 652p, 707p, 713p, 722p, 731p, 744p],  
[ 707p, 710p, 722p, 737p, 743p, 752p, 801p, 814p],  
[ 737p, 740p, 752p, 807p, 813p, 822p, 831p, 844p],  
[ 807p, 810p, 822p, 837p, 843p, 852p, 901p, 914p],  
[ 837p, 840p, 852p, 907p, 913p, 922p, 931p, 944p],  
[ 907p, 910p, 922p, 937p, 943p, 952p, 1001p, 1014p],  
[ 937p, 940p, 952p, 1006p, 1012p, 1020p, 1028p, 1041p],  
[ 1007p, 1010p, 1020p, 1032p, 1038p, 1046p, 1054p, 1107p],  
[ 1037p, 1040p, 1050p, 1102p, 1108p, 1116p, 1124p, 1137p],  
[ 1107p, 1110p, 1120p, 1132p, 1138p, 1146p, 1154p, 1207x],  
[ 1207x, 1210x, 1220x, 1232x, 1238x, 1246x, 1254x, 107x]  
]  
stop_times_sunday: [  
[ -, -, -, -, -, 642a, 650a, 707a],  
[ -, -, -, -, 659a, 712a, 720a, 737a],  
[ 657a, 700a, 710a, 722a, 729a, 742a, 750a, 807a],  
[ 727a, 730a, 740a, 752a, 759a, 812a, 820a, 837a],  
[ 757a, 800a, 810a, 822a, 829a, 842a, 850a, 907a],  
[ 827a, 830a, 840a, 852a, 859a, 912a, 920a, 937a],  
[ 857a, 900a, 910a, 922a, 929a, 942a, 950a, 1007a],  
[ 927a, 930a, 940a, 952a, 959a, 1012a, 1020a, 1037a],  
[ 957a, 1000a, 1010a, 1022a, 1029a, 1042a, 1050a, 1107a],  
[ 1027a, 1030a, 1040a, 1052a, 1059a, 1112a, 1120a, 1137a],  
[ 1057a, 1100a, 1110a, 1122a, 1129a, 1142a, 1150a, 1207p],  
[ 1127a, 1130a, 1140a, 1152a, 1159a, 1212p, 1220p, 1237p],  
[ 1157a, 1200p, 1210p, 1222p, 1229p, 1242p, 1250p, 107p],  
[ 1227p, 1230p, 1240p, 1252p, 1259p, 112p, 120p, 137p],  
[ 1257p, 100p, 110p, 122p, 129p, 142p, 150p, 207p],  
[ 127p, 130p, 140p, 152p, 159p, 212p, 220p, 237p],  
[ 157p, 200p, 210p, 222p, 229p, 242p, 250p, 307p],  
[ 227p, 230p, 240p, 252p, 259p, 312p, 320p, 337p],  
[ 257p, 300p, 310p, 322p, 329p, 342p, 350p, 407p],  
[ 327p, 330p, 340p, 352p, 359p, 412p, 420p, 437p],  
[ 357p, 400p, 410p, 422p, 429p, 442p, 450p, 507p],  
[ 427p, 430p, 440p, 452p, 459p, 512p, 520p, 537p],  
[ 457p, 500p, 510p, 522p, 529p, 542p, 550p, 607p],  
[ 527p, 530p, 540p, 552p, 559p, 612p, 620p, 637p],  
[ 557p, 600p, 610p, 622p, 629p, 642p, 650p, 707p],  
[ 627p, 630p, 640p, 652p, 659p, 712p, 720p, 737p],  
[ 657p, 700p, 710p, 722p, 729p, 742p, 750p, 807p],  
[ 727p, 730p, 740p, 752p, 759p, 812p, 820p, 837p],  
[ 757p, 800p, 810p, 822p, 829p, 842p, 850p, 907p],  
[ 827p, 830p, 840p, 852p, 859p, 912p, 920p, 937p],  
[ 857p, 900p, 910p, 922p, 929p, 942p, 950p, 1007p],  
[ 957p, 1000p, 1010p, 1022p, 1029p, 1042p, 1050p, 1107p],  
[ 1057p, 1100p, 1110p, 1122p, 1129p, 1142p, 1150p, 1207x]  
]  
 
short_name: 81  
long_name: To Downtown Halifax  
time_points: [ 7125, 6216, 6564, 8214, 6087, 8414 ]  
between_stops:  
6216-6564: [ 6982, 6985, 8262 ]  
6564-8214: [ 6197, 6193, 6203, 8633, 8193, 8202, 8182, 8213, 8178, 8205, 8190 ]  
8214-6087: [ 8183, 8196, 8195, 8194, 8328, 8337, 8333, 8336, 8327, 8338 ]  
stop_times: [  
[ 610a, 620a, 627a, 637a, 647a, 649a],  
[ 640a, 650a, 657a, 708a, 725a, 727a],  
[ 710a, 720a, 728a, 739a, 756a, 758a],  
[ 740a, 750a, 758a, 809a, 826a, 828a],  
[ 810a, 820a, 828a, 839a, 856a, 858a],  
[ 840a, 850a, 858a, 909a, 926a, 928a],  
[ 910a, 920a, 928a, 939a, 956a, 958a],  
[ 940a, 950a, 958a, 1009a, 1026a, 1028a],  
[ 1010a, 1020a, 1028a, 1039a, 1056a, 1058a],  
[ 1040a, 1050a, 1058a, 1109a, 1126a, 1128a],  
[ 1110a, 1120a, 1128a, 1139a, 1156a, 1158a],  
[ 1140a, 1150a, 1158a, 1209p, 1226p, 1228p],  
[ 1210p, 1220p, 1228p, 1239p, 1256p, 1258p],  
[ 1240p, 1250p, 1258p, 109p, 126p, 128p],  
[ 110p, 120p, 128p, 139p, 156p, 158p],  
[ 140p, 150p, 158p, 209p, 226p, 228p],  
[ 210p, 220p, 228p, 239p, 256p, 258p],  
[ 240p, 250p, 258p, 309p, 326p, 328p],  
[ 310p, 320p, 328p, 339p, 356p, 358p],  
[ 340p, 350p, 358p, 409p, 426p, 428p],  
[ 414p, 424p, 432p, 443p, 500p, 502p],  
[ 444p, 454p, 502p, 513p, 530p, 532p],  
[ 514p, 524p, 532p, 543p, 600p, 602p],  
[ 544p, 554p, 602p, 613p, 623p, 625p],  
[ 610p, 620p, 624p, 635p, 645p, 647p],  
[ 640p, 650p, 654p, 705p, 715p, 717p],  
[ 710p, 720p, 724p, 735p, 745p, 747p],  
[ 740p, 750p, 754p, 805p, 815p, 817p]  
]  
 
short_name: 81  
long_name: To Hemlock Ravine  
time_points: [ 8414, 6105, 8184, 6563, 6219, 7125 ]  
between_stops:  
6105-8184: [ 6108, 6103, 6102, 6122, 8331, 8330, 8334, 8335, 8329 ]  
8184-6563: [ 8206, 8221, 8222, 8181, 8210, 8201, 8251, 8629, 8634, 6192, 6196, 6201, 6200, 6199, 6198 ]  
6563-6219: [ 6565, 6984, 6983 ]  
stop_times: [  
[ -, -, -, -, 600a, 610a],  
[ 603a, 606a, 616a, 626a, 630a, 640a],  
[ 633a, 636a, 646a, 656a, 700a, 710a],  
[ 655a, 658a, 710a, 725a, 730a, 740a],  
[ 725a, 728a, 740a, 755a, 800a, 810a],  
[ 755a, 758a, 810a, 825a, 830a, 840a],  
[ 825a, 828a, 840a, 855a, 900a, 910a],  
[ 855a, 858a, 910a, 925a, 930a, 940a],  
[ 925a, 928a, 940a, 955a, 1000a, 1010a],  
[ 955a, 958a, 1010a, 1025a, 1030a, 1040a],  
[ 1025a, 1028a, 1040a, 1055a, 1100a, 1110a],  
[ 1055a, 1058a, 1110a, 1125a, 1130a, 1140a],  
[ 1125a, 1128a, 1140a, 1155a, 1200p, 1210p],  
[ 1155a, 1158a, 1210p, 1225p, 1230p, 1240p],  
[ 1225p, 1228p, 1240p, 1255p, 100p, 110p],  
[ 1255p, 1258p, 110p, 125p, 130p, 140p],  
[ 125p, 128p, 140p, 155p, 200p, 210p],  
[ 155p, 158p, 210p, 225p, 230p, 240p],  
[ 225p, 228p, 240p, 255p, 300p, 310p],  
[ 255p, 258p, 310p, 325p, 330p, 340p],  
[ 322p, 325p, 337p, 356p, 404p, 414p],  
[ 352p, 355p, 407p, 426p, 434p, 444p],  
[ 422p, 425p, 437p, 456p, 504p, 514p],  
[ 452p, 455p, 507p, 526p, 534p, 544p],  
[ 525p, 528p, 540p, 555p, 600p, 610p],  
[ 600p, 602p, 612p, 625p, 630p, 640p],  
[ 630p, 632p, 642p, 655p, 700p, 710p],  
[ 700p, 702p, 712p, 725p, 730p, 740p]  
]  
 
short_name: 9  
long_name: To Mumford Terminal  
time_points: [ 8649, 8409, 6087, 6583, 7284 ]  
between_stops:  
6087-6583: [ 6089, 6116, 6091, 6127, 6094, 6110, 6119, 6128, 6580, 6588, 6584, 6583 ]  
6583-7284: [ 6585, 7096, 8560 ]  
8409-6087: [ 6096, 6113, 6124 ]  
8649-6087: [ 6096, 6113, 6124 ]  
stop_times: [  
[ 620a, -, 630a, 641a, 652a],  
[ 650a, -, 703a, 714a, 725a],  
[ 715a, -, 728a, 739a, 750a],  
[ 735a, -, 748a, 759a, 810a],  
[ 755a, -, 808a, 819a, 830a],  
[ 815a, -, 828a, 839a, 850a],  
[ 837a, -, 850a, 901a, 912a],  
[ 907a, -, 920a, 931a, 942a],  
[ 937a, -, 950a, 1001a, 1012a],  
[ 1007a, -, 1020a, 1031a, 1042a],  
[ 1037a, -, 1050a, 1101a, 1112a],  
[ 1107a, -, 1120a, 1131a, 1142a],  
[ 1137a, -, 1150a, 1201p, 1212p],  
[ 1207p, -, 1220p, 1231p, 1242p],  
[ 1237p, -, 1250p, 101p, 112p],  
[ 107p, -, 120p, 131p, 142p],  
[ 137p, -, 150p, 201p, 212p],  
[ 207p, -, 220p, 231p, 242p],  
[ 237p, -, 250p, 301p, 312p],  
[ 307p, -, 320p, 331p, 342p],  
[ 327p, -, 340p, 351p, 402p],  
[ 347p, -, 400p, 411p, 422p],  
[ 407p, -, 420p, 431p, 442p],  
[ 427p, -, 440p, 451p, 502p],  
[ 447p, -, 500p, 511p, 522p],  
[ 507p, -, 520p, 531p, 542p],  
[ 537p, -, 550p, 601p, 612p],  
[ 608p, -, 620p, 631p, 640p],  
[ 658p, -, 710p, 721p, 732p],  
[ 758p, -, 810p, 821p, 832p],  
[ -, 859p, 910p, 920p, 931p],  
[ -, 1000p, 1010p, 1019p, 1030p],  
[ -, 1100p, 1110p, 1119p, 1130p],  
[ -, 1200x, 1210x, 1219x, 1230x]  
]  
 
short_name: 9  
long_name: To Point Pleasant Park  
time_points: [ 7284, 7094, 6105, 8649 ]  
between_stops:  
7284-7094: [ 7274, 6409, 6403, 6407, 8552, 8563, 8553 ]  
7094-6105: [ 6581, 6582, 6586, 6587, 6100, 6120, 6109, 6095, 6090, 6107, 6115, 6088, 6104, 6125 ]  
6105-8649: [ 6108, 6103, 6102, 6114, 6097 ]  
stop_times: [  
[ 550a, 600a, 610a, 619a],  
[ 615a, 625a, 635a, 646a],  
[ 635a, 646a, 659a, 713a],  
[ 655a, 707a, 720a, 734a],  
[ 715a, 727a, 740a, 754a],  
[ 735a, 747a, 800a, 814a],  
[ 755a, 807a, 820a, 834a],  
[ 825a, 837a, 850a, 904a],  
[ 855a, 906a, 919a, 933a],  
[ 925a, 935a, 948a, 1002a],  
[ 955a, 1005a, 1018a, 1032a],  
[ 1025a, 1035a, 1048a, 1102a],  
[ 1055a, 1105a, 1118a, 1132a],  
[ 1125a, 1135a, 1148a, 1202p],  
[ 1155a, 1205p, 1218p, 1232p],  
[ 1225p, 1235p, 1248p, 102p],  
[ 1255p, 105p, 118p, 132p],  
[ 125p, 135p, 148p, 202p],  
[ 155p, 205p, 218p, 232p],  
[ 225p, 237p, 250p, 304p],  
[ 245p, 257p, 310p, 324p],  
[ 305p, 317p, 330p, 344p],  
[ 325p, 337p, 350p, 404p],  
[ 345p, 357p, 410p, 424p],  
[ 405p, 417p, 430p, 444p],  
[ 425p, 437p, 450p, 504p],  
[ 455p, 507p, 520p, 534p],  
[ 525p, 537p, 550p, 602p],  
[ 622p, 632p, 645p, 657p],  
[ 722p, 732p, 745p, 757p],  
[ 822p, 832p, 845p, -],  
[ 922p, 932p, 942p, -],  
[ 1022p, 1032p, 1042p, -],  
[ 1122p, 1132p, 1142p, -]  
]  
 
default: hfxfeed.zip  
 
hfxfeed.zip: hfxtable.yml createfeed.py  
./createfeed.py --input=hfxtable.yml --output=hfxfeed.zip  
 
ROUTE_FILES=1-to-dartmouth.yml 1-to-mumford.yml \  
2-to-downtown-via-north.yml 2-to-wedgewood-via-main.yml \  
3-to-shopping-malls.yml 3-to-manors.yml \  
4-to-farnham-gate-via-rosedale.yml 4-to-downtown-via-north.yml \  
5-to-springvale.yml 5-to-downtown.yml \  
6-to-stonehaven.yml 6-to-downtown.yml \  
7-robie-to-gottingen.yml 7-gottingen-to-robie.yml \  
9-to-point-pleasant-park.yml 9-to-mumford.yml \  
10-to-westphal.yml 10-to-dalhousie.yml \  
14-to-leiblin-park.yml 14-to-universities-downtown.yml \  
17-to-hospitals-universities.yml 17-to-lacewood.yml \  
18-to-smu.yml 18-to-lacewood.yml \  
20-to-herring-cove.yml 20-to-mumford-downtown.yml \  
21-to-timberlea.yml 21-to-lacewood-halifax.yml \  
23-to-timberlea.yml 23-to-mumford-halifax.yml \  
41-to-dalhousie.yml 41-to-bridge-terminal.yml \  
42-to-lacewood.yml 42-to-dalhousie.yml \  
52-to-bridge-terminal-burnside.yml 52-to-lacewood-chain-lake-drive.yml \  
58-to-lucien-drive.yml \  
80-to-bedford-halifax.yml 80-to-bedford-sackville.yml \  
81-to-downtown-halifax.yml 81-to-hemlock-ravine.yml  
 
hfxtable.yml: hfxtable.yml.in $(ROUTE_FILES) indent-route.pl  
cp hfxtable.yml.in hfxtable.yml  
@$(foreach ROUTE_FILE, $(ROUTE_FILES), \  
echo "Parsing $(ROUTE_FILE)"; \  
./indent-route.pl < $(ROUTE_FILE) >> hfxtable.yml;)  
 
clean:  
rm -f hfxtable.yml hfxfeed.zip *~  
 
=== Introduction ===  
 
This distribution contains everything required to build a basic google transit  
feed for Halifax Metro Transit, Nova Scotia, Canada. Note that it is woefully  
incomplete at the moment.  
 
Requirements: GNU Make, Perl, Python 2.5.  
 
=== Usage ===  
 
First, grab a copy of google transit feed tools:  
 
cd $HOME/src  
wget http://googletransitdatafeed.googlecode.com/files/transitfeed-1.1.7.tar.gz  
tar zxvf transitfeed-1.1.7.tar.gz  
 
Set PYTHONPATH to the python directory in the above checkout:  
 
export PYTHONPATH=$HOME/src/transitfeed-1.1.7/python  
 
Then just type "make" to build the feed. The output at the end is "feed.zip".  
For fun, you can view this feed using the snazzy transit feed view application:  
 
$HOME/src/transitfeed-1.1.7/python/schedule_viewer.py --feed=hfxfeed.zip  
 
=== Copyright ===  
 
With the exception of createfeed.py, which is licensed under the Apache Public  
License, please consider all software tools in distribution to be in the public  
domain. Use them for what you will.  
 
I believe the Metro Transit route data is considered factual information  
which can not be copyrighted. Note, however, that Metro Transit and/or  
the city of Halifax may have claim over its own name and other trademarks.  
 
#!/usr/bin/perl  
 
use strict;  
 
sub parse_time {  
my ($time) = @_;  
 
my ($hour, $minute);  
 
if ($time =~ /a\Z/) {  
$time =~ m/([0-9]+)([0-9][0-9])a/;  
($hour, $minute) = ($1, $2);  
} elsif ($time =~ /p\Z/) {  
$time =~ m/([0-9]+)([0-9][0-9])p/;  
($hour, $minute) = ($1, $2);  
if ($hour < 12) {  
$hour += 12;  
}  
} elsif ($time =~ /x\Z/) {  
$time =~ m/([0-9]+)([0-9][0-9])x/;  
($hour, $minute) = ($1, $2);  
if ($hour == 12) {  
$hour += 12;  
} else {  
$hour += 24;  
}  
} elsif ($time =~ /^\ *-\Z/) {  
($hour, $minute) = (0, 0);  
# no stop at this time  
} else {  
print "Should not happen! Time ('$time') misformed.\n";  
exit;  
}  
 
return ($hour, $minute);  
}  
 
my $num_intervals = $ARGV[0] or die "No num intervals given!";  
my $interval = $ARGV[1] or die "No interval given!";  
 
my @times;  
 
$_ = <STDIN>;  
print $_;  
 
if ($_ !~ /^\#/) {  
my @timestrs;  
if ($_ =~ m/\[(.*)\]/) {  
my $inner = $1;  
@timestrs = split (/\,/, $inner);  
 
} else {  
@timestrs = split /\ /;  
}  
 
foreach (@timestrs) {  
my ($hour, $minute) = parse_time($_);  
push @times, [ $hour, $minute ];  
}  
}  
 
for (my $i=1; $i<($num_intervals+1); $i++) {  
my $first = 1;  
foreach (@times) {  
my $mytime = $_;  
my ($hour, $minute) = (@$mytime[0], @$mytime[1]);  
if ($hour > 0 || $minute > 0) {  
$minute += $interval * $i;  
if ($minute > 59) {  
$hour += int($minute / 60);  
$minute = $minute % 60;  
if ($minute < 10) {  
$minute = "0" . $minute;  
}  
}  
}  
 
sub print_time {  
my ($hour, $minute) = @_;  
if ($hour == 0 && $minute == 0) {  
print "-";  
} else {  
if ($hour < 12) {  
print "$hour$minute" . "a";  
} else {  
if ($hour > 12) {  
$hour -= 12;  
}  
print "$hour$minute" . "p";  
}  
}  
}  
 
if (!$first) {  
print " ";  
print_time($hour, $minute);  
} else {  
$first = 0;  
print_time($hour, $minute);  
}  
}  
print "\n";  
}  
 
#!/usr/bin/python  
 
# Copyright (C) 2007 Google Inc.  
# Copyright (C) 2008-2009 William Lachance  
#  
# Licensed under the Apache License, Version 2.0 (the "License");  
# you may not use this file except in compliance with the License.  
# You may obtain a copy of the License at  
#  
# http://www.apache.org/licenses/LICENSE-2.0  
#  
# Unless required by applicable law or agreed to in writing, software  
# distributed under the License is distributed on an "AS IS" BASIS,  
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
# See the License for the specific language governing permissions and  
# limitations under the License.  
 
import transitfeed  
from transitfeed import ServicePeriod  
from optparse import OptionParser  
import yaml, sys, os.path  
import re  
 
stops = {}  
 
def ProcessOptions(schedule, options):  
 
# the follow features are REQUIRED  
agency_name = options.get('agency_name')  
agency_url = options.get('agency_url')  
agency_timezone = options.get('agency_timezone')  
 
service_periods = []  
 
service_periods.append(ServicePeriod(id="weekday"))  
service_periods[0].SetWeekdayService()  
service_periods.append(ServicePeriod(id="saturday"))  
service_periods[1].SetDayOfWeekHasService(5)  
service_periods.append(ServicePeriod(id="sunday"))  
service_periods[2].SetDayOfWeekHasService(6)  
 
# the service period options are, well, optional  
for service_period in service_periods:  
if options.get('start_date'):  
service_period.SetStartDate(options['start_date'])  
if options.get('end_date'):  
service_period.SetEndDate(options['end_date'])  
if options.get('add_date'):  
service_period.SetDateHasService(options['add_date'])  
if options.get('remove_date'):  
service_period.SetDateHasService(options['remove_date'],  
has_service=False)  
 
# Add all service period objects to the schedule  
schedule.SetDefaultServicePeriod(service_periods[0], validate=False)  
schedule.AddServicePeriodObject(service_periods[1], validate=False)  
schedule.AddServicePeriodObject(service_periods[2], validate=False)  
 
if not (agency_name and agency_url and agency_timezone):  
print "You must provide agency information"  
 
schedule.NewDefaultAgency(agency_name=agency_name, agency_url=agency_url,  
agency_timezone=agency_timezone)  
 
 
# Remove any stops from stopsdata that aren't serviced by any routes in  
# routedata.  
def PruneStops(stopsdata, routedata):  
stopset = set()  
for route in routedata:  
stopset.update(route['time_points'])  
for between_list in route['between_stops']:  
stopset.update(route['between_stops'][between_list])  
 
toprune = list()  
for i, stop in enumerate(stopsdata):  
if stop['stop_code'] not in stopset:  
print "Pruning unused stop %s " % stop['stop_code']  
toprune.append(i)  
 
# Prune the list in reverse order, as the indices will change otherwise.  
toprune.sort()  
toprune.reverse()  
for prunee in toprune:  
del stopsdata[prunee]  
 
def AddStops(schedule, stopsdata):  
for stopdata in stopsdata:  
stop_code = stopdata['stop_code']  
# we have to manually add the stop instead of using AddStop, cause  
# we want the stop_code  
stop_id = unicode(len(schedule.stops))  
stop = transitfeed.Stop(stop_id=stop_id, lat=stopdata['lat'],  
lng=stopdata['lng'], name=stopdata['name'],  
stop_code=stop_code)  
schedule.AddStopObject(stop)  
stops[stop_code] = stop  
 
 
def AddTripsToSchedule(schedule, route, routedata, service_id, stop_times):  
 
service_period = schedule.GetServicePeriod(service_id)  
timerex = re.compile('^(\d+)(\d\d)([a-z])$')  
 
for trip in stop_times:  
t = route.AddTrip(schedule, headsign=routedata['long_name'], service_period=service_period)  
 
if len(trip) > len(routedata['time_points']):  
print "Length of trip (%s) exceeds number of time points (%s)!" % (len(trip), len(routedata['time_points']))  
class StopTimesError(Exception): pass  
raise StopTimesError()  
else:  
trip_stops = [] # Build a list of (time, stop_code) tuples  
i = 0  
for stop_time in trip:  
matches = timerex.match(str(stop_time))  
if matches and len(matches.groups()) == 3:  
hour, minute, shift = (int(matches.group(1)),  
str(matches.group(2)),  
matches.group(3))  
if shift == 'p' and hour < 12:  
hour += 12  
elif shift == 'x':  
if hour == 12:  
hour += 12  
else:  
hour += 24  
 
# munge hours and minutes if they're < 10  
if hour < 10:  
hour = "0" + str(hour)  
 
clock_time = str(hour) + ":" + minute + ":00"  
seconds = transitfeed.TimeToSecondsSinceMidnight(clock_time)  
trip_stops.append((seconds, routedata['time_points'][i]) )  
elif re.search(r'^\-$', str(stop_time)):  
pass  
else:  
class InvalidStopTimeError(Exception): pass  
raise InvalidStopTimeError, 'Bad stoptime "%s"' % stop_time  
i = i + 1  
 
trip_stops.sort() # Sort by time  
prev_stop_code = None  
between_stops = routedata.get('between_stops')  
 
for (time, stop_code) in trip_stops:  
if prev_stop_code and between_stops:  
between_stop_list = between_stops.get('%s-%s' % (prev_stop_code, stop_code))  
if between_stop_list:  
for between_stop_code in between_stop_list:  
t.AddStopTime(stop=stops[between_stop_code])  
 
t.AddStopTime(stop=stops[stop_code], arrival_secs=time,  
departure_secs=time)  
prev_stop_code = stop_code  
 
 
 
def AddRouteToSchedule(schedule, routedata):  
r = schedule.AddRoute(short_name=str(routedata['short_name']),  
long_name=routedata['long_name'],  
route_type='Bus')  
AddTripsToSchedule(schedule, r, routedata, "weekday", routedata['stop_times'])  
if routedata.get('stop_times_saturday'):  
AddTripsToSchedule(schedule, r, routedata, "saturday", routedata['stop_times_saturday'])  
if routedata.get('stop_times_sunday'):  
AddTripsToSchedule(schedule, r, routedata, "sunday", routedata['stop_times_sunday'])  
 
def main():  
parser = OptionParser()  
parser.add_option('--input', dest='input',  
help='Path of input file')  
parser.add_option('--output', dest='output',  
help='Path of output file, should end in .zip')  
parser.set_defaults(output='feed.zip')  
(options, args) = parser.parse_args()  
 
schedule = transitfeed.Schedule()  
stream = open(options.input, 'r')  
data = yaml.load(stream)  
ProcessOptions(schedule, data['options'])  
PruneStops(data['stops'], data['routes'])  
AddStops(schedule, data['stops'])  
 
for route in data['routes']:  
AddRouteToSchedule(schedule, route)  
 
schedule.WriteGoogleTransitFeed(options.output)  
 
 
if __name__ == '__main__':  
main()  
 
options:  
start_date: 20080315  
end_date: 20081215  
remove_date: 20080704  
agency_name: Halifax Metro Transit  
agency_url: http://www.halifax.ca/metrotransit/  
agency_timezone: America/Halifax  
 
stops:  
# the following waypoints are derived from google maps / google earth  
- { name: Robie & Lady Hammond, stop_code: 8208, lat: 44.6647155, lng: -63.61677 }  
- { name: Kearney Lake & Grosvenor, stop_code: 7019, lat: 44.681611, lng: -63.667767 }  
- { name: Kearney Lake & Wedgewood, stop_code: 7023, lat: 44.681611, lng: -63.667767 }  
- { name: Lacewood Terminal, stop_code: 7087, lat: 44.661511, lng: -63.656975 }  
- { name: Lacewood Terminal, stop_code: 7086, lat: 44.661511, lng: -63.656975 }  
- { name: Mumford Road & Joseph Howe, stop_code: 6612, lat: 44.648528, lng: -63.629597 }  
- { name: Alma & Dutch Village, stop_code: 6032, lat: 44.659581, lng: -63.630681 }  
- { name: Dunbrack & Main, stop_code: 6597, lat: 44.652714, lng: -63.649692 }  
- { name: Joseph Howe Manor, stop_code: 8430, lat: 44.634822, lng: -63.576186 }  
- { name: J.H. MacKenzie Manor, stop_code: 6791, lat: 44.637589, lng: -63.571281 }  
- { name: Gordon B. Isnor Manor, stop_code: 6505, lat: 44.651589, lng: -63.585292 }  
- { name: Ross Street & Dunbrack, stop_code: 6601, lat: 44.676468, lng: -63.66354 }  
- { name: Dutch Village & Deal Street, stop_code: 6611, lat: 44.659069, lng: -63.631546 }  
- { name: Downs & Milson, stop_code: 6578, lat: 44.641788, lng: -63.636932 }  
- { name: Chebucto & Oxford (north bound), stop_code: 6396, lat: 44.648689, lng: -63.601871 }  
- { name: Chebucto & Oxford (south bound), stop_code: 6397, lat: 44.648689, lng: -63.601871 }  
- { name: Point Pleasant Park, stop_code: 8649, lat: 44.625298, lng: -63.56406 }  
- { name: Tower Road Turing Loop, stop_code: 8409, lat: 44.6259, lng: -63.574524 }  
# the following waypoints are derived from geobase  
- { name: Sunnyside (Bedford Highway & Dartmouth), stop_code: 6236, lat: 44.731726, lng: -63.657578 }  
- { name: Sunnyside (Bedford Highway & Dartmouth), stop_code: 6238, lat: 44.731726, lng: -63.657578 }  
- { name: Stonehaven & Glenmore, stop_code: 8361, lat: 44.635224, lng: -63.630198 }  
- { name: Seton Road & Bedford Highway (Mount Saint Vincent University), stop_code: 6216, lat: 44.670526, lng: -63.641589 }  
- { name: Seton Road & Bedford Highway (Mount Saint Vincent University), stop_code: 6219, lat: 44.670526, lng: -63.641589 }  
- { name: Walker Avenue & Old Sackville Road (Sackville Terminal), stop_code: 8260, lat: 44.769474, lng: -63.696749 }  
- { name: Cobequid Drive and Memory Lane (Cobequid Terminal), stop_code: 8646, lat: 44.753835, lng: -63.66313 }  
- { name: Cobequid Drive and Memory Lane (Cobequid Terminal), stop_code: 6445, lat: 44.753835, lng: -63.66313 }  
- { name: Ash Lake & Chain Lake Drive (TeleTech), stop_code: 6390, lat: 44.637817, lng: -63.664118 }  
- { name: Victoria Road & Highfield Park Drive (Highfield Terminal), stop_code: 6923, lat: 44.682821, lng: -63.590579 }  
- { name: Victoria Road & Highfield Park Drive (Highfield Terminal), stop_code: 6918, lat: 44.682821, lng: -63.590579 }  
- { name: Macdonald Avenue & Ilsley Avenue (near Metro Transit H.Q.), stop_code: 6949, lat: 44.695728, lng: -63.583946 }  
- { name: Macdonald Avenue & Ilsley Avenue (near Metro Transit H.Q.), stop_code: 7205, lat: 44.695728, lng: -63.583946 }  
- { name: Wright Avenue & Macdonald, stop_code: 7153, lat: 44.701754, lng: -63.600508 }  
- { name: Akerley & Colford, stop_code: 6767, lat: 44.716152, lng: -63.586565 }  
- { name: Cowie Hill & Ridge Valley, stop_code: 8167, lat: 44.63064, lng: -63.622718 }  
- { name: Cowie Hill & Ridge Valley, stop_code: 8168, lat: 44.63064, lng: -63.622718 }  
- { name: Juniper Crescent & Leiblin Drive, stop_code: 7143, lat: 44.595027, lng: -63.636932 }  
 
# major timepoints for the 20  
# this is a big lie... I have no actual idea exactly where the dockyards are  
# (not really wanting to waltz around a military installation with a gps),  
# and decided to put them on some random place on provo wallis  
- { name: Dockyard, stop_code: 6568, lat: 44.654879, lng: -63.580571, bad: 1 }  
- { name: Dockyard, stop_code: 6572, lat: 44.654879, lng: -63.580571, bad: 1 }  
- { name: Greystone (turning loop), stop_code: 6797, lat: 44.599446, lng: -63.614456 }  
- { name: Greystone (turning loop), stop_code: 6800, lat: 44.599446, lng: -63.614456 }  
- { name: Herring Cove & Fotherby, stop_code: 6851, lat: 44.588541, lng: -63.593062 }  
- { name: Herring Cove & Fotherby, stop_code: 6859, lat: 44.588541, lng: -63.593062 }  
- { name: Herring Cove (St. Paul's Ave & School), stop_code: 7121, lat: 44.571368, lng: -63.561739 }  
# the following waypoints are derived from openstreetmap  
- { name: Titus & Main, stop_code: 7166, lat: 44.6594, lng: -63.6343 }  
- { name: Spring Garden & South Park, stop_code: 8308, lat: 44.6422, lng: -63.5797 }  
- { name: Romans & Bayers, stop_code: 6197, lat: 44.6526, lng: -63.6214 }  
- { name: Coleman & Bayers, stop_code: 6193, lat: 44.6516, lng: -63.6178 }  
- { name: Connolly & Bayers, stop_code: 6203, lat: 44.6530, lng: -63.6132 }  
- { name: Upper Water & Cornwallis, stop_code: 8414, lat: 44.6539, lng: -63.5814 }  
- { name: Oxford & Young, stop_code: 7423, lat: 44.6543, lng: -63.6097 }  
- { name: Larry Uteck Boulevard & Bedford Highway, stop_code: 7125, lat: 44.6989, lng: -63.6639 }  
- { name: Dorothea & Lucien, stop_code: 6575, lat: 44.6784, lng: -63.5109, bad: 1 }  
- { name: Penhorn Terminal, stop_code: 7445, lat: 44.6730, lng: -63.5413, bad: 1 }  
- { name: Alderney Ferry Terminal, stop_code: 6031, lat: 44.6645, lng: -63.5685 }  
- { name: South & LeMarchant, stop_code: 7144, lat: 44.6359, lng: -63.5895 }  
- { name: Robie & Young, stop_code: 8269, lat: 44.6597, lng: -63.6021 }  
- { name: Robie & Spring Garden (north bound), stop_code: 8185, lat: 44.6407, lng: -63.5867 }  
- { name: Summer Street (QEII Health Sciences), stop_code: 8363, lat: 44.6457, lng: -63.5856, bad: 1 }  
- { name: Chain Lake & Lakelands, stop_code: 6160, lat: 44.6375, lng: -63.6691 }  
- { name: Greenwood Heights, stop_code: 6315, lat: 44.6553, lng: -63.7361, bad: 1 }  
- { name: Glengary Gardens, stop_code: 6722, lat: 44.6605, lng: -63.7467, bad: 1 }  
- { name: Summer Street (QEII Health Sciences), stop_code: 8364, lat: 44.6457, lng: -63.5856, bad: 1 }  
- { name: Chain Lake & Lakelands, stop_code: 6189, lat: 44.6375, lng: -63.6691 }  
- { name: Greenwood Heights, stop_code: 6317, lat: 44.6553, lng: -63.7361, bad: 1 }  
 
# the following were taken by wlach's GPS device  
 
# mumford rd. and chebucto, moving to terminal (going downtown afterwards)  
- { name: Mumford & Chebucto, stop_code: 7276, lat: 44.64591, lng: -63.61571 }  
 
# mumford rd. and chebucto, moving out of terminal (going away from dwntwn)  
- { name: Mumford & Leppert, stop_code: 7273, lat: 44.64604, lng: -63.61616 }  
 
# robie stops  
- { name: Robie & Spring Garden, stop_code: 8332, lat: 44.64055, lng: -63.58652 }  
- { name: Robie & Binney (north bound), stop_code: 8219, lat: 44.64235, lng: -63.58776 }  
- { name: Robie & Cherry (north bound), stop_code: 8179, lat: 44.64426, lng: -63.58869 }  
- { name: North & Gottingen, stop_code: 7346, lat: 44.65704, lng: -63.59146 }  
- { name: North & Gottingen, stop_code: 6781, lat: 44.65768, lng: -63.59172 }  
- { name: North & Gottingen, stop_code: 6769, lat: 44.65748, lng: -63.59123 }  
- { name: Robie & Bliss (south bound), stop_code: 8194, lat: 44.64158, lng: -63.58758 }  
- { name: Robie & Jubilee (south bound), stop_code: 8195, lat: 44.64328, lng: -63.58837 }  
- { name: Robie & Cherry (south bound), stop_code: 8196, lat: 44.64467, lng: -63.58923 }  
- { name: Robie & Shirley (south bound), stop_code: 8183, lat: 44.64612, lng: -63.59004 }  
- { name: Robie & Quinpool (south bound), stop_code: 8214, lat: 44.64768, lng: -63.59078 }  
- { name: Robie & Welsford (south bound), stop_code: 8190, lat: 44.64857, lng: -63.59114 }  
- { name: Robie & Cunard (south bound), stop_code: 8205, lat: 44.65038, lng: -63.59227 }  
- { name: Robie & Charles (south bound), stop_code: 8178, lat: 44.65305, lng: -63.59373 }  
- { name: Robie & North (south bound), stop_code: 8213, lat: 44.65498, lng: -63.59537 }  
- { name: Robie & May (south bound), stop_code: 8182, lat: 44.65603, lng: -63.59684 }  
- { name: Robie & Almon (south bound), stop_code: 8202, lat: 44.65759, lng: -63.59930 }  
- { name: Robie & Young (south bound), stop_code: 8193, lat: 44.65899, lng: -63.60136 }  
 
- { name: Robie & North, stop_code: 7341, lat: 44.65499, lng: -63.59449 }  
- { name: North & Windsor, stop_code: 7358, lat: 44.65234, lng: -63.59830 }  
- { name: North & Clifton, stop_code: 7353, lat: 44.65381, lng: -63.59615 }  
 
- { name: North & Gottingen, stop_code: 7347, lat: 44.65706, lng: -63.59150 }  
- { name: North & Maynard, stop_code: 7354, lat: 44.65610, lng: -63.59275 }  
- { name: North & Robie, stop_code: 7342, lat: 44.65448, lng: -63.59507 }  
- { name: North & Clifton, stop_code: 7352, lat: 44.65361, lng: -63.59630 }  
- { name: North & Windsor, stop_code: 7357, lat: 44.65211, lng: -63.59844 }  
- { name: Robie & Quinpool (north bound), stop_code: 8184, lat: 44.64795, lng: -63.59068 }  
- { name: Robie & Cunard (north bound), stop_code: 8206, lat: 44.65001, lng: -63.59176 }  
- { name: Robie & Garrick (north bound), stop_code: 8221, lat: 44.65171, lng: -63.59281 }  
- { name: Robie & Willow (north bound), stop_code: 8222, lat: 44.65372, lng: -63.59403 }  
- { name: Robie & North (north bound), stop_code: 8181, lat: 44.65494, lng: -63.59510 }  
- { name: Robie & May (north bound), stop_code: 8210, lat: 44.65609, lng: -63.59674 }  
- { name: Robie & Almon (north bound), stop_code: 8201, lat: 44.65724, lng: -63.59846 }  
- { name: Robie & Russell (north bound), stop_code: 8251, lat: 44.65879, lng: -63.60080 }  
 
- { name: North & Brunswick, stop_code: 7348, lat: 44.65833, lng: -63.59029 }  
- { name: Novalea & Duffus, stop_code: 6583, lat: 44.66729, lng: -63.60655 }  
- { name: Gottingen & Black, stop_code: 6785, lat: 44.65825, lng: -63.59252 }  
- { name: Gottingen & Bloomfield, stop_code: 6768, lat: 44.65982, lng: -63.59452 }  
- { name: Gottingen & Macara, stop_code: 6782, lat: 44.66113, lng: -63.59659 }  
# all of these are headed towards the mackay bridge  
- { name: Novalea & Livingstone, stop_code: 7377, lat: 44.66388, lng: -63.60046 }  
- { name: Novalea & Stanley, stop_code: 7381, lat: 44.66479, lng: -63.60187 }  
- { name: Novalea & Cabot, stop_code: 7374, lat: 44.66624, lng: -63.60420 }  
- { name: Novalea & Devonshire, stop_code: 7369, lat: 44.66717, lng: -63.60568 }  
- { name: Novalea & Vestby, stop_code: 7373, lat: 44.66871, lng: -63.60773 }  
- { name: Novalea & Leeds, stop_code: 7376, lat: 44.67042, lng: -63.61035 }  
- { name: Novalea (Samuel Prince Manor), stop_code: 7380, lat: 44.67160, lng: -63.61214 }  
- { name: Novalea (Samuel Prince Manor), stop_code: 7379, lat: 44.67160, lng: -63.61214 }  
- { name: Novalea (Samuel Prince Manor), stop_code: 7378, lat: 44.67176, lng: -63.61225 }  
# the following three are headed AWAY from the mackay bridge  
- { name: Novalea (Samuel Prince Manor), stop_code: 7367, lat: 44.67160, lng: -63.61234 }  
- { name: Novalea (Samuel Prince Manor), stop_code: 7368, lat: 44.67160, lng: -63.61234 }  
- { name: Novalea & Vestby, stop_code: 7382, lat: 44.66854, lng: -63.60771 }  
- { name: Novalea & Duffus, stop_code: 7370, lat: 44.66755, lng: -63.60648 }  
- { name: Novalea & Cabot, stop_code: 7362, lat: 44.66645, lng: -63.60485 }  
- { name: Novalea & Stanley, stop_code: 7365, lat: 44.66493, lng: -63.60239 }  
- { name: Novalea & Livingstone, stop_code: 7364, lat: 44.66404, lng: -63.60110 }  
- { name: Gottingen & Young, stop_code: 6770, lat: 44.66227, lng: -63.59841 }  
- { name: Gottingen & Sullivan, stop_code: 6783, lat: 44.66177, lng: -63.59768 }  
- { name: Gottingen & Almon, stop_code: 6776, lat: 44.66018, lng: -63.59534 }  
- { name: Gottingen & Black, stop_code: 6777, lat: 44.65850, lng: -63.59289 }  
- { name: North & Brunswick, stop_code: 7351, lat: 44.65810, lng: -63.58967 }  
- { name: North & Barrington (south bound), stop_code: 7343, lat: 44.65865, lng: -63.58818 }  
- { name: Barrington & Duke (south bound), stop_code: 6105, lat: 44.64973, lng: -63.57519 }  
- { name: Barrington & Duke (north bound), stop_code: 6087, lat: 44.65066, lng: -63.57561 }  
# headed towards the north end on barrington  
- { name: Barrington & Duke (north bound), stop_code: 6086, lat: 44.65041, lng: -63.57559 }  
- { name: Barrington & Cornwallis (north bound), stop_code: 6089, lat: 44.65436, lng: -63.58181 }  
# on barrington and north, just east of the macdonald bridge  
- { name: Barrington & North, stop_code: 6116, lat: 44.65875, lng: -63.58761 }  
# ditto, just west of the bridge  
- { name: Barrington & North, stop_code: 6091, lat: 44.66043, lng: -63.58963 }  
# headed west on barrington from north, up towards duffus (following the 9)  
- { name: Barrington & Russell, stop_code: 6127, lat: 44.66310, lng: -63.59233 }  
 
# now headed towards the macdonald bridge from the west, on barrington  
- { name: Barrington & Russell (south bound), stop_code: 6090, lat: 44.66327, lng: -63.59279 }  
- { name: Barrington (south bound), stop_code: 6107, lat: 44.66067, lng: -63.59007 }  
- { name: Barrington & North (south bound), stop_code: 6115, lat: 44.65940, lng: -63.58880 }  
- { name: Gottingen & Young (north bound), stop_code: 7366, lat: 44.66267, lng: -63.59887 }  
- { name: North & Brunswick (south bound), stop_code: 8638, lat: 44.65853, lng: -63.58986 }  
- { name: Barrington (south bound), stop_code: 6088, lat: 44.65675, lng: -63.58524 }  
- { name: Barrington & Cornwallis (south bound), stop_code: 6104, lat: 44.65441, lng: -63.58209 }  
- { name: Barrington & Cornwallis (south bound), stop_code: 6125, lat: 44.65348, lng: -63.58080 }  
- { name: Northridge Road (Richmond Manor), stop_code: 8165, lat: 44.67192, lng: -63.61618 }  
- { name: Northridge Road (Richmond Manor), stop_code: 8164, lat: 44.67193, lng: -63.61618 }  
- { name: Novalea & Sentinel, stop_code: 7361, lat: 44.67318, lng: -63.61473 }  
- { name: Novalea & Ridge, stop_code: 7360, lat: 44.67323, lng: -63.61551 }  
 
- { name: Windsor & Charles (south bound), stop_code: 8559, lat: 44.65146, lng: -63.59704 }  
- { name: Hunter & Cunard (south bound), stop_code: 6545, lat: 44.65035, lng: -63.59433 }  
- { name: Hunter & Cunard (north bound), stop_code: 6544, lat: 44.65039, lng: -63.59469 }  
- { name: Windsor & Charles (north bound), stop_code: 8558, lat: 44.65127, lng: -63.59656 }  
 
- { name: Windsor & North (north bound), stop_code: 8554, lat: 44.65252, lng: -63.59893 }  
- { name: Windsor & Summit (north bound), stop_code: 8568, lat: 44.65307, lng: -63.60000 }  
- { name: Windsor & Almon (north bound), stop_code: 8556, lat: 44.65420, lng: -63.60240 }  
- { name: Windsor & London (north bound), stop_code: 8572, lat: 44.65505, lng: -63.60432 }  
- { name: Windsor & Young (north bound), stop_code: 8571, lat: 44.65581, lng: -63.60568 }  
 
- { name: Windsor & Bayers (north bound), stop_code: 8574, lat: 44.65717, lng: -63.60773 }  
- { name: Windsor & Ashton (north bound), stop_code: 8550, lat: 44.65829, lng: -63.60944 }  
- { name: Windsor & Maxwell (north bound), stop_code: 8549, lat: 44.66015, lng: -63.61264 }  
- { name: Windsor & Hood (north bound), stop_code: 8567, lat: 44.66087, lng: -63.61576 }  
- { name: Windsor & Connolly (north bound), stop_code: 8570, lat: 44.66040, lng: -63.61868 }  
- { name: Windsor & Strawberry (north bound), stop_code: 8552, lat: 44.66066, lng: -63.62020 }  
 
- { name: Windsor & Kempt (north bound), stop_code: 8563, lat: 44.66192, lng: -63.62175 }  
- { name: Windsor & Kempt (north bound), stop_code: 8553, lat: 44.66236, lng: -63.62236 }  
- { name: Windsor & Connaught, stop_code: 8560, lat: 44.66040, lng: -63.62022 }  
 
- { name: Windsor & Connolly (south bound), stop_code: 8551, lat: 44.66026, lng: -63.61910 }  
- { name: Windsor & Hood (south bound), stop_code: 8562, lat: 44.66074, lng: -63.61580 }  
- { name: Windsor & Maxwell (south bound), stop_code: 8565, lat: 44.66006, lng: -63.61291 }  
- { name: Windsor & Ashton (south bound), stop_code: 8573, lat: 44.65826, lng: -63.60962 }  
- { name: Windsor & Bayers (south bound), stop_code: 8555, lat: 44.65711, lng: -63.60793 }  
 
- { name: Windsor & Young (south bound), stop_code: 8561, lat: 44.65604, lng: -63.60638 }  
- { name: Windsor & London (south bound), stop_code: 8564, lat: 44.65511, lng: -63.60471 }  
- { name: Windsor & Almon (south bound), stop_code: 8557, lat: 44.65430, lng: -63.60298 }  
# - { name: Windsor & Summit (south bound), stop_code: 856x, lat: 44.65322, lng: -63.60061 }  
- { name: Windsor & North (south bound), stop_code: 8566, lat: 44.65227, lng: -63.59863 }  
 
- { name: Cogswell & Brunswick (north bound), stop_code: 6455, lat: 44.65094, lng: -63.57983 }  
- { name: Cogswell & Gottingen (north bound), stop_code: 6773, lat: 44.65095, lng: -63.58157 }  
- { name: Gottingen & Cornwallis (north bound), stop_code: 6778, lat: 44.65198, lng: -63.58330 }  
- { name: Gottingen & Cunard (north bound), stop_code: 6779, lat: 44.65325, lng: -63.58519 }  
- { name: Gottingen & Gerrish (north bound), stop_code: 6775, lat: 44.65407, lng: -63.58622 }  
- { name: Gottingen & Charles (north bound), stop_code: 6787, lat: 44.65573, lng: -63.58866 }  
 
- { name: Gottingen & Charles (south bound), stop_code: 6774, lat: 44.65557, lng: -63.58865 }  
- { name: Gottingen & Gerrish (south bound), stop_code: 6780, lat: 44.65489, lng: -63.58771 }  
- { name: Gottingen & Cunard (south bound), stop_code: 6786, lat: 44.65361, lng: -63.58581 }  
- { name: Gottigen & Cornwallis (south bound), stop_code: 6790, lat: 44.65200, lng: -63.58332 }  
- { name: Gottingen & Falkland (south bound), stop_code: 6771, lat: 44.65089, lng: -63.58185 }  
 
# following stops are for routes heading from dartmouth to mumford  
- { name: North & Dublin, stop_code: 7344, lat: 44.65061, lng: -63.60074 }  
- { name: North & Oxford, stop_code: 7356, lat: 44.64929, lng: -63.60253 }  
- { name: Chebucto & Connolly, stop_code: 6405, lat: 44.64818, lng: -63.60497 }  
- { name: Chebucto & Connaught, stop_code: 6404, lat: 44.64759, lng: -63.60729 }  
- { name: Chebucto & Arm Crescent, stop_code: 6413, lat: 44.64631, lng: -63.61047 }  
- { name: Chebucto & Quinn, stop_code: 6414, lat: 44.64602, lng: -63.61234 }  
- { name: Mumford & Chebucto, stop_code: 7275, lat: 44.64592, lng: -63.61570 }  
- { name: Mumford Terminal, stop_code: 7284, lat: 44.64786, lng: -63.62035 }  
- { name: Mumford Terminal, stop_code: 7285, lat: 44.64786, lng: -63.62035 }  
- { name: Mumford Terminal, stop_code: 8643, lat: 44.64786, lng: -63.62035 }  
 
# following stops are for routes heading from mumford towards dartmouth  
- { name: Mumford & Leppert, stop_code: 7274, lat: 44.64599, lng: -63.61618 }  
- { name: Chebucto & Quinn, stop_code: 6409, lat: 44.64571, lng: -63.61272 }  
- { name: Chebucto & Arm Crescent, stop_code: 6403, lat: 44.64599, lng: -63.61064 }  
- { name: Chebucto & Newton, stop_code: 6407, lat: 44.64664, lng: -63.60843 }  
- { name: Chebucto & Elm, stop_code: 6406, lat: 44.64787, lng: -63.60564 }  
- { name: North & Oxford, stop_code: 7355, lat: 44.64896, lng: -63.60284 }  
- { name: North & Dublin, stop_code: 7345, lat: 44.65013, lng: -63.60110 }  
 
# following stops are for routes heading from scotia square towards spring garden  
- { name: Barrington & George, stop_code: 6108, lat: 44.64848, lng: -63.57482 }  
- { name: Barrington & Prince, stop_code: 6084, lat: 44.64760, lng: -63.57435 }  
- { name: Barrington & Sackville, stop_code: 6103, lat: 44.64660, lng: -63.57368 }  
- { name: Barrington & Blowers, stop_code: 6102, lat: 44.64557, lng: -63.57322 }  
- { name: Barrington & Spring Garden, stop_code: 6122, lat: 44.64454, lng: -63.57279 }  
 
# following stops heading from scotia square to water street terminal / ferry terminal  
- { name: George & Hollis, stop_code: 6733, lat: 44.64851, lng: -63.57341 }  
- { name: Water Street Terminal, stop_code: 8435, lat: 44.64922, lng: -63.57225 }  
 
# following stops are for routes heading on spring garden, barrington to robie  
- { name: Spring Garden & Queen, stop_code: 8331, lat: 44.64348, lng: -63.57551 }  
- { name: Spring Garden & Dresden Row, stop_code: 8330, lat: 44.64288, lng: -63.57759 }  
- { name: Spring Garden & South Park, stop_code: 8334, lat: 44.64247, lng: -63.57942 }  
- { name: Spring Garden & Summer, stop_code: 8335, lat: 44.64144, lng: -63.58316 }  
- { name: Spring Garden & Carlton, stop_code: 8329, lat: 44.64105, lng: -63.58481 }  
 
# following stop data was collected going along robie, onto south, onto barrington  
- { name: Robie & Coburg, stop_code: 8186, lat: 44.63979, lng: -63.58671 }  
- { name: Robie & University, stop_code: 8188, lat: 44.63776, lng: -63.58559 }  
- { name: Robie & South, stop_code: 8296, lat: 44.63665, lng: -63.58400 }  
- { name: South & Wellington, stop_code: 8303, lat: 44.63715, lng: -63.58187 }  
- { name: South & Tower, stop_code: 8305, lat: 44.63778, lng: -63.57941 }  
- { name: South & South Park, stop_code: 8295, lat: 44.63840, lng: -63.57627 }  
- { name: South & Queen, stop_code: 8299, lat: 44.63886, lng: -63.57421 }  
- { name: South & Barrington, stop_code: 8293, lat: 44.63972, lng: -63.57165 }  
- { name: South & Barrington, stop_code: 6096, lat: 44.64023, lng: -63.57041 }  
- { name: Barrington & Morris, stop_code: 6113, lat: 44.64155, lng: -63.57109 }  
- { name: Barrington & Spring Garden, stop_code: 6124, lat: 44.64404, lng: -63.57232 }  
 
# following stop is what you get continuing into south, towards lemarchant  
- { name: Robie & South, stop_code: 8317, lat: 44.63633, lng: -63.58584 }  
 
# following stop data was collected going along barrington, onto south, onto robie  
- { name: Barrington & Morris, stop_code: 6114, lat: 44.64188, lng: -63.57140 }  
- { name: Barrington & South, stop_code: 6097, lat: 44.64024, lng: -63.57055 }  
- { name: South & Church, stop_code: 8294, lat: 44.63949, lng: -63.57253 }  
- { name: South & Queen, stop_code: 8292, lat: 44.63894, lng: -63.57462 }  
- { name: South & South Park, stop_code: 8300, lat: 44.63836, lng: -63.57711 }  
- { name: South & Tower, stop_code: 8301, lat: 44.63795, lng: -63.57863 }  
- { name: South & Wellington, stop_code: 8298, lat: 44.63723, lng: -63.58183 }  
- { name: South & Robie, stop_code: 8297, lat: 44.63684, lng: -63.58358 }  
- { name: South & Robie, stop_code: 8220, lat: 44.63685, lng: -63.58488 }  
- { name: Robie & University, stop_code: 8187, lat: 44.63857, lng: -63.58576 }  
 
# ~quinpool and oxford, heading to spring garden and robie  
- { name: Quinpool & Oxford, stop_code: 7412, lat: 44.64424, lng: -63.60031 }  
- { name: Oxford & Norwood, stop_code: 7419, lat: 44.64296, lng: -63.59948 }  
- { name: Oxford & Jubilee, stop_code: 7409, lat: 44.64031, lng: -63.59805 }  
- { name: Oxford & Jennings, stop_code: 7402, lat: 44.63898, lng: -63.59738 }  
- { name: Coburg & Oxford, stop_code: 6453, lat: 44.63778, lng: -63.59617 }  
- { name: Coburg & Lilac, stop_code: 6447, lat: 44.63842, lng: -63.59361 }  
- { name: Coburg & Lemarchant, stop_code: 6449, lat: 44.63903, lng: -63.59137 }  
- { name: Coburg & Henry, stop_code: 6454, lat: 44.63957, lng: -63.58905 }  
- { name: Coburg & Robie, stop_code: 6452, lat: 44.64007, lng: -63.58723 }  
 
# from ~ Young and Robie to the Bedford Hwy  
- { name: Young & Monaghan, stop_code: 8629, lat: 44.65816, lng: -63.60450 }  
- { name: Young & Windsor, stop_code: 8634, lat: 44.65684, lng: -63.60654 }  
- { name: Bayers & Dublin, stop_code: 6192, lat: 44.65630, lng: -63.60857 }  
- { name: Bayers & Oxford, stop_code: 6196, lat: 44.65519, lng: -63.60994 }  
- { name: Bayers & Connolly, stop_code: 6201, lat: 44.65365, lng: -63.61245 }  
- { name: Bayers & Connaught, stop_code: 6200, lat: 44.65252, lng: -63.61456 }  
- { name: Bayers & Vaughan, stop_code: 6199, lat: 44.65202, lng: -63.61846 }  
- { name: Bayers & Romans, stop_code: 6198, lat: 44.65318, lng: -63.62294 }  
# forgot to get the stop code for this one, it's between  
#- { name: Village at Bayers Road, stop_code: xxxx, lat: 44.65380, lng: -63.62662 }  
- { name: Village at Bayers Road, stop_code: 6563, lat: 44.65469, lng: -63.62804 }  
- { name: Desmond & Scott, stop_code: 6565, lat: 44.65629, lng: -63.62758 }  
- { name: Joseph Howe & Dutch Village, stop_code: 6984, lat: 44.65830, lng: -63.62902 }  
- { name: Joseph Howe & Dutch Village, stop_code: 6983, lat: 44.66037, lng: -63.62809 }  
 
# from ~bedford highway to young and robie (partial)  
- { name: Joseph Howe & Dutch Village, stop_code: 6982, lat: 44.65839, lng: -63.62920 }  
- { name: Joseph Howe & Scot, stop_code: 6985, lat: 44.65692, lng: -63.62963 }  
- { name: Scot & Desmond, stop_code: 8262, lat: 44.65638, lng: -63.62809 }  
- { name: Village at Bayers Road, stop_code: 6564, lat: 44.65470, lng: -63.62797 }  
- { name: Young & Monaghan, stop_code: 8633, lat: 44.65808, lng: -63.60435 }  
 
# robie -> barrington on spring garden  
- { name: Spring Garden & Carlton, stop_code: 8328, lat: 44.64091, lng: -63.58551 }  
- { name: Spring Garden & Summer, stop_code: 8337, lat: 44.64141, lng: -63.58288 }  
- { name: Spring Garden & South Park, stop_code: 8333, lat: 44.64217, lng: -63.57999 }  
- { name: Spring Garden & Dresden Row, stop_code: 8336, lat: 44.64302, lng: -63.57741 }  
- { name: Spring Garden & Queen, stop_code: 8327, lat: 44.64342, lng: -63.57547 }  
- { name: Spring Garden & Barrington, stop_code: 8338, lat: 44.64393, lng: -63.57325 }  
 
# barrington, from spring garden to duke  
- { name: Barrington & Sackville, stop_code: 6121, lat: 44.64590, lng: -63.57344 }  
# I have marked down 6086 as being the gotime id for the stop below, but  
# that can't be right: 6086 is for barrington & duke (south bound). the  
# schedules say so  
#- { name: Barrington & Prince, stop_code: xxxx, lat: 44.64671, lng: -63.57383 }  
- { name: Barrington & George, stop_code: 6106, lat: 44.64871, lng: -63.57474 }  
 
# dartmouth  
- { name: Bridge Terminal (Dartmouth Sportsplex), stop_code: 6842, lat: 44.67016, lng: -63.57624 }  
- { name: Bridge Terminal (Dartmouth Sportsplex), stop_code: 7151, lat: 44.67016, lng: -63.57624 }  
- { name: Bridge Terminal (Dartmouth Sportsplex), stop_code: 8640, lat: 44.67016, lng: -63.57624 }  
- { name: Bridge Terminal (Dartmouth Sportsplex), stop_code: 8641, lat: 44.67016, lng: -63.57624 }  
- { name: Bridge Terminal (Dartmouth Sportsplex), stop_code: 8642, lat: 44.67016, lng: -63.57624 }  
 
# following the #10, from bridge terminal to mic mac mall  
- { name: Wyse & Dawson, stop_code: 8616, lat: 44.67162, lng: -63.58015 }  
- { name: Boland & Cairn, stop_code: 6304, lat: 44.67344, lng: -63.57982 }  
- { name: Boland & Victoria, stop_code: 6303, lat: 44.67510, lng: -63.57797 }  
- { name: Boland & Frances, stop_code: 8428, lat: 44.67642, lng: -63.57897 }  
- { name: Slayter & Woodland, stop_code: 8587, lat: 44.67776, lng: -63.57929 }  
- { name: Sheridan & Woodland, stop_code: 8580, lat: 44.67969, lng: -63.57693 }  
- { name: Frederick & Woodland, stop_code: 8586, lat: 44.68060, lng: -63.57579 }  
- { name: Laurier & Woodland, stop_code: 8582, lat: 44.68202, lng: -63.57399 }  
- { name: Woodland & Micmac, stop_code: 7214, lat: 44.68501, lng: -63.56801 }  
- { name: Micmac & Glencarin, stop_code: 7213, lat: 44.68667, lng: -63.56355 }  
- { name: Mic Mac Terminal (Mic Mac Mall), stop_code: 7219, lat: 44.68536, lng: -63.56081 }  
 
# following the #10, Micmac Mall -> Tacoma Center  
- { name: Micmac & Brookdale, stop_code: 7210, lat: 44.68456, lng: -63.55681 }  
# the following stop doesn't come between 15:30-17:30, leave it out until  
# we can express this in GTFS (or alternately, just leave this mostly  
# useless top out indefinitely-- 7173 comes right after it)  
#- { name: Main & Gordon, stop_code: 7174, lat: 44.68137, lng: -63.54327 }  
- { name: Main & Gordon, stop_code: 7173, lat: 44.68169, lng: -63.54023 }  
- { name: Main & Hartlen, stop_code: 6834, lat: 44.68168, lng: -63.53737 }  
- { name: Tacoma Center, stop_code: 8369, lat: 44.68039, lng: -63.53747 }  
 
# following the #10, Tacoma Center -> Woodlawn & Main  
- { name: Valleyfield & Oakwood, stop_code: 8416, lat: 44.67932, lng: -63.53463 }  
- { name: Spikenard & Margaree Parkway, stop_code: 8323, lat: 44.68022, lng: -63.53151 }  
- { name: Spikenard & Woodlawn, stop_code: 8320, lat: 44.68092, lng: -63.52837 }  
- { name: Spikenard & Woodlawn, stop_code: 8603, lat: 44.68174, lng: -63.52757 }  
- { name: Woodlawn & Main, stop_code: 8598, lat: 44.68351, lng: -63.52875 }  
 
# Following #10, Woodlawn & Main -> Inverary & Strath  
- { name: Booth & Main, stop_code: 6306, lat: 44.68593, lng: -63.52412 }  
- { name: Booth & Scotsburn, stop_code: 6305, lat: 44.68786, lng: -63.52550 }  
- { name: Booth & David, stop_code: 7053, lat: 44.68977, lng: -63.52740 }  
- { name: Kennedy, stop_code: 7052, lat: 44.69088, lng: -63.52839 }  
- { name: Kennedy, stop_code: 7051, lat: 44.69151, lng: -63.53071 }  
- { name: Caladonia, stop_code: 6369, lat: 44.69199, lng: -63.53286 }  
- { name: Caladonia & Dumbarton, stop_code: 6591, lat: 44.69308, lng: -63.53429 }  
- { name: Kincardine & Dumbarton, stop_code: 6592, lat: 44.69247, lng: -63.53681 }  
- { name: Kincardine & Greenoch, stop_code: 7057, lat: 44.68988, lng: -63.53612 }  
- { name: Inverary & Strath, stop_code: 6974, lat: 44.68847, lng: -63.53599 }  
 
# following #10, iverary & strath -> tacoma  
- { name: Strath & Raymoor, stop_code: 8160, lat: 44.68717, lng: -63.53591 }  
- { name: Raymoor, stop_code: 8161, lat: 44.68559, lng: -63.53323 }  
- { name: Raymoor & Main, stop_code: 8162, lat: 44.68428, lng: -63.53158 }  
- { name: Weyburn & Main, stop_code: 8483, lat: 44.68355, lng: -63.53236 }  
- { name: Weyburn & Athabaskan, stop_code: 8484, lat: 44.68215, lng: -63.53176 }  
- { name: Weyburn & Spikenard, stop_code: 8482, lat: 44.68078, lng: -63.53111 }  
- { name: Spikenard & Valleyfield, stop_code: 8319, lat: 44.67957, lng: -63.53369 }  
- { name: Tacoma Center, stop_code: 8368, lat: 44.67997, lng: -63.53717 }  
 
# following #10, tacoma -> micmac  
- { name: Hartlen & Main, stop_code: 6835, lat: 44.68165, lng: -63.53725 }  
- { name: Major & Main, stop_code: 7175, lat: 44.68195, lng: -63.54001 }  
- { name: Micmac & Brookdlae, stop_code: 7209, lat: 44.68466, lng: -63.55729 }  
- { name: Micmac & Glencairn, stop_code: 7218, lat: 44.68576, lng: -63.56118 }  
 
# following #10, micmac -> bridge terminal  
- { name: Micmac & Glencairn, stop_code: 7211, lat: 44.68671, lng: -63.56299 }  
- { name: Micmac & Woodland, stop_code: 7215, lat: 44.68532, lng: -63.56827 }  
- { name: Woodland & Laurier, stop_code: 8581, lat: 44.68175, lng: -63.57462 }  
- { name: Woodland & Pinehill, stop_code: 8583, lat: 44.68072, lng: -63.57587 }  
- { name: Woodland & Sheridan, stop_code: 8584, lat: 44.67979, lng: -63.57703 }  
- { name: Woodland & Slayter, stop_code: 8585, lat: 44.67778, lng: -63.57946 }  
- { name: Victoria & Francse, stop_code: 8424, lat: 44.67623, lng: -63.57887 }  
- { name: Victoria & Boland, stop_code: 8419, lat: 44.67515, lng: -63.57724 }  
- { name: Nantucket & Victoria, stop_code: 8429, lat: 44.67296, lng: -63.57360 }  
- { name: Thistle & Victoria, stop_code: 8427, lat: 44.67185, lng: -63.57202 }  
- { name: Thistle & Victoria, stop_code: 8389, lat: 44.67106, lng: -63.57202 }  
- { name: Wyse & Thistle, stop_code: 8392, lat: 44.66898, lng: -63.57436 }  
- { name: Wyse & Thistle, stop_code: 8614, lat: 44.66898, lng: -63.57540 }  
 
# ~coburg and Henry -> quinpool and oxford  
- { name: Coburg & Henry, stop_code: 6448, lat: 44.63967, lng: -63.58873 }  
- { name: Coburg & Lemarchant, stop_code: 6450, lat: 44.63914, lng: -63.59097 }  
- { name: Coburg & Lilac, stop_code: 6451, lat: 44.63833, lng: -63.59454 }  
- { name: Oxford & Coburg, stop_code: 7401, lat: 44.63822, lng: -63.59685 }  
- { name: Oxford & Jennings, stop_code: 7403, lat: 44.63940, lng: -63.59741 }  
- { name: Oxford & Cornwall, stop_code: 7410, lat: 44.64129, lng: -63.59843 }  
- { name: Oxford & Norwood, stop_code: 7406, lat: 44.64270, lng: -63.59924 }  
- { name: Quinpool & Oxford, stop_code: 7421, lat: 44.64444, lng: -63.60015 }  
 
# ~ quinpool and oxford, to young and oxford  
- { name: Oxford & Allan, stop_code: 7404, lat: 44.64699, lng: -63.60142 }  
 
# south & dalhousie -> spring garden & south park (following #10)  
- { name: South & Dalhousie, stop_code: 8304, lat: 44.63488, lng: -63.59253 }  
- { name: Beaufort & South, stop_code: 6206, lat: 44.63380, lng: -63.59510 }  
- { name: Beaufort & Oakland, stop_code: 6209, lat: 44.63272, lng: -63.59301 }  
- { name: Beaufort & Inglis, stop_code: 6208, lat: 44.63124, lng: -63.58960 }  
- { name: Inglis & Greenwood, stop_code: 6961, lat: 44.63194, lng: -63.58596 }  
- { name: Inglis & Robie, stop_code: 6962, lat: 44.63272, lng: -63.58260 }  
- { name: Inglis & Wellington, stop_code: 6965, lat: 44.63311, lng: -63.58089 }  
- { name: Tower & Inglis, stop_code: 6969, lat: 44.63378, lng: -63.57829 }  
- { name: South Park & Victoria, stop_code: 8314, lat: 44.63568, lng: -63.57665 }  
- { name: South Park & South, stop_code: 8306, lat: 44.63739, lng: -63.57736 }  
- { name: South Park & South, stop_code: 8307, lat: 44.63846, lng: -63.57769 }  
- { name: South Park & University, stop_code: 8309, lat: 44.64016, lng: -63.57856 }  
- { name: South Park & Spring Garden, stop_code: 8312, lat: 44.64203, lng: -63.57956 }  
 
# south park and spring garden -> robie and inglis (following #10)  
- { name: Spring Garden & South Park, stop_code: 8308, lat: 44.64172, lng: -63.57946 }  
- { name: South Park & Morris, stop_code: 8313, lat: 44.64017, lng: -63.57877 }  
- { name: South Park & South, stop_code: 8311, lat: 44.63837, lng: -63.57793 }  
- { name: South Park & Fenwick, stop_code: 8315, lat: 44.63687, lng: -63.57716 }  
# (two between stops with no gotime id #'s...)  
- { name: Inglis (SMU), stop_code: 6960, lat: 44.63326, lng: -63.58090 }  
- { name: Inglish & Robie, stop_code: 6966, lat: 44.63280, lng: -63.58262 }  
 
# robie & young -> Leeds & Rosemeade  
- { name: Robie & Young, stop_code: 8192, lat: 44.66001, lng: -63.60277 }  
- { name: Robie & Livingstone, stop_code: 8209, lat: 44.66097, lng: -63.60419 }  
- { name: Robie & Stanley, stop_code: 8217, lat: 44.66197, lng: -63.60570 }  
- { name: Robie & Cabot, stop_code: 8204, lat: 44.66341, lng: -63.60783 }  
- { name: Robie & Duffus, stop_code: 8207, lat: 44.66454, lng: -63.60950 }  
- { name: Robie & Lady Hammond, stop_code: 8180, lat: 44.66556, lng: -63.61093 }  
- { name: Robie & Normandy, stop_code: 8211, lat: 44.66670, lng: -63.61254 }  
- { name: Leeds & Rosemeade, stop_code: 7131, lat: 44.66823, lng: -63.61368 }  
 
# Leeds & Rosemeade -> Robie & Young  
- { name: Leeds & Rosemeade, stop_code: 7133, lat: 44.66856, lng: -63.61347 }  
- { name: Robie & Normandy, stop_code: 8212, lat: 44.66695, lng: -63.61309 }  
- { name: Robie & Lady Hammond, stop_code: 8208, lat: 44.66551, lng: -63.61100 }  
- { name: Robie & Cabot, stop_code: 8203, lat: 44.66370, lng: -63.60844 }  
- { name: Robie & Stanley, stop_code: 8197, lat: 44.66168, lng: -63.60543 }  
- { name: Robie & Kaye, stop_code: 8218, lat: 44.66006, lng: -63.60306 }  
 
# Quinpool & Robie -> Quinpool & Connaught  
- { name: Quinpool & Robie, stop_code: 8151, lat: 44.64716, lng: -63.59127 }  
- { name: Quinpool & Monastery, stop_code: 8138, lat: 44.64620, lng: -63.59458 }  
- { name: Quinpool & Preston, stop_code: 8148, lat: 44.64528, lng: -63.59772 }  
- { name: Quinpool & Oxford, stop_code: 8137, lat: 44.64446, lng: -63.60074 }  
- { name: Quinpool & Beech, stop_code: 8134, lat: 44.64408, lng: -63.60197 }  
- { name: Quinpool & Poplar, stop_code: 8146, lat: 44.64353, lng: -63.60386 }  
 
# Quinpool & Connaught -> Quinpool & Robie  
- { name: Quinpool & Poplar, stop_code: 8135, lat: 44.64339, lng: -63.60391 }  
- { name: Quinpool & Beech, stop_code: 8133, lat: 44.64389, lng: -63.60237 }  
- { name: Quinpool & Oxford, stop_code: 8136, lat: 44.64460, lng: -63.59996 }  
- { name: Quinpool & Preston, stop_code: 8147, lat: 44.64531, lng: -63.59756 }  
- { name: Quinpool & Vernon, stop_code: 8149, lat: 44.64639, lng: -63.59360 }  
- { name: Quinpool & Robie, stop_code: 8150, lat: 44.64702, lng: -63.59167 }  
 
# heading away from bayer's road, onto gottingen (at least for #21)  
- { name: Young & Isleville, stop_code: 8632, lat: 44.66144, lng: -63.59985 }  
 
# heading towards bayer's road, from gottingen (at least for #21)  
- { name: Young & Agricola, stop_code: 8631, lat: 44.66096, lng: -63.60080 }  
 
# robie and lady hammond -> barrington, following the #9  
- { name: Robie & Lady Hammond, stop_code: 7094, lat: 44.66531, lng: -63.60980 }  
- { name: Duffus & Isleville, stop_code: 6581, lat: 44.66669, lng: -63.60707 }  
- { name: Novalea & Duffus, stop_code: 6582, lat: 44.66782, lng: -63.60558 }  
- { name: Albert & Duffus, stop_code: 6586, lat: 44.66926, lng: -63.60375 }  
- { name: Duffus & Barrington, stop_code: 6587, lat: 44.67051, lng: -63.60189 }  
- { name: Barrington & Marginal, stop_code: 6100, lat: 44.66868, lng: -63.60024 }  
- { name: Barrington & Richmond, stop_code: 6120, lat: 44.66799, lng: -63.59873 }  
- { name: Barrington & Hannover, stop_code: 6109, lat: 44.66677, lng: -63.59710 }  
- { name: Barrington & Young, stop_code: 6095, lat: 44.66502, lng: -63.59504 }  
 
# barrington -> robie and lady hammond, following the #9  
- { name: Barrington & Young, stop_code: 6094, lat: 44.66523, lng: -63.59504 }  
- { name: Barrington & Hanover, stop_code: 6110, lat: 44.66667, lng: -63.59676 }  
- { name: Barrington & Richmond, stop_code: 6119, lat: 44.66803, lng: -63.59848 }  
- { name: Barrington & Marginal, stop_code: 6128, lat: 44.66892, lng: -63.60026 }  
- { name: Barrington & Duffus, stop_code: 6580, lat: 44.67064, lng: -63.60203 }  
- { name: Duffus & Albert, stop_code: 6588, lat: 44.66975, lng: -63.60318 }  
- { name: Duffus & Acadia, stop_code: 6584, lat: 44.66852, lng: -63.60486 }  
- { name: Duffus & Novalea, stop_code: 6583, lat: 44.66728, lng: -63.60654 }  
- { name: Duffus & Agricola, stop_code: 6585, lat: 44.66585, lng: -63.60852 }  
- { name: Robie & Lady Hammond, stop_code: 7096, lat: 44.66546, lng: -63.61008 }  
 
 
routes:  
 
#!/usr/bin/perl  
 
use strict;  
 
my $first = 1;  
while (<STDIN>) {  
if ($first) {  
$first = 0;  
print " - $_";  
} else {  
print " $_";  
}  
}  
 
#!/usr/bin/perl  
 
use strict;  
 
my $first = 1;  
my $prev_comment = 0;  
while (<STDIN>) {  
if ($_ !~ /^\#/) {  
if (!$first && !$prev_comment) {  
print ",\n";  
} else {  
$first = 0;  
$prev_comment = 0;  
}  
chomp;  
my @times = split /\ +/;  
print " [ ";  
my $first = 1;  
foreach (@times) {  
if (!$first) {  
print ", ";  
} else {  
$first = 0;  
}  
print $_;  
}  
print "]";  
} else {  
# yes, this conditional is loaded with assumptions...  
print ",\n" . $_;  
$prev_comment = 1;  
}  
}  
 
 
 Binary files a/origin-src/wlach-libroutez-272ef93.tar.gz and /dev/null differ
*.o  
*.routez  
*~  
.*.swp  
aclocal.m4  
autom4te.cache  
config.log  
config.mk  
config.status  
configure  
libroutez.so  
python/libroutez/tripgraph.py  
python/libroutez/tripgraph_wrap_py.cc  
python/libroutez/_tripgraph.so  
ruby/routez.so  
ruby/routez_wrap_rb.cc  
ruby/routez_wrap_rb.o  
tags  
examples/testgraph  
 
=== Current maintainer and primary author ===  
 
William Lachance <wrlach@gmail.com>  
 
=== Contributors ===  
 
Brandon Martin Anderson <badhill@gmail.com>  
- Core concepts of a trip planning library (in graphserver:  
http://graphserver.sourceforge.net)  
- Python OSM parsing library  
 
Peter McCurdy <petermccurdy@alumni.uwaterloo.ca>  
- Support for delaying walking to a stop at the start of a trip.  
 
Jason Madigan <jason@jasonmadigan.com>  
- Some updates to the README regarding building, and updates to  
the ruby examples.  
 
Copyright (c) 2008-2009 William Lachance, Brandon Martin Anderson, and others.  
 
Permission is hereby granted, free of charge, to any person  
obtaining a copy of this software and associated documentation  
files (the "Software"), to deal in the Software without  
restriction, including without limitation the rights to use,  
copy, modify, merge, publish, distribute, sublicense, and/or sell  
copies of the Software, and to permit persons to whom the  
Software is furnished to do so, subject to the following  
conditions:  
 
The above copyright notice and this permission notice shall be  
included in all copies or substantial portions of the Software.  
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,  
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES  
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND  
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT  
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,  
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING  
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR  
OTHER DEALINGS IN THE SOFTWARE.  
 
include config.mk  
 
default: libroutez.so examples/loadgraph examples/testgraph \  
python/libroutez/tripgraph.py python/libroutez/_tripgraph.so \  
ruby/routez.so  
 
include install.mk  
 
# Always always compile with fPIC  
CFLAGS += -fPIC  
CXXFLAGS += -fPIC  
 
# libroutez should be compiled as a shared library by default  
ifeq (${OS},MACOS)  
LDFLAGS += -dynamiclib  
else  
LDFLAGS += -shared  
endif  
 
config.mk:  
@echo "Please run ./configure. Stop."  
@exit 1  
 
%.o: %.cc  
g++ $< -c -o $@ $(CXXFLAGS) $(PYTHON_CFLAGS) $(RUBY_CFLAGS) -D WVTEST_CONFIGURED -I./include -I./wvtest/cpp -g  
@g++ $< -MM $(CXXFLAGS) $(PYTHON_CFLAGS) $(RUBY_CFLAGS) -D WVTEST_CONFIGURED -I./include -I./wvtest/cpp > $*.d  
@mv -f $*.d $*.d.tmp  
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d  
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \  
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d  
@rm -f $*.d.tmp  
 
TRIPGRAPH_OBJECTS=lib/tripgraph.o lib/trippath.o lib/tripstop.o lib/serviceperiod.o  
 
# libroutez: the main library  
libroutez.so: $(TRIPGRAPH_OBJECTS)  
g++ $(TRIPGRAPH_OBJECTS) $(LDFLAGS) -o libroutez.so -fPIC -g  
 
# python bindings  
python/libroutez/tripgraph.py python/libroutez/tripgraph_wrap_py.cc: tripgraph.i  
swig -classic -c++ -python -I./include -outdir python/libroutez -o python/libroutez/tripgraph_wrap_py.cc $<  
python/libroutez/_tripgraph.so: libroutez.so python/libroutez/tripgraph_wrap_py.o  
g++ -o $@ python/libroutez/tripgraph_wrap_py.o libroutez.so $(LDFLAGS) $(PYTHON_LDFLAGS) -fPIC  
 
# ruby bindings  
ruby/routez_wrap_rb.cc: routez.i tripgraph.i  
swig -c++ -ruby -I./include -o $@ $<  
 
ruby/routez.so: libroutez.so ruby/routez_wrap_rb.o  
g++ -o ruby/routez.so ruby/routez_wrap_rb.o libroutez.so $(LDFLAGS) $(RUBY_LDFLAGS) -I./include -fPIC  
 
# stupid test programs  
examples/loadgraph: examples/loadgraph.o libroutez.so  
g++ $< -o $@ libroutez.so -fPIC -g -I./include  
examples/testgraph: examples/testgraph.o libroutez.so  
g++ $< -o $@ libroutez.so -fPIC -g -I./include  
 
# unit test suite  
TEST_OBJS=t/tripgraph.t.o t/tripstop.t.o t/all.t.o  
WVTEST_OBJS=wvtest/cpp/wvtest.o wvtest/cpp/wvtestmain.o  
t/all.t: $(TEST_OBJS) $(WVTEST_OBJS) libroutez.so  
g++ $(TEST_OBJS) $(WVTEST_OBJS) -o $@ libroutez.so -fPIC -g  
 
.PHONY: test test-cpp test-python  
test: test-cpp test-python  
 
test-cpp: t/all.t  
LD_LIBRARY_PATH=$(PWD) valgrind --tool=memcheck wvtest/wvtestrun t/all.t  
 
test-python: python/libroutez/tripgraph.py python/libroutez/_tripgraph.so  
LD_LIBRARY_PATH=$(PWD) PYTHONPATH=$(PWD)/t:$(PWD)/python:$(PYTHONPATH) wvtest/wvtestrun python wvtest/python/wvtestmain.py pytest.py  
 
clean:  
rm -f *.so lib/*.o python/*.pyc */*.pyc examples/testgraph \  
python/libroutez/_tripgraph.so python/libroutez/tripgraph.py \  
python/libroutez/tripgraph_wrap_py.cc python/libroutez/*.o \  
ruby/routez.so ruby/*.o ruby/routez_wrap_rb.cc \  
wvtest/cpp/*.o wvtest/cpp/*.d \  
t/*.o t/*.d t/all.t *.d  
 
-include $(TRIPGRAPH_OBJECTS:.o=.d)  
 
=== About ===  
 
libroutez is a library written to help plan trips. Currently, its focus is  
on providing directions for using public transit, but it could be easily  
extended to cover other things (e.g. cycle-path planning). Specifically,  
it provides an interface to solving the following problems:  
 
- Finding the closest point in a road/transportation network to a specific  
latitude-longitude pair.  
- Finding the shortest path between two points in a road/transportation  
network.  
 
The design of libroutez is based on the following principles:  
 
- Focus on solving user and developer problems, not data structures or  
algorithms. For example, though libroutez uses the astar algorithm internally,  
we try to expose the interface to that through a simple method called  
"find_path".  
- Be extensible, but only in response to demonstrative developer need.  
- Be fast. libroutez uses an internal graph representation that, after being  
generated, can be loaded very quickly on program startup. Trips on a modest  
sized transit network can be generated in a fraction of a second on modern  
hardware (and there are plans to speed things up further).  
- Minimize memory use. Obviously the scale of public transit systems will  
incur some overhead here, but we want to be maximally useful on embedded  
systems and virtual servers where such resources may be scarce.  
- Minimize dependancies. For example, we don't assume the user wants to use a  
PostGRES database to store trip planning data (though they can if the want to).  
libroutez itself has no run-time dependancies beyond the C++ standard library.  
 
The libroutez has utility functions for converting Google Transit Feed  
(http://code.google.com/p/googletransitdatafeed) and OpenStreetMap  
(http://openstreetmap.org) data into its own format. It should be very easy  
to add a simple converter for your preferred data type.  
 
=== Setup and use ===  
 
These instructions assume you are on a UNIX-based system (e.g. Linux or  
MacOS X).  
 
1. Download and install the following packages:  
- Boost  
- Probably any recent version should do. We need shared_ptr, unordered_set,  
and unordered_map (unordered_map.hpp is included in debian/ubuntu packages  
libboost1.37-dev & libboost1.38-dev)  
- Google Transit Data Feed (http://code.google.com/p/googletransitdatafeed/)  
- As of this writing you need what's in SVN, as it has a fix that I made  
to actually handle interpolated stops correctly. The next version after  
1.1.9 should have my fix.  
- SWIG  
- A recentish version is desirable. I used 1.3.36.  
 
Helpful hint: To install a python package in a local prefix, do:  
 
"python setup.py install --home=$HOME --prefix=" when inside the package  
 
You may need to set PYTHONPATH to $HOME/lib/python first.  
 
2. Build the C++ graph module and the bindings.  
 
The usual...  
 
- ./autogen.sh && ./configure && make  
 
For an install into your home directory, try running ./configure like so:  
 
- ./configure --prefix=$HOME --libdir=$HOME/lib  
 
or maybe:  
 
- ./configure --prefix=$HOME --libdir=$HOME/lib64 # (for many 64-bit systems)  
 
3. Set up your language environment.  
 
You can either 'make install' to install the binding source to the library  
directory you chose with './configure', or set your library and ruby/python  
path to the libroutez source directory of your choice. e.g.:  
 
export LD_LIBRARY_PATH=/path/to/libroutez and  
export PYTHONPATH=/path/to/libroutez/python  
export RUBYLIB=/path/to/libroutez/ruby  
 
(setting RUBYLIB is only necessary if you want to use ruby, python is used  
by the graph creation utility, so you almost certainly do want that in your  
path)  
 
4. Build a graph.  
 
To reduce application start up time, libroutez uses a custom graph format  
which is created from GTFS and OpenStreetMap data. The creategraph utility  
is used to create this.  
 
The invocation is pretty simple. If you want to create a graph file called  
'mygraph.routez', simply invoke creategraph.py as follows:  
 
./creategraph.py /path/to/gtfsfeed.zip --osm="/path/to/osmfile.osm" \  
mygraph.routez mygraph-gtfsmapping.yml  
 
Want some sample data to play with? You can download the combination of  
William Lachance's Halifax GTFS and Geobase data:  
 
- http://wlach.masalalabs.ca/hfxfeed.zip  
- http://wlach.masalalabs.ca/greater-hrm-geobase.osm.gz  
 
The Halifax GTFS feed is produced by me, based on information provided  
by the city of Halifax. For more information, please see:  
http://github.com/wlach/halifax-transit-feed.  
 
The OSM data is derived from the GeoBase dataset provided by the  
government of Canada, and is distributed under the following terms:  
http://geobase.ca/geobase/en/licence.jsp  
 
5. Starting playing with the library.  
 
Now that you've built a graph, you can start planning trips. Try the  
'testgraph' mini program in examples. The following corresponds to  
a trip from Cogswell and Maynard to Glengarry Gardens at 9am on Monday,  
September 14th 2009 in Halifax, Nova Scotia, Canada:  
 
"testgraph mygraph.routez 44.649942 -63.583457 44.6605 -63.7467 1252933200"  
 
You should get a bunch of directions in "routezspeak" in response. :) Note that  
no attempt is currently made to prettify the output, but hopefully this will at  
least give you a starting point (perhaps that would be a fun little first  
project for someone who wants to contribute?). Correlating the descriptive  
information contained within a Google Transit feed with libroutez's internal  
data structures will necessitate using the gtfs mapping yaml file generated  
by the creategraph utility.  
 
For those who like programming in ruby and python, there are examples of both  
in the same directory as 'testgraph'.  
 
=== Contributing ===  
 
Contributions to libroutez are gratefully accepted. The easiest thing to do  
is fork my repository on github (http://github.com/wlach/libroutez), apply  
your change (make sure to add your name and nature of contribution to  
AUTHORS), then either email me (at wrlach@gmail.com) or the libroutez mailing  
list (http://groups.google.com/group/libroutez) to let us know about what you  
did. Patch files sent directly to wrlach@gmail.com are also welcome.  
 
In order for changes to be committed, they will need to be licensed under the  
same terms as the rest of libroutez (the MIT license). Please note that you  
consent to this in your git commit message or mail the libroutez mailing list  
saying that this (or all) your contributions are released under the MIT  
license.  
 
# ===========================================================================  
# http://autoconf-archive.cryp.to/ax_with_prog.html  
# ===========================================================================  
#  
# SYNOPSIS  
#  
# AX_WITH_PROG([VARIABLE],[program],[VALUE-IF-NOT-FOUND],[PATH])  
#  
# DESCRIPTION  
#  
# Locates an installed program binary, placing the result in the precious  
# variable VARIABLE. Accepts a present VARIABLE, then --with-program, and  
# failing that searches for program in the given path (which defaults to  
# the system path). If program is found, VARIABLE is set to the full path  
# of the binary; if it is not found VARIABLE is set to VALUE-IF-NOT-FOUND  
# if provided, unchanged otherwise.  
#  
# A typical example could be the following one:  
#  
# AX_WITH_PROG(PERL,perl)  
#  
# NOTE: This macro is based upon the original AX_WITH_PYTHON macro from  
# Dustin J. Mitchell <dustin@cs.uchicago.edu>.  
#  
# LAST MODIFICATION  
#  
# 2008-05-05  
#  
# COPYLEFT  
#  
# Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>  
# Copyright (c) 2008 Dustin J. Mitchell <dustin@cs.uchicago.edu>  
#  
# Copying and distribution of this file, with or without modification, are  
# permitted in any medium without royalty provided the copyright notice  
# and this notice are preserved.  
 
AC_DEFUN([AX_WITH_PROG],[  
AC_PREREQ([2.61])  
 
pushdef([VARIABLE],$1)  
pushdef([EXECUTABLE],$2)  
pushdef([VALUE_IF_NOT_FOUND],$3)  
pushdef([PATH_PROG],$4)  
 
AC_ARG_VAR(VARIABLE,Absolute path to EXECUTABLE executable)  
 
AS_IF(test -z "$VARIABLE",[  
AC_MSG_CHECKING(whether EXECUTABLE executable path has been provided)  
AC_ARG_WITH(EXECUTABLE,AS_HELP_STRING([--with-EXECUTABLE=[[[[PATH]]]]],absolute path to EXECUTABLE executable), [  
AS_IF([test "$withval" != "yes"],[  
VARIABLE="$withval"  
AC_MSG_RESULT($VARIABLE)  
],[  
VARIABLE=""  
AC_MSG_RESULT([no])  
])  
],[  
AC_MSG_RESULT([no])  
])  
 
AS_IF(test -z "$VARIABLE",[  
AC_PATH_PROG([]VARIABLE[],[]EXECUTABLE[],[]VALUE_IF_NOT_FOUND[],[]PATH_PROG[])  
])  
])  
 
popdef([PATH_PROG])  
popdef([VALUE_IF_NOT_FOUND])  
popdef([EXECUTABLE])  
popdef([VARIABLE])  
])  
 
# ===========================================================================  
# http://www.nongnu.org/autoconf-archive/ax_python_devel.html  
# ===========================================================================  
#  
# SYNOPSIS  
#  
# AX_PYTHON_DEVEL([version])  
#  
# DESCRIPTION  
#  
# Note: Defines as a precious variable "PYTHON_VERSION". Don't override it  
# in your configure.ac.  
#  
# This macro checks for Python and tries to get the include path to  
# 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS)  
# output variables. It also exports $(PYTHON_EXTRA_LIBS) and  
# $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code.  
#  
# You can search for some particular version of Python by passing a  
# parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please  
# note that you *have* to pass also an operator along with the version to  
# match, and pay special attention to the single quotes surrounding the  
# version number. Don't use "PYTHON_VERSION" for this: that environment  
# variable is declared as precious and thus reserved for the end-user.  
#  
# This macro should work for all versions of Python >= 2.1.0. As an end  
# user, you can disable the check for the python version by setting the  
# PYTHON_NOVERSIONCHECK environment variable to something else than the  
# empty string.  
#  
# If you need to use this macro for an older Python version, please  
# contact the authors. We're always open for feedback.  
#  
# LICENSE  
#  
# Copyright (c) 2009 Sebastian Huber <sebastian-huber@web.de>  
# Copyright (c) 2009 Alan W. Irwin <irwin@beluga.phys.uvic.ca>  
# Copyright (c) 2009 Rafael Laboissiere <rafael@laboissiere.net>  
# Copyright (c) 2009 Andrew Collier <colliera@ukzn.ac.za>  
# Copyright (c) 2009 Matteo Settenvini <matteo@member.fsf.org>  
# Copyright (c) 2009 Horst Knorr <hk_classes@knoda.org>  
#  
# This program is free software: you can redistribute it and/or modify it  
# under the terms of the GNU General Public License as published by the  
# Free Software Foundation, either version 3 of the License, or (at your  
# option) any later version.  
#  
# This program is distributed in the hope that it will be useful, but  
# WITHOUT ANY WARRANTY; without even the implied warranty of  
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General  
# Public License for more details.  
#  
# You should have received a copy of the GNU General Public License along  
# with this program. If not, see <http://www.gnu.org/licenses/>.  
#  
# As a special exception, the respective Autoconf Macro's copyright owner  
# gives unlimited permission to copy, distribute and modify the configure  
# scripts that are the output of Autoconf when processing the Macro. You  
# need not follow the terms of the GNU General Public License when using  
# or distributing such scripts, even though portions of the text of the  
# Macro appear in them. The GNU General Public License (GPL) does govern  
# all other use of the material that constitutes the Autoconf Macro.  
#  
# This special exception to the GPL applies to versions of the Autoconf  
# Macro released by the Autoconf Archive. When you make and distribute a  
# modified version of the Autoconf Macro, you may extend this special  
# exception to the GPL to apply to your modified version as well.  
 
AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL])  
AC_DEFUN([AX_PYTHON_DEVEL],[  
#  
# Allow the use of a (user set) custom python version  
#  
AC_ARG_VAR([PYTHON_VERSION],[The installed Python  
version to use, for example '2.3'. This string  
will be appended to the Python interpreter  
canonical name.])  
 
AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]])  
if test -z "$PYTHON"; then  
AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path])  
PYTHON_VERSION=""  
fi  
 
#  
# Check for a version of Python >= 2.1.0  
#  
AC_MSG_CHECKING([for a version of Python >= '2.1.0'])  
ac_supports_python_ver=`$PYTHON -c "import sys; \  
ver = sys.version.split ()[[0]]; \  
print (ver >= '2.1.0')"`  
if test "$ac_supports_python_ver" != "True"; then  
if test -z "$PYTHON_NOVERSIONCHECK"; then  
AC_MSG_RESULT([no])  
AC_MSG_FAILURE([  
This version of the AC@&t@_PYTHON_DEVEL macro  
doesn't work properly with versions of Python before  
2.1.0. You may need to re-run configure, setting the  
variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG,  
PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.  
Moreover, to disable this check, set PYTHON_NOVERSIONCHECK  
to something else than an empty string.  
])  
else  
AC_MSG_RESULT([skip at user request])  
fi  
else  
AC_MSG_RESULT([yes])  
fi  
 
#  
# if the macro parameter ``version'' is set, honour it  
#  
if test -n "$1"; then  
AC_MSG_CHECKING([for a version of Python $1])  
ac_supports_python_ver=`$PYTHON -c "import sys; \  
ver = sys.version.split ()[[0]]; \  
print (ver $1)"`  
if test "$ac_supports_python_ver" = "True"; then  
AC_MSG_RESULT([yes])  
else  
AC_MSG_RESULT([no])  
AC_MSG_ERROR([this package requires Python $1.  
If you have it installed, but it isn't the default Python  
interpreter in your system path, please pass the PYTHON_VERSION  
variable to configure. See ``configure --help'' for reference.  
])  
PYTHON_VERSION=""  
fi  
fi  
 
#  
# Check if you have distutils, else fail  
#  
AC_MSG_CHECKING([for the distutils Python package])  
ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`  
if test -z "$ac_distutils_result"; then  
AC_MSG_RESULT([yes])  
else  
AC_MSG_RESULT([no])  
AC_MSG_ERROR([cannot import Python module "distutils".  
Please check your Python installation. The error was:  
$ac_distutils_result])  
PYTHON_VERSION=""  
fi  
 
#  
# Check for Python include path  
#  
AC_MSG_CHECKING([for Python include path])  
if test -z "$PYTHON_CPPFLAGS"; then  
python_path=`$PYTHON -c "import distutils.sysconfig; \  
print (distutils.sysconfig.get_python_inc ());"`  
if test -n "${python_path}"; then  
python_path="-I$python_path"  
fi  
PYTHON_CPPFLAGS=$python_path  
fi  
AC_MSG_RESULT([$PYTHON_CPPFLAGS])  
AC_SUBST([PYTHON_CPPFLAGS])  
 
#  
# Check for Python library path  
#  
AC_MSG_CHECKING([for Python library path])  
if test -z "$PYTHON_LDFLAGS"; then  
# (makes two attempts to ensure we've got a version number  
# from the interpreter)  
ac_python_version=`cat<<EOD | $PYTHON -  
 
# join all versioning strings, on some systems  
# major/minor numbers could be in different list elements  
from distutils.sysconfig import *  
ret = ''  
for e in get_config_vars ('VERSION'):  
if (e != None):  
ret += e  
print (ret)  
EOD`  
 
if test -z "$ac_python_version"; then  
if test -n "$PYTHON_VERSION"; then  
ac_python_version=$PYTHON_VERSION  
else  
ac_python_version=`$PYTHON -c "import sys; \  
print (sys.version[[:3]])"`  
fi  
fi  
 
# Make the versioning information available to the compiler  
AC_DEFINE_UNQUOTED([HAVE_PYTHON], ["$ac_python_version"],  
[If available, contains the Python version number currently in use.])  
 
# First, the library directory:  
ac_python_libdir=`cat<<EOD | $PYTHON -  
 
# There should be only one  
import distutils.sysconfig  
for e in distutils.sysconfig.get_config_vars ('LIBDIR'):  
if e != None:  
print (e)  
break  
EOD`  
 
# Before checking for libpythonX.Y, we need to know  
# the extension the OS we're on uses for libraries  
# (we take the first one, if there's more than one fix me!):  
ac_python_soext=`$PYTHON -c \  
"import distutils.sysconfig; \  
print (distutils.sysconfig.get_config_vars('SO')[[0]])"`  
 
# Now, for the library:  
ac_python_soname=`$PYTHON -c \  
"import distutils.sysconfig; \  
print (distutils.sysconfig.get_config_vars('LDLIBRARY')[[0]])"`  
 
# Strip away extension from the end to canonicalize its name:  
ac_python_library=`echo "$ac_python_soname" | sed "s/${ac_python_soext}$//"`  
 
# This small piece shamelessly adapted from PostgreSQL python macro;  
# credits goes to momjian, I think. I'd like to put the right name  
# in the credits, if someone can point me in the right direction... ?  
#  
if test -n "$ac_python_libdir" -a -n "$ac_python_library" \  
-a x"$ac_python_library" != x"$ac_python_soname"  
then  
# use the official shared library  
ac_python_library=`echo "$ac_python_library" | sed "s/^lib//"`  
PYTHON_LDFLAGS="-L$ac_python_libdir -l$ac_python_library"  
else  
# old way: use libpython from python_configdir  
ac_python_libdir=`$PYTHON -c \  
"from distutils.sysconfig import get_python_lib as f; \  
import os; \  
print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"`  
PYTHON_LDFLAGS="-L$ac_python_libdir -lpython$ac_python_version"  
fi  
 
if test -z "PYTHON_LDFLAGS"; then  
AC_MSG_ERROR([  
Cannot determine location of your Python DSO. Please check it was installed with  
dynamic libraries enabled, or try setting PYTHON_LDFLAGS by hand.  
])  
fi  
fi  
AC_MSG_RESULT([$PYTHON_LDFLAGS])  
AC_SUBST([PYTHON_LDFLAGS])  
 
#  
# Check for site packages  
#  
AC_MSG_CHECKING([for Python site-packages path])  
if test -z "$PYTHON_SITE_PKG"; then  
PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \  
print (distutils.sysconfig.get_python_lib(0,0));"`  
fi  
AC_MSG_RESULT([$PYTHON_SITE_PKG])  
AC_SUBST([PYTHON_SITE_PKG])  
 
#  
# libraries which must be linked in when embedding  
#  
AC_MSG_CHECKING(python extra libraries)  
if test -z "$PYTHON_EXTRA_LIBS"; then  
PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \  
conf = distutils.sysconfig.get_config_var; \  
print (conf('LOCALMODLIBS') + ' ' + conf('LIBS'))"`  
fi  
AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])  
AC_SUBST(PYTHON_EXTRA_LIBS)  
 
#  
# linking flags needed when embedding  
#  
AC_MSG_CHECKING(python extra linking flags)  
if test -z "$PYTHON_EXTRA_LDFLAGS"; then  
PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \  
conf = distutils.sysconfig.get_config_var; \  
print (conf('LINKFORSHARED'))"`  
fi  
AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])  
AC_SUBST(PYTHON_EXTRA_LDFLAGS)  
 
#  
# final check to see if everything compiles alright  
#  
AC_MSG_CHECKING([consistency of all components of python development environment])  
# save current global flags  
ac_save_LIBS="$LIBS"  
ac_save_CPPFLAGS="$CPPFLAGS"  
LIBS="$ac_save_LIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LDFLAGS $PYTHON_EXTRA_LIBS"  
CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"  
AC_LANG_PUSH([C])  
AC_LINK_IFELSE([  
AC_LANG_PROGRAM([[#include <Python.h>]],  
[[Py_Initialize();]])  
],[pythonexists=yes],[pythonexists=no])  
AC_LANG_POP([C])  
# turn back to default flags  
CPPFLAGS="$ac_save_CPPFLAGS"  
LIBS="$ac_save_LIBS"  
 
AC_MSG_RESULT([$pythonexists])  
 
if test ! "x$pythonexists" = "xyes"; then  
AC_MSG_FAILURE([  
Could not link test program to Python. Maybe the main Python library has been  
installed in some non-standard library path. If so, pass it to configure,  
via the LDFLAGS environment variable.  
Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"  
============================================================================  
ERROR!  
You probably have to install the development version of the Python package  
for your distribution. The exact name of this package varies among them.  
============================================================================  
])  
PYTHON_VERSION=""  
fi  
 
#  
# all done!  
#  
])  
 
# ===========================================================================  
# http://autoconf-archive.cryp.to/ax_with_ruby.html  
# ===========================================================================  
#  
# SYNOPSIS  
#  
# AX_WITH_RUBY([VALUE-IF-NOT-FOUND],[PATH])  
#  
# DESCRIPTION  
#  
# Locates an installed Ruby binary, placing the result in the precious  
# variable $RUBY. Accepts a present $RUBY, then --with-ruby, and failing  
# that searches for ruby in the given path (which defaults to the system  
# path). If ruby is found, $RUBY is set to the full path of the binary; if  
# it is not found $RUBY is set to VALUE-IF-NOT-FOUND if provided,  
# unchanged otherwise.  
#  
# A typical use could be the following one:  
#  
# AX_WITH_RUBY  
#  
# LAST MODIFICATION  
#  
# 2008-05-05  
#  
# COPYLEFT  
#  
# Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>  
#  
# Copying and distribution of this file, with or without modification, are  
# permitted in any medium without royalty provided the copyright notice  
# and this notice are preserved.  
 
AC_DEFUN([AX_WITH_RUBY],[  
AX_WITH_PROG(RUBY,ruby,$1,$2)  
])  
 
# ===========================================================================  
# http://autoconf-archive.cryp.to/ax_compare_version.html  
# ===========================================================================  
#  
# SYNOPSIS  
#  
# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])  
#  
# DESCRIPTION  
#  
# This macro compares two version strings. Due to the various number of  
# minor-version numbers that can exist, and the fact that string  
# comparisons are not compatible with numeric comparisons, this is not  
# necessarily trivial to do in a autoconf script. This macro makes doing  
# these comparisons easy.  
#  
# The six basic comparisons are available, as well as checking equality  
# limited to a certain number of minor-version levels.  
#  
# The operator OP determines what type of comparison to do, and can be one  
# of:  
#  
# eq - equal (test A == B)  
# ne - not equal (test A != B)  
# le - less than or equal (test A <= B)  
# ge - greater than or equal (test A >= B)  
# lt - less than (test A < B)  
# gt - greater than (test A > B)  
#  
# Additionally, the eq and ne operator can have a number after it to limit  
# the test to that number of minor versions.  
#  
# eq0 - equal up to the length of the shorter version  
# ne0 - not equal up to the length of the shorter version  
# eqN - equal up to N sub-version levels  
# neN - not equal up to N sub-version levels  
#  
# When the condition is true, shell commands ACTION-IF-TRUE are run,  
# otherwise shell commands ACTION-IF-FALSE are run. The environment  
# variable 'ax_compare_version' is always set to either 'true' or 'false'  
# as well.  
#  
# Examples:  
#  
# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])  
# AX_COMPARE_VERSION([3.15],[lt],[3.15.8])  
#  
# would both be true.  
#  
# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])  
# AX_COMPARE_VERSION([3.15],[gt],[3.15.8])  
#  
# would both be false.  
#  
# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])  
#  
# would be true because it is only comparing two minor versions.  
#  
# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])  
#  
# would be true because it is only comparing the lesser number of minor  
# versions of the two values.  
#  
# Note: The characters that separate the version numbers do not matter. An  
# empty string is the same as version 0. OP is evaluated by autoconf, not  
# configure, so must be a string, not a variable.  
#  
# The author would like to acknowledge Guido Draheim whose advice about  
# the m4_case and m4_ifvaln functions make this macro only include the  
# portions necessary to perform the specific comparison specified by the  
# OP argument in the final configure script.  
#  
# LAST MODIFICATION  
#  
# 2008-04-12  
#  
# COPYLEFT  
#  
# Copyright (c) 2008 Tim Toolan <toolan@ele.uri.edu>  
#  
# Copying and distribution of this file, with or without modification, are  
# permitted in any medium without royalty provided the copyright notice  
# and this notice are preserved.  
 
dnl #########################################################################  
AC_DEFUN([AX_COMPARE_VERSION], [  
AC_PROG_AWK  
 
# Used to indicate true or false condition  
ax_compare_version=false  
 
# Convert the two version strings to be compared into a format that  
# allows a simple string comparison. The end result is that a version  
# string of the form 1.12.5-r617 will be converted to the form  
# 0001001200050617. In other words, each number is zero padded to four  
# digits, and non digits are removed.  
AS_VAR_PUSHDEF([A],[ax_compare_version_A])  
A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \  
-e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \  
-e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \  
-e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \  
-e 's/[[^0-9]]//g'`  
 
AS_VAR_PUSHDEF([B],[ax_compare_version_B])  
B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \  
-e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \  
-e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \  
-e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \  
-e 's/[[^0-9]]//g'`  
 
dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary  
dnl # then the first line is used to determine if the condition is true.  
dnl # The sed right after the echo is to remove any indented white space.  
m4_case(m4_tolower($2),  
[lt],[  
ax_compare_version=`echo "x$A  
x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`  
],  
[gt],[  
ax_compare_version=`echo "x$A  
x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`  
],  
[le],[  
ax_compare_version=`echo "x$A  
x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`  
],  
[ge],[  
ax_compare_version=`echo "x$A  
x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`  
],[  
dnl Split the operator from the subversion count if present.  
m4_bmatch(m4_substr($2,2),  
[0],[  
# A count of zero means use the length of the shorter version.  
# Determine the number of characters in A and B.  
ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'`  
ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'`  
 
# Set A to no more than B's length and B to no more than A's length.  
A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`  
B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`  
],  
[[0-9]+],[  
# A count greater than zero means use only that many subversions  
A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`  
B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`  
],  
[.+],[  
AC_WARNING(  
[illegal OP numeric parameter: $2])  
],[])  
 
# Pad zeros at end of numbers to make same length.  
ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"  
B="$B`echo $A | sed 's/./0/g'`"  
A="$ax_compare_version_tmp_A"  
 
# Check for equality or inequality as necessary.  
m4_case(m4_tolower(m4_substr($2,0,2)),  
[eq],[  
test "x$A" = "x$B" && ax_compare_version=true  
],  
[ne],[  
test "x$A" != "x$B" && ax_compare_version=true  
],[  
AC_WARNING([illegal OP parameter: $2])  
])  
])  
 
AS_VAR_POPDEF([A])dnl  
AS_VAR_POPDEF([B])dnl  
 
dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.  
if test "$ax_compare_version" = "true" ; then  
m4_ifvaln([$4],[$4],[:])dnl  
m4_ifvaln([$5],[else $5])dnl  
fi  
]) dnl AX_COMPARE_VERSION  
 
 
# ===========================================================================  
# http://autoconf-archive.cryp.to/ax_prog_ruby_version.html  
# ===========================================================================  
#  
# SYNOPSIS  
#  
# AX_PROG_RUBY_VERSION([VERSION],[ACTION-IF-TRUE],[ACTION-IF-FALSE])  
#  
# DESCRIPTION  
#  
# Makes sure that ruby supports the version indicated. If true the shell  
# commands in ACTION-IF-TRUE are executed. If not the shell commands in  
# ACTION-IF-FALSE are run. Note if $RUBY is not set (for example by  
# running AC_CHECK_PROG or AC_PATH_PROG),  
#  
# Example:  
#  
# AC_PATH_PROG([RUBY],[ruby])  
# AC_PROG_RUBY_VERSION([1.8.0],[ ... ],[ ... ])  
#  
# This will check to make sure that the ruby you have supports at least  
# version 1.6.0.  
#  
# NOTE: This macro uses the $RUBY variable to perform the check.  
# AX_WITH_RUBY can be used to set that variable prior to running this  
# macro. The $RUBY_VERSION variable will be valorized with the detected  
# version.  
#  
# LAST MODIFICATION  
#  
# 2008-04-12  
#  
# COPYLEFT  
#  
# Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>  
#  
# Copying and distribution of this file, with or without modification, are  
# permitted in any medium without royalty provided the copyright notice  
# and this notice are preserved.  
 
AC_DEFUN([AX_PROG_RUBY_VERSION],[  
AC_REQUIRE([AC_PROG_SED])  
AC_REQUIRE([AC_PROG_GREP])  
 
AS_IF([test -n "$RUBY"],[  
ax_ruby_version="$1"  
 
AC_MSG_CHECKING([for ruby version])  
changequote(<<,>>)  
ruby_version=`$RUBY --version 2>&1 | $GREP "^ruby " | $SED -e 's/^.* \([0-9]*\.[0-9]*\.[0-9]*\) .*/\1/'`  
changequote([,])  
AC_MSG_RESULT($ruby_version)  
 
AC_SUBST([RUBY_VERSION],[$ruby_version])  
 
AX_COMPARE_VERSION([$ax_ruby_version],[le],[$ruby_version],[  
:  
$2  
],[  
:  
$3  
])  
],[  
AC_MSG_WARN([could not find the ruby interpreter])  
$3  
])  
])  
 
# ===========================================================================  
# http://autoconf-archive.cryp.to/ax_ruby_devel.html  
# ===========================================================================  
#  
# SYNOPSIS  
#  
# AX_RUBY_DEVEL([version])  
#  
# DESCRIPTION  
#  
# This macro checks for Ruby and tries to get the include path to  
# 'ruby.h'. It provides the $(RUBY_CPPFLAGS) and $(RUBY_LDFLAGS) output  
# variables. It also exports $(RUBY_EXTRA_LIBS) for embedding Ruby in your  
# code.  
#  
# You can search for some particular version of Ruby by passing a  
# parameter to this macro, for example "1.8.6".  
#  
# LAST MODIFICATION  
#  
# 2008-04-12  
#  
# COPYLEFT  
#  
# Copyright (c) 2008 Rafal Rzepecki <divided.mind@gmail.com>  
# Copyright (c) 2008 Sebastian Huber <sebastian-huber@web.de>  
# Copyright (c) 2008 Alan W. Irwin <irwin@beluga.phys.uvic.ca>  
# Copyright (c) 2008 Rafael Laboissiere <rafael@laboissiere.net>  
# Copyright (c) 2008 Andrew Collier <colliera@ukzn.ac.za>  
# Copyright (c) 2008 Matteo Settenvini <matteo@member.fsf.org>  
# Copyright (c) 2008 Horst Knorr <hk_classes@knoda.org>  
#  
# This program is free software: you can redistribute it and/or modify it  
# under the terms of the GNU General Public License as published by the  
# Free Software Foundation, either version 3 of the License, or (at your  
# option) any later version.  
#  
# This program is distributed in the hope that it will be useful, but  
# WITHOUT ANY WARRANTY; without even the implied warranty of  
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General  
# Public License for more details.  
#  
# You should have received a copy of the GNU General Public License along  
# with this program. If not, see <http://www.gnu.org/licenses/>.  
#  
# As a special exception, the respective Autoconf Macro's copyright owner  
# gives unlimited permission to copy, distribute and modify the configure  
# scripts that are the output of Autoconf when processing the Macro. You  
# need not follow the terms of the GNU General Public License when using  
# or distributing such scripts, even though portions of the text of the  
# Macro appear in them. The GNU General Public License (GPL) does govern  
# all other use of the material that constitutes the Autoconf Macro.  
#  
# This special exception to the GPL applies to versions of the Autoconf  
# Macro released by the Autoconf Macro Archive. When you make and  
# distribute a modified version of the Autoconf Macro, you may extend this  
# special exception to the GPL to apply to your modified version as well.  
 
AC_DEFUN([AX_RUBY_DEVEL],[  
AC_REQUIRE([AX_WITH_RUBY])  
AS_IF([test -n "$1"], [AX_PROG_RUBY_VERSION([$1])])  
 
#  
# Check if you have mkmf, else fail  
#  
AC_MSG_CHECKING([for the mkmf Ruby package])  
ac_mkmf_result=`$RUBY -rmkmf -e ";" 2>&1`  
if test -z "$ac_mkmf_result"; then  
AC_MSG_RESULT([yes])  
else  
AC_MSG_RESULT([no])  
AC_MSG_ERROR([cannot import Ruby module "mkmf".  
Please check your Ruby installation. The error was:  
$ac_distutils_result])  
fi  
 
#  
# Check for Ruby include path  
#  
AC_MSG_CHECKING([for Ruby include path])  
if test -z "$RUBY_CPPFLAGS"; then  
ruby_path=`$RUBY -rmkmf -e 'print Config::CONFIG[["archdir"]]'`  
if test -n "${ruby_path}"; then  
ruby_path="-I$ruby_path"  
fi  
RUBY_CPPFLAGS=$ruby_path  
fi  
AC_MSG_RESULT([$RUBY_CPPFLAGS])  
AC_SUBST([RUBY_CPPFLAGS])  
 
#  
# Check for Ruby library path  
#  
AC_MSG_CHECKING([for Ruby library path])  
if test -z "$RUBY_LDFLAGS"; then  
RUBY_LDFLAGS=`$RUBY -rmkmf -e 'print Config::CONFIG[["LIBRUBYARG_SHARED"]]'`  
fi  
AC_MSG_RESULT([$RUBY_LDFLAGS])  
AC_SUBST([RUBY_LDFLAGS])  
 
#  
# Check for site packages  
#  
AC_MSG_CHECKING([for Ruby site-packages path])  
if test -z "$RUBY_SITE_PKG"; then  
RUBY_SITE_PKG=`$RUBY -rmkmf -e 'print Config::CONFIG[["sitearchdir"]]'`  
fi  
AC_MSG_RESULT([$RUBY_SITE_PKG])  
AC_SUBST([RUBY_SITE_PKG])  
 
#  
# libraries which must be linked in when embedding  
#  
AC_MSG_CHECKING(ruby extra libraries)  
if test -z "$RUBY_EXTRA_LIBS"; then  
RUBY_EXTRA_LIBS=`$RUBY -rmkmf -e 'print Config::CONFIG[["SOLIBS"]]'`  
fi  
AC_MSG_RESULT([$RUBY_EXTRA_LIBS])  
AC_SUBST(RUBY_EXTRA_LIBS)  
 
#  
# linking flags needed when embedding  
# (is it even needed for Ruby?)  
#  
# AC_MSG_CHECKING(ruby extra linking flags)  
# if test -z "$RUBY_EXTRA_LDFLAGS"; then  
# RUBY_EXTRA_LDFLAGS=`$RUBY -rmkmf -e 'print Config::CONFIG[["LINKFORSHARED"]]'`  
# fi  
# AC_MSG_RESULT([$RUBY_EXTRA_LDFLAGS])  
# AC_SUBST(RUBY_EXTRA_LDFLAGS)  
 
# this flags breaks ruby.h, and is sometimes defined by KDE m4 macros  
CFLAGS="`echo "$CFLAGS" | sed -e 's/-std=iso9899:1990//g;'`"  
#  
# final check to see if everything compiles alright  
#  
AC_MSG_CHECKING([consistency of all components of ruby development environment])  
AC_LANG_PUSH([C])  
# save current global flags  
ac_save_LIBS="$LIBS"  
LIBS="$ac_save_LIBS $RUBY_LDFLAGS"  
ac_save_CPPFLAGS="$CPPFLAGS"  
CPPFLAGS="$ac_save_CPPFLAGS $RUBY_CPPFLAGS"  
AC_TRY_LINK([  
#include <ruby.h>  
],[  
ruby_init();  
],[rubyexists=yes],[rubyexists=no])  
 
AC_MSG_RESULT([$rubyexists])  
 
if test ! "$rubyexists" = "yes"; then  
AC_MSG_ERROR([  
Could not link test program to Ruby. Maybe the main Ruby library has been  
installed in some non-standard library path. If so, pass it to configure,  
via the LDFLAGS environment variable.  
Example: ./configure LDFLAGS="-L/usr/non-standard-path/ruby/lib"  
============================================================================  
ERROR!  
You probably have to install the development version of the Ruby package  
for your distribution. The exact name of this package varies among them.  
============================================================================  
])  
RUBY_VERSION=""  
fi  
AC_LANG_POP  
# turn back to default flags  
CPPFLAGS="$ac_save_CPPFLAGS"  
LIBS="$ac_save_LIBS"  
 
#  
# all done!  
#  
])  
 
#!/bin/sh  
 
aclocal  
autoconf  
#! /bin/sh  
# Attempt to guess a canonical system name.  
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,  
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.  
 
timestamp='2005-08-03'  
 
# This file is free software; you can redistribute it and/or modify it  
# under the terms of the GNU General Public License as published by  
# the Free Software Foundation; either version 2 of the License, or  
# (at your option) any later version.  
#  
# This program is distributed in the hope that it will be useful, but  
# WITHOUT ANY WARRANTY; without even the implied warranty of  
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU  
# General Public License for more details.  
#  
# You should have received a copy of the GNU General Public License  
# along with this program; if not, write to the Free Software  
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA  
# 02110-1301, USA.  
#  
# As a special exception to the GNU General Public License, if you  
# distribute this file as part of a program that contains a  
# configuration script generated by Autoconf, you may include it under  
# the same distribution terms that you use for the rest of that program.  
 
 
# Originally written by Per Bothner <per@bothner.com>.  
# Please send patches to <config-patches@gnu.org>. Submit a context  
# diff and a properly formatted ChangeLog entry.  
#  
# This script attempts to guess a canonical system name similar to  
# config.sub. If it succeeds, it prints the system name on stdout, and  
# exits with 0. Otherwise, it exits with 1.  
#  
# The plan is that this can be called by configure scripts if you  
# don't specify an explicit build system type.  
 
me=`echo "$0" | sed -e 's,.*/,,'`  
 
usage="\  
Usage: $0 [OPTION]  
 
Output the configuration name of the system \`$me' is run on.  
 
Operation modes:  
-h, --help print this help, then exit  
-t, --time-stamp print date of last modification, then exit  
-v, --version print version number, then exit  
 
Report bugs and patches to <config-patches@gnu.org>."  
 
version="\  
GNU config.guess ($timestamp)  
 
Originally written by Per Bothner.  
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005  
Free Software Foundation, Inc.  
 
This is free software; see the source for copying conditions. There is NO  
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."  
 
help="  
Try \`$me --help' for more information."  
 
# Parse command line  
while test $# -gt 0 ; do  
case $1 in  
--time-stamp | --time* | -t )  
echo "$timestamp" ; exit ;;  
--version | -v )  
echo "$version" ; exit ;;  
--help | --h* | -h )  
echo "$usage"; exit ;;  
-- ) # Stop option processing  
shift; break ;;  
- ) # Use stdin as input.  
break ;;  
-* )  
echo "$me: invalid option $1$help" >&2  
exit 1 ;;  
* )  
break ;;  
esac  
done  
 
if test $# != 0; then  
echo "$me: too many arguments$help" >&2  
exit 1  
fi  
 
trap 'exit 1' 1 2 15  
 
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a  
# compiler to aid in system detection is discouraged as it requires  
# temporary files to be created and, as you can see below, it is a  
# headache to deal with in a portable fashion.  
 
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still  
# use `HOST_CC' if defined, but it is deprecated.  
 
# Portable tmp directory creation inspired by the Autoconf team.  
 
set_cc_for_build='  
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;  
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;  
: ${TMPDIR=/tmp} ;  
{ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||  
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||  
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||  
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;  
dummy=$tmp/dummy ;  
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;  
case $CC_FOR_BUILD,$HOST_CC,$CC in  
,,) echo "int x;" > $dummy.c ;  
for c in cc gcc c89 c99 ; do  
if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then  
CC_FOR_BUILD="$c"; break ;  
fi ;  
done ;  
if test x"$CC_FOR_BUILD" = x ; then  
CC_FOR_BUILD=no_compiler_found ;  
fi  
;;  
,,*) CC_FOR_BUILD=$CC ;;  
,*,*) CC_FOR_BUILD=$HOST_CC ;;  
esac ; set_cc_for_build= ;'  
 
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.  
# (ghazi@noc.rutgers.edu 1994-08-24)  
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then  
PATH=$PATH:/.attbin ; export PATH  
fi  
 
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown  
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown  
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown  
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown  
 
# Note: order is significant - the case branches are not exclusive.  
 
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in  
*:NetBSD:*:*)  
# NetBSD (nbsd) targets should (where applicable) match one or  
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,  
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently  
# switched to ELF, *-*-netbsd* would select the old  
# object file format. This provides both forward  
# compatibility and a consistent mechanism for selecting the  
# object file format.  
#  
# Note: NetBSD doesn't particularly care about the vendor  
# portion of the name. We always set it to "unknown".  
sysctl="sysctl -n hw.machine_arch"  
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \  
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`  
case "${UNAME_MACHINE_ARCH}" in  
armeb) machine=armeb-unknown ;;  
arm*) machine=arm-unknown ;;  
sh3el) machine=shl-unknown ;;  
sh3eb) machine=sh-unknown ;;  
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;  
esac  
# The Operating System including object format, if it has switched  
# to ELF recently, or will in the future.  
case "${UNAME_MACHINE_ARCH}" in  
arm*|i386|m68k|ns32k|sh3*|sparc|vax)  
eval $set_cc_for_build  
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \  
| grep __ELF__ >/dev/null  
then  
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).  
# Return netbsd for either. FIX?  
os=netbsd  
else  
os=netbsdelf  
fi  
;;  
*)  
os=netbsd  
;;  
esac  
# The OS release  
# Debian GNU/NetBSD machines have a different userland, and  
# thus, need a distinct triplet. However, they do not need  
# kernel version information, so it can be replaced with a  
# suitable tag, in the style of linux-gnu.  
case "${UNAME_VERSION}" in  
Debian*)  
release='-gnu'  
;;  
*)  
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`  
;;  
esac  
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:  
# contains redundant information, the shorter form:  
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.  
echo "${machine}-${os}${release}"  
exit ;;  
*:OpenBSD:*:*)  
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`  
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}  
exit ;;  
*:ekkoBSD:*:*)  
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}  
exit ;;  
macppc:MirBSD:*:*)  
echo powerppc-unknown-mirbsd${UNAME_RELEASE}  
exit ;;  
*:MirBSD:*:*)  
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}  
exit ;;  
alpha:OSF1:*:*)  
case $UNAME_RELEASE in  
*4.0)  
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`  
;;  
*5.*)  
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`  
;;  
esac  
# According to Compaq, /usr/sbin/psrinfo has been available on  
# OSF/1 and Tru64 systems produced since 1995. I hope that  
# covers most systems running today. This code pipes the CPU  
# types through head -n 1, so we only detect the type of CPU 0.  
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`  
case "$ALPHA_CPU_TYPE" in  
"EV4 (21064)")  
UNAME_MACHINE="alpha" ;;  
"EV4.5 (21064)")  
UNAME_MACHINE="alpha" ;;  
"LCA4 (21066/21068)")  
UNAME_MACHINE="alpha" ;;  
"EV5 (21164)")  
UNAME_MACHINE="alphaev5" ;;  
"EV5.6 (21164A)")  
UNAME_MACHINE="alphaev56" ;;  
"EV5.6 (21164PC)")  
UNAME_MACHINE="alphapca56" ;;  
"EV5.7 (21164PC)")  
UNAME_MACHINE="alphapca57" ;;  
"EV6 (21264)")  
UNAME_MACHINE="alphaev6" ;;  
"EV6.7 (21264A)")  
UNAME_MACHINE="alphaev67" ;;  
"EV6.8CB (21264C)")  
UNAME_MACHINE="alphaev68" ;;  
"EV6.8AL (21264B)")  
UNAME_MACHINE="alphaev68" ;;  
"EV6.8CX (21264D)")  
UNAME_MACHINE="alphaev68" ;;  
"EV6.9A (21264/EV69A)")  
UNAME_MACHINE="alphaev69" ;;  
"EV7 (21364)")  
UNAME_MACHINE="alphaev7" ;;  
"EV7.9 (21364A)")  
UNAME_MACHINE="alphaev79" ;;  
esac  
# A Pn.n version is a patched version.  
# A Vn.n version is a released version.  
# A Tn.n version is a released field test version.  
# A Xn.n version is an unreleased experimental baselevel.  
# 1.2 uses "1.2" for uname -r.  
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`  
exit ;;  
Alpha\ *:Windows_NT*:*)  
# How do we know it's Interix rather than the generic POSIX subsystem?  
# Should we change UNAME_MACHINE based on the output of uname instead  
# of the specific Alpha model?  
echo alpha-pc-interix  
exit ;;  
21064:Windows_NT:50:3)  
echo alpha-dec-winnt3.5  
exit ;;  
Amiga*:UNIX_System_V:4.0:*)  
echo m68k-unknown-sysv4  
exit ;;  
*:[Aa]miga[Oo][Ss]:*:*)  
echo ${UNAME_MACHINE}-unknown-amigaos  
exit ;;  
*:[Mm]orph[Oo][Ss]:*:*)  
echo ${UNAME_MACHINE}-unknown-morphos  
exit ;;  
*:OS/390:*:*)  
echo i370-ibm-openedition  
exit ;;  
*:z/VM:*:*)  
echo s390-ibm-zvmoe  
exit ;;  
*:OS400:*:*)  
echo powerpc-ibm-os400  
exit ;;  
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)  
echo arm-acorn-riscix${UNAME_RELEASE}  
exit ;;  
arm:riscos:*:*|arm:RISCOS:*:*)  
echo arm-unknown-riscos  
exit ;;  
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)  
echo hppa1.1-hitachi-hiuxmpp  
exit ;;  
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)  
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.  
if test "`(/bin/universe) 2>/dev/null`" = att ; then  
echo pyramid-pyramid-sysv3  
else  
echo pyramid-pyramid-bsd  
fi  
exit ;;  
NILE*:*:*:dcosx)  
echo pyramid-pyramid-svr4  
exit ;;  
DRS?6000:unix:4.0:6*)  
echo sparc-icl-nx6  
exit ;;  
DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)  
case `/usr/bin/uname -p` in  
sparc) echo sparc-icl-nx7; exit ;;  
esac ;;  
sun4H:SunOS:5.*:*)  
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`  
exit ;;  
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)  
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`  
exit ;;  
i86pc:SunOS:5.*:*)  
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`  
exit ;;  
sun4*:SunOS:6*:*)  
# According to config.sub, this is the proper way to canonicalize  
# SunOS6. Hard to guess exactly what SunOS6 will be like, but  
# it's likely to be more like Solaris than SunOS4.  
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`  
exit ;;  
sun4*:SunOS:*:*)  
case "`/usr/bin/arch -k`" in  
Series*|S4*)  
UNAME_RELEASE=`uname -v`  
;;  
esac  
# Japanese Language versions have a version number like `4.1.3-JL'.  
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`  
exit ;;  
sun3*:SunOS:*:*)  
echo m68k-sun-sunos${UNAME_RELEASE}  
exit ;;  
sun*:*:4.2BSD:*)  
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`  
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3  
case "`/bin/arch`" in  
sun3)  
echo m68k-sun-sunos${UNAME_RELEASE}  
;;  
sun4)  
echo sparc-sun-sunos${UNAME_RELEASE}  
;;  
esac  
exit ;;  
aushp:SunOS:*:*)  
echo sparc-auspex-sunos${UNAME_RELEASE}  
exit ;;  
# The situation for MiNT is a little confusing. The machine name  
# can be virtually everything (everything which is not  
# "atarist" or "atariste" at least should have a processor  
# > m68000). The system name ranges from "MiNT" over "FreeMiNT"  
# to the lowercase version "mint" (or "freemint"). Finally  
# the system name "TOS" denotes a system which is actually not  
# MiNT. But MiNT is downward compatible to TOS, so this should  
# be no problem.  
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)  
echo m68k-atari-mint${UNAME_RELEASE}  
exit ;;  
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)  
echo m68k-atari-mint${UNAME_RELEASE}  
exit ;;  
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)  
echo m68k-atari-mint${UNAME_RELEASE}  
exit ;;  
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)  
echo m68k-milan-mint${UNAME_RELEASE}  
exit ;;  
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)  
echo m68k-hades-mint${UNAME_RELEASE}  
exit ;;  
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)  
echo m68k-unknown-mint${UNAME_RELEASE}  
exit ;;  
m68k:machten:*:*)  
echo m68k-apple-machten${UNAME_RELEASE}  
exit ;;  
powerpc:machten:*:*)  
echo powerpc-apple-machten${UNAME_RELEASE}  
exit ;;  
RISC*:Mach:*:*)  
echo mips-dec-mach_bsd4.3  
exit ;;  
RISC*:ULTRIX:*:*)  
echo mips-dec-ultrix${UNAME_RELEASE}  
exit ;;  
VAX*:ULTRIX*:*:*)  
echo vax-dec-ultrix${UNAME_RELEASE}  
exit ;;  
2020:CLIX:*:* | 2430:CLIX:*:*)  
echo clipper-intergraph-clix${UNAME_RELEASE}  
exit ;;  
mips:*:*:UMIPS | mips:*:*:RISCos)  
eval $set_cc_for_build  
sed 's/^ //' << EOF >$dummy.c  
#ifdef __cplusplus  
#include <stdio.h> /* for printf() prototype */  
int main (int argc, char *argv[]) {  
#else  
int main (argc, argv) int argc; char *argv[]; {  
#endif  
#if defined (host_mips) && defined (MIPSEB)  
#if defined (SYSTYPE_SYSV)  
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);  
#endif  
#if defined (SYSTYPE_SVR4)  
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);  
#endif  
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)  
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);  
#endif  
#endif  
exit (-1);  
}  
EOF  
$CC_FOR_BUILD -o $dummy $dummy.c &&  
dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&  
SYSTEM_NAME=`$dummy $dummyarg` &&  
{ echo "$SYSTEM_NAME"; exit; }  
echo mips-mips-riscos${UNAME_RELEASE}  
exit ;;  
Motorola:PowerMAX_OS:*:*)  
echo powerpc-motorola-powermax  
exit ;;  
Motorola:*:4.3:PL8-*)  
echo powerpc-harris-powermax  
exit ;;  
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)  
echo powerpc-harris-powermax  
exit ;;  
Night_Hawk:Power_UNIX:*:*)  
echo powerpc-harris-powerunix  
exit ;;  
m88k:CX/UX:7*:*)  
echo m88k-harris-cxux7  
exit ;;  
m88k:*:4*:R4*)  
echo m88k-motorola-sysv4  
exit ;;  
m88k:*:3*:R3*)  
echo m88k-motorola-sysv3  
exit ;;  
AViiON:dgux:*:*)  
# DG/UX returns AViiON for all architectures  
UNAME_PROCESSOR=`/usr/bin/uname -p`  
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]  
then  
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \  
[ ${TARGET_BINARY_INTERFACE}x = x ]  
then  
echo m88k-dg-dgux${UNAME_RELEASE}  
else  
echo m88k-dg-dguxbcs${UNAME_RELEASE}  
fi  
else  
echo i586-dg-dgux${UNAME_RELEASE}  
fi  
exit ;;  
M88*:DolphinOS:*:*) # DolphinOS (SVR3)  
echo m88k-dolphin-sysv3  
exit ;;  
M88*:*:R3*:*)  
# Delta 88k system running SVR3  
echo m88k-motorola-sysv3  
exit ;;  
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)  
echo m88k-tektronix-sysv3  
exit ;;  
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)  
echo m68k-tektronix-bsd  
exit ;;  
*:IRIX*:*:*)  
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`  
exit ;;  
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.  
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id  
exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '  
i*86:AIX:*:*)  
echo i386-ibm-aix  
exit ;;  
ia64:AIX:*:*)  
if [ -x /usr/bin/oslevel ] ; then  
IBM_REV=`/usr/bin/oslevel`  
else  
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}  
fi  
echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}  
exit ;;  
*:AIX:2:3)  
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then  
eval $set_cc_for_build  
sed 's/^ //' << EOF >$dummy.c  
#include <sys/systemcfg.h>  
 
main()  
{  
if (!__power_pc())  
exit(1);  
puts("powerpc-ibm-aix3.2.5");  
exit(0);  
}  
EOF  
if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`  
then  
echo "$SYSTEM_NAME"  
else  
echo rs6000-ibm-aix3.2.5  
fi  
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then  
echo rs6000-ibm-aix3.2.4  
else  
echo rs6000-ibm-aix3.2  
fi  
exit ;;  
*:AIX:*:[45])  
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`  
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then  
IBM_ARCH=rs6000  
else  
IBM_ARCH=powerpc  
fi  
if [ -x /usr/bin/oslevel ] ; then  
IBM_REV=`/usr/bin/oslevel`  
else  
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}  
fi  
echo ${IBM_ARCH}-ibm-aix${IBM_REV}  
exit ;;  
*:AIX:*:*)  
echo rs6000-ibm-aix  
exit ;;  
ibmrt:4.4BSD:*|romp-ibm:BSD:*)  
echo romp-ibm-bsd4.4  
exit ;;  
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and  
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to  
exit ;; # report: romp-ibm BSD 4.3  
*:BOSX:*:*)  
echo rs6000-bull-bosx  
exit ;;  
DPX/2?00:B.O.S.:*:*)  
echo m68k-bull-sysv3  
exit ;;  
9000/[34]??:4.3bsd:1.*:*)  
echo m68k-hp-bsd  
exit ;;  
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)  
echo m68k-hp-bsd4.4  
exit ;;  
9000/[34678]??:HP-UX:*:*)  
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`  
case "${UNAME_MACHINE}" in  
9000/31? ) HP_ARCH=m68000 ;;  
9000/[34]?? ) HP_ARCH=m68k ;;  
9000/[678][0-9][0-9])  
if [ -x /usr/bin/getconf ]; then  
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`  
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`  
case "${sc_cpu_version}" in  
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0  
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1  
532) # CPU_PA_RISC2_0  
case "${sc_kernel_bits}" in  
32) HP_ARCH="hppa2.0n" ;;  
64) HP_ARCH="hppa2.0w" ;;  
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20  
esac ;;  
esac  
fi  
if [ "${HP_ARCH}" = "" ]; then  
eval $set_cc_for_build  
sed 's/^ //' << EOF >$dummy.c  
 
#define _HPUX_SOURCE  
#include <stdlib.h>  
#include <unistd.h>  
 
int main ()  
{  
#if defined(_SC_KERNEL_BITS)  
long bits = sysconf(_SC_KERNEL_BITS);  
#endif  
long cpu = sysconf (_SC_CPU_VERSION);  
 
switch (cpu)  
{  
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;  
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;  
case CPU_PA_RISC2_0:  
#if defined(_SC_KERNEL_BITS)  
switch (bits)  
{  
case 64: puts ("hppa2.0w"); break;  
case 32: puts ("hppa2.0n"); break;  
default: puts ("hppa2.0"); break;  
} break;  
#else /* !defined(_SC_KERNEL_BITS) */  
puts ("hppa2.0"); break;  
#endif  
default: puts ("hppa1.0"); break;  
}  
exit (0);  
}  
EOF  
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`  
test -z "$HP_ARCH" && HP_ARCH=hppa  
fi ;;  
esac  
if [ ${HP_ARCH} = "hppa2.0w" ]  
then  
eval $set_cc_for_build  
 
# hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating  
# 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler  
# generating 64-bit code. GNU and HP use different nomenclature:  
#  
# $ CC_FOR_BUILD=cc ./config.guess  
# => hppa2.0w-hp-hpux11.23  
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess  
# => hppa64-hp-hpux11.23  
 
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |  
grep __LP64__ >/dev/null  
then  
HP_ARCH="hppa2.0w"  
else  
HP_ARCH="hppa64"  
fi  
fi  
echo ${HP_ARCH}-hp-hpux${HPUX_REV}  
exit ;;  
ia64:HP-UX:*:*)  
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`  
echo ia64-hp-hpux${HPUX_REV}  
exit ;;  
3050*:HI-UX:*:*)  
eval $set_cc_for_build  
sed 's/^ //' << EOF >$dummy.c  
#include <unistd.h>  
int  
main ()  
{  
long cpu = sysconf (_SC_CPU_VERSION);  
/* The order matters, because CPU_IS_HP_MC68K erroneously returns  
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct  
results, however. */  
if (CPU_IS_PA_RISC (cpu))  
{  
switch (cpu)  
{  
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;  
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;  
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;  
default: puts ("hppa-hitachi-hiuxwe2"); break;  
}  
}  
else if (CPU_IS_HP_MC68K (cpu))  
puts ("m68k-hitachi-hiuxwe2");  
else puts ("unknown-hitachi-hiuxwe2");  
exit (0);  
}  
EOF  
$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&  
{ echo "$SYSTEM_NAME"; exit; }  
echo unknown-hitachi-hiuxwe2  
exit ;;  
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )  
echo hppa1.1-hp-bsd  
exit ;;  
9000/8??:4.3bsd:*:*)  
echo hppa1.0-hp-bsd  
exit ;;  
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)  
echo hppa1.0-hp-mpeix  
exit ;;  
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )  
echo hppa1.1-hp-osf  
exit ;;  
hp8??:OSF1:*:*)  
echo hppa1.0-hp-osf  
exit ;;  
i*86:OSF1:*:*)  
if [ -x /usr/sbin/sysversion ] ; then  
echo ${UNAME_MACHINE}-unknown-osf1mk  
else  
echo ${UNAME_MACHINE}-unknown-osf1  
fi  
exit ;;  
parisc*:Lites*:*:*)  
echo hppa1.1-hp-lites  
exit ;;  
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)  
echo c1-convex-bsd  
exit ;;  
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)  
if getsysinfo -f scalar_acc  
then echo c32-convex-bsd  
else echo c2-convex-bsd  
fi  
exit ;;  
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)  
echo c34-convex-bsd  
exit ;;  
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)  
echo c38-convex-bsd  
exit ;;  
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)  
echo c4-convex-bsd  
exit ;;  
CRAY*Y-MP:*:*:*)  
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'  
exit ;;  
CRAY*[A-Z]90:*:*:*)  
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \  
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \  
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \  
-e 's/\.[^.]*$/.X/'  
exit ;;  
CRAY*TS:*:*:*)  
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'  
exit ;;  
CRAY*T3E:*:*:*)  
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'  
exit ;;  
CRAY*SV1:*:*:*)  
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'  
exit ;;  
*:UNICOS/mp:*:*)  
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'  
exit ;;  
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)  
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`  
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`  
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`  
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"  
exit ;;  
5000:UNIX_System_V:4.*:*)  
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`  
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`  
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"  
exit ;;  
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)  
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}  
exit ;;  
sparc*:BSD/OS:*:*)  
echo sparc-unknown-bsdi${UNAME_RELEASE}  
exit ;;  
*:BSD/OS:*:*)  
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}  
exit ;;  
*:FreeBSD:*:*)  
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`  
exit ;;  
i*:CYGWIN*:*)  
echo ${UNAME_MACHINE}-pc-cygwin  
exit ;;  
i*:MINGW*:*)  
echo ${UNAME_MACHINE}-pc-mingw32  
exit ;;  
i*:windows32*:*)  
# uname -m includes "-pc" on this system.  
echo ${UNAME_MACHINE}-mingw32  
exit ;;  
i*:PW*:*)  
echo ${UNAME_MACHINE}-pc-pw32  
exit ;;  
x86:Interix*:[34]*)  
echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'  
exit ;;  
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)  
echo i${UNAME_MACHINE}-pc-mks  
exit ;;  
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)  
# How do we know it's Interix rather than the generic POSIX subsystem?  
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we  
# UNAME_MACHINE based on the output of uname instead of i386?  
echo i586-pc-interix  
exit ;;  
i*:UWIN*:*)  
echo ${UNAME_MACHINE}-pc-uwin  
exit ;;  
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)  
echo x86_64-unknown-cygwin  
exit ;;  
p*:CYGWIN*:*)  
echo powerpcle-unknown-cygwin  
exit ;;  
prep*:SunOS:5.*:*)  
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`  
exit ;;  
*:GNU:*:*)  
# the GNU system  
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`  
exit ;;  
*:GNU/*:*:*)  
# other systems with GNU libc and userland  
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu  
exit ;;  
i*86:Minix:*:*)  
echo ${UNAME_MACHINE}-pc-minix  
exit ;;  
arm*:Linux:*:*)  
echo ${UNAME_MACHINE}-unknown-linux-gnu  
exit ;;  
cris:Linux:*:*)  
echo cris-axis-linux-gnu  
exit ;;  
crisv32:Linux:*:*)  
echo crisv32-axis-linux-gnu  
exit ;;  
frv:Linux:*:*)  
echo frv-unknown-linux-gnu  
exit ;;  
ia64:Linux:*:*)  
echo ${UNAME_MACHINE}-unknown-linux-gnu  
exit ;;  
m32r*:Linux:*:*)  
echo ${UNAME_MACHINE}-unknown-linux-gnu  
exit ;;  
m68*:Linux:*:*)  
echo ${UNAME_MACHINE}-unknown-linux-gnu  
exit ;;  
mips:Linux:*:*)  
eval $set_cc_for_build  
sed 's/^ //' << EOF >$dummy.c  
#undef CPU  
#undef mips  
#undef mipsel  
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)  
CPU=mipsel  
#else  
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)  
CPU=mips  
#else  
CPU=  
#endif  
#endif  
EOF  
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`  
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }  
;;  
mips64:Linux:*:*)  
eval $set_cc_for_build  
sed 's/^ //' << EOF >$dummy.c  
#undef CPU  
#undef mips64  
#undef mips64el  
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)  
CPU=mips64el  
#else  
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)  
CPU=mips64  
#else  
CPU=  
#endif  
#endif  
EOF  
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`  
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }  
;;  
or32:Linux:*:*)  
echo or32-unknown-linux-gnu  
exit ;;  
ppc:Linux:*:*)  
echo powerpc-unknown-linux-gnu  
exit ;;  
ppc64:Linux:*:*)  
echo powerpc64-unknown-linux-gnu  
exit ;;  
alpha:Linux:*:*)  
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in  
EV5) UNAME_MACHINE=alphaev5 ;;  
EV56) UNAME_MACHINE=alphaev56 ;;  
PCA56) UNAME_MACHINE=alphapca56 ;;  
PCA57) UNAME_MACHINE=alphapca56 ;;  
EV6) UNAME_MACHINE=alphaev6 ;;  
EV67) UNAME_MACHINE=alphaev67 ;;  
EV68*) UNAME_MACHINE=alphaev68 ;;  
esac  
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null  
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi  
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}  
exit ;;  
parisc:Linux:*:* | hppa:Linux:*:*)  
# Look for CPU level  
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in  
PA7*) echo hppa1.1-unknown-linux-gnu ;;  
PA8*) echo hppa2.0-unknown-linux-gnu ;;  
*) echo hppa-unknown-linux-gnu ;;  
esac  
exit ;;  
parisc64:Linux:*:* | hppa64:Linux:*:*)  
echo hppa64-unknown-linux-gnu  
exit ;;  
s390:Linux:*:* | s390x:Linux:*:*)  
echo ${UNAME_MACHINE}-ibm-linux  
exit ;;  
sh64*:Linux:*:*)  
echo ${UNAME_MACHINE}-unknown-linux-gnu  
exit ;;  
sh*:Linux:*:*)  
echo ${UNAME_MACHINE}-unknown-linux-gnu  
exit ;;  
sparc:Linux:*:* | sparc64:Linux:*:*)  
echo ${UNAME_MACHINE}-unknown-linux-gnu  
exit ;;  
x86_64:Linux:*:*)  
echo x86_64-unknown-linux-gnu  
exit ;;  
i*86:Linux:*:*)  
# The BFD linker knows what the default object file format is, so  
# first see if it will tell us. cd to the root directory to prevent  
# problems with other programs or directories called `ld' in the path.  
# Set LC_ALL=C to ensure ld outputs messages in English.  
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \  
| sed -ne '/supported targets:/!d  
s/[ ][ ]*/ /g  
s/.*supported targets: *//  
s/ .*//  
p'`  
case "$ld_supported_targets" in  
elf32-i386)  
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"  
;;  
a.out-i386-linux)  
echo "${UNAME_MACHINE}-pc-linux-gnuaout"  
exit ;;  
coff-i386)  
echo "${UNAME_MACHINE}-pc-linux-gnucoff"  
exit ;;  
"")  
# Either a pre-BFD a.out linker (linux-gnuoldld) or  
# one that does not give us useful --help.  
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"  
exit ;;  
esac  
# Determine whether the default compiler is a.out or elf  
eval $set_cc_for_build  
sed 's/^ //' << EOF >$dummy.c  
#include <features.h>  
#ifdef __ELF__  
# ifdef __GLIBC__  
# if __GLIBC__ >= 2  
LIBC=gnu  
# else  
LIBC=gnulibc1  
# endif  
# else  
LIBC=gnulibc1  
# endif  
#else  
#ifdef __INTEL_COMPILER  
LIBC=gnu  
#else  
LIBC=gnuaout  
#endif  
#endif  
#ifdef __dietlibc__  
LIBC=dietlibc  
#endif  
EOF  
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`  
test x"${LIBC}" != x && {  
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"  
exit  
}  
test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }  
;;  
i*86:DYNIX/ptx:4*:*)  
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.  
# earlier versions are messed up and put the nodename in both  
# sysname and nodename.  
echo i386-sequent-sysv4  
exit ;;  
i*86:UNIX_SV:4.2MP:2.*)  
# Unixware is an offshoot of SVR4, but it has its own version  
# number series starting with 2...  
# I am not positive that other SVR4 systems won't match this,  
# I just have to hope. -- rms.  
# Use sysv4.2uw... so that sysv4* matches it.  
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}  
exit ;;  
i*86:OS/2:*:*)  
# If we were able to find `uname', then EMX Unix compatibility  
# is probably installed.  
echo ${UNAME_MACHINE}-pc-os2-emx  
exit ;;  
i*86:XTS-300:*:STOP)  
echo ${UNAME_MACHINE}-unknown-stop  
exit ;;  
i*86:atheos:*:*)  
echo ${UNAME_MACHINE}-unknown-atheos  
exit ;;  
i*86:syllable:*:*)  
echo ${UNAME_MACHINE}-pc-syllable  
exit ;;  
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)  
echo i386-unknown-lynxos${UNAME_RELEASE}  
exit ;;  
i*86:*DOS:*:*)  
echo ${UNAME_MACHINE}-pc-msdosdjgpp  
exit ;;  
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)  
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`  
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then  
echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}  
else  
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}  
fi  
exit ;;  
i*86:*:5:[678]*)  
# UnixWare 7.x, OpenUNIX and OpenServer 6.  
case `/bin/uname -X | grep "^Machine"` in  
*486*) UNAME_MACHINE=i486 ;;  
*Pentium) UNAME_MACHINE=i586 ;;  
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;  
esac  
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}  
exit ;;  
i*86:*:3.2:*)  
if test -f /usr/options/cb.name; then  
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`  
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL  
elif /bin/uname -X 2>/dev/null >/dev/null ; then  
UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`  
(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486  
(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \  
&& UNAME_MACHINE=i586  
(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \  
&& UNAME_MACHINE=i686  
(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \  
&& UNAME_MACHINE=i686  
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL  
else  
echo ${UNAME_MACHINE}-pc-sysv32  
fi  
exit ;;  
pc:*:*:*)  
# Left here for compatibility:  
# uname -m prints for DJGPP always 'pc', but it prints nothing about  
# the processor, so we play safe by assuming i386.  
echo i386-pc-msdosdjgpp  
exit ;;  
Intel:Mach:3*:*)  
echo i386-pc-mach3  
exit ;;  
paragon:*:*:*)  
echo i860-intel-osf1  
exit ;;  
i860:*:4.*:*) # i860-SVR4  
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then  
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4  
else # Add other i860-SVR4 vendors below as they are discovered.  
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4  
fi  
exit ;;  
mini*:CTIX:SYS*5:*)  
# "miniframe"  
echo m68010-convergent-sysv  
exit ;;  
mc68k:UNIX:SYSTEM5:3.51m)  
echo m68k-convergent-sysv  
exit ;;  
M680?0:D-NIX:5.3:*)  
echo m68k-diab-dnix  
exit ;;  
M68*:*:R3V[5678]*:*)  
test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;  
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)  
OS_REL=''  
test -r /etc/.relid \  
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`  
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \  
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }  
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \  
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;  
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)  
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \  
&& { echo i486-ncr-sysv4; exit; } ;;  
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)  
echo m68k-unknown-lynxos${UNAME_RELEASE}  
exit ;;  
mc68030:UNIX_System_V:4.*:*)  
echo m68k-atari-sysv4  
exit ;;  
TSUNAMI:LynxOS:2.*:*)  
echo sparc-unknown-lynxos${UNAME_RELEASE}  
exit ;;  
rs6000:LynxOS:2.*:*)  
echo rs6000-unknown-lynxos${UNAME_RELEASE}  
exit ;;  
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)  
echo powerpc-unknown-lynxos${UNAME_RELEASE}  
exit ;;  
SM[BE]S:UNIX_SV:*:*)  
echo mips-dde-sysv${UNAME_RELEASE}  
exit ;;  
RM*:ReliantUNIX-*:*:*)  
echo mips-sni-sysv4  
exit ;;  
RM*:SINIX-*:*:*)  
echo mips-sni-sysv4  
exit ;;  
*:SINIX-*:*:*)  
if uname -p 2>/dev/null >/dev/null ; then  
UNAME_MACHINE=`(uname -p) 2>/dev/null`  
echo ${UNAME_MACHINE}-sni-sysv4  
else  
echo ns32k-sni-sysv  
fi  
exit ;;  
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort  
# says <Richard.M.Bartel@ccMail.Census.GOV>  
echo i586-unisys-sysv4  
exit ;;  
*:UNIX_System_V:4*:FTX*)  
# From Gerald Hewes <hewes@openmarket.com>.  
# How about differentiating between stratus architectures? -djm  
echo hppa1.1-stratus-sysv4  
exit ;;  
*:*:*:FTX*)  
# From seanf@swdc.stratus.com.  
echo i860-stratus-sysv4  
exit ;;  
i*86:VOS:*:*)  
# From Paul.Green@stratus.com.  
echo ${UNAME_MACHINE}-stratus-vos  
exit ;;  
*:VOS:*:*)  
# From Paul.Green@stratus.com.  
echo hppa1.1-stratus-vos  
exit ;;  
mc68*:A/UX:*:*)  
echo m68k-apple-aux${UNAME_RELEASE}  
exit ;;  
news*:NEWS-OS:6*:*)  
echo mips-sony-newsos6  
exit ;;  
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)  
if [ -d /usr/nec ]; then  
echo mips-nec-sysv${UNAME_RELEASE}  
else  
echo mips-unknown-sysv${UNAME_RELEASE}  
fi  
exit ;;  
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.  
echo powerpc-be-beos  
exit ;;  
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.  
echo powerpc-apple-beos  
exit ;;  
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.  
echo i586-pc-beos  
exit ;;  
SX-4:SUPER-UX:*:*)  
echo sx4-nec-superux${UNAME_RELEASE}  
exit ;;  
SX-5:SUPER-UX:*:*)  
echo sx5-nec-superux${UNAME_RELEASE}  
exit ;;  
SX-6:SUPER-UX:*:*)  
echo sx6-nec-superux${UNAME_RELEASE}  
exit ;;  
Power*:Rhapsody:*:*)  
echo powerpc-apple-rhapsody${UNAME_RELEASE}  
exit ;;  
*:Rhapsody:*:*)  
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}  
exit ;;  
*:Darwin:*:*)  
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown  
case $UNAME_PROCESSOR in  
*86) UNAME_PROCESSOR=i686 ;;  
unknown) UNAME_PROCESSOR=powerpc ;;  
esac  
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}  
exit ;;  
*:procnto*:*:* | *:QNX:[0123456789]*:*)  
UNAME_PROCESSOR=`uname -p`  
if test "$UNAME_PROCESSOR" = "x86"; then  
UNAME_PROCESSOR=i386  
UNAME_MACHINE=pc  
fi  
echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}  
exit ;;  
*:QNX:*:4*)  
echo i386-pc-qnx  
exit ;;  
NSE-?:NONSTOP_KERNEL:*:*)  
echo nse-tandem-nsk${UNAME_RELEASE}  
exit ;;  
NSR-?:NONSTOP_KERNEL:*:*)  
echo nsr-tandem-nsk${UNAME_RELEASE}  
exit ;;  
*:NonStop-UX:*:*)  
echo mips-compaq-nonstopux  
exit ;;  
BS2000:POSIX*:*:*)  
echo bs2000-siemens-sysv  
exit ;;  
DS/*:UNIX_System_V:*:*)  
echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}  
exit ;;  
*:Plan9:*:*)  
# "uname -m" is not consistent, so use $cputype instead. 386  
# is converted to i386 for consistency with other x86  
# operating systems.  
if test "$cputype" = "386"; then  
UNAME_MACHINE=i386  
else  
UNAME_MACHINE="$cputype"  
fi  
echo ${UNAME_MACHINE}-unknown-plan9  
exit ;;  
*:TOPS-10:*:*)  
echo pdp10-unknown-tops10  
exit ;;  
*:TENEX:*:*)  
echo pdp10-unknown-tenex  
exit ;;  
KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)  
echo pdp10-dec-tops20  
exit ;;  
XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)  
echo pdp10-xkl-tops20  
exit ;;  
*:TOPS-20:*:*)  
echo pdp10-unknown-tops20  
exit ;;  
*:ITS:*:*)  
echo pdp10-unknown-its  
exit ;;  
SEI:*:*:SEIUX)  
echo mips-sei-seiux${UNAME_RELEASE}  
exit ;;  
*:DragonFly:*:*)  
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`  
exit ;;  
*:*VMS:*:*)  
UNAME_MACHINE=`(uname -p) 2>/dev/null`  
case "${UNAME_MACHINE}" in  
A*) echo alpha-dec-vms ; exit ;;  
I*) echo ia64-dec-vms ; exit ;;  
V*) echo vax-dec-vms ; exit ;;  
esac ;;  
*:XENIX:*:SysV)  
echo i386-pc-xenix  
exit ;;  
i*86:skyos:*:*)  
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'  
exit ;;  
esac  
 
#echo '(No uname command or uname output not recognized.)' 1>&2  
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2  
 
eval $set_cc_for_build  
cat >$dummy.c <<EOF  
#ifdef _SEQUENT_  
# include <sys/types.h>  
# include <sys/utsname.h>  
#endif  
main ()  
{  
#if defined (sony)  
#if defined (MIPSEB)  
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,  
I don't know.... */  
printf ("mips-sony-bsd\n"); exit (0);  
#else  
#include <sys/param.h>  
printf ("m68k-sony-newsos%s\n",  
#ifdef NEWSOS4  
"4"  
#else  
""  
#endif  
); exit (0);  
#endif  
#endif  
 
#if defined (__arm) && defined (__acorn) && defined (__unix)  
printf ("arm-acorn-riscix\n"); exit (0);  
#endif  
 
#if defined (hp300) && !defined (hpux)  
printf ("m68k-hp-bsd\n"); exit (0);  
#endif  
 
#if defined (NeXT)  
#if !defined (__ARCHITECTURE__)  
#define __ARCHITECTURE__ "m68k"  
#endif  
int version;  
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;  
if (version < 4)  
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);  
else  
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);  
exit (0);  
#endif  
 
#if defined (MULTIMAX) || defined (n16)  
#if defined (UMAXV)  
printf ("ns32k-encore-sysv\n"); exit (0);  
#else  
#if defined (CMU)  
printf ("ns32k-encore-mach\n"); exit (0);  
#else  
printf ("ns32k-encore-bsd\n"); exit (0);  
#endif  
#endif  
#endif  
 
#if defined (__386BSD__)  
printf ("i386-pc-bsd\n"); exit (0);  
#endif  
 
#if defined (sequent)  
#if defined (i386)  
printf ("i386-sequent-dynix\n"); exit (0);  
#endif  
#if defined (ns32000)  
printf ("ns32k-sequent-dynix\n"); exit (0);  
#endif  
#endif  
 
#if defined (_SEQUENT_)  
struct utsname un;  
 
uname(&un);  
 
if (strncmp(un.version, "V2", 2) == 0) {  
printf ("i386-sequent-ptx2\n"); exit (0);  
}  
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */  
printf ("i386-sequent-ptx1\n"); exit (0);  
}  
printf ("i386-sequent-ptx\n"); exit (0);  
 
#endif  
 
#if defined (vax)  
# if !defined (ultrix)  
# include <sys/param.h>  
# if defined (BSD)  
# if BSD == 43  
printf ("vax-dec-bsd4.3\n"); exit (0);  
# else  
# if BSD == 199006  
printf ("vax-dec-bsd4.3reno\n"); exit (0);  
# else  
printf ("vax-dec-bsd\n"); exit (0);  
# endif  
# endif  
# else  
printf ("vax-dec-bsd\n"); exit (0);  
# endif  
# else  
printf ("vax-dec-ultrix\n"); exit (0);  
# endif  
#endif  
 
#if defined (alliant) && defined (i860)  
printf ("i860-alliant-bsd\n"); exit (0);  
#endif  
 
exit (1);  
}  
EOF  
 
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&  
{ echo "$SYSTEM_NAME"; exit; }  
 
# Apollos put the system type in the environment.  
 
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }  
 
# Convex versions that predate uname can use getsysinfo(1)  
 
if [ -x /usr/convex/getsysinfo ]  
then  
case `getsysinfo -f cpu_type` in  
c1*)  
echo c1-convex-bsd  
exit ;;  
c2*)  
if getsysinfo -f scalar_acc  
then echo c32-convex-bsd  
else echo c2-convex-bsd  
fi  
exit ;;  
c34*)  
echo c34-convex-bsd  
exit ;;  
c38*)  
echo c38-convex-bsd  
exit ;;  
c4*)  
echo c4-convex-bsd  
exit ;;  
esac  
fi  
 
cat >&2 <<EOF  
$0: unable to guess system type  
 
This script, last modified $timestamp, has failed to recognize  
the operating system you are using. It is advised that you  
download the most up to date version of the config scripts from  
 
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess  
and  
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub  
 
If the version you run ($0) is already up to date, please  
send the following data and any information you think might be  
pertinent to <config-patches@gnu.org> in order to provide the needed  
information to handle your system.  
 
config.guess timestamp = $timestamp  
 
uname -m = `(uname -m) 2>/dev/null || echo unknown`  
uname -r = `(uname -r) 2>/dev/null || echo unknown`  
uname -s = `(uname -s) 2>/dev/null || echo unknown`  
uname -v = `(uname -v) 2>/dev/null || echo unknown`  
 
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`  
/bin/uname -X = `(/bin/uname -X) 2>/dev/null`  
 
hostinfo = `(hostinfo) 2>/dev/null`  
/bin/universe = `(/bin/universe) 2>/dev/null`  
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`  
/bin/arch = `(/bin/arch) 2>/dev/null`  
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`  
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`  
 
UNAME_MACHINE = ${UNAME_MACHINE}  
UNAME_RELEASE = ${UNAME_RELEASE}  
UNAME_SYSTEM = ${UNAME_SYSTEM}  
UNAME_VERSION = ${UNAME_VERSION}  
EOF  
 
exit 1  
 
# Local variables:  
# eval: (add-hook 'write-file-hooks 'time-stamp)  
# time-stamp-start: "timestamp='"  
# time-stamp-format: "%:y-%02m-%02d"  
# time-stamp-end: "'"  
# End:  
 
OS=@OS@  
 
PYTHON_LDFLAGS=@PYTHON_LDFLAGS@  
PYTHON_CFLAGS=@PYTHON_CPPFLAGS@  
RUBY_LDFLAGS=@RUBY_LDFLAGS@  
RUBY_CFLAGS=@RUBY_CPPFLAGS@  
RUBY_VERSION=@RUBY_VERSION@  
INSTALL=@INSTALL@  
INSTALL_DATA=@INSTALL_DATA@  
INSTALL_PROGRAM=@INSTALL_PROGRAM@  
INSTALL_SCRIPT=@INSTALL_SCRIPT@  
 
prefix=@prefix@  
exec_prefix=@exec_prefix@  
bindir=@bindir@  
libdir=@libdir@  
libexecdir=@libexecdir@  
sbindir=@sbindir@  
 
#! /bin/sh  
# Configuration validation subroutine script.  
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,  
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.  
 
timestamp='2005-07-08'  
 
# This file is (in principle) common to ALL GNU software.  
# The presence of a machine in this file suggests that SOME GNU software  
# can handle that machine. It does not imply ALL GNU software can.  
#  
# This file is free software; you can redistribute it and/or modify  
# it under the terms of the GNU General Public License as published by  
# the Free Software Foundation; either version 2 of the License, or  
# (at your option) any later version.  
#  
# This program is distributed in the hope that it will be useful,  
# but WITHOUT ANY WARRANTY; without even the implied warranty of  
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
# GNU General Public License for more details.  
#  
# You should have received a copy of the GNU General Public License  
# along with this program; if not, write to the Free Software  
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA  
# 02110-1301, USA.  
#  
# As a special exception to the GNU General Public License, if you  
# distribute this file as part of a program that contains a  
# configuration script generated by Autoconf, you may include it under  
# the same distribution terms that you use for the rest of that program.  
 
 
# Please send patches to <config-patches@gnu.org>. Submit a context  
# diff and a properly formatted ChangeLog entry.  
#  
# Configuration subroutine to validate and canonicalize a configuration type.  
# Supply the specified configuration type as an argument.  
# If it is invalid, we print an error message on stderr and exit with code 1.  
# Otherwise, we print the canonical config type on stdout and succeed.  
 
# This file is supposed to be the same for all GNU packages  
# and recognize all the CPU types, system types and aliases  
# that are meaningful with *any* GNU software.  
# Each package is responsible for reporting which valid configurations  
# it does not support. The user should be able to distinguish  
# a failure to support a valid configuration from a meaningless  
# configuration.  
 
# The goal of this file is to map all the various variations of a given  
# machine specification into a single specification in the form:  
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM  
# or in some cases, the newer four-part form:  
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM  
# It is wrong to echo any other type of specification.  
 
me=`echo "$0" | sed -e 's,.*/,,'`  
 
usage="\  
Usage: $0 [OPTION] CPU-MFR-OPSYS  
$0 [OPTION] ALIAS  
 
Canonicalize a configuration name.  
 
Operation modes:  
-h, --help print this help, then exit  
-t, --time-stamp print date of last modification, then exit  
-v, --version print version number, then exit  
 
Report bugs and patches to <config-patches@gnu.org>."  
 
version="\  
GNU config.sub ($timestamp)  
 
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005  
Free Software Foundation, Inc.  
 
This is free software; see the source for copying conditions. There is NO  
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."  
 
help="  
Try \`$me --help' for more information."  
 
# Parse command line  
while test $# -gt 0 ; do  
case $1 in  
--time-stamp | --time* | -t )  
echo "$timestamp" ; exit ;;  
--version | -v )  
echo "$version" ; exit ;;  
--help | --h* | -h )  
echo "$usage"; exit ;;  
-- ) # Stop option processing  
shift; break ;;  
- ) # Use stdin as input.  
break ;;  
-* )  
echo "$me: invalid option $1$help"  
exit 1 ;;  
 
*local*)  
# First pass through any local machine types.  
echo $1  
exit ;;  
 
* )  
break ;;  
esac  
done  
 
case $# in  
0) echo "$me: missing argument$help" >&2  
exit 1;;  
1) ;;  
*) echo "$me: too many arguments$help" >&2  
exit 1;;  
esac  
 
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).  
# Here we must recognize all the valid KERNEL-OS combinations.  
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`  
case $maybe_os in  
nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \  
kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)  
os=-$maybe_os  
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`  
;;  
*)  
basic_machine=`echo $1 | sed 's/-[^-]*$//'`  
if [ $basic_machine != $1 ]  
then os=`echo $1 | sed 's/.*-/-/'`  
else os=; fi  
;;  
esac  
 
### Let's recognize common machines as not being operating systems so  
### that things like config.sub decstation-3100 work. We also  
### recognize some manufacturers as not being operating systems, so we  
### can provide default operating systems below.  
case $os in  
-sun*os*)  
# Prevent following clause from handling this invalid input.  
;;  
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \  
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \  
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \  
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\  
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \  
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \  
-apple | -axis | -knuth | -cray)  
os=  
basic_machine=$1  
;;  
-sim | -cisco | -oki | -wec | -winbond)  
os=  
basic_machine=$1  
;;  
-scout)  
;;  
-wrs)  
os=-vxworks  
basic_machine=$1  
;;  
-chorusos*)  
os=-chorusos  
basic_machine=$1  
;;  
-chorusrdb)  
os=-chorusrdb  
basic_machine=$1  
;;  
-hiux*)  
os=-hiuxwe2  
;;  
-sco5)  
os=-sco3.2v5  
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`  
;;  
-sco4)  
os=-sco3.2v4  
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`  
;;  
-sco3.2.[4-9]*)  
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`  
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`  
;;  
-sco3.2v[4-9]*)  
# Don't forget version if it is 3.2v4 or newer.  
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`  
;;  
-sco*)  
os=-sco3.2v2  
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`  
;;  
-udk*)  
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`  
;;  
-isc)  
os=-isc2.2  
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`  
;;  
-clix*)  
basic_machine=clipper-intergraph  
;;  
-isc*)  
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`  
;;  
-lynx*)  
os=-lynxos  
;;  
-ptx*)  
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`  
;;  
-windowsnt*)  
os=`echo $os | sed -e 's/windowsnt/winnt/'`  
;;  
-psos*)  
os=-psos  
;;  
-mint | -mint[0-9]*)  
basic_machine=m68k-atari  
os=-mint  
;;  
esac  
 
# Decode aliases for certain CPU-COMPANY combinations.  
case $basic_machine in  
# Recognize the basic CPU types without company name.  
# Some are omitted here because they have special meanings below.  
1750a | 580 \  
| a29k \  
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \  
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \  
| am33_2.0 \  
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \  
| bfin \  
| c4x | clipper \  
| d10v | d30v | dlx | dsp16xx \  
| fr30 | frv \  
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \  
| i370 | i860 | i960 | ia64 \  
| ip2k | iq2000 \  
| m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \  
| mips | mipsbe | mipseb | mipsel | mipsle \  
| mips16 \  
| mips64 | mips64el \  
| mips64vr | mips64vrel \  
| mips64orion | mips64orionel \  
| mips64vr4100 | mips64vr4100el \  
| mips64vr4300 | mips64vr4300el \  
| mips64vr5000 | mips64vr5000el \  
| mips64vr5900 | mips64vr5900el \  
| mipsisa32 | mipsisa32el \  
| mipsisa32r2 | mipsisa32r2el \  
| mipsisa64 | mipsisa64el \  
| mipsisa64r2 | mipsisa64r2el \  
| mipsisa64sb1 | mipsisa64sb1el \  
| mipsisa64sr71k | mipsisa64sr71kel \  
| mipstx39 | mipstx39el \  
| mn10200 | mn10300 \  
| ms1 \  
| msp430 \  
| ns16k | ns32k \  
| or32 \  
| pdp10 | pdp11 | pj | pjl \  
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \  
| pyramid \  
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \  
| sh64 | sh64le \  
| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \  
| sparcv8 | sparcv9 | sparcv9b \  
| strongarm \  
| tahoe | thumb | tic4x | tic80 | tron \  
| v850 | v850e \  
| we32k \  
| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \  
| z8k)  
basic_machine=$basic_machine-unknown  
;;  
m32c)  
basic_machine=$basic_machine-unknown  
;;  
m6811 | m68hc11 | m6812 | m68hc12)  
# Motorola 68HC11/12.  
basic_machine=$basic_machine-unknown  
os=-none  
;;  
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)  
;;  
 
# We use `pc' rather than `unknown'  
# because (1) that's what they normally are, and  
# (2) the word "unknown" tends to confuse beginning users.  
i*86 | x86_64)  
basic_machine=$basic_machine-pc  
;;  
# Object if more than one company name word.  
*-*-*)  
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2  
exit 1  
;;  
# Recognize the basic CPU types with company name.  
580-* \  
| a29k-* \  
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \  
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \  
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \  
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \  
| avr-* \  
| bfin-* | bs2000-* \  
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \  
| clipper-* | craynv-* | cydra-* \  
| d10v-* | d30v-* | dlx-* \  
| elxsi-* \  
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \  
| h8300-* | h8500-* \  
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \  
| i*86-* | i860-* | i960-* | ia64-* \  
| ip2k-* | iq2000-* \  
| m32r-* | m32rle-* \  
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \  
| m88110-* | m88k-* | maxq-* | mcore-* \  
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \  
| mips16-* \  
| mips64-* | mips64el-* \  
| mips64vr-* | mips64vrel-* \  
| mips64orion-* | mips64orionel-* \  
| mips64vr4100-* | mips64vr4100el-* \  
| mips64vr4300-* | mips64vr4300el-* \  
| mips64vr5000-* | mips64vr5000el-* \  
| mips64vr5900-* | mips64vr5900el-* \  
| mipsisa32-* | mipsisa32el-* \  
| mipsisa32r2-* | mipsisa32r2el-* \  
| mipsisa64-* | mipsisa64el-* \  
| mipsisa64r2-* | mipsisa64r2el-* \  
| mipsisa64sb1-* | mipsisa64sb1el-* \  
| mipsisa64sr71k-* | mipsisa64sr71kel-* \  
| mipstx39-* | mipstx39el-* \  
| mmix-* \  
| ms1-* \  
| msp430-* \  
| none-* | np1-* | ns16k-* | ns32k-* \  
| orion-* \  
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \  
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \  
| pyramid-* \  
| romp-* | rs6000-* \  
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \  
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \  
| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \  
| sparclite-* \  
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \  
| tahoe-* | thumb-* \  
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \  
| tron-* \  
| v850-* | v850e-* | vax-* \  
| we32k-* \  
| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \  
| xstormy16-* | xtensa-* \  
| ymp-* \  
| z8k-*)  
;;  
m32c-*)  
;;  
# Recognize the various machine names and aliases which stand  
# for a CPU type and a company and sometimes even an OS.  
386bsd)  
basic_machine=i386-unknown  
os=-bsd  
;;  
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)  
basic_machine=m68000-att  
;;  
3b*)  
basic_machine=we32k-att  
;;  
a29khif)  
basic_machine=a29k-amd  
os=-udi  
;;  
abacus)  
basic_machine=abacus-unknown  
;;  
adobe68k)  
basic_machine=m68010-adobe  
os=-scout  
;;  
alliant | fx80)  
basic_machine=fx80-alliant  
;;  
altos | altos3068)  
basic_machine=m68k-altos  
;;  
am29k)  
basic_machine=a29k-none  
os=-bsd  
;;  
amd64)  
basic_machine=x86_64-pc  
;;  
amd64-*)  
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`  
;;  
amdahl)  
basic_machine=580-amdahl  
os=-sysv  
;;  
amiga | amiga-*)  
basic_machine=m68k-unknown  
;;  
amigaos | amigados)  
basic_machine=m68k-unknown  
os=-amigaos  
;;  
amigaunix | amix)  
basic_machine=m68k-unknown  
os=-sysv4  
;;  
apollo68)  
basic_machine=m68k-apollo  
os=-sysv  
;;  
apollo68bsd)  
basic_machine=m68k-apollo  
os=-bsd  
;;  
aux)  
basic_machine=m68k-apple  
os=-aux  
;;  
balance)  
basic_machine=ns32k-sequent  
os=-dynix  
;;  
c90)  
basic_machine=c90-cray  
os=-unicos  
;;  
convex-c1)  
basic_machine=c1-convex  
os=-bsd  
;;  
convex-c2)  
basic_machine=c2-convex  
os=-bsd  
;;  
convex-c32)  
basic_machine=c32-convex  
os=-bsd  
;;  
convex-c34)  
basic_machine=c34-convex  
os=-bsd  
;;  
convex-c38)  
basic_machine=c38-convex  
os=-bsd  
;;  
cray | j90)  
basic_machine=j90-cray  
os=-unicos  
;;  
craynv)  
basic_machine=craynv-cray  
os=-unicosmp  
;;  
cr16c)  
basic_machine=cr16c-unknown  
os=-elf  
;;  
crds | unos)  
basic_machine=m68k-crds  
;;  
crisv32 | crisv32-* | etraxfs*)  
basic_machine=crisv32-axis  
;;  
cris | cris-* | etrax*)  
basic_machine=cris-axis  
;;  
crx)  
basic_machine=crx-unknown  
os=-elf  
;;  
da30 | da30-*)  
basic_machine=m68k-da30  
;;  
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)  
basic_machine=mips-dec  
;;  
decsystem10* | dec10*)  
basic_machine=pdp10-dec  
os=-tops10  
;;  
decsystem20* | dec20*)  
basic_machine=pdp10-dec  
os=-tops20  
;;  
delta | 3300 | motorola-3300 | motorola-delta \  
| 3300-motorola | delta-motorola)  
basic_machine=m68k-motorola  
;;  
delta88)  
basic_machine=m88k-motorola  
os=-sysv3  
;;  
djgpp)  
basic_machine=i586-pc  
os=-msdosdjgpp  
;;  
dpx20 | dpx20-*)  
basic_machine=rs6000-bull  
os=-bosx  
;;  
dpx2* | dpx2*-bull)  
basic_machine=m68k-bull  
os=-sysv3  
;;  
ebmon29k)  
basic_machine=a29k-amd  
os=-ebmon  
;;  
elxsi)  
basic_machine=elxsi-elxsi  
os=-bsd  
;;  
encore | umax | mmax)  
basic_machine=ns32k-encore  
;;  
es1800 | OSE68k | ose68k | ose | OSE)  
basic_machine=m68k-ericsson  
os=-ose  
;;  
fx2800)  
basic_machine=i860-alliant  
;;  
genix)  
basic_machine=ns32k-ns  
;;  
gmicro)  
basic_machine=tron-gmicro  
os=-sysv  
;;  
go32)  
basic_machine=i386-pc  
os=-go32  
;;  
h3050r* | hiux*)  
basic_machine=hppa1.1-hitachi  
os=-hiuxwe2  
;;  
h8300hms)  
basic_machine=h8300-hitachi  
os=-hms  
;;  
h8300xray)  
basic_machine=h8300-hitachi  
os=-xray  
;;  
h8500hms)  
basic_machine=h8500-hitachi  
os=-hms  
;;  
harris)  
basic_machine=m88k-harris  
os=-sysv3  
;;  
hp300-*)  
basic_machine=m68k-hp  
;;  
hp300bsd)  
basic_machine=m68k-hp  
os=-bsd  
;;  
hp300hpux)  
basic_machine=m68k-hp  
os=-hpux  
;;  
hp3k9[0-9][0-9] | hp9[0-9][0-9])  
basic_machine=hppa1.0-hp  
;;  
hp9k2[0-9][0-9] | hp9k31[0-9])  
basic_machine=m68000-hp  
;;  
hp9k3[2-9][0-9])  
basic_machine=m68k-hp  
;;  
hp9k6[0-9][0-9] | hp6[0-9][0-9])  
basic_machine=hppa1.0-hp  
;;  
hp9k7[0-79][0-9] | hp7[0-79][0-9])  
basic_machine=hppa1.1-hp  
;;  
hp9k78[0-9] | hp78[0-9])  
# FIXME: really hppa2.0-hp  
basic_machine=hppa1.1-hp  
;;  
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)  
# FIXME: really hppa2.0-hp  
basic_machine=hppa1.1-hp  
;;  
hp9k8[0-9][13679] | hp8[0-9][13679])  
basic_machine=hppa1.1-hp  
;;  
hp9k8[0-9][0-9] | hp8[0-9][0-9])  
basic_machine=hppa1.0-hp  
;;  
hppa-next)  
os=-nextstep3  
;;  
hppaosf)  
basic_machine=hppa1.1-hp  
os=-osf  
;;  
hppro)  
basic_machine=hppa1.1-hp  
os=-proelf  
;;  
i370-ibm* | ibm*)  
basic_machine=i370-ibm  
;;  
# I'm not sure what "Sysv32" means. Should this be sysv3.2?  
i*86v32)  
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`  
os=-sysv32  
;;  
i*86v4*)  
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`  
os=-sysv4  
;;  
i*86v)  
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`  
os=-sysv  
;;  
i*86sol2)  
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`  
os=-solaris2  
;;  
i386mach)  
basic_machine=i386-mach  
os=-mach  
;;  
i386-vsta | vsta)  
basic_machine=i386-unknown  
os=-vsta  
;;  
iris | iris4d)  
basic_machine=mips-sgi  
case $os in  
-irix*)  
;;  
*)  
os=-irix4  
;;  
esac  
;;  
isi68 | isi)  
basic_machine=m68k-isi  
os=-sysv  
;;  
m88k-omron*)  
basic_machine=m88k-omron  
;;  
magnum | m3230)  
basic_machine=mips-mips  
os=-sysv  
;;  
merlin)  
basic_machine=ns32k-utek  
os=-sysv  
;;  
mingw32)  
basic_machine=i386-pc  
os=-mingw32  
;;  
miniframe)  
basic_machine=m68000-convergent  
;;  
*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)  
basic_machine=m68k-atari  
os=-mint  
;;  
mips3*-*)  
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`  
;;  
mips3*)  
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown  
;;  
monitor)  
basic_machine=m68k-rom68k  
os=-coff  
;;  
morphos)  
basic_machine=powerpc-unknown  
os=-morphos  
;;  
msdos)  
basic_machine=i386-pc  
os=-msdos  
;;  
mvs)  
basic_machine=i370-ibm  
os=-mvs  
;;  
ncr3000)  
basic_machine=i486-ncr  
os=-sysv4  
;;  
netbsd386)  
basic_machine=i386-unknown  
os=-netbsd  
;;  
netwinder)  
basic_machine=armv4l-rebel  
os=-linux  
;;  
news | news700 | news800 | news900)  
basic_machine=m68k-sony  
os=-newsos  
;;  
news1000)  
basic_machine=m68030-sony  
os=-newsos  
;;  
news-3600 | risc-news)  
basic_machine=mips-sony  
os=-newsos  
;;  
necv70)  
basic_machine=v70-nec  
os=-sysv  
;;  
next | m*-next )  
basic_machine=m68k-next  
case $os in  
-nextstep* )  
;;  
-ns2*)  
os=-nextstep2  
;;  
*)  
os=-nextstep3  
;;  
esac  
;;  
nh3000)  
basic_machine=m68k-harris  
os=-cxux  
;;  
nh[45]000)  
basic_machine=m88k-harris  
os=-cxux  
;;  
nindy960)  
basic_machine=i960-intel  
os=-nindy  
;;  
mon960)  
basic_machine=i960-intel  
os=-mon960  
;;  
nonstopux)  
basic_machine=mips-compaq  
os=-nonstopux  
;;  
np1)  
basic_machine=np1-gould  
;;  
nsr-tandem)  
basic_machine=nsr-tandem  
;;  
op50n-* | op60c-*)  
basic_machine=hppa1.1-oki  
os=-proelf  
;;  
openrisc | openrisc-*)  
basic_machine=or32-unknown  
;;  
os400)  
basic_machine=powerpc-ibm  
os=-os400  
;;  
OSE68000 | ose68000)  
basic_machine=m68000-ericsson  
os=-ose  
;;  
os68k)  
basic_machine=m68k-none  
os=-os68k  
;;  
pa-hitachi)  
basic_machine=hppa1.1-hitachi  
os=-hiuxwe2  
;;  
paragon)  
basic_machine=i860-intel  
os=-osf  
;;  
pbd)  
basic_machine=sparc-tti  
;;  
pbb)  
basic_machine=m68k-tti  
;;  
pc532 | pc532-*)  
basic_machine=ns32k-pc532  
;;  
pentium | p5 | k5 | k6 | nexgen | viac3)  
basic_machine=i586-pc  
;;  
pentiumpro | p6 | 6x86 | athlon | athlon_*)  
basic_machine=i686-pc  
;;  
pentiumii | pentium2 | pentiumiii | pentium3)  
basic_machine=i686-pc  
;;  
pentium4)  
basic_machine=i786-pc  
;;  
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)  
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`  
;;  
pentiumpro-* | p6-* | 6x86-* | athlon-*)  
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`  
;;  
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)  
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`  
;;  
pentium4-*)  
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`  
;;  
pn)  
basic_machine=pn-gould  
;;  
power) basic_machine=power-ibm  
;;  
ppc) basic_machine=powerpc-unknown  
;;  
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`  
;;  
ppcle | powerpclittle | ppc-le | powerpc-little)  
basic_machine=powerpcle-unknown  
;;  
ppcle-* | powerpclittle-*)  
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`  
;;  
ppc64) basic_machine=powerpc64-unknown  
;;  
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`  
;;  
ppc64le | powerpc64little | ppc64-le | powerpc64-little)  
basic_machine=powerpc64le-unknown  
;;  
ppc64le-* | powerpc64little-*)  
basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`  
;;  
ps2)  
basic_machine=i386-ibm  
;;  
pw32)  
basic_machine=i586-unknown  
os=-pw32  
;;  
rom68k)  
basic_machine=m68k-rom68k  
os=-coff  
;;  
rm[46]00)  
basic_machine=mips-siemens  
;;  
rtpc | rtpc-*)  
basic_machine=romp-ibm  
;;  
s390 | s390-*)  
basic_machine=s390-ibm  
;;  
s390x | s390x-*)  
basic_machine=s390x-ibm  
;;  
sa29200)  
basic_machine=a29k-amd  
os=-udi  
;;  
sb1)  
basic_machine=mipsisa64sb1-unknown  
;;  
sb1el)  
basic_machine=mipsisa64sb1el-unknown  
;;  
sei)  
basic_machine=mips-sei  
os=-seiux  
;;  
sequent)  
basic_machine=i386-sequent  
;;  
sh)  
basic_machine=sh-hitachi  
os=-hms  
;;  
sh64)  
basic_machine=sh64-unknown  
;;  
sparclite-wrs | simso-wrs)  
basic_machine=sparclite-wrs  
os=-vxworks  
;;  
sps7)  
basic_machine=m68k-bull  
os=-sysv2  
;;  
spur)  
basic_machine=spur-unknown  
;;  
st2000)  
basic_machine=m68k-tandem  
;;  
stratus)  
basic_machine=i860-stratus  
os=-sysv4  
;;  
sun2)  
basic_machine=m68000-sun  
;;  
sun2os3)  
basic_machine=m68000-sun  
os=-sunos3  
;;  
sun2os4)  
basic_machine=m68000-sun  
os=-sunos4  
;;  
sun3os3)  
basic_machine=m68k-sun  
os=-sunos3  
;;  
sun3os4)  
basic_machine=m68k-sun  
os=-sunos4  
;;  
sun4os3)  
basic_machine=sparc-sun  
os=-sunos3  
;;  
sun4os4)  
basic_machine=sparc-sun  
os=-sunos4  
;;  
sun4sol2)  
basic_machine=sparc-sun  
os=-solaris2  
;;  
sun3 | sun3-*)  
basic_machine=m68k-sun  
;;  
sun4)  
basic_machine=sparc-sun  
;;  
sun386 | sun386i | roadrunner)  
basic_machine=i386-sun  
;;  
sv1)  
basic_machine=sv1-cray  
os=-unicos  
;;  
symmetry)  
basic_machine=i386-sequent  
os=-dynix  
;;  
t3e)  
basic_machine=alphaev5-cray  
os=-unicos  
;;  
t90)  
basic_machine=t90-cray  
os=-unicos  
;;  
tic54x | c54x*)  
basic_machine=tic54x-unknown  
os=-coff  
;;  
tic55x | c55x*)  
basic_machine=tic55x-unknown  
os=-coff  
;;  
tic6x | c6x*)  
basic_machine=tic6x-unknown  
os=-coff  
;;  
tx39)  
basic_machine=mipstx39-unknown  
;;  
tx39el)  
basic_machine=mipstx39el-unknown  
;;  
toad1)  
basic_machine=pdp10-xkl  
os=-tops20  
;;  
tower | tower-32)  
basic_machine=m68k-ncr  
;;  
tpf)  
basic_machine=s390x-ibm  
os=-tpf  
;;  
udi29k)  
basic_machine=a29k-amd  
os=-udi  
;;  
ultra3)  
basic_machine=a29k-nyu  
os=-sym1  
;;  
v810 | necv810)  
basic_machine=v810-nec  
os=-none  
;;  
vaxv)  
basic_machine=vax-dec  
os=-sysv  
;;  
vms)  
basic_machine=vax-dec  
os=-vms  
;;  
vpp*|vx|vx-*)  
basic_machine=f301-fujitsu  
;;  
vxworks960)  
basic_machine=i960-wrs  
os=-vxworks  
;;  
vxworks68)  
basic_machine=m68k-wrs  
os=-vxworks  
;;  
vxworks29k)  
basic_machine=a29k-wrs  
os=-vxworks  
;;  
w65*)  
basic_machine=w65-wdc  
os=-none  
;;  
w89k-*)  
basic_machine=hppa1.1-winbond  
os=-proelf  
;;  
xbox)  
basic_machine=i686-pc  
os=-mingw32  
;;  
xps | xps100)  
basic_machine=xps100-honeywell  
;;  
ymp)  
basic_machine=ymp-cray  
os=-unicos  
;;  
z8k-*-coff)  
basic_machine=z8k-unknown  
os=-sim  
;;  
none)  
basic_machine=none-none  
os=-none  
;;  
 
# Here we handle the default manufacturer of certain CPU types. It is in  
# some cases the only manufacturer, in others, it is the most popular.  
w89k)  
basic_machine=hppa1.1-winbond  
;;  
op50n)  
basic_machine=hppa1.1-oki  
;;  
op60c)  
basic_machine=hppa1.1-oki  
;;  
romp)  
basic_machine=romp-ibm  
;;  
mmix)  
basic_machine=mmix-knuth  
;;  
rs6000)  
basic_machine=rs6000-ibm  
;;  
vax)  
basic_machine=vax-dec  
;;  
pdp10)  
# there are many clones, so DEC is not a safe bet  
basic_machine=pdp10-unknown  
;;  
pdp11)  
basic_machine=pdp11-dec  
;;  
we32k)  
basic_machine=we32k-att  
;;  
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)  
basic_machine=sh-unknown  
;;  
sparc | sparcv8 | sparcv9 | sparcv9b)  
basic_machine=sparc-sun  
;;  
cydra)  
basic_machine=cydra-cydrome  
;;  
orion)  
basic_machine=orion-highlevel  
;;  
orion105)  
basic_machine=clipper-highlevel  
;;  
mac | mpw | mac-mpw)  
basic_machine=m68k-apple  
;;  
pmac | pmac-mpw)  
basic_machine=powerpc-apple  
;;  
*-unknown)  
# Make sure to match an already-canonicalized machine name.  
;;  
*)  
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2  
exit 1  
;;  
esac  
 
# Here we canonicalize certain aliases for manufacturers.  
case $basic_machine in  
*-digital*)  
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`  
;;  
*-commodore*)  
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`  
;;  
*)  
;;  
esac  
 
# Decode manufacturer-specific aliases for certain operating systems.  
 
if [ x"$os" != x"" ]  
then  
case $os in  
# First match some system type aliases  
# that might get confused with valid system types.  
# -solaris* is a basic system type, with this one exception.  
-solaris1 | -solaris1.*)  
os=`echo $os | sed -e 's|solaris1|sunos4|'`  
;;  
-solaris)  
os=-solaris2  
;;  
-svr4*)  
os=-sysv4  
;;  
-unixware*)  
os=-sysv4.2uw  
;;  
-gnu/linux*)  
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`  
;;  
# First accept the basic system types.  
# The portable systems comes first.  
# Each alternative MUST END IN A *, to match a version number.  
# -sysv* is not here because it comes later, after sysvr4.  
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \  
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\  
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \  
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \  
| -aos* \  
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \  
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \  
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \  
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \  
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \  
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \  
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \  
| -chorusos* | -chorusrdb* \  
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \  
| -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \  
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \  
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \  
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \  
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \  
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \  
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \  
| -skyos* | -haiku*)  
# Remember, each alternative MUST END IN *, to match a version number.  
;;  
-qnx*)  
case $basic_machine in  
x86-* | i*86-*)  
;;  
*)  
os=-nto$os  
;;  
esac  
;;  
-nto-qnx*)  
;;  
-nto*)  
os=`echo $os | sed -e 's|nto|nto-qnx|'`  
;;  
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \  
| -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \  
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)  
;;  
-mac*)  
os=`echo $os | sed -e 's|mac|macos|'`  
;;  
-linux-dietlibc)  
os=-linux-dietlibc  
;;  
-linux*)  
os=`echo $os | sed -e 's|linux|linux-gnu|'`  
;;  
-sunos5*)  
os=`echo $os | sed -e 's|sunos5|solaris2|'`  
;;  
-sunos6*)  
os=`echo $os | sed -e 's|sunos6|solaris3|'`  
;;  
-opened*)  
os=-openedition  
;;  
-os400*)  
os=-os400  
;;  
-wince*)  
os=-wince  
;;  
-osfrose*)  
os=-osfrose  
;;  
-osf*)  
os=-osf  
;;  
-utek*)  
os=-bsd  
;;  
-dynix*)  
os=-bsd  
;;  
-acis*)  
os=-aos  
;;  
-atheos*)  
os=-atheos  
;;  
-syllable*)  
os=-syllable  
;;  
-386bsd)  
os=-bsd  
;;  
-ctix* | -uts*)  
os=-sysv  
;;  
-nova*)  
os=-rtmk-nova  
;;  
-ns2 )  
os=-nextstep2  
;;  
-nsk*)  
os=-nsk  
;;  
# Preserve the version number of sinix5.  
-sinix5.*)  
os=`echo $os | sed -e 's|sinix|sysv|'`  
;;  
-sinix*)  
os=-sysv4  
;;  
-tpf*)  
os=-tpf  
;;  
-triton*)  
os=-sysv3  
;;  
-oss*)  
os=-sysv3  
;;  
-svr4)  
os=-sysv4  
;;  
-svr3)  
os=-sysv3  
;;  
-sysvr4)  
os=-sysv4  
;;  
# This must come after -sysvr4.  
-sysv*)  
;;  
-ose*)  
os=-ose  
;;  
-es1800*)  
os=-ose  
;;  
-xenix)  
os=-xenix  
;;  
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)  
os=-mint  
;;  
-aros*)  
os=-aros  
;;  
-kaos*)  
os=-kaos  
;;  
-zvmoe)  
os=-zvmoe  
;;  
-none)  
;;  
*)  
# Get rid of the `-' at the beginning of $os.  
os=`echo $os | sed 's/[^-]*-//'`  
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2  
exit 1  
;;  
esac  
else  
 
# Here we handle the default operating systems that come with various machines.  
# The value should be what the vendor currently ships out the door with their  
# machine or put another way, the most popular os provided with the machine.  
 
# Note that if you're going to try to match "-MANUFACTURER" here (say,  
# "-sun"), then you have to tell the case statement up towards the top  
# that MANUFACTURER isn't an operating system. Otherwise, code above  
# will signal an error saying that MANUFACTURER isn't an operating  
# system, and we'll never get to this point.  
 
case $basic_machine in  
*-acorn)  
os=-riscix1.2  
;;  
arm*-rebel)  
os=-linux  
;;  
arm*-semi)  
os=-aout  
;;  
c4x-* | tic4x-*)  
os=-coff  
;;  
# This must come before the *-dec entry.  
pdp10-*)  
os=-tops20  
;;  
pdp11-*)  
os=-none  
;;  
*-dec | vax-*)  
os=-ultrix4.2  
;;  
m68*-apollo)  
os=-domain  
;;  
i386-sun)  
os=-sunos4.0.2  
;;  
m68000-sun)  
os=-sunos3  
# This also exists in the configure program, but was not the  
# default.  
# os=-sunos4  
;;  
m68*-cisco)  
os=-aout  
;;  
mips*-cisco)  
os=-elf  
;;  
mips*-*)  
os=-elf  
;;  
or32-*)  
os=-coff  
;;  
*-tti) # must be before sparc entry or we get the wrong os.  
os=-sysv3  
;;  
sparc-* | *-sun)  
os=-sunos4.1.1  
;;  
*-be)  
os=-beos  
;;  
*-haiku)  
os=-haiku  
;;  
*-ibm)  
os=-aix  
;;  
*-knuth)  
os=-mmixware  
;;  
*-wec)  
os=-proelf  
;;  
*-winbond)  
os=-proelf  
;;  
*-oki)  
os=-proelf  
;;  
*-hp)  
os=-hpux  
;;  
*-hitachi)  
os=-hiux  
;;  
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)  
os=-sysv  
;;  
*-cbm)  
os=-amigaos  
;;  
*-dg)  
os=-dgux  
;;  
*-dolphin)  
os=-sysv3  
;;  
m68k-ccur)  
os=-rtu  
;;  
m88k-omron*)  
os=-luna  
;;  
*-next )  
os=-nextstep  
;;  
*-sequent)  
os=-ptx  
;;  
*-crds)  
os=-unos  
;;  
*-ns)  
os=-genix  
;;  
i370-*)  
os=-mvs  
;;  
*-next)  
os=-nextstep3  
;;  
*-gould)  
os=-sysv  
;;  
*-highlevel)  
os=-bsd  
;;  
*-encore)  
os=-bsd  
;;  
*-sgi)  
os=-irix  
;;  
*-siemens)  
os=-sysv4  
;;  
*-masscomp)  
os=-rtu  
;;  
f30[01]-fujitsu | f700-fujitsu)  
os=-uxpv  
;;  
*-rom68k)  
os=-coff  
;;  
*-*bug)  
os=-coff  
;;  
*-apple)  
os=-macos  
;;  
*-atari*)  
os=-mint  
;;  
*)  
os=-none  
;;  
esac  
fi  
 
# Here we handle the case where we know the os, and the CPU type, but not the  
# manufacturer. We pick the logical manufacturer.  
vendor=unknown  
case $basic_machine in  
*-unknown)  
case $os in  
-riscix*)  
vendor=acorn  
;;  
-sunos*)  
vendor=sun  
;;  
-aix*)  
vendor=ibm  
;;  
-beos*)  
vendor=be  
;;  
-hpux*)  
vendor=hp  
;;  
-mpeix*)  
vendor=hp  
;;  
-hiux*)  
vendor=hitachi  
;;  
-unos*)  
vendor=crds  
;;  
-dgux*)  
vendor=dg  
;;  
-luna*)  
vendor=omron  
;;  
-genix*)  
vendor=ns  
;;  
-mvs* | -opened*)  
vendor=ibm  
;;  
-os400*)  
vendor=ibm  
;;  
-ptx*)  
vendor=sequent  
;;  
-tpf*)  
vendor=ibm  
;;  
-vxsim* | -vxworks* | -windiss*)  
vendor=wrs  
;;  
-aux*)  
vendor=apple  
;;  
-hms*)  
vendor=hitachi  
;;  
-mpw* | -macos*)  
vendor=apple  
;;  
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)  
vendor=atari  
;;  
-vos*)  
vendor=stratus  
;;  
esac  
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`  
;;  
esac  
 
echo $basic_machine$os  
exit  
 
# Local variables:  
# eval: (add-hook 'write-file-hooks 'time-stamp)  
# time-stamp-start: "timestamp='"  
# time-stamp-format: "%:y-%02m-%02d"  
# time-stamp-end: "'"  
# End:  
 
# Process this file with autoconf to produce a configure script.  
AC_PREREQ(2.57)  
AC_INIT(libroutez, 0.1.0, libroutez@googlegroups.com, libroutez)  
AC_CONFIG_SRCDIR(lib/tripgraph.cc)  
 
AC_PROG_CC  
AC_PROG_CXX  
AC_PROG_CPP  
AC_PROG_CXXCPP  
AC_PROG_INSTALL  
 
# Detect target build environment  
AC_CANONICAL_TARGET  
case "$target" in  
*-linux*)  
OS="LINUX"  
;;  
*-sunos*|*-solaris*)  
OS="SOLARIS"  
;;  
*-win*)  
OS="WIN32"  
;;  
*-apple*)  
OS="MACOS"  
;;  
*)  
OS="OTHER"  
;;  
esac  
 
AC_SUBST(OS)  
 
AX_PYTHON_DEVEL  
AX_WITH_RUBY  
AX_RUBY_DEVEL  
 
AC_CHECK_PROG(SWIG, swig, swig)  
 
if test x"$SWIG" = "x"; then  
AC_MSG_ERROR("swig not found")  
fi  
 
if test x"$PYTHON_CPPFLAGS" = "x"; then  
AC_MSG_ERROR("python not found")  
fi  
 
if test x"$RUBY_CPPFLAGS" = "x"; then  
AC_MSG_ERROR("ruby not found")  
fi  
 
AC_CONFIG_FILES(config.mk)  
 
AC_OUTPUT  
 
 
#include <stdlib.h>  
#include "tripgraph.h"  
 
using namespace std;  
 
 
int main(int argc, char *argv[])  
{  
// this example does nothing other than simply load a graph into memory  
// useful for profiling memory usage  
 
if (argc < 2)  
{  
printf("Usage: %s <graph file> ", argv[0]);  
return 1;  
}  
 
printf("Loading graph...\n");  
TripGraph g;  
g.load(argv[1]);  
 
return 0;  
}  
 
#include <stdlib.h>  
#include "tripgraph.h"  
 
using namespace std;  
using namespace tr1;  
 
 
void print_actions(shared_ptr<TripAction> &action)  
{  
shared_ptr<TripAction> parent(action->parent);  
if (parent)  
print_actions(parent);  
 
printf("%d->%d; route: %d; start time: %.2f; end time: %.2f\n",  
action->src_id, action->dest_id, action->route_id,  
action->start_time, action->end_time);  
}  
 
 
int main(int argc, char *argv[])  
{  
if (argc < 7)  
{  
printf("Usage: %s <graph file> <src lat> <src lng> <dest lat> "  
"<dest lng> <start time>\n", argv[0]);  
return 1;  
}  
 
float src_lat = atof(argv[2]);  
float src_lng = atof(argv[3]);  
float dest_lat = atof(argv[4]);  
float dest_lng = atof(argv[5]);  
int start_time = atoi(argv[6]);  
 
printf("Loading graph...\n");  
TripGraph g;  
g.load(argv[1]);  
 
printf("Calculating path...\n");  
TripPath *p = g.find_path(start_time, false, src_lat, src_lng,  
dest_lat, dest_lng);  
 
if (p)  
print_actions(p->last_action);  
else  
printf("Couldn't find path.\n");  
 
delete p;  
 
return 0;  
}  
 
#!/usr/bin/python  
 
# This example is just to give a quick example of using the API for python  
# hackers.  
 
# FIXME: flesh this out a bit more  
 
from libroutez.tripgraph import *  
 
 
if __name__ == '__main__':  
g = TripGraph()  
 
g.add_tripstop(0, TripStop.GTFS, 0.0, 0.0)  
g.add_tripstop(1, TripStop.GTFS, 0.5, 0.0)  
s = ServicePeriod(0, 1, 0, 0, 7, 0, 100, 2000, True, True, True)  
g.add_service_period(s);  
g.add_triphop(500, 1000, 0, 1, 1, 1, 0)  
g.add_walkhop(0, 1)  
 
path = g.find_path(0, False, 0.0, 0.0, 0.5, 0.0)  
 
for action in path.get_actions():  
print "src: %s dest: %s st: %s et: %s rid: %s" % \  
(action.src_id, action.dest_id, action.start_time, action.end_time,  
action.route_id)  
 
 
#!/usr/bin/ruby  
 
# This example is just here to give a simple example of using the ruby  
# API.  
 
# FIXME: It would be nice to have some more ruby examples, but I'll leave  
# that to the ruby hackers.  
 
# This is all slightly icky, but it's probably enough to  
# help you get started  
 
require 'routez'  
 
g = Routez::TripGraph.new()  
g.add_tripstop(0, Routez::TripStop::OSM, 0.0, 0.0)  
g.add_tripstop(1, Routez::TripStop::OSM, 1.0, 0.0)  
g.add_walkhop(0, 1)  
 
path = g.find_path(0, false, 0.0, 0.0, 1.0, 0.0)  
 
path.get_actions().each do |action|  
puts "src: #{action.src_id} dest: #{action.dest_id} st: #{action.start_time} et: #{action.end_time} rid: #{action.route_id}"  
end  
 
s = Routez::ServicePeriod.new(0, 1, 0, 0, 7, 0, 100, 2000, true, true, true)  
g.add_service_period(s);  
g.add_triphop(500, 1000, 0, 1, 1, 1, 0)  
path2 = g.find_path(0, false, 0.0, 0.0, 1.0, 0.0)  
 
path2.get_actions().each do |action|  
puts "src: #{action.src_id} dest: #{action.dest_id} st: #{action.start_time} et: #{action.end_time} rid: #{action.route_id}"  
end  
 
 
g = Routez::TripGraph.new()  
 
g.add_tripstop(0, Routez::TripStop::GTFS, 44.6554236, -63.5936968) # north and agricola  
g.add_tripstop(1, Routez::TripStop::OSM, 44.6546407, -63.5948438) # north and robie (just north of north&agricola)  
g.add_tripstop(2, Routez::TripStop::GTFS, 44.6567144, -63.5919115) # north and northwood (just south of north&agricola)  
g.add_tripstop(3, Routez::TripStop::GTFS, 44.6432423, -63.6045261) # Quinpool and Connaught (a few kms away from north&agricola)  
 
stops = g.find_tripstops_in_range(44.6554236, -63.5936968, Routez::TripStop::GTFS, 500.0)  
 
stops.each do |stop|  
puts "id: #{stop.id} lat: #{stop.lat} lon: #{stop.lng} type: #{stop.type}"  
end  
 
#ifndef __DEFUNS_H  
#define __DEFUNS_H  
 
// max length of an identifier field (i.e. a service period)  
// this simplifies the saving/loading code considerably  
const int MAX_ID_LEN = 20;  
 
#endif // __DEFUNS_H  
 
#ifndef __SERVICEPERIOD_H  
#define __SERVICEPERIOD_H  
#include <stdint.h>  
#include <stdio.h>  
#include <time.h>  
#include <vector>  
 
 
struct ServicePeriodException  
{  
ServicePeriodException(int32_t _tm_mday, int32_t _tm_mon, int32_t _tm_year);  
ServicePeriodException();  
 
int32_t tm_mday;  
int32_t tm_mon;  
int32_t tm_year;  
};  
 
class ServicePeriod  
{  
public:  
ServicePeriod(int32_t id,  
int32_t start_mday, int32_t start_mon, int32_t start_year,  
int32_t end_mday, int32_t end_mon, int32_t end_year,  
int32_t duration, bool weekday, bool saturday, bool sunday);  
ServicePeriod(const ServicePeriod &s);  
ServicePeriod();  
ServicePeriod(FILE *fp);  
 
void add_exception_on(int32_t tm_mday, int32_t tm_mon, int32_t tm_year);  
void add_exception_off(int32_t tm_mday, int32_t tm_mon, int32_t tm_year);  
 
bool is_turned_on(int32_t tm_mday, int32_t tm_mon, int32_t tm_year);  
bool is_turned_off(int32_t tm_mday, int32_t tm_mon, int32_t tm_year);  
 
void write(FILE *fp);  
 
int32_t id;  
 
// start/end time: the range of dates for which the service period is  
// valid (e.g. Jan 2008 - Sep 2009)  
time_t start_time;  
time_t end_time;  
 
// duration and days of the week that the service period is active  
int32_t duration;  
bool weekday;  
bool saturday;  
bool sunday;  
 
// days that the service period is off (regardless of what the normal  
// schedule) says. E.g. a weekday sched on Xmas  
std::vector<ServicePeriodException> exceptions_off;  
 
// days that the service period is on (regardless of what the normal  
// schedule) says. E.g. a sunday sched on Xmas  
std::vector<ServicePeriodException> exceptions_on;  
};  
 
#endif // __SERVICEPERIOD_H  
 
#ifndef __TRIPGRAPH_H  
#define __TRIPGRAPH_H  
#include <queue>  
#include <stdint.h>  
#include <string>  
#include <tr1/memory>  
#include <tr1/unordered_map>  
#include <vector>  
 
#include "serviceperiod.h"  
#include "trippath.h"  
#include "tripstop.h"  
 
 
class TripGraph  
{  
public:  
TripGraph();  
void load(std::string fname);  
void save(std::string fname);  
 
void set_timezone(std::string timezone);  
void add_service_period(ServicePeriod &service_period);  
void add_triphop(int32_t start_time, int32_t end_time, int32_t src_id,  
int32_t dest_id, int32_t route_id, int32_t trip_id,  
int32_t service_id);  
void add_tripstop(int32_t id, TripStop::Type type, float lat, float lng);  
void add_walkhop(int32_t src_id, int32_t dest_id);  
 
void link_osm_gtfs();  
 
TripStop get_tripstop(int32_t id);  
 
std::vector<std::pair<int, int> > get_service_period_ids_for_time(int secs);  
 
#ifdef SWIG  
%newobject find_path;  
#endif  
TripPath * find_path(double start, bool walkonly,  
double src_lat, double src_lng,  
double dest_lat, double dest_lng);  
// various internal types  
struct PathCompare  
{  
inline bool operator() (const std::tr1::shared_ptr<TripPath> &x,  
const std::tr1::shared_ptr<TripPath> &y)  
{  
return x->heuristic_weight > y->heuristic_weight;  
}  
};  
 
typedef std::vector<std::tr1::shared_ptr<TripPath> > TripPathList;  
typedef std::tr1::unordered_map<int32_t, std::tr1::unordered_map<int, std::tr1::shared_ptr<TripPath> > > VisitedRouteMap;  
typedef std::tr1::unordered_map<int32_t, std::tr1::unordered_map<int32_t, std::tr1::shared_ptr<TripPath> > > VisitedWalkMap;  
typedef std::priority_queue<std::tr1::shared_ptr<TripPath>, std::vector<std::tr1::shared_ptr<TripPath> >, PathCompare> PathQueue;  
 
typedef std::vector<ServicePeriod> ServicePeriodList;  
typedef std::vector<std::tr1::shared_ptr<TripStop> > TripStopList;  
 
std::vector<TripStop> find_tripstops_in_range(double lat, double lng,  
TripStop::Type type,  
double range);  
 
private:  
// internal copy of get_tripstop: returns a pointer, not a copy, so  
// much faster (when called many times)  
std::tr1::shared_ptr<TripStop> _get_tripstop(int32_t id);  
std::tr1::shared_ptr<TripStop> get_nearest_stop(double lat, double lng);  
 
void extend_path(std::tr1::shared_ptr<TripPath> &path,  
bool walkonly, int32_t end_id, int &num_paths_considered,  
VisitedRouteMap &visited_routes,  
VisitedWalkMap &visited_walks,  
PathQueue &uncompleted_paths, PathQueue &completed_paths);  
 
std::string timezone;  
TripStopList tripstops;  
ServicePeriodList splist;  
};  
 
#endif // __TRIPGRAPH_H  
 
#ifndef __TRIPPATH_H  
#define __TRIPPATH_H  
#include <tr1/unordered_set>  
#include <tr1/memory>  
#include <deque>  
#include "tripstop.h"  
 
 
struct TripAction  
{  
TripAction(int32_t _src_id, int32_t _dest_id, int _route_id,  
double _start_time, double _end_time);  
TripAction() {} // for swig, which wants to call resize for some dumb reason  
TripAction(const TripAction &other);  
~TripAction() { }  
 
TripAction &operator=(const TripAction &other);  
 
int32_t src_id, dest_id;  
double start_time, end_time;  
int route_id;  
 
// pointer to the action which preceded this one  
std::tr1::shared_ptr<TripAction> parent;  
};  
 
 
struct TripPath  
{  
public:  
TripPath(double _time, double _fastest_speed,  
std::tr1::shared_ptr<TripStop> &_dest_stop,  
std::tr1::shared_ptr<TripStop> &_last_stop);  
TripPath() {}  
 
std::tr1::shared_ptr<TripPath> add_action(  
std::tr1::shared_ptr<TripAction> &action,  
std::deque<int> &_possible_route_ids,  
std::tr1::shared_ptr<TripStop> &_last_stop);  
 
// the following are mostly for the benefit of language bindings  
// C++ code should be able to access this directly with less overhead...  
std::deque<TripAction> get_actions();  
//tr1python::object get_last_action();  
 
double time;  
double fastest_speed;  
std::tr1::shared_ptr<TripStop> dest_stop;  
std::tr1::shared_ptr<TripStop> last_stop;  
std::tr1::shared_ptr<TripAction> last_action;  
 
double walking_time;  
double route_time;  
int traversed_route_ids;  
std::tr1::unordered_set<int> possible_route_ids;  
int last_route_id;  
double weight;  
double heuristic_weight;  
 
private:  
void _get_heuristic_weight();  
 
// Given an action just after the end of a walk in the path, delays  
// that walk by the given number of seconds.  
void delay_walk(std::tr1::shared_ptr<TripAction> walk, float secs);  
};  
 
#endif // __TRIPPATH_H  
 
#ifndef __TRIPSTOP_H  
#define __TRIPSTOP_H  
#include <assert.h>  
#include <tr1/memory>  
#include <tr1/unordered_map>  
#include <string.h>  
#include <string>  
#include <stdint.h>  
#include <vector>  
#include <deque>  
#include <list>  
 
 
// a triphop represents a hop to a specific node on the graph at a  
// particular time (with a particular duration)  
struct TripHop  
{  
TripHop() { }  
 
TripHop(int32_t _start_time, int32_t _end_time, int32_t _dest_id,  
int32_t _trip_id)  
{  
start_time = _start_time;  
end_time = _end_time;  
dest_id = _dest_id;  
trip_id = _trip_id;  
}  
 
int32_t start_time;  
int32_t end_time;  
int32_t dest_id;  
int32_t trip_id;  
};  
 
 
struct WalkHop  
{  
WalkHop() { }  
WalkHop(int32_t _dest_id, float _walktime)  
{  
dest_id = _dest_id;  
walktime = _walktime;  
}  
 
int32_t dest_id;  
float walktime;  
};  
 
 
struct TripStop  
{  
int32_t id;  
enum Type { OSM, GTFS };  
Type type;  
float lat, lng;  
 
TripStop(FILE *fp);  
TripStop(int32_t _id, Type _type, float _lat, float _lng);  
TripStop();  
 
void write(FILE *fp);  
 
void add_triphop(int32_t start_time, int32_t end_time, int32_t dest_id,  
int32_t route_id, int32_t trip_id, int32_t service_id);  
void add_walkhop(int32_t dest_id, float walktime);  
std::deque<int> get_routes(int32_t service_id);  
const TripHop * find_triphop(int time, int route_id, int32_t service_id);  
std::vector<TripHop> find_triphops(  
int time, int route_id, int32_t service_id, int num);  
 
typedef std::vector<TripHop> TripHopList;  
typedef std::tr1::unordered_map<int, TripHopList> TripHopDict;  
typedef std::tr1::unordered_map<int32_t, TripHopDict> ServiceDict;  
 
// we keep a shared pointer to a tdict, as most nodes won't have one and  
// we don't want the memory overhead of one if not strictly needed  
// (note: we use a shared pointer instead of a standard pointer because  
// the same tripstop may have multiple instances, but we only want one  
// instance of its internal servicedict because it can be really huge...)  
std::tr1::shared_ptr<ServiceDict> tdict;  
 
typedef std::list<WalkHop> WalkHopList;  
WalkHopList wlist;  
};  
 
#endif // __TRIPSTOP_H  
 
#!/bin/sh  
 
#  
# install - install a program, script, or datafile  
# This comes from X11R5; it is not part of GNU.  
#  
# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $  
#  
# This script is compatible with the BSD install script, but was written  
# from scratch.  
#  
 
 
# set DOITPROG to echo to test this script  
 
# Don't use :- since 4.3BSD and earlier shells don't like it.  
doit="${DOITPROG-}"  
 
 
# put in absolute paths if you don't have them in your path; or use env. vars.  
 
mvprog="${MVPROG-mv}"  
cpprog="${CPPROG-cp}"  
chmodprog="${CHMODPROG-chmod}"  
chownprog="${CHOWNPROG-chown}"  
chgrpprog="${CHGRPPROG-chgrp}"  
stripprog="${STRIPPROG-strip}"  
rmprog="${RMPROG-rm}"  
 
instcmd="$mvprog"  
chmodcmd=""  
chowncmd=""  
chgrpcmd=""  
stripcmd=""  
rmcmd="$rmprog -f"  
mvcmd="$mvprog"  
src=""  
dst=""  
 
while [ x"$1" != x ]; do  
case $1 in  
-c) instcmd="$cpprog"  
shift  
continue;;  
 
-m) chmodcmd="$chmodprog $2"  
shift  
shift  
continue;;  
 
-o) chowncmd="$chownprog $2"  
shift  
shift  
continue;;  
 
-g) chgrpcmd="$chgrpprog $2"  
shift  
shift  
continue;;  
 
-s) stripcmd="$stripprog"  
shift  
continue;;  
 
*) if [ x"$src" = x ]  
then  
src=$1  
else  
dst=$1  
fi  
shift  
continue;;  
esac  
done  
 
if [ x"$src" = x ]  
then  
echo "install: no input file specified"  
exit 1  
fi  
 
if [ x"$dst" = x ]  
then  
echo "install: no destination specified"  
exit 1  
fi  
 
 
# If destination is a directory, append the input filename; if your system  
# does not like double slashes in filenames, you may need to add some logic  
 
if [ -d $dst ]  
then  
dst="$dst"/`basename $src`  
fi  
 
# Make a temp file name in the proper directory.  
 
dstdir=`dirname $dst`  
dsttmp=$dstdir/#inst.$$#  
 
# Move or copy the file name to the temp name  
 
$doit $instcmd $src $dsttmp  
 
# and set any options; do chmod last to preserve setuid bits  
 
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi  
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi  
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi  
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi  
 
# Now rename the file to the real destination.  
 
$doit $rmcmd $dst  
$doit $mvcmd $dsttmp $dst  
 
 
exit 0  
 
install-libroutez: libroutez.so  
$(INSTALL) -d $(DESTDIR)$(libdir)  
$(INSTALL_PROGRAM) libroutez.so $(DESTDIR)$(libdir)/ ;  
 
# note: this is very non-idiomatic way of installing a python library. it  
# probably doesn't handle edge cases well. but it works for me.  
install-python: python/libroutez/_tripgraph.so python/libroutez/tripgraph.py  
$(INSTALL) -d $(DESTDIR)$(libdir)/python/libroutez  
$(INSTALL) python/libroutez/osm.py $(DESTDIR)$(libdir)/python/libroutez  
$(INSTALL) python/libroutez/_tripgraph.so $(DESTDIR)$(libdir)/python/libroutez  
$(INSTALL) python/libroutez/tripgraph.py $(DESTDIR)$(libdir)/python/libroutez  
$(INSTALL) python/libroutez/__init__.py $(DESTDIR)$(libdir)/python/libroutez  
 
# likewise, this is a very non idiomatic way of installing a ruby module...  
install-ruby:  
$(INSTALL) -d $(DESTDIR)$(libdir)/ruby  
$(INSTALL) ruby/routez.so $(DESTDIR)$(libdir)/ruby  
 
install-util:  
$(INSTALL) -d $(DESTDIR)$(bindir)  
$(INSTALL) utils/creategraph.py $(DESTDIR)$(bindir)  
$(INSTALL) utils/get-gtfs-bounds.py $(DESTDIR)$(bindir)  
 
 
install: install-libroutez install-python install-util install-ruby  
 
#include <string.h>  
#include <assert.h>  
#include "serviceperiod.h"  
#include "defuns.h"  
 
using namespace std;  
 
 
static time_t get_time_t(int tm_mday, int tm_mon, int tm_year)  
{  
struct tm t;  
t.tm_sec = 0;  
t.tm_min = 0;  
t.tm_hour = 0;  
t.tm_mday = tm_mday;  
t.tm_mon = tm_mon;  
t.tm_year = tm_year;  
t.tm_wday = -1;  
t.tm_yday = -1;  
t.tm_isdst = -1;  
 
return mktime(&t);  
}  
 
 
ServicePeriodException::ServicePeriodException(int32_t _tm_mday, int32_t _tm_mon,  
int32_t _tm_year)  
{  
tm_mday = _tm_mday;  
tm_mon = _tm_mon;  
tm_year = _tm_year;  
}  
 
 
ServicePeriodException::ServicePeriodException()  
{  
tm_mday = 0;  
tm_mon = 0;  
tm_year = 0;  
}  
 
 
ServicePeriod::ServicePeriod(int32_t _id, int32_t _start_mday,  
int32_t _start_mon, int32_t _start_year,  
int32_t _end_mday, int32_t _end_mon,  
int32_t _end_year, int32_t _duration,  
bool _weekday, bool _saturday,  
bool _sunday)  
{  
id = _id;  
 
start_time = get_time_t(_start_mday, _start_mon, _start_year);  
end_time = get_time_t(_end_mday, _end_mon, _end_year);  
 
duration = _duration;  
weekday = _weekday;  
saturday = _saturday;  
sunday = _sunday;  
}  
 
 
ServicePeriod::ServicePeriod(const ServicePeriod &s)  
{  
id = s.id;  
 
start_time = s.start_time;  
end_time = s.end_time;  
 
duration = s.duration;  
weekday = s.weekday;  
saturday = s.saturday;  
sunday = s.sunday;  
 
for (vector<ServicePeriodException>::const_iterator i = s.exceptions_on.begin();  
i != s.exceptions_on.end(); i++)  
add_exception_on(i->tm_mday, i->tm_mon, i->tm_year);  
 
for (vector<ServicePeriodException>::const_iterator i = s.exceptions_off.begin();  
i != s.exceptions_off.end(); i++)  
add_exception_off(i->tm_mday, i->tm_mon, i->tm_year);  
}  
 
 
ServicePeriod::ServicePeriod()  
{  
// blank service period object  
start_time = 0;  
end_time = 0;  
 
duration = 0;  
weekday = false;  
saturday = false;  
sunday = false;  
}  
 
 
ServicePeriod::ServicePeriod(FILE *fp)  
{  
assert(fread(&id, sizeof(int32_t), 1, fp) == 1);  
 
assert(fread(&start_time, sizeof(time_t), 1, fp) == 1);  
assert(fread(&end_time, sizeof(time_t), 1, fp) == 1);  
 
assert(fread(&duration, sizeof(int32_t), 1, fp) == 1);  
assert(fread(&weekday, sizeof(bool), 1, fp) == 1);  
assert(fread(&saturday, sizeof(bool), 1, fp) == 1);  
assert(fread(&sunday, sizeof(bool), 1, fp) == 1);  
 
uint32_t num_exceptions_on;  
assert(fread(&num_exceptions_on, sizeof(uint32_t), 1, fp) == 1);  
for (int i=0; i < num_exceptions_on; i++)  
{  
ServicePeriodException e;  
assert(fread(&e, sizeof(ServicePeriodException), 1, fp) == 1);  
add_exception_on(e.tm_mday, e.tm_mon, e.tm_year);  
}  
 
uint32_t num_exceptions_off;  
assert(fread(&num_exceptions_off, sizeof(uint32_t), 1, fp) == 1);  
for (int i=0; i < num_exceptions_off; i++)  
{  
ServicePeriodException e;  
assert(fread(&e, sizeof(ServicePeriodException), 1, fp) == 1);  
add_exception_off(e.tm_mday, e.tm_mon, e.tm_year);  
}  
}  
 
 
void ServicePeriod::write(FILE *fp)  
{  
assert(fwrite(&id, sizeof(int32_t), 1, fp) == 1);  
 
assert(fwrite(&start_time, sizeof(time_t), 1, fp) == 1);  
assert(fwrite(&end_time, sizeof(time_t), 1, fp) == 1);  
 
assert(fwrite(&duration, sizeof(int32_t), 1, fp) == 1);  
assert(fwrite(&weekday, sizeof(bool), 1, fp) == 1);  
assert(fwrite(&saturday, sizeof(bool), 1, fp) == 1);  
assert(fwrite(&sunday, sizeof(bool), 1, fp) == 1);  
 
uint32_t num_exceptions_on = exceptions_on.size();  
assert(fwrite(&num_exceptions_on, sizeof(uint32_t), 1, fp) == 1);  
for (vector<ServicePeriodException>::iterator i = exceptions_on.begin();  
i != exceptions_on.end(); i++)  
{  
ServicePeriodException &e = (*i);  
assert(fwrite(&e, sizeof(ServicePeriodException), 1, fp) == 1);  
}  
 
uint32_t num_exceptions_off = exceptions_off.size();  
assert(fwrite(&num_exceptions_off, sizeof(uint32_t), 1, fp) == 1);  
for (vector<ServicePeriodException>::iterator i = exceptions_off.begin();  
i != exceptions_off.end(); i++)  
{  
ServicePeriodException &e = (*i);  
assert(fwrite(&e, sizeof(ServicePeriodException), 1, fp) == 1);  
}  
}  
 
 
void ServicePeriod::add_exception_on(int32_t tm_mday, int32_t tm_mon, int32_t tm_year)  
{  
exceptions_on.push_back(ServicePeriodException(tm_mday, tm_mon, tm_year));  
}  
 
 
void ServicePeriod::add_exception_off(int32_t tm_mday, int32_t tm_mon, int32_t tm_year)  
{  
exceptions_off.push_back(ServicePeriodException(tm_mday, tm_mon, tm_year));  
}  
 
 
bool ServicePeriod::is_turned_on(int32_t tm_mday, int32_t tm_mon, int32_t tm_year)  
{  
for (vector<ServicePeriodException>::iterator i = exceptions_on.begin();  
i != exceptions_on.end(); i++)  
{  
if ((*i).tm_mday == tm_mday && (*i).tm_mon == tm_mon &&  
(*i).tm_year == tm_year)  
return true;  
}  
 
return false;  
}  
 
 
bool ServicePeriod::is_turned_off(int32_t tm_mday, int32_t tm_mon, int32_t tm_year)  
{  
for (vector<ServicePeriodException>::iterator i = exceptions_off.begin();  
i != exceptions_off.end(); i++)  
{  
if ((*i).tm_mday == tm_mday && (*i).tm_mon == tm_mon &&  
(*i).tm_year == tm_year)  
return true;  
}  
 
return false;  
}  
 
#include "tripgraph.h"  
#include <assert.h>  
#include <errno.h>  
#include <map>  
#include <math.h>  
#include <stdlib.h>  
 
using namespace std;  
using namespace tr1;  
 
// set to 1 to see what find_path is doing (VERY verbose)  
#if 0  
# define DEBUGPATH(fmt, args...) fprintf(stderr, fmt, ## args)  
#else  
# define DEBUGPATH  
#endif  
 
// Estimated walking speed in m/s  
static const float EST_WALK_SPEED = 1.1f;  
static int SECS_IN_DAY = (60*60*24);  
 
 
static inline double radians(double degrees)  
{  
return degrees/180.0f*M_PI;  
}  
 
static inline double degrees(double radians)  
{  
return radians*180.0f/M_PI;  
}  
 
static double distance(double src_lat, double src_lng, double dest_lat,  
double dest_lng)  
{  
// returns distance in meters  
static const double EPSILON = 0.00005;  
 
if (fabs(src_lat - dest_lat) < EPSILON && fabs(src_lng - dest_lng) < EPSILON) {  
return 0.0f;  
}  
 
double theta = src_lng - dest_lng;  
double src_lat_radians = radians(src_lat);  
double dest_lat_radians = radians(dest_lat);  
double dist = sin(src_lat_radians) * sin(dest_lat_radians) +  
cos(src_lat_radians) * cos(dest_lat_radians) *  
cos(radians(theta));  
dist = acos(dist);  
dist = degrees(dist);  
dist *= (60.0f * 1.1515 * 1.609344 * 1000.0f);  
return dist;  
}  
 
 
TripGraph::TripGraph()  
{  
set_timezone("UTC");  
}  
 
 
void TripGraph::load(string fname)  
{  
FILE *fp = fopen(fname.c_str(), "r");  
if (!fp)  
{  
printf("Error: Couldn't open graph file %s: %s (%d).\n",  
fname.c_str(), strerror(errno), errno);  
return;  
}  
 
uint32_t timezone_len;  
assert(fread(&timezone_len, sizeof(uint32_t), 1, fp) == 1);  
char tz[timezone_len+1];  
assert(fread(tz, sizeof(char), timezone_len, fp) == timezone_len);  
tz[timezone_len] = '\0';  
set_timezone(tz);  
 
uint32_t num_service_periods;  
if (fread(&num_service_periods, sizeof(uint32_t), 1, fp) != 1)  
{  
printf("Error: Couldn't read the number of service periods.\n");  
return;  
}  
for (int i=0; i < num_service_periods; i++)  
{  
ServicePeriod s(fp);  
add_service_period(s);  
}  
 
uint32_t num_tripstops;  
if (fread(&num_tripstops, sizeof(uint32_t), 1, fp) != 1)  
{  
printf("Error: Couldn't read the number of tripstops.\n");  
return;  
}  
 
tripstops.reserve(num_tripstops);  
for (uint32_t i=0; i < num_tripstops; i++)  
{  
shared_ptr<TripStop> s(new TripStop(fp));  
assert(tripstops.size() == s->id);  
tripstops.push_back(s);  
}  
 
fclose(fp);  
}  
 
 
void TripGraph::save(string fname)  
{  
FILE *fp = fopen(fname.c_str(), "w");  
if (!fp)  
{  
printf("Error: Couldn't open graph %s for writing: %s (%d).\n",  
fname.c_str(), strerror(errno), errno);  
return;  
}  
 
// write timezone  
uint32_t timezone_len = timezone.size();  
assert(fwrite(&timezone_len, sizeof(uint32_t), 1, fp) == 1);  
assert(fwrite(timezone.c_str(), sizeof(char), timezone_len, fp) ==  
timezone_len);  
 
// write service periods  
uint32_t num_service_periods = splist.size();  
assert(fwrite(&num_service_periods, sizeof(uint32_t), 1, fp) == 1);  
for (ServicePeriodList::iterator i = splist.begin(); i != splist.end();  
i++)  
i->write(fp);  
 
// write tripstops  
uint32_t num_tripstops = tripstops.size();  
assert(fwrite(&num_tripstops, sizeof(uint32_t), 1, fp) == 1);  
for (TripStopList::iterator i = tripstops.begin();  
i != tripstops.end(); i++)  
{  
(*i)->write(fp);  
}  
 
fclose(fp);  
}  
 
 
void TripGraph::set_timezone(std::string _timezone)  
{  
timezone = _timezone;  
setenv("TZ", timezone.c_str(), 1);  
tzset();  
}  
 
 
void TripGraph::add_service_period(ServicePeriod &service_period)  
{  
assert(service_period.id == splist.size());  
splist.push_back(service_period);  
}  
 
 
void TripGraph::add_triphop(int32_t start_time, int32_t end_time,  
int32_t src_id, int32_t dest_id, int32_t route_id,  
int32_t trip_id, int32_t service_id)  
{  
// will assert if src_id doesn't exist!!  
_get_tripstop(src_id)->add_triphop(start_time, end_time, dest_id, route_id,  
trip_id, service_id);  
}  
 
 
void TripGraph::add_tripstop(int32_t id, TripStop::Type type, float lat, float lng)  
{  
// id must equal size of tripstops  
assert(id == tripstops.size());  
 
tripstops.push_back(shared_ptr<TripStop>(new TripStop(id, type, lat, lng)));  
}  
 
 
void TripGraph::add_walkhop(int32_t src_id, int32_t dest_id)  
{  
// will assert if src_id or dest_id doesn't exist!!  
shared_ptr<TripStop> ts_src = _get_tripstop(src_id);  
shared_ptr<TripStop> ts_dest = _get_tripstop(dest_id);  
 
double dist = distance(ts_src->lat, ts_src->lng,  
ts_dest->lat, ts_dest->lng);  
 
ts_src->add_walkhop(dest_id, dist / EST_WALK_SPEED);  
}  
 
 
struct Point  
{  
Point(double _lat, double _lng) { lat=_lat; lng=_lng; }  
double lat;  
double lng;  
};  
 
bool operator==(const Point &p1, const Point &p2)  
{  
// We say that anything within a distance of 1 meter is identical.  
return (distance(p1.lat, p1.lng, p2.lat, p2.lng) < 1.0f);  
}  
 
Point get_closest_point(Point &a, Point &b, Point &c)  
{  
// Given a line made up of a and b, and a point c,  
// return the point on the line closest to c (may be a or b).  
double ab2 = pow((b.lat - a.lat), 2) + pow((b.lng - a.lng), 2);  
double ap_ab = (c.lat - a.lat)*(b.lat-a.lat) + (c.lng-a.lng)*(b.lng-a.lng);  
double t = ap_ab / ab2;  
 
// Clamp t to be between a and b.  
if (t < 0.0f)  
t = 0.0f;  
else if (t>1.0f)  
t = 1.0f;  
 
return Point(a.lat + (b.lat - a.lat)*t, a.lng + (b.lng - a.lng)*t);  
}  
 
 
// This complicated-looking method attempts to link gtfs stops to osm nodes.  
// If a stop lies between two osm nodes on a polyline, we will link the gtfs  
// stop to both of them.  
void TripGraph::link_osm_gtfs()  
{  
map<int32_t, pair<int32_t, int32_t> > new_walkhops;  
 
// do some counting of the actual number of gtfs  
int gtfs_tripstop_count = 0;  
int gtfs_tripstop_total = 0;  
for (TripStopList::iterator i = tripstops.begin();  
i != tripstops.end(); i++)  
{  
if ((*i)->type == TripStop::GTFS)  
gtfs_tripstop_total++;  
}  
 
for (TripStopList::iterator i = tripstops.begin();  
i != tripstops.end(); i++)  
{  
gtfs_tripstop_count++;  
// For each GTFS stop...  
if ((*i)->type == TripStop::GTFS)  
{  
Point gtfs_pt((*i)->lat, (*i)->lng);  
 
pair<int32_t, int32_t> nearest_walkhop(-1, -1);  
double min_dist;  
 
// Check each other trip stop and all its walkhops...  
// FIXME: This is begging to be optimized. We need some way to  
// exclude the bulk of tripstops that are a million miles away.  
// One idea is to do some sort of quadtree-like partitioning of  
// the tripstops; then we'd mostly only have to check other stops  
// within our partition.  
// Another idea is to put a bounding box around each tripstop and  
// its associated walkhops, saving us from having to examine each  
// walkhop of some faraway triphop.  
for (TripStopList::iterator j = tripstops.begin();  
j != tripstops.end(); j++)  
{  
for (TripStop::WalkHopList::iterator k = (*j)->wlist.begin();  
k != (*j)->wlist.end(); k++)  
{  
Point trip_pt((*j)->lat, (*j)->lng);  
 
shared_ptr<TripStop> dest_stop = _get_tripstop(k->dest_id);  
Point walk_pt(dest_stop->lat, dest_stop->lng);  
 
Point p = get_closest_point(trip_pt, walk_pt, gtfs_pt);  
 
// Find the closest OSM hop to the GTFS stop  
double dist = distance(gtfs_pt.lat, gtfs_pt.lng,  
p.lat, p.lng);  
if ((nearest_walkhop.first == (-1) &&  
nearest_walkhop.second == (-1)) || dist < min_dist)  
{  
nearest_walkhop = pair<int32_t,int32_t>(-1, -1);  
// If the GTFS stop is on one of the OSM nodes, use  
// that node. Otherwise remember both nodes.  
if (trip_pt == p)  
nearest_walkhop.first = (*j)->id;  
else if (walk_pt == p)  
nearest_walkhop.first = k->dest_id;  
else  
{  
nearest_walkhop.first = (*j)->id;  
nearest_walkhop.second = k->dest_id;  
}  
 
min_dist = dist;  
}  
}  
}  
 
new_walkhops[(*i)->id] = nearest_walkhop;  
printf("%02.2f%% done: Linking %d -> %d, %d\n",  
((float)gtfs_tripstop_count * 100.0f) / ((float)gtfs_tripstop_total),  
(*i)->id,  
nearest_walkhop.first,  
nearest_walkhop.second);  
}  
}  
 
for (map<int32_t, pair<int32_t, int32_t> >::iterator i = new_walkhops.begin();  
i != new_walkhops.end(); i++)  
{  
int32_t osmstop1 = i->second.first;  
int32_t osmstop2 = i->second.second;  
 
assert(osmstop1 >= 0);  
add_walkhop(i->first, osmstop1);  
add_walkhop(osmstop1, i->first);  
 
if (osmstop2 >= 0)  
{  
add_walkhop(i->first, osmstop2);  
add_walkhop(osmstop2, i->first);  
}  
}  
}  
 
 
shared_ptr<TripStop> TripGraph::get_nearest_stop(double lat, double lng)  
{  
// FIXME: use a quadtree to speed this up, see link_osm_gtfs() for  
// more thoughts on this  
 
shared_ptr<TripStop> closest_stop;  
double min_dist = 0.0f;  
for (TripStopList::iterator i = tripstops.begin();  
i != tripstops.end(); i++)  
{  
double dist = pow(((*i)->lat - lat), 2) + pow(((*i)->lng - lng), 2);  
if (!closest_stop || dist < min_dist)  
{  
closest_stop = (*i);  
min_dist = dist;  
}  
}  
 
return closest_stop;  
}  
 
 
TripStop TripGraph::get_tripstop(int32_t id)  
{  
shared_ptr<TripStop> ts = _get_tripstop(id);  
return TripStop(*ts);  
}  
 
 
vector<pair<int, int> > TripGraph::get_service_period_ids_for_time(int secs)  
{  
vector<pair<int, int> > vsp;  
 
for (ServicePeriodList::iterator i = splist.begin(); i != splist.end(); i++)  
{  
for (int offset = 0; offset < i->duration; offset += SECS_IN_DAY)  
{  
time_t mysecs = secs - offset;  
struct tm * t = localtime(&mysecs);  
if (i->start_time <= mysecs &&  
i->end_time >= mysecs &&  
(((t->tm_wday == 6 && i->saturday) ||  
(t->tm_wday == 0 && i->sunday) ||  
(t->tm_wday > 0 && t->tm_wday < 6 && i->weekday)) &&  
!i->is_turned_off(t->tm_mday, t->tm_mon, t->tm_year)) ||  
i->is_turned_on(t->tm_mday, t->tm_mon, t->tm_year))  
{  
vsp.push_back(pair<int, int>(i->id, offset));  
}  
}  
}  
 
return vsp;  
}  
 
 
TripPath * TripGraph::find_path(double start, bool walkonly,  
double src_lat, double src_lng,  
double dest_lat, double dest_lng)  
{  
PathQueue uncompleted_paths;  
PathQueue completed_paths;  
 
VisitedRouteMap visited_routes;  
VisitedWalkMap visited_walks;  
 
shared_ptr<TripStop> start_node = get_nearest_stop(src_lat, src_lng);  
shared_ptr<TripStop> end_node = get_nearest_stop(dest_lat, dest_lng);  
DEBUGPATH("Find path. Secs: %f walkonly: %d "  
"src lat: %f src lng: %f dest_lat: %f dest_lng: %f\n",  
start, walkonly, src_lat, src_lng, dest_lat, dest_lng);  
DEBUGPATH("- Start: %d End: %d\n", start_node->id, end_node->id);  
 
//DEBUGPATH("..service period determination..");  
 
// Consider the distance required to reach the start node from the  
// beginning, and add that to our start time.  
double dist_from_start = distance(src_lat, src_lng,  
start_node->lat, start_node->lng);  
start += (dist_from_start / EST_WALK_SPEED);  
 
DEBUGPATH("- Start time - %f (dist from start: %f)\n", start, dist_from_start);  
shared_ptr<TripPath> start_path(new TripPath(start, EST_WALK_SPEED,  
end_node, start_node));  
if (start_node == end_node)  
return new TripPath(*start_path);  
 
uncompleted_paths.push(start_path);  
 
int num_paths_considered = 0;  
 
while (uncompleted_paths.size() > 0)  
{  
DEBUGPATH("Continuing\n");  
shared_ptr<TripPath> path = uncompleted_paths.top();  
uncompleted_paths.pop();  
extend_path(path, walkonly, end_node->id, num_paths_considered,  
visited_routes, visited_walks, uncompleted_paths,  
completed_paths);  
 
// If we've still got open paths, but their weight exceeds that  
// of the weight of a completed path, break.  
if (uncompleted_paths.size() > 0 && completed_paths.size() > 0 &&  
uncompleted_paths.top()->heuristic_weight >  
completed_paths.top()->heuristic_weight)  
{  
DEBUGPATH("Breaking with %d uncompleted paths (paths "  
"considered: %d).\n", uncompleted_paths.size(),  
num_paths_considered);  
return new TripPath(*(completed_paths.top()));  
}  
 
//if len(completed_paths) > 0 and len(uncompleted_paths) > 0:  
// print "Weight of best completed path: %s, uncompleted: %s" % \  
// (completed_paths[0].heuristic_weight, uncompleted_paths[0].heuristic_weight)  
}  
 
if (completed_paths.size())  
return new TripPath(*(completed_paths.top()));  
 
return NULL;  
}  
 
 
shared_ptr<TripStop> TripGraph::_get_tripstop(int32_t id)  
{  
assert(id < tripstops.size());  
 
return tripstops[id];  
}  
 
 
void TripGraph::extend_path(shared_ptr<TripPath> &path,  
bool walkonly,  
int32_t goal_id,  
int &num_paths_considered,  
VisitedRouteMap &visited_routes,  
VisitedWalkMap &visited_walks,  
PathQueue &uncompleted_paths,  
PathQueue &completed_paths)  
{  
TripPathList newpaths;  
int32_t src_id = path->last_stop->id;  
int last_route_id = path->last_route_id;  
 
#if 0  
if (path->last_action)  
{  
string last_src_id = path->last_action->src_id;  
if (cb)  
python::call<void>(cb, tripstops[last_src_id]->lat,  
tripstops[last_src_id]->lng,  
tripstops[src_id]->lat,  
tripstops[src_id]->lng,  
last_route_id);  
}  
#endif  
time_t mysecs = (time_t)path->time;  
struct tm * tm = localtime(&mysecs);  
double elapsed_daysecs = tm->tm_sec + (60*tm->tm_min) + (60*60*tm->tm_hour);  
double daystart = path->time - elapsed_daysecs;  
 
// Figure out service period based on start time, then figure out  
// seconds since midnight on our particular day  
vector<pair<int, int> > vsp = get_service_period_ids_for_time(path->time);  
 
DEBUGPATH("Extending path at vertex %d (on %d) @ %f (walktime: %f, "  
"routetime: %f elapsed_daysecs: %f)\n", src_id, last_route_id, path->time,  
path->walking_time, path->route_time, elapsed_daysecs);  
shared_ptr<TripStop> src_stop = _get_tripstop(src_id);  
 
// Keep track of outgoing route ids at this node: make sure that we  
// don't get on a route later when we could have gotten on here.  
deque<int> outgoing_route_ids;  
if (!walkonly)  
{  
for (vector<pair<int, int> >::iterator i = vsp.begin(); i != vsp.end(); i++)  
{  
deque<int> route_ids = src_stop->get_routes(i->first);  
for (deque<int>::iterator j = route_ids.begin(); j != route_ids.end(); j++)  
outgoing_route_ids.push_back(*j);  
}  
}  
 
// Explore walkhops that are better than the ones we've already visited.  
// If we're on a bus, don't allow a transfer if we've been on for  
// less than 5 minutes (FIXME: probably better to measure distance  
// travelled?)  
if (last_route_id == -1 || path->route_time > (2 * 60))  
{  
for (TripStop::WalkHopList::iterator i = src_stop->wlist.begin();  
i != src_stop->wlist.end(); i++)  
{  
int32_t dest_id = i->dest_id;  
double walktime = i->walktime;  
 
// Do a quick test to make sure that the potential basis for a  
// new path isn't worse than what we have already, before  
// incurring the cost of creating a new path and evaluating it.  
unordered_map<int32_t, shared_ptr<TripPath> > vsrc = visited_walks[src_id];  
unordered_map<int32_t, shared_ptr<TripPath> >::iterator v1 = vsrc.find(dest_id);  
if (v1 != vsrc.end() && path->heuristic_weight > v1->second->heuristic_weight)  
continue;  
 
shared_ptr<TripAction> action(  
new TripAction(src_id, dest_id, -1, path->time,  
(path->time + walktime)));  
shared_ptr<TripStop> ds = _get_tripstop(dest_id);  
shared_ptr<TripPath> path2 = path->add_action(  
action, outgoing_route_ids, ds);  
 
DEBUGPATH("- Considering walkpath to %d\n", dest_id);  
 
if (v1 == vsrc.end() ||  
v1->second->heuristic_weight > path2->heuristic_weight ||  
((v1->second->heuristic_weight - path2->heuristic_weight) < 1.0f &&  
v1->second->walking_time > path2->walking_time))  
{  
DEBUGPATH("-- Adding walkpath to %d (walktime: %f (%f, %f))\n", dest_id, walktime, action->start_time, action->end_time);  
if (dest_id == goal_id)  
completed_paths.push(path2);  
else  
uncompleted_paths.push(path2);  
 
num_paths_considered++;  
visited_walks[src_id][dest_id] = path2;  
}  
}  
}  
 
 
// If we're doing a walkonly path (mostly for generating shapes?), stop  
// and return here.  
if (walkonly)  
return;  
 
// Find outgoing triphops from the source and get a list of paths to them.  
for (vector<pair<int, int> >::iterator sp = vsp.begin(); sp != vsp.end();  
sp++)  
{  
deque<int> route_ids = src_stop->get_routes(sp->first);  
for (deque<int>::iterator j = route_ids.begin(); j != route_ids.end(); j++)  
{  
int LEEWAY = 0;  
if ((*j) != last_route_id)  
LEEWAY = (5*60); // give 5 mins to make a transfer  
 
const TripHop * t = src_stop->find_triphop(  
elapsed_daysecs + sp->second + LEEWAY, (*j), sp->first);  
if (t)  
{  
// If we've been on the route before (or could have been),  
// don't get on again.  
if ((*j) != last_route_id && path->possible_route_ids.count(*j))  
{  
// pass  
}  
// Disallow more than three transfers.  
else if ((*j) != last_route_id &&  
path->traversed_route_ids > 3)  
{  
// pass  
}  
else  
{  
// Do a quick test to make sure that the potential basis for a  
// new path isn't worse than what we have already, before  
// incurring the cost of creating a new path and evaluating it.  
unordered_map<int, shared_ptr<TripPath> >::iterator v = visited_routes[src_id].find(*j);  
if (v != visited_routes[src_id].end() && path->heuristic_weight > v->second->heuristic_weight)  
continue;  
 
shared_ptr<TripAction> action = shared_ptr<TripAction>(  
new TripAction(src_id, t->dest_id, (*j), daystart + t->start_time,  
daystart + t->end_time));  
shared_ptr<TripStop> ds = _get_tripstop(t->dest_id);  
shared_ptr<TripPath> path2 = path->add_action(  
action, outgoing_route_ids, ds);  
 
 
if (v == visited_routes[src_id].end() ||  
v->second->heuristic_weight > path2->heuristic_weight ||  
((v->second->heuristic_weight - path2->heuristic_weight) < 1.0f &&  
v->second->walking_time > path2->walking_time))  
{  
if (t->dest_id == goal_id)  
completed_paths.push(path2);  
else  
uncompleted_paths.push(path2);  
 
num_paths_considered++;  
visited_routes[src_id][(*j)] = path2;  
}  
}  
}  
}  
}  
}  
 
 
vector<TripStop> TripGraph::find_tripstops_in_range(double lat, double lng,  
TripStop::Type type,  
double range)  
{  
vector<TripStop> tripstops_in_range;  
 
for (TripStopList::iterator i = tripstops.begin();  
i != tripstops.end(); i++)  
{  
if ((*i)->type != type)  
continue;  
 
double dist = distance((*i)->lat, (*i)->lng, lat, lng);  
if (dist <= range)  
tripstops_in_range.push_back(*(*i));  
}  
 
return tripstops_in_range;  
}  
 
#include "trippath.h"  
#include <math.h>  
 
#if 0  
#define LOG(...) fprintf(stderr, __VA_ARGS__)  
#else  
#define LOG(...)  
#endif  
 
using namespace std;  
using namespace tr1;  
 
static inline double radians(double degrees)  
{  
return degrees/180.0f*M_PI;  
}  
 
static inline double degrees(double radians)  
{  
return radians*180.0f/M_PI;  
}  
 
static double distance(double src_lat, double src_lng, double dest_lat, double dest_lng)  
{  
if (src_lat == dest_lat && src_lng == dest_lng)  
return 0.0f;  
 
double theta = src_lng - dest_lng;  
double src_lat_radians = radians(src_lat);  
double dest_lat_radians = radians(dest_lat);  
double dist = sin(src_lat_radians) * sin(dest_lat_radians) +  
cos(src_lat_radians) * cos(dest_lat_radians) *  
cos(radians(theta));  
dist = acos(dist);  
dist = degrees(dist);  
dist *= (60.0f * 1.1515 * 1.609344 * 1000.0f);  
return dist;  
}  
 
 
TripAction::TripAction(int32_t _src_id, int32_t _dest_id,  
int _route_id, double _start_time, double _end_time) :  
src_id(_src_id),  
dest_id(_dest_id),  
route_id(_route_id),  
start_time(_start_time),  
end_time(_end_time),  
parent()  
{  
}  
 
 
TripAction::TripAction(const TripAction &other):  
src_id(other.src_id),  
dest_id(other.dest_id),  
route_id(other.route_id),  
start_time(other.start_time),  
end_time(other.end_time),  
parent(other.parent)  
{  
}  
 
 
TripAction& TripAction::operator=(const TripAction &other)  
{  
src_id = other.src_id;  
dest_id = other.dest_id;  
route_id = other.route_id;  
start_time = other.start_time;  
end_time = other.end_time;  
parent = other.parent;  
}  
 
TripPath::TripPath(double _time, double _fastest_speed,  
shared_ptr<TripStop> &_dest_stop,  
shared_ptr<TripStop> &_last_stop)  
{  
fastest_speed = _fastest_speed;  
dest_stop = _dest_stop;  
last_stop = _last_stop;  
time = _time;  
 
walking_time = 0.0f;  
weight = _time;  
traversed_route_ids = 0;  
last_route_id = -1;  
route_time = 0.0f;  
_get_heuristic_weight();  
}  
 
#if 0  
python::object TripPath::get_last_action()  
{  
if (last_action)  
return python::object(*last_action);  
 
return python::object();  
}  
#endif  
 
void TripPath::_get_heuristic_weight()  
{  
// start off with heuristic weight being equivalent to its real weight  
heuristic_weight = weight;  
 
// then, calculate the time remaining based on going directly  
// from the last vertex to the destination vertex at the fastest  
// possible speed in the graph  
double remaining_distance = distance(last_stop->lat, last_stop->lng,  
dest_stop->lat, dest_stop->lng);  
heuristic_weight += remaining_distance / 5; //(fastest_speed / 3);  
 
// now, add 5 minutes per each transfer, multiplied to the power of 2  
// (to make transfers exponentially more painful)  
if (traversed_route_ids > 1)  
heuristic_weight += (pow(2.0f, (int)(traversed_route_ids-2)) * 5.0f * 60.0f);  
 
// double the cost of walking after 5 mins, quadruple after 10 mins,  
// octuple after 15, etc. (up to a maximum of 20 iterations of this, to  
// make sure we don't freeze for particularly long walking times-- mostly  
// useful for obscure test cases)  
double excess_walking_time = walking_time - 300.0f;  
int iter = 0;  
while (excess_walking_time > 0 && iter < 20)  
{  
double iter_walking_time = 0;  
if (excess_walking_time > 300.0f)  
iter_walking_time = 300.0f;  
else  
iter_walking_time = excess_walking_time;  
heuristic_weight += (iter_walking_time * pow(2.0f, iter));  
excess_walking_time -= 300.0f;  
iter++;  
}  
 
// add 5 mins to our weight if we were walking and remaining distance  
// >1000m, to account for the fact that we're probably going to  
// want to wait for another bus. this prevents us from repeatedly  
// getting out of the bus and walking around  
if (last_route_id == -1 && remaining_distance > 1000)  
heuristic_weight += (5*60);  
}  
 
static void _add_actions_to_list(deque<TripAction> &l,  
shared_ptr<TripAction> &action)  
{  
if (action)  
{  
if (action->parent)  
_add_actions_to_list(l, action->parent);  
l.push_back(TripAction(*action));  
}  
}  
 
deque<TripAction> TripPath::get_actions()  
{  
deque<TripAction> l;  
 
// recursively add actions to list, so we get them back in the  
// correct order  
_add_actions_to_list(l, last_action);  
 
return l;  
}  
 
shared_ptr<TripPath> TripPath::add_action(shared_ptr<TripAction> &action,  
deque<int> &_possible_route_ids,  
shared_ptr<TripStop> &_last_stop)  
{  
shared_ptr<TripPath> new_trippath(new TripPath(*this));  
 
float departure_delay = 0.0f;  
 
if (action->route_id == -1)  
{  
new_trippath->walking_time += (action->end_time - action->start_time);  
new_trippath->route_time = 0;  
}  
else if (new_trippath->last_action)  
{  
// Starting first bus route, adjust the start time to match.  
if (new_trippath->traversed_route_ids == 0)  
{  
departure_delay =  
action->start_time - new_trippath->last_action->end_time;  
// Aim to be at the bus stop 3 minutes early.  
departure_delay -= 3*60;  
}  
 
if (action->route_id != new_trippath->last_action->route_id)  
{  
new_trippath->traversed_route_ids++;  
new_trippath->route_time = 0;  
}  
}  
 
for (deque<int>::iterator i = _possible_route_ids.begin();  
i != _possible_route_ids.end(); i++)  
{  
new_trippath->possible_route_ids.insert(*i);  
}  
 
new_trippath->route_time += (action->end_time - action->start_time);  
new_trippath->weight += (action->end_time - action->start_time);  
new_trippath->weight += (action->start_time - time);  
 
if (new_trippath->last_action)  
action->parent = new_trippath->last_action;  
new_trippath->last_action = shared_ptr<TripAction>(new TripAction(*action));  
new_trippath->last_stop = _last_stop;  
new_trippath->last_route_id = action->route_id;  
new_trippath->_get_heuristic_weight();  
new_trippath->time = action->end_time;  
 
if (departure_delay > 0.0f)  
{  
LOG("Delaying start by %f seconds\n", departure_delay);  
new_trippath->delay_walk(new_trippath->last_action, departure_delay);  
}  
 
return new_trippath;  
}  
 
 
void TripPath::delay_walk(shared_ptr<TripAction> walk, float secs)  
{  
if (!walk)  
return;  
 
// Don't delay partial walks; we need to be given the element *after*  
// the final walk.  
if (walk->route_id == -1)  
return;  
 
// Only delay actual walks.  
if (!walk->parent || walk->parent->route_id != -1)  
return;  
 
shared_ptr<TripAction> w(walk);  
while (w && w->parent && w->parent->route_id == -1)  
{  
// We need to clone the actions, as they're no longer safe to share  
// (for instance, they could be shared by another bus trip that leaves  
// earlier).  
w->parent = shared_ptr<TripAction>(new TripAction(*(w->parent)));  
w = w->parent;  
 
w->start_time += secs;  
w->end_time += secs;  
}  
 
// If we delayed the initial walk, then we've reduced the total trip time.  
if (!w)  
{  
weight -= secs;  
_get_heuristic_weight();  
}  
}  
 
 
#include "defuns.h"  
#include "tripstop.h"  
#include <algorithm>  
#include <stdio.h>  
 
 
using namespace std;  
using namespace tr1;  
 
 
TripStop::TripStop(FILE *fp)  
{  
assert(fread(&id, sizeof(int32_t), 1, fp) == 1);  
assert(fread(&type, sizeof(Type), 1, fp) == 1);  
assert(fread(&lat, sizeof(float), 1, fp) == 1);  
assert(fread(&lng, sizeof(float), 1, fp) == 1);  
 
uint8_t have_triphops;  
assert(fread(&have_triphops, sizeof(uint8_t), 1, fp) == 1);  
 
if (have_triphops)  
{  
tdict = shared_ptr<ServiceDict>(new ServiceDict);  
 
uint32_t num_service_periods;  
assert(fread(&num_service_periods, sizeof(uint32_t), 1, fp) == 1);  
for (uint32_t i=0; i<num_service_periods; i++)  
{  
int32_t sp_id;  
assert(fread(&sp_id, sizeof(int32_t), 1, fp) == 1);  
 
uint32_t num_route_ids;  
assert(fread(&num_route_ids, sizeof(uint32_t), 1, fp) == 1);  
for (uint32_t j=0; j<num_route_ids; j++)  
{  
int32_t route_id;  
assert(fread(&route_id, sizeof(int32_t), 1, fp) == 1);  
 
uint32_t num_triphops = 0;  
assert(fread(&num_triphops, sizeof(uint32_t), 1, fp) == 1);  
(*tdict)[sp_id][route_id].reserve(num_triphops);  
for (uint32_t k=0; k<num_triphops; k++)  
{  
TripHop t;  
assert(fread(&t, sizeof(TripHop), 1, fp) == 1);  
assert(t.end_time >= t.start_time); // FIXME: should be >, no?  
(*tdict)[sp_id][route_id].push_back(t);  
}  
}  
 
}  
}  
 
uint32_t num_walkhops = 0;  
assert(fread(&num_walkhops, sizeof(uint32_t), 1, fp) == 1);  
for (int i=0; i<num_walkhops; i++)  
{  
int32_t dest_id;  
float walktime;  
assert(fread(&dest_id, sizeof(int32_t), 1, fp) == 1);  
assert(fread(&walktime, sizeof(float), 1, fp) == 1);  
assert(walktime >= 0.0f); // FIXME, should be >, no?  
add_walkhop(dest_id, walktime);  
}  
}  
 
 
TripStop::TripStop(int32_t _id, Type _type, float _lat, float _lng)  
{  
id = _id;  
type = _type;  
lat = _lat;  
lng = _lng;  
}  
 
 
TripStop::TripStop()  
{  
}  
 
 
void TripStop::write(FILE *fp)  
{  
assert(fwrite(&id, sizeof(int32_t), 1, fp) == 1);  
assert(fwrite(&type, sizeof(Type), 1, fp) == 1);  
assert(fwrite(&lat, sizeof(float), 1, fp) == 1);  
assert(fwrite(&lng, sizeof(float), 1, fp) == 1);  
 
uint8_t have_triphops = tdict ? 1 : 0;  
assert(fwrite(&have_triphops, sizeof(uint8_t), 1, fp) == 1);  
 
if (tdict)  
{  
uint32_t num_service_periods = tdict->size();  
assert(fwrite(&num_service_periods, sizeof(uint32_t), 1, fp) == 1);  
 
for (ServiceDict::iterator i = tdict->begin(); i != tdict->end(); i++)  
{  
assert(fwrite(&(i->first), sizeof(int32_t), 1, fp) == 1);  
uint32_t num_route_ids = i->second.size();  
assert(fwrite(&num_route_ids, sizeof(uint32_t), 1, fp) == 1);  
for (TripHopDict::iterator j = i->second.begin();  
j != i->second.end(); j++)  
{  
int32_t route_id = j->first;  
assert(fwrite(&route_id, sizeof(int32_t), 1, fp) == 1);  
uint32_t num_triphops = j->second.size();  
assert(fwrite(&num_triphops, sizeof(uint32_t), 1, fp) == 1);  
for (TripHopList::iterator k = j->second.begin();  
k != j->second.end(); k++)  
{  
assert(fwrite(&(*k), sizeof(TripHop), 1, fp) == 1);  
}  
}  
}  
}  
 
uint32_t num_walkhops = wlist.size();  
assert(fwrite(&num_walkhops, sizeof(uint32_t), 1, fp) == 1);  
for (WalkHopList::iterator i = wlist.begin(); i != wlist.end(); i++)  
{  
assert(fwrite(&(*i), sizeof(WalkHop), 1, fp) == 1);  
}  
}  
 
 
static bool sort_triphops(const TripHop &x,  
const TripHop &y)  
{  
return x.start_time < y.start_time;  
}  
 
 
void TripStop::add_triphop(int32_t start_time, int32_t end_time,  
int32_t dest_id, int32_t route_id, int32_t trip_id,  
int32_t service_id)  
{  
if (!tdict)  
tdict = shared_ptr<ServiceDict>(new ServiceDict);  
 
(*tdict)[service_id][route_id].push_back(TripHop(start_time, end_time,  
dest_id, trip_id));  
::sort((*tdict)[service_id][route_id].begin(),  
(*tdict)[service_id][route_id].end(), sort_triphops);  
}  
 
 
void TripStop::add_walkhop(int32_t dest_id, float walktime)  
{  
wlist.push_front(WalkHop(dest_id, walktime));  
}  
 
 
const TripHop * TripStop::find_triphop(int time, int route_id,  
int32_t service_id)  
{  
if (tdict)  
{  
for (TripHopList::iterator i = (*tdict)[service_id][route_id].begin();  
i != (*tdict)[service_id][route_id].end(); i++)  
{  
if ((*i).start_time >= time)  
return &(*i);  
}  
}  
 
return NULL;  
}  
 
 
vector<TripHop> TripStop::find_triphops(int time, int route_id,  
int32_t service_id,  
int num)  
{  
vector<TripHop> tlist;  
 
if (tdict)  
{  
for (TripHopList::iterator i = (*tdict)[service_id][route_id].begin();  
(i != ((*tdict)[service_id][route_id].end()) && tlist.size() < num);  
i++)  
{  
if ((*i).start_time >= time)  
tlist.push_back(*i);  
}  
}  
 
return tlist;  
}  
 
 
deque<int> TripStop::get_routes(int32_t service_id)  
{  
deque<int> routes;  
 
if (tdict)  
{  
for (TripHopDict::iterator i = (*tdict)[service_id].begin();  
i != (*tdict)[service_id].end(); i++)  
{  
routes.push_back(i->first);  
}  
}  
 
return routes;  
}  
 
 
#!/usr/bin/python  
 
# The code in this module was gratuitously stolen from  
# graphserver (http://graphserver.sourceforge.net/)  
# Copyright (c) 2007, Brandon Martin-Anderson  
 
import xml.sax  
import copy  
import sys  
from math import *  
 
class Node:  
def __init__(self, id, lon, lat):  
self.id = id  
self.lon = lon  
self.lat = lat  
self.tags = {}  
 
class Way:  
def __init__(self, id, osm):  
self.osm = osm  
self.id = id  
self.nds = []  
self.tags = {}  
 
def split(self, dividers):  
# slice the node-array using this nifty recursive function  
def slice_array(ar, dividers):  
for i in range(1,len(ar)-1):  
if dividers[ar[i]]>1:  
#print "slice at %s"%ar[i]  
left = ar[:i+1]  
right = ar[i:]  
 
rightsliced = slice_array(right, dividers)  
 
return [left]+rightsliced  
return [ar]  
 
slices = slice_array(self.nds, dividers)  
 
# create a way object for each node-array slice  
ret = []  
i=0  
for slice in slices:  
littleway = copy.copy( self )  
littleway.id += "-%d"%i  
littleway.nds = slice  
ret.append( littleway )  
i += 1  
 
return ret  
 
def get_projected_points(self, reprojection_func=lambda x,y:(x,y)):  
"""nodedir is a dictionary of nodeid->node objects. If reprojection_func is None, returns unprojected points"""  
ret = []  
 
for nodeid in self.nds:  
node = self.osm.nodes[ nodeid ]  
ret.append( reprojection_func(node.lon,node.lat) )  
 
return ret  
 
def to_canonical(self, srid, reprojection_func=None):  
"""Returns canonical string for this geometry"""  
 
return "SRID=%d;LINESTRING(%s)"%(srid, ",".join( ["%f %f"%(x,y) for x,y in self.get_projected_points()] ) )  
 
@property  
def fromv(self):  
return self.nds[0]  
 
@property  
def tov(self):  
return self.nds[-1]  
 
class OSM:  
 
def __init__(self, filename_or_stream):  
""" File can be either a filename or stream/file object."""  
nodes = {}  
ways = {}  
 
superself = self  
 
class OSMHandler(xml.sax.ContentHandler):  
@classmethod  
def setDocumentLocator(self,loc):  
pass  
 
@classmethod  
def startDocument(self):  
pass  
 
@classmethod  
def endDocument(self):  
pass  
 
@classmethod  
def startElement(self, name, attrs):  
if name=='node':  
if (int(attrs['id']) % 1000) == 0:  
print "Parsing node %s" % attrs['id']  
self.currElem = Node(attrs['id'], float(attrs['lon']), float(attrs['lat']))  
elif name=='way':  
if (int(attrs['id']) % 1000) == 0:  
print "Parsing way %s" % attrs['id']  
self.currElem = Way(attrs['id'], superself)  
elif name=='tag':  
pass  
#self.currElem.tags[attrs['k']] = attrs['v']  
elif name=='nd':  
self.currElem.nds.append( attrs['ref'] )  
 
@classmethod  
def endElement(self,name):  
if name=='node':  
nodes[self.currElem.id] = self.currElem  
elif name=='way':  
ways[self.currElem.id] = self.currElem  
 
@classmethod  
def characters(self, chars):  
pass  
 
xml.sax.parse(filename_or_stream, OSMHandler)  
 
self.nodes = nodes  
self.ways = ways  
 
#count times each node is used  
node_histogram = dict.fromkeys( self.nodes.keys(), 0 )  
print "Counting and pruning ways"  
for way in self.ways.values():  
#if a way has only one node, delete it out of the osm collection  
#similarly if it's not a road  
if len(way.nds) < 2:# or not way.tags.get('highway') or way.tags['highway'] == 'footway':  
del self.ways[way.id]  
else:  
for node in way.nds:  
# toss out any ways that don't have all nodes on map  
if not self.nodes.get(node) and self.ways.get(way.id):  
del self.ways[way.id]  
elif self.ways.get(way.id):  
node_histogram[node] += 1  
 
# delete nodes that don't appear in ways  
for node in self.nodes.values():  
if node_histogram[node.id] == 0:  
del self.nodes[node.id]  
 
#use that histogram to split all ways, replacing the member set of ways  
print "Splitting ways"  
new_ways = {}  
for id, way in self.ways.iteritems():  
split_ways = way.split(node_histogram)  
for split_way in split_ways:  
new_ways[split_way.id] = split_way  
self.ways = new_ways  
 
@property  
def connecting_nodes(self):  
"""List of nodes that are the endpoint of one or more ways"""  
 
ret = {}  
for way in self.ways.values():  
ret[way.fromv] = self.nodes[way.fromv]  
ret[way.tov] = self.nodes[way.tov]  
 
return ret  
 
%module routez  
%include tripgraph.i  
// just a blank file to get the unit test main function going  
 
#!/usr/bin/python  
 
# This is here mostly just to test that the python bindings actually work  
 
from libroutez.tripgraph import *  
import time  
from wvtest import *  
 
last=None  
 
@wvtest  
def basic_find_path():  
graph = TripGraph()  
graph.add_tripstop(0, TripStop.OSM, 0.0, 0.0)  
graph.add_tripstop(1, TripStop.OSM, 1.0, 0.0)  
 
# no path available  
p = graph.find_path(0, True, 0.0, 0.0, 1.0, 0.0)  
WVPASSEQ(p, None)  
 
# walking only  
graph.add_walkhop(0, 1)  
p = graph.find_path(0, True, 0.0, 0.0, 1.0, 0.0)  
actions = p.get_actions()  
WVPASSEQ(len(actions), 1)  
 
 
@wvtest  
def get_service_period_offsets():  
graph = TripGraph()  
graph.add_service_period(ServicePeriod(0, 1, 0, 108, 7, 0, 108, 2000,  
False, True, False))  
t = time.mktime((2008, 1, 5, 0, 0, 0, 0, 0, -1))  
splist = graph.get_service_period_ids_for_time(int(t))  
WVPASSEQ(splist[0][0], 0)  
WVPASSEQ(splist[0][1], 0)  
 
 
@wvtest  
def tripstop():  
ts = TripStop(0, TripStop.OSM, 0.0, 0.0);  
ts.add_triphop(500, 1000, 1, 1, 1, 0);  
route_ids = ts.get_routes(0)  
WVPASSEQ(len(route_ids), 1)  
WVPASSEQ(route_ids[0], 1)  
 
#include "wvtest.h"  
#include "tripgraph.h"  
 
using namespace std;  
 
 
WVTEST_MAIN("basic_graph_pathfinding")  
{  
TripGraph g;  
 
// simple path, just walking  
g.add_tripstop(0, TripStop::OSM, 0.0f, 0.0f);  
g.add_tripstop(1, TripStop::OSM, 1.0f, 0.0f);  
g.add_walkhop(0, 1);  
 
{  
TripPath *p = g.find_path(0, false, 0.0, 0.0, 1.0, 0.0);  
 
std::deque<TripAction> actions = p->get_actions();  
WVPASSEQ(actions.size(), 1);  
 
TripAction action = actions.front();  
WVPASSEQ(action.src_id, 0);  
WVPASSEQ(action.dest_id, 1);  
 
delete p;  
}  
 
// take the triphop if we have it  
{  
ServicePeriod s(0, 0, 0, 0, 7, 0, 100, 2000, true, true, true);  
g.add_service_period(s);  
g.add_triphop(500, 1000, 0, 1, 1, 1, 0);  
}  
 
{  
TripPath *p = g.find_path(0, false, 0.0, 0.0, 1.0, 0.0);  
 
std::deque<TripAction> actions = p->get_actions();  
WVPASSEQ(actions.size(), 1);  
 
TripAction action = actions.front();  
WVPASSEQ(action.src_id, 0);  
WVPASSEQ(action.dest_id, 1);  
WVPASSEQ(action.start_time, 500.0f);  
WVPASSEQ(action.end_time, 1000.0f);  
 
delete p;  
}  
}  
 
 
WVTEST_MAIN("basic_graph_saveload")  
{  
TripGraph g;  
g.add_tripstop(0, TripStop::OSM, 0.0f, 0.0f);  
g.add_tripstop(1, TripStop::OSM, 1.0f, 0.0f);  
g.add_walkhop(0, 1);  
 
ServicePeriod s(0, 1, 0, 0, 7, 0, 100, 2000, true, true, true);  
g.add_service_period(s);  
g.add_triphop(500, 1000, 0, 1, 1, 1, 0);  
 
char *tmpgraphname = tmpnam(NULL); // security issues in unit tests? bah.  
unlink(tmpgraphname);  
g.save(tmpgraphname);  
 
TripGraph g2;  
g2.load(tmpgraphname);  
 
// verify that we have two tripstops  
for (int i=0; i<2; i++)  
{  
TripStop ts = g2.get_tripstop(i);  
WVPASSEQ(ts.type, TripStop::OSM);  
}  
 
// verify that we can still solve a basic path  
{  
TripPath *p = g.find_path(0, false, 0.0, 0.0, 1.0, 0.0);  
 
std::deque<TripAction> actions = p->get_actions();  
WVPASSEQ(actions.size(), 1);  
 
TripAction action = actions.front();  
WVPASSEQ(action.src_id, 0);  
WVPASSEQ(action.dest_id, 1);  
WVPASSEQ(action.start_time, 500.0f);  
WVPASSEQ(action.end_time, 1000.0f);  
 
delete p;  
}  
}  
 
 
WVTEST_MAIN("impossible_path")  
{  
TripGraph g;  
g.add_tripstop(0, TripStop::OSM, 0.0f, 0.0f);  
g.add_tripstop(1, TripStop::OSM, 1.0f, 0.0f);  
g.add_tripstop(2, TripStop::OSM, 0.0f, 1.0f);  
g.add_walkhop(0, 1);  
 
TripPath *p = g.find_path(0, false, 0.0, 0.0, 0.0, 1.0);  
WVPASS(!p);  
}  
 
 
WVTEST_MAIN("tripstops_in_range")  
{  
TripGraph g;  
// north and agricola  
g.add_tripstop(0, TripStop::GTFS, 44.6554236f, -63.5936968f);  
// north and robie (just north of north&agricola)  
g.add_tripstop(1, TripStop::OSM, 44.6546407f, -63.5948438f);  
// north and northwood (just south of north&agricola)  
g.add_tripstop(2, TripStop::GTFS, 44.6567144f, -63.5919115f);  
// Quinpool and Connaught (a few kms away from north&agricola)  
g.add_tripstop(3, TripStop::GTFS, 44.6432423f, -63.6045261f);  
 
{  
vector<TripStop> v = g.find_tripstops_in_range(44.6554236f,  
-63.5936968f,  
TripStop::GTFS,  
500.0f);  
WVPASSEQ(v.size(), 2);  
WVPASS(v[0].id == 0 || v[0].id == 2);  
WVPASS(v[1].id == 0 || v[1].id == 2);  
}  
}  
 
 
static time_t get_time_t(int tm_mday, int tm_mon, int tm_year)  
{  
struct tm t;  
t.tm_sec = 0;  
t.tm_min = 0;  
t.tm_hour = 0;  
t.tm_mday = tm_mday;  
t.tm_mon = tm_mon;  
t.tm_year = tm_year;  
t.tm_wday = -1;  
t.tm_yday = -1;  
t.tm_isdst = -1;  
 
return mktime(&t);  
}  
 
WVTEST_MAIN("service_periods")  
{  
TripGraph g;  
 
// from the 1st to the 7th (i.e. 1st saturday only)  
{  
ServicePeriod s(0, 1, 0, 108, 7, 0, 108, 2000, false, true, false);  
g.add_service_period(s);  
}  
 
// test something that's within a supported service period  
// Saturday Midnight Jan 5th 2008  
{  
vector<pair<int, int> > vsp = g.get_service_period_ids_for_time(get_time_t(5, 0, 108));  
WVPASSEQ(vsp.size(), 1);  
WVPASSEQ(vsp[0].first, 0);  
}  
 
// test something outside a supported service period: day  
// Saturday Midnight Jan 11th 2008  
{  
vector<pair<int, int> > vsp = g.get_service_period_ids_for_time(get_time_t(11, 0, 108));  
WVPASSEQ(vsp.size(), 0);  
}  
// test something outside a supported service period: month  
// Saturday Midnight Feb 5th 2008  
{  
vector<pair<int, int> > vsp = g.get_service_period_ids_for_time(get_time_t(5, 1, 108));  
WVPASSEQ(vsp.size(), 0);  
}  
 
// test something outside a supported service period: year  
// Saturday Midnight Jan 11th 2009  
{  
vector<pair<int, int> > vsp = g.get_service_period_ids_for_time(get_time_t(5, 1, 109));  
WVPASSEQ(vsp.size(), 0);  
}  
 
// add another service period (saturdays for month of january)  
{  
ServicePeriod s(1, 1, 0, 108, 31, 0, 108, 2000, false, true,  
false);  
g.add_service_period(s);  
}  
 
// test something that's within _two_ supported service periods  
// Saturday Midnight Jan 5th 2008  
{  
vector<pair<int, int> > vsp = g.get_service_period_ids_for_time(get_time_t(5, 0, 108));  
WVPASSEQ(vsp.size(), 2);  
WVPASS(vsp[0].first==0 || vsp[0].first==1);  
WVPASS(vsp[1].first==0 || vsp[1].first==1);  
WVFAILEQ(vsp[0].first, vsp[1].first);  
}  
 
// save graph, reload, make sure service periods are still there  
}  
 
 
WVTEST_MAIN("service_periods_overlapping")  
{  
TripGraph g;  
 
// from the 1st to the 7th (i.e. 1st saturday only)  
// (weekday and saturday schedules)  
{  
ServicePeriod s1(0, 1, 0, 108, 7, 0, 108, 90000, false, true, false);  
g.add_service_period(s1);  
ServicePeriod s2(1, 1, 0, 108, 7, 0, 108, 90000, true, false, false);  
g.add_service_period(s2);  
}  
 
vector<pair<int, int> > vsp = g.get_service_period_ids_for_time(get_time_t(5, 0, 108));  
WVPASSEQ(vsp.size(), 2);  
WVPASS(vsp[0].first==0 || vsp[0].first==1);  
WVPASS(vsp[1].first==0 || vsp[1].first==1);  
WVFAILEQ(vsp[0].first, vsp[1].first);  
 
int weekday_index = (vsp[0].first == 1) ? 0 : 1;  
WVPASSEQ(vsp[weekday_index].second, 86400);  
}  
 
 
WVTEST_MAIN("service_periods_turned_on_or_off")  
{  
TripGraph g;  
 
// from the 1st to the 7th (i.e. 1st saturday only)  
// turn off weekday service on the 2nd (wednesday)  
// turn on saturday service on the 3rd (keeping weekday service)  
{  
ServicePeriod s1(0, 1, 0, 108, 7, 0, 108, 80000, false, true, false);  
s1.add_exception_on(3, 0, 108);  
WVPASSEQ(s1.is_turned_on(3, 0, 108), true);  
WVPASSEQ(s1.is_turned_on(4, 0, 108), false);  
g.add_service_period(s1);  
ServicePeriod s2(1, 1, 0, 108, 7, 0, 108, 80000, true, false, false);  
s2.add_exception_off(2, 0, 108);  
WVPASSEQ(s2.is_turned_off(2, 0, 108), true);  
WVPASSEQ(s2.is_turned_off(3, 0, 108), false);  
g.add_service_period(s2);  
}  
 
{  
// should be no service on the 2nd  
vector<pair<int, int> > vsp = g.get_service_period_ids_for_time(get_time_t(2, 0, 108));  
WVPASSEQ(vsp.size(), 0);  
}  
 
{  
// should be two service periods on the 3rd (saturday and weekday)  
vector<pair<int, int> > vsp = g.get_service_period_ids_for_time(get_time_t(3, 0, 108));  
WVPASSEQ(vsp.size(), 2);  
WVPASS(vsp[0].first==0 || vsp[0].first==1);  
WVPASS(vsp[1].first==0 || vsp[1].first==1);  
WVFAILEQ(vsp[0].first, vsp[1].first);  
}  
}  
 
 
WVTEST_MAIN("service_periods_save_load")  
{  
TripGraph g;  
 
// use the same setup as the previous test: saturday and weekday schedules  
// with a few exceptions  
 
// from the 1st to the 7th (i.e. 1st saturday only)  
// turn off weekday service on the 2nd (wednesday)  
// turn on saturday service on the 3rd (keeping weekday service)  
{  
ServicePeriod s1(0, 1, 0, 108, 7, 0, 108, 80000, false, true, false);  
s1.add_exception_on(3, 0, 108);  
g.add_service_period(s1);  
ServicePeriod s2(1, 1, 0, 108, 7, 0, 108, 80000, true, false, false);  
s2.add_exception_off(2, 0, 108);  
g.add_service_period(s2);  
}  
 
char *tmpgraphname = tmpnam(NULL); // security issues in unit tests? bah.  
unlink(tmpgraphname);  
g.save(tmpgraphname);  
 
TripGraph g2;  
g2.load(tmpgraphname);  
 
{  
// should be no service on the 2nd  
vector<pair<int, int> > vsp = g2.get_service_period_ids_for_time(get_time_t(2, 0, 108));  
WVPASSEQ(vsp.size(), 0);  
}  
 
{  
// should be two service periods on the 3rd (saturday and weekday)  
vector<pair<int, int> > vsp = g2.get_service_period_ids_for_time(get_time_t(3, 0, 108));  
WVPASSEQ(vsp.size(), 2);  
WVPASS(vsp[0].first==0 || vsp[0].first==1);  
WVPASS(vsp[1].first==0 || vsp[1].first==1);  
WVFAILEQ(vsp[0].first, vsp[1].first);  
}  
}  
 
#include "wvtest.h"  
#include "tripstop.h"  
#include <stdio.h>  
 
using namespace std;  
using namespace tr1;  
 
 
WVTEST_MAIN("save/load")  
{  
TripStop t1(1, TripStop::OSM, 44.5f, 54.4f);  
t1.add_triphop(500, 550, 0, 0, 0, 0);  
t1.add_triphop(550, 600, 0, 0, 0, 0);  
 
char *tmpname = tmpnam(NULL); // security issues in unit tests? bah.  
unlink(tmpname);  
FILE *fp1 = fopen(tmpname, "w");  
t1.write(fp1);  
fclose(fp1);  
 
FILE *fp2 = fopen(tmpname, "r");  
TripStop t2(fp2);  
 
WVPASSEQ(t2.id, t1.id);  
WVPASSEQ(t2.type, t1.type);  
WVPASSEQ(t2.lat, t1.lat);  
WVPASSEQ(t2.lng, t1.lng);  
shared_ptr<TripStop::ServiceDict> tdict = t2.tdict;  
WVPASSEQ(tdict->size(), 1);  
WVPASSEQ(((*tdict))[0].size(), 1);  
WVPASSEQ(((*tdict))[0][0].size(), 2);  
WVPASSEQ(((*tdict))[0][0][0].start_time, 500);  
WVPASSEQ(((*tdict))[0][0][1].start_time, 550);  
 
fclose(fp2);  
}  
 
 
WVTEST_MAIN("get_multiple_triphops")  
{  
TripStop t;  
t.add_triphop(500, 550, 0, 0, 0, 0);  
t.add_triphop(550, 600, 0, 0, 0, 0);  
t.add_triphop(600, 650, 0, 0, 0, 0);  
t.add_triphop(600, 650, 0, 0, 0, 1);  
 
// Ask for different amounts...  
 
vector<TripHop> v = t.find_triphops(499, 0, 0, 3);  
WVPASSEQ(v.size(), 3);  
WVPASSEQ(v[0].start_time, 500);  
WVPASSEQ(v[1].start_time, 550);  
WVPASSEQ(v[2].start_time, 600);  
 
v = t.find_triphops(499, 0, 0, 2);  
WVPASSEQ(v.size(), 2);  
WVPASSEQ(v[0].start_time, 500);  
WVPASSEQ(v[1].start_time, 550);  
 
v = t.find_triphops(499, 0, 0, 4);  
WVPASSEQ(v.size(), 3);  
WVPASSEQ(v[0].start_time, 500);  
WVPASSEQ(v[1].start_time, 550);  
WVPASSEQ(v[2].start_time, 600);  
 
v = t.find_triphops(551, 0, 0, 2);  
WVPASSEQ(v.size(), 1);  
WVPASSEQ(v[0].start_time, 600);  
 
}  
 
%module tripgraph  
 
%{  
#include "serviceperiod.h"  
#include "tripgraph.h"  
#include "trippath.h"  
#include "tripstop.h"  
%}  
 
%include "std_string.i"  
%include "std_deque.i"  
%include "std_vector.i"  
%include "std_pair.i"  
%include "inttypes.i"  
%template(ListTripAction) std::deque<TripAction>;  
%template(ListId) std::deque<int>;  
%template(ListTripHop) std::vector<TripHop>;  
%template(ListTripStop) std::vector<TripStop>;  
%template(ServicePeriodTuple) std::pair<int, int>;  
%template(ListServicePeriodTuple) std::vector<std::pair<int, int> >;  
%include "serviceperiod.h"  
%include "tripgraph.h"  
%include "trippath.h"  
%include "tripstop.h"  
 
#!/usr/bin/python  
 
import transitfeed  
import libroutez.osm as osm  
import time  
import sys  
from libroutez.tripgraph import *  
from optparse import OptionParser  
 
class IdMap:  
'''class which maps from gtfs ids -> libroutez ids'''  
def __init__(self):  
self.spmap = {}  
self.stopmap = {}  
self.routemap = {}  
self.tripmap = {}  
 
def save(self, fname):  
f = open(fname, 'w')  
 
print >> f, "Service Periods: {"  
for gtfs_sp_id in sorted(self.spmap.keys()):  
print >>f, " '%s': %s," % (gtfs_sp_id, self.spmap[gtfs_sp_id])  
print >> f, "}"  
 
print >> f, "Stops: {"  
for gtfs_stop_id in sorted(self.stopmap.keys()):  
print >>f, " '%s': %s," % (gtfs_stop_id, self.stopmap[gtfs_stop_id])  
print >> f, "}"  
 
print >> f, "Routes: {"  
for gtfs_route_id in sorted(self.routemap.keys()):  
print >>f, " '%s': %s," % (gtfs_route_id,  
self.routemap[gtfs_route_id])  
print >> f, "}"  
 
print >> f, "Trips: {"  
for gtfs_trip_id in sorted(self.tripmap.keys()):  
print >> f, " '%s': %s," % (gtfs_trip_id, self.tripmap[gtfs_trip_id])  
print >> f, "}"  
 
f.close()  
 
def load_gtfs(tripgraph, sched, idmap):  
print "Setting timezone to %s" % sched.GetDefaultAgency().agency_timezone  
tripgraph.set_timezone(str(sched.GetDefaultAgency().agency_timezone))  
 
stops = sched.GetStopList()  
for stop in stops:  
idmap.stopmap[stop.stop_id] = len(idmap.stopmap)  
tripgraph.add_tripstop(idmap.stopmap[stop.stop_id], TripStop.GTFS,  
stop.stop_lat, stop.stop_lon)  
 
for sp_id in sched.service_periods.keys():  
idmap.spmap[sp_id] = len(idmap.spmap)  
 
service_period_bounds = {}  
 
trips = sched.GetTripList()  
for trip in trips:  
interpolated_stops = trip.GetTimeInterpolatedStops()  
prevstop = None  
prevsecs = 0  
for (secs, stoptime, is_timepoint) in interpolated_stops:  
stop = stoptime.stop  
if prevstop:  
# stupid side-effect of google's transit feed python script being broken  
if int(secs) < int(prevsecs):  
print "WARNING: Negative edge in gtfs. This probably means you "  
"need a more recent version of the google transit feed "  
"package (see README)"  
if not idmap.tripmap.has_key(trip.trip_id):  
idmap.tripmap[trip.trip_id] = len(idmap.tripmap)  
if not idmap.routemap.has_key(trip.route_id):  
idmap.routemap[trip.route_id] = len(idmap.routemap)  
 
if not service_period_bounds.has_key(trip.service_id):  
service_period_bounds[trip.service_id] = prevsecs  
elif prevsecs > service_period_bounds[trip.service_id]:  
service_period_bounds[trip.service_id] = prevsecs  
 
if prevstop.stop_id != stop.stop_id:  
# only add triphop if we're not going to ourselves. there are  
# some feeds (cough, cough, Halifax) which actually do this  
tripgraph.add_triphop(prevsecs, secs, idmap.stopmap[prevstop.stop_id],  
idmap.stopmap[stop.stop_id],  
idmap.routemap[trip.route_id],  
idmap.tripmap[trip.trip_id],  
idmap.spmap[trip.service_id])  
prevstop = stop  
prevsecs = secs  
 
for sp_id in sched.service_periods.keys():  
sp = sched.service_periods[sp_id]  
if not sp.start_date or not sp.end_date:  
continue  
tm_start = time.strptime(sp.start_date, "%Y%m%d")  
tm_end = time.strptime(sp.end_date, "%Y%m%d")  
# FIXME: currently assume weekday service is uniform, i.e.  
# monday service == mon-fri service  
if service_period_bounds.has_key(sp_id):  
s = ServicePeriod(idmap.spmap[sp_id],  
tm_start.tm_mday, tm_start.tm_mon - 1,  
(tm_start.tm_year - 1900),  
tm_end.tm_mday, tm_end.tm_mon - 1,  
(tm_end.tm_year - 1900),  
int(service_period_bounds[sp_id]),  
sp.day_of_week[0], sp.day_of_week[5],  
sp.day_of_week[6])  
for ex in sp.date_exceptions.keys():  
tm_ex = time.strptime(ex, "%Y%m%d")  
if sp.date_exceptions[ex] == 1:  
s.add_exception_on(tm_ex.tm_mday, tm_ex.tm_mon - 1,  
tm_ex.tm_year - 1900)  
else:  
s.add_exception_off(tm_ex.tm_mday, tm_ex.tm_mon - 1,  
tm_ex.tm_year - 1900)  
 
tripgraph.add_service_period(s)  
else:  
print "WARNING: It appears as if we have a service period with no "  
"bound. This implies that it's not actually being used for anything."  
 
 
def load_osm(tripgraph, map, idmap):  
# map of osm ids -> libroutez ids. libroutez ids are positive integers,  
# starting from the last gtfs id. I'm assuming that OSM ids can be pretty  
# much anything  
osm_nodemap = {}  
for node in map.nodes.values():  
osm_nodemap[node.id] = len(osm_nodemap) + len(idmap.stopmap)  
tripgraph.add_tripstop(osm_nodemap[node.id], TripStop.OSM,  
node.lat, node.lon)  
 
for way in map.ways.values():  
previd = None  
for id in way.nds:  
if previd:  
tripgraph.add_walkhop(osm_nodemap[previd], osm_nodemap[id])  
tripgraph.add_walkhop(osm_nodemap[id], osm_nodemap[previd])  
previd = id  
 
if __name__ == '__main__':  
 
usage = "usage: %prog [options] <gtfs feed> <graph> <gtfs mapping>"  
parser = OptionParser(usage)  
parser.add_option('--osm', dest='osm',  
help='Path of OSM file (optional)')  
 
(options, args) = parser.parse_args()  
 
if len(args) < 3:  
parser.error("incorrect number of arguments")  
exit(1)  
 
print "Loading schedule."  
schedule = transitfeed.Schedule(  
problem_reporter=transitfeed.ProblemReporter())  
schedule.Load(args[0])  
print "Creating graph"  
g = TripGraph()  
print "Inserting gtfs into graph"  
idmap = IdMap()  
load_gtfs(g, schedule, idmap)  
 
if options.osm:  
print "Loading OSM."  
map = osm.OSM(options.osm)  
print "Inserting osm into graph"  
load_osm(g, map, idmap)  
print "Linking osm with gtfs"  
g.link_osm_gtfs()  
 
print "Saving idmap"  
idmap.save(args[2])  
 
print "Saving graph"  
g.save(args[1])  
 
#!/usr/bin/python  
 
import zipfile  
from optparse import OptionParser  
 
if __name__ == '__main__':  
parser = OptionParser()  
(options, args) = parser.parse_args()  
 
zip = zipfile.ZipFile(args[0], mode='r')  
stoptext = zip.read("stops.txt")  
lines = stoptext.split('\n')  
 
descriptors = lines[0].split(',')  
(stop_lat_descriptor, stop_lng_descriptor) = (-1, -1)  
id = 0  
for descriptor in descriptors:  
if descriptor == "stop_lat":  
stop_lat_descriptor = id  
elif descriptor == "stop_lon":  
stop_lng_descriptor = id  
id+=1  
 
(min_lat, min_lng, max_lat, max_lng) = (0.0, 0.0, 0.0, 0.0)  
for line in lines[1:-2:]:  
stop_info = line.split(',')  
(lat, lng) = (float(stop_info[stop_lat_descriptor]),  
float(stop_info[stop_lng_descriptor]))  
if min_lat == 0.0 or lat < min_lat:  
min_lat = lat  
if min_lng == 0.0 or lng < min_lng:  
min_lng = lng  
if max_lat == 0.0 or lat > max_lat:  
max_lat = lat  
if max_lng == 0.0 or lng > max_lng:  
max_lng = lng  
 
print "Polygon:"  
print "%s\t%s" % (min_lat, min_lng)  
print "%s\t%s" % (min_lat, max_lng)  
print "%s\t%s" % (max_lat, max_lng)  
print "%s\t%s" % (max_lat, min_lng)  
print "min_lat, min_lng, max_lat, max_lng: %s %s %s %s" % \  
(min_lat, min_lng, max_lat, max_lng)  
 
GNU LIBRARY GENERAL PUBLIC LICENSE  
Version 2, June 1991  
 
Copyright (C) 1991 Free Software Foundation, Inc.  
675 Mass Ave, Cambridge, MA 02139, USA  
Everyone is permitted to copy and distribute verbatim copies  
of this license document, but changing it is not allowed.  
 
[This is the first released version of the library GPL. It is  
numbered 2 because it goes with version 2 of the ordinary GPL.]  
 
Preamble  
 
The licenses for most software are designed to take away your  
freedom to share and change it. By contrast, the GNU General Public  
Licenses are intended to guarantee your freedom to share and change  
free software--to make sure the software is free for all its users.  
 
This license, the Library General Public License, applies to some  
specially designated Free Software Foundation software, and to any  
other libraries whose authors decide to use it. You can use it for  
your libraries, too.  
 
When we speak of free software, we are referring to freedom, not  
price. Our General Public Licenses are designed to make sure that you  
have the freedom to distribute copies of free software (and charge for  
this service if you wish), that you receive source code or can get it  
if you want it, that you can change the software or use pieces of it  
in new free programs; and that you know you can do these things.  
 
To protect your rights, we need to make restrictions that forbid  
anyone to deny you these rights or to ask you to surrender the rights.  
These restrictions translate to certain responsibilities for you if  
you distribute copies of the library, or if you modify it.  
 
For example, if you distribute copies of the library, whether gratis  
or for a fee, you must give the recipients all the rights that we gave  
you. You must make sure that they, too, receive or can get the source  
code. If you link a program with the library, you must provide  
complete object files to the recipients so that they can relink them  
with the library, after making changes to the library and recompiling  
it. And you must show them these terms so they know their rights.  
 
Our method of protecting your rights has two steps: (1) copyright  
the library, and (2) offer you this license which gives you legal  
permission to copy, distribute and/or modify the library.  
 
Also, for each distributor's protection, we want to make certain  
that everyone understands that there is no warranty for this free  
library. If the library is modified by someone else and passed on, we  
want its recipients to know that what they have is not the original  
version, so that any problems introduced by others will not reflect on  
the original authors' reputations.  
 
Finally, any free program is threatened constantly by software  
patents. We wish to avoid the danger that companies distributing free  
software will individually obtain patent licenses, thus in effect  
transforming the program into proprietary software. To prevent this,  
we have made it clear that any patent must be licensed for everyone's  
free use or not licensed at all.  
 
Most GNU software, including some libraries, is covered by the ordinary  
GNU General Public License, which was designed for utility programs. This  
license, the GNU Library General Public License, applies to certain  
designated libraries. This license is quite different from the ordinary  
one; be sure to read it in full, and don't assume that anything in it is  
the same as in the ordinary license.  
 
The reason we have a separate public license for some libraries is that  
they blur the distinction we usually make between modifying or adding to a  
program and simply using it. Linking a program with a library, without  
changing the library, is in some sense simply using the library, and is  
analogous to running a utility program or application program. However, in  
a textual and legal sense, the linked executable is a combined work, a  
derivative of the original library, and the ordinary General Public License  
treats it as such.  
 
Because of this blurred distinction, using the ordinary General  
Public License for libraries did not effectively promote software  
sharing, because most developers did not use the libraries. We  
concluded that weaker conditions might promote sharing better.  
 
However, unrestricted linking of non-free programs would deprive the  
users of those programs of all benefit from the free status of the  
libraries themselves. This Library General Public License is intended to  
permit developers of non-free programs to use free libraries, while  
preserving your freedom as a user of such programs to change the free  
libraries that are incorporated in them. (We have not seen how to achieve  
this as regards changes in header files, but we have achieved it as regards  
changes in the actual functions of the Library.) The hope is that this  
will lead to faster development of free libraries.  
 
The precise terms and conditions for copying, distribution and  
modification follow. Pay close attention to the difference between a  
"work based on the library" and a "work that uses the library". The  
former contains code derived from the library, while the latter only  
works together with the library.  
 
Note that it is possible for a library to be covered by the ordinary  
General Public License rather than by this special one.  
 
GNU LIBRARY GENERAL PUBLIC LICENSE  
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION  
 
0. This License Agreement applies to any software library which  
contains a notice placed by the copyright holder or other authorized  
party saying it may be distributed under the terms of this Library  
General Public License (also called "this License"). Each licensee is  
addressed as "you".  
 
A "library" means a collection of software functions and/or data  
prepared so as to be conveniently linked with application programs  
(which use some of those functions and data) to form executables.  
 
The "Library", below, refers to any such software library or work  
which has been distributed under these terms. A "work based on the  
Library" means either the Library or any derivative work under  
copyright law: that is to say, a work containing the Library or a  
portion of it, either verbatim or with modifications and/or translated  
straightforwardly into another language. (Hereinafter, translation is  
included without limitation in the term "modification".)  
 
"Source code" for a work means the preferred form of the work for  
making modifications to it. For a library, complete source code means  
all the source code for all modules it contains, plus any associated  
interface definition files, plus the scripts used to control compilation  
and installation of the library.  
 
Activities other than copying, distribution and modification are not  
covered by this License; they are outside its scope. The act of  
running a program using the Library is not restricted, and output from  
such a program is covered only if its contents constitute a work based  
on the Library (independent of the use of the Library in a tool for  
writing it). Whether that is true depends on what the Library does  
and what the program that uses the Library does.  
 
1. You may copy and distribute verbatim copies of the Library's  
complete source code as you receive it, in any medium, provided that  
you conspicuously and appropriately publish on each copy an  
appropriate copyright notice and disclaimer of warranty; keep intact  
all the notices that refer to this License and to the absence of any  
warranty; and distribute a copy of this License along with the  
Library.  
 
You may charge a fee for the physical act of transferring a copy,  
and you may at your option offer warranty protection in exchange for a  
fee.  
 
2. You may modify your copy or copies of the Library or any portion  
of it, thus forming a work based on the Library, and copy and  
distribute such modifications or work under the terms of Section 1  
above, provided that you also meet all of these conditions:  
 
a) The modified work must itself be a software library.  
 
b) You must cause the files modified to carry prominent notices  
stating that you changed the files and the date of any change.  
 
c) You must cause the whole of the work to be licensed at no  
charge to all third parties under the terms of this License.  
 
d) If a facility in the modified Library refers to a function or a  
table of data to be supplied by an application program that uses  
the facility, other than as an argument passed when the facility  
is invoked, then you must make a good faith effort to ensure that,  
in the event an application does not supply such function or  
table, the facility still operates, and performs whatever part of  
its purpose remains meaningful.  
 
(For example, a function in a library to compute square roots has  
a purpose that is entirely well-defined independent of the  
application. Therefore, Subsection 2d requires that any  
application-supplied function or table used by this function must  
be optional: if the application does not supply it, the square  
root function must still compute square roots.)  
 
These requirements apply to the modified work as a whole. If  
identifiable sections of that work are not derived from the Library,  
and can be reasonably considered independent and separate works in  
themselves, then this License, and its terms, do not apply to those  
sections when you distribute them as separate works. But when you  
distribute the same sections as part of a whole which is a work based  
on the Library, the distribution of the whole must be on the terms of  
this License, whose permissions for other licensees extend to the  
entire whole, and thus to each and every part regardless of who wrote  
it.  
 
Thus, it is not the intent of this section to claim rights or contest  
your rights to work written entirely by you; rather, the intent is to  
exercise the right to control the distribution of derivative or  
collective works based on the Library.  
 
In addition, mere aggregation of another work not based on the Library  
with the Library (or with a work based on the Library) on a volume of  
a storage or distribution medium does not bring the other work under  
the scope of this License.  
 
3. You may opt to apply the terms of the ordinary GNU General Public  
License instead of this License to a given copy of the Library. To do  
this, you must alter all the notices that refer to this License, so  
that they refer to the ordinary GNU General Public License, version 2,  
instead of to this License. (If a newer version than version 2 of the  
ordinary GNU General Public License has appeared, then you can specify  
that version instead if you wish.) Do not make any other change in  
these notices.  
 
Once this change is made in a given copy, it is irreversible for  
that copy, so the ordinary GNU General Public License applies to all  
subsequent copies and derivative works made from that copy.  
 
This option is useful when you wish to copy part of the code of  
the Library into a program that is not a library.  
 
4. You may copy and distribute the Library (or a portion or  
derivative of it, under Section 2) in object code or executable form  
under the terms of Sections 1 and 2 above provided that you accompany  
it with the complete corresponding machine-readable source code, which  
must be distributed under the terms of Sections 1 and 2 above on a  
medium customarily used for software interchange.  
 
If distribution of object code is made by offering access to copy  
from a designated place, then offering equivalent access to copy the  
source code from the same place satisfies the requirement to  
distribute the source code, even though third parties are not  
compelled to copy the source along with the object code.  
 
5. A program that contains no derivative of any portion of the  
Library, but is designed to work with the Library by being compiled or  
linked with it, is called a "work that uses the Library". Such a  
work, in isolation, is not a derivative work of the Library, and  
therefore falls outside the scope of this License.  
 
However, linking a "work that uses the Library" with the Library  
creates an executable that is a derivative of the Library (because it  
contains portions of the Library), rather than a "work that uses the  
library". The executable is therefore covered by this License.  
Section 6 states terms for distribution of such executables.  
 
When a "work that uses the Library" uses material from a header file  
that is part of the Library, the object code for the work may be a  
derivative work of the Library even though the source code is not.  
Whether this is true is especially significant if the work can be  
linked without the Library, or if the work is itself a library. The  
threshold for this to be true is not precisely defined by law.  
 
If such an object file uses only numerical parameters, data  
structure layouts and accessors, and small macros and small inline  
functions (ten lines or less in length), then the use of the object  
file is unrestricted, regardless of whether it is legally a derivative  
work. (Executables containing this object code plus portions of the  
Library will still fall under Section 6.)  
 
Otherwise, if the work is a derivative of the Library, you may  
distribute the object code for the work under the terms of Section 6.  
Any executables containing that work also fall under Section 6,  
whether or not they are linked directly with the Library itself.  
 
6. As an exception to the Sections above, you may also compile or  
link a "work that uses the Library" with the Library to produce a  
work containing portions of the Library, and distribute that work  
under terms of your choice, provided that the terms permit  
modification of the work for the customer's own use and reverse  
engineering for debugging such modifications.  
 
You must give prominent notice with each copy of the work that the  
Library is used in it and that the Library and its use are covered by  
this License. You must supply a copy of this License. If the work  
during execution displays copyright notices, you must include the  
copyright notice for the Library among them, as well as a reference  
directing the user to the copy of this License. Also, you must do one  
of these things:  
 
a) Accompany the work with the complete corresponding  
machine-readable source code for the Library including whatever  
changes were used in the work (which must be distributed under  
Sections 1 and 2 above); and, if the work is an executable linked  
with the Library, with the complete machine-readable "work that  
uses the Library", as object code and/or source code, so that the  
user can modify the Library and then relink to produce a modified  
executable containing the modified Library. (It is understood  
that the user who changes the contents of definitions files in the  
Library will not necessarily be able to recompile the application  
to use the modified definitions.)  
 
b) Accompany the work with a written offer, valid for at  
least three years, to give the same user the materials  
specified in Subsection 6a, above, for a charge no more  
than the cost of performing this distribution.  
 
c) If distribution of the work is made by offering access to copy  
from a designated place, offer equivalent access to copy the above  
specified materials from the same place.  
 
d) Verify that the user has already received a copy of these  
materials or that you have already sent this user a copy.  
 
For an executable, the required form of the "work that uses the  
Library" must include any data and utility programs needed for  
reproducing the executable from it. However, as a special exception,  
the source code distributed need not include anything that is normally  
distributed (in either source or binary form) with the major  
components (compiler, kernel, and so on) of the operating system on  
which the executable runs, unless that component itself accompanies  
the executable.  
 
It may happen that this requirement contradicts the license  
restrictions of other proprietary libraries that do not normally  
accompany the operating system. Such a contradiction means you cannot  
use both them and the Library together in an executable that you  
distribute.  
 
7. You may place library facilities that are a work based on the  
Library side-by-side in a single library together with other library  
facilities not covered by this License, and distribute such a combined  
library, provided that the separate distribution of the work based on  
the Library and of the other library facilities is otherwise  
permitted, and provided that you do these two things:  
 
a) Accompany the combined library with a copy of the same work  
based on the Library, uncombined with any other library  
facilities. This must be distributed under the terms of the  
Sections above.  
 
b) Give prominent notice with the combined library of the fact  
that part of it is a work based on the Library, and explaining  
where to find the accompanying uncombined form of the same work.  
 
8. You may not copy, modify, sublicense, link with, or distribute  
the Library except as expressly provided under this License. Any  
attempt otherwise to copy, modify, sublicense, link with, or  
distribute the Library is void, and will automatically terminate your  
rights under this License. However, parties who have received copies,  
or rights, from you under this License will not have their licenses  
terminated so long as such parties remain in full compliance.  
 
9. You are not required to accept this License, since you have not  
signed it. However, nothing else grants you permission to modify or  
distribute the Library or its derivative works. These actions are  
prohibited by law if you do not accept this License. Therefore, by  
modifying or distributing the Library (or any work based on the  
Library), you indicate your acceptance of this License to do so, and  
all its terms and conditions for copying, distributing or modifying  
the Library or works based on it.  
 
10. Each time you redistribute the Library (or any work based on the  
Library), the recipient automatically receives a license from the  
original licensor to copy, distribute, link with or modify the Library  
subject to these terms and conditions. You may not impose any further  
restrictions on the recipients' exercise of the rights granted herein.  
You are not responsible for enforcing compliance by third parties to  
this License.  
 
11. If, as a consequence of a court judgment or allegation of patent  
infringement or for any other reason (not limited to patent issues),  
conditions are imposed on you (whether by court order, agreement or  
otherwise) that contradict the conditions of this License, they do not  
excuse you from the conditions of this License. If you cannot  
distribute so as to satisfy simultaneously your obligations under this  
License and any other pertinent obligations, then as a consequence you  
may not distribute the Library at all. For example, if a patent  
license would not permit royalty-free redistribution of the Library by  
all those who receive copies directly or indirectly through you, then  
the only way you could satisfy both it and this License would be to  
refrain entirely from distribution of the Library.  
 
If any portion of this section is held invalid or unenforceable under any  
particular circumstance, the balance of the section is intended to apply,  
and the section as a whole is intended to apply in other circumstances.  
 
It is not the purpose of this section to induce you to infringe any  
patents or other property right claims or to contest validity of any  
such claims; this section has the sole purpose of protecting the  
integrity of the free software distribution system which is  
implemented by public license practices. Many people have made  
generous contributions to the wide range of software distributed  
through that system in reliance on consistent application of that  
system; it is up to the author/donor to decide if he or she is willing  
to distribute software through any other system and a licensee cannot  
impose that choice.  
 
This section is intended to make thoroughly clear what is believed to  
be a consequence of the rest of this License.  
 
12. If the distribution and/or use of the Library is restricted in  
certain countries either by patents or by copyrighted interfaces, the  
original copyright holder who places the Library under this License may add  
an explicit geographical distribution limitation excluding those countries,  
so that distribution is permitted only in or among countries not thus  
excluded. In such case, this License incorporates the limitation as if  
written in the body of this License.  
 
13. The Free Software Foundation may publish revised and/or new  
versions of the Library General Public License from time to time.  
Such new versions will be similar in spirit to the present version,  
but may differ in detail to address new problems or concerns.  
 
Each version is given a distinguishing version number. If the Library  
specifies a version number of this License which applies to it and  
"any later version", you have the option of following the terms and  
conditions either of that version or of any later version published by  
the Free Software Foundation. If the Library does not specify a  
license version number, you may choose any version ever published by  
the Free Software Foundation.  
 
14. If you wish to incorporate parts of the Library into other free  
programs whose distribution conditions are incompatible with these,  
write to the author to ask for permission. For software which is  
copyrighted by the Free Software Foundation, write to the Free  
Software Foundation; we sometimes make exceptions for this. Our  
decision will be guided by the two goals of preserving the free status  
of all derivatives of our free software and of promoting the sharing  
and reuse of software generally.  
 
NO WARRANTY  
 
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO  
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR  
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY  
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE  
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR  
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE  
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME  
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.  
 
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN  
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY  
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU  
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR  
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE  
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING  
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A  
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF  
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH  
DAMAGES.  
 
END OF TERMS AND CONDITIONS  
 
Appendix: How to Apply These Terms to Your New Libraries  
 
If you develop a new library, and you want it to be of the greatest  
possible use to the public, we recommend making it free software that  
everyone can redistribute and change. You can do so by permitting  
redistribution under these terms (or, alternatively, under the terms of the  
ordinary General Public License).  
 
To apply these terms, attach the following notices to the library. It is  
safest to attach them to the start of each source file to most effectively  
convey the exclusion of warranty; and each file should have at least the  
"copyright" line and a pointer to where the full notice is found.  
 
<one line to give the library's name and a brief idea of what it does.>  
Copyright (C) <year> <name of author>  
 
This library is free software; you can redistribute it and/or  
modify it under the terms of the GNU Library General Public  
License as published by the Free Software Foundation; either  
version 2 of the License, or (at your option) any later version.  
 
This library is distributed in the hope that it will be useful,  
but WITHOUT ANY WARRANTY; without even the implied warranty of  
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU  
Library General Public License for more details.  
 
You should have received a copy of the GNU Library General Public  
License along with this library; if not, write to the Free  
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
 
Also add information on how to contact you by electronic and paper mail.  
 
You should also get your employer (if you work as a programmer) or your  
school, if any, to sign a "copyright disclaimer" for the library, if  
necessary. Here is a sample; alter the names:  
 
Yoyodyne, Inc., hereby disclaims all copyright interest in the  
library `Frob' (a library for tweaking knobs) written by James Random Hacker.  
 
<signature of Ty Coon>, 1 April 1990  
Ty Coon, President of Vice  
 
That's all there is to it!  
 
This is a snapshot of various files from the wvtest project that we use  
to test libroutez. It is licensed under the LGPL. For more information,  
see here:  
 
http://github.com/apenwarr/wvtest/tree/master  
 
/*  
* WvTest:  
* Copyright (C) 1997-2009 Net Integration Technologies, Inc.  
* Licensed under the GNU Library General Public License, version 2.  
* See the included file named LICENSE for license information.  
*/  
#include "wvtest.h"  
#include <stdio.h>  
#include <string.h>  
#include <stdlib.h>  
#include <ctype.h>  
#ifdef _WIN32  
#include <direct.h>  
#else  
#include <unistd.h>  
#include <sys/wait.h>  
#endif  
#include <errno.h>  
#include <signal.h>  
 
#include <cstdlib>  
 
#ifdef HAVE_VALGRIND_MEMCHECK_H  
# include <valgrind/memcheck.h>  
# include <valgrind/valgrind.h>  
#else  
# define VALGRIND_COUNT_ERRORS 0  
# define VALGRIND_DO_LEAK_CHECK  
# define VALGRIND_COUNT_LEAKS(a,b,c,d) (a=b=c=d=0)  
#endif  
 
#define MAX_TEST_TIME 40 // max seconds for a single test to run  
#define MAX_TOTAL_TIME 120*60 // max seconds for the entire suite to run  
 
#define TEST_START_FORMAT "! %s:%-5d %-40s "  
 
static int memerrs()  
{  
return (int)VALGRIND_COUNT_ERRORS;  
}  
 
static int memleaks()  
{  
int leaked = 0, dubious = 0, reachable = 0, suppressed = 0;  
VALGRIND_DO_LEAK_CHECK;  
VALGRIND_COUNT_LEAKS(leaked, dubious, reachable, suppressed);  
printf("memleaks: sure:%d dubious:%d reachable:%d suppress:%d\n",  
leaked, dubious, reachable, suppressed);  
fflush(stdout);  
 
// dubious+reachable are normally non-zero because of globals...  
// return leaked+dubious+reachable;  
return leaked;  
}  
 
// Return 1 if no children are running or zombies, 0 if there are any running  
// or zombie children.  
// Will wait for any already-terminated children first.  
// Passes if no rogue children were running, fails otherwise.  
// If your test gets a failure in here, either you're not killing all your  
// children, or you're not calling waitpid(2) on all of them.  
static bool no_running_children()  
{  
#ifndef _WIN32  
pid_t wait_result;  
 
// Acknowledge and complain about any zombie children  
do  
{  
int status = 0;  
wait_result = waitpid(-1, &status, WNOHANG);  
 
if (wait_result > 0)  
{  
char buf[256];  
snprintf(buf, sizeof(buf) - 1, "%d", wait_result);  
buf[sizeof(buf)-1] = '\0';  
WVFAILEQ("Unclaimed dead child process", buf);  
}  
} while (wait_result > 0);  
 
// There should not be any running children, so waitpid should return -1  
WVPASSEQ(errno, ECHILD);  
WVPASSEQ(wait_result, -1);  
return (wait_result == -1 && errno == ECHILD);  
#endif  
return true;  
}  
 
 
WvTest *WvTest::first, *WvTest::last;  
int WvTest::fails, WvTest::runs;  
time_t WvTest::start_time;  
bool WvTest::run_twice = false;  
 
void WvTest::alarm_handler(int)  
{  
printf("\n! WvTest Current test took longer than %d seconds! FAILED\n",  
MAX_TEST_TIME);  
fflush(stdout);  
abort();  
}  
 
 
static const char *pathstrip(const char *filename)  
{  
const char *cptr;  
cptr = strrchr(filename, '/');  
if (cptr) filename = cptr + 1;  
cptr = strrchr(filename, '\\');  
if (cptr) filename = cptr + 1;  
return filename;  
}  
 
 
WvTest::WvTest(const char *_descr, const char *_idstr, MainFunc *_main,  
int _slowness) :  
descr(_descr),  
idstr(pathstrip(_idstr)),  
main(_main),  
slowness(_slowness),  
next(NULL)  
{  
if (first)  
last->next = this;  
else  
first = this;  
last = this;  
}  
 
 
static bool prefix_match(const char *s, const char * const *prefixes)  
{  
for (const char * const *prefix = prefixes; prefix && *prefix; prefix++)  
{  
if (!strncasecmp(s, *prefix, strlen(*prefix)))  
return true;  
}  
return false;  
}  
 
 
int WvTest::run_all(const char * const *prefixes)  
{  
int old_valgrind_errs = 0, new_valgrind_errs;  
int old_valgrind_leaks = 0, new_valgrind_leaks;  
 
#ifdef _WIN32  
/* I should be doing something to do with SetTimer here,  
* not sure exactly what just yet */  
#else  
char *disable(getenv("WVTEST_DISABLE_TIMEOUT"));  
if (disable != NULL && disable[0] != '\0' && disable[0] != '0')  
signal(SIGALRM, SIG_IGN);  
else  
signal(SIGALRM, alarm_handler);  
alarm(MAX_TEST_TIME);  
#endif  
start_time = time(NULL);  
 
// make sure we can always start out in the same directory, so tests have  
// access to their files. If a test uses chdir(), we want to be able to  
// reverse it.  
char wd[1024];  
if (!getcwd(wd, sizeof(wd)))  
strcpy(wd, ".");  
 
const char *slowstr1 = getenv("WVTEST_MIN_SLOWNESS");  
const char *slowstr2 = getenv("WVTEST_MAX_SLOWNESS");  
int min_slowness = 0, max_slowness = 65535;  
if (slowstr1) min_slowness = atoi(slowstr1);  
if (slowstr2) max_slowness = atoi(slowstr2);  
 
#ifdef _WIN32  
run_twice = false;  
#else  
char *parallel_str = getenv("WVTEST_PARALLEL");  
if (parallel_str)  
run_twice = atoi(parallel_str) > 0;  
#endif  
 
// there are lots of fflush() calls in here because stupid win32 doesn't  
// flush very often by itself.  
fails = runs = 0;  
for (WvTest *cur = first; cur; cur = cur->next)  
{  
if (cur->slowness <= max_slowness  
&& cur->slowness >= min_slowness  
&& (!prefixes  
|| prefix_match(cur->idstr, prefixes)  
|| prefix_match(cur->descr, prefixes)))  
{  
#ifndef _WIN32  
// set SIGPIPE back to default, helps catch tests which don't set  
// this signal to SIG_IGN (which is almost always what you want)  
// on startup  
signal(SIGPIPE, SIG_DFL);  
 
pid_t child = 0;  
if (run_twice)  
{  
// I see everything twice!  
printf("Running test in parallel.\n");  
child = fork();  
}  
#endif  
 
printf("\nTesting \"%s\" in %s:\n", cur->descr, cur->idstr);  
fflush(stdout);  
 
cur->main();  
chdir(wd);  
 
new_valgrind_errs = memerrs();  
WVPASS(new_valgrind_errs == old_valgrind_errs);  
old_valgrind_errs = new_valgrind_errs;  
 
new_valgrind_leaks = memleaks();  
WVPASS(new_valgrind_leaks == old_valgrind_leaks);  
old_valgrind_leaks = new_valgrind_leaks;  
 
fflush(stderr);  
printf("\n");  
fflush(stdout);  
 
#ifndef _WIN32  
if (run_twice)  
{  
if (!child)  
{  
// I see everything once!  
printf("Child exiting.\n");  
_exit(0);  
}  
else  
{  
printf("Waiting for child to exit.\n");  
int result;  
while ((result = waitpid(child, NULL, 0)) == -1 &&  
errno == EINTR)  
printf("Waitpid interrupted, retrying.\n");  
}  
}  
#endif  
 
WVPASS(no_running_children());  
}  
}  
 
WVPASS(runs > 0);  
 
if (prefixes && *prefixes && **prefixes)  
printf("WvTest: WARNING: only ran tests starting with "  
"specifed prefix(es).\n");  
else  
printf("WvTest: ran all tests.\n");  
printf("WvTest: %d test%s, %d failure%s.\n",  
runs, runs==1 ? "" : "s",  
fails, fails==1 ? "": "s");  
fflush(stdout);  
 
return fails != 0;  
}  
 
 
// If we aren't running in parallel, we want to output the name of the test  
// before we run it, so we know what happened if it crashes. If we are  
// running in parallel, outputting this information in multiple printf()s  
// can confuse parsers, so we want to output everything in one printf().  
//  
// This function gets called by both start() and check(). If we're not  
// running in parallel, just print the data. If we're running in parallel,  
// and we're starting a test, save a copy of the file/line/description until  
// the test is done and we can output it all at once.  
//  
// Yes, this is probably the worst API of all time.  
void WvTest::print_result(bool start, const char *_file, int _line,  
const char *_condstr, bool result)  
{  
static char *file;  
static char *condstr;  
static int line;  
 
if (start)  
{  
if (file)  
free(file);  
if (condstr)  
free(condstr);  
file = strdup(pathstrip(_file));  
condstr = strdup(_condstr);  
line = _line;  
 
for (char *cptr = condstr; *cptr; cptr++)  
{  
if (!isprint((unsigned char)*cptr))  
*cptr = '!';  
}  
}  
 
const char *result_str = result ? "ok\n" : "FAILED\n";  
if (run_twice)  
{  
if (!start)  
printf(TEST_START_FORMAT "%s", file, line, condstr, result_str);  
}  
else  
{  
if (start)  
printf(TEST_START_FORMAT, file, line, condstr);  
else  
printf("%s", result_str);  
}  
fflush(stdout);  
 
if (!start)  
{  
if (file)  
free(file);  
if (condstr)  
free(condstr);  
file = condstr = NULL;  
}  
}  
 
 
void WvTest::start(const char *file, int line, const char *condstr)  
{  
// Either print the file, line, and condstr, or save them for later.  
print_result(true, file, line, condstr, 0);  
}  
 
 
void WvTest::check(bool cond)  
{  
#ifndef _WIN32  
alarm(MAX_TEST_TIME); // restart per-test timeout  
#endif  
if (!start_time) start_time = time(NULL);  
 
if (time(NULL) - start_time > MAX_TOTAL_TIME)  
{  
printf("\n! WvTest Total run time exceeded %d seconds! FAILED\n",  
MAX_TOTAL_TIME);  
fflush(stdout);  
abort();  
}  
 
runs++;  
 
print_result(false, NULL, 0, NULL, cond);  
 
if (!cond)  
{  
fails++;  
 
if (getenv("WVTEST_DIE_FAST"))  
abort();  
}  
}  
 
 
bool WvTest::start_check_eq(const char *file, int line,  
const char *a, const char *b, bool expect_pass)  
{  
if (!a) a = "";  
if (!b) b = "";  
 
size_t len = strlen(a) + strlen(b) + 8 + 1;  
char *str = new char[len];  
sprintf(str, "[%s] %s [%s]", a, expect_pass ? "==" : "!=", b);  
 
start(file, line, str);  
delete[] str;  
 
bool cond = !strcmp(a, b);  
if (!expect_pass)  
cond = !cond;  
 
check(cond);  
return cond;  
}  
 
 
bool WvTest::start_check_eq(const char *file, int line,  
const std::string &a, const std::string &b,  
bool expect_pass)  
{  
return start_check_eq(file, line, a.c_str(), b.c_str(), expect_pass);  
}  
 
 
bool WvTest::start_check_eq(const char *file, int line,  
int a, int b, bool expect_pass)  
{  
size_t len = 128 + 128 + 8 + 1;  
char *str = new char[len];  
sprintf(str, "%d %s %d", a, expect_pass ? "==" : "!=", b);  
 
start(file, line, str);  
delete[] str;  
 
bool cond = (a == b);  
if (!expect_pass)  
cond = !cond;  
 
check(cond);  
return cond;  
}  
 
 
bool WvTest::start_check_lt(const char *file, int line,  
const char *a, const char *b)  
{  
if (!a) a = "";  
if (!b) b = "";  
 
size_t len = strlen(a) + strlen(b) + 8 + 1;  
char *str = new char[len];  
sprintf(str, "[%s] < [%s]", a, b);  
 
start(file, line, str);  
delete[] str;  
 
bool cond = strcmp(a, b) < 0;  
check(cond);  
return cond;  
}  
 
 
bool WvTest::start_check_lt(const char *file, int line, int a, int b)  
{  
size_t len = 128 + 128 + 8 + 1;  
char *str = new char[len];  
sprintf(str, "%d < %d", a, b);  
 
start(file, line, str);  
delete[] str;  
 
bool cond = a < b;  
check(cond);  
return cond;  
}  
 
/* -*- Mode: C++ -*-  
* WvTest:  
* Copyright (C) 1997-2009 Net Integration Technologies, Inc.  
* Licensed under the GNU Library General Public License, version 2.  
* See the included file named LICENSE for license information.  
*/  
#ifndef __WVTEST_H  
#define __WVTEST_H  
 
#ifndef WVTEST_CONFIGURED  
# error "Missing settings: HAVE_VALGRIND_MEMCHECK_H HAVE_WVCRASH WVTEST_CONFIGURED"  
#endif  
 
#include <time.h>  
#include <string>  
 
class WvTest  
{  
typedef void MainFunc();  
const char *descr, *idstr;  
MainFunc *main;  
int slowness;  
WvTest *next;  
static WvTest *first, *last;  
static int fails, runs;  
static time_t start_time;  
static bool run_twice;  
 
static void alarm_handler(int sig);  
 
static void print_result(bool start, const char *file, int line,  
const char *condstr, bool result);  
public:  
WvTest(const char *_descr, const char *_idstr, MainFunc *_main, int _slow);  
static int run_all(const char * const *prefixes = NULL);  
static void start(const char *file, int line, const char *condstr);  
static void check(bool cond);  
static inline bool start_check(const char *file, int line,  
const char *condstr, bool cond)  
{ start(file, line, condstr); check(cond); return cond; }  
static bool start_check_eq(const char *file, int line,  
const char *a, const char *b, bool expect_pass);  
static bool start_check_eq(const char *file, int line,  
const std::string &a, const std::string &b,  
bool expect_pass);  
static bool start_check_eq(const char *file, int line, int a, int b,  
bool expect_pass);  
static bool start_check_lt(const char *file, int line,  
const char *a, const char *b);  
static bool start_check_lt(const char *file, int line, int a, int b);  
};  
 
 
#define WVPASS(cond) \  
WvTest::start_check(__FILE__, __LINE__, #cond, (cond))  
#define WVPASSEQ(a, b) \  
WvTest::start_check_eq(__FILE__, __LINE__, (a), (b), true)  
#define WVPASSLT(a, b) \  
WvTest::start_check_lt(__FILE__, __LINE__, (a), (b))  
#define WVFAIL(cond) \  
WvTest::start_check(__FILE__, __LINE__, "NOT(" #cond ")", !(cond))  
#define WVFAILEQ(a, b) \  
WvTest::start_check_eq(__FILE__, __LINE__, (a), (b), false)  
#define WVPASSNE(a, b) WVFAILEQ(a, b)  
#define WVFAILNE(a, b) WVPASSEQ(a, b)  
 
#define WVTEST_MAIN3(descr, ff, ll, slowness) \  
static void _wvtest_main_##ll(); \  
static WvTest _wvtest_##ll(descr, ff, _wvtest_main_##ll, slowness); \  
static void _wvtest_main_##ll()  
#define WVTEST_MAIN2(descr, ff, ll, slowness) \  
WVTEST_MAIN3(descr, ff, ll, slowness)  
#define WVTEST_MAIN(descr) WVTEST_MAIN2(descr, __FILE__, __LINE__, 0)  
#define WVTEST_SLOW_MAIN(descr) WVTEST_MAIN2(descr, __FILE__, __LINE__, 1)  
 
 
#endif // __WVTEST_H  
 
/*  
* WvTest:  
* Copyright (C) 1997-2009 Net Integration Technologies, Inc.  
* Licensed under the GNU Library General Public License, version 2.  
* See the included file named LICENSE for license information.  
*/  
#include "wvtest.h"  
#ifdef HAVE_WVCRASH  
# include "wvcrash.h"  
#endif  
#include <stdlib.h>  
#include <stdio.h>  
#ifdef _WIN32  
#include <io.h>  
#include <windows.h>  
#else  
#include <unistd.h>  
#include <fcntl.h>  
#endif  
 
static bool fd_is_valid(int fd)  
{  
#ifdef _WIN32  
if ((HANDLE)_get_osfhandle(fd) != INVALID_HANDLE_VALUE) return true;  
#endif  
int nfd = dup(fd);  
if (nfd >= 0)  
{  
close(nfd);  
return true;  
}  
return false;  
 
}  
 
 
static int fd_count(const char *when)  
{  
int count = 0;  
 
printf("fds open at %s:", when);  
 
for (int fd = 0; fd < 1024; fd++)  
{  
if (fd_is_valid(fd))  
{  
count++;  
printf(" %d", fd);  
fflush(stdout);  
}  
}  
printf("\n");  
 
return count;  
}  
 
 
int main(int argc, char **argv)  
{  
char buf[200];  
#if defined(_WIN32) && defined(HAVE_WVCRASH)  
setup_console_crash();  
#endif  
 
// test wvtest itself. Not very thorough, but you have to draw the  
// line somewhere :)  
WVPASS(true);  
WVPASS(1);  
WVFAIL(false);  
WVFAIL(0);  
int startfd, endfd;  
char * const *prefixes = NULL;  
 
if (argc > 1)  
prefixes = argv + 1;  
 
startfd = fd_count("start");  
int ret = WvTest::run_all(prefixes);  
 
if (ret == 0) // don't pollute the strace output if we failed anyway  
{  
endfd = fd_count("end");  
 
WVPASS(startfd == endfd);  
#ifndef _WIN32  
if (startfd != endfd)  
{  
sprintf(buf, "ls -l /proc/%d/fd", getpid());  
system(buf);  
}  
#endif  
}  
 
// keep 'make' from aborting if this environment variable is set  
if (getenv("WVTEST_NO_FAIL"))  
return 0;  
else  
return ret;  
}  
 
#!/usr/bin/perl -w  
#  
# WvTest:  
# Copyright (C)2007-2009 Versabanq Innovations Inc. and contributors.  
# Licensed under the GNU Library General Public License, version 2.  
# See the included file named LICENSE for license information.  
#  
use strict;  
use Time::HiRes qw(time);  
 
# always flush  
$| = 1;  
 
if (@ARGV < 1) {  
print STDERR "Usage: $0 <command line...>\n";  
exit 127;  
}  
 
print STDERR "Testing \"all\" in @ARGV:\n";  
 
my $pid = open(my $fh, "-|");  
if (!$pid) {  
# child  
setpgrp();  
open STDERR, '>&STDOUT' or die("Can't dup stdout: $!\n");  
exec(@ARGV);  
exit 126; # just in case  
}  
 
my $istty = -t STDOUT;  
my @log = ();  
my ($gpasses, $gfails) = (0,0);  
 
sub bigkill($)  
{  
my $pid = shift;  
 
if (@log) {  
print "\n" . join("\n", @log) . "\n";  
}  
 
print STDERR "\n! Killed by signal FAILED\n";  
 
($pid > 0) || die("pid is '$pid'?!\n");  
 
local $SIG{CHLD} = sub { }; # this will wake us from sleep() faster  
kill 15, $pid;  
sleep(2);  
 
if ($pid > 1) {  
kill 9, -$pid;  
}  
kill 9, $pid;  
 
exit(125);  
}  
 
# parent  
local $SIG{INT} = sub { bigkill($pid); };  
local $SIG{TERM} = sub { bigkill($pid); };  
local $SIG{ALRM} = sub {  
print STDERR "Alarm timed out! No test results for too long.\n";  
bigkill($pid);  
};  
 
sub colourize($)  
{  
my $result = shift;  
my $pass = ($result eq "ok");  
 
if ($istty) {  
my $colour = $pass ? "\e[32;1m" : "\e[31;1m";  
return "$colour$result\e[0m";  
} else {  
return $result;  
}  
}  
 
sub mstime($$$)  
{  
my ($floatsec, $warntime, $badtime) = @_;  
my $ms = int($floatsec * 1000);  
my $str = sprintf("%d.%03ds", $ms/1000, $ms % 1000);  
 
if ($istty && $ms > $badtime) {  
return "\e[31;1m$str\e[0m";  
} elsif ($istty && $ms > $warntime) {  
return "\e[33;1m$str\e[0m";  
} else {  
return "$str";  
}  
}  
 
sub resultline($$)  
{  
my ($name, $result) = @_;  
return sprintf("! %-65s %s", $name, colourize($result));  
}  
 
my $allstart = time();  
my ($start, $stop);  
 
sub endsect()  
{  
$stop = time();  
if ($start) {  
printf " %s %s\n", mstime($stop - $start, 500, 1000), colourize("ok");  
}  
}  
 
while (<$fh>)  
{  
chomp;  
s/\r//g;  
 
if (/^\s*Testing "(.*)" in (.*):\s*$/)  
{  
alarm(120);  
my ($sect, $file) = ($1, $2);  
 
endsect();  
 
printf("! %s %s: ", $file, $sect);  
@log = ();  
$start = $stop;  
}  
elsif (/^!\s*(.*?)\s+(\S+)\s*$/)  
{  
alarm(120);  
 
my ($name, $result) = ($1, $2);  
my $pass = ($result eq "ok");  
 
if (!$start) {  
printf("\n! Startup: ");  
$start = time();  
}  
 
push @log, resultline($name, $result);  
 
if (!$pass) {  
$gfails++;  
if (@log) {  
print "\n" . join("\n", @log) . "\n";  
@log = ();  
}  
} else {  
$gpasses++;  
print ".";  
}  
}  
else  
{  
push @log, $_;  
}  
}  
 
endsect();  
 
my $newpid = waitpid($pid, 0);  
if ($newpid != $pid) {  
die("waitpid returned '$newpid', expected '$pid'\n");  
}  
 
my $code = $?;  
my $ret = ($code >> 8);  
 
# return death-from-signal exits as >128. This is what bash does if you ran  
# the program directly.  
if ($code && !$ret) { $ret = $code | 128; }  
 
if ($ret && @log) {  
print "\n" . join("\n", @log) . "\n";  
}  
 
if ($code != 0) {  
print resultline("Program returned non-zero exit code ($ret)", "FAILED");  
}  
 
my $gtotal = $gpasses+$gfails;  
printf("\nWvTest: %d test%s, %d failure%s, total time %s.\n",  
$gtotal, $gtotal==1 ? "" : "s",  
$gfails, $gfails==1 ? "" : "s",  
mstime(time() - $allstart, 2000, 5000));  
print STDERR "\nWvTest result code: $ret\n";  
exit( $ret ? $ret : ($gfails ? 125 : 0) );