var illLargeCurrent = null; var illLargeNew = null; var illSmallCurrent = null; var illSmallNew = null; function showIllustration(illId) { illLargeNew = document.getElementById('ill-large-' + illId); if(illLargeNew != illLargeCurrent) { if(illLargeCurrent) { illLargeCurrent.style.display = 'none'; } if(illLargeNew) { illLargeNew.style.display = 'block'; illLargeCurrent = illLargeNew; repositionBlock('ill-large-' + illId); } } } function closeIllustration(illId) { illLargeCurrent = document.getElementById('ill-large-' + illId); illLargeCurrent.style.display = 'none'; illLargeCurrent = null; } function repositionBlock(div_id) { doc_width = document.documentElement.clientWidth; doc_height = document.documentElement.clientHeight; div_width = document.getElementById(div_id).offsetWidth; div_height = document.getElementById(div_id).offsetHeight; div_left = (doc_width - div_width) / 2; div_top = document.documentElement.scrollTop + (doc_height - div_height) / 2; if(div_top < 0) div_top = 0; if(div_left < 0) div_left = 0; document.getElementById(div_id).style.left = div_left + 'px'; document.getElementById(div_id).style.top = div_top + 'px'; }