/** Revision No : $Rev$ Last changed by: $Author$ Last changed on: $Date$ **/ function getDocHeight(doc) { doc = doc || document; // from http://stackoverflow.com/questions/1145850/get-height-of-entire-document-with-javascript var body = doc.body, html = doc.documentElement; var height = Math.max(window.innerHeight, body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight); return height; } function getDocWidth(doc) { doc = doc || document; // from http://stackoverflow.com/questions/1145850/get-height-of-entire-document-with-javascript var body = doc.body, html = doc.documentElement; var width = Math.max(window.innerWidth, body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth); return width; } function goHome() { $('html').addClass('js'); window.location = "dashboard"; } var failHeight = 9000; function setIframeHeight(id) { if (!isIE8) { var ifrm = document.getElementById(id); var doc = ifrm.contentDocument ? ifrm.contentDocument : ifrm.contentWindow.document; if (doc.URL.indexOf('/regon/') >= 0) { $('#' + id).height(failHeight + "px"); //$( "#innerframe" ).css( "overflow-y", "scroll"); } else { //$( "#innerframe" ).css( "overflow", "hidden"); $('#' + id).height("10px"); // reset to minimal height in case going from longer to shorter doc try { var dh = getDocHeight(doc); if (dh <= 10) { dh = failHeight; } $('#' + id).height(dh + 10 + "px"); } catch (err) { ('#' + id).height(failHeight + "px"); } } } else { $('#' + id).height(failHeight + "px"); //$( "#innerframe" ).css( "overflow", "scroll"); } } var isIE8 = navigator.userAgent.indexOf('MSIE 8.0') > 0; var failWidth = 1500; function setIframeWidth(id) { if (!isIE8) { var ifrm = document.getElementById(id); var doc = ifrm.contentDocument ? ifrm.contentDocument : ifrm.contentWindow.document; $('#' + id).width("10px"); // reset to minimal height in case going from longer to shorter doc try { var newWidth = getDocWidth(doc); if (newWidth <= 10) { newWidth = failWidth; } } catch (err) { newWidth = failWidth; } $('#' + id).width(newWidth + "px"); $('#header').width(newWidth + "px"); } else { $('#' + id).width(failWidth + "px"); } } function checkLoc(id) { var url = ''; try { var ifrm = document.getElementById(id); var doc = (typeof ifrm.contentDocument != "undefined") ? ifrm.contentDocument : ifrm.contentWindow.document; url = doc.URL; if ((url.indexOf('login') >= 0) || (url.indexOf('Login') >= 0)) { goHome(); return false; } else { return true; } } catch (err) { if ($.browser.webkit) { console.log(err); } if (((url.indexOf('rpbd') >= 0) || (url.indexOf('cspprod') >= 0))) { //do nothing just show me the error } else { goHome(); } return false; } } function waitForJquery() { if (typeof jQuery == "undefined") { alert("jQuery hasn't loaded.");} } function ifload() { //alert('in ifload'); waitForJquery(); if (checkLoc('innerframe')) { try { setIframeHeight('innerframe'); setIframeWidth('innerframe'); } catch (err) { } $('html').removeClass('js'); } $(window).scroll(function() { if($(window).scrollTop() + $(window).height() > $(document).height() - 100) $('#innerframe').css({height: ($('#innerframe').height() + 600)});{ } }); } function ifunload() { //alert('in outer unload'); $('html').addClass('js'); }