function blur_pos(pos) {
	if (pos)
		pos=parseInt(pos.replace('px',''));
	else
		pos=0;
	var newpos=pos+Math.floor(Math.random()*3)-1;
	if ((Math.abs(newpos)>Math.abs(maxblur*blur)) && (Math.abs(newpos)>Math.abs(pos))) newpos=pos;
	return newpos+'px';
}

function blur_obj(id) {
	var obj=document.getElementById(id);
	if(obj) {
		obj.style.left=blur_pos(obj.style.left);
		obj.style.top=blur_pos(obj.style.top);
	}
}

function blur_all() {
	for(i=1;i<=blur_count;i++)
		blur_obj('blur_'+i);
}

function blur_on() {
	blur=1;
}

function blur_off() {
	blur=0;
}

function glare_move(id,pos,inc,left,right,time) {
	var obj=document.getElementById(id);
	if (obj) {
		if (pos<right) {
			obj.style.left=pos+"px";
			var rect_left=0;
			if (pos<left) rect_left=left-pos;
			var rect_right=right-pos;
			obj.style.clip="rect(0px,"+rect_right+"px,95px,"+rect_left+"px)";
			setTimeout('glare_move("'+id+'",'+(pos+inc)+','+inc+','+left+','+right+','+time+')',time);
		} else {
			setTimeout('glare_move("'+id+'",'+(left-120)+','+inc+','+left+','+right+','+time+')',1000+Math.random()*10000);
		}
	}
}

var blur_count=2;
var maxblur=4;
var blur=0;
setInterval('blur_all()',30);
blur_on();

glare_move("glare_lutein",1000,3,3,182,10);
glare_move("glare_products",1000,3,158,312,10);

