2 function scorm_get_element_style(obj, prop, cssProp) {
5 if (obj.currentStyle) {
6 ret = obj.currentStyle[prop];
7 } else if (document.defaultView && document.defaultView.getComputedStyle) {
8 var compStyle = document.defaultView.getComputedStyle(obj, null);
9 ret = compStyle.getPropertyValue(cssProp);
12 if (ret == 'auto') ret = '0';
16 function scorm_resize (cwidth, cheight) {
18 var winwidth = 0, winheight = 0;
19 if( typeof( window.innerWidth ) == 'number' ) {
21 winwidth = window.innerWidth;
22 winheight = window.innerHeight;
23 } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
24 //IE 6+ in 'standards compliant mode'
25 winwidth = document.documentElement.clientWidth;
26 winheight = document.documentElement.clientHeight;
27 } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
29 winwidth = document.body.clientWidth;
30 winheight = document.body.clientHeight;
33 var header = document.getElementById('header');
34 var content = document.getElementById('content');
37 headerheight = content.offsetTop;
40 var footer = document.getElementById('footer');
41 var imsnavbar = document.getElementById('tochead');
42 var scormtop = document.getElementById('scormtop');
45 var scormtopheight = 0;
47 footerheight = footer.offsetHeight + parseInt(scorm_get_element_style(footer, 'marginTop', 'margin-top')) + parseInt(scorm_get_element_style(footer, 'marginBottom', 'margin-bottom'));
50 imsnavheight = imsnavbar.offsetHeight;
53 scormtopheight = scormtop.offsetHeight;
56 var topmargin = parseInt(scorm_get_element_style(document.getElementsByTagName('body')[0], 'marginTop', 'margin-top'));
57 var bottommargin = parseInt(scorm_get_element_style(document.getElementsByTagName('body')[0], 'marginBottom', 'margin-bottom'));
59 var totalheight = headerheight +
63 bottommargin+10; // +10 to save a minor vertical scroll always present!
65 var totalheighttoc = totalheight+imsnavheight;
66 // override total height with configured height if it is defined
70 var toctree = document.getElementById('toctree');
72 var toctreeHeight = toctree.offsetHeight;
73 document.getElementById('toctree').style.height = (winheight - totalheighttoc) + 'px';
74 var scoframe2 = document.getElementById('scoframe1');
75 document.getElementById('scormobject').style.height = (winheight - totalheight) + 'px';
77 var scoframe2 = document.getElementById('scoframe1');
78 document.getElementById('scormobject').style.height = (winheight - totalheight) + 'px';
81 // resize the content container too to move the footer below the SCORM content
82 var contenti3 = document.getElementById('content-i3');
84 contenti3.style.height = (winheight - totalheight + 30) + 'px';
86 document.getElementById('content').style.height = (winheight - totalheight + 30) + 'px';
88 // resize the content container too to move the footer below the SCORM content
89 var contenti3 = document.getElementById('content-i3');
91 contenti3.style.height = (winheight - totalheight + 30) + 'px';
93 document.getElementById('content').style.height = (winheight - totalheight + 30) + 'px';