var all_data;
var markFLG = 0;
var currentInfoWindow = null;
var currentMarker = null;
function initialize(){
all_data = new Array();
work_data = new Array();
$.each(LinkData.getWorks(), function(workKey, workValue) {
$.each(LinkData.getFiles(workValue), function(fileKey, fileValue) {
$.each(LinkData.getSubjects(workValue, fileValue), function(subjKey, subjValue) {
var tmp_data = {}
tmp_data["id"] = subjValue;
$.each(LinkData.getProperties(workValue, fileValue), function(propKey, propValue) {
$.each(LinkData.getObjects(workValue, fileValue, subjValue, propValue), function(objKey, objValue) {
if(propValue == "http://purl.org/dc/elements/1.1/description"){
tmp_data["description"] = objValue;
}else if(propValue == "http://www.w3.org/2003/01/geo/wgs84_pos#lat"){
tmp_data["lat"] = objValue;
}else if(propValue == "http://www.w3.org/2003/01/geo/wgs84_pos#long"){
tmp_data["longitude"] = objValue;
}else if(propValue == "http://linkdata.org/property/rdf1s2662i#%E6%B4%8B%E5%BC%8F"){
tmp_data["yousiki"] = objValue;
}else if(propValue == "http://linkdata.org/property/rdf1s2662i#%E3%83%A9%E3%83%B3%E3%82%AF"){
tmp_data["rank"] = objValue;
}else if(propValue == "http://www.w3.org/2000/01/rdf-schema#label"){
tmp_data["label"] = objValue;
}
});
});
work_data.push(tmp_data);
});
});
});
all_data = work_data;
var latlng = new google.maps.LatLng(36.649231, 138.182394);
var myOptions = {
zoom: 15,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("result"), myOptions);
var data = new Array();
for (var i in all_data){
var value = all_data[i].label;
data.push({position: new google.maps.LatLng(all_data[i].lat, all_data[i].longitude), content: '<h4>' + all_data[i].label +'</h4>' + '<br>' + '洋式:' + all_data[i].yousiki + '<br><small>' + '設備:' + all_data[i].description +'</small>',rank:all_data[i].rank});
};
for (i = 0; i < data.length; i++) {
var marker = new google.maps.Marker({
position: data[i].position,
animation: google.maps.Animation.DROP,
icon: "http://chart.apis.google.com/chart?chst=d_map_xpin_icon&chld=pin|glyphish_walk|99FFFF",
map: map
});
attachMessage(marker, data[i].content);
};
};
function attachMessage(marker, msg) {
google.maps.event.addListener(marker, 'click', function(event) {
infowindow = new google.maps.InfoWindow({
content: msg
});