// Open a new window of a certain size.
// Usage: <a href="javascript:openWindow('images/filename.jpg', '570', '220');"></a>

function openWindow(url, iwidth, iheight) {
  var params = 'resizable,width='+iwidth+',height='+iheight
  popupWin = window.open(url, 'popup', params)
  popupWin.focus()
}

// Open a new window of a certain size.
// Usage: <a href="javascript:openGalleryWindow('images/filename.jpg', '570', '220', '<b>text</b>');"></a>

function openGalleryWindow(url, iwidth, iheight, text) {
  var params = 'resizable,width='+iwidth+',height='+iheight
  popupWin = window.open(url, 'popup', params)
  popupWin.focus()
  popupWin.document.write('<div align="center"><img border=1 src="'+url+'"></div>')
  popupWin.document.write('<table border="0" cellspacing="0" cellpadding="3" width="100%"><tr><td><b>'+text+'</b></td><td align="right"><a href="javascript:onclick=window.close()">close</a></td></tr></table>')
  popupWin.document.close()
}

// Closes the popup when focus is lost
// Usage: In body Tag: onfocus="KillPop()"

function KillPop() {
  if (self.popupWin) {
    self.popupWin.close()
  }
}


// Generates email address "safe" from harvesters
// <SCRIPT language=javascript>generateAntiSpiderEmail('user', 'domain', 'tld', 'display_text');</SCRIPT>

function generateAntiSpiderEmail(Username, DomainName, TLD, Text) {
	Address = Username + "&#64;" + DomainName + "." + TLD;

	if (!(Text)) {DisplayText = Address}
	else {DisplayText = Text};

	document.write("<a href=\"ma" + "il" + "to:" + Address + "\">" + DisplayText + "</a>");
}


