// simple function to decode coded email addresses
//  given user with ! for @ and # for .
//    and subject (optional) 
// 30/12/04 MSA Created
// 29/04/05 MSA Changed subject for Avisoft site
// 14/03/06 MSA Added text and called mail2 so will validate

function sm(user, subject, text )
{
  if (subject == undefined) {subject = 'From Website'      ;} // default if not specified
  if (subject == ''       ) {subject = 'From Website'      ;} // default if null
  if (subject != ''       ) {subject = '?subject='+subject ;} // set up subject
  user = user.replace(/#/g,'.') ;                             // restore dots
  user = user.replace(/!/g,'@') ;                             // restore at sign
  if (text    == undefined) {text    = user                ;} // default if not specified
  if (text    == ''       ) {text    = user                ;} // default if null
  document.write('<a href="mailto:' + user + subject +'">'+text+'</a>');  // and write it out to page
}

