/*
============================================================
Script:     Automatic E-mail This Link Script 
            With Auto-Capture and Validation

Functions:  This script automatically captures the title of
            the current page and the url of the current page
            and sends them via the user's e-mail client to
            an address entered in a box on the form.  The
            e-mail address field is also checked to see that
            it is not empty, and that the e-mail address is
            in valid format.

Browsers:   IE4-6, NS4-6

Author:     etLux
============================================================
Put the following script in the body of your page.  No
modifications are needed. Note the two expressions commented
in the script that each must be placed intact on a single
line.

<!-- Begin E-Mail-This-Page Script //-->
<form name="eMailer">
E-MAIL THIS LINK
<br />
Enter recipient's e-mail:
<br />
<input type="text" name="address" size="25">
<br />
<input type="button" value="Send this URL" onClick="mailThisUrl();">
</form>

*/
// (C) 2000 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this header

// validates that the entry is formatted as an e-mail address
function isEMailAddr(theAddr) {
	var str = theAddr;
    var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
    if (!str.match(re)) {
        alert("That e-mail address format is very strange. \nIt may not be sent.");
        //setTimeout("focusElement('" + elem.form.name + "', '" + elem.name + "')", 0);
        return true;
    } else {
        return true;
    }
}

u = window.location;
t = document.title;

function mailThisUrl(){
	r = "<a href=\""+u+"\">"+u+"</a>";
	m = "CAPLA: I thought this might interest you...";
	d = "While viewing RecognitionForLearning.ca, I came across this page and I thought it may interest you....";
	msg = d+"The title of it is: \""+t+"\" and the URL is: "+u;
		// the following expression must be all on one line...
	//emailAddr = window.prompt('Enter the email address \nof the recipient:','');
	emailAddr = "";
	//if (isEMailAddr(emailAddr)) {
		//window.location = "mailto:"+emailAddr+"?body="+msg+"&subject="+m;
		window.location = "mailto:"+emailAddr+"?subject="+m+"&body="+msg;
		//window.location = "mailto:"+document.eMailer.address.value+"?subject="+m+"&body="+document.title+" "+u;
		//window.location = "mailto:"+document.eMailer.address.value+"?subject="+u;
	//}
}

function mailSpecificItem(url,which){
	m = "CAPLA: I thought this might interest you...";
	msg = "While viewing RecognitionForLearning.ca, I came across this item and I thought it may interest you....\n\r\n\rThe link is: http://"+url+'?i='+which;
	emailAddr = "";
	
	
	window.location = "mailto:"+emailAddr+"?subject="+m+"&body="+escape(msg);
}

