// popup

function ShowEA(who, suff, name, site) {

var email = name + "\u0040" + site + '.' + suff;

var pos = StrPos(email, 'http://');
if (pos >= 0) {
	var anchor = '<a href="' + email + '" target="_blank" onclick="self.close()"></a>';
} else {
	var anchor = '<a href="mailto: ' + email + '" onclick="self.close()"> ' + email + '</a></p>';
}

var popupWin = PopUp('', 'EmailPopup', '400', '240', 'yes', '');

popupWin.document.write('<html><head><title>User E-mail Address</title></head>');
popupWin.document.write('<body style="margin: 16px; padding: 0">');
popupWin.document.write('<p align="center"><b>User E-mail Address</b></p>');
popupWin.document.write('<br>');
popupWin.document.write('<p align="center"><b>' + who + '</b></p>');
popupWin.document.write('<p align="center">' + anchor + '</p>');
popupWin.document.write('<br>');
popupWin.document.write('<p align="center"><a href="javascript: self.close();window.opener.focus();">Close Window</a></p>');
popupWin.document.write('</body></html>');
popupWin.document.close();

}

function StrPos(str, txt) {

for (var i = 0; i < str.length; i++) {
	if (str.substring(i, txt.length) == txt) return i;
}

return -1;

}

function ShowFullSizeImage(wwwImagePath) {

var idx =  wwwImagePath.lastIndexOf('/');
var imageName = wwwImagePath.substr(idx + 1);

var popupWin = PopUp('', 'FullSizeImagePopup', '', '', 'yes', '', 'resizable=yes');

popupWin.document.write('<html><head><title>' + imageName + '</title></head>');
popupWin.document.write('<body style="margin: 8px; padding: 0"><img src="' + wwwImagePath + '">');
popupWin.document.write('<p align="center"><a href="javascript: self.close();window.opener.focus();">Close Window</a></p>');
popupWin.document.write('</body></html>');
popupWin.document.close();

}

function PopUp(myPage, myName, w, h, scroll, menu, options) {

var winProps = '';

if (w && h) {
  var winLeft = (screen.width - w) / 2;
  var winTop = (screen.height - h) / 2 - 30;
  winProps = 'width='+w+',height='+h+',top='+winTop+',left='+winLeft+',';
}
if (scroll) {
  winProps += 'scrollbars='+scroll;
}
if (menu) {
  winProps += ',menubar='+menu;
}
if (options) {
  winProps += ',' + options;
}

var popupWin = window.open(myPage, myName, winProps);

if (parseInt(navigator.appVersion) >= 4) {
  popupWin.window.focus();
}

return popupWin;

}
