jQuery(document).ready(function(){
//jQuery(document).load(function(){
if($("div.thumbdiv")){

$("div.thumbdiv").each(function(){

var divid=$(this).attr( "id");

if($(this).find('marker')){
var tstamp = $(this).find('marker').attr( "id");
}
var picsource = $("#" + divid + "_first");
var picheight = $("#" + divid + "_first").height();
var picwidth  = $("#" + divid + "_first").width();

var divw = picwidth / 100;
var divh = picheight / 100;
var picmarginw = 0
var picmarginh = 0
if(divw < divh){
  var thumbwidth = picwidth /divw;
  var thumbheight = picheight /divw;
  var picmarginh = (thumbheight - 100) /2
}else{
  var thumbwidth = picwidth /divh;
  var thumbheight = picheight /divh;
  var picmarginw = (thumbwidth - 100) /2
}

//Wenn Sourcepic vorhanden
if(picheight > 0 ){

//picsource.clone().prependTo($(this));

$(this).find('img').css({width: thumbwidth ,height: thumbheight, 'margin-left': '-' + picmarginw, border:'none'});
$(this).css({padding:'0', 'background-color':'#ffffff', 'visibility': 'visible', width: '100px' ,'overflow':'hidden',border:'none'});

$(this).hover(function() {
	$(this).css({'z-index' : '10', border:'1px solid #7095CC'});
  $(this).find('img').addClass("hover").stop()
		.animate({			
			width: picwidth, 
			height: picheight,
      marginLeft: '4px'	,
      marginTop: '4px'		
		}, 200);
		$(this).addClass("hover").stop()
		.animate({		
			width: picwidth  +10,
      height: picheight +10
		}, 200);

	} , function() {
		$(this).removeClass("hover").stop()
		.animate({	
    height :'100%',
    width: '100px'	,
    'z-index' : '0'
		}, 400);
  $(this).find('img').removeClass("hover").stop()
		.animate({			
      width: thumbwidth, 
			height: thumbheight,
      marginLeft: '-' + picmarginw 		
		}, 400);
	
	$(this).css({'overflow':'hidden',border:'none'});	
  
}); 
}
});
}});
