// JavaScript Document
function debugObj(o){
   var t = 'Objekt: ' + o;
   for(var a in o)
   t += '\n' + a + ( typeof o[a] == 'String' ? o[a] : typeof o[a]);
   alert(t);
}

function findPos(element) {
	var y = x = 0;
	 if (document.getElementById('StatusLine'))
	    document.getElementById('StatusLine').innerHTML = "";
	for (var e = element; e; e = e.offsetParent) {
		  if (document.getElementById('StatusLine'))
		     document.getElementById('StatusLine').innerHTML = 
			     (document.getElementById('StatusLine').innerHTML + e.id + "." + e.className + e.tagName +e.offsetLeft + "/" + e.offsetTop + "," );
		 x += e.offsetLeft;
		 y += e.offsetTop;
   }
	 if (document.getElementById('StatusLine'))
	    document.getElementById('StatusLine').innerHTML =  (document.getElementById('StatusLine').innerHTML + " [" + x + "/" + y + "] " );
	for (e = element.parentNode; e && e != document.body; e = e.parentNode){
	   if (e.scrollTop) y -= e.scrollTop;
	}
	return [x,y];
}


function showPic(obj){
	
	coors = findPos(obj);
	
	var imageName = obj.firstChild.src; 
	
	// image is first or second child depending on text
	if (obj.firstChild.nodeName == "IMG"){
	  
	  imageName = obj.firstChild.src;
	}
	else {
		 
	  imageName = obj.firstChild.nextSibling.src;
	  //alert("sibling");
	}
	//alert(imageName);
	
	// set position
	document.LargePic.style.top = coors[1]+"px";
	document.LargePic.style.left =  coors[0] +"px";
	
	// set lightroom specifica to large pic
	document.LargePic.parentNode.rel = obj.rel;
	document.LargePic.parentNode.href = obj.href;
	// set image spec for large pic
	document.LargePic.src= imageName.replace(/TC.jpg/g, "T.jpg");
	return false;
}

function hidePic(obj){
	document.LargePic.style.display="none"; 
	//document.LargePic.src= "";
	
	return false;
}

function loadedPic(obj){
  if (document.getElementById('StatusLine'))
     document.getElementById('StatusLine').innerHTML =  (obj.height + " - " + obj.width + " - " +obj.style.left+ " - " +obj.style.top);
  obj.style.display="inline"; 
  return false;
}

function oeffnefenster (url) {
 fenster = window.open(url, "fenster1", "width=760,height=600,status=yes,scrollbars=yes,resizable=yes");
 fenster.focus();
}
