$(document).ready(function(){
	$("div#loading").hide();
	
  	$("#tbody .programm tr td.blackevetit, #tbody .programm tr td.coloredevetit, #tbody .programm tr td.htmlclbr").click(function(event){
	
  	event.preventDefault();
	
	//var topid = $(this).attr('id');
	
	var topid = $(this).find("a").attr("id");
	
	//alert(topid);
	
	var olpos = { x:0, y:0 };
	
	olpos = getPosition(document.getElementById(topid));
	
	//alert(olpos.x+"-"+olpos.y);
	
	var calcpos = -5;
	calcpos += parseInt(olpos.y);
	
	//alert(calcpos);
	
	$("#proginfo").slideToggle("fast", function(){ change("sdetailinfo.php?LID=" + topid,calcpos) } );
	
	$("div#loading").ajaxStart(halas(parseInt(calcpos)-40));
	$("div#loading").ajaxSuccess(halah());
	
	});

	function halas(calcpos)
	{
	$("div#loading").show(100).css("top",parseInt(calcpos));
	}
	function halah()
	{
	$("div#loading").hide(100);
	}

  function change(loc,calcpos){
  //alert(loc);
    $.ajax({
      url: loc,
      type: "GET",
      success: function( neueDaten ) {
        $("#proginfo").html( neueDaten );
      },
      complete: function(){
        $("#proginfo").slideToggle("fast").css("top",parseInt(calcpos));
		//alert(String(calcpos));
		halah();
      }
    });
  }
});

function getPosition(obj) {
  var pos = { x:0, y:0 };
	
  do {
    pos.x += obj.offsetLeft;
    pos.y += obj.offsetTop;
	
	obj = obj.offsetParent;
  } while (obj);//

  //alert(pos.x + '/' + pos.y);
  return pos;
}


$(document).ready(function(){
});