/*
*		BEWEGINGEN SCRIPTS
*/
var balkBreedte = 20;
var startBreedte = 20;
var movingElement;
var movingElementId;
var movingElementWidth;
var movingElementLeft;
var movingElementLeftStart;
var movingElementLeftCurrent;
var movingElementStart;
var movingElementCurrent;
var movingElementStartSpeed;
var movingElementCurrentSpeed;
var movingElementDirection;
var movement;
var imageVar;
var movingElementWidthStart;
var movingElementLeftStart;

movingElementWidthStart = 264;
movingElementLeftStart = 752;

function createCookie( ) {
	var expires = "";
	var moverStatus = 0;

	if (document.getElementById('movingsearchbar')!=null)
	{
		mover = document.getElementById('movingsearchbar').style;
		if(mover.width!="20px")
			moverStatus = 1;
	}
	document.cookie = "webfxtab_tabPane1=" + currentTab + "-" + moverStatus + expires + "; path=/";
}


function startMoving()
{
	movingElement = document.getElementById('movingsearchbar').style;
	movingElementWidth = movingElementWidthStart;
	movingElementLeft = movingElementLeftStart;
	movingElementLeftStart=movingElementLeft;
	imageVar=document.getElementById('zoekbtn');
	if(movingElement.width==startBreedte + 'px')
	{
		movingElementDirection = 'right';
		movingElementLeftCurrent = movingElementLeft + movingElementWidth;
		movingElementWidthCurrent = 0;
		imageVar.src = "/lib/images/zoeksluiten.gif";
	}
	else
	{
		movingElementDirection = 'left';
		movingElementLeft = movingElementLeft - movingElementWidth
		movingElementLeftCurrent = movingElementLeft;
		movingElementWidthCurrent = movingElementWidth;
		imageVar.src = "/lib/images/zoekopen.gif";
	}
	movingElementStartSpeed = 20;
	movingElementCurrentSpeed = movingElementStartSpeed;
	movement = setInterval("newMoving()",1);
}

function newMoving()
{
	if(movingElementDirection=="right")
	{
		if(movingElementWidthCurrent<movingElementWidth)
		{
			if(movingElementWidth-movingElementWidthCurrent>=balkBreedte+movingElementCurrentSpeed)
			{
				movingElementWidthCurrent +=  movingElementCurrentSpeed;
				movingElementLeft -= movingElementCurrentSpeed;
				movingElement.width = (movingElementWidthCurrent+balkBreedte) + "px";
				movingElement.left = movingElementLeft + "px";
			}
			else
			{
				movingElementLeft -= movingElementWidth-movingElementWidthCurrent;
				movingElementWidthCurrent =  movingElementWidth;
				
				movingElement.width = movingElementWidthCurrent + "px";
				movingElement.left = movingElementLeft+ balkBreedte + "px";
				createCookie();
				clearInterval(movement);
			}
		}
	}
	else if(movingElementDirection=="left")
	{
		if(movingElementWidthCurrent>=movingElementCurrentSpeed && movingElementWidthCurrent > balkBreedte+movingElementCurrentSpeed)
		{
			movingElementWidthCurrent -=  movingElementCurrentSpeed;
			movingElementLeft += movingElementCurrentSpeed;
			movingElement.width = movingElementWidthCurrent + "px";
			movingElement.left = (movingElementLeft+balkBreedte) + "px";
		}
		else
		{	
			movingElement.width = startBreedte + "px";
			movingElement.left = movingElementLeftStart + "px";
			createCookie();
			clearInterval(movement);
		}
	}
}