//poll
up_t1=0
up_t2=0
function poll(){
if(window.pageYOffset>distance)fade_1(1)
else fade_1(0)
wndwHght()//window height
up_time=setTimeout('poll()',300)}

//Balloon
function Note(event,a){
x=event.clientX+15
y=event.clientY +15
b=document.body.clientWidth
if(!note[a][1])note[a][1]=""
if(note[a][2]){if(x+note[a][2]+25>b) x=x-note[a][2]-40}
else if(x+220>b)x=x-220
balloon='<div class="balloon" style="top:'+y+'px; left:'+x+'px; width:'+note[a][2]+'px;">'
if(note[a][1]!="")balloon+='<h1>'+note[a][1]+'</h1>'
balloon+='<p>'+note[a][0]+'</p></div>'
document.getElementById("msg2").innerHTML=balloon}
function Pop(){document.getElementById("msg2").innerHTML='&nbsp;'}

//scroll
distance=350
time_=2
frames_=75//80
stpUp=25//25
stpDwn=36.8//40
var upTimer
opcty=0

function fade_1(i){
if(i==1){if(opcty<.95){opcty+=.05
window.clearTimeout(up_t1)
up_t2=setTimeout('fade_1(1)',20)}
else opcty=1}
else {if(opcty>.05){opcty-=.05
window.clearTimeout(up_t2)
up_t1=setTimeout('fade_1(0)',20)}
else opcty=0}
document.getElementById("up_arrow").style.opacity=opcty} 

function Scroll_up(){t_f=time_/frames_
scrllP=window.pageYOffset 
step=scrllP/frames_
sU=step/stpUp
sD=step/stpDwn
move=3
window.clearTimeout(upTimer)
scroll_(step,scrllP,scrllP,sU,sD)}

function scroll_(stp,cP,sP,sU,sD){prcnt=cP/sP
if(prcnt>=.25){move+=sU
if(move>stp)move=stp}
if(prcnt<.25){move-=sD
if(move<2.5)move=2}
cP-=move
if (cP>0){window.scrollTo(0,cP)
upTimer=setTimeout('scroll_('+stp+','+cP+','+sP+','+sU+','+sD+')',10)}
else {window.scrollTo(0,0)}
cP=0; sU=0; sD=0; stp=0}

//title
function title(x){r=x
t=document.getElementsByTagName('title')[0].firstChild.data
if (r==1)document.write('<input name="Study" type="hidden" id="Study" value="'+t+'" />')
else document.getElementById("title2").innerHTML=t}

//space
diH=0
wiH=0
function wndwHght(){if(diH==0)diH=document.body.clientHeight
if(wiH!=window.innerHeight){wiH=window.innerHeight
if(wiH>diH)spc=(wiH-diH)+0
else spc=0
document.getElementById("space").style.marginTop=spc+"px"}}
