Thanks for the fix Dmitry. It worked great.
I have made some alterations to my code. I am now triggering the javascript from a button inside a swf and have added another function 'scrollToTop'(last one honest) At the moment I have this...
function scrollToTop(){
$.scrollTo('0px', 600 );
var wait = setInterval(function() {
if( !$("#element1").is(":animated") ) {
clearInterval(wait);
$("#flash").animate({'width':'500px','height':'800px'},800);
document.getElementById('main').height="800";
}
}, 200);
}
It works but looks messy to me, the downside is that '#flash animate' and 'main' are triggering at the same time. I would prefer the three functions to fire sequentially. Many Thanks