//Globale Library GPS-Tracks.com
// Copyright GPS-Tracks.com
// ACHTUNG: Darf kein ASPx enthalten!

// *********************************************************************************
// Globale JS-Variablen
var UrlGlobalPrafix = 0;  //Globaler PräfixCounter

// *********************************************************************************
// GetUrlPrafix
// Gibt die incrementierte URL zurück
function GetUrlPrafix(Sdn) {
  if(Sdn == '1'){
  UrlGlobalPrafix++;
    if(UrlGlobalPrafix > 9){
	UrlGlobalPrafix = 0;
	}
  var szSdn = 'http://ms' + UrlGlobalPrafix + '.GPS-Tracks.com/';
  } else {
  var szSdn = '';
  }
return szSdn;
}

// *********************************************************************************
// $
// $() Macht aus $("XYZ") --> document.getElementById("XYZ")
function $() {
var elements = new Array();
  for (var i = 0; i < arguments.length; i++) {
  var element = arguments[i];
    if (typeof element == 'string')
    element = document.getElementById(element);
    if (arguments.length == 1)
    return element;
  elements.push(element);
  }
return elements;
}

// *********************************************************************************
// Ajax
function GpsTracksAjax(Loader){
  if (window.XMLHttpRequest){
  Loader = new XMLHttpRequest();
  } 
  else if(window.ActiveXObject){
    try{
    Loader = new ActiveXObject("Msxml2.XMLHTTP");
    }
	catch (ex) {
   	  try {
      Loader = new ActiveXObject("Microsoft.XMLHTTP");
	  } 
	  catch (ex) {
	  }
    }
  }  
return Loader;
}

var PoiFoto_Window = null;
function PoiFotoResize(x,y){
  if(navigator.appName.toLowerCase() == 'microsoft internet explorer'){
    if ((navigator.userAgent.toLowerCase().indexOf('aol')==-1) && (navigator.userAgent.toLowerCase().indexOf('opera')==-1)){
	PoiFoto_Window.resizeTo(x+25,y+74);
	}  
    
    if (navigator.userAgent.toLowerCase().indexOf('opera')!=-1){
	PoiFoto_Window.resizeTo(x+12,y+31);
	}

    if(navigator.userAgent.toLowerCase().indexOf('aol')!=-1){
	PoiFoto_Window.resizeTo(x+4,y+4);
	}
  } else {
	if(navigator.appVersion.substring(0,1) < "5"){
	PoiFoto_Window.resizeTo(x,y);
	} else {
	PoiFoto_Window.resizeTo(x+8,y+28);
	}
  }
}

function PoiFoto(FotoPfad,Titel,AltText){ 
PoiFoto_Window = window.open('', 'PoiFoto','resizable=1,menubar=no,location=no,status=no,titlebar=no,toolbar=no');
  with (PoiFoto_Window){
  document.open();
  document.write('<title>'+Titel+'</title>');
  document.write('<meta http-equiv=\"imagetoolbar\" content=\"no\">');
  document.write('<body style=\"vertical-align:middle; text-align: center;\" bgcolor=\"black\" location=\"no\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\"scroll=\"no\" onload=\"opener.PoiFotoResize(document.images[0].width,document.images[0].height)\">')
  document.write('<center>');
  document.write('<a href=\"javascript:self.close()\">');
  document.write('<div style=\"width:auto;text-align: center;\">');
  document.write('<img src=\"'+FotoPfad+'\" border=\"0\" alt=\"'+AltText+'\" align=\"absmiddle\" style=\"vertical-align:middle;\">')
  document.write('</div>');
  document.write('</center>');
  document.close();
  }
}

//LibWindowEinfach
function LibWindowEinfach(szPath, iHeight, iWidth, iTop, iLeft){
  if (iHeight > screen.height || iHeight < 1){
  iHeight = screen.height
  }

  if (iWidth > screen.width || iWidth < 1){
  iWidth = screen.width
  }
var w = window.open(szPath, "Einfach" + Math.round(999 * Math.random()), "location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes,height="+iHeight+",width="+iWidth+",top="+iTop+",left="+iLeft);
w.focus();
}

function LibWindowMaxSize(szPath)
{
var w;
var iHeight = screen.height;
var iWidth = screen.width;
var iTop=0;
var iLeft=0;
w = window.open(szPath, "MaxSize" + Math.round(999 * Math.random()), "location=no,menubars=no,toolbars=no,resizable=yes,fullscreen=yes");
w.focus();
}


//StrRight
function StrRight(szString, iAnzahlChars){
return szString.substring(szString.length - iAnzahlChars, szString.length);
}

//StrLeft
function StrLeft(szString, iAnzahlChars){
return szString.substring(0, iAnzahlChars);
}


