var tn = new Image();
var timeOut = new Array();
var countries = new Array('fr','be','ch','es','ca','lu','uk');

function $(I) { return document.getElementById(I); }
function _(O,V) { O.innerHTML = V; }

function thumbs() {
	p = tn.src.substring(11).split(new RegExp('[./]+','g'));
	dl = new Image();
	dl.src = tn.src.replace(new RegExp('/([0-9]+)[.]','g'),'/'+((p[p.length-2] >= 12) ? 1:parseInt(p[p.length-2])+1)+'.');
	if(dl.complete) {
		tn.src = dl.src;
		timeOut['tn'] = window.setTimeout(function () { thumbs(); },600);
	}
	else {
		timeOut['tn'] = window.setTimeout(function () { thumbs(); },100);
	}
}

img = document.getElementsByTagName('img');
a = document.getElementsByTagName('a');

for(i in img) {
	if(img[i].className == 'thumb') {
		img[i].onmouseover = function () {
			tn = this;
			timeOut['tn'] = window.setTimeout(function () { thumbs(); },100);
		}
		img[i].onmouseout = function () {
			clearTimeout(timeOut['tn']);
		}
	}
}

if($('thumbs')) {
	for(i in countries) {
		$(countries[i]).onclick = function () {
			window.open(this.href,'phone','toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0,copyhistory=0,menuBar=0,width=310,height=340');
			return false;
		}
	}
}

for(i in a) {
	if(a[i].className == 'bookmark') {
		a[i].onclick = function() {
			if(navigator.appName != 'Microsoft Internet Explorer' ) window.sidebar.addPanel('PornTubeAmateur.com - Vidéos porno amateur avec extraits gratuits !','http://www.porntubeamateur.com/','');
			else window.external.AddFavorite('http://www.porntubeamateur.com/','PornTubeAmateur.com - Vidéos porno amateur avec extraits gratuits !');
			return false;
		}
	}
}