// ======================================================
// script: Gerard Ferrandez - ge1doot - October 19, 1999
// DOM crossbrowser version - April 17th, 2006
// http://www.dhteumeuleu.com
// ======================================================

var r  = 0.5;
var ps = 0.5;
var k  = 0;
var xm = 0;
var ym = 0;
var dx = 0;
var dy = 0;
var nx = 0;
var ny = 0;

function trn() {
	k++;
	w = nx+Math.abs(dx)+r+(Math.sin(k*ps)*r);
	h = ny+Math.abs(dy)+r+(Math.cos(k*ps)*r);
	with(document.getElementById("theimg").style){
		width  = Math.round(w)+"px";
		left   = Math.round(dx*.5+(nx-w)*.5)+"px";
		height = Math.round(h)+"px";
		top    = Math.round(dy*.5+(ny-h)*.5)+"px";
		dx += (xm-dx)/(w*.2);
		dy += (ym-dy)/(h*.2);
	}
	setTimeout("trn()", 1);
}

function resize(){
	nx = document.body.offsetWidth;
	ny = document.body.offsetHeight;
	r  = nx*.5;
	ps = 5/r;
	with(document.getElementById("thetrou").style){
		width  = nx+"px";
		height = ny+"px";
	}
}
onresize = resize;

document.onmousemove = function(e){
	if (!e) e = window.event;
	xm = (e.x || e.clientX) - nx*.5;
	ym = (e.y || e.clientY) - ny*.5;
}

onload = function(){
	resize();
	trn();
}
