Technische Einzelheiten

JavaScript-Quelltexte: main.js

var browser = parseInt(navigator.appVersion), dhtmlType = 0,
    isIE = navigator.userAgent.toLowerCase().indexOf('msie') >= 0,
    isOpera = navigator.userAgent.toLowerCase().indexOf('opera') >= 0,
    isMozilla = (navigator.userAgent.toLowerCase().indexOf('mozilla') >= 0) && !isIE && !isOpera,
    mozVersion = 0;

    if (isMozilla) mozVersion = parseFloat(navigator.userAgent.substring(navigator.userAgent.toLowerCase().indexOf('rv:')+3))

var intNothing = 0,                 // eigentlich Konstanten
    intRefreshCookies = 1,
    intFrameCallCheck = 2,

    cssNavigation = 1,
    cssDefault = 2,

    dhtmlNS4 = 1,
    dhtmlIE4 = 2,
    dhtmlDOM = 3;

if (document.createElement) { dhtmlType = dhtmlDOM }
 else { if (document.all && !isOpera) { dhtmlType = dhtmlIE4 }       // for IE4
  else { if (document.layers && !isOpera) { dhtmlType = dhtmlNS4 }
 }
}

function GetLastModified() {
var d = new Date(document.lastModified), res, value="",
 months = "JanFebMarAprMayJunJulAugSepOctNovDec";

 if (GetLastModified.arguments.length>0) value = GetLastModified.arguments[0];
 if (value=="de") { months = "JanFebMarAprMaiJunJulAugSepOktNovDez" };
 if (value=="ru") { months = "янвфевмарапрмайиюниюлавгсепоктноядек" };

 value = d.getYear();
 if (value<70) {value += 2000};
 if (value<1000) {value += 1900};
 if ((value>=1900) && (value<1970)) {value += 100};
 if (browser<4) { res = String(d.getDate())+". "+String(d.getMonth()+1)+". "+value+", "+d.getHours()+":" }
  else { res = String(d.getDate())+" "+months.substr(3*(d.getMonth()),3)+" "+value+", "+d.getHours()+":" };
 value = d.getMinutes();
 if (value<10) { res += "0"+value } else { res += value };
 return res;
}

function ShowStatus(msg) {
 window.status=msg;
 return true;
}

function ClearStatus() {
 return ShowStatus('');
}

function focusIt() {
 if (browser >= 3) window.focus();
}

function preloadImages() {    // Alle Bilder bereits beim Seitenaufruf laden
 if (document.images) {       // Image-Modul geladen ?
  var ImageArray = new Array;
  for(arg=0; arg<PreloadImages.arguments.length; arg++) {
   ImageArray[arg] = new Image;
   ImageArray[arg].src = PreloadImages.arguments[arg];
  }
 }
}

function swapImage(ImageId, ImageSource){   // Austausch des Bildes
 if (document.images){
  if ((typeof ImageId == 'string') || (typeof ImageId == 'number')) {
   document.images[ImageId].src = ImageSource;
  }
  else if (ImageId && ImageId.src) { ImageId.src = ImageSource; }
 }
}

function removeFrames() {
 if (top.parent!=self) top.parent.location.replace(self.location.href);
}

function checkFramecall() {
 if (browser > 3) {
  var Adresse = location.search;
  if (Adresse) {
   var anURL = Adresse.substring(1, Adresse.length);
   if (anURL.indexOf('http://') >= 0) location.href=anURL;
  }
 }
}

function setCookie(aName, aValue, aLifetime) {  // aLifetime in Tagen
 var now = new Date();
 var expiry = new Date(now.getTime() + aLifetime*24*60*60*1000);
 if ((aValue != null) && (aValue != ""))
  document.cookie=aName + "=" + escape(aValue) + "; expires=" + expiry.toGMTString();
 return getCookie(aName) != null; // Test, ob es geklappt hat
}

function getCookie(aName) {
 var aStart, anEnd;
 if (document.cookie) {
  aStart = document.cookie.indexOf(aName+"=");
  if (aStart < 0) return null;
  aStart = document.cookie.indexOf("=", aStart) + 1;
  anEnd = document.cookie.indexOf(";", aStart);
  if (anEnd < 0) anEnd = document.cookie.length;
  return unescape(document.cookie.substring(aStart, anEnd));
 }
 else return null;
}

function deleteCookie(aName) {
 var now = new Date();
 var expired = new Date(now.getTime() - 2*24*60*60*1000);  // 2 Tage zurueck
 document.cookie=aName + "=null; expires=" + expired.toGMTString();
}

function cookiesEnabled() {
 var result=true, aValue="Cookie zu Testzwecken", aName="testIt";
 if (navigator.cookieEnabled != null) result = navigator.cookieEnabled;
 if (result) {
  result=false;
  if (setCookie(aName, aValue, 1)) result = getCookie(aName) == aValue;
  deleteCookie(aName);
 }
 return result;
}

function refreshCookie(aName, aLifetime) {
 var cookieValue = getCookie(aName);
 if (cookieValue != null) setCookie(aName, cookieValue, aLifetime);
}

function refreshCookies() {
 var duration = getCookie("duration"), refreshed = getCookie("refreshed");
 if (duration == null) duration = 90;
 if (refreshed != 1) {
  refreshCookie("popUp", duration);
  refreshCookie("selectedStyle", duration);
  refreshCookie("duration", duration);

  setCookie("refreshed", 1, 1); // Refershing after 1 day
 }
}

function newWindow() {
 var newW, url, winName="_blank", w=700, h=500;
 // Possible arguments: url, winName, width, height

 if (newWindow.arguments.length > 0) {
  url = newWindow.arguments[0];
  if (newWindow.arguments.length > 1) winName = newWindow.arguments[1];
  if (newWindow.arguments.length > 2) w = Math.round(newWindow.arguments[2]);
  if (newWindow.arguments.length > 3) h = Math.round(newWindow.arguments[3]);

  newW = window.open(url, winName,
   "width=" + w + ",height=" + h + ",screenX=50,screenY=50,toolbar=no,directories=no,menubar=yes,scrollbars=yes,resizable=yes");
   // nach den Kommas keine Leerraueme eingeben!
  if (browser > 2) {
   if (window.moveTo) newW.moveTo(50,50);
   newW.focus();
  }
 }
}

function getStyleSheetVersion() {
 var vCookie=getCookie("selectedStyle");
 if (vCookie==null) vCookie=0; else vCookie=vCookie-1;
 return vCookie;
}

// var cssNavigation = 1, cssDefault = 2;

function changeAStyleSheet(level, which) {
 var aVersion=getStyleSheetVersion(), aDir,
  aText="<link rel=\"stylesheet\" type=\"text\/css\" title=\"Main Style Sheet\" href=\"";
 var aFile="main" + aVersion + ".css";

 if (which==1) aFile="contents" + aVersion + ".css" ;

 if (level==1) aDir=".\/styles\/";
 if (level==2) aDir="..\/styles\/";
 if (level==3) aDir="..\/..\/styles\/";
 if (level==4) aDir="..\/..\/..\/styles\/";

 if (aVersion>0) document.write(aText + aDir + aFile + "\" \/>");
}

function changeStyleSheet(level) {
 var aVersion=getStyleSheetVersion();
 if (aVersion > 0) changeAStyleSheet(level, cssDefault);

 // if (!document.styleSheets)
}

function changeNavStyleSheet(level) {
 changeAStyleSheet(level, cssNavigation);
}

function popUp() {
 var vCookie=getCookie("popUp"), url;

 if ((vCookie!=null) && (vCookie==1) && (document.getElementById) && (popUp.arguments.length > 0)) {
  url = popUp.arguments[0].getAttribute("href");
  
  if (popUp.arguments.length == 1) newWindow(url, 'Abbr');
  if (popUp.arguments.length == 2) newWindow(url, 'Abbr', popUp.arguments[1]);
  if (popUp.arguments.length == 3) newWindow(url, 'Abbr', popUp.arguments[1], popUp.arguments[2]);
  return false;
 }
 else return true;
}

function checkEsc(event) {
 var code = 0;
 if (event.keyCode) code=event.keyCode;
 else if (event.which) code=event.which;
 if (code==27) window.close();
}

function addEvent(obj, eventType, aFunction, isCapture) {
 // W3C DOM
 if (obj.addEventListener) {
  obj.addEventListener(eventType, aFunction, isCapture);
  return true;
 }
 // Internet Explorer
 else if (obj.attachEvent) {
  return obj.attachEvent("on"+eventType, aFunction);
 }
 else return false;
}

function removeEvent(obj, eventType, aFunction, isCapture) {
 if (obj.removeEventListener) {
  obj.removeEventListener(eventType, aFunction, isCapture);
  return true;
 }
 else if (obj.detachEvent) {
  return obj.detachEvent("on"+eventType, aFunction);
 }
 else return false;
}

function processAnchorEvent(event) {
 if ((event.type=="mouseover") || (event.type=="focus")) {
  // Internet Explorer
  if (event.srcElement) window.status=event.srcElement.getAttribute("title");
  // W3C DOM
  if (event.currentTarget) {
   window.status=event.currentTarget.getAttribute("title");
   /* event.stopPropagation(); */
   if (event.cancelable) event.preventDefault();
  }
 }
 if ((event.type=="mouseout") || (event.type=="blur")) {
  if (event.srcElement) window.status="";
  if (event.currentTarget) {
   window.status="";
   /* event.stopPropagation(); */
   if (event.cancelable) event.preventDefault();
   // in case of mouseout anything should be done for focused links.
  }
 }
 return true; // for IE, identical to event.preventDefault()
}

function initAnchorStatus() {
 var anchorList, aTitle, i;

 if (document.getElementsByTagName) {
  anchorList=document.getElementsByTagName("a");
  if (anchorList.length>0)
   for (i=0; i<anchorList.length; i++) {
    aTitle=anchorList[i].getAttribute("title");
    if ((aTitle!=null) && (aTitle!="")) {
     addEvent(anchorList[i], "mouseover", processAnchorEvent, false);
     addEvent(anchorList[i], "focus", processAnchorEvent, false);
     addEvent(anchorList[i], "mouseout", processAnchorEvent, false);
     addEvent(anchorList[i], "blur", processAnchorEvent, false);
    }
   }
 }
}

function addImgTitles() {
 var imgList, aTitle, anAlt, i;

 if (document.getElementsByTagName) {
  imgList=document.getElementsByTagName("img");
  if (imgList.length>0)
   for (i=0; i<imgList.length; i++) {
    aTitle=imgList[i].getAttribute("title");
    anAlt=imgList[i].getAttribute("alt");
    if (((anAlt!=null) && (anAlt!="")) && ((aTitle==null) || (aTitle==""))) {
     imgList[i].setAttribute("title", anAlt)
    }
   }
  imgList=document.getElementsByTagName("area");
  if (imgList.length>0)
   for (i=0; i<imgList.length; i++) {
    aTitle=imgList[i].getAttribute("title");
    anAlt=imgList[i].getAttribute("alt");
    if (((anAlt!=null) && (anAlt!="")) && ((aTitle==null) || (aTitle==""))) {
     imgList[i].setAttribute("title", anAlt)
    }
   }
 }
}

function ifJS() {
 var aList, items, i;

 if (document.getElementById) {
  aList = document.getElementById("menuItems");
  items = aList.getElementsByTagName("li");
  if (items.length > 0) for (i=0; i<items.length; i++) {
   if (items[i].className == "js") items[i].style.display = "inline";
   if (window.name.toLowerCase() == "abbr") {
    if (items[i].className == "jsClose") {
     items[i].style.display = "inline";
     onkeypress=checkEsc;
    }
   }
   else if (items[i].className == "jsBack") items[i].style.display = "inline";
  }
 }
}

// var intNothing = 0,
//     intRefreshCookies = 1,
//     intFrameCallCheck = 2,

function initPage() {
 var anOpts = intNothing;
 if (initPage.arguments.length > 0) anOpts = initPage.arguments[0];

 removeFrames();

 if ((anOpts & intFrameCallCheck) != 0) checkFramecall(); // nur noch aus historischen Gruenden
 if ((anOpts & intRefreshCookies) != 0) refreshCookies();

 ifJS();
 if (window.name.toLowerCase()=='abbr') onkeypress=checkEsc;

 if (!isOpera) initAnchorStatus();
 addImgTitles();

 focusIt();
}

function initContentsPage() {
 initAnchorStatus();
 addImgTitles();
}