var conf_enable_save_googleplace=false;
var youarehere_icon='https://topo.directory/eorder/imaps/icons/letter_a.png';
var watchID;
var yah_counter=0;
var old_bounds;
var info_window = [];
var html_iw = [];
var markers = [];
var lat_lng = [];
var markers_google = [];
var infowindow_g = [];
var poi_type_nr=39;
var poi_types_icon = [];
poi_types_icon["Administration"]='https://topo.directory/eorder/imaps/icons/workoffice.png';;
poi_types_icon["Ancient Site"]='https://topo.directory/eorder/imaps/icons/ancientsite.png';
poi_types_icon["Appartments"]='https://topo.directory/eorder/imaps/icons/hotel.png';
poi_types_icon["Bar"]='https://topo.directory/eorder/imaps/icons/bar.png';
poi_types_icon["Beach"]='https://topo.directory/eorder/imaps/icons/beach.png';
poi_types_icon["Cafe"]='https://topo.directory/eorder/imaps/icons/cafe.png';
poi_types_icon["Church"]='https://topo.directory/eorder/imaps/icons/church.png';
poi_types_icon["Culture"]='https://topo.directory/eorder/imaps/icons/theater.png';;
poi_types_icon["Education"]='https://topo.directory/eorder/imaps/icons/university.png';
poi_types_icon["Forest"]='https://topo.directory/eorder/imaps/icons/forest2.png';
poi_types_icon["Forts"]='https://topo.directory/eorder/imaps/icons/citywalls.png';;
poi_types_icon["Gas Station"]='https://topo.directory/eorder/imaps/icons/gasstation.png';
poi_types_icon["Gorge"]='https://topo.directory/eorder/imaps/icons/climbing.png';;
poi_types_icon["Hospital"]='https://topo.directory/eorder/imaps/icons/firstaid.png';
poi_types_icon["Hotel"]='https://topo.directory/eorder/imaps/icons/hotel.png';
poi_types_icon["Island"]='https://topo.directory/eorder/imaps/icons/ferry.png';;
poi_types_icon["Lake"]='https://topo.directory/eorder/imaps/icons/lake.png';
poi_types_icon["Lighthouses"]='https://topo.directory/eorder/imaps/icons/sunny.png';;
poi_types_icon["Monastery"]='https://topo.directory/eorder/imaps/icons/church.png';
poi_types_icon["Mounts"]='https://topo.directory/eorder/imaps/icons/mountains.png';;
poi_types_icon["Museum"]='https://topo.directory/eorder/imaps/icons/museum_archeological.png';
poi_types_icon["Parking"]='https://topo.directory/eorder/imaps/icons/parking.png';
poi_types_icon["Peaks"]='https://topo.directory/eorder/imaps/icons/flag-export.png';;
poi_types_icon["Pharmacy"]='https://topo.directory/eorder/imaps/icons/pharmacy.png';
poi_types_icon["Plains & Plateaus"]='https://topo.directory/eorder/imaps/icons/flowers.png';;
poi_types_icon["Restaurant"]='https://topo.directory/eorder/imaps/icons/restaurant.png';
poi_types_icon["Shop"]='https://topo.directory/eorder/imaps/icons/shop.png';
poi_types_icon["Site"]='https://topo.directory/eorder/imaps/icons/photo.png';
poi_types_icon["Sports"]='https://topo.directory/eorder/imaps/icons/sport.png';
poi_types_icon["Town-Village"]='https://topo.directory/eorder/imaps/icons/village.png';
poi_types_icon["Traffic Camera"]='https://topo.directory/eorder/imaps/icons/cctv.png';
poi_types_icon["Transportation"]='https://topo.directory/eorder/imaps/icons/bicycle_shop.png';
poi_types_icon["Statue"]='https://topo.directory/eorder/imaps/icons/statue-2.png';
poi_types_icon["Park"]='https://topo.directory/eorder/imaps/icons/forest2.png';
poi_types_icon["Bus Stop"]='https://topo.directory/eorder/imaps/icons/busstop.png';
poi_types_icon["Cave"]='https://topo.directory/eorder/imaps/icons/cave.png';
poi_types_icon["City"]='https://topo.directory/eorder/imaps/icons/city.png';
poi_types_icon["Playground"]='https://topo.directory/eorder/imaps/icons/playground.png';
poi_types_icon["Law"]='https://topo.directory/eorder/imaps/icons/court.png';
var poi_types_en = [];
var poi_types_el = [];
var poi_types_var = [];
poi_types_en[1]="Administration";poi_types_el[1]="Διοίκηση";poi_types_var[1]="Administration";
poi_types_en[2]="Ancient Site";poi_types_el[2]="Αρχαιολογικός Χώρος";poi_types_var[2]="AncientSite";
poi_types_en[3]="Appartments";poi_types_el[3]="Διαμερίσματα";poi_types_var[3]="Appartment";
poi_types_en[4]="Bars";poi_types_el[4]="Bars";poi_types_var[4]="Bar";
poi_types_en[5]="Beaches";poi_types_el[5]="Παραλίες";poi_types_var[5]="Beach";
poi_types_en[6]="Cafes";poi_types_el[6]="Καφετέριες";poi_types_var[6]="Cafe";
poi_types_en[7]="Churches";poi_types_el[7]="Εκκλησίες";poi_types_var[7]="Church";
poi_types_en[8]="Culture";poi_types_el[8]="Πολιτισμός";poi_types_var[8]="Culture";
poi_types_en[9]="Education";poi_types_el[9]="Εκπαίδευση";poi_types_var[9]="Education";
poi_types_en[10]="Forests";poi_types_el[10]="Δάση";poi_types_var[10]="Forest";
poi_types_en[11]="Forts";poi_types_el[11]="Φρούρια";poi_types_var[11]="Forts";
poi_types_en[12]="Gas Station";poi_types_el[12]="Βενζινάδικα";poi_types_var[12]="Gas";
poi_types_en[13]="Gorges";poi_types_el[13]="Φαράγγια";poi_types_var[13]="Gorge";
poi_types_en[14]="Hospital";poi_types_el[14]="Νοσοκομεία";poi_types_var[14]="Hospital";
poi_types_en[15]="Hotels";poi_types_el[15]="Ξενοδοχεία";poi_types_var[15]="Hotel";
poi_types_en[16]="Island";poi_types_el[16]="Νησιά";poi_types_var[16]="Island";
poi_types_en[17]="Lake";poi_types_el[17]="Λίμνες";poi_types_var[17]="Lake";
poi_types_en[18]="Lighthouses";poi_types_el[18]="Φάροι";poi_types_var[18]="Lighthouses";
poi_types_en[19]="Monastery";poi_types_el[19]="Μοναστήρια";poi_types_var[19]="Monastery";
poi_types_en[20]="Mounts";poi_types_el[20]="Βουνά";poi_types_var[20]="Mounts";
poi_types_en[21]="Museums";poi_types_el[21]="Μουσεία";poi_types_var[21]="Museum";
poi_types_en[22]="Parking";poi_types_el[22]="Παρκινγ";poi_types_var[22]="Parking";
poi_types_en[23]="Peaks";poi_types_el[23]="Peaks";poi_types_var[23]="Peaks";
poi_types_en[24]="Pharmacy";poi_types_el[24]="Pharmacy";poi_types_var[24]="Pharmacy";
poi_types_en[25]="Plains & Plateaus";poi_types_el[25]="Πεδιάδες-Οροπέδια";poi_types_var[25]="PlainsPlateaus";
poi_types_en[26]="Restaurants";poi_types_el[26]="Εστιατόρια";poi_types_var[26]="Restaurant";
poi_types_en[27]="Shops";poi_types_el[27]="Καταστήματα";poi_types_var[27]="Shop";
poi_types_en[28]="Site";poi_types_el[28]="Τόπος";poi_types_var[28]="Site";
poi_types_en[29]="Sports";poi_types_el[29]="Αθλητικά";poi_types_var[29]="Sports";
poi_types_en[30]="Town-Village";poi_types_el[30]="Πόλεις-Χωριά";poi_types_var[30]="TownVillage";
poi_types_en[31]="Traffic Camera";poi_types_el[31]="Κάμερες Τροχαίας";poi_types_var[31]="TrafficCamera";
poi_types_en[32]="Transportation";poi_types_el[32]="Μεταφορές";poi_types_var[32]="Transportation";
poi_types_en[33]="Statue";poi_types_el[33]="Άγαλμα";poi_types_var[33]="Statue";
poi_types_en[34]="Park";poi_types_el[34]="Πάρκο";poi_types_var[34]="Park";
poi_types_en[35]="Bus Stop";poi_types_el[35]="Στάση Λεωφορείου";poi_types_var[35]="Busstop";
poi_types_en[36]="Cave";poi_types_el[36]="Σπήλαιο";poi_types_var[36]="Cave";
poi_types_en[37]="City";poi_types_el[37]="Πόλη";poi_types_var[37]="City";
poi_types_en[38]="Playground";poi_types_el[38]="Παιδική Χαρά";poi_types_var[38]="Playground";
poi_types_en[39]="Law";poi_types_el[39]="Νομικά";poi_types_var[39]="Law";
var poi_types_db = [];
poi_types_db[1]="Administration";
poi_types_db[2]="Ancient Site";
poi_types_db[3]="Appartments";
poi_types_db[4]="Bar";
poi_types_db[5]="Beach";
poi_types_db[6]="Cafe";
poi_types_db[7]="Church";
poi_types_db[8]="Culture";
poi_types_db[9]="Education";
poi_types_db[10]="Forest";
poi_types_db[11]="Forts";
poi_types_db[12]="Gas Station";
poi_types_db[13]="Gorge";
poi_types_db[14]="Hospital";
poi_types_db[15]="Hotel";
poi_types_db[16]="Island";
poi_types_db[17]="Lake";
poi_types_db[18]="Lighthouses";
poi_types_db[19]="Monastery";
poi_types_db[20]="Mounts";
poi_types_db[21]="Museum";
poi_types_db[22]="Parking";
poi_types_db[23]="Peaks";
poi_types_db[24]="Pharmacy";
poi_types_db[25]="Plains & Plateaus";
poi_types_db[26]="Restaurant";
poi_types_db[27]="Shop";
poi_types_db[28]="Site";
poi_types_db[29]="Sports";
poi_types_db[30]="Town-Village";
poi_types_db[31]="Traffic Camera";
poi_types_db[32]="Transportation";
poi_types_db[33]="Statue";
poi_types_db[34]="Park";
poi_types_db[35]="Bus Stop";
poi_types_db[36]="Cave";
poi_types_db[37]="City";
poi_types_db[38]="Playground";
poi_types_db[39]="Law";
var poi_types_db_el = [];
poi_types_db_el[1]="Διοίκηση";
poi_types_db_el[2]="Αρχαιολογικός Χώρος";
poi_types_db_el[3]="Διαμερίσματα";
poi_types_db_el[4]="Bar";
poi_types_db_el[5]="Παραλία";
poi_types_db_el[6]="Καφετέρια";
poi_types_db_el[7]="Εκκλησία";
poi_types_db_el[8]="Πολιτισμός";
poi_types_db_el[9]="Εκπαίδευση";
poi_types_db_el[10]="Δάσος";
poi_types_db_el[11]="Κάστρο";
poi_types_db_el[12]="Βενζινάδικο";
poi_types_db_el[13]="Φαράγγι";
poi_types_db_el[14]="Νοσοκομείο";
poi_types_db_el[15]="Ξενοδοχείο";
poi_types_db_el[16]="Νησί";
poi_types_db_el[17]="Λίμνη";
poi_types_db_el[18]="Φάρος";
poi_types_db_el[19]="Μοναστήρι";
poi_types_db_el[20]="Οροσειρά";
poi_types_db_el[21]="Μουσείο";
poi_types_db_el[22]="Χώρος Στάθμευσης";
poi_types_db_el[23]="Κορυφή";
poi_types_db_el[24]="Φαρμακείο";
poi_types_db_el[25]="Πεδιάδα-Οροπέδιο";
poi_types_db_el[26]="Εστιατόριο";
poi_types_db_el[27]="Κατάστημα";
poi_types_db_el[28]="Τόπος";
poi_types_db_el[29]="Αθλητικά";
poi_types_db_el[30]="Πόλη-Χωριό";
poi_types_db_el[31]="Κάμερα Τροχαίας";
poi_types_db_el[32]="Μεταφορές";
poi_types_db_el[33]="Άγαλμα";
poi_types_db_el[34]="Πάρκο";
poi_types_db_el[35]="Στάση Λεωφορείου";
poi_types_db_el[36]="Σπήλαιο";
poi_types_db_el[37]="Πόλη";
poi_types_db_el[38]="Παιδική Χαρά";
poi_types_db_el[39]="Νομικά";
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
function errorHandler(err) {
if(err.code == 1) {
//alert("Error: Access is denied!");
}else if( err.code == 2) {
// alert("Error: Position is unavailable!");
}
}
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
function toggle_selector()
{ //alert ("called");
if (document.getElementById("selected").style.display=='none')
document.getElementById("selected").style.display="inline-block";
else document.getElementById("selected").style.display="none";
if (document.getElementById("unselected").style.display=='none')
document.getElementById("unselected").style.display="inline-block";
else document.getElementById("unselected").style.display="none"
}
////////////////////////////////////////
/////////////////////////////////////////////
//////////////////////////////////////////////
function poi_type_selected(map,poi_type)
{
// console.log(poi_type);
// alert(document.getElementById("div_"+poi_type).className);
if (document.getElementById("div_"+poi_type).className=="poi_menu round shadow")
{// JUST SELECTED
document.getElementById("div_"+poi_type).className="poi_menu_selected round shadow";
//alert (document.getElementById(poi_type).checked);
document.getElementById(poi_type).checked=true;
//alert (document.getElementById(poi_type).checked);
}
else
{// JUST UNSELECTED
document.getElementById("div_"+poi_type).className="poi_menu round shadow";
// alert (document.getElementById(poi_type).checked);
document.getElementById(poi_type).checked=false;
//alert (document.getElementById(poi_type).checked);
}
update_markers(map);
}
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function insert_single_marker(map,x,y,icon,areaid,name,name_el)
{//console.log('insert_single_marker x='+x+' y='+y);
latlng = new google.maps.LatLng(y, x);
if (enable_edit)
{
html_iw[areaid] ="
";
}
else
{
html_iw[areaid] ="
";
info_window[areaid] = new google.maps.InfoWindow({
content: html_iw[areaid],
maxWidth: 400
});
markers[areaid] = new google.maps.Marker({
icon:icon,
draggable: enable_edit,
position: latlng,
map: map1,
title: name
});
google.maps.event.addListener(markers[areaid], "click", function() { info_window[areaid].open(map, markers[areaid]);});
google.maps.event.addListener(markers[areaid], "dragstart", function() {info_window[areaid].close(); });
google.maps.event.addListener(markers[areaid], "dragend", function() {
info_window[areaid] = new google.maps.InfoWindow({content: html_iw[areaid] + markers[areaid].getPosition().lat().toFixed(6) + ' , ' + markers[areaid].getPosition().lng().toFixed(6)});
map.setCenter(markers[areaid].getPosition());
info_window[areaid].open(map, markers[areaid]);
});
google.maps.event.addListener(markers[areaid], "dblclick", function() { map.setZoom(14); });
}
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function savegoogleData(placeid)
{ console.log('savegoogleData function starts with placeid='+placeid);
var formid='form_'+placeid;
var name = document.getElementById(formid).name.value;
var name_el = document.getElementById(formid).name_el.value;
var address = document.getElementById(formid).address.value;
var author_email = document.getElementById(formid).author_email.value;
var type = document.getElementById(formid).type.value;
var nomosid = document.getElementById(formid).nomosid.value;
var g_o_placeid = document.getElementById(formid).g_o_placeid.value;
var latlng1;
var lat1;
var lng1;
lat1=markers_google[placeid].getPosition().lat();
lng1=markers_google[placeid].getPosition().lng();
var url = "https://topo.directory/eorder/imaps/phpsqlinfo_addrow.php";
$.post(url,
{
name:name,
name_el:name_el,
address:address,
author_email:author_email,
nomosid:nomosid,
type:type,
g_o_placeid:g_o_placeid,
lat:lat1,
lng:lng1
},
function(data, status){
if (status=="success")
{
infowindow_g[placeid].close();
infowindow_g[placeid] = null;
markers_google[placeid].setMap(null);
markers_google[placeid] = null;
//update_markers(map1);
}
});
} //function
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function save_googleplace(location)
{ //alert('savegoogleData');
var grgc_nomos;
var g_nomos;
var g_o_placeid;
var name ;
var name_el ;
var address;
var lat1;
var lng1;
var nomosid;
var author_email;
var type;
var geocoder = new google.maps.Geocoder;
geocoder.geocode({'location': location}, function(results, status) {
if (status === google.maps.GeocoderStatus.OK)
{
if (results[1]) {
g_o_placeid=results[1].place_id;// alert(current_place_id);
// address =results[1].formatted_address;
g_nomos =results[1].address_components[2].long_name ;
for (var ac = 0; ac < results[1].address_components.length; ac++)
{
if (results[1].address_components[ac].types.toString()=='locality,political')
{
name=results[1].address_components[ac].short_name;
name_el=name;
}
if (results[1].address_components[ac].types.toString()=='administrative_area_level_5,political')
{
address=results[1].address_components[ac].short_name;
}
if (results[1].address_components[ac].types.toString()=='administrative_area_level_3,political')
{
grgc_nomos=results[1].address_components[ac].long_name;
nomosid=nomos_lookup(grgc_nomos);
}
}
if (name)
{
lat1=results[1].geometry.location.lat();
lng1=results[1].geometry.location.lng();
author_email = "auto@gp.lace";
type ="Town-Village";
//alert ("insert."+"name"+name+"name_el:"+name_el+"nomos:"+nomosid+ "placeid:"+g_o_placeid+"address:"+address+"lat:"+lat1+"lng:"+lng1);
var url = "https://topo.directory/eorder/imaps/phpsqlinfo_addrow.php";
$.post(url,
{
name:name,
name_el:name_el,
address:address,
author_email:author_email,
nomosid:nomosid,
type:type,
g_o_placeid:g_o_placeid,
lat:lat1,
lng:lng1
},
function(data, status)
{
if (status=="success")
{
// alert ("inserted new village:"+name);
}
});
} // if name
}//if result
} //if status
}); //geocode call
} //function
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
function savenewData()
{
var url = "https://topo.directory/eorder/imaps/phpsqlinfo_addrow.php";
var formid='iwf_00';
var name = document.getElementById(formid).name.value;
var name_el = document.getElementById(formid).name_el.value;
var address = document.getElementById(formid).address.value;
var type = document.getElementById(formid).type.value;
var nomosid = document.getElementById(formid).nomosid.value;
var latlng1;
var lat1;
var lng1;
lat1=new_marker.getPosition().lat();
lng1=new_marker.getPosition().lng();
$.get(url,
{
name:name,
name_el:name_el,
address:address,
nomosid:nomosid,
type:type,
lat:lat1,
lng:lng1
},
function(data, status)
{ //alert (status);
if (status=="success")
{
if (data=='ok')
{
new_infowindow.close();
new_infowindow = null;
new_marker.setMap(null);
new_marker = null;
update_markers(map1);
}//data=ok
else
{
document.getElementById('new_div').innerHTML =data;
}
}
});
} //function
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
function saveData(area_id)
{ //alert ('save data');
var url = "https://topo.directory/eorder/imaps/phpsqlinfo_addrow.php";
var formid;
if (area_id>0) formid='iwf_'+area_id; else formid='iwf_00';
var name = document.getElementById(formid).name.value;
var name_el = document.getElementById(formid).name_el.value;
//var address = document.getElementById(formid).address.value;
var author_email = document.getElementById(formid).author_email.value;
//type = document.getElementById(formid).type.value;
//var nomosid = document.getElementById(formid).nomosid.value;
var latlng1;
var lat1;
var lng1;
if (area_id>0)
{
lat1=markers[area_id].getPosition().lat();
lng1=markers[area_id].getPosition().lng();
}
else
{
lat1=marker.getPosition().lat();
lng1=marker.getPosition().lng();
}
$.post(url,
{
name:name,
name_el:name_el,
author_email:author_email,
area_id:area_id,
lat:lat1,
lng:lng1
},
function(data, status)
{ //alert (status);
if (status=="success")
{
if (area_id>0) info_window[area_id].close(); else infowindow.close();
document.getElementById("message").innerHTML = "Congratulations!!!. Location added. We will contact you for additional information before we add the new spot to our system!";
}
});
}
////////////////////////////////////////////////////
////////////////////////
/////////////////////////////////
////////////////////////
////////////////////////////////////////////////////
////////////////////////
/////////////////////////////////
////////////////////////
function create_map(div_containing_map,cx,cy,zoom)
{ // alert('create');
//Create a div containing the map
mapcanvas = document.createElement('div');
mapcanvas.id = div_containing_map+'_mapcontainer';
mapcanvas.style.height = '100%';
mapcanvas.style.width = '100%';
mapcanvas.innerHTML='Loading Map...';
document.getElementById(div_containing_map).appendChild(mapcanvas);
//Create the map
var coords = new google.maps.LatLng(cx,cy);
var options ={
zoom: zoom,
center: coords, //center of map is the You are here point
scrollwheel: false,
panControl: true,
zoomControl: true,
mapTypeControl: true,
//mapTypeControl: false,
scaleControl: true,
streetViewControl: true,
overviewMapControl: true,
//mapTypeId: google.maps.MapTypeId.SATELLITE,
mapTypeId: google.maps.MapTypeId.ROADMAP,
styles: [ {
featureType:'water', elementType:'geometry',
stylers:[ {hue:'#0066cc'}, {saturation:50}, {lightness:-49}, {visibility:'on'} ] },{
featureType:'landscape', elementType:'geometry',
stylers:[ {hue:'ffe680'}, {saturation:-14}, {lightness:-18}, {visibility:'on'} ] },{
featureType:'landscape.man_made', elementType:'all',
stylers:[ {hue:'#0099ff'}, {saturation:10}, {lightness:-23}, {visibility:'on'} ] },{
featureType:'road', elementType:'geometry',
stylers:[ {hue:'#8d9b83'}, {saturation:-89}, {lightness:-12}, {visibility:'on'} ] },{
featureType:'road.highway', elementType:'geometry',
stylers:[ {hue:'#b2b200'}, {saturation:50}, {lightness:-30}, {visibility:'on'} ] },{
featureType:'road.arterial', elementType:'geometry',
stylers:[ {hue:'#bdc5b6'}, {saturation:-89}, {lightness:-3}, {visibility:'simplified'} ] },{
featureType:'road.local', elementType:'geometry',
stylers:[ {hue:'#bdc5b6'}, {saturation:-89}, {lightness:-26}, {visibility:'on'} ] },
{
featureType:'poi', elementType:'all',
stylers:[ {hue:'#c17118'}, {saturation:61}, {lightness:-45}, {visibility:'off'} ]
},
{featureType:'poi.business', elementType:'all',
stylers:[ {hue:'#c17118'}, {saturation:61}, {lightness:-45}, {visibility:'off'} ]
},
{featureType:'poi.park', elementType:'all',
stylers:[ {hue:'#8ba975'}, {saturation:-46}, {lightness:-28}, {visibility:'on'} ] },{
featureType:'transit', elementType:'geometry',
stylers:[ {hue:'#a43218'}, {saturation:74}, {lightness:-51}, {visibility:'simplified'} ] },{
featureType:'administrative.province', elementType:'all',
stylers:[ {hue:'#fff'}, {saturation:0}, {lightness:50}, {visibility:'simplified'} ] },{
featureType:'administrative.neighborhood', elementType:'all',
stylers:[ {hue:'#fff'}, {visibility:'on'} ] },{
featureType:'administrative.locality', elementType:'labels',
stylers:[ {hue:'#fff'}, {visibility:'on'} ] },{
featureType:'administrative.land_parcel', elementType:'all',
stylers:[ {hue:'#fff'}, {visibility:'on'} ] },{
featureType:'administrative', elementType:'all',
stylers:[ {hue:'#3a3935'}, {saturation:5}, {lightness:0}, {visibility:'on'} ] },{
featureType:'poi.medical', elementType:'geometry',
stylers:[ {hue:'#cba923'}, {saturation:50}, {lightness:-46}, {visibility:'on'} ] }] ,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.SMALL
},
};
map1 = new google.maps.Map(document.getElementById(div_containing_map+"_mapcontainer"), options);
// var E4_Lassithi = new google.maps.KmlLayer({
// url: 'http://www.last.gr/eorder/var/kml/E4_lassithi.kml'
// });
// E4_Lassithi.setMap(map1);
google.maps.event.addListener(map1, 'idle', function()
{
update_markers(map1);
//save the new bounds for the next call
old_bounds= map1.getBounds();
});
/// INSERT A NEW SPOT
google.maps.event.addListener(map1, "click", function(event)
{
var new_html = "
Add a new Point of Interest ";
new_infowindow = new google.maps.InfoWindow({
content: new_html
});
new_marker = new google.maps.Marker
({
position: event.latLng,
icon:'https://topo.directory/eorder/imaps/icons/marker_add.png',
draggable:true,
map: map1
});
google.maps.event.addListener(new_marker, "click", function() {
new_infowindow.open(map1, new_marker);
var grgc_nomos;
var geocoder = new google.maps.Geocoder;
var latlng = {lat: new_marker.getPosition().lat(), lng: new_marker.getPosition().lng()};
var current_place_id;
geocoder.geocode({'location': latlng}, function(results, status)
{
if (status === google.maps.GeocoderStatus.OK)
{
if (results[1])
{
current_place_id=results[1].place_id;// alert(current_place_id);
document.getElementById('iwf_00').g_placeid.value =current_place_id;
document.getElementById('iwf_00').address.value =results[1].formatted_address;
document.getElementById('iwf_00').g_nomos.value =results[1].address_components[2].long_name ;
for (var ac = 0; ac < results[1].address_components.length; ac++)
{
if (results[1].address_components[ac].types.toString()=='administrative_area_level_3,political')
{
grgc_nomos=results[1].address_components[ac].long_name;
document.getElementById('iwf_00').g_nomos.value =grgc_nomos
}
}
// grgc_nomos=document.getElementById('iwf_00').g_nomos.value;
detect_nomos(grgc_nomos);
//g_request_details (current_place_id);
}//if result
} //if status
}); //geocode call
});
});
}
/////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
function nomos_lookup(value)
{
switch (value)
{
case 'Αιτωλοακαρνανία':
case 'Αιτωλοακαρνανίας': return '100';break;
case 'Αργολίδα':
case 'Αργολίδας': return '101';break;
case 'Αρκαδία':
case 'Αρκαδίας': return '102';break;
case 'Άρτας':
case 'Άρτα':
case 'Άρτης': return '103';break;
case 'Anatoliki Attiki':
case 'Anatolikis Attikis':
case 'Ανατολική Αττική':
case 'Ανατολικής Αττικής':
case 'Κεντρικής Αττικής':
case 'Κεντρική Αττική':
case 'Ditiki Attiki':
case 'Ditikis Attikis':
case 'Δυτικής Αττικής':
case 'Δυτική Αττική':
case 'Αττικής':
return '104';break;
case 'Αχαΐα':
case 'Αχαΐας':
case 'Αχαϊας':
case 'Αχαϊα': return '105';break;
case 'Boeotia':
case 'Viotia':
case 'Viotia':
case 'Biotea':
case 'Viotea':
case 'Βοιωτία':
case 'Βοιωτίας': return '106';break;
case 'Γρεβενά':
case 'Γρεβενών': return '107';break;
case 'Δράμα':
case 'Δράμας': return '108';break;
case 'Kos':
case 'Κως':
case 'Rodos':
case 'Rhodes':
case 'Ρόδος':
case 'Karpathos':
case 'Κάρπαθος':
case 'Kasos ':
case 'Κάσος':
case 'Κάσσος':
case 'Patmos':
case 'Πάτμος':
case 'Kalimnos':
case 'Kalymnos':
case 'Κάλυμνος':
case 'Dodecanese':
case 'Δωδεκανήσου':
return '109';break;
case 'Έβρου': return '110';break;
case 'Euboea':
case 'Evia':
case 'Εύβοια':
case 'Εύβοιας': return '111';break;
case 'Evrytania':
case 'Evritania':
case 'Evritania':
case 'Ευρυτανία':
case 'Ευρυτανίας': return '112';break;
case 'Ζάκυνθος':
case 'Ζακύνθου': return '113';break;
case 'Ηλεία':
case 'Ηλείας': return '114';break;
case 'Ημαθεία':
case 'Ημαθείας': return '115';break;
case 'Heraklion':
case 'Heraklio':
case 'Herakleon':
case 'Herakleo':
case 'Iraklion':
case 'Iraklio':
case 'Iraklio':
case 'Eraklion':
case 'Ηρακλείου':
case 'Ηράκλειο': return '116';break;
case 'Θεσπρωτία':
case 'Θεσπρωτίας': return'117';break;
case 'Θεσαλονίκη':
case 'Θεσαλονίκης': return '118';break;
case 'Ιωάννινα':
case 'Ιωαννίνων': return '119';break;
case 'Καβάλα':
case 'Καβάλας':return '120';break;
case 'Karditsa':
case 'Karditsas':
case 'Karditsis':
case 'Καρδίτσα':
case 'Καρδίτσης':
case 'Καρδίτσας': return '121';break;
case 'Καστοριά':
case 'Καστοριάς': return '122';break;
case 'Κέρκυρα':
case 'Κέρκυρας': return '123';break;
case 'Κεφαλληνία':
case 'Κεφαλλονιά':
case 'Κεφαλλονιάς':
case 'Κεφαλληνίας': return '124';break;
case 'Kilkis':
case 'Κιλκίς': return '125';break;
case 'Κοζάνη':
case 'Κοζάνης': return '126';break;
case 'Κορινθία':
case 'Κορινθίας':
case 'Κόρινθος':
case 'Κορίνθου': return '127';break;
case 'Άνδρος':
case 'Naxos':
case 'Νάξος':
case 'Πάρος':
case 'Σύρος':
case 'Τήνος':
case 'Μύκονος':
case 'Κέα':
case 'Σίφνος':
case 'Σαντορίνη':
case 'Θύρα':
case 'Μήλος':
case 'Κυκλάδων': return '128';break;
case 'Λακωνία':
case 'Λακωνίας': return '129';break;
case 'Larissa':
case 'Larissas':
case 'Larissis':
case 'Λαρίσσης':
case 'Λάρισσα':
case 'Λάρισα':
case 'Λάρισσας': return '130';break;
case 'Lasithiou':
case 'Lassithiou':
case 'Lasithi':
case 'Lassithi':
case 'Λασιθίου':
case 'Λασίθι': return'131';break;
case 'Lesvos':
case 'Lesbos Prefecture':
case 'Λέσβου':
case 'Λέσβος': return '132';break;
case 'Λευκάδα':
case 'Λευκάδας': return '133';break;
case 'Μαγνησία':
case 'Σποράδες':
case 'Μαγνησίας': return '134';break;
case 'Μεσσηνία':
case 'Μεσσηνίας': return '135';break;
case 'Ξάνθη':
case 'Ξάνθης': return '136';break;
case 'Πέλλα':
case 'Πέλλας': return '137';break;
case 'Πιερία':
case 'Πιερίας': return '138';break;
case 'Πρέβεζα':
case 'Πρεβέζης':
case 'Πρέβεζας': return '139';break;
case 'Rethimno':
case 'Rethymno':
case 'Rethemno':
case 'Rethemnos':
case 'Rethimnou':
case 'Rethymnou':
case 'Rethemnou':
case 'Rethimnoy':
case 'Rethymnoy':
case 'Rethemnoy':
case 'Ρέθυμνο':
case 'Ρεθύμνου': return '140';break;
case 'Ροδόπη':
case 'Ροδόπης': return '141';break;
case 'Samos':
case 'Samou':
case 'Σάμος':
case 'Σαμος':
case 'Σάμου': return '142';break;
case 'Serres':
case 'Seres':
case 'Σέρρες':
case 'Σερρών': return '143';break;
case 'Trikala':
case 'Trikalon':
case 'Τρίκαλα':
case 'Τρικάλων': return '144';break;
case 'Fthiotida':
case 'Phthiotida':
case 'Ftheotida':
case 'Φθιώτιδα':
case 'Φθιώτιδας': return '145';break;
case 'Φλώρινα':
case 'Φλώρινας':
case 'Φλωρίνης': return '146';break;
case 'Phokida':
case 'Phokidas':
case 'Focida':
case 'Focidas':
case 'Fokida':
case 'Fokidas':
case 'Φωκίδα':
case 'Φωκίδας': return '147';break;
case 'Χαλκιδική':
case 'Χαλκιδικής': return '148';break;
case 'Chania':
case 'Chanion':
case 'Χανιά':
case 'Χανίων': return '149';break;
case 'Χίος':
case 'Χίου': return '150';break;
case 'Lemnos':
case 'Limnos':
case 'Λήμνος':
case 'Λήμνου': return '151';break;
} //switch
}
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
function detect_nomos(value)
{
$('#nomosid').val( nomos_lookup(value)).change();
}
//////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
function new_point(value)
{
switch (value)
{
case 'Administration':
document.getElementById('iwf_00').name.value='Administration';
document.getElementById('iwf_00').name_el.value='Διοίκηση';
break;
case 'Ancient Site':
document.getElementById('iwf_00').name.value='Ancient Site';
document.getElementById('iwf_00').name_el.value='Αρχαιολογικός Χώρος';
break;
case 'Appartments':
document.getElementById('iwf_00').name.value='Appartments';
document.getElementById('iwf_00').name_el.value='Διαμερίσματα';
break;
case 'Bar':
document.getElementById('iwf_00').name.value='Bar';
document.getElementById('iwf_00').name_el.value='Bar';
break;
case 'Beach':
document.getElementById('iwf_00').name.value='Beach';
document.getElementById('iwf_00').name_el.value='Παραλία';
break;
case 'Cafe':
document.getElementById('iwf_00').name.value='Cafe';
document.getElementById('iwf_00').name_el.value='Καφετέρια';
break;
case 'Church':
document.getElementById('iwf_00').name.value='Church';
document.getElementById('iwf_00').name_el.value='Εκκλησία';
break;
case 'Culture':
document.getElementById('iwf_00').name.value='Culture';
document.getElementById('iwf_00').name_el.value='Πολιτισμός';
break;
case 'Education':
document.getElementById('iwf_00').name.value='Education';
document.getElementById('iwf_00').name_el.value='Εκπαίδευση';
break;
case 'Forest':
document.getElementById('iwf_00').name.value='Forest';
document.getElementById('iwf_00').name_el.value='Δάσος';
break;
case 'Forts':
document.getElementById('iwf_00').name.value='Forts';
document.getElementById('iwf_00').name_el.value='Κάστρο';
break;
case 'Gas Station':
document.getElementById('iwf_00').name.value='Gas Station';
document.getElementById('iwf_00').name_el.value='Βενζινάδικο';
break;
case 'Gorge':
document.getElementById('iwf_00').name.value='Gorge';
document.getElementById('iwf_00').name_el.value='Φαράγγι';
break;
case 'Hospital':
document.getElementById('iwf_00').name.value='Hospital';
document.getElementById('iwf_00').name_el.value='Νοσοκομείο';
break;
case 'Hotel':
document.getElementById('iwf_00').name.value='Hotel';
document.getElementById('iwf_00').name_el.value='Ξενοδοχείο';
break;
case 'Island':
document.getElementById('iwf_00').name.value='Island';
document.getElementById('iwf_00').name_el.value='Νησί';
break;
case 'Lake':
document.getElementById('iwf_00').name.value='Lake';
document.getElementById('iwf_00').name_el.value='Λίμνη';
break;
case 'Lighthouses':
document.getElementById('iwf_00').name.value='Lighthouses';
document.getElementById('iwf_00').name_el.value='Φάρος';
break;
case 'Monastery':
document.getElementById('iwf_00').name.value='Monastery';
document.getElementById('iwf_00').name_el.value='Μοναστήρι';
break;
case 'Mounts':
document.getElementById('iwf_00').name.value='Mounts';
document.getElementById('iwf_00').name_el.value='Οροσειρά';
break;
case 'Museum':
document.getElementById('iwf_00').name.value='Museum';
document.getElementById('iwf_00').name_el.value='Μουσείο';
break;
case 'Parking':
document.getElementById('iwf_00').name.value='Parking';
document.getElementById('iwf_00').name_el.value='Χώρος Στάθμευσης';
break;
case 'Peaks':
document.getElementById('iwf_00').name.value='Peaks';
document.getElementById('iwf_00').name_el.value='Κορυφή';
break;
case 'Pharmacy':
document.getElementById('iwf_00').name.value='Pharmacy';
document.getElementById('iwf_00').name_el.value='Φαρμακείο';
break;
case 'Plains & Plateaus':
document.getElementById('iwf_00').name.value='Plains & Plateaus';
document.getElementById('iwf_00').name_el.value='Πεδιάδα-Οροπέδιο';
break;
case 'Restaurant':
document.getElementById('iwf_00').name.value='Restaurant';
document.getElementById('iwf_00').name_el.value='Εστιατόριο';
break;
case 'Shop':
document.getElementById('iwf_00').name.value='Shop';
document.getElementById('iwf_00').name_el.value='Κατάστημα';
break;
case 'Site':
document.getElementById('iwf_00').name.value='Site';
document.getElementById('iwf_00').name_el.value='Τόπος';
break;
case 'Sports':
document.getElementById('iwf_00').name.value='Sports';
document.getElementById('iwf_00').name_el.value='Αθλητικά';
break;
case 'Town-Village':
document.getElementById('iwf_00').name.value='Town-Village';
document.getElementById('iwf_00').name_el.value='Πόλη-Χωριό';
break;
case 'Traffic Camera':
document.getElementById('iwf_00').name.value='Traffic Camera';
document.getElementById('iwf_00').name_el.value='Κάμερα Τροχαίας';
break;
case 'Transportation':
document.getElementById('iwf_00').name.value='Transportation';
document.getElementById('iwf_00').name_el.value='Μεταφορές';
break;
case 'Statue':
document.getElementById('iwf_00').name.value='Statue';
document.getElementById('iwf_00').name_el.value='Άγαλμα';
break;
case 'Park':
document.getElementById('iwf_00').name.value='Park';
document.getElementById('iwf_00').name_el.value='Πάρκο';
break;
case 'Bus Stop':
document.getElementById('iwf_00').name.value='Bus Stop';
document.getElementById('iwf_00').name_el.value='Στάση Λεωφορείου';
break;
case 'Cave':
document.getElementById('iwf_00').name.value='Cave';
document.getElementById('iwf_00').name_el.value='Σπήλαιο';
break;
case 'City':
document.getElementById('iwf_00').name.value='City';
document.getElementById('iwf_00').name_el.value='Πόλη';
break;
case 'Playground':
document.getElementById('iwf_00').name.value='Playground';
document.getElementById('iwf_00').name_el.value='Παιδική Χαρά';
break;
case 'Law':
document.getElementById('iwf_00').name.value='Law';
document.getElementById('iwf_00').name_el.value='Νομικά';
break;
} //switch
}
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
function create_yah(position)
{
//perform rev geocoding
// update address div
// create a marker
//alert("create_yah: entered");
// Get Coordinates
var coords = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
//Detect and write the street address
geocoder = new google.maps.Geocoder();
geocoder.geocode({'latLng': coords},
function(results, status)
{
if (status == google.maps.GeocoderStatus.OK)
{
if (results[1])
{
document.getElementById("yah_address").innerHTML="You are here:
"+results[1].formatted_address;
// document.getElementById("yah_address").innerHTML="You are here:
"+results[1].place_id;
}
}
else
{
//alert("Geocoder failed due to: " + status);
}
});
// Insert a "You are here Marker"
marker_yah = new google.maps.Marker
({
position: coords,
map: map1,
icon: youarehere_icon,
animation: google.maps.Animation.BOUNCE,
title:'You Are here'
});
google.maps.event.addListener(marker_yah, 'click', toggleBounce);
}
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function toggleBounce()
{
if (marker_yah.getAnimation() != null)
{
marker_yah.setAnimation(null);
}
else
{
marker_yah.setAnimation(google.maps.Animation.BOUNCE);
}
}
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function update_markers(map1)
{
var bounds = map1.getBounds();
var southWest = bounds.getSouthWest();
var northEast = bounds.getNorthEast();
var y0 = southWest.lat();
var x0 = southWest.lng();
var y1 = northEast.lat();
var x1= northEast.lng();
var zlevel=map1.getZoom();
console.log ("update_markers fn starts");
$.ajax({
type: 'GET',
url: "https://topo.directory/eo/actions/api.php",
data: {action:'get_onbounds_points', zlevel:zlevel,x0:x0,x1:x1, y0:y0,y1:y1,
enable_zoom_levels:enable_zoom_levels,
Administration:document.getElementById('Administration').checked,
AncientSite:document.getElementById('AncientSite').checked,
Appartment:document.getElementById('Appartment').checked,
Bar:document.getElementById('Bar').checked,
Beach:document.getElementById('Beach').checked,
Cafe:document.getElementById('Cafe').checked,
Church:document.getElementById('Church').checked,
Culture:document.getElementById('Culture').checked,
Education:document.getElementById('Education').checked,
Forest:document.getElementById('Forest').checked,
Forts:document.getElementById('Forts').checked,
Gas:document.getElementById('Gas').checked,
Gorge:document.getElementById('Gorge').checked,
Hospital:document.getElementById('Hospital').checked,
Hotel:document.getElementById('Hotel').checked,
Island:document.getElementById('Island').checked,
Lake:document.getElementById('Lake').checked,
Lighthouses:document.getElementById('Lighthouses').checked,
Monastery:document.getElementById('Monastery').checked,
Mounts:document.getElementById('Mounts').checked,
Museum:document.getElementById('Museum').checked,
Parking:document.getElementById('Parking').checked,
Peaks:document.getElementById('Peaks').checked,
Pharmacy:document.getElementById('Pharmacy').checked,
PlainsPlateaus:document.getElementById('PlainsPlateaus').checked,
Restaurant:document.getElementById('Restaurant').checked,
Shop:document.getElementById('Shop').checked,
Site:document.getElementById('Site').checked,
Sports:document.getElementById('Sports').checked,
TownVillage:document.getElementById('TownVillage').checked,
TrafficCamera:document.getElementById('TrafficCamera').checked,
Statue:document.getElementById('Statue').checked,
Park:document.getElementById('Park').checked,
Busstop:document.getElementById('Busstop').checked,
Cave:document.getElementById('Cave').checked,
City:document.getElementById('City').checked,
Law:document.getElementById('Law').checked,
Transportation:document.getElementById('Transportation').checked,
Playground:document.getElementById('Playground').checked
},
dataType: "json",
success: function(data, status){ console.log ('update_markers Callback. status:'+status);
if (status=="success")
{
if (data)
{ console.log ('update_markers Callback. data:'+data);
//action
for (key in data)
{//alert (key );
if (!markers[key])
insert_single_marker(map1,data[key].x,data[key].y,data[key].t,key,data[key].n,data[key].n_el);
}
for (key in markers)
{
if (!data[key])
{
markers[key].setMap(null);
markers[key] = null;
delete markers[key];
} //else alert (key + 'found');
}
// ;
markers[areaid].setAnimation(google.maps.Animation.BOUNCE);
} //if data
else
{
for (key in markers)
{
markers[key].setMap(null);
markers[key] = null;
delete markers[key];
}
}
} // if success
} // callback function
});// ajax call
} //function
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function updateLocation()
{ //alert ('update location');
if (navigator.geolocation)
{
// timeout at 10000 milliseconds (10 seconds)
var options = {timeout:10000};
watchID = navigator.geolocation.watchPosition(showLocation,errorHandler,options);
//alert (watchID);
}
else
{
x.innerHTML = "Sorry, browser does not support geolocation!.";
}
}
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function showLocation(position)
{//alert (document.getElementById('snap2yah').checked);
var coords_yah = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
if (document.getElementById('snap2yah').checked)
map1.panTo(coords_yah);
marker_yah.setPosition(coords_yah);
}
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function stopWatch()
{
navigator.geolocation.clearWatch(watchID);
watchID=0;//alert (watchID);
}
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function toggle_snap_yah()
{//alert (document.getElementById('snap2yah').checked);
if (!document.getElementById('snap2yah').checked) stopWatch();
if (document.getElementById('snap2yah').checked) updateLocation();
}
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function misplaced(areaid)
{ //alert ('misplaced');
var url = "https://topo.directory/eo/actions/api.php";
$.post(url,
{action:'area_misplaced',
areaid:areaid
},
function(data, status)
{ //alert (status);
if (status=="success")
{
if (data==1)
document.getElementById("misplaced_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/error-4-32_red.png";
else
document.getElementById("misplaced_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/error-4-32.png";
}
});
} //function
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function inappropriate(areaid)
{ //alert ('misplaced');
var url = "https://topo.directory/eo/actions/api.php";
$.post(url,
{
action:'area_inappropriate',
areaid:areaid
},
function(data, status)
{ //alert (status);
if (status=="success")
{
if (data==1)
document.getElementById("inappropriate_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/error-6-32_red.png";
else document.getElementById("inappropriate_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/error-6-32.png";
}
});
} //function
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function area_rate(areaid,grade)
{ //alert ('area_rate');
var url = "https://topo.directory/eo/actions/api.php";
$.post(url,
{action:'area_rate',
areaid:areaid,
grade:grade
},
function(data, status){ //alert (status);
if (status=="success")
{
var i;
for (i = 1; i < 6; i++)
{
var rate_div_id='rate_'+i;
if (i==data)
document.getElementById(rate_div_id).innerHTML = '*'+i;
else document.getElementById(rate_div_id).innerHTML = i;
// alert (rate_div_id);
}
}
});
} //function
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function area_like(areaid)
{ //alert ('area_rate');
var url = "https://topo.directory/eo/actions/api.php";
$.post(url,
{action:'area_like',
areaid:areaid
},
function(data, status){ //alert (status);
if (status=="success")
{
if (data==1)
document.getElementById("area_like_btn_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/favorite-5-32_red.png";
else document.getElementById("area_like_btn_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/favorite-5-32.png";
}
});
} //function
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function area_wish(areaid)
{ //alert ('area_rate');
var url = "https://topo.directory/eo/actions/api.php";
$.post(url,
{action:'area_wish',
areaid:areaid
},
function(data, status){ //alert (status);
if (status=="success")
{
if (data==1)
document.getElementById("area_wish_btn_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/define-location-32_green.png";
else document.getElementById("area_wish_btn_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/define-location-32.png";
}
});
} //function
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function area_been(areaid)
{ //alert ('area_rate');
var url = "https://topo.directory/eo/actions/api.php";
$.post(url,
{action:'area_been',
areaid:areaid
},
function(data, status){ //alert (status);
if (status=="success")
{
if (data==1)
document.getElementById("area_been_btn_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/arrow-204-32_green.png";
else document.getElementById("area_been_btn_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/arrow-204-32.png";
}
});
} //function
///////////////////////////////////////////
/////////////////////////////////////////
/////////////////////////////////////////////
////////////// img interactions
//////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function img_rate(areaid,grade)
{ //alert (areaid+'image rate'+grade);
var url = "https://topo.directory/eo/actions/api.php";
$.post(url,
{action:'img_rate',
img_id:areaid,
grade:grade
},
function(data, status){ //alert (status);
if (status=="success")
{
var i;
for (i = 1; i < 6; i++)
{
var rate_div_id='rate_'+i;
if (i==data)
document.getElementById(rate_div_id).innerHTML = '*'+i;
else document.getElementById(rate_div_id).innerHTML = i;
// alert (rate_div_id);
}
}
});
} //function
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function img_misplaced(areaid)
{ //alert ('misplaced');
var url = "https://topo.directory/eo/actions/api.php";
$.post(url,
{action:'img_misplaced',
img_id:areaid
},
function(data, status){ //alert (status);
if (status=="success")
{ if (data==1)
document.getElementById("img_misplaced_btn_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/error-4-32_red.png";
else document.getElementById("img_misplaced_btn_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/error-4-32.png";
}
});
} //function
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function img_inappropriate(areaid)
{ //alert ('misplaced');
var url = "https://topo.directory/eo/actions/api.php";
$.post(url,
{action:'img_inappropriate',
img_id:areaid
},
function(data, status){ //alert (status);
if (status=="success")
{
if (data==1)
document.getElementById("img_inappropriate_btn_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/error-6-32_red.png";
else document.getElementById("img_inappropriate_btn_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/error-6-32.png";
}
});
} //function
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function img_like(areaid)
{ //alert ('area_rate');
var url = "https://topo.directory/eo/actions/api.php";
$.post(url,
{action:'img_like',
img_id:areaid
},
function(data, status){ //alert (status);
if (status=="success")
{
if (data==1)
document.getElementById("img_like_btn_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/favorite-5-32_red.png";
else document.getElementById("img_like_btn_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/favorite-5-32.png";
}
});
} //function
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function img_wish(areaid)
{ //alert ('area_rate');
var url = "https://topo.directory/eo/actions/api.php";
$.post(url,
{action:'img_wish',
img_id:areaid
},
function(data, status){ //alert (status);
if (status=="success")
{
if (data==1)
document.getElementById("img_wish_btn_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/define-location-32_green.png";
else document.getElementById("img_wish_btn_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/define-location-32.png";
}
});
} //function
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function img_been(areaid)
{ //alert ('area_rate');
var url = "https://topo.directory/eo/actions/api.php";
$.post(url,
{action:'img_been',
img_id:areaid
},
function(data, status){ //alert (status);
if (status=="success")
{
if (data==1)
document.getElementById("img_been_btn_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/arrow-204-32_green.png";
else document.getElementById("img_been_btn_img").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/arrow-204-32.png";
}
});
} //function
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function img_report(areaid,img_report_as)
{
if(img_report_as){
//alert ('area_rate');
var url = "https://topo.directory/eo/actions/api.php";
$.post(url,
{action:'img_report',
img_id:areaid,
img_report_as:img_report_as
},
function(data, status){ //alert (status);
if (status=="success")
{
if (data)
{
if (data=="img_report_spam") reported="Spam/Scam";
if (data=="img_report_lowq") reported="Blurry/ Low Quality";
if (data=="img_report_nude") reported="Nudity";
if (data=="img_report_violence") reported="Hate/Violence";
if (data=="img_report_illegal") reported="Illegal";
if (data=="img_report_unrelated") reported="Unrelated";
if (data=="img_report_old") reported="Very old";
document.getElementById("report_already").innerHTML += "Reportted by you as: "+reported+'
';
//else document.getElementById("report_div").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/arrow-204-32.png";
}
}
});}
} //function
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function area_suggest_address(areaid,suggested_address)
{
// alert ('area_suggest_address');
if(suggested_address){
// alert ('suggested_address');
var url = "https://topo.directory/eo/actions/api.php";
$.post(url,
{action:'area_suggest_address',
area_id:areaid,
suggested_address:suggested_address
},
function(data, status){
if (status=="success")
{
if (data=="OK")
{
document.getElementById("area_suggest_address_btn").innerHTML = 'OK';
}
}
}
);
}
} //function
///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function area_suggest_phone(areaid,suggested_phone)
{
// alert ('area_suggest_address');
if(suggested_phone){
// alert ('suggested_address');
var url = "https://topo.directory/eo/actions/api.php";
$.post(url,
{action:'area_suggest_phone',
area_id:areaid,
suggested_phone:suggested_phone
},
function(data, status){
if (status=="success")
{
if (data=="OK")
{
document.getElementById("area_suggest_phone_btn").innerHTML = 'OK';
}
}
}
);
}
} //function
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function area_report(areaid,area_report_as)
{
if(area_report_as){
//alert ('area_rate');
var url = "https://topo.directory/eo/actions/api.php";
$.post(url,
{action:'area_report',
area_id:areaid,
area_report_as:area_report_as
},
function(data, status){ //alert (status);
if (status=="success")
{
if (data)
{
if (data=="area_report_spam") reported="Spam/Scam";
if (data=="area_report_closed") reported="Closed";
if (data=="area_report_nude") reported="Nudity";
if (data=="area_report_violence") reported="Hate/Violence";
if (data=="area_report_illegal") reported="Illegal";
if (data=="area_report_duplicate") reported="Duplicate";
if (data=="area_report_privacy") reported="Private";
document.getElementById("report_already").innerHTML += "Reportted by you as: "+reported+'
';
//else document.getElementById("report_div").src = "https://topo.directory/eorder/var/templates/awesome/images/icons/arrow-204-32.png";
}
}
});}
} //function
////////////////////////
/////////////////////////
///////////////////////////////
function gis_area_photo_add(areaid,image)
{
// console.log('add tag:'+areaid);
document.getElementById("status").innerHTML ="Waiting for reply";
$.post("https://topo.directory/eorder/imaps/imaps_ajax_fns.php",
{
action: "add",
areaid: areaid,
image: image
},
function(data, status){ //alert (status);
//console.log('data:'+data);
if (status=="success")
{ // console.log('add success:');
document.getElementById("status").innerHTML =data;
button_id="img"+areaid;
document.getElementById(button_id).src="https://topo.directory/eorder/images/icons/delete.gif";
div_id="div_area_tag_"+areaid;
document.getElementById("taggedwith_div").appendChild(document.getElementById(div_id));
}
});
}
function gis_area_photo_delete(areaid,image)
{
// console.log('delete:'+areaid);
document.getElementById("status").innerHTML="Waiting for reply";
// console.log('waiting...delete:'+areaid);
$.post("https://topo.directory/eorder/imaps/imaps_ajax_fns.php",
{
action: "delete",
areaid: areaid,
image: image
},
function(data, status){// alert (status);
if (status=="success"){
// console.log('success:'+areaid);
// console.log('data:'+data);
document.getElementById("status").innerHTML =data;
button_id="img"+areaid;
document.getElementById(button_id).src="https://topo.directory/eorder/images/icons/add.gif";
div_id="div_area_tag_"+areaid;
// console.log(div_id);
document.getElementById("tagwith_div").appendChild(document.getElementById(div_id));
if (data=="OK") {//document.getElementById("img"+areaid).innerHTML= 1./ change the image, 2./ change the action
}
}
});
// console.log('posting...delete:'+areaid);
}
function gis_area_photo_toggle(areaid,image)
{ // console.log('gis_area_photo_toggle:'+areaid);
button_id="img"+areaid;
if (document.getElementById(button_id).src=="https://topo.directory/eorder/images/icons/delete.gif")
gis_area_photo_delete(areaid,image);
else
gis_area_photo_add(areaid,image);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////
function gis_area_photo_change_location(image)
{
var lat;
var lng;
lat=marker_DB.getPosition().lat();
lng=marker_DB.getPosition().lng();
$.post("https://topo.directory/eorder/imaps/imaps_ajax_fns.php",
{
action: "change_coords_photo_db",
image: image,
lat: lat,
lng: lng
},
function(data, status){// alert (status);
if (status=="success"){
if (data=="OK") {//document.getElementById("img"+areaid).innerHTML= 1./ change the image, 2./ change the action
}
document.getElementById("status").innerHTML =data;
info_window_DB.close();
}
});
}
function GP_search(q_type,map1)
{
///////////////////////
///////////////////////////
///////// GOOGLE AUTO SEARCH
var place_center = map1.getCenter();
infowindow_g = new google.maps.InfoWindow();
var service = new google.maps.places.PlacesService(map1);
service.nearbySearch({
location: place_center,
radius: 3000,
types: [q_type]
}, callback1);
function callback1(results, status) { //alert ('search');
if (status === google.maps.places.PlacesServiceStatus.OK) {
for (var i = 0; i < results.length; i++) {
createMarker1(results[i]);
}
}
}
function createMarker1(place) {
var placeLoc = place.geometry.location;
markers_google[place.place_id] = new google.maps.Marker({
map: map1,
draggable:true,
position: place.geometry.location
});
var form_id='form_'+place.place_id;
var buttong_id='buttong_'+place.place_id;
google.maps.event.addListener( markers_google[place.place_id], 'click', function() {
var new_html = "
";
//infowindow_g.setContent(place.name+' '+place.place_id);
infowindow_g[place.place_id] = new google.maps.InfoWindow({
content: new_html
});
//document.getElementById(form_id).buttong.addEventListener("click", savegoogleData(place.place_id));
if (conf_enable_save_googleplace) save_googleplace(place.geometry.location);
var grgc_nomos;
var geocoder = new google.maps.Geocoder;
var current_place_id;
geocoder.geocode({'location': place.geometry.location}, function(results, status) {
if (status === google.maps.GeocoderStatus.OK) {
if (results[1]) {
current_place_id=results[1].place_id;// alert(current_place_id);
document.getElementById(form_id).g_placeid.value =current_place_id;
document.getElementById(form_id).address.value =results[1].formatted_address;
document.getElementById(form_id).g_nomos.value =results[1].address_components[2].long_name ;
for (var ac = 0; ac < results[1].address_components.length; ac++)
{
if (results[1].address_components[ac].types.toString()=='administrative_area_level_3,political')
{
grgc_nomos=results[1].address_components[ac].long_name;
document.getElementById(form_id).g_nomos.value =grgc_nomos
}
}
// grgc_nomos=document.getElementById('iwf_00').g_nomos.value;
detect_nomos(grgc_nomos);
//g_request_details (current_place_id);
}//if result
} //if status
}); //geocode call
infowindow_g[place.place_id].open(map1, this);
});
} //function createMarker1
///////// GOOGLE AUTO SEARCH END
//////////////////
//////////////////
}