function viewPhoto(thumb) {
	if (document.all){
		document.images.photolg.style.filter = "blendTrans(duration=2)";
		document.images.photolg.style.filter = "blendTrans(duration=crossFadeDuration)";
		document.images.photolg.filters.blendTrans.Apply();
	}
	document.photolg.src = thumb.src.replace('_sm','_lg');
	if (document.all){
		document.images.photolg.filters.blendTrans.Play()
	}
}
var photo;
var minMargin = 0;
var old = minMargin;
var photolgheight = 0;

window.onload = function () {
	photo = new getObj('photolg');
	movePhoto();
}

function movePhoto() {
	if (window.innerHeight) {
		pos = window.pageYOffset
	} else if (document.documentElement && document.documentElement.scrollTop) {
		pos = document.documentElement.scrollTop
	} else if (document.body) {
		pos = document.body.scrollTop
	}
	
	var thumbRowCount = 0;
	var els = document.getElementsByTagName('IMG');	
	for (i = 0, j = 0; i < els.length; i++) {
		if ( els[i].className == 'photosm' ) {
			if (!(j % 2)) thumbRowCount++;
			j++;
		} else if ( els[i].className == 'photolg' ) {
			photolgheight = (els[i].height);
		}
	}
	maxMargin = ((thumbRowCount * 67) + 40);
	if (photolgheight > maxMargin) pos = minMargin;
	if (pos < minMargin) pos = minMargin;
	if (pos > maxMargin) pos = maxMargin;
	if (pos != old)			 photo.style.marginTop = pos;
	old = pos;
	temp = setTimeout('movePhoto()',20);
}

function getObj(name) {
  if (document.getElementById) {
  	if (document.getElementById(name)) {
  		this.obj = document.getElementById(name);
			this.style = document.getElementById(name).style;
		}
  } else if (document.all) {
		this.obj = document.all[name];
		this.style = document.all[name].style;
  }
  else if (document.layers) {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

function getImageHeight(myImage) {
	var y, obj;
	if (document.layers) {
		var img = getImage(myImage);
		return img.height;
	} else {
		return getElementHeight(myImage);
	}
	return -1;
}
