function bookmark() {

	 var ua=navigator.userAgent.toLowerCase();
    var isKonq=(ua.indexOf('konqueror')!=-1);
    var isSafari=(ua.indexOf('webkit')!=-1);
    var isMac=(ua.indexOf('mac')!=-1);
    var buttonStr=isMac?'Command/Cmd':'CTRL';

    if(window.external && (!document.createTextNode ||
      (typeof(window.external.AddFavorite)=='unknown'))) {
        // IE4/Win generates an error when you
        // execute "typeof(window.external.AddFavorite)"
        // In IE7 the page must be from a web server, not directly from a local 
        // file system, otherwise, you will get a permission denied error.
        window.external.AddFavorite(self.location, document.title); // IE/Win
    } else if(isKonq) {
      alert('You need to press CTRL + B to bookmark our site.');
    } else if(window.opera) {
      void(0); // do nothing here (Opera 7+)
    } else if(window.home || isSafari) { // Firefox, Netscape, Safari, iCab
      alert('You need to press '+buttonStr+' + D to bookmark our site.');
    } else if(!window.print || isMac) { // IE5/Mac and Safari 1.0
      alert('You need to press Command/Cmd + D to bookmark our site.');    
    } else {
      alert('In order to bookmark this site you need to do so manually '+
        'through your browser.');
    }
}




function validateForm(theForm) {
	
	var reason = "";
	
	  reason += validateEmpty(theForm.your_name);
	  reason += validateEmpty(theForm.your_email);
	  reason += validateEmpty(theForm.friend_email);
	  reason += validateEmpty(theForm.friend_name);
	  reason += validateEmail(theForm.your_email);
 	  reason += validateEmail(theForm.friend_email);
	      
	 if (reason != "") {
	    alert("Some fields need correction:\n" + reason);
	    return false;
	 }
	
	 return true;
}


function validateEmpty(fld) {
    var error = "";
  
    if (fld.value.length == 0) {
        fld.style.background = '#9bacbe'; 
        error = "The required field "+fld.name+" has not been filled in.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;   
}


function trim(s)
{
  return s.replace(/^\s+|\s+$/, '');
} 


function validateEmail(fld) {
    var error="";
    var tfld = trim(fld.value);                        // value of field with whitespace trimmed off
    var emailFilter = /^\w(\.?[-\w])*@\w(\.?[-\w])*\.([a-z]{3}(\.[a-z]{2})?|[a-z]{2}(\.[a-z]{2})?)$/i;
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
    
    if (!emailFilter.test(tfld)) {              //test email for illegal characters
        fld.style.background = '#9bacbe';
        error = "Please enter a valid email address.\n";
    } else if (fld.value.match(illegalChars)) {
        fld.style.background = '#9bacbe';
        error = "The email address contains illegal characters.\n";
    } else {
        fld.style.background = '#ffffff';
    }
    return error;
}