window.onload=init
window.onresize=init
function init(){
	placeClipBox()
	animate()
}

function placeClipBox(){
	var anim=document.getElementById("animateBox") 
	if(!anim) return false
	var mid=parseInt(getWinWidth()/2)
	anim.style.left=mid-230
}

animStartLeft=0
animEndLeft=280
animDelta=2
speed=20
direction=1
function animate(){
	if(!window.currAnimLeft) currAnimLeft=animStartLeft
	if(currAnimLeft >= animEndLeft) direction=0
	if(currAnimLeft <= animStartLeft) direction=1
	
	if(direction) currAnimLeft+=animDelta
	else currAnimLeft -= animDelta
	
	var bar=document.getElementById("light")
	if(!bar) return false
	
	pLeft=currAnimLeft - 380 
	bar.style.left= pLeft + "px"

	if(window.animTimer)clearTimeout(animTimer)
	animTimer=setTimeout("animate()",speed)
	
}

function getWinWidth(){return window.innerWidth || document.body.clientWidth}

