// JavaScript Document

var selectedMenu = null;

$(document).ready(function() {

/*
	$("#nav img").hover(function() {
		if ($(this).attr("src").indexOf("Selected") < 0) {
    	$(this).attr("src", $(this).attr("src").split("images/").join("images/HL/"));
		}
  }, function() {
		if ($(this).attr("src").indexOf("Selected") < 0) {
	    $(this).attr("src", $(this).attr("src").split("images/HL/").join("images/"));
		}
  });
	
	$("#subnav img").hover(function() {
		if ($(this).attr("src").indexOf("Selected") < 0) {
    	$(this).attr("src", $(this).attr("src").split("images/").join("images/HL/"));
		}
  }, function() {
		if ($(this).attr("src").indexOf("Selected") < 0) {
	    $(this).attr("src", $(this).attr("src").split("images/HL/").join("images/"));
		}
  });
*/
	
	$(window).load(function () {
			
		var coordinates = new google.maps.LatLng(48.504822, -122.252419);
		
		var mapOptions = {
			zoom: 12,
			center:coordinates,
			mapTypeId: google.maps.MapTypeId.ROADMAP
		};
		
		var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);

		var contentString = '<div id="map_window"><h2>Atkinson Family Dentistry</h2>'+
    '<p>727 Trail Road<br />'+
		'Sedro-Woolley, WA 98284<br />(360) 856-4540</p></div>';

		var infowindow = new google.maps.InfoWindow({
				content: contentString,
				maxWidth:150
		});


		var marker = new google.maps.Marker({
			position: coordinates,
			map: map,
			title:"Atkinson Family Dentistry (727 Trail Road, Sedro-Woolley, WA 98284)"
		});
		
		google.maps.event.addListener(marker, 'click', function() {
  		infowindow.open(map,marker);
		});
		
		infowindow.open(map,marker);

	});
				

	$("#homeleft li").hover(function() {
		if ($(this).attr("class").indexOf("selected") < 0) {
    	$(this).css("background", "url(images/menuHLBG.jpg) repeat-x left top");
		}
  }, function() {
		if ($(this).attr("class").indexOf("selected") < 0) {
    	$(this).css("background", "url(images/menuBG.jpg) repeat-x left top");
		}
  });
	
	$("#homeleft li").click(function() {
		if ($(this).attr("class").indexOf("selected") < 0) {
			window.document.location.href = $(this).attr("link");
		}
	});

	
	$("#menu h1").click(function() {

		currentMenu = $(this).next();

		if (selectedMenu != currentMenu) {
	
			if (selectedMenu != null) {
				selectedMenu.toggle('blind','slow');
			}
			
			currentMenu.toggle('blind','slow');
			
			selectedMenu = currentMenu;
		}
		return false;
	});
	
	Initialize();
});


