// javascript file common.js
var myweb=top.document.URL;
var mydefpage="index.html";
var mysubject="Family%20History";
var myem1="alan";
var myem2="blackwellad";
var myem3="freeserve.co.uk";
var lastem="";
var lastcc="";
var lastsubject="";
var lastbody="";

// Function combines parts of an email address
function getem(x,y,z)
{
   return x+"@"+y+"."+z;
}

// Function invokes an email with specified destination and subject
function domail(x,y,z,s,b)
{
   action="m"+"ailt"+"o:";
   me=getem(myem1,myem2,myem3);
   dest=me;
   if (x+y+z){dest=getem(x,y,z)};
   lastem=dest;
   cc="cc="+me+"&";
   if (me==dest){cc=""; lastcc=""}else{lastcc=me}
   if (s){s+="%20"}else{s=""}
   s+=mysubject;
   subject="subject="+s;
   lastsubject=decodeURI(s);
   if (b){b+="\n\n"}else {b=""}
   b+="Linked%20from%20"+myweb+"%20%20Page:%20"+document.title;
   lastbody=decodeURI(b);
   body="&body="+b;
   hr=action+dest+"?"+cc+subject+body;
   return hr;
}

// Function to force use of frameset - to be called in the Head of each html doc
function forceframes(relpath)
{
    if (top.location==self.location)
    {
        top.location.href=relpath+mydefpage+"?"+document.URL;
    }
}

// Function to warn when an email is being sent
function warnmail()
{
	x="When you click the OK button below, this should automatically open your Email client program (e.g. Outlook Express or Windows Mail) with the basic details already filled in to create a new email. Don\'t forget to send it from your Outbox !\n\n";
	x+="However, this will not work properly if you do not have an Email client program installed and correctly configued on your computer. For example, if you normally send emails via a web-based service (e.g Hotmail, Yahoo, Gmail, or a similar web-mail service provided by your ISP).\n\n";
	x+="In this case, just highlight and copy the details below, and then send an email manually in your normal manner, with the same details.\n\n";
	x+="To: "+lastem+"\n";
	if (lastcc) x+="Cc: "+lastcc+"\n";
	if (lastsubject) x+="Subject: "+lastsubject+"\n";
	if (lastbody) x+="\n"+lastbody;
	alert(x);
	return true;
}