// JavaScript Document
function writit(text,id)
{
	if (document.getElementById)
	{
		x = document.getElementById(id);
		x.innerHTML = '';
		x.innerHTML = text;
	}
	else if (document.all)
	{
		x = document.all[id];
		x.innerHTML = text;
	}
	else if (document.layers)
	{
		x = document.layers[id];
		text2 = '<P CLASS="testclass">' + text + '</P>';
		x.document.open();
		x.document.write(text2);
		x.document.close();
	}
}

var p=imgstr.length;
var cnt=0;

function loadimagearray(){
picture[cnt]=new Image();
picture[cnt].src=imgstr[cnt];
CkLoad();
}

function CkLoad(){
if (picture[cnt].complete){
pic_w[cnt]=picture[cnt].width;
pic_h[cnt]=picture[cnt].height;
cnt++;
var x = "Loading Picture " + cnt + "of " + p;
writit(x, "show");
if (cnt<p){ loadimagearray(); }
else {

document.show.style.visibility='visible';
writit("", "show");
size_image();
showpictures();
}
}
else {
setTimeout('CkLoad()',100);
}
}



function size_image() {
if((pic_w[j]>pic_h[j])&&(pic_w[j]>500)) {
document.images.show.width=500;
document.images.show.height=500*pic_h[j]/pic_w[j];
}
else if ((pic_h[j]>=pic_w[j])&&(pic_h[j]>500)){
document.images.show.height=500;
document.images.show.width=500*pic_w[j]/pic_h[j];
}
else {
document.images.show.height=pic_h[j];
document.images.show.width=pic_w[j];
}

document.images.show.src=picture[j].src;
}



function playstat(inpstat)
{
document.viewer.playbut.value = (inpstat == "Stop") ? "Play" : "Stop";
showpictures();
}

function fwd()
{
if (j<(p-1))
{
j=j+1;
if (document.all)
{
document.images.show.style.filter="blendTrans(duration=2)";
document.images.show.style.filter="blendTrans(duration=dur)";
document.images.show.filters.blendTrans.Apply();
}
size_image();
if (document.all)
{
document.images.show.filters.blendTrans.Play();
}
document.viewer.playbut.value="Play"
}
}

function rew()
{
if (j)
{
j=j-1;
if (document.all)
{
document.images.show.style.filter="blendTrans(duration=2)";
document.images.show.style.filter="blendTrans(duration=dur)";
document.images.show.filters.blendTrans.Apply();
}
size_image();
if (document.all)
{
document.images.show.filters.blendTrans.Play();
}
document.viewer.playbut.value="Play"
}
}

function showpictures()
{
if (document.viewer.playbut.value == "Stop")
{
if (document.all)
{
document.images.show.style.filter="blendTrans(duration=2)";
document.images.show.style.filter="blendTrans(duration=dur)";
document.images.show.filters.blendTrans.Apply();
}

size_image();

if (document.all)
{
document.images.show.filters.blendTrans.Play();
}
j=j+1;
if (j>(p-1)) j=0;
t=setTimeout('showpictures()', sp);
}
}
