Hey Guys,

during the last days i,ve got a big problem.
I want to find out automatically the offset-position (y-axis) of an image-element and if the content on the right side is getting bigger than the min-height of 46px,
the image has to get the difference between the original position of it self and the new position.
I've set the min-height of the (text-filled)content to 46px and the offsetTop of the image to -64px.

I also have to say, that the images automatically have been loaded in a foreach request in SMARTY

here is the code i wrote for that:

var description_head = document.getElementById('description_head').offsetHeight;
var description_content = document.getElementById('description_content').offsetHeight;
var img = document.getElementById('articleImage');
var image_position_y = document.getElementById('articleImage').offsetTop;
var content_min_height = 46;
var image_0_pos = -64;
var height_content = description_head + description_content;


if(height_content == 46){
img.style.top = image_0_pos +"px";
}
else
{
if(height_content > 46 && height_content < 312)
{
var new_pos = image_0_pos - height_content + content_min_height;
img.style.top = new_pos+"px";
}
else
{
var new_pos = image_0_pos - height_content + content_min_height / 2;
img.style.top = new_pos+"px";
}
}


I hope some guy could help me with some suggestions and code-examples ...