var locallink=false;
function setupLinks()
{
    var j=0;

    for (var i=0;i<document.links.length;i++)
    {
        if ((document.links[i].href.substring(0, 38) == 'http://trimarkpublications.ecnext.com/') ||
            (document.links[i].href.substring(0, 39) == 'https://trimarkpublications.ecnext.com/') ||
            (document.links[i].href.substring(0,4) != 'http'))
        {
            document.links[i].onclick = function(){ locallink = true };
        }
    }
}

function checkExit()
{
    var cookieval = getCookieSurvey('survey');
    if (cookieval == null)
    {
        if (!locallink)
        {
            var expdate = new Date ();
            expdate.setTime (expdate.getTime() + (10 * 365 *   24 * 60 * 60 * 1000)); // 10 years from now
            setCookieSurvey('survey','1',expdate,' ','trimarkpublications.ecnext.com','');
            window.open("http://www.surveymonkey.com/s.asp?u=78770830597","","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=500");
        }
    }
}


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

function getCookieVal (offset)
{
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1)
    endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset,   endstr));
}


function getCookieSurvey (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 PopUp(url,wsize,hsize,resize)
  {
    window.open(url, 'childwin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,width='+wsize+',height='+hsize+',resizable='+resize);
  }

  function WinOpen(url,wsize,hsize,resize)
  {
     window.open(url, 'childwin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,width='+wsize+',height='+hsize+',resizable='+resize)
  }

  function openWinView(url)
  {
    winview=window.open(url, 'winview', 'toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,resizable=yes,width=600,height=500,scrollbars=yes');
    winview.focus();
  }

  function changeButton(myImage)
  {

    re=/On\.gif/;

    found=re.exec(myImage.src);

    if  (found == 'On.gif')
    {
      re = /On\.gif/;
      newSrc=myImage.src.replace(re,'Off.gif');
      myImage.src=newSrc;
    }else{
      re = /Off\.gif/;
      newSrc=myImage.src.replace(re,'On.gif');
      myImage.src=newSrc;
    }

  }
  function RUSure()
  {
    if(confirm("Are you sure you want to\nclear the entire form?"))
    {
      document.registration.reset();
    }
    else
    {
      return;
    }
  }

  function preLoad()
  {
    return;
  }
