//grundlegende JavaScript-Funktionen

function showPic (whichpic) {
var gallery = document.getElementById( 'archivsel' );
      var links = gallery.getElementsByTagName( 'a' );
      for( var i=0; i < links.length; i++ ){
        links[i].style.color="#000";
		links[i].style.background="#ddd";
		links[i].onmouseover = function(){
			this.style.color="#226";
			this.style.background="#999";
			};
		links[i].onmouseout = function(){
			if(this!=whichpic){
				this.style.color="#000";
				this.style.background="#ddd";
			}
			};
        };
whichpic.style.color="#226";
whichpic.style.background="#999";
 if (document.getElementById) {
  document.getElementById('placeholder').src = whichpic.href;
  if (whichpic.title) {
   document.getElementById('desc').childNodes[0].nodeValue = whichpic.title;
  } else {
   document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
  }
  return false;
 } else {
  return true;
 }
}

function prepareGallery(){
  if( document.getElementById &&
      document.getElementsByTagName ){
    if( document.getElementById( 'archivsel' ) ){
      var gallery = document.getElementById( 'archivsel' );
      var links = gallery.getElementsByTagName( 'a' );
      for( var i=0; i < links.length; i++ ){
        links[i].onclick = function(){
          return showPic(this);
        };
      }
    }
  }
}

function init()
{
lnks = document.getElementsByTagName("a");
for(i=0; i<lnks.length; i++) {
lnks[i].onfocus = new Function("if(this.blur)this.blur()");
}
}

function hasClass(obj) {
     var result = false;
     if (obj.getAttributeNode("class") != null) {
         result = obj.getAttributeNode("class").value;
     }
     return result;
  }   

 function stripe(id) {
    var even = false; 
    // if arguments are provided to specify the colours
    // of the even & odd rows, then use the them;
    // otherwise use the following defaults:
    var evenColor = arguments[1] ? arguments[1] : "#fff";
    var oddColor = arguments[2] ? arguments[2] : "#eee";
  
    var table = document.getElementById(id);
    if (! table) { return; }
    var tbodies = table.getElementsByTagName("tbody");
    for (var h = 0; h < tbodies.length; h++) {
      var trs = tbodies[h].getElementsByTagName("tr");     
      for (var i = 0; i < trs.length; i++) {
	    if (!hasClass(trs[i]) && ! trs[i].style.backgroundColor) {
           var tds = trs[i].getElementsByTagName("td");
          for (var j = 0; j < tds.length; j++) {    
            var mytd = tds[j];
	        if (! hasClass(mytd) && ! mytd.style.backgroundColor) {     
		      mytd.style.backgroundColor = even ? evenColor : oddColor;           
            }
          }
        }
        // flip from odd to even, or vice-versa
        even =  ! even;
      }
    }
  }
