var browser = parseInt(navigator.appVersion);
var IE = navigator.userAgent.indexOf("MSIE") >= 0;

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();
 return true;
}

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)
    }
   }
 }
}

function initPage() {
 initAnchorStatus();
 addImgTitles();

 if ((browser >= 3) && (document.title) && (parent.frames.length>0)) {
  if (top.document.title != document.title)
   top.document.title = document.title;
 }

 focusIt();
}

function initContentsPage() {
 initAnchorStatus();
 addImgTitles();
}