<!--
 
function cleanText(textObject)
{
   var textValue = textObject.value;
   var ndx;
   var txtlen = textValue.length;

  for (ndx = 0; ndx < txtlen && (textValue.charAt(ndx) == ' ' || textValue.charAt(ndx) == '\r' || textValue.charAt(ndx) == '\n'); ndx++) {}
  textValue = textValue.substr(ndx,txtlen-ndx);

  txtlen = textValue.length;

  for (ndx = txtlen-1; ndx >=0  && (textValue.charAt(ndx) == ' ' || textValue.charAt(ndx) == '\r' || textValue.charAt(ndx) == '\n');ndx--) {}
  textValue = textValue.substr(0,ndx+1);

  textObject.value = textValue;
  
  return textValue;
}

 	
function setFullAddress(queryname)
{
	var frm = document.forms[queryname];
	
  var last_address = frm.address.value;
  var last_city    = frm.city.value;
  var last_state   = frm.state.value;  
  var last_zipcode = frm.zipcode.value;    
  
  frm.saddr.value = [last_address,last_city,last_state,last_zipcode].join(', ');
  return true;
}

		
function DirectionsQuery(d_queryname,d_text) 
{
var hintObj = "";
var closeHint = "";
	
  if (DirectionsQuery.arguments.length > 2)
  {
    hintObj =	DirectionsQuery.arguments[2];
    closeHint = '<tr>' +
                  '<td colspan="3">' + 
                  '  <div align="right"><input type="image" name="closeHint" id="closeHint" src="Scripts/close_hint.gif" title="Click to close" onclick="' + hintObj + '.hide();return false;"/></div>' +
                  '</td>' +
                '</tr>';
  }
  
  
  
	return WrapHint
	       ( 
          '<form action="http://maps.google.com/maps" method="get" target="mapit" name="' + d_queryname + '" onsubmit="setFullAddress(\''+ d_queryname + '\')">' +
          '<table border="0" cellpadding="0" cellspacing="4">' + 
          closeHint +
          '<tr>' +
            '<td colspan="3">' + 
              '<b>Address</b><br>' +
              '<input type="text" name="address" id="address" value="" size="40" title="Type in address" onblur="cleanText(this)"/>' +
            '</td>' +
          '</tr>' +
          '<tr>' +
            '<td>' +
              '<b>City</b><br>' +
              '<input type="text" name="city" id="city" value="" size="40" title="Type in city" onblur="cleanText(this)"/>' +
            '</td>' +
            '<td>' +
              '<b>State</b><br>' +
              '<input type="text" name="state" id="state" value="CA" size="2" maxlength="2" size="2" title="Type in 2 character state abbreviation" onblur="cleanText(this)"/>' +
            '</td>' +
            '<td>' +
              '<b>Zipcode</b><br>' +
              '<input type="text" name="zipcode" id="zipcode" value="" size="10" title="Type in zipcode" onblur="cleanText(this)"/>' +
            '</td>' +
          '</tr>' +
          '<tr>' +
            '<td colspan="3" align="right">' + 
              '<div align="right"><input type="submit" value="Get Driving Directions" style="background-color:#00AA00;font-weight:bold; font-size: 9px"/></div>' +            
            '</td>' +
          '</tr>' +          
          '</table>' +
          '<input type="hidden" name="saddr" id="saddr" value="" />' +
          
          '<input type="hidden" name="daddr" value="' + d_text + '" />' +
          '<input type="hidden" name="hl" value="en" />' +
          '</form>'
         );

}
  
  // -->	  
