picarray=new Array();
pics=0;


var xmlhttp
var slideshow=0;
var slideshowwait=0;
var opac=0;
var thispic;
ingal=0;
function dogal(gal)
 {document.getElementById("framediv").style.opacity=0;
eopac="alpha(opacity="+0+")"
if(ie)
 {document.getElementById("framediv").style.filter=eopac;}


wt=document.documentElement.scrollWidth;

ht1=document.documentElement.scrollHeight;
var w=(wt-500)/2
tr=document.documentElement.scrollTop






document.getElementById("imgdiv").style.width=wt+"px";
if(ht1 > 1000)
  {
   document.getElementById("imgdiv").style.height=(ht1 + tr)+"px";}

lft=(wt-500)/2
document.getElementById("framecontainer").style.left=lft+"px";

document.getElementById("framecontainer").style.top=(tr + 10)+"px";

document.getElementById("imgdiv").style.visibility="visible"; 
document.getElementById("framecontainer").style.visibility="visible"; 
document.getElementById("framediv").style.visibility="visible"; 
ingal=1;
picturedetail(gal)
}



function picturedetail(gal)
{

document.getElementById("framediv").style.opacity=0;
eopac="alpha(opacity="+0+")"
if(ie)
 {document.getElementById("framediv").style.filter=eopac;}

thispic=gal;
 thepic=picarray[gal];
 slideshowwait=1;

fillframe(thepic);







}
function hidepic()
{slideshow=0;
 document.getElementById("slideshow").style.background="#303030";
 document.getElementById("imgdiv").style.visibility="hidden"; 
document.getElementById("framediv").style.visibility="hidden"; 
document.getElementById("framecontainer").style.visibility="hidden"; 
document.getElementById("thepic").style.visibility="hidden";
ingal=0;


}


function fillframe(str)
{

xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support XMLHTTP!");
  return;
  }
var url="getimage.php?";
url=url+str;
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged()
{
if (xmlhttp.readyState==4)
  {
  document.getElementById("framediv").innerHTML=xmlhttp.responseText;
  
  
  }
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}

function fadein()
{opac=0;
if(ingal > 0){
document.getElementById("thepic").style.visibility="visible";}
else{
document.getElementById("thepic").style.visibility="hidden";}



 
 
 fade();
}
function fade()
{opac=opac+10;
 eopac="alpha(opacity="+opac+")"

 if(ie)
  {document.getElementById("framediv").style.filter=eopac;
  
   }
  document.getElementById("framediv").style.opacity=(opac/100);
  if(opac < 100)
   {t=setTimeout("fade();",50);
    }
  else
  {
seeslideshow()}
}
function seeslideshow()
{if(slideshow==1)
   {doslideshow()}
}
function doslideshow()
{
 if(slideshowwait == 0)
  {nextpic()}
 else
 {slideshowwait=0;
 t=setTimeout("doslideshow();",3000);}
 
}

function nextpic()
{if(thispic < pics)
  {picturedetail(thispic+1)}
 else
  {picturedetail(0)};
}
function prevpic()
{if(thispic > 0)
  {picturedetail(thispic-1)}
 else
  {picturedetail(pics)};
}
function slideshowon()
 {if(slideshow > 0)
   {document.getElementById('slideshow').style.background="#303030";
   slideshow=0;}
  else
   {document.getElementById('slideshow').style.background="#d00";
    slideshow=1;
    slideshowwait=1;
    nextpic();}
}

function buthover(but)
 {if(but == 'slideshow' && slideshow > 0)
     {document.getElementById(but).style.background='#f00';}
   else
     {document.getElementById(but).style.background='#808080';}
}

function butback(but)
 {if(but == 'slideshow' && slideshow >0)
     {document.getElementById(but).style.background='#d00';}
   else
     {document.getElementById(but).style.background='#303030';}
}
