//  code by Alan Dix  © 2004   http://www.meandeviation.com/
//  you are free to use, copy, or distribute this code so long as this notice
//  is included in full and any modifications clearly indicated

function email_addr(name,host,isLink,otherName,subject) { //mod - added otherName for
	                                           //  when the link isn't the email address
                                                   // and optional subject variable
    var undefined;
	var email = name + "@" + host;
    var subj   = subject; // in format subject=text 
	if ( subj == undefined ) subj = "";
	if ( otherName == undefined ) otherName = "";
    if (  ! subj && otherName && otherName.match(/^subject=/) != null ) {
        subj = otherName;
        otherName = "";
    }
    if ( subj ) subj = "?" + subj;
    if (otherName)  { // mod - added this case
         isLink = 1; // must be live in this case  
         document.write("<a href=\"mailto:" + email + subj + "\">");
         document.write(otherName);
         document.write("</a>");
         document.close();
   }  else  {  //the rest is not modified
         if ( isLink ) document.write("<a href=\"mailto:" + email + subj + "\">");
         document.write(email);
         if ( isLink ) document.write("</a>");
         document.close();
   }
}

//function MM_openBrWindow(theURL,winName,features) { //v2.0
 // window.open(theURL,winName,features);
//}


	var popup=0;

function openWindow(URL,winName,params) { //v2.0
  popup=window.open(URL,winName,params);
  if (!popup.opener)
   { popup.opener=self; }
  popup.focus();  
}

function openImageWindow(imgurl,imgwidth,imgheight,title,width,height,winname,artist,work,photo,comment) {
    if ( ! imgurl.match(/^\w+:/) ) {   // should never happen, link.href makes urls absolute
		var myurl = location.href;
		var baseurl = myurl.replace(/\/[^\/]+$/,"/");
		imgurl = baseurl + imgurl;
	}
	var url = BASEURL + "info/imagedisplay.php?imgurl=" + escape(imgurl) + "&imgwidth=" + escape(imgwidth) + "&imgheight=" + escape(imgheight) + "&title=" + escape(title) + "&artist=" + escape(artist) + "&work=" + escape(work) + "&photo=" + escape(photo) + "&comment=" + escape(comment);
	openWindow(url,winname,'scrollbars=yes,resizable=yes,width=' + width + ',height=' + height); 
}

