// @@ GLOBAL VARIABLES

var mainDomain="everbritecleaning.co.uk";
var siteName="Ever Brite Cleaning Services";


// @@@@@ adding a favourite @@@@@

function addBookmark() {
  if (window.external)
    external.AddFavorite("http://www."+mainDomain+"/",siteName)
  else
    alert("We're sorry, your browser does not support this feature.\n\nPlease manually add our site to your Bookmarks\n(typically, keystroke Ctrl+D), thank you.");
}

function drawAddFav(linkText) {
  if (!linkText) var linkText="Add us to your Favourites";
  document.write('<a href="javascript:addBookmark();" target="_self" title="Click now to add us to your Favourites">'+linkText+'</a>');
}


// @@@@@ 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) {
  var w = ((addW) ? addW : 0);
  var h = ((addH) ? addH : 0);
  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="main.css"></head><body style="margin:10px;font-size:11px;" onload="resizeTo(document.popupImg.width+50+'+w+',document.popupImg.height+100+'+h+'); window.focus()"><div align="center"><img border="0" src="' + img + '" name="popupImg"><br><br>[<a href="javascript:window.close()">close window</a>]</div></body></html>');
    close();
  }
}


// @@@@@ generic popup window @@@@@

function popup(doc,name,s,w,h,r) {
  remoteWin=window.open(doc,name,"scrollbars=" + s + ",width=" + w + ",height=" + h + ",resizable=" + r);
  remoteWin.focus();
}
