<!--
/*   This script came from the 24 hour JavaScripts Sitelocated at http://www.javascripts.com.  It is brought to   you by Eric Jarvies, Lewis Sellers, Giuseppe Lombardo,           Kurt Anderson, and David Medinets. */var expDays = 30;var exp = new Date(); exp.setTime(exp.getTime() + (expDays*24*60*60*1000));function Count(info){                var WWHCount = GetCookie('WWHCount')                if (WWHCount == null) {                        WWHCount = 0;                }                else{                        WWHCount++;                }                SetCookie ('WWHCount', WWHCount, exp);        return WWHCount;}function set(){        VisitorName = prompt("Who are you?",'');        SetCookie ('VisitorName', VisitorName, exp);        SetCookie ('WWHCount', 0, exp);        SetCookie ('WWhenH', 0, exp);		document.location ='demo.html';return true;}function getCookieVal (offset) {          var endstr = document.cookie.indexOf (";", offset);          if (endstr == -1)                    endstr = document.cookie.length;                  return unescape(document.cookie.substring(offset, endstr));}function GetCookie (name) {          var arg = name + "=";          var alen = arg.length;          var clen = document.cookie.length;          var i = 0;          while (i < clen) {            var j = i + alen;            if (document.cookie.substring(i, j) == arg)                      return getCookieVal (j);                    i = document.cookie.indexOf(" ", i) + 1;                    if (i == 0) break;           }          return null;}function SetCookie (name, value) {          var argv = SetCookie.arguments;          var argc = SetCookie.arguments.length;          var expires = (argc > 2) ? argv[2] : null;          var path = (argc > 3) ? argv[3] : null;          var domain = (argc > 4) ? argv[4] : null;          var secure = (argc > 5) ? argv[5] : false;          document.cookie = name + "=" + escape (value) +         ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +         ((path == null) ? "" : ("; path=" + path)) +          ((domain == null) ? "" : ("; domain=" + domain)) +            ((secure == true) ? "; secure" : "");}function DeleteCookie (name) {          var exp = new Date();          exp.setTime (exp.getTime() - 1);          // This cookie is history          var cval = GetCookie (name);          document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();}
function launch198x300(URL) {
        window.open(URL, "NiceWindow",
		"scrollbars=no,resizable=yes,width=198,height=300");
}

// a sub-routine to call frmpopup to pop-up a new window with an advertisement in it
// usually called from an affiliate's web site, with an affiliate ID (source) passed in
// optionally, the affiliate may pass in a page number, if they have the ad pop-up on 
// several different pages.  Also having them pass in an Ad Class, which will only be
// to reference a particular ad, in the early stages of this project

//IMPORTANT -  this code is cloned in insiderreports/_scriptLibrary/jscriptnavigation.js
function popup_leadform(AffID, AffPage, AdClass, AdID, ProgID, CID, Close)
 {
   viewct = GetCookie("ViewCt")
   if (AffPage == null) AffPage = "X"
   if (AdClass == null) AdClass = 10
   if (AdID == null) AdID = 0
   if (ProgID == null) ProgID = 1004
   if (CID == null) CID = 0
   if (viewct == null && AffID > 0)
     launch198x300('http://www.huginc.com/includes/commoncode/frmpopup.asp?a='+AffID+'&P='+AffPage+'&ac='+AdClass+'&adid='+AdID+'&pid='+ProgID+'&cid='+CID+'&Close='+Close);
     else
     {if (viewct == null && AffID ==0)
     launch198x300('http://www.huginc.com/includes/commoncode/frmpopup.asp?a=30009770&P='+AffPage+'&ac='+AdClass+'&adid='+AdID+'&pid='+ProgID+'&cid='+CID+'&Close='+Close);
     }
    viewct++;
     SetCookie("ViewCt", viewct, exp, "/");                     //works
 }
 
 
 //Form Funtions//
function validateFormOnSubmit(Form1) {
 var reason = "";

  reason += validateEmpty(Form1.FirstName);
  reason += validateEmpty(Form1.LastName);
  reason += validateEmail(Form1.Email);
  reason += validatePhone(Form1.Phone);
  reason += validateEmpty(Form1.Postal);
      
  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 = '#FFFF99'; 
        error = "The required field 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$/ ;
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
    
    if (fld.value == "") {
        fld.style.background = '#FFFF99';
        error = "You didn't enter an email address.\n";
    } else if (!emailFilter.test(tfld)) {              //test email for illegal characters
        fld.style.background = '#FFFF99';
        error = "Please enter a valid email address.\n";
    } else if (fld.value.match(illegalChars)) {
        fld.style.background = '#FFFF99';
        error = "The email address contains illegal characters.\n";
    } else {
        fld.style.background = 'White';
    }
    return error;
}

function validatePhone(fld) {
    var error = "";
    var stripped = fld.value.replace(/[\(\)\.\-\ ]/g, '');     

   if (fld.value == "") {
        error = "You didn't enter a phone number.\n";
        fld.style.background = '#FFFF99';
    } else if (isNaN(parseInt(stripped))) {
        error = "The phone number contains illegal characters.\n";
        fld.style.background = '#FFFF99';
    } else if (!(stripped.length == 10)) {
        error = "Please include a valid phone number. Make sure you included an area code.\n";
        fld.style.background = '#FFFF99';
    } 
    return error;
}

-->