var pics=0;
var picn=new Array();
var cap=new Array();
var thmb=new Array();
var ti=new Array();
var base=0;
var path='';
var album='';
var themename='';
var numCols=0;
var debug=false;
var myids=new Array();
var cp;
var cs;
var pw=null;
var d=document;
var xaf_NS7=(!d.all&&d.getElementById);
var xaf_NS4=(!d.getElementById);
var xaf_IE5=(!xaf_NS4&&!xaf_NS7&&(navigator.userAgent.indexOf('MSIE 5.0')!=-1||navigator.userAgent.indexOf('MSIE	5.2')!=-1));
var xaf_IE5p5=(!xaf_NS4&&!xaf_NS7&&navigator.userAgent.indexOf('MSIE 5.5')!=-1);
var xaf_NS6=(xaf_NS7&&navigator.userAgent.indexOf('Netscape6')!=-1);
var xaf_SAF=(navigator.userAgent.indexOf('Safari')!=-1);

function photo_templatesetup(tcp,tcs)
{
if(typeof tcp!='undefined')
  {
  cp=tcp;
  }
  if(typeof tcs!='undefined')
  {
  cs=tcs;
  }
}

function photo_albumsetup(p,a,t)
{
var node;
path=p;
album=a;
themename=t;
photo_scanCollection("photo_albumtitle",0,function(node,i,a){node.innerHTML+=a;},a);
}

function photo_pic(n,tti,tcap)
{
var leaf,ext;
leaf=n.substring(0,n.lastIndexOf('.'));
ext=n.substring(n.lastIndexOf('.'),n.length);
picn[pics]=path+n;
ti[pics]=tti;
cap[pics]=tcap;
thmb[pics]=path+leaf+'_thumb'+ext;
pics++;
}

function photo_show(pc)
{
var w,h;
var cb=pc+base;
var bigimg;
var strsrc="";
if(cb>=picn.length)return true;
strsrc+='<html><head><title> Romeo&rsquo;s Floral Designs. Enlarged Image View</title>';
strsrc+='<style type="text/css"><!--';
strsrc+='td {';
strsrc+='	font-family: Arial,Helvetica,Swiss,Sans Serif;';
strsrc+='	font-size: smaller;';
strsrc+='}';
strsrc+='--></style>';
strsrc+='<scr'+'ipt>';
strsrc+='var pics='+pics+';var c='+cb+';var e;';
strsrc+='</scr'+'ipt>';
strsrc+='</head>';
strsrc+='<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor="#000000" scroll="auto">';
strsrc+='<table width="100%"><tr><td><a href="javascript:window.opener.photo_nextpic(-1, window)"><img src="'+themename+'prev.gif" border=0 title="Previous photo" /></a><a href="javascript:window.opener.photo_nextpic(1, window)"><img src="'+themename+'next.gif" border=0 title="Next photo" /></a></td><td><b ID="title"></b></td><td height=15 ID="posn" >Photo i of n</td><td align="right"><a href="javascript:close()">close</a></td></tr></table>';
strsrc+='<table align="center"><tr><td align="center"><a href="javascript:window.opener.photo_nextpic(1, window)"><img src ="'+picn[cb]+'" border=0 ID="pic" onLoad="window.opener.photo_sizetofit(window);" /></a></td></tr>';
strsrc+='<tr><td align="center" ID="caption"></td></tr></table>';
strsrc+='</body></html>';
bigimg=new Image();
bigimg.src=picn[cb];
w=bigimg.width+10;
h=bigimg.height+30;
s=0;
if(w>screen.availWidth-50)
{
  w=screen.availWidth-50;
  s=1;
}
if(h>screen.availHeight-50)
{
  h=screen.availHeight-50;
  s=1;
}
o="toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,scrollbars="+s+",left=40;top=20;screenX=40,screenY=20,width="+w+",height="+h;
if(pw)
{
  wd=window.open("","photoslideshow",o,true);
  pw=wd;
}else
{
  wd=window.open("","",o,true);
  wd.name="photoslideshow";
  pw=wd;
}
wd.document.open();
wd.document.writeln(strsrc);
wd.document.close();
photo_nextpic(0,wd);
wd.focus();
}

function photo_albumfill(base)
{
var i;
var timg;
var tel;
var trow;
myids=new Array();
photo_scanIndexedCollection("photo_thumb",photo_img,0);
photo_scanIndexedCollection("photo_title",photo_text,ti);
photo_scanIndexedCollection("photo_caption",photo_text,cap);
photo_scanCollection("photo_positionpages",0,function(tel,i,a){if(base>0||picn.length>base+photo_countslots())tel.style.visibility="visible";else tel.style.visibility="hidden";},0);
photo_scanCollection("photo_prevpage",0,function(tel,i,a){if(base>0)tel.style.visibility="visible";else tel.style.visibility="hidden";},0);
photo_scanCollection("photo_nextpage",0,function(tel,i,a){if(picn.length>base+photo_countslots())tel.style.visibility="visible";else tel.style.visibility="hidden";},0);
photo_scanCollection("photo_position",0,photo_postext,0);
photo_scanIndexedCollection("photo_cell",photo_vis,0);
}

function photo_img(timg,i,a)
{
if((base+i)<thmb.length&&(base+i)>=0)
  if(thmb[base+i]!='')
  {
    timg.src=thmb[base+i];
    timg.removeAttribute("width");
    timg.removeAttribute("height");
  }
  else timg.src=themename+"nothumb.gif";
else timg.src=themename+"missingthumb.gif";
}

function photo_text(tel,i,a)
{
if((base+i)<a.length&&(base+i)>=0)
  //tel.innerHTML=a[base+i];
  //blank out the text caption
  tel.innerHTML='';
else tel.innerHTML='';
}

function photo_postext(tel,i,a)
{
var top=base+photo_countslots();
if(top>picn.length)
  top=picn.length;
  tel.innerHTML="Showing pictures "+(base+1)+" to "+top+" of "+picn.length;
}

function photo_vis(tel,i,a)
{
if((base+i)<thmb.length&&(base+i)>=0)
  tel.style.visibility="visible";
  else tel.style.visibility="hidden";
}

function photo_countslots()
{
var i;
i=0;
timg=document.getElementById("photo_thumb"+i);
while(timg){i++;
  timg=document.getElementById("photo_thumb"+i);
  }
return i;
}

function photo_prevpage()
{
if(base>0)
  {
  base=base-photo_countslots();
  photo_albumfill(base);
  }
}

function photo_nextpage()
{
if(picn.length>base+photo_countslots())
  {
  base=base+photo_countslots();
  photo_albumfill(base);
  }
}

function photo_albumcreate(ncols,nrows,startslot)
{
var posn=document.getElementById("photo_albumdisplay");
var x,y;
var slotnum;
var row_startslot;
if(posn)
  {
  var oTable=document.createElement("TABLE");
  var oTBody0=document.createElement("TBODY");
  var oRow,oCell;
  var i,j,k;
  var tcell_collect;
  var tcell;
  var tcellInnerHTML;
  if(startslot!=-1)slotnum=startslot;
    else slotnum=photo_countslots();
  oTable.appendChild(oTBody0);
  oTable.border=0;
  oTable.width='100%';
  if(typeof cp!='undefined')oTable.cellPadding=cp;
  if(typeof cs!='undefined')oTable.cellSpacing=cs;
  oTable.className="photo_albumtable";
  for(i=0;i<nrows;i++)
    {
    tcell_collect=document.getElementsByName("photo_albumcelltemplate");
    row_startslot=slotnum;
    for(k=0;k<tcell_collect.length;k++)
      {
      slotnum=row_startslot;
      tcell=tcell_collect[k];
      if(tcell)tcellInnerHTML=tcell.innerHTML;
      oRow=document.createElement("TR");
      oRow.id="photo_row"+i;
      oRow.className="photo_albumrow";
      oTBody0.appendChild(oRow);
      for(j=0;j<ncols;j++)
        {
        oCell=document.createElement("TD");
        if(tcell)
          {
          var slothtml=tcellInnerHTML;
          slothtml=slothtml.replace(/slotnum/gi,slotnum);
          slothtml=slothtml.replace(/%28/gi,"(");
          slothtml=slothtml.replace(/%29/gi,")");
          oCell.innerHTML=slothtml;
          }
          else
          {
          oCell.innerHTML='<a href="javascript:photo_show('+slotnum+');"><img src="gradient_photothumb.gif" border=0 hspace=2 vspace=2 ID="photo_thumb'+slotnum+'"></a>';
          }
          oCell.align='center';
          oCell.vAlign='top';
          oCell.width=100/ncols+'%';
          oCell.id="photo_cell"+slotnum;
          oCell.className="photo_albumcell"+k;
          oRow.appendChild(oCell);
          slotnum++;
        }
      }
    }
    tcell_collect=document.getElementsByName("photo_albumcelltemplate");
    for(k=tcell_collect.length-1;k>=0;k--)
      {
      tcell=tcell_collect[k];
      if(tcell&&photo_ChildOf(posn,tcell))
        {
        var p=tcell.parentNode;
        p.removeChild(tcell);
        }
      }
    posn.appendChild(oTable);
    numCols=ncols;
  }
}

function photo_nextpic(d,wnd)
{
wnd.c+=d;
if(wnd.c>=pics)wnd.c=0;
if(wnd.c<0)wnd.c=pics-1;
if(wnd.document.images!=null)
  {
  var e=wnd.document.getElementById("pic");
  if(e)
    {
    e.src=picn[wnd.c];
    e.align="center";
    }
  e=wnd.document.getElementById("posn");
  if(e)e.innerHTML="Photo&nbsp;"+(wnd.c+1)+"&nbsp;of&nbsp;"+pics;
  e=wnd.document.getElementById("title");
  if(e)e.innerHTML=ti[wnd.c];
  e=wnd.document.getElementById("caption");
  if(e)e.innerHTML=cap[wnd.c];
  if(wnd.navigator.userAgent.indexOf('MSIE')!=-1)wnd.document.title=ti[wnd.c];
  }
}

function photo_sizetofit(wnd)
{
if(wnd.document.images!=null)
  {
  e=wnd.document.getElementById("pic");
  if(e)
    {
    if(e.width!=0||e.height!=0)
      {
      var w,h,s;
      w=e.width+18+32;
      h=e.height+56+32;
      s=false;
      if(cap[wnd.c]!='')h=h+40;
      if(w>screen.availWidth){w=screen.availWidth;s=true;
      }
    if(h>screen.availHeight)
      {
      h=screen.availHeight;s=true;
      }
    wnd.resizeTo(w,h);
    if(s)wnd.moveTo(0,0);
      } else
      {
      wnd.setTimeout("photo_sizetofit(window)",50);
      }
    }
  }
}

function photo_ChildOf(a,n)
{
var p;
p=n.parentNode;
while(p)
  {
  if(p==a)return true;
  p=p.parentNode;
  }
return false;
}

function photo_scanIndexedCollection(name,func,args)
{
var i;
var count;
i=0;
do
  {
  count=photo_scanCollection(name+i,i,func,args);
  i++;
  }
while(count>0)
}

function photo_scanCollection(name,base,func,args)
{
var tcell_collect;
var tcell;
var i;
var count;
count=0;
tcell_collect=document.getElementsByName(name);
if(tcell_collect.length>0)
  {
  for(k=0;k<tcell_collect.length;k++)
    {
    tcell=tcell_collect[k];
    if(tcell)func(tcell,base,args);
    }
  return tcell_collect.length;
  } else
  {
  if(myids.length==0)photo_scanTree3A();
  return photo_scanTree3B(name,base,func,args);
  }
return 0;
}

function photo_scanTree3A()
{
var i;
var c=0;
var node=document;
while(node)
  {
  if(node.id!=""&&typeof node.id!="undefined")
    {
    myids[c]=node;
    c++;
    }
  node=photo_getnextnode(node);
  if(node&&!(xaf_NS7||xaf_NS6||xaf_NS4))if((typeof node.tagName)!="undefined")if(node.tagName.toUpperCase()=="HTML")node=null;
  }
return c;
}

function photo_scanTree3B(name,base,func,args)
{
var i;
var c=0;
var node;
if(document.getElementById(name)==null)return 0;
for(i=0;i<myids.length;i++)
  {
  node=myids[i];
  if(node.id==name)
    {
    func(node,base,args);
    c++;
    }
  }
return c;
}

function photo_getnextnode(node)
{
if(node==null)return null;
if(node.firstChild)return node.firstChild;
while(node.nextSibling==null)
  {
  if(node.parentNode==null)return null;
  node=node.parentNode;
  }
return node.nextSibling;
}