function swap(des,num) {
	if (document.images) {
		document.images[names[des]].src = buttons[num].src;
	}
}

function changelink(src) {
	document.links['thumblink'].href = src.getAttribute('href');
}

function popup(src, features, width, height) {
    if ( width > 0 && height > 0 ) {
        features += ',width=' + (width + 25) + ',height=' + (height + 50);
    }
    
	var theWindow = window.open('/util/loadimg.php?img='+src.getAttribute('href'), src.getAttribute('target'), features);
	theWindow.focus();
	return theWindow;
}
function popupSlideshow(src, index, features) {
	var theWindow = window.open(src.getAttribute('href') + '&photoIndex=' + index, src.getAttribute('target'), features);
	theWindow.focus();
	return theWindow;
}

function popupVr(src, features, width, height) {
    if ( width > 0 && height > 0 ) {
        features += ',width=' + (width + 15) + ',height=' + (height + 60);
    }

	var theWindow = window.open('/util/loadvr.php?vr='+src.getAttribute('href'), src.getAttribute('target'), features);
	theWindow.focus();
	return theWindow;
}

/* DETECT BROWSER FOR WINDOW SIZING PURPOSES */
dh = 0;
dw = 0;

if(navigator.userAgent.match(/MSIE/) && navigator.userAgent.match(/Mac/i)) {
	dh = -16;
	dw = -15;
} else if (navigator.userAgent.match(/MSIE/)) {
	dh = -20;
}