var _sethomepage = 0;
var _setbookmark = 0;
var animpos = 0;

function setanim(s)
{
var wl = 0;
var wt = 0;
var ww = 220;
var wh = 170;

var tx = 0;
var ty = 0;

var tx2 = 0;
var ty2 = 0;
var tx3 = 0;
var ty3 = 0;

var animposx = 382;
var animposy = -370;

var obj = document.getElementById('tha');
if (obj)
	{
	var pw = parseInt(obj.offsetWidth);
	var ph = parseInt(obj.offsetHeight);

	tx = -s + ww;
	ty = (s / 15) - 20;

	tx2 = wl - tx;
	if (tx2 < 0) tx2 = 0;
	ty2 = wt - ty;
	if (ty2 < 0) ty2 = 0;

	tx3 = ww - tx;
	if (tx3 > pw) tx3 = pw;
	ty3 = wh - ty;
	if (ty3 > ph) ty3 = ph;

// top, right, bottom, and left 
	obj.style.clip = 'rect(' + ty2 + ' ' + tx3 + ' ' + ty3 + ' ' + tx2 + ')';

	tx = animposx + tx;
	ty = animposy + ty;

	obj.style.marginLeft = tx + 'px';
	obj.style.marginTop = ty + 'px';
	}
}

function timer1()
{
setanim(animpos);
animpos += 10;
if (animpos > 1000) animpos = 0;
}

function animinit()
{
animpos = 0;
var obj = document.getElementById('tha');
if (obj)
	{
	obj.style.clip = 'rect(0 0 0 0)';
	obj.style.visibility = 'visible';
	}

setInterval(timer1, 50);
}

function email(obj)
{
var txt = obj.href;
if (txt.substr(7, 4) == 'info') return true;
obj.href = 'mailto:' + txt.substr(7).split("").reverse().join("");
return true;
}

function ask()
{
return confirm('You are about to report this gallery as a broken link. Continue?');
}

function addBookmark(title, url)
{
if (window.sidebar)
	{
	window.sidebar.addPanel(title, url,"");
	}
  else
	{
	if (document.all)
		{
		window.external.AddFavorite(url, title);
		}
	  else
		{
		if (window.opera && window.print)
			{
			return true;
			}
		}
	}

if (_setbookmark == 0)
	{
	var obj = document.getElementById('blframe');
	if (obj)
		{
		obj.src = 'hf.php?act=f';
		}
	}

_setbookmark = 1;
}

function sethomepage()
{
if (document.all)
	{
	document.body.style.behavior = 'url(#default#homepage)'; 
	document.body.sethomepage('http://babezhunter.com');
	}
  else
	{
	alert('Your browser don\'t support this function.\nIf you would set BabezHunter as your Homepage, you can do this in the menuitem Tools/Options .');
	}

if (_sethomepage == 0)
	{
	var obj = document.getElementById('blframe');
	if (obj)
		{
		obj.src = 'hf.php?act=h';
		}
	}

_sethomepage = 1;
}

window.onload = animinit;
