var offW = 50;
var offH = 50;
//var winW = screen.width;
//var winH = screen.height;
var winW = (typeof window.innerWidth != 'undefined')? window.innerWidth: document.documentElement.clientWidth;
var winH = (typeof window.innerHeight != 'undefined')? window.innerHeight: document.documentElement.clientHeight;
var randx = 0;
var randy = 0;
var timer=null;
var timer2=null;
function cellTimer(){
	clearTimeout(timer);
	clearTimeout(timer2);
	randx = Math.floor(Math.random()*5+1);
	randy = Math.floor(Math.random()*5+1);
	createDiv()
}
function createDiv() {
	var newCel = document.createElement("div");
	newCel.id = "cel";
	newCel.style.width = "40px";
	newCel.style.height = "40px";
	newCel.style.background = "none transparent";
	newCel.style.position = "fixed";
	newCel.style.zIndex = "999";
	newCel.style.top = "10px";
	newCel.style.left = "10px";
	//newCel.innerHTML = "<img src='bloedcel.gif' alt='bloedcel' id='img' style='width:0px;height:0px;'/>";
	newCel.innerHTML = "<object id='img' style='width:0px;height:0px;' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='100%' height='100%' align='center' ><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='flash/bloedcel.swf' /><param name='quality' value='best' /><param name='wmode' value='transparent' /><embed src='flash/bloedcel.swf' quality='best' width='100%' height='100%' name='bloedcel' align='center' wmode='transparent' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/></object>";
	document.body.appendChild(newCel);
	moveObj();
}
function setOpacity(value) {
	testObj.style.opacity = value/10;
	testObj.style.filter = 'alpha(opacity=' + value*10 + ')';
}
function removeDiv() {
	var olddiv = document.getElementById('cel');
	document.body.removeChild(olddiv);
	timer2=setTimeout("cellTimer()",8000);
}
function moveObj() {
	var widthLimit = winW;
	var heightLimit = winH;
	if (document.getElementById('cel')) {
		var widthHuidig = document.getElementById('cel').style.left;
		var heightHuidig = document.getElementById('cel').style.top;
		var imgHuidig = document.getElementById('img').style.width;
		widthHuidig = parseInt(widthHuidig.replace("px",""));
		heightHuidig = parseInt(heightHuidig.replace("px",""));
		imgHuidig = parseInt(imgHuidig.replace("px",""));
	}
	var widthNew = widthHuidig + parseInt(randx);
	var heightNew = heightHuidig + parseInt(randy);
	if ((widthHuidig < -10) || (heightHuidig <-10)) {
		clearTimeout(timer);
		removeDiv();
		return;
	}
	if (widthHuidig >= (widthLimit) || heightHuidig >= (heightLimit)) {
		clearTimeout(timer);
		if ((randx>0) && (randy>0)) {
			if (widthHuidig >= (widthLimit)) {
				randx=-randx;
				widthNew=widthHuidig-40;
			} else {
				randy=-randy;
				heightNew=heightHuidig-20;
			}
                } else {
			removeDiv();
			return;
		}
	}
	if (imgHuidig < 50) {
		var imgwh = imgHuidig + 1;
	} else {
		var imgwh = imgHuidig;
	}
	if (document.getElementById('cel')) {
		document.getElementById('img').style.width = imgwh+"px";
		document.getElementById('img').style.height = imgwh+"px";
		document.getElementById('cel').style.left = widthNew+"px";
		document.getElementById('cel').style.top = heightNew+"px";
	}
	timer=setTimeout("moveObj()",40);
}