var iframe;
var lastSentHeight='0';
function contentHeight() {
	return String($('body').outerHeight(true));
}
function resizeMsg() {
	return xdReceiverPath + '#' + 'height_' + contentHeight();
}
function createXDFrame() {
	// Append the Iframe into the DOM.
	iframe = $('<iframe id="xd-iframe"" src="' + resizeMsg() + '" width="1" height="1" scrolling="no" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"><\/iframe>').appendTo('#app-wrapper');
}
function frameResize() {
	if(contentHeight()!=lastSentHeight){
		lastSentHeight=contentHeight();
		try {
			iframe[0].contentWindow.location = resizeMsg()
			//iframe[0].contentWindow.location.replace(resizeMsg())
		}catch(e){
			//console.log(e)
		}
	}
}
function beginFrameResizing() {
	lastSentHeight=contentHeight();
	setInterval("frameResize()", 200);
}
$(function(){
	createXDFrame();
	beginFrameResizing()	
});
