// variables
	// user-agent identity
	var version = parseInt(navigator.appVersion);
	var isNS  = (navigator.appName.indexOf("Netscape") >= 0);
	var isNS4 = (isNS && version == 4);
	var isNS5 = (isNS && version > 4);
	var isIE  = !(isNS);
	var isIE4 = (isIE && version == 4);
	var isIE5 = (isIE && version > 4);
	var isMac = (navigator.appVersion.indexOf("Macintosh") >= 0);
	var isWin = !(isMac);
	var isAOL = (navigator.userAgent.indexOf("AOL") >= 0);

	// Flash detection; minimum: version 4.0
	var flashVersion = 0;
	for (i = 4; i <= 7; i++)
	{
		if (isIE)
		{
			document.write('<script language="VBScript" type="text/vbscript">\n');
			document.write('On Error Resume Next\n');
			document.write('CreateObject("ShockwaveFlash.ShockwaveFlash." & i)\n');
			document.write('If Err = 0 Then\n');
			document.write('flashVersion = i\n');
			document.write('End If\n');
			document.write('</script>\n');
		}
		else
		{
			var plugin = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
			if (plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".") - 1)) >= i)
			{
				flashVersion = i;
			}
		}
	}

// cookie management
	function readCookie(name)
	{
		var cookieArray = document.cookie.split("; ");
		for (var i = 0; i < cookieArray.length; i++)
		{
			var nameValueArray = cookieArray[i].split("=", 2);
			if (nameValueArray[0] == name) return(nameValueArray[1]);
		}
		return(null);
	}

	function writeCookie(name, value, expires)
	{
		if (expires)
		{
			document.cookie = name + "=" + value + "; expires=" + expires.toGMTString();
		}
		else
		{
			document.cookie = name + "=" + value;
		}
	}

// event capturing
	if (isNS4)
	{
		window.captureEvents(Event.ONLOAD);
		window.onLoad = pageLoad;
		window.captureEvents(Event.ONUNLOAD);
		window.onUnload = pageUnload;
	}

	if (isNS5)
	{
		window.addEventListener("load", pageLoad, false);
		window.addEventListener("unload", pageUnload, false);
	}

	if (isIE)
	{
		window.attachEvent("onload", pageLoad);
		window.attachEvent("onunload", pageUnload);
	}

// event handlers
	function pageLoad(evt)
	{
		// frame break
		if (window != top) top.location.replace(location.href);
	}

	function pageUnload(evt)
	{
		// empty
	}

// mouseovers; incompatible with NS4
	//
	// Usage:
	// <a href="LINK"><img src="IMAGE.EXT" onload="mouseLoad(this);" width="WIDTH" height="HEIGHT" border="0" alt="ALT" /></a>
	// 
	// Note: mouseover image must be named IMAGE_over.EXT
	//
	function mouseLoad(obj)
	{
		if (isNS4 || obj.out) return;
		
		obj.out = new Image();
		obj.out.src = obj.src;
		obj.over = new Image();
		obj.over.src = obj.src.replace(/.gif$/, "_over.gif").replace(/.jpg$/, "_over.jpg");
		if (isNS5)
		{
			obj.addEventListener("mouseover", mouseOver, false);
			obj.addEventListener("mouseout", mouseOut, false);
		}
		if (isIE)
		{
			obj.attachEvent("onmouseover", mouseOver);
			obj.attachEvent("onmouseout", mouseOut);
		}
	}

	function mouseOver(evt)
	{
		obj = (evt.target) ? evt.target : evt.srcElement;
		obj.src = obj.over.src;
	}

	function mouseOut(evt)
	{
		obj = (evt.target) ? evt.target : evt.srcElement;
		if (obj.out) obj.src = obj.out.src;
	}
	
	function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function formChecker() 
  {
  	// Friends name
    if (document.formSTF.nomami.value == "")
      {
      alert("Please enter your friend's name.");
          document.formSTF.nomami.focus()
      return false;
      }
    // Friend's E-mail
    if (document.formSTF.emailami.value.indexOf("@") == -1 ||
        document.formSTF.emailami.value == "")
    {
      alert("Please include a proper e-mail address for your friend.");
          document.formSTF.emailami.focus()
      return false;
    }
	// Your email email efrom
	if (document.formSTF.email.value.indexOf("@") == -1 ||
        document.formSTF.email.value == "")
    {
      alert("Please include your proper e-mail address.");
          document.formSTF.email.focus()
      return false;
    }
	// Your Name
    if (document.formSTF.nom.value == "")
      {
      alert("Please enter your name.");
          document.formSTF.nom.focus()
      return false;
      }
	// eSubject
   /* if (document.formSTF.esubject.value == "")
      {
      alert("Please enter a subject that will appear in \nthe message to your friend.");
          document.formSTF.esubject.focus()
      return false;
      }*/
  }
