var transition = false, x1, x2, y1, y2, step, timer, steps = 50;

function effect(o) {
	if(transition == true) return;
	if(!o.checked) return;
	transition = true;
	$kk('mover').style.left = getX(o);
	$kk('mover').style.top = getY(o);
	$kk('mover').style.visibility = 'visible';
	x1 = $kk('mover').offsetLeft;
	y1 = $kk('mover').offsetTop;
	x2 = x1 + getX($kk('destination')) - getX(o);
	y2 = y1 + getY($kk('destination')) - getY(o);
	step = 0;
	timer = setInterval("animation()", 10);
}

function animation() {
	step++;
	if(step >= steps) {
		clearInterval(timer);
		$kk('mover').style.visibility = 'hidden';
		transition = false;
	}
	x = x1 + (x2-x1) * (step/steps);
	y = y1 + (y2-y1) * (step/steps);
	$kk('mover').style.left = x;
	$kk('mover').style.top = y;
}

function $kk(s) {
	return document.getElementById(s);
}

function getX(o) {
	var t = 0;
	while(o != null) {
		t += o.offsetLeft;
		o = o.offsetParent;
	}
	return t;
}

function getY(o) {
	var t = 0;
	while(o != null) {
		t += o.offsetTop;
		o = o.offsetParent;
	}
	return t;
}

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}


