if (wina+(imgx/2)) > (scnx/2)
  then posx=right
  else posx=left
if (winb+(imgy/2)) > (scny/2) 
  then posy=top
  else posy=bottom

