An overview :
h:graphicImage element has dynamic "url" parameter that is the property of Seam component.
But now - the problem :
"onchange" event handler of h:graphicImage is being invoked, when hidden field values are not yet updated with new values of the component. So I have previous incorrect state of properties.
Further re-running the same script from button (when page is fully rendered) gives correct results.
I an thinking in two possible ways now :
1) Add some timeout before running the script (dirty and not reliable solution)
2) Use basically another approach - looking forward to your advices ..