Jquery resize Iframe

Hey guys,

Really need some one in the know to help me out.

Basically I created a nice Jquery function to resize a window to the content on an Iframe. Because the Iframe has PHP in it which pulls a list of stockists and Iframes dont Auto resize to fit its contents if it pulls extra info.

So the code is as follows.



$(document).ready(function(){
	
	var iheight = $(document).height();
	
	$('#dynamIframe', window.parent.document).attr('HEIGHT', iheight);
		
	
	
});
	
	



So this bit of code is embedded into my Iframe, all its suppose to do is get the documents (the Iframe’s) current height then it selects the parent document ( the one containing the Iframe ) then it basically adds the height to the attributes.

THE PROBLEM: It works great, the first time you use it. BOOYAKASHAA. However when you click a another stockist on the list. A smaller list for example… it keeps the height of the document really big. So it initially makes the space bigger to accomadate the list. But does not go smaller afterwards?

See it mess up

here -> http://justcrisps.co.uk/stockists.php

Please advise!!

Cheers in advance!

bump