// ARRAY REMOVE ( INDEX )
Array.prototype.r=function(i){var n=this.length;for(;i<n;i++){this[i]=this[i+1];}this.length--;};

// ARRAY APPLY ( FUNCTION, START, END ) 
Array.prototype.a=function(f,s,e){var i=(s==null)?0:s,e=(e==null)?this.length-1:e;for(;i<=e;i++){f(this[i],i,e);}};

// ARRAY APPLY WITH ADDED RETURN ( FUNCTION )
Array.prototype.ap=function(f){var s=0,n=this.length;if(s>=n)return null;var r=f(this[s],s,n-1);for(var i=s+1;i<n;i++){r+=f(this[i],i,n-1);}return r;};

// ARRAY PUSH ( VALUE )
Array.prototype.p=function(v){this[this.length]=v;};

// ARRAY FIND ( VALUE ) RETURNS INDEX
Array.prototype.f=function(v){var i=0,n=this.length;for(;i<n;i++){if(this[i][0]==v)return i;}return -1;};

// HTML FILE NAME
var me=document.URL.match(/\w+\.htm/);if(me==null)me='index.htm';else me=me[0];
var gme=me;

// HTML FILE NAME WITHOUT EXTENSION
var mep=me.slice(0,-4);

// HTML FILE NAME PRE UNDERSCORE
var meu=(mep.split('_'))[0];

// DOCUMENT WRITE ( STRING )
function dw(s){document.write(s);}

// WRITE MAIL LINK ( NAME, ADDRESS ) 
function mail(n,a){var t=n+'@'+a;return '<a href="mailto:'+t+'">'+t+'</a>';}

// MENU OR BUTTON ON ( IMAGE )
function mon(i){if(i!=meu)document.images[i].src='img/'+i+'-.gif';}

// MENU OR BUTTON OFF ( IMAGE )
function moff(i){var t=i;if(i==meu)t+='--';document.images[i].src='img/'+t+'.gif';}

// MENU MARK CURRENT PAGE AS ACTIVE
function mfix(i){moff(meu);}


// GALLERY LISTING - INCLUDED BEFORE INCLUDING THIS FILE
// gl[[thumb,[[img,description]...]]...]

// GALLERY CURRENT IMAGE
var gi=Math.floor(Math.random()*(gl.length-1));

// GALLERY PARSE URL
var gu=(((document.URL).split('#'))[0]).split('?');if((gu.length==2)&&(gu[1]!='')){gu[1].split(',').a(function(t){if(t.length)gi=gl.f(t);});}

// GALLERY URL PREVIOUS
var gup=me+'?'+gl[((gi-1)==-1)?gl.length-1:gi-1][0];

// GALLERY URL CURRENT - FULLY QUALIFIED FOR RETURN
var guc=(((document.URL).split('?'))[0])+'?'+gl[gi][0];

// GALLERY URL NEXT
var gun=me+'?'+gl[((gi+1)==gl.length)?0:gi+1][0];


// RANDOMIMAGE
function rndi(){
 var i=1+Math.floor(Math.random()*4.999);
 dw('<a href="showroom.htm"><img src="img/ran'+i+'.jpg" border=0 width=381 height=254></a>'); }

// GALLERY TABLE
function gallery_table(){
 (gl[gi])[1].a(function(t,i,j){
  dw('<a href="'+gun+'"><img src="img/f/'+t[0]+'.jpg" border=0></a><br>');
  if(i!=j){dw('<div id="dts"></div>');}
  });}



// THUMB ON OFF
function tof(n,a,b){
 return 'onMouseOver="document.'+n+'.src=\'img/t/'+a+'.gif\'" onMouseOut="document.'+n+'.src=\'img/t/'+b+'.gif\'"';}


// DRAW THUMB IMAGE
function thumb_image(s,i){
 if(i==gi){return '<img src="img/t/'+s+'-.gif" border=0 width=127 height=127>';}
 return '<a href="'+gme+'?'+gl[i][0]+'" '+tof(s,s+'-',s)+'><img name="'+s+'" src="img/t/'+s+'.gif" border=0 width=127 height=127></a>'; }

// THUMB TABLE 
function thumb_table(){var th=0;
 gl.a(function(t,i){
  if(th==0)dw('<div id="dt">');
  dw(thumb_image(t[0],i));
  if(th==2){th=-1;dw('</div>');}
  th++;});
 if(th!=0)dw('</div>');} 
  
// THUMB TABLE 
function thumb_6(){var th=0;
 gl.a(function(t,i){
  if(th==0)dw('<div id="dt">');
  dw(thumb_image(t[0],i));
  if(th==2){th=-1;dw('</div>');}
  th++;},0,5);
 if(th!=0)dw('</div>');} 

