Put the following in your overall layout just above the </head> line:
<script type="text/javascript">
function testkey(ev){
return ((ev.which ? ev.which : ev.keyCode) != '13');
}
function tellfriend(anc, pname){
var friend = document.getElementById('tell-' + anc);
var thisloc=location.href.replace(/%23/g, '#');
if (thisloc.indexOf('#') == -1) // no anchor so add one in
{
thisloc += '#' + anc;
}
else // replace existing anchor with our own
{
thisloc = thisloc.replace(/#.*/, '#' + anc)
}
if (friend.value != '') {
location.href = 'mailto:' + friend.value + '?subject=' + escape('Take a look at ') + pname
+ '&body=' + escape('I saw ' + thisloc + ' and thought you would be interested.');
}
}
</script>
Enter the following code into your product layout:
Enter e-mail address to tell a friend
<input type=text id="tell-<Actinic:Variable Name="EncodedProductAnchor"/>" value="" size="40" onKeypress="return testkey(event);"/>
<input type=button value="SEND" onclick="tellfriend('<Actinic:Variable Name="EncodedProductAnchor"/>','<actinic:block php="true">echo rawurlencode('<Actinic:Variable Name="ProductName" encoding="perl" selectable="false" />');</actinic:block>');">
<script type="text/javascript">
function testkey(ev){
return ((ev.which ? ev.which : ev.keyCode) != '13');
}
function tellfriend(anc, pname){
var friend = document.getElementById('tell-' + anc);
var thisloc=location.href.replace(/%23/g, '#');
if (thisloc.indexOf('#') == -1) // no anchor so add one in
{
thisloc += '#' + anc;
}
else // replace existing anchor with our own
{
thisloc = thisloc.replace(/#.*/, '#' + anc)
}
if (friend.value != '') {
location.href = 'mailto:' + friend.value + '?subject=' + escape('Take a look at ') + pname
+ '&body=' + escape('I saw ' + thisloc + ' and thought you would be interested.');
}
}
</script>
Enter the following code into your product layout:
Enter e-mail address to tell a friend
<input type=text id="tell-<Actinic:Variable Name="EncodedProductAnchor"/>" value="" size="40" onKeypress="return testkey(event);"/>
<input type=button value="SEND" onclick="tellfriend('<Actinic:Variable Name="EncodedProductAnchor"/>','<actinic:block php="true">echo rawurlencode('<Actinic:Variable Name="ProductName" encoding="perl" selectable="false" />');</actinic:block>');">