// @@ GLOBAL VARIABLES

var mainDomain="oxfordaunts.co.uk";
var siteName="Oxford Aunts Care";
var postcode="OX1+3EX";
var styleSheet="css/default.css";

// @@@@@ generating a spam-safe e-mail address @@@@@

function drawEmail(alias,text,dn,title) {
  var at = '&#064;'; // at symbol encoded
  var p1 = '&#109;&#097;&#105;&#108;'; // protocol name encoded part 1
  var p2 = '&#116;&#111;&#58;'; // protocol name encoded part 2
  if (!dn) dn=mainDomain;
  if (title) title=' title="'+title+'"'
    else title='';
  if (!text) text=alias+at+dn;
  document.write('<a href="'+p1+p2+alias+at+dn+'"'+title+'>'+text+'</a>');
}

// @@@@@ popup window to Image size and wrap in HTML @@@@@

function popupImg(img,addH,addW,caption) {
  var w = ((addW) ? addW : 0);
  var h = ((addH) ? addH : 0);
  var c = ((caption) ? ('<p align="center">' + caption + '</p>') : '');
  remoteWin = window.open("","photo","resizable=1,width=200,height=200,status=1,scrollbars="+(((h<0)||(w<0)) ? "1" : "0"));
  with (remoteWin.document) {
    open('text/html', 'replace');
    write('<html><head><meta http-equiv="imagetoolbar" content="no"><title>'+siteName+'</title><link rel="stylesheet" type="text/css" href="http://www.'+mainDomain+'/css/popup.css"></head><body style="margin:20px;font-size:11px;" onload="resizeTo(document.images[0].width+60+'+w+',document.images[0].height+190+'+h+'); window.focus()"><p align="center"><img border="0" src="' + img + '" name="popupImg"></p>' + c + '<p align="center">[<a href="javascript:window.close()">close window</a>]</p></body></html>');
    close();
  }
}
