elementToModify = null;
replacement = null;
function nowSeriously(element, reality) {
	elementToModify = element;
	replacement = reality;
	setTimeout("replaceText()", 1000);
}

function replaceText() {
	if(elementToModify.firstChild.data != replacement) {
		origData = elementToModify.firstChild.data;
		elementToModify.title=origData;
		elementToModify.firstChild.data=replacement;
		blink(elementToModify);
	}
}

var blinker = null;
var normalColor = null;
function blink(ele) {
  if(blinker != null) {
    blinker.style.color=normalColor;
    blinker = null;
  }
  else {
    blinker = ele;
    normalColor = blinker.style.color;
    blinker.style.color="orange";
    setTimeout("blink()", 200);
  }
}

function imgCount() {
      var count = 0;
      var index = 0;
      var element = null;
      do {
        element = document.getElementsByTagName("img")[index++];
        if(element != null && element.src.toLowerCase().lastIndexOf("th_") > 0 ) {
          count+=1;
        }

      }while (element != null);
      var cStr = "";
      if(count > 1) {
        cStr = count.toString() + " Fotos";
        try{
            document.getElementById("slideshow").style.display="block";
        }catch(ex){}
      }
      else if(count == 1) {
        cStr = count.toString() + " Foto";
      }
      else {
        cStr = "keine Fotos";
      }
      document.getElementById("imgCount").firstChild.data=cStr;
}

function photoRights() {
	alert("(Foto kommt nach OK).\nBitte fair bleiben.\n"
			+ "Ich gestatte niemandem den Einsatz meiner\n"
			+ "Fotos zu irgendeinem Verwendungszweck außerhalb\n"
			+ "meiner Web-Seiten.\n\nDanke.");
}
function getRandom( min, max ) {
	if( min > max ) {
   	return  -1;
	}
   if( min == max ) {
   	return min ;
   }
   var r = parseInt( Math.random() * ( max+1) );
   
   return  (r + min) <= max ? (r + min) : r;
}


function showCitation() {
	document.getElementById("citation").firstChild.nodeValue=citations[getRandom(0, citations.length - 1)];
}

function fontFallback() {
  try {
    var windex = navigator.userAgent.indexOf("Windows");
    if(windex && windex >= 0) {
       var bds = document.getElementsByTagName("body");
       var bd = bds ? bds[0] : null;
       if(bd) {
          var st = document.createAttribute("class");
          st.nodeValue = "win";
          bd.setAttributeNode(st);
       }
    }
  }catch(ex) {}
}
function browserCheck() {
  try{
	var mindex = null;
    if(! document.cookie || document.cookie.split('=')[0] != "ieWarning") {
      agent = navigator.userAgent;
      mindex = agent.indexOf("MSIE");
      if(mindex && mindex >= 0) {
        message = "\t" + agent.substring(mindex, mindex + 8);
        message += "\n\nF%fcr Darstellungsfehler im Internet-Explorer\n";
        message += "%fcbernehme ich keine Verantwortung.\n\n";
        message += "Ich gebe mir M%fche, auch diesen Browser zu unterst%fctzen,\n";
        message += "werde aber nicht jeden seiner Fehler umgehen k%f6nnen.\n\n";
        message += "Tut mir leid. Trotzdem viel Spa%df mit dem Text.\n\n";
        message += "Michael Uplawski, 2009. (weiter mit OK)";
        alert(unescape(message) );
        document.cookie = "ieWarning=true";
      }
    }
  }catch(ex) {}
}
function toggleBlockElement(eid, toggler) {
	if(eid) {
		var ele = document.getElementById(eid);
		if(ele) {
			var dp = ele.style.display;
			dp = 'none' == dp ? 'block' : 'none';
			document.getElementById(eid).style.display = dp;
		}
	}
}

