function fx_bump_init()
{
	document.fx_bump_w	= 64+8*0
	document.fx_bump_h	= 48+6*0
	document.fx_bump_imgDataIso	= buildBmp8Header( document.fx_bump_w, document.fx_bump_h )
	document.fx_bump_displace	= []

	var
		i,j,
		w = document.fx_bump_w
		h = document.fx_bump_h
		bottomLine = w*h
		tmp=[]
		str = ""


	// create elevation map
/*
	for( i=0; i<bottomLine; i++ )
		tmp[ i ] = Math.floor( Math.random()*255 )

	for( var j=0; j<0; j++ )
		for( i=0; i<bottomLine; i++ )
			tmp[ i ] = ( tmp[ i ]+tmp[ (i+1)%bottomLine ]+tmp[ (i+w)%bottomLine ]+tmp[ (i+w+1)%bottomLine ] )>>2
/*/

	str += "                "
	str += "  a  a          "
	str += "       a aa  a  "
	str += "                  "
	str += "aa   aa  a  a  "
	str += " a a a a  a   a "
	str += " a a aa   a  aa "
	str += " a a a    a a a "
	str += " a a  aa a  aa a"
	str += "                  "
	str += "   a         a  "
	str += " a    a aa     a"
	for( i=0; i<bottomLine; i++ )
	{
		if( str.charAt( (Math.floor( (i%w)*16/w  )+Math.floor( (i/w)*12/h  )*16)%str.length )==" " )
			tmp[ i ] = Math.floor( Math.random()*64 )
		else
			tmp[ i ] = Math.floor( Math.random()*64 )+192
	}
//*/


	// smooth elevation map
	for( var j=0; j<2; j++ )
		for( i=0; i<bottomLine; i++ )
			tmp[ i ] = ( tmp[ i ]+tmp[ (i+1)%bottomLine ]+tmp[ (i+w)%bottomLine ]+tmp[ (i+w+1)%bottomLine ] )>>2

	// create normal map
	for( i=0; i<bottomLine; i++ )
		document.fx_bump_displace[ i ] = ( 128+tmp[ i ]-tmp[ (i+1)%bottomLine ] )*256+( 128+tmp[ i ]-tmp[ (i+w)%bottomLine ] )
//*/


	progressBarIndex++
}

function fx_bump_update( time, extraArguments )
{
	var
		i,j,k,n,
		xLight,yLight,xEnd,yEnd,xTmp,yTmp
		w				= document.fx_bump_w
		h				= document.fx_bump_h
		imgDataIso		= document.fx_bump_imgDataIso
		bumpDisplace	= document.fx_bump_displace,
		bottomLine		= w*h,
		rOffset=64+64*Math.cos(time/4096),
		gOffset=64+64*Math.cos(time/4096+Math.PI*2/3),
		bOffset=64+64*Math.cos(time/4096+Math.PI*4/3)


	n = -84
	for( i=0;i<128;i++)
	{
		j = i*4
		if( ++n>0 )
			j += n*32
		imgDataIso += byteToIsoArray[ Math.max(0,Math.min(255,j-bOffset))&255 ]+ byteToIsoArray[ Math.max(32,Math.min(255,j-gOffset))&255 ]+ byteToIsoArray[ Math.max(64,Math.min(255,j-rOffset))&255 ]+ "\0"
	}
	imgDataIso += "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"


	i		= 0
	if( mouse.hover )
	{
		xLight	= -w*mouse.x*8-128
		yLight	= -h*mouse.y*8-128
	}
	else
	{
		xLight	= w*4*(Math.cos(time/2048)-1)-128
		yLight	= h*4*(Math.sin(time/3072)-1)-128
	}
	xEnd	= xLight+w*8
	yEnd	= yLight+h*8
	k = 96
	kk = 1.0/(1536+512*Math.cos(time/404))
	for( y=yLight; y<yEnd; y+=8)
	{
		j = 31*i/bottomLine
		for( x=xLight; x<xEnd; x+=8,i++ )
		{
			xTmp = x+(bumpDisplace[ i ]>>8 )
			yTmp = y+(bumpDisplace[ i ]&255)
			imgDataIso += byteToIsoArray[ Math.max( j, 96-(xTmp*xTmp+yTmp*yTmp)*kk )&255 ]
		}
	}

	customImageHandle.src	= imgDataIso
}

function fx_bump_destroy()
{
}