current_photo = 1;
		
/* photo viewer */

function photoViewer(anHREF, width, height) {

	var twidth = width + 100;
	var theight = height + 100;
	
	var chasm = screen.availWidth;
	var mount = screen.availHeight;
	var attribs = 'toolbar=no,location=no,directories=no,width='+twidth+',height='+theight+',left=' + ((chasm - twidth - 10) * .5) + ',top=' + ((mount - theight - 30) * .5 ) + ',resizable=no,status=no,menubar=no,scrollbars=yes';

	if (self.photos) {
		if (self.photos.closed) {
			popupwin = window.open(anHREF,'photos',attribs);
			self.photos = popupwin;
		} else {
			self.photos.focus();
		}
		self.photos.location.href = anHREF;
	} else {
		popupwin = window.open(anHREF,'photos',attribs);
		self.photos = popupwin;
		self.photos.focus();
	}
}

/* info popup */

function infoPop(anHREF) {
	
	var twidth = 640;
	var theight = screen.availHeight * 0.7;
	
	var chasm = screen.availWidth;
	var mount = screen.availHeight;
	var attribs = 'toolbar=no,location=no,directories=no,width='+twidth+',height='+theight+',left=' + ((chasm - twidth - 10) * .5) + ',top=' + ((mount - theight - 30) * .5 ) + ',resizable=yes,status=no,menubar=no,scrollbars=yes';

	if (self.photos) {
		if (self.photos.closed) {
			popupwin = window.open(anHREF,'photos',attribs);
			self.photos = popupwin;
		} else {
			self.photos.focus();
		}
		self.photos.location.href = anHREF;
	} else {
		popupwin = window.open(anHREF,'photos',attribs);
		self.photos = popupwin;
		self.photos.focus();
	}
}


/* helper javascript/css functions */

function jscss(a,o,c1,c2) {
	switch (a) {
		case 'swap':
			o.className=!jscss('check',o,c1)?o.className.replace(c2,c1):o.className.replace(c1,c2);
		break;
		case 'add':
			if(!jscss('check',o,c1)){o.className+=o.className?' '+c1:c1;}
		break;
		case 'remove':
			var rep=o.className.match(' '+c1)?' '+c1:c1;
			o.className=o.className.replace(rep,'');
		break;
		case 'check':
			return new RegExp('\\b'+c1+'\\b').test(o.className)
		break;
	}
}

/* Photo Toggle */

function show_photo(idx) {
	
	image_old = document.getElementById('image'+current_photo);
	image_control_old = document.getElementById('image_control'+current_photo);
	jscss('add', image_old, 'hidden');
	jscss('remove', image_control_old, 'current');
	
	image_new = document.getElementById('image'+idx);
	image_control_new = document.getElementById('image_control'+idx);
	jscss('remove', image_new, 'hidden');
	jscss('add', image_control_new, 'current');
	
	current_photo = idx;
}


