var currentwindow=null;
window.onload = function() {
var fileValue = 'suzakacity_contact_app ';
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/rdf1s4732i#Department_name"){
tmp_data["name"] = objValue;
} else if(propValue == "http://linkdata.org/property/rdf1s4732i#telephone_number"){
tmp_data["tel"] = objValue;
} else if(propValue == "http://linkdata.org/property/rdf1s4732i#email_address"){
tmp_data["mail"] = objValue;
} else if(propValue == "http://linkdata.org/property/rdf1s4732i#furigana"){
tmp_data["kana"] = objValue;
}
});
});
tmp_a_data.push(tmp_data);
});
});
});
all_data = tmp_a_data;
$(".selectka").append("<option value='-1' selected='selected'>部署を選択してください。</option>");
for (var i in all_data){
if (all_data[i].name ){
var all_id=all_data[i].name;
$(".selectka").append("<option value='"+ all_data[i].id +"'>" + all_data[i].name+ "</option>");
}
}
$(".selectka").change(function() {
$("#result").empty();
var sectionKaKey = $("option:selected", $(this)).val();
if (sectionKaKey == -1) {
return;
}
$("#result").append("<div style='padding-left:10px;'>【連絡先】</div>");
for (var i in all_data){
var detail_c = sectionKaKey;
if (all_data[i].id === detail_c){
$("#result").append("<div style='padding-left:10px;'>"+all_data[i].kana+ "<br/>"+"TEL:" + "<a href=tel:" + all_data[i].tel + ">" + all_data[i].tel + "</a>"+ "</div>");
$("#result").append("<div style='padding-left:10px;'>Mail:" + "<a href=mailto:" + all_data[i].mail + ">" + all_data[i].mail + "</a></div>");
}
}
});
}