/**
* JavaScript
*
* @author	Sebastian Müller <sebastian produktivbuero de>
* @date		dd/mm/yyyy
*/


/** ************************************************************************
* Entschlüsselt E-Mails
*
* @param	$s  verschlüsselte E-Mail-Adresse
* @return	E-Mail-Adresse
* @author	http://jumk.de
* @date		
***************************************************************************/

function UnCryptMailto (s) {
	var n = 0;
	var r = "";
	for( var i = 0; i < s.length; i++)
	{
	    n = s.charCodeAt( i );
	    if( n >= 8364 )
	    {
	        n = 128;
	    }
	    r += String.fromCharCode( n - 1 );
	}
	return r;
};


/** ************************************************************************
* Ruft den Link zur E-Mail-Adresse auf
*
* @param	$s  verschlüsselte E-Mail-Adresse
* @return	-
* @author	http://jumk.de
* @date		
***************************************************************************/

function linkTo_UnCryptMailto (s) {
	location.href=UnCryptMailto(s);
};


/** ************************************************************************
* Öffnet ein Popupfenster
*
* @param	$url  Zieladresse
* @param	$width  Fensterbreite
* @param	$height  Fensterhöhe
* @return	-
* @author	Sebastian Müller
* @date		12/04/2007
***************************************************************************/

function popup(url, width, height) {
	myWindow = window.open(url,'popup','width=' + width + ', height=' + height + ', scrollbars=yes,toolbar=no,location=no,status=no,menubar=no,resizable=yes,top=0,left=0');
	myWindow.moveTo(50,50);
};


/** ************************************************************************
* Initialisiert die Karte
*
* @param	-
* @return	-
* @author	Sebastian Müller <sebastian produktivbuero de>
* @date		21/08/2008
***************************************************************************/
var linemap = null;

function initialize() {
  if (GBrowserIsCompatible()) {
    linemap = new GMap2(document.getElementById("map"));
    linemap.setCenter(new GLatLng(52.500723,13.414970), 15);
    // Steuerelemente anpassen
    var mapTypeControl = new GMapTypeControl();
    var smallTypeControl = new GLargeMapControl();
    linemap.addControl(mapTypeControl);
    linemap.addControl(smallTypeControl);
    linemap.addMapType(G_PHYSICAL_MAP);
    
    // Grundlegende Parameter aller Icons festlegen
    baseIcon = new GIcon();
    baseIcon.shadow = "http://druckerei-rabe.de/template/images/maps-shadow.png";
    baseIcon.iconSize = new GSize(50, 42);
    baseIcon.shadowSize = new GSize(50, 42);
    baseIcon.iconAnchor = new GPoint(25, 21);

    // Marker mit eigenem Icon erstellen
    var icon = new GIcon(baseIcon);
    icon.image = "http://druckerei-rabe.de/template/images/maps-logo.gif";
    // Objektparameter übergeben
    markerOptions = { icon:icon };
    var point = new GLatLng(52.500723,13.414970);
    var marker = new GMarker(point, markerOptions);
    linemap.addOverlay(marker);
  } // end if
};


/** ************************************************************************
* Positioniert das aktuelle Fenster
*
* @return	-
* @author	Sebastian Müller
* @date		07/02/2008
***************************************************************************/

function positionWindow() {
  self.resizeTo(screen.availWidth, screen.availHeight);
  self.moveTo(0,0);
  self.focus();
};
