function SSResizeFrame() {
if (document.getElementById('childFrame').contentWindow.document.body) {
var tempHeight = parseInt(document.getElementById('childFrame').contentWindow.document.body.clientHeight);
if (document.getElementById('childFrame').contentWindow.document.getElementById('janrainModal')) {
if (document.getElementById('childFrame').contentWindow.document.getElementById('janrainModal').style.display != 'none') {
tempHeight = tempHeight + parseInt(document.getElementById('childFrame').contentWindow.document.getElementById('janrainModal').style.height.replace('px', ''));
}
}
if (docHeight != (tempHeight)) {
document.getElementById('childFrame').style.height = parseInt(tempHeight + 20) + 'px';
if (document.getElementById('childFrame').contentWindow.document.getElementById('janrainModal')) {
if (document.getElementById('childFrame').contentWindow.document.getElementById('janrainModal').style.display != 'none') {
document.getElementById('childFrame').height = tempHeight + parseInt(document.getElementById('childFrame').contentWindow.document.getElementById('janrainModal').style.height.replace('px', ''));
}
}
}
docHeight = parseInt(document.getElementById('childFrame').contentWindow.document.body.clientHeight);// + 20;
if (document.getElementById('childFrame').contentWindow.document.getElementById('janrainModal')) {
if (document.getElementById('childFrame').contentWindow.document.getElementById('janrainModal').style.display != 'none') {
docHeight = docHeight + parseInt(document.getElementById('childFrame').contentWindow.document.getElementById('janrainModal').style.height.replace('px', ''));
}
}
}
}
//http://www.dyn-web.com/tutorials/iframes/height/
function getDocHeight(doc) {
doc = doc || document;
// stackoverflow.com/questions/1145850/
var body = doc.body, html = doc.documentElement;
//alert(body.scrollHeight + ',' + body.offsetHeight + ',' + html.clientHeight + ',' + html.scrollHeight + ',' + html.offsetHeight);
var height = Math.max( body.scrollHeight, body.offsetHeight,
html.clientHeight, html.scrollHeight, html.offsetHeight );
return height;
}
function setIframeHeight(id) {
var ifrm = document.getElementById(id);
var doc = ifrm.contentDocument? ifrm.contentDocument:
ifrm.contentWindow.document;
ifrm.style.height = getDocHeight( doc ) + "px";
// alert(ifrm.style.height);
// talker.send('resize', { height: getDocHeight( doc ) });
}