﻿
function windowHeight(){var myHeight=0;if(typeof(window.innerWidth)=='number'){myHeight=window.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){myHeight=document.documentElement.clientHeight;}return myHeight;}
function yScroll(){var scrOfY=0;if(typeof(window.pageYOffset)=='number'){scrOfY=window.pageYOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;}else if(document.documentElement&&document.documentElement.scrollTop){scrOfY=document.documentElement.scrollTop;}return scrOfY;}
function eTOTALTOP(eOBJ){var t=0;while(eOBJ){if(eOBJ.style.position=='absolute'){return t;}t=t+eOBJ.offsetTop;eOBJ=eOBJ.offsetParent;}return t;}
function divHeight(id){var result=0;var d=document.getElementById(id);if(d.offsetHeight){result=d.offsetHeight;}else if(d.style.pixelHeight){result=d.style.pixelHeight;}return result;}
function toggleDiv(targetId){if(document.images&&document.getElementById){var oi=new Image(11,11),ci=new Image(11,11);oi.src='/images/open.gif';ci.src='/images/closed.gif';var target=document.getElementById(targetId);var img=document.getElementById(targetId+'Img');if(target.style.display=="none"){target.style.display="";img.src=oi.src;var scroll=yScroll();var wHeight=windowHeight();var dHeight=divHeight(targetId);var totalTop=eTOTALTOP(target);var toScroll=Math.min((totalTop+dHeight)-(scroll+wHeight),(totalTop-scroll-70));if(toScroll>0){window.scrollBy(0,toScroll+30);}}else{img.src=ci.src;target.style.display="none";}}}