﻿/* NORMAL DRAWER FUNCTIONS */

var sDiv="";
var inEm = 9.8;
var mClick = 1;
var closeInEm = 0;

function toggleDrawer(divId, buttonId, cBlockId)
{

	sDiv = document.getElementById(divId);
	var button = document.getElementById(buttonId);
	var handle = document.getElementById(cBlockId);
			
	
	if(mClick==1)
	{
		
		if (sDiv.style.height=="auto")
		{
			sDiv.style.overflow="hidden";
			sDiv.style.height="9.8em";
			button.src="img/drawer_expand_btn.gif";
			button.alt="Open";
			//sDiv.title=="Open";
			//sDiv.style.cursor=="pointer";
			handle.title="Open";			
		}
		else
		{
			toggleDrawerAnim(divId);
			button.src="img/drawer_close_btn.gif";
			button.alt="Close";
			//sDiv.title=="Close";
			//sDiv.style.cursor=="default";
			handle.title="Close";
		}
	}
}

function toggleDrawerAnim(){
	if (sDiv.offsetHeight < (sDiv.scrollHeight-9.8))
	{
		sDiv.style.height=(inEm + "em")
		inEm+=1.4;
		setTimeout("toggleDrawerAnim()","9.8")
	}
	else
	{
		sDiv.style.height="auto";
		sDiv.style.overflow="visible"
		inEm = 9.8;
	}
}


/* TABLE DRAWER FUNCTION */

var table_sDiv="";
var table_inEm = .1;
var table_mClick = 1;
var table_closeInEm = 0;

function toggletableDrawer(divId, buttonId, cBlockId)
{

	table_sDiv = document.getElementById(divId);
	var button = document.getElementById(buttonId);
	var handle = document.getElementById(cBlockId);
			
	
	if(table_mClick==1)
	{
		
		if (table_sDiv.style.height=="auto")
		{
			table_sDiv.style.overflow="hidden";
			table_sDiv.style.height=".1em";
			button.src="img/drawer_expand_table_btn.gif";
			button.alt="Open";
			//table_sDiv.title=="Open";
			//table_sDiv.style.cursor=="pointer";
			handle.title="Open";			
		}
		else
		{
			toggleTableDrawerAnim(divId);
			button.src="img/drawer_close_table_btn.gif";
			button.alt="Close";
			//table_sDiv.title=="Close";
			//table_sDiv.style.cursor=="default";
			handle.title="Close";
		}
	}
}

function toggleTableDrawerAnim(){
	if (table_sDiv.offsetHeight < (table_sDiv.scrollHeight-.1))
	{
		table_sDiv.style.height=(table_inEm + "em")
		table_inEm+=1.4;
		setTimeout("toggleTableDrawerAnim()",".1")
	}
	else
	{
		table_sDiv.style.height="auto";
		table_sDiv.style.overflow="visible"
		table_inEm = .1;
	}
}


/* PRACTICE DRAWER FUNCTION */

var practice_sDiv="";
var practice_inEm = .1;
var practice_mClick = 1;
var practice_closeInEm = 0;

function togglePracticeDrawer(divId, buttonId, cBlockId)
{

	practice_sDiv = document.getElementById(divId);
	var button = document.getElementById(buttonId);
	var handle = document.getElementById(cBlockId);
			
	
	togglePracticeDrawerAnim(divId);
	handle.style.display = "none";
}

function togglePracticeDrawerAnim(){
	if (practice_sDiv.offsetHeight < (practice_sDiv.scrollHeight-.1))
	{
		practice_sDiv.style.height=(practice_inEm + "em")
		practice_inEm+=1.4;
		setTimeout("togglePracticeDrawerAnim()",".1")
	}
	else
	{
		practice_sDiv.style.height="auto";
		practice_sDiv.style.overflow="visible"
		practice_inEm = .1;
	}
}

