//Yahoo driving directions  1/9/06
//*********************************
  
//function checks to see if there is a blank
//******************************************
function isBlank(theString)
{
	if (theString.length == 0)
	{
		return true;
	}
	if (theString == "")
	{
		return true;
	}
	var i;
	var b=true;
	for(i=0;i<theString.length && b;i++)
	{
		if(theString.charAt(i) != ' ')
			b = false;
	}
	if(i==theString.length)
		return true;
	else
		return false;

} //end of isBlank()
//******************

	function showData() 
	{
		if(isBlank(directionsForm.address.value))
		{  
			//document.write(' ');

			alert ("Please enter your address.");
			directionsForm.address.focus();
			directionsForm.address.select();

		}
		//YAHOO driving directions starts here
		
		else
		{ 
			
			var start = 'http://maps.yahoo.com/dd_result.php?';
			
			var q2 = '&q2=2555+Main+Street%2C+South+Chatham%2C+ma+02659';
			var b = new String(document.directionsForm.address.value);
		
			var bline = '&q1=';
			
			var i;
			for(i=0;i<b.length;i++)
			{

				if(b.charAt(i) == ' ')
				{
					bline = bline + '+';
				}
				else if(b.charAt(i) == ',')
				{
					bline = bline + '%2C';
				}
				else if(b.charAt(i) == '.')
				{
					bline = bline + '.';
				}
				else
				{
					bline = bline + b.charAt(i);	
				}
			 }
		
			//document.write(b);
		
			var c = new String('&q3=&q4=&q5=');
		
			var d = new String(start+bline+q2 + c);
			document.write(' ');
			location.replace(d);
		}
	  }
		//YAHOO driving directions ends
		//*****************************