// --------------------------------- vars ---------------------------------

photo_border_width=1;
photo_border_color='#606060';

photo_padding_width=5;
photo_padding_color='white';

photo_speed=0.2;
photo_nifty_controls=1;

unloading = false;

var currentPhoto = 1;
var totalPhoto = 0;


// --------------------------------- usage ---------------------------------

// pic[0]=new Array(filename,width,height,subscript,date)
// pic[1]=new Array(filename,width,height,subscript,date)

// <A HREF="javascript:loadphotoarray(0)">popup</A>
// <A HREF="javascript:loadphoto(filename,width,height,subscript,date)">popup</A>



// --------------------------------------------------------------------------

ie = /MSIE ((5\.5)|[678])/.test(navigator.userAgent);
win = navigator.platform == "Win32";

ie7 = navigator.appVersion.indexOf("MSIE 7.0") != -1;

prev=0; next=0;
// BROWSER INDEPENDENT WINDOW DETAILS.
// returns an object with the following attributes:
// width: window width
// height: window height
// scrollOffsetX: scroll X (probably always 0)
// scrollOffsetY: scroll Y

function getWindowDetails() {
	var myWidth = 0;
	var myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
	 //Non-IE
	 myWidth = window.innerWidth;
	 myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	 //IE 6+ in 'standards compliant mode'
	 myWidth = document.documentElement.clientWidth;
	 myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	 //IE 4 compatible
	 myWidth = document.body.clientWidth;
	 myHeight = document.body.clientHeight;
	}

	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
	 //Netscape compliant
	 scrOfY = window.pageYOffset;
	 scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
	 //DOM compliant
	 scrOfY = document.body.scrollTop;
	 scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
	 //IE6 standards compliant mode
	 scrOfY = document.documentElement.scrollTop;
	 scrOfX = document.documentElement.scrollLeft;
	}
	windowDetails = new Object();
	windowDetails.width = myWidth;
	windowDetails.height = myHeight;
	windowDetails.scrollOffsetX = scrOfX;
	windowDetails.scrollOffsetY = scrOfY;

	return windowDetails;
}
function $(o) { return document.getElementById(o); }
function loadphotoarray(p) {
	if (p=="next" || p=="prev") p=eval(p);
	currentPhoto = p + 1;
	if (p!=999) {
		hidephoto();
		wait();		
		
		if (p>0) prev=p-1; else prev=(pic.length-1); 		
		if (p+1<pic.length) next=p+1; else next=0;
		loadphoto(pic[p][0],pic[p][1],pic[p][2],pic[p][3],pic[p][4],prev,next);
		//loadphoto(pic[p][0],800,600,pic[p][3],pic[p][4],prev,next);
		
	}
	//$('#tdPicTotal').html(currentPhoto+' of '+ pic.length);
	document.getElementById('tdPicTotal').innerHTML ='Foto ' + currentPhoto+' van '+ pic.length;
}
function loadphoto(url,w,h,s,d) {
	wait();
	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");
	if (photo_nifty_controls==1) {
		if (prev == 999 && next == 999) {
			document.getElementById("photodiv5").innerHTML='<IMG SRC="hosts/kimpe/images/dummy.gif" WIDTH=15 HEIGHT=15 BORDER=0>';
			document.getElementById("photodiv6").innerHTML='<IMG SRC="hosts/kimpe/images/dummy.gif" WIDTH=15 HEIGHT=15 BORDER=0>';
		} else {
			document.getElementById("photodiv5").innerHTML='<IMG SRC="hosts/kimpe/images/prev.gif" WIDTH=23 HEIGHT=21 BORDER=0>';
			document.getElementById("photodiv6").innerHTML='<IMG SRC="hosts/kimpe/images/next.gif" WIDTH=23 HEIGHT=21 BORDER=0>';
		}
	}
}
http://kimpe.omnicasa.com/hosts/kimpe/images/bg.gif
function centerphoto() {
	dv=document.getElementById("bigphotodiv");

	dv.style.width=(document.images["bigphoto"].width+(photo_padding_width*2+photo_border_width*2))+"px";
	dv.style.height=(document.images["bigphoto"].height+(photo_padding_width*2+photo_border_width*2))+"px";
	/********************************/
	dv.style.width='800px';
	dv.style.height='600px';
	/*******************************/
	//var w = dv.style.width;
	//var h = dv.style.height;
	dv=document.getElementById("photodiv2");
	//dv.style.left=((photo_padding_width+1)+(document.images["bigphoto"].width-(20-photo_border_width)-38) / 2 + 6)+"px";
	//dv.style.top=((photo_padding_width+1)+photo_border_width+3)+"px"; // document.images["bigphoto"].height
	dv.style.left="0px";
	//dv.style.top=((photo_padding_width+1)+photo_border_width + 1 + document.images["bigphoto"].height)+"px"; // document.images["bigphoto"].height
		dv.style.top="600"; // document.images["bigphoto"].height


	
	dv=document.getElementById("photodiv3");
	dv.style.left=(photo_padding_width+photo_border_width)+"px";
	dv.style.width=(document.images["bigphoto"].width)+"px";
	dv.style.top=((photo_padding_width+photo_border_width)+document.images["bigphoto"].height-23)+"px";

	dv=document.getElementById("photodiv4");
	dv.style.left=(photo_padding_width+photo_border_width)+"px";
	dv.style.top=((photo_padding_width+photo_border_width)+document.images["bigphoto"].height-23)+"px";

	dv=document.getElementById("bigphotodiv");

              var h=document.body.clientHeight;
        var t=document.body.scrollTop;
	var w=document.body.clientWidth;
	var l=document.body.scrollLeft;
	//var y=Math.floor(h/2-dv.offsetHeight/2+t);
        var y = t + 40;
	var x=Math.floor(w/2-dv.offsetWidth/2+l);
	dv.style.top=y+"px";
	dv.style.left=x+"px";
	dv.style.zIndex = 9999999;
}
function hidephoto() {
	dv=document.getElementById("bigphotodiv");
	dv.style.visibility="hidden";
	unwait();
}
function showphoto() {
	dv=document.getElementById("bigphotodiv");
	fadeIn("bigphotodiv",photo_speed);
}
function fixcenter() {
	centerphoto(windowDetail);
}
function wait() {
	if (!unloading) {
		unloading = true;
		if (ie || 1==1) {
			pw = document.body.scrollWidth;
			ph = document.body.scrollHeight;
			cw = document.body.clientWidth;
			ch = document.body.clientHeight;
			sl = document.body.scrollLeft;
			st = document.body.scrollTop;
		}
		$('wait').style.width = pw+"px";
		$('wait').style.height = ph+"px";
		$('wait').style.zIndex = 9999998;
		$('wait').style.visibility = "visible";
	}
}
//CHECK FOR IE6
function getInternetExplorerVersion()
// Returns the version of Windows Internet Explorer or a -1
// (indicating the use of another browser).
{
   var rv = -1; // Return value assumes failure.
   if (navigator.appName == 'Microsoft Internet Explorer')
   {
      var ua = navigator.userAgent;
      var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
      if (re.exec(ua) != null)
         rv = parseFloat( RegExp.$1 );
   }
   return rv;
}
function checkIEVersion()
{
   var msg = "You're not using Windows Internet Explorer.";
   var ver = getInternetExplorerVersion();
   if ( ver> -1 )
   { if ( ver>= 9.0 )
         msg = 9;//"You're using Windows Internet Explorer 8.";
      else if ( ver== 8.0 )
         msg = 8;//"You're using Windows Internet Explorer 8.";
      else if ( ver == 7.0 )
    	  msg = 7;//"You're using Windows Internet Explorer 7.";
      else if ( ver == 6.0 )
    	  msg = 6;//"You're using Windows Internet Explorer 6.";
      else
    	  msg = 0;//"You should upgrade your copy of Windows Internet Explorer";
    }
	//alert(msg);
   return msg;
}

function unwait() {
	unloading = false;
	$('wait').style.visibility = "hidden";
}
function fadeIn(whatdiv, speed) {
	if (document.all) {
		$(whatdiv).style.filter = "blendTrans(duration=" + speed + ")";
//		if ($(whatdiv).filters.blendTrans.status != 2) {
			$(whatdiv).filters.blendTrans.apply();
			$(whatdiv).style.visibility = "visible";
			$(whatdiv).filters.blendTrans.play();
//		}
	} else {
		$(whatdiv).style.opacity = 0;
		$(whatdiv).style.mozOpacity = 0;
		$(whatdiv).style.visibility = "visible";
		for (i = 0.1; i <= 1; i += 0.025) {
			window.setTimeout("$('" + whatdiv + "').style.opacity=" + i, i * 1000 * speed);
			window.setTimeout("$('" + whatdiv + "').style.mozOpacity=" + i, i * 1000 * speed);
		}
	}
}

function fadeOut(whatdiv,speed) {
	if (document.all) {
		$(whatdiv).style.filter = "blendTrans(duration=" + speed + ")";
//		if ($(whatdiv).filters.blendTrans.status != 2) {
			$(whatdiv).filters.blendTrans.apply();
			$(whatdiv).style.visibility = "hidden";
			$(whatdiv).filters.blendTrans.play();
//		}
	} else {
		$(whatdiv).style.opacity = 0;
		$(whatdiv).style.mozOpacity = 0;
		$(whatdiv).style.visibility = "visible";
		for (i = 0.1; i <= 1; i += 0.025) {
			window.setTimeout("$('" + whatdiv + "').style.opacity=" + (0.9 - i), i * 1000 * speed);
			window.setTimeout("$('" + whatdiv + "').style.mozOpacity=" + (0.9 - i), i * 1000 * speed);
		}
	}
}

/*
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";
	}
}
*/

var getWindowDetail = getWindowDetails();
var windowDetail = getWindowDetail.height;

document.write('<DIV ID="bigphotodiv" STYLE="position:absolute;left:-999px;top:-999px;padding-bottom:50px;visibility:hidden;background:white; }">');

document.write('<DIV ID="photodiv1" STYLE="position:absolute;left:0px;top:0px">');
	document.write('<TABLE CELLPADDING='+photo_padding_width+' CELLSPACING=0 BORDER=0 STYLE="background:'+photo_padding_color+(photo_border_width>0?(';border:'+photo_border_width+'px solid '+photo_border_color):'')+'"><TR><TD align="center" valign="middle" width="790" height="580" >');
	document.write('<IMG NAME="bigphoto" SRC="hosts/kimpe/images/dummy.gif" onLoad="if (this.src.indexOf(\'dummy.gif\')==-1) { centerphoto('+windowDetail+');showphoto() }"><BR>');
	document.write('</TD></TR></TABLE>');
document.write('</DIV>');

document.write('<DIV ID="photodiv3" STYLE="position:absolute;left:0px;top:0px;background-color:black;width:60px;color:white;text-align:center;height:23px;padding:4px 0px 0px 0px;font-family:tahoma,arial;font-size:11px"></DIV>');

document.write('<DIV ID="photodiv4" STYLE="position:absolute;left:0px;top:0px;background-color:black;width:60px;color:white;height:23px;padding:4px 0px 0px 0px;font-family:tahoma,arial;font-size:11px"></DIV>');

if (photo_nifty_controls==1) {

	document.write('<DIV ID="photodiv2" STYLE="position:absolute;left:0px;top:580px;width:800;">');

		document.write('<TABLE STYLE="background:white;" CELLPADDING=0 CELLSPACING=0 CELLPADDING=0 BORDER=0 HEIGHT=50 WIDTH=100%>');
		document.write('<TR >');
			document.write('<TD WIDTH=50 style="padding-left:13px;padding-right:5px;"><A HREF="javascript:loadphotoarray(\'prev\')" ID="photodiv5"><IMG SRC="hosts/kimpe/images/prev.gif" WIDTH=50 HEIGHT=22 BORDER=0></A></TD>');
				
				document.write('<TD WIDTH=50><A HREF="javascript:loadphotoarray(\'next\')" ID="photodiv6"><IMG SRC="hosts/kimpe/images/next.gif" WIDTH=50 HEIGHT=22 BORDER=0></A></TD>');
			document.write('<TD WIDTH=20 ID="tdCurrentTotal"></TD>');		
			document.write('<TD WIDTH=700 ID="tdPicTotal" style="padding-left:10px; font-weight:bold; color:#333333;">'+ currentPhoto +' van ' + totalPhoto + '</TD>');
		    document.write('<TD WIDTH=12 style="padding-right:5px;"><A HREF="javascript:hidephoto()" STYLE="color:red;font-family:tahoma,arial;font-size:11px;text-decoration:none">Sluiten</A></TD>');
			document.write('<TD WIDTH=15><A HREF="javascript:hidephoto()"><IMG SRC="hosts/kimpe/images/close.gif" WIDTH=23 HEIGHT=22 BORDER=0></A></TD>');
			document.write('<TD WIDTH=20 >&nbsp;&nbsp;</TD>');		
		document.write('</TR>');
		document.write('</TABLE>');

	document.write('</DIV>');

} else {

	document.write('<DIV ID="photodiv2" STYLE="position:absolute;left:0px;top:0px;background:#800000;padding:1px 5px 1px 5px;border:1px solid black">');
	document.write('<A HREF="javascript:hidephoto()" STYLE="color:red;font-family:tahoma,arial;font-size:11px;text-decoration:none">Sluiten</A><BR>');
	document.write('</DIV>');

}

document.write('</DIV>');



window.onresize=fixcenter;



