imgObj.pre=new Array();
imgObj.property=new Array();
imgObj.obj1=new Array(); // indexed Array, not hash
imgObj.obj=new Array();i_index=0;

function imgObj(id_field,image_name,title,aspect,text,l_desc){
this.index=i_index;
i_index++;
this.id_field=id_field;
this.image_name=image_name;
this.title=title;
this.text=text;
this.aspect=aspect;
this.l_desc=l_desc;
imgObj.obj[id_field]=this;
imgObj.obj1[this.index]=this;
this.test=test;
this.checkNext=getNext;
this.getNext=getNext;
this.getLast=getLast;
this.findID=findID;
this.preLoad=preLoad;
}

function findID(){

}

function preLoad(){return 0;
var index_=this.index;
++index_;
if(index_ < imgObj.obj1.length){
imgObj.pre[index_] = new Image();
imgObj.pre[index_].src=this.image_name;
}else{
imgObj.pre[0] = new Image();
imgObj.pre[0].src=this.image_name;
}
}

function getNext(){
var index_=this.index;
++index_;
if(index_ < imgObj.obj1.length){
imgObj.obj1[index_].test(1);
}else{
imgObj.obj1[0].test(1);
}
}

function getLast(){
var index_=this.index;
--index_;
if(index_ > -1){
imgObj.obj1[index_].test(1);
}else{
imgObj.obj1[((imgObj.obj1.length)-1)].test(1);
}
}

function test(check){
if(! document.getElementById){
return true;
}
var nav='<div style="margin-top: 11px" class="td"><a href="javascript:opener.imgObj.obj['+this.id_field+'].getLast()">PREVIOUS</a> &#149; <a href="javascript:opener.imgObj.obj['+this.id_field+'].getNext()">NEXT</a></div>';


var aspect=this.aspect;
var height=450+25;
var width=450+190;
if(aspect >= 1){width=parseInt((450/aspect)+190);
html=htmlVert;
}
if(aspect < 1){height=parseInt((450*aspect)+125);
width=450+25;
html=htmlHor;
}
html = html.replace(/\^title\^/g ,this.title);
html = html.replace(/\^image_name\^/g ,this.image_name);
html = html.replace(/\^text\^/g ,this.text);
html = html.replace(/\^nav\^/g ,nav);

makeWindow(html,width,height);
this.preLoad()
return false;
}

var pWin='';
function makeWindow(contents,width,height){
if(pWin != ''){if(!pWin.closed){pWin.close()}}
pWin  = window.open("","","width="+width+",height="+height)
pWin.document.open();
pWin.document.write(contents);
pWin.document.close();
pWin.focus();
}

function restore(){
document.getElementsByTagName('body')[0].innerHTML=imgObj.property['saved_html'];
return false;
}