// very simple user agent detection
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;
var isMac = (navigator.userAgent.indexOf('Mac') != -1) ? true : false;

function pop(path, w, h, popName, scrollbars, resizable, menubar, toolbar) {
	if (!scrollbars) scrollbars=0;
	if (!resizable) resizable=0;
	if (!menubar) menubar=0;
	if (!toolbar) toolbar=0;

p = window.open(path,popName,'width=' + w + ',height=' + h + ',location=0,directories=0,status=0,menubar=' + menubar + ',toolbar=' + toolbar + ',scrollbars=' + scrollbars + ',resizable=' + resizable);
	p.focus();
}

function popZoomify(url) {
	pop(url, 650, 550, 'popZoomify', 0, 1);
}

function popHints(url) {
	pop(url, 400, 450, 'popHints', 1, 1);
}

function popVideo(url, w, h) {
	pop(url, w, h, 'popVideo', 0, 1);
}

function popAudio(url, w, h) {
	// ugly hack to fix problem on Mac IE with audio popups
	if (isIE && isMac && h < 100) {
		h = h + 30;
	}
	pop(url, w, h, 'popAudio', 0, 1);
}


function popTranscript(url) {
	pop(url, 400, 450, 'popTranscript', 1, 1, 1, 1);
}

function popMisc(url) {
	pop(url, 400, 450, 'popMisc', 1, 1, 1, 1);
}

// NLM-provided popup functionality for footer
function openPopup(POPUP)
{
  var popup =  window.open(POPUP,'popup','resizable=yes,scrollbars=yes,width=400,height=600');
  popup.focus();
}
