var smid = "";
var myImage = new Image();
myImage.src = "/proimages/menu_left.gif";
var myImage1 = new Image();
myImage1.src = "/proimages/menubg.gif";
var myImage2 = new Image();
myImage2.src = "/proimages/menu_right.gif";
//hides and shows menu
var previousid = "";
function ShowSub(id){
if(document.getElementById(id).value==1){
document.getElementById(id).value=0;
document.getElementById(id).style.visibility='hidden';
document.getElementById(id).style.display='none';
}else{
document.getElementById(id).style.visibility='visible';
document.getElementById(id).style.display='block';
document.getElementById(id).value=1;
if(previousid != id)
hideprevmenu(previousid);
}
previousid = id;
}
function hideprevmenu(id){
if(id){
str = new String(id);
sub_str = str.substr(0,3);
if(sub_str == "SUB"){
document.getElementById(id).value=0;
document.getElementById(id).style.visibility='hidden';
document.getElementById(id).style.display='none';
}
}
}
// function GetXmlHttpObject(){
// var xmlHttp=null;
// try
// {
// // Firefox, Opera 8.0+, Safari
// xmlHttp=new XMLHttpRequest();
// }
// catch (e)
// {
// // Internet Explorer
// try
// {
// xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
// }
// catch (e)
// {
// xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
// }
// }
// return xmlHttp;
// }
function GetXmlHttpObject() {
var AjaxObj = false;
if(window.XMLHttpRequest){
AjaxObj = new XMLHttpRequest();
} else if (window.ActiveXObject){
AjaxObj=new ActiveXObject("Msxml2.XMLHTTP");
if (!AjaxObj){
AjaxObj=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return(AjaxObj);
}
var map = null;
var geocoder = null;
//loads the map
function loadMap() {
var icon = new GIcon();
icon.image = "/google_map_icons/om_cl.png";
icon.shadow = "/google_map_icons/om_cl.png";
icon.iconSize = new GSize(50, 50);
icon.shadowSize = new GSize(50, 50);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);
// address = 'bad rodach germany';
address = '50.320000, 10.777855';
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(50.341431, 10.777855), 5);
geocoder = new GClientGeocoder();
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
//alert(address + " not found");
} else {
map.setCenter(point, 10);
var marker = new GMarker(point,icon);
map.addOverlay(marker);
// GEvent.addListener(marker, "click", function() {
// map.setCenter(point, 15);
// var marker = new GMarker(point,icon);
// map.addOverlay(marker);
// marker.openInfoWindowHtml("Bad Rodach Germany");
// });
}
}
);
}
}
}
//default plan map
function defaultloadMap(){
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(50.341431, 10.777855), 12);
}
}
var accommodationicon = "/google_map_icons/unterkunfte.png";
var accommodationshadowicon = "/google_map_icons/unterkunfte.png";
var restauranticon = "/google_map_icons/gaststaetten.png";
var restaurantshadowicon = "/google_map_icons/gaststaetten.png";
var sightsicon = "/google_map_icons/sehenswuerdigkeiten.png";
var sightsshadowicon = "/google_map_icons/sehenswuerdigkeiten.png";
var routeicon = "/binary_data/";
var routeshadowicon = "/binary_data/";
var table_name = "";
var postcode = "";
var street = "";
var loc_name = "";
function showAddress(table_name,postcode,street,loc_name,info,img_name,geocode) {
var icon = new GIcon();
if(table_name == 'accommodation'){
icon.image = accommodationicon;
icon.shadow = accommodationshadowicon;
}
if(table_name == 'restaurant'){
icon.image = restauranticon;
icon.shadow = restaurantshadowicon;
}
if(table_name == 'sights'){
icon.image = sightsicon;
icon.shadow = sightsshadowicon;
}
if(table_name == 'route'){
icon.image = routeicon + img_name;
icon.shadow = routeshadowicon + img_name;
}
icon.iconSize = new GSize(22, 22);
icon.shadowSize = new GSize(22, 22);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);
info = replace(info,"#","\"");
if(table_name == "sights"){
// street = decodeURI(street);
address = street.toString()+', '+ postcode.toString() +' '+ loc_name.toString() + ', germany' ;
}else{
if(geocode!=="GeoCode"){
address = geocode.toString();
}else{
address = street.toString()+', '+ postcode.toString() +' '+ loc_name.toString() + ', germany' ;
}
}
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(50.341431, 10.777855), 15);
geocoder = new GClientGeocoder();
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert("sorry select location could not be found");
} else {
var marker = new GMarker(point,icon);
map.setCenter(point, 15);
map.addOverlay(marker);
marker.openInfoWindowHtml(info);
// var tmpMarker = createMarker(point,addr,map,info);
// map.addOverlay(tmpMarker);
// map.setCenter(point, 15);
// tmpMarker.openInfoWindowHtml(info);
}
}
);
}
}
}
var googleInfo = new Array();
var postcodestring = "";
var addr = null;
var postcodearray = null;
var pointstr = "";
function showAddresses(table,location,lang_id){
pointstr = "";
//point the location on the map
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(50.341431, 10.777855), 12);
geocoder = new GClientGeocoder();
//gets the postcode of the accommodation under selected location
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="getPostCode.php";
url=url+"?xTm="+ Math.random() +"&table="+table;
// if(table=="accommodation" || table == "restaurant"){
// url=url+"&location="+ location;
// }else{
// url=url+"&location_id="+location;
// }
url=url+"&location_id="+location;
url=url+"&lang_id=de";
xmlHttp.onreadystatechange=function getpost(){
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
postcodestring = xmlHttp.responseText;
if(postcodestring){
postcodearray = postcodestring.split("###");
for(i=0,j=0;i";
}
}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
}
// Creates a marker at the given point with the given number label
function createMarker(table_name,point,postcode, mapObj, info) {
var icon = new GIcon();
if(table_name == 'accommodation'){
icon.image = accommodationicon;
icon.shadow = accommodationshadowicon;
}
if(table_name == 'restaurant'){
icon.image = restauranticon;
icon.shadow = restaurantshadowicon;
}
if(table_name == 'sights'){
icon.image = sightsicon;
icon.shadow = sightsshadowicon;
}
icon.iconSize = new GSize(22, 22);
icon.shadowSize = new GSize(22, 22);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);
mapObj.setCenter(point, 12);
var marker = new GMarker(point, icon);
GEvent.addListener(marker, "click", function(){
Allpostcodearray = pointstr.split("|");
for(i=0;iLoading...";
var url="submenu.php";
var url1="&tm="+ Math.random() +"&table_name="+table_name+"&lang_id=de";
if((table_name == "route" || table_name == "hiking") && get == "10"){
url1=url1+"&more="+get_value;
}
xmlHttp.open("POST",url);
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
xmlHttp.onreadystatechange=function(){
if (xmlHttp.readyState==4 && xmlHttp.status==200){
document.getElementById("sub_navi").innerHTML = xmlHttp.responseText;
window.status = "Done";
//load the subsub menu when back to google map for acc
if(get == '1'){
highlightsubmenu(document.getElementById("accsubmenu_" + get_value));
showAddresses('accommodation',get_value,lang_id);
}
//show a specific loaction on the google map
if(get == '2'){
get_value_array = get_value.split("#");
locationStr = get_value_array['0'].toString();
acc_id = get_value_array['1'].toString();
element_id = (table_name == "restaurant") ? "restsubmenu_" + element_id : "accsubmenu_" + element_id;;
highlightsubmenu(document.getElementById(element_id));
show_specific_location(table_name,acc_id,acc_id,lang_id,geocode);
}
//load the subsub menu when back to google map for route
if(get == '3'){
// var imgname = "";
// //get the image dynamically
// var url="getimagename.php";
// url=url+"?routeback_id="+get_value;
// xmlHttp.onreadystatechange=function getpost(){
// if (xmlHttp.readyState==4 && xmlHttp.status==200){
// imgname = xmlHttp.responseText;
highlightsubmenu(document.getElementById("routesubmenu_" + get_value));
showlocations('route',get_value,imgname);
// }
// }
// xmlHttp.open("GET",url,true);
// xmlHttp.send(null);
}
//load the subsub menu when back to google map for rest
if(get == '4'){
highlightsubmenu(document.getElementById("restsubmenu_" + get_value));
showAddresses('restaurant',get_value,lang_id);
}
if(get == '5'){
get_value_array = get_value.split("#");
location_id = get_value_array['0'].toString();
rest_id = get_value_array['1'].toString();
highlightsubmenu(document.getElementById("restsubmenu_" + location_id));
show_specific_location('restaurant',location_id,rest_id,lang_id);
}
//load the subsub menu when back to google map for sight
if(get == '6'){
get_value_array = get_value.split("#");
location_id = get_value_array['0'].toString();
sight_id = get_value_array['1'].toString();
element_id = "sightsubmenu_" + location_id;
highlightsubmenu(document.getElementById(element_id));
show_specific_location('sights',location_id,sight_id,lang_id);
}
// if(get == '7'){
// get_value_array = get_value.split("#");
// location_id = get_value_array['0'].toString();
// sight_id = get_value_array['1'].toString();
// highlightsubmenu(document.getElementById("sightsubmenu_" + location_id));
// show_specific_location('sights',location_id,sight_id,lang_id);
// }
}
}
xmlHttp.send(url1);
}
function show_specific_location(table_name,location_id,spec_id,lang_id,geocode){
var xmlHttp=GetXmlHttpObject();
if (xmlHttp==null){
alert ("Browser does not support HTTP Request")
return
}
window.status = "Loading...";
document.getElementById("sub_sub_navi").innerHTML = "Loading...
";
var url="subsubmenu.php";
url=url+"?table_name="+table_name;
url=url+"&location_id="+location_id;
url=url+"&lang_id=de";
xmlHttp.onreadystatechange=function getpost(){
if (xmlHttp.readyState==4 && xmlHttp.status==200){
document.getElementById("sub_sub_navi").innerHTML = xmlHttp.responseText;
var url="getSpecificLocationInfo.php";
url=url+"?rn=" + Math.random() + "&location_id="+location_id;
url=url+"&table_name="+table_name;
url=url+"&spec_id="+spec_id;
if(geocode!="accommodation"){
url=url+"&geocode="+geocode;
}
var xmlHttp1=GetXmlHttpObject();
xmlHttp1.onreadystatechange=function getpost(){
if (xmlHttp1.readyState==4 && xmlHttp1.status==200){
Spec_info = xmlHttp1.responseText;
Spec_info_array = Spec_info.split("###");
if(Spec_info_array['4']){
var info4 = Spec_info_array['4'].toString();
}else{
var info4 = '0';
}
showAddress(table_name,Spec_info_array['1'].toString(),Spec_info_array['0'].toString(),Spec_info_array['2'].toString(),Spec_info_array['3'].toString(),"",info4);
}
}
xmlHttp1.open("GET",url,true);
xmlHttp1.send(null);
}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
window.status = "Done";
}
function gmapmainmover(tid){
tid.className = "gmapmainnavigation";
}
function gmapmainmout(tid){
tid.className = "";
}
function gmapsubmover(tid){
tid.className = "gmapsubnavigation";
}
function gmapsubmout(tid){
tid.className = "";
}
function generatesubsubmenu(table_name,location_id,lang_id){
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null){
alert ("Browser does not support HTTP Request")
return
}
window.status = "Loading...";
document.getElementById("sub_sub_navi").innerHTML = "Loading...
";
var url="subsubmenu.php";
url=url+"?table_name="+table_name;
// if(table_name=="accommodation" || table_name=="restaurant"){
// url=url+"&location="+location_id;
// }else{
// url=url+"&location_id="+location_id;
// }
url=url+"&location_id="+location_id;
url=url+"&lang_id=de";
xmlHttp.onreadystatechange=function getpost(){
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
//alert(xmlHttp.responseText);
document.getElementById("sub_sub_navi").innerHTML = xmlHttp.responseText;
window.status = "Done";
}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
var previousmainmenuid = "";
function highlightmainmenu(mid){
//clear the sub sub navigation
document.getElementById("sub_sub_navi").innerHTML = "
";
//document.getElementById("sub_navi").innerHTML = "";
if(previousmainmenuid){
previousmainmenuid.className = "";
previousmainmenuid.onmouseout = function()
{
this.className = "";
}
}
mid.className = "gmapmainnavigation";
mid.onmouseout = function()
{
this.className = "gmapmainnavigation";
}
previousmainmenuid = mid;
}
var previoussubmenuid = "";
function highlightsubmenu(smid){
// var posx;
// var posy;
//get the posX and posY of the clicked menu
// posx = findPosX(smid);
// posy = findPosY(smid);
// document.getElementById("sub_sub_navi").style.top = posy;
if(previoussubmenuid){
previoussubmenuid.className = "";
previoussubmenuid.onmouseout = function()
{
this.className = "";
}
}
smid.className = "gmapsubnavigation";
smid.onmouseout = function()
{
this.className = "gmapsubnavigation";
}
previoussubmenuid = smid;
}
function findPosX(obj){
var curleft = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
}
else if (obj.x)
curleft += obj.x;
return curleft;
}
function findPosY(obj){
var curtop = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curtop += obj.offsetTop
obj = obj.offsetParent;
}
}
else if (obj.x)
curtop += obj.x;
return curtop;
}
//function which generates the 3rd menu for the touren
function showlocationsmenu(table_name,route_id){
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null){
alert ("Browser does not support HTTP Request")
return
}
window.status = "Loading...";
document.getElementById("sub_sub_navi").innerHTML = "Loading...
";
var url="subsubmenu.php";
url=url+"?table_name="+table_name;
url=url+"&route_id="+route_id;
xmlHttp.onreadystatechange=function getpost(){
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
document.getElementById("sub_sub_navi").innerHTML = xmlHttp.responseText;
window.status = "Done";
}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function showroutedetails(route_id,lang_id){
location.href = "/route.php?route_id="+route_id+"&lang_id=de";
}
function showhikingdetails(route_id,lang_id){
location.href = "/hiking.php?route_id="+route_id+"&lang_id=de";
}
//function for route
//shows the locations on the map
function showlocations(table_name,route_id,img_name){
pointstr = "";
//point the location on the map
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(50.341431, 10.777855), 15);
geocoder = new GClientGeocoder();
//gets the postcode of the location under selected route
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="getPostCode.php";
url=url+"?table="+table_name;
url=url+"&route_id="+route_id;
xmlHttp.onreadystatechange=function getpost(){
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
postcodestring = xmlHttp.responseText;
if(postcodestring){
postcodearray = postcodestring.split("###");
for(i=0,j=0;i";
}
}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
}
// Creates a marker at the given point with the given number label
function createLocationMarker(table_name,point,postcode, mapObj, info,img_name) {
var icon = new GIcon();
//icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
//icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icon.image = routeicon + img_name;
icon.shadow = routeshadowicon + img_name;
icon.iconSize = new GSize(20, 20);
icon.shadowSize = new GSize(20, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);
var marker = new GMarker(point, icon);
GEvent.addListener(marker, "click", function() {
Allpostcodearray = pointstr.split("|");
for(i=0;i