<!--
// =========================================================================
//                 ===== slide show dhtml =====
// script: Gerard Ferrandez - June 2005
// http://www.dhteumeuleu.com
// 3D Terragen pics: Silus - http://silusatrium.no.sapo.pt/galleries01.html
// =========================================================================

var xm=-100,ym=0,nx=0,ny=0,dx=0,x0=0,y0=0,iz=false,iL=0;
var N,b0,b1,NW,ims,img,imgWidth,imgHeight,borWidth,nxi,nyi,nxo=0,nyo,nho,nxo=0;

el=function(o){	return document.getElementById(o); }

function iZoom(){
	if(!iz){
		with(el("rLinkZoom").style){
			width  = nxi;
			height = nyi;
		}
		iz = true;
		iResize();
		scroll();
	} else {
		iz = false;
		iResize();
		with(el("rLinkZoom").style){
			height = "100%";
			width  = "100%";
			left   = 0;
			top    = 0;
		}
	}
}

function slide(){
	if(!iz){
		dx-=xm/70;
		if(dx>0)dx-=NW; else if(dx<-NW)dx+=NW;
		b0.style.left = Math.round(dx);
		b1.style.left = Math.round(dx+NW);
	}
	setTimeout("slide()",16);
}

function scroll(){
	if(iz){
		xmo = Math.min(nwo,Math.max(0,((-nxo+xm+nx))));
		ymo = Math.min(nho,Math.max(0,((-nyo+ym+ny))));
		x = -xmo*(nxi/nwo)+xmo;
		y = -ymo*(nyi/nho)+ymo;
		x0 += ((x0>x)?-1:1)*Math.abs(x0-x)/10;
		y0 += ((y0>y)?-1:1)*Math.abs(y0-y)/10;
		with(el("rLinkZoom").style){
			left = x0;
			top  = y0;
		}
		setTimeout("scroll()",16);
	}
}

function iResize(){
	if(iz){
		nwo = Math.min(nxi,Math.round(98*nx/50));
		nxo = Math.round(((2*nx)-nwo)/2);
	} else {
		nho = Math.round(parseInt(el("rLinkScreen").style.height)*ny/50);
		nyo = Math.round(parseInt(el("rLinkScreen").style.top)*ny/50);
		nwo = Math.round((nxi/nyi)*nho);
		nxo = Math.round((2*nx-nwo)/2);
	}
	with(el("rLinkScreen").style){
		width = nwo;
		left = nxo;
	}
}

function iBorder(o,i){
	o=o.getElementsByTagName("img");
	o[iL].className="thumbOut";
	o[i].className="thumbOver";
}

function disp(i,title,caption){
	iBorder(b0,i);
	iBorder(b1,i);
	iL=i;
	if(iz)iZoom();
	el("rLinkTitle").innerHTML = title;
	el("rLinkCaption").innerHTML = caption;
	el("rLinkZoom").src = img[i].src;
	nxi = ims[i].width;
	nyi = ims[i].height;
	iResize();
}

function init(obj){
	obj.innerHTML = el("source").innerHTML;
	img = obj.getElementsByTagName("img");
	for(i=0;i<N;i++){
		img[i].className = "thumbOut";
		img[i].style.position = "absolute";
		img[i].style.background = "#444";
		img[i].style.top = 0;
		img[i].onmousedown = new Function("return false;");
		img[i].onclick = new Function("iZoom();");
		img[i].onmouseover = new Function('disp('+i+',"'+img[i].title+'","'+img[i].alt+'");');
		img[i].alt   = "";
		img[i].title = "";
	}
}

function oResize(obj){
	img = obj.getElementsByTagName("img");
	NW = 0;
	for(i=0;i<N;i++){
		w = (ims[i].width/ims[i].height)*imgHeight;
		img[i].style.left = NW;
		NW += w+(2*borWidth);
		img[i].style.width  = Math.max(1,w);
		img[i].style.height = Math.max(1,imgHeight);
		img[i].style.borderWidth   = Math.max(1,borWidth);
	}
}

function resize(){
	nx = document.body.offsetWidth /2;
	ny = document.body.offsetHeight /2;
	borWidth = Math.round(1.4*ny/50);
	imgHeight = Math.round((parseInt(el("banner").style.height)*ny/50) - (2*borWidth));
	oResize(b0);
	oResize(b1);
	iResize();
	NW = Math.round(NW);
	el("rLinkTitle").style.fontSize = Math.round(4*ny/50)+"px";
	el("rLinkCaption").style.fontSize = Math.round(2*ny/50)+"px";
}
onresize = resize;

document.onmousemove = function(e) {
	if (window.event) e = window.event;
	xm = (e.x || e.clientX)-nx;
	ym = (e.y || e.clientY)-ny;
}

function run() {
	o = el("banner").getElementsByTagName("span");
	b0 = o[0];
	b1 = o[1];
	init(b0);
	init(b1);
	img[0].onmouseover();
	resize();
	slide();
}

//-->