var img1 = new Image();
img1.src = "http://www.banik.com/images/icons/arrow_tween.gif";
var img2 = new Image();
img2.src = "http://www.banik.com/images/icons/arrow_close.gif";
var img3 = new Image();
img3.src = "http://www.banik.com/images/icons/arrow_open.gif";

// ANIMATE THOSE ARROWS!!
function movedn(id)
{
  document.getElementById(id).className = 'arrow_open';
}
function moveup(id)
{
  document.getElementById(id).className = 'arrow_close';
}
function animateMe(id,dir)
{
	var myid = id;
	if(dir == 'up')
	{
		document.getElementById(id).className = 'arrow_tween';
		setTimeout('movedn(\"'+ id +'\")',70);
	}
	if(dir == 'down')
	{
		document.getElementById(id).className = 'arrow_tween';
		setTimeout('moveup(\"'+ id +'\")',70);
	}
}

/*
#########################################################
# FUNCTION NAME: showhide(theLayer,theTable)
#########################################################
# REQUIREMENTS:
#   The content in the DIV must be inside of an HTML
#   table in order to properly define the final height.
# ------------------------------------------------------
# DESCRIPTION:
#   Show/Hide a DIV layer by animating the height.
#########################################################
*/

// Define some generic variables
var y = 0;
var q = 30;
var g = 0;
var movespeed = 50;

// Write the function, yo
function showhide(theLayer,theTable)
{
	if(document.getElementById(theLayer).style.display == "none")
		document.getElementById(theLayer).style.display = "";
	else
		document.getElementById(theLayer).style.display = "none";
/*
	// Close the DIV
	if(y > document.getElementById(theTable).clientHeight && g==0)
    {
        g = 1;
        return;
    }
    // Open the DIV
	if(y < 1 && g==1)
    {
        g = 0;
        return;
    }
    // Close Speed
	if(g)
    {
        q = -30;
    }
   // Open Speed
   if(!g)
    {
        q = 30;
    }
    y = y + q;
    e = document.getElementById(theLayer);
    e.style.height = y + 'px';
	if(y == 0)
	{
		e.style.display = "none";
	}
	else
	{
		e.style.display = "";
	}
    
	// Run that timer, yo
	t=setTimeout(function(){showhide(theLayer,theTable)},20);
*/
}

/*
#########################################################
# FUNCTION NAME: nScale(integer, profile)
#########################################################
# DESCRIPTION:
#   This produces the "easing" effect
#########################################################
*/
function nScale(integer, profile)
{
var n, a, u, excess, i = ii = 0, negative = integer < 0;

integer = Math.floor(Math.abs(integer));

return {ascend:ascend, descend:descend, plateau:plateau}[profile]();

function ascend(){
return scale(integer);}

function descend(){
return scale(integer).reverse();}

function plateau()
{
a = scale(Math.round(integer / 2)).concat(a.slice().reverse());
if(ii * 2 > integer)
{
n = Math.round(a.length / 2);
while(a[n + 1] == a[n])
++n;
if(!(a[n] += (negative ? 1 : -1)))
a.splice(n, 1);
}
return a;
}

function scale(num)
{
a = [];
while(ii < num)
{
ii += ++i;
a.push(i);
}
if(ii > num)
{
excess = ii - num;
ii -= excess;
n = a.length - 1;
while(excess)
{
u = --n;
while(a[u + 1])
{
if(excess)
{
a[u + 1] -= 1;
--excess;
}
else
break;
++u;
}
}
}
if(negative)
{
n = a.length;
while(n--)
a[n] = -a[n];
}
return a;
}
}

/*
#########################################################
# FUNCTION NAME: toggleH(layer, profile)
#########################################################
# DESCRIPTION:
#   This produces the "easing" effect
#########################################################
*/
var timeout, height1 = false;
function toggleH(theLayer,theTable, prof)
{
clearTimeout(timeout);
var eStyle = document.getElementById(theLayer).style;
var tHeight = document.getElementById(theTable).clientHeight;
var n = (eStyle.height1 ? 0 : tHeight);
var extent = (height1 ? 0 - 1 : tHeight - 2);
height1 = !height1;
var x = extent - n;
if(x)
{
var scale = nScale(x, prof);
function repeat()
{
if(scale.length)
{
n += scale.shift();
eStyle.height = n + "px";
timeout = setTimeout(repeat, 15);
}
}
repeat();
}
}
