google.load("maps", "3", {other_params:"sensor=false"});

var cache = [];
var $j = jQuery.noConflict();

$j(document).ready(function($)
{
	try
	{
		$j("#nav li").hover(
			function()
			{
				var childUl = $j(this).find("ul");
				childUl[0].show(1);
			},
			function()
			{
				var childUl = $j(this).find("ul");
				childUl[0].hide(1);
			}
		);
	}
	catch(e){}
				$('.cycle-slideshow').cycle({
					fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
				});
});
//DirectoryItem object
function DirectoryItem()
{
	var prevmark = null;
	this.name = '';
	this.address = '';
	this.phone = '';
	this.html = '';
	this.street = '';
	this.city = '';
	this.state = '';
	this.zip = ''
	this.buildMarker = function(map,bounds,geocoder,num)
	{
		var infowindowLevel = 0;
		var name = this.name;
		var phone = this.phone;
		var address = this.address;
		var street = this.street;
		var city = this.city;
		var state = this.state;
		var zip = this.zip;
		geocoder.geocode(
		{'address': this.address},
		function(results, status)
		{
			if (status != google.maps.GeocoderStatus.OK) 
			{
				//alert('Sorry, we were unable to geocode that address.');
			} 
			else 
			{
				point = results[0].geometry.location;
				var image = 'images/map marker/map-marker-' + num + '.png';
				var marker = new google.maps.Marker({
					position: point, 
					map: map,
					icon: image
				});
				bounds.extend(point);
				map.setCenter(bounds.getCenter());
				//map.fitBounds(bounds);
				var contentString = 
					'<div id="mapcontent">' +
					name + '<br />' +
					street + '<br />' +
					city + ', ' +
					state + ' ' +
					zip + '<br />' +
					'P: ' + phone.substr(0,3) + '-' + phone.substr(3,3) + '-' + phone.substr(6,4) +
					'<br>Directions: <b>To here</b><br />Start address:<form action="directions.php" method="post">' + '<input type="text" SIZE=20 name="saddr" id="saddr" value="" /><br>' + '<INPUT value="Get Directions" TYPE="SUBMIT">' + '<input type="hidden" name="daddr" value="' + address + '"/>' +
					'</div>';
				var infowindow = new google.maps.InfoWindow({
					content: contentString
				});
				google.maps.event.addListener(marker, 'click', function() {
					infowindow.setZIndex(++infowindowLevel);
					infowindow.open(map,marker);
				});
			}
		});
	};
}
