<!--
//input stuff
var m;

function getCoords(){m.x=event.clientX;m.y=event.clientY;}

function swapImg(img,str){
	MM_findObj(img).src='grfx/'+str;
}

function toolTip(str,d){
	obj=MM_findObj('tooltip');
	if(d==0)
		obj.style.visibility='hidden';
	else
		{
		getCoords();
		obj.style.left=(m.x+20)-MM_findObj("maincontainer").offsetLeft;
		obj.style.top=m.y;
		obj.innerHTML=str;
		obj.style.visibility='visible';
		}
}

function expandMod(k,n){
	if(m.wait==1)
		return;
	m.wait=1;
	
	eval('m.modbox'+k+'_'+n+'.wait=1');
	vel=1.5*Math.sqrt(m.data[k][2+n]);

	if(n==m.active_mod)
		{
		animLS('m.modbox'+k+'_'+n,'height',-vel,-1,1,15);
		m.q=1;
		}
	else
		{
		animLS('m.modbox'+k+'_'+n,'height',vel,1,1,m.data[k][2+n]);
		if(m.active_mod>-1){
			eval('m.modbox'+m.active+'_'+m.active_mod+'.wait=1');
			vel2=1.5*Math.sqrt(m.data[m.active][2+m.active_mod]);
			animLS('m.modbox'+m.active+'_'+m.active_mod,'height',-vel2,-1,1,15);
			}
		m.active_mod=n;
		}
}

function expand(n){
	if(m.wait==1)
		return;
	m.wait=1;

	eval('m.box'+n+'.wait=1');
	tH=m.data[n][1];
	vel=1.5*Math.sqrt(tH);
	
	if(n==m.active)
		{
		animLS('m.box'+n,'height',-vel,-1,1,15);
		if(m.active_mod>-1)
			{
			MM_findObj('modbox'+m.active+'_'+m.active_mod).style.height=15;
			m.active_mod=-1;
			}
		m.data[n][0]=15;
		m.active=-1;
		}
	else
		{
		animLS('m.box'+n,'height',vel,1,1,tH);
		m.data[n][0]=tH;
		if(m.active>-1)
			{
			eval('m.box'+m.active+'.wait=1');
			vel2=1.5*Math.sqrt(m.data[m.active][1]);
			animLS('m.box'+m.active,'height',-vel2,-1,1,15);
			if(m.active_mod>-1)
				{
				MM_findObj('modbox'+m.active+'_'+m.active_mod).style.height=15;
				m.active_mod=-1;
				}
			m.data[m.active][0]=15;
			}
		m.active=n;
		}
}

function test(){
	if(onPage<0)
		return;
	
	//do height stuff
	if(!(m.active<0 || m.active_mod<0))
		{
		lyr='m.box'+m.active+'.style';
		mod='m.modbox'+m.active+'_'+m.active_mod+'.style';
		eval(lyr+'.height=m.data[m.active][0]+parseInt('+mod+'.height)-19');
		}
}

function scrollTest(){
	lyr=MM_findObj('leftpanel');
	m.H=lyr.offsetHeight;

	if(m.H>m.hh-135 && m.activate!=1) setupScroll(1);
	if(m.H<=m.hh-135 && m.activate!=0) setupScroll(0);
	
	lpt=parseInt(MM_findObj('leftpanel').style.top);
	if(m.activate==1){ //make sure the content doesn't zoom off the top of the scroll
		if((lpt+m.H)<(m.hh-135)) MM_findObj('leftpanel').style.top=(m.hh-115)-m.H;
	}
	else if(lpt<0) MM_findObj('leftpanel').style.top=0;
	
	//move the scroll tab
	if(m.activate==1){
		scrtab_lyr=MM_findObj('scrolltab');
		h=m.hh-135;scalefactor=h/(m.H-h);
		scrtab_lyr.style.top=-scalefactor*m.scr_real;
	}
}

function layout(){
	m.hh=document.body.clientHeight;
	MM_findObj('leftpanelcontainer').style.height=m.hh-135;
	MM_findObj('scrollcontainer').style.height=m.hh-135;
}

function processData(){
	m.data=new Array();

	for(i=0;i<=onPage;i++)
		{
		m.data[i]=new Array();
		lyr=MM_findObj('box'+i+'inner');
		lyr2=MM_findObj('box'+i);

		m.data[i][1]=18+lyr.offsetHeight+(1+mods[i])*17;
		eval('m.box'+i+'=lyr2');
		eval('m.box'+i+'.wait=0');
		
		if(mods[i]>-1)
			for(j=0;j<=mods[i];j++)
				{
				lyr=MM_findObj('mod'+i+'_'+j+'inner');
				lyr2=MM_findObj('modbox'+i+'_'+j);
				m.data[i][2+j]=15+lyr.offsetHeight;
				eval('m.modbox'+i+'_'+j+'=lyr2');eval('m.modbox'+i+'_'+j+'.wait=0');
				}
		}

	MM_findObj('leftpanelcontainer').style.visibility='visible';

	if(obj=MM_findObj('contentEntry'))
		{
		idV=obj.insertID.value;
		if(idV!=-1)
			{
			MM_findObj('formwarning').innerHTML="[submitting as annotation "+(mods[idV]+2)+" to '"+MM_findObj('boxtitle'+idV).innerText+"']";
			}
		}
}

function doStuff(init){

	m=new Object();
	layout();

	m.active=-1;m.active_mod=-1;m.wait=0;m.activate=0;m.scrolling=0;m.scr_real=0;m.q=0;
	m.formValues=new Array();
	ddActive=0;
	
	if(onPage>-1)
		{
		setInterval('test()',15);
		processData();
		}
	setInterval('scrollTest()',15);
}
//-->
