window.onload = function() {
  // Aus Frames ausbrechen
  if (self.parent.frames.length != 0) {
        self.parent.location == 'http://www.martinsrieder-weinstadl.de/';
  }

  ticker('news', tickerText, 300);
  setInterval('dateAndTime()', 1000);
  
  if (window.location.href == 'http://www.martinsrieder-weinstadl.de/anfahrt.html') {
    onLoad();
  }
//  alert(document.compatMode);
}

window.onunload = function() {
  if (window.location.href == 'http://www.martinsrieder-weinstadl.de/anfahrt.html') {
    GUnload();
  }
}


function dateAndTime() {
  var dateString = new Date(now * 1000);
  var string = '';
  
  if (dateString.getDate() < 10) {
    string += '0' + dateString.getDate();
  } else {
    string += dateString.getDate();
  }
  
  string += ".";
  
  if ((1 + dateString.getMonth()) < 10) {
    string += '0' + (1 + dateString.getMonth());
  } else {
    string += (1 + dateString.getMonth());
  }
  
  string += ".";
  if (navigator.appName.indexOf('Internet Explorer') != -1) {
    string += dateString.getYear();
  } else {
    string += 1900 + dateString.getYear();
  }
  string += ", ";
  
  if (dateString.getHours() < 10) {
    string += '0' + dateString.getHours();
  } else {
    string += dateString.getHours();
  }
  
  string += ':';
  
  if (dateString.getMinutes() < 10) {
    string += '0' + dateString.getMinutes();
  } else {
    string += dateString.getMinutes();
  }
  
  string += ':';
  
  if (dateString.getSeconds() < 10) {
    string += '0' + dateString.getSeconds();
  } else {
    string += dateString.getSeconds();
  }
  
  string += ' Uhr';
  
  document.getElementById('dateAndTime').innerHTML = string;
  
  now++;

  return now;
}


function newwin(url,target,w,h) {
  popup=window.open(url,target,'width=' + w + ',height=' + h + ',top=10,left=10,history=no,resizable=yes,status=no,scrollbars=no,toolbar=no,menubar=no,location=no,dependent=yes');
  popup.window.resizeTo(w,h);
  popup.focus();
}


function favoriten() {
  var url   = 'http://www.martinsrieder-weinstadl.de/';
  var title = 'Erlesene Südtiroler und Pfälzer Weine, Bayrisches Bier, zünftige Brotzeiten';
  
  if ((navigator.appName == 'Microsoft Internet Explorer') && (parseInt(navigator.appVersion) >= 4)) {
    external.AddFavorite(url, title);
  }
}


function ticker(divid,
                text,
                delay) {
  /* document.getElementById(divid).style.display = "inline"; */
  document.getElementById(divid).innerHTML = text;
  document.getElementById(divid).style.visibility = 'visible';
  
  text = text.substring(1, text.length) + text.charAt(0);
  var temp = text;
  var pos  = 0;
  
  while(temp.indexOf('\"', pos) >  -1) {
    temp = temp.substring(0, temp.indexOf('\"', pos)) + '\\\"' + temp.substring(temp.indexOf('\"', pos) + 1,  temp.length);
    pos  = temp.indexOf('\"', pos) + 1;
  }
  
  var id = setTimeout('ticker(\"' + divid + '\", \"' + temp + '\", ' + delay + ')', delay);
  
  return id;
}


function load(latitude, longitude, zoom) {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById('map'));
    map.setCenter(new GLatLng(37.4419, -122.1419), 13);
  }
}

/*
function googleMaps(latitude, longitude, zoom) {
  var map = new GMap2(document.getElementById('map'));
  map.addControl(new GSmallMapControl());
  map.addControl(new GMapTypeControl());
  map.setCenter(new GLatLng(37.4419, -122.1419), 13);
  
  // Our info window content
  var infoTabs = [
    new GInfoWindowTab("Martinsrieder Weinstadl", "Unser Weinstadl finden Sie hier."),
  ];
  
  // Place a marker in the center of the map and open the info window
  // automatically
  var marker = new GMarker(map.getCenter());
  GEvent.addListener(marker, "click", function() {
                     marker.openInfoWindowTabsHtml(infoTabs);
		    });
  map.addOverlay(marker);
  marker.openInfoWindowTabsHtml(infoTabs);
}
*/

