$(window).load(function() {
	function initializeMap(){
		$('#searchlocations').hide();
                           loadBullets();
	}
	function loadBullets(){
		$('#map').load('http://www.clearwaterlakes.com/siteplan/', {}, function(){

			//place bullets
			$(this).children('a.bullet').each(function(){
				var coords = $(this).attr('rel').split('-');
				$(this).css({left: coords[0] + 'px', top: coords[1] + 'px'})
					   .hide()
					   .fadeIn()
					   .click(function(){showPopup($(this).attr('id'));});
			});
		});
	}
	
	function showPopup(id){
		$('#map div.popup').fadeOut(); 
		var boxid = '#' + id + '-box';
		$(boxid).fadeIn();
		$('a.close').click(function(){
//			$(this).parent().fadeOut();
                        $(boxid).fadeOut();
		});
	}

	
	//initialize map
$('#sitePlanCaption').append('<p>Click on a highlighted location on the map for more information on swims and amenities.</p>');
	initializeMap();
	

});
