
smallSizes = new Array(77,77);
mediumSizes = new Array(200,170);
pageName = 'beforeafter_photos.htm';
scriptName = 'beforeafter_photos.js';
countX = 4;
countY = 2;

// sections: name, small images path, medium images path, big images path
// images: name, src, big width, big height
var arImages = new Array(
  new Array('Before and After Photos', 'before_after', 'images/portfolio/small/','images/portfolio/medium/','images/portfolio/big/',
    new Array(
		new Array('Project 1 Before','ba_080911084937.jpg',448,336,''), 
		new Array('Project 1 After','ba_080911085005.jpg',448,299,''), 
		new Array('Project 2 Before','ba_080911085027.jpg',448,336,''), 
		new Array('Project 2 After','ba_080911085047.jpg',448,299,''), 
		new Array('Project 3 Before','ba_080911085104.jpg',448,333,''), 
		new Array('Project 3 After','ba_pools_002.jpg',448,336,'') 
    )
  )
)

if (typeof(section)=='undefined')
 section = getParameter(self.document.location.href, 'section');
var sectionIndex = 0;

if (section != '') {
  for (var i=0; i<arImages.length; i++) {
    if (arImages[i][1] == section) {
	  sectionIndex = i;
	  break;
	}
  }
}

section = arImages[sectionIndex][1];

ind = getParameter(self.document.location.href, 'ind');
if (isNaN(ind) || (ind=='') || (ind<0) || (ind>arImages[sectionIndex][5].length))
  ind = 0;

var arPreloadImages = new Array();
function preload() {
  if (arImages[sectionIndex][3]!='') {
    for (i=ind;(i<(Number(ind)+Number(countX*countY))) && (i<arImages[sectionIndex][5].length);i++) {
      arPreloadImages[i] = new Image(mediumSizes[0],mediumSizes[1]);
      arPreloadImages[i].src = arImages[sectionIndex][3]+arImages[sectionIndex][5][i][1];
    }
  }
}
  
function menu_portfolio() {
  var jp;
  document.write('<table border="0" cellspacing="0" cellpadding="0">');
  document.write('<tr><td>Choose a category:&nbsp;<select name="cat" class="select1" onChange="if (this.value.length!=0) window.location=this.value" style="font-size:9px;">');
  for (jp=0;jp<arImages.length;jp++) {
    document.write('<option value="'+pageName+'?section='+arImages[jp][1]+'"'+((jp==sectionIndex)?' selected':'')+'>'+arImages[jp][0]+'</option>');
  }  
  document.write('</select></td></tr>')
  document.write('</table>');
}

function showImageMedium(number) {
  showImage('imagemedium',arImages[sectionIndex][3]+arImages[sectionIndex][5][number][1]);
  if (arImages[sectionIndex][5][number][0]!='')
   showMessage('imagemediumname',arImages[sectionIndex][5][number][0]);
  else
   showMessage('imagemediumname','Photo '+Number(Number(number)+1));

}

