var IE = false;
try {
	IE = ie;
} catch(e) {}

if (!IE) {
	
var positions = new Array();
var running = new Array();
var myTimer1;
var myTimer2;
var myTimer3;
var myTimer4;
	
window.addEvent('domready', function(){

	positions[0] = "25 50";	
	positions[1] = "70 50";	
	positions[2] = "50 50";
	positions[3] = "50 50";
		
	var box1 = document.getElementById('teaserBox_4_1');
	box1.style.backgroundPosition = "25% 50%";
	box1.style.cursor = "pointer";
	
	var box2 = document.getElementById('teaserBox_4_2');
	box2.style.backgroundPosition = "70% 50%";
	box2.style.cursor = "pointer";
	
	var box3 = document.getElementById('teaserBox_4_3');
	box3.style.backgroundPosition = "50% 50%";
	box3.style.cursor = "pointer";
	
	var box4 = document.getElementById('teaserBox_4_4');
	box4.style.backgroundPosition = "50% 50%";
	box4.style.cursor = "pointer";
	
	var roll1 = new Fx.Style('teaserBox_4_1','background-position', {duration: 500, onComplete: function() {running[0] = false;},unit: '%',transition: Fx.Transitions.linear});
	var roll2 = new Fx.Style('teaserBox_4_2','background-position', {duration: 500, onComplete: function() {running[1] = false;},unit: '%',transition: Fx.Transitions.linear});
	var roll3 = new Fx.Style('teaserBox_4_3','background-position', {duration: 500, onComplete: function() {running[2] = false;},unit: '%',transition: Fx.Transitions.linear});
	var roll4 = new Fx.Style('teaserBox_4_4','background-position', {duration: 500, onComplete: function() {running[3] = false;},unit: '%',transition: Fx.Transitions.linear});
	
	var restorePos1 = function(){ roll1.start(this.style.backgroundPosition, positions[0]); };
	var restorePos2 = function(){ roll2.start(this.style.backgroundPosition, positions[1]); };
	var restorePos3 = function(){ roll3.start(this.style.backgroundPosition, positions[2]); };
	var restorePos4 = function(){ roll4.start(this.style.backgroundPosition, positions[3]); };
		
	$('teaserBox_4_1').addEvent('mousemove', function(e) {
			$clear(myTimer1);			
			e = new Event(e);
			var myObj = document.getElementById('teaserBox_4_1');
			var coord = findElementCoords(myObj);						
			var x = Math.abs(((e.client.x - coord[0]) / 2.4));
			var y = Math.abs(((e.client.y - coord[1]) / 2.4));			
			if (running[0]) {
				roll1.stop();
			}
			running[0] = true;
			roll1.start(myObj.style.backgroundPosition, x + " " + y );			
			e.stop();
	});
	$('teaserBox_4_1').addEvent('mouseout', function(e) {						
			myTimer1 = restorePos1.delay(2000, document.getElementById('teaserBox_4_1'));					
	});

	$('teaserBox_4_2').addEvent('mousemove', function(e) {
			$clear(myTimer2);			
			e = new Event(e);
			var myObj = document.getElementById('teaserBox_4_2');
			var coord = findElementCoords(myObj);						
			var x = Math.abs(((e.client.x - coord[0]) / 2.4));
			var y = Math.abs(((e.client.y - coord[1]) / 2.4));			
			if (running[1]) {
				roll2.stop();
			}
			running[1] = true;
			roll2.start(myObj.style.backgroundPosition, x + " " + y );
			e.stop();
	});
	$('teaserBox_4_2').addEvent('mouseout', function(e) {
		myTimer2 = restorePos2.delay(2000, document.getElementById('teaserBox_4_2'));			
	});
	
	$('teaserBox_4_3').addEvent('mousemove', function(e) {
			$clear(myTimer3);			
			e = new Event(e);
			var myObj = document.getElementById('teaserBox_4_3');
			var coord = findElementCoords(myObj);						
			var x = Math.abs(((e.client.x - coord[0]) / 2.4));
			var y = Math.abs(((e.client.y - coord[1]) / 2.4));			
			if (running[2]) {
				roll3.stop();
			}
			running[2] = true;
			roll3.start(myObj.style.backgroundPosition, x + " " + y );			
			e.stop();
	});
	$('teaserBox_4_3').addEvent('mouseout', function(e) {
		myTimer3 = restorePos3.delay(2000, document.getElementById('teaserBox_4_3'));			
	});
	
	$('teaserBox_4_4').addEvent('mousemove', function(e) {
			$clear(myTimer4);			
			e = new Event(e);
			var myObj = document.getElementById('teaserBox_4_4');
			var coord = findElementCoords(myObj);						
			var x = Math.abs(((e.client.x - coord[0]) / 2.4));
			var y = Math.abs(((e.client.y - coord[1]) / 2.4));			
			if (running[3]) {
				roll4.stop();
			}
			running[3] = true;
			roll4.start(myObj.style.backgroundPosition, x + " " + y );			
			e.stop();
	});
	$('teaserBox_4_4').addEvent('mouseout', function(e) {
		myTimer4 = restorePos4.delay(2000, document.getElementById('teaserBox_4_4'));			
	});
});
}
function findElementCoords(obj) 
{
	var curleft = curtop = 0;
	if (obj.offsetParent) 
	{
		curleft = obj.offsetLeft;
		curtop = obj.offsetTop;
		while (obj = obj.offsetParent) 
		{
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}
	}
	return [curleft,curtop];
}