var contentArray = [];
var iConArray = [];
var markers = [];
var iterator = 0;
var map;
var geocoder;
// infowindow contents �迭
// contentArray[0] = "Kay";
contentArray[0] = "
Label in Korea
";
// marker icon �迭
iConArray[0] = "http://maps.google.com/mapfiles/ms/micons/grn-pushpin.png";
// ���浵 �迭
var markerArray = [new google.maps.LatLng(37.2659140, 127.0016870)];
function initialize() {
geocoder = new google.maps.Geocoder();
var mapOptions = {
zoom: 17,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: new google.maps.LatLng(37.2659140, 127.0016870)
};
map = new google.maps.Map(document.getElementById('map'), mapOptions);
var populationOptions = {
strokeColor: '#000000',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#808080',
fillOpacity: 0.5,
map: map,
center: new google.maps.LatLng(37.2659140, 127.0016870),
radius: $("#radius").val() * 1000
};
//cityCircle = new google.maps.Circle(populationOptions);
}
// �ּҰ˻�
function showAddress() {
var address = $("#address").val();
geocoder.geocode({
'address': address
}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
draggable: true
});
google.maps.event.addListener(marker, "dragend", function(event) {
var point = marker.getPosition();
$("#latitude").val(point.lat());
$("#longitude").val(point.lng());
var populationOptions = {
strokeColor: '#000000',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#808080',
fillOpacity: 0.5,
map: map,
center: new google.maps.LatLng($("#latitude").val(), $("#longitude").val()),
radius: $("#radius").val() * 1000
};
if (cityCircle) {
cityCircle.setMap(null);
}
cityCircle = new google.maps.Circle(populationOptions);
});
var lat = results[0].geometry.location.lat();
var lng = results[0].geometry.location.lng();
$("#latitude").val(lat);
$("#longitude").val(lng);
var populationOptions = {
strokeColor: '#000000',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#808080',
fillOpacity: 0.5,
map: map,
center: new google.maps.LatLng(lat, lng),
radius: $("#radius").val() * 1000
};
if (cityCircle) {
cityCircle.setMap(null);
}
cityCircle = new google.maps.Circle(populationOptions);
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
});
}
// ���Ӹ�Ŀ����
function viewMarker() {
for (var i = 0; i < markerArray.length; i++) {
setTimeout(function() {
addMarker();
}, i * 300);
}
/*var marker = new google.maps.Marker ({
position: new google.maps.LatLng(37.2659140, 127.0016870),
map: map,
draggable: true
});*/
google.maps.event.addListener(marker, "dragend", function(event) {
var point = marker.getPosition();
$("#latitude").val(point.lat());
$("#longitude").val(point.lng());
var populationOptions = {
strokeColor: '#000000',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#808080',
fillOpacity: 0.5,
map: map,
center: new google.maps.LatLng($("#latitude").val(), $("#longitude").val()),
radius: $("#radius").val() * 1000
};
if (cityCircle) {
cityCircle.setMap(null);
}
cityCircle = new google.maps.Circle(populationOptions);
});
}
// ��Ŀ�߰�
function addMarker() {
var marker = new google.maps.Marker({
position: markerArray[iterator],
map: map,
draggable: false,
icon: iConArray[iterator],
animation: google.maps.Animation.DROP
});
markers.push(marker);
var infowindow = new google.maps.InfoWindow({
content: contentArray[iterator]
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map, marker);
});
iterator++;
}
// �߽��̵�
function fnLocation(lat, lng) {
myLocation = new google.maps.LatLng(lat, lng);
map.setCenter(myLocation);
}
//google.maps.event.addDomListener(window, 'load', initialize);
$(window).load(function() {
initialize();
viewMarker();
});