// 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;

// DO NOTHING
function nop(){}

// 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);}

// LOOKUP ELEMENT ( ID )
function id2e(i){return document.getElementById(i);}

// TOGGLE DISPLAY ( ELEMENT, 0=HIDE|1=SHOW )
function dpy(e,s){e.style.display=['none','block'][s];}

// SET CLASS NAME ( ELEMENT, CLASS )
function cname(e,c){if(e)e.className=c;}

// TABS ( ON, [OFF ARRAY] )
function tabs(n,f){dpy(id2e(n),1);cname(id2e(n+'_'),'active');f.a(function(e){dpy(id2e(e),0);cname(id2e(e+'_'),'normal');});}

// PORTFOLIO TABLE
var ptab=[
["t1","i1t",[
 "i1a","Seatwall with Pillars and Landscape Lighting",
 "i1b","Seatwall, Landscape Lighting and Landscaping",
 "i1c","Brick Paver Walkway leading to Brick Steps and Brick Paver Patio"]],
["t2","i2t",[
 "i2a","Excavation for proposed Brick Paver Patio",
 "i2b","Finishing touches being done",
 "i2c","Brick Paver Patio with Seatwall and Fire Pit"]],
["t3","i3t",[
 "i3a","Flagstone Pathway",
 "i3b","Outcropping Retaining Wall",
 "i3c","Landscape Installation"]],
["t4","i4t",[
 "i4a","Retaining Wall and Landscape Installation",
 "i4b","Landscape Installation",
 "i4c","Front Landscape Design and Installation"]],
["t5","i5t",[
 "i5a","Before",
 "i5b","After",
 "i5c","Brick Paver Patio with In-lites Lighting"]],
["t6","i6t",[
 "i6a","Brick and Morter Mailbox with Side Planters",
 "i6b","Brick & Morter Mailbox",
 "i6c","Other styles and designs also available"]],
["t7","i7t",[
 "i7a","Excavation for proposed Brick Paver Patio",
 "i7b","Brick Paver Patio with surrounding landscaping",
 "i7c","Completed Brick Paver Patio using circles"]],
["t8","i8t",[
 "i8a","Before",
 "i8b","Pave Loc Brick Paver Patio with circular design",
 "i8c","After: Brick Paver Patio with Pond and Waterfalls"]],
["t9","i9t",[
 "i9a","Before Brick Walkway",
 "i9b","Installation Process",
 "i9c","Brick Paver Walkway and Steps"]]
];


// PORTFOLIO SWITCH TO NEW IMAGE
function pset(i) { var j; i--;
 for(j=0;j<9;j++) { 
  if(j==i) { document.images[ptab[j][0]].src='img/'+ptab[j][1]+'-.jpg'; }
  else { document.images[ptab[j][0]].src='img/'+ptab[j][1]+'.jpg'; } }
 j=ptab[i][2];
 document.images["p1"].src='img/'+j[0]+'.jpg';
 document.images["p2"].src='img/'+j[2]+'.jpg';
 document.images["p3"].src='img/'+j[4]+'.jpg';
 id2e("p1t").innerHTML=j[1];
 id2e("p2t").innerHTML=j[3];
 id2e("p3t").innerHTML=j[5];
}


