prev=999; 
next=999;
maxpic=0;
function loadphotoarray(p) {
	if (p=="next" || p=="prev") p=eval(p);
	if (p!=999) {
		hidephoto();
		if (p>0) prev=p-1; else prev=999;
		if (p+1<maxpic) next=p+1; else next=999;
		loadphoto(pic[p][0],pic[p][1],pic[p][2],pic[p][3],pic[p][4],prev,next);
	}
}
function loadphoto(url,w,h,s,d) {
	document.images["bigphoto"].width=w;
	document.images["bigphoto"].height=h;
	document.images["bigphoto"].src="/"+url;
	document.getElementById("photodiv3").innerHTML=s;
	document.getElementById("photodiv3").style.display=((s==""&&d=="")?"none":"inline");
	xy=d.substring(0,4);
	xm=d.substring(4,6);
	xd=d.substring(6,8);
	xh=d.substring(8,10);
	xi=d.substring(10,12);
	document.getElementById("photodiv4").innerHTML="<NOBR>&nbsp;&nbsp;"+xd+"/"+xm+"/"+xy+"&nbsp;-&nbsp;"+xh+":"+xi+"</NOBR>";
	document.getElementById("photodiv4").style.display=(d==""?"none":"inline");
	document.getElementById("photodiv5").innerHTML='<IMG SRC="/img/icon_prev'+(prev==999?"off":"")+'.gif" WIDTH=15 HEIGHT=15 BORDER=0>';
	document.getElementById("photodiv6").innerHTML='<IMG SRC="/img/icon_next'+(next==999?"off":"")+'.gif" WIDTH=15 HEIGHT=15 BORDER=0>';
}
function centerphoto() {
	dv=document.getElementById("bigphotodiv");
	dv.style.width=document.images["bigphoto"].width+13;
	dv.style.height=document.images["bigphoto"].height+3;

	dv=document.getElementById("photodiv2");
	dv.style.left=2+document.images["bigphoto"].width-19 - 40;
	dv.style.top=2;

	dv=document.getElementById("photodiv3");
	dv.style.left=2;
	dv.style.width=document.images["bigphoto"].width - 60;
	dv.style.top=2;

	dv=document.getElementById("photodivextra");
	dv.style.left=2;
	dv.style.width=document.images["bigphoto"].width;
	dv.style.height=document.getElementById("photodiv3").offsetHeight;
	dv.style.top=2;

	dv=document.getElementById("photodiv4");
	dv.style.left=2;
	dv.style.top=2;

	dv=document.getElementById("bigphotodiv");
	h=document.body.clientHeight;
	t=document.body.scrollTop;
	w=document.body.clientWidth;
	l=document.body.scrollLeft;
	y=Math.floor(h/2-dv.offsetHeight/2+t);
	x=Math.floor(w/2-dv.offsetWidth/2+l);
	dv.style.top=y;
	dv.style.left=x;
}
function hidephoto() {
	dv=document.getElementById("bigphotodiv");
	dv.style.visibility="hidden";
}
function showphoto() {
	dv=document.getElementById("bigphotodiv");
	fadeIn("bigphotodiv",0.3);
}
function fixcenter() {

	document.getElementById("klapmenu1").style.visibility="visible";
	document.getElementById("klapmenu1").style.visibility="hidden";
	centerphoto();
}

function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	} else if (obj.x) {
		curleft += obj.x;
	}
	return curleft;
}

function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	} else if (obj.y) {
		curtop += obj.y;
	}
	return curtop;
}

function mouseoverinit() {
	if (!document.getElementById) return;
	preloads=new Array();
	imgs=document.getElementsByTagName('img');
	for (i=0;i<imgs.length;i++) {
		for (j=0; j<imgs[i].attributes.length; j++) {
			tt = imgs[i].attributes[j].name.toUpperCase();
			if (tt == "SWAP") {
				soff = imgs[i].getAttribute('src'); son = soff.replace("_off","_on");
				preloads[i] = new Image(); preloads[i].src = son;
				imgs[i].onmouseover = new Function("imgs["+i+"].src='"+son+"'");
				imgs[i].onmouseout = new Function("imgs["+i+"].src='"+soff+"'");
			}
		}
	}
}

function fadeIn(whatdiv,speed) {
	if (document.all && navigator.userAgent.indexOf("Opera")==-1) {
		document.getElementById(whatdiv).style.filter="blendTrans(duration="+speed+")";
		    if (document.getElementById(whatdiv).filters.blendTrans.status != 2) {
		        document.getElementById(whatdiv).filters.blendTrans.apply();
		        document.getElementById(whatdiv).style.visibility="visible";
		        document.getElementById(whatdiv).filters.blendTrans.play();
		    }
	} else {
	        document.getElementById(whatdiv).style.visibility="visible";
	}
}
//window.onresize=fixcenter;
//document.onclick=hidephoto;
window.onload=init;
function init() {
	mouseoverinit();
	fadeIn("allcontent",0.1);
}