var all_data;
function initialize(){
all_data = new Array();
tmp_a_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://linkdata.org/property/rdf1s598i#address"){
tmp_data["address"] = objValue;
}else if(propValue == "http://www.w3.org/2000/01/rdf-schema#label1"){
tmp_data["label1"] = 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://www.w3.org/2000/01/rdf-schema#label2"){
tmp_data["label2"] = objValue;
}else if(propValue == "http://www.w3.org/2000/01/rdf-schema#label3"){
tmp_data["label3"] = objValue;
}else if(propValue == "http://www.w3.org/2000/01/rdf-schema#label4"){
tmp_data["label4"] = objValue;
}
});
});
tmp_a_data.push(tmp_data);
});
});
});
all_data = tmp_a_data;
var latlng = new google.maps.LatLng(35.0956,132.345613);
var myOptions = {
zoom: 9,
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: '<small>[温泉名]</small>' + all_data[i].label1.fontcolor("blue") +'<br>'+ all_data[i].label2.fontcolor("Skyblue") +'<br>'+ '<small>[泉質]</small>' + all_data[i].label3.fontcolor("green") +'<br>'+ '<small>[効能]</small>' + all_data[i].label4.fontcolor("green")});
};
for (i = 0; i < data.length; i++) {
var marker = new google.maps.Marker({
position: data[i].position,
map: map
});
attachMessage(marker, data[i].content);
};
};
function attachMessage(marker, msg) {
google.maps.event.addListener(marker, 'click', function(event) {
new google.maps.InfoWindow({
content: msg
}).open(marker.getMap(), marker);
});
};
window.onload = function() {
$(function(){
initialize();
});
};