﻿<?xml version="1.0" encoding="UTF-8" ?> 
<Module>
  <ModulePrefs
	directory_title="Google Transit"
    author="Turadg Aleahmad" author_email="turadg@aleahmad.net"
	author_affiliation="HCII, CMU" author_location="Pittsburgh, PA"
    title="Transit in __UP_city__" height="180" width="300" scaling="false"
	title_url="http://www.cs.cmu.edu/~taleahma/projects/transit-gadget/"
	thumbnail="http://www.cs.cmu.edu/~taleahma/projects/transit-gadget/thumbnail.png"
	screenshot="http://www.cs.cmu.edu/~taleahma/projects/transit-gadget/screenshot-v2.png"
	description="Get directions public transit with defaults to save you time"
	author_link="http://aleahmad.net/turadg/">
    <Require feature="analytics"/>
  </ModulePrefs>
  <UserPref name="default_start" display_name="Default Start address" required="false" />
  <UserPref name="default_end" display_name="Default End address" required="false" />
  <UserPref name="city" display_name="City" required="true" datatype="string" />
  <Content type="html">
  <![CDATA[ 
	<style type="text/css">
	/* taken from "/intl/en_us/mapfiles/129e/maps2.transit_homepage.css" */
h2,h3,.tlp-footer{clear:both; font-weight:normal}
.tlp-logo,.tlp-graphic,.tlp-overview,.tlp-icon,.tlp-trip{display:block; float:left}
body{text-align:center; font-size:62.5%; font-family:Arial,sans-serif; margin:0 0 2em 0}
a{color:#0a00c1; font-size:1.17em}
h2{margin:0 0 1.1em 0; font-size:2.1em; color:#006900}
h3{padding:0.6em 0 0 0; margin:0 0 0.2em 0; font-size:1.4em; color:#30842c}
h4{padding-top:1em; margin:0 0 0.8em 0; color:#30842c}
h5{font-size:1em; margin:0 0 0.4em 0; color:#000}
strong{display:block; margin:0.45em 0; color:#000}
input{padding:0 0.3em; width:22em; font-size:1em}
fieldset{border:none; margin:0.9em 0 0 0.6em; padding:0 6px}
select{width:9.2em; font-size:1em}
form{margin:0}
.tlp-input{color:#000}
.tlp-input-empty{color:#999}
.tlp-area{margin-bottom:0}
.tlp-logo{width:150px; height:55px}
.tlp-graphic{width:147px; height:148px}
.tlp-header{border-top:solid 1px #cacaca; height:5.7em; padding:0.6em 0 0 0}
.tlp-overview{margin-left:1.85em; width:251px}
.tlp-overview ul{padding:0 0 0 0; margin:0 0 0 1.5em; line-height:2em}
.tlp-area ul{color:#8c8c8c; padding:0; margin:0 0 1.4em 0; line-height:1.4em; font-size:0.85em; list-style-type:none}
.tlp-no-region-heading{margin-bottom:1.4em}
ul.tlp-no-heading-list{margin-bottom:0}
.tlp-links-footer{font-size:0.8em; margin-top:1.8em; padding-top:0.19em; text-align:center}
.tlp-links-footer a{padding:0 0.4em}
.tlp-footer{margin-top:0.8em; border-top:solid 1px #cacaca; padding-top:0.19em; text-align:center}
.tlp-trip{float:center; width:27em; border:solid 1px #aeaee2; background-color:#cadff4}
.tlp-icon{clear:left; margin:0 0.38em 0 0; width:15px; height:24px}
.tlp-hidden{visibility:hidden}
.tlp-when{margin-left:0.46em; width:5.9em; color:#000}
.tlp-form-row{font-size:0.95em; margin-bottom:0.46em}
.tlp-button-row{margin-top:1em; padding-left:1.3em; padding-bottom:1em}
.tlp-button-row .button {background: url(http://google.com/intl/en_us/mapfiles/dd-button.png) no-repeat; height: 5em;}
.tlp-button-row input {font-size: large;}
.tlp-new-message{margin-top:18px}
.tlp-new-message span{color:red}
.tlp-new-message a{font-size:1em}
.button img,.button input,.button a{position:absolute;width:16.5em;height:2.5em;font-size:1.6em;line-height:2.5em}
.button input,.button a {background:url(button_transparent.gif);position:relative;border:none;display:block;
text-decoration:none; text-align:center;font-weight:bold;cursor:pointer;cursor:hand;color:#fff}
.button input{padding:0 0 0.2em 0}
.button {font-size:0.769em}
	</style>
    <script type="text/javascript">

     // Track this gadget rendering using Google Analytics.
     _IG_Analytics("UA-78454-7", "/transitgadget_render");

     // Get user preferences
     var prefs = new _IG_Prefs(__MODULE_ID__);

     // Pop up a window with directions
     function popupDirections() {
		form = document.forms['transitForm'];
		city = prefs.getString("city");
		
		// qualify the addresses with the city
		form.saddr.value = form.simple_saddr.value + ", " + city;
		form.daddr.value = form.simple_daddr.value + ", " + city;
		
	    return form.submit();
     }
	 
    _IG_RegisterOnloadHandler(function () {
		 // copy default values in from preferences
	    form = document.forms['transitForm'];
		form.simple_saddr.value = prefs.getString("default_start");
		form.simple_daddr.value = prefs.getString("default_end");
    });
	
     </script>	
	 <!-- FIXME include style -->
	 <div class="tlp-trip">
<form action="http://google.com/maps" name="f" id="transitForm" name="transitForm" target="new" method="get" onsubmit="return popupDirections()">
<input type="hidden" value="UTF8" name="ie"/>
<input type="hidden" value="d" name="f"/>
<input type="hidden" value="r" name="dirflg"/>
<input type="hidden" name="saddr" value="error, should be reset"/>
<input type="hidden" name="daddr" value="error, should be reset"/>
<fieldset>
<div class="tlp-form-row">
<img class="tlp-icon" src="http://google.com/intl/en_us/mapfiles/dd-icon-start.gif" alt="Start address"/>
<input type="text" maxlength="2048" class="tlp-input" name="simple_saddr" id="simple_saddr"/>
<br /><font size="-2" color="#555555">e.g. 5000 Forbes Ave</font>
</div>
<div class="tlp-form-row">
<img class="tlp-icon" src="http://google.com/intl/en_us/mapfiles/dd-icon-dest.gif" alt="Destination address"/>
<input type="text" maxlength="2048" class="tlp-input" name="simple_daddr" id="simple_daddr"/>
<br /><font size="-2" color="#555555">e.g. Friendship Ave and Amber St</font>
</div>
<div class="tlp-form-row">
<img class="tlp-icon tlp-hidden"/>
<select name="ttype" id="ttype">
<option value="dep">Leave</option>
<option value="arr">Arrive</option>
</select>
<input type="text" maxlength="100" value="9/25/08" name="date" class="tlp-when" id="fdate"/>
<input type="text" maxlength="100" value="now" name="time" class="tlp-when" id="ftime"/>
</div>
<div class="tlp-button-row">
<div class="button">
<!-- <img width="0" height="0" src="http://google.com/intl/en_us/mapfiles/dd-button.png"/> -->
<input type="submit" value="Get directions"/>
</div>
</div>
</fieldset>
</form>
</div>
	 
  ]]> 
  </Content> 
</Module>
