function show_gallery_photo(photoid) {
	if(!show_gallery_photo_data[photoid]) return false;
	photo = show_gallery_photo_data[photoid];

	var mvx = (screen.availWidth - photo.large_width)/2;
	var mvy = (screen.availHeight - photo.large_height)/2;

	var winopts = '';
	winopts += 'width='+photo.large_width+',';
	winopts += 'height='+photo.large_height+',';
	winopts += 'resizable=yes,';
	winopts += 'scrollbars=no,';
	winopts += 'left='+mvx+',';
	winopts += 'top='+mvy+'';

	var win = window.open('about:blank', 'galleryphoto_'+photoid, winopts);

	var buf = '';
	buf += '<html><head><title>'+photo.galleryphoto_title+'</title></head>';
	buf += '<body style="margin:0px;padding:0px;">'
	buf += '<img id="galleryphoto" src="'+photo.large+'" width="'+photo.large_width+'" height="'+photo.large_height+'" alt="'+photo.galleryphoto_title+'" border="0" hspace="0" vspace="0" onclick="window.opener.photoClick(window);" galleryimg="no">';
	buf += '<div id="galleryphoto_control" style="position:absolute;visibility:hidden;left:0px;top:0px;"></div>';
	buf += '<div id="galleryphoto_info" style="position:absolute;visibility:hidden;left:0px;top:0px;"></div>';
	buf += '</body>';
	buf += '</html>';

	win.document.open();
	win.document.write(buf);
	win.document.close();

	//var imgphoto = win.document.getElementById('galleryphoto');

	var divcontrol = win.document.getElementById('galleryphoto_control');
	var divcontrol_width = '183';
	divcontrol.style.backgroundColor = '#FFFFFF';
	divcontrol.style.color = '#000000';
	divcontrol.style.fontSize = '11px';
	divcontrol.style.whiteSpace = 'nowrap';
	divcontrol.style.border = 'solid black 1px';
	divcontrol.style.borderWidth = '0px 0px 1px 1px';
	divcontrol.style.fontFamily = 'Arial, Helvetica, sans-serif';
	divcontrol.style.padding = '2px 0px;';
	divcontrol.style.width = divcontrol_width + 'px';
	divcontrol.style.textAlign = 'center';

	var buf = '';
	buf += '&nbsp;';
	buf += '<a href="javascript:window.opener.photoClick(window)" style="color:black;text-decoration:none;"><span id="lblShowHide">showa</span> details</a>';
	buf += '&nbsp;|&nbsp;';

	if(photo.original) {
		buf += '<a href="javascript:window.opener.showHiRes(\''+photo.original+'\');window.close();" style="color:black;text-decoration:none;">view original</a>';
		buf += '&nbsp;|&nbsp;';
	}

	buf += '<a href="javascript:window.close()" style="color:black;text-decoration:none;">close</a>';
	buf += '&nbsp;';

	divcontrol.innerHTML = buf;

	divcontrol.style.top = '0px';
	divcontrol.style.left = (photo.large_width - divcontrol.offsetWidth) + 'px';

	divcontrol.style.visibility = 'visible';

	////////////
	var divinfo = win.document.getElementById('galleryphoto_info');
	divinfo.style.backgroundColor = '#FFFFFF';
	divinfo.style.color = '#000000';
	divinfo.style.fontSize = '11px';
	divinfo.style.border = 'solid black 1px';
	divinfo.style.borderWidth = '1px 1px 0px 0px';
	divinfo.style.fontFamily = 'Arial, Helvetica, sans-serif';
	divinfo.style.padding = '2px 3px';
	divinfo.style.width = (photo.large_width - 15) + 'px';

	var buf = '';
	var showdivinfo = 0;
	if(photo.galleryphoto_title || photo.galleryphoto_description) {
		buf += '<b>'+photo.galleryphoto_title+'</b> ';
		buf += photo.galleryphoto_description;
		showdivinfo = 1;
	} else {
		buf = '<i>No photo information available</i>';
		showdivinfo = 0;
	}
	buf += ' <a href="javascript:window.opener.photoClick(window)">hide description</a>';
	divinfo.innerHTML = buf;

	divinfo.style.top = (photo.large_height - divinfo.offsetHeight) + 'px';
	divinfo.style.left = ((photo.large_width - divinfo.offsetWidth) / 2) + 'px';

	if(showdivinfo) {
		divinfo.style.visibility = 'visible';
		win.document.getElementById('lblShowHide').innerHTML = 'hide';
	} else {
		win.document.getElementById('lblShowHide').innerHTML = 'show';
	}
	win.focus();
}

function photoClick(win) {
	var divcontrol = win.document.getElementById('galleryphoto_control');
	var divinfo = win.document.getElementById('galleryphoto_info');

	var newval = (divcontrol.style.visibility == 'visible' && divinfo.style.visibility == 'visible') ? 'hidden' : 'visible';

	win.document.getElementById('lblShowHide').innerHTML = (newval == 'hidden') ? 'show' : 'hide';

	//divcontrol.style.visibility = newval;
	divinfo.style.visibility = newval;

	win.focus();
}

function showHiRes(photohref) {
	var winwidth = 800;
	var winheight = 600;

	var mvx = (screen.availWidth - winwidth)/2;
	var mvy = (screen.availHeight - winheight)/2;

	var winopts = '';
	winopts += 'width='+winwidth+',';
	winopts += 'height='+winheight+',';
	winopts += 'resizable=yes,scrollbars=yes,';
	winopts += 'left='+mvx+',';
	winopts += 'top='+mvy+'';

	var win = window.open('about:blank', 'galleryphoto_hires', winopts);

	var buf = '';
	buf += '<html><head><title></title></head>';
	buf += '<body style="margin:0px;padding:0px;"><div align="center">'
	buf += '<img src="'+photohref+'" alt="" border="0" hspace="0" vspace="0" galleryimg="no">';
	buf += '</div></body>';
	buf += '</html>';

	win.document.open();
	win.document.write(buf);
	win.document.close();

	win.focus();
}

