$(document).ready(function(){
    if ($('#map').length) {
        load(); /* load Google Maps */
        $('#map span').remove(); /* remove the obscuring copyright data */
        /* open the info box on the map from right hand entry links */
        $('a.popmap').click(function() {
            marker_id = this.id;
            markers[marker_id].openInfoWindow(markers[marker_id].html);
            return false;
          })
    }
    $('#searchbutton').click(function() {
        if ($('#search')[0].value.length) {
            location = '/directory/search/' + $('#search')[0].value + '/';
        }
    });
    // style the search field, put in placeholder text
	var searchLabel = $('#search label').remove().text();
	$('#search-text').addClass('placeholder').val(searchLabel).focus(function() {
		if (this.value ==searchLabel) {
			$(this).removeClass('placeholder').val('');
		};
	}).blur(function() {
		if (this.value == '') {
			$(this).addClass('placeholder').val(searchLabel);
	    };
	});
});