<!-- Begin

function Client()
{
  this.agent    = navigator.userAgent.toLowerCase();
  this.name     = navigator.appName.toLowerCase();
  this.majorVer = parseInt(navigator.appVersion);
  this.version  = parseFloat(navigator.appVersion);

  if (navigator.platform)
    this.opSys = navigator.platform;
  else
    this.opSys = "unknown";

  // do some operating system detection
  this.isMac = (this.opSys.indexOf("Mac") != -1);
  this.isWin = (this.opSys.indexOf("Win") != -1);
  this.isNt  = ((this.agent.indexOf("windows nt") != -1) ||
  	       ((this.agent.toLowerCase().indexOf("winnt") != -1)));

  // detect netscape
  this.ns  = (this.name == "netscape");
  this.ns2 = (this.ns && ((this.majorVer >= 2) && (this.majorVer < 5)));
  this.ns3 = (this.ns && ((this.majorVer >= 3) && (this.majorVer < 5)));
  this.ns4 = (this.ns && (this.majorVer == 4));
  this.ns5 = (this.ns && (this.majorVer >= 5));
  this.ns6 = (this.ns && (this.majorVer >= 6));

  // detect explorer
  this.ie  = (this.name == "microsoft internet explorer");
  this.ie3 = (this.ie && (this.majorVer >= 3));
  this.ie4 = (this.ie && (
  	     (this.agent.indexOf("msie 4") > -1) || (this.majorVer >= 4)));
  this.ie5 = (this.ie && (
  	     (this.agent.indexOf("msie 5") > -1) || (this.majorVer >= 5)));

  // detect other browsers
  this.op  = (this.agent.indexOf("opera") != -1);

  // MEMBER PROPERTIES
  this.ActiveXEnabled = (this.ie3 && !this.isMac);
  this.DHTMLEnabled   = (this.ns4 || this.ns5 || this.ie4);
  this.JavaEnabled    = (this.ns3 || this.ns5 || this.ie3);
  this.JSEnabled      = (this.ns2 || this.ns5 || this.ie3);
  this.VBEnabled      = (this.ie3);
  this.CSSSupport     = (this.ie4 || this.ie5 || this.ns5 || this.ns6);

  return this;
}

var client = new Client();

function setFocus(f)
{
  if (client.CSSSupport)
    f.style.backgroundColor='#c9c9c9';
}

function setBlur(f)
{
  if (client.CSSSupport)
   f.style.backgroundColor='#ffffff';
}

// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments

function setCookie(name, value, expires, path, domain, secure)
{
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist

function getCookie(name)
{
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1)
  {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  }
  else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
function deleteCookie(name, path, domain)
{
  if (getCookie(name))
  {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function addbookmark($url,$title)
{
  var bookmarkurl="http://www.sheltonfinancialgroup.com/"
  var bookmarktitle="Shelton Financial Group"

  if (document.all)
    window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

function isDigit(c)
{
  return((c>="0") && (c<="9"))
}

function isInteger(s)
{
  var i;

  for (i=0; i<s.length; i++)
  {
    if (!isDigit(s.charAt(i)))
      return(false);
  }
  return(true);
}

function whichRadioSelected(r)
{
  for (var i=0; i<r.length; i++)
  {
    if (r[i].checked)
      return(i);
  }
  return(-1);
}

function isRadioSelected(r)
{
  for (var i=0; i<r.length; i++)
  {
    if (r[i].checked)
      return(true);
  }
  return(false);
}

function ValidZip(z)
{
  var valid = "0123456789-";
  var hyphencount = 0;

  if (z.length != 5 && z.length != 10)
  {
    alert("Please enter your 5 digit or 5 digit+4 zip code.");
    return(false);
  }
  for (var i=0; i < z.length; i++)
  {
    temp = "" + z.substring(i, i+1);
    if (temp == "-")
      hyphencount++;
    if (valid.indexOf(temp) == "-1")
    {
      alert("Invalid characters in your zip code.  Please try again.");
      return(false);
    }
    if ((hyphencount > 1) || ((z.length == 10) && ""+z.charAt(5) != "-"))
    {
      alert("The hyphen character should be used with a properly formatted 5 digit+four zip code, like '12345-6789'.   Please try again.");
      return(false);
    }
  }
  return(true);
}

function ValidEmail(str)
{
  var filter=/^.+@.+\..{2,3}$/

  return(filter.test(str));
}

//  End -->

