/**
 * @author niek.vugteveen
 */

var intv = null;
var post_id;
   
jQuery(document).ready(
	function()
	{
		if (window.autosave && jQuery('#post_ID').attr('name') == 'temp_ID') {
			post_id = jQuery('#post_ID').val();
			jQuery('#title').attr('value','Titel');
			autosave();
			intv = setInterval(create_iframe,2000);
			jQuery('#title').attr('value','');
		}
		else if(jQuery('#post_ID')){
			create_iframe();
		}
	}
);

function create_iframe()
{
	if(jQuery('#post_ID').val() != post_id){
		jQuery('#mct_thumb_iframe').attr('src', '../wp-content/plugins/mct_post_thumb/mct_post_thumb_uploader.php?post_id=' + jQuery('#post_ID').val());
		clearInterval(intv);
	}
}
