
  var cv_mon = 12;
  var cv_vrate = 960;
  var cv_wrate = 360;
  var cv_srate = 1.5;

  function ph(area,pre,suf) {
    document.write('(' + area + ") " + pre + "-" + suf);
  }

  function em(acct,dom,tld) {
    document.write('<a href="mailto:' + acct + "@" + dom + "." + tld + '">' + acct + "@" + dom + "." + tld + '</a>');
  }

  var popwin;

  function popopen(title,width,height,content) {

    if ( !popwin || popwin.closed ) {
      popwin=window.open('','pophelp','width=' + width +',height=' +height + ',resizable=yes,scrollbars=yes,top=50,left=10');
    }

    popwin.document.clear();
    popwin.document.writeln('<html> <head> <title>' + title + '</title> </head>');
    popwin.document.writeln('<body style="font-size: 80%; font-family: Arial, Helvetica, sans-serif;">');
    popwin.document.writeln(content);
    popwin.document.writeln('</body> </html>');
    popwin.document.close();
    popwin.focus();
  }

  function popclose() {
    if (popwin && !popwin.closed) {
      popwin.close();
    }
  }

  var effect = 0;
  function check_required(form) {
    var req = '';
    effect++;
    if (effect == 4) {
      effect = 0;
    }
    var hasValue = new Object;
    var inputs = document.getElementsByTagName('input');
    for (var i=0; i<inputs.length; i++) {
      if (inputs[i].className == 'required') {
        if (inputs[i].type == 'radio') {
          if (inputs[i].checked) {
            hasValue[inputs[i].name] = 'true';
          } else {
            if (hasValue[inputs[i].name] != 'true') {
              hasValue[inputs[i].name] = 'false';
            }
          }
        } else {
          if (! inputs[i].value) {
            hasValue[inputs[i].name] = 'false';
            if (effect == 1) {
              new Effect.Shake(inputs[i]);
            } else if (effect == 2) {
              new Effect.Pulsate(inputs[i]);
            } else if (effect == 3) {
              new Effect.Highlight(inputs[i]);
            }
          }
        }
      }
    }
    for (var name in hasValue) {
      if (hasValue[name] == 'false') {
        req = req + '\n\t' + name;
      }
    }
    var inputs = document.getElementsByTagName('select');
    for (var i=0; i<inputs.length; i++) {
      if (inputs[i].className=='required' && ! inputs[i].value) {
        req = req + '\n\t' + inputs[i].getAttribute('name');
        if (effect == 1) {
          new Effect.Shake(inputs[i]);
        } else if (effect == 2) {
          new Effect.Pulsate(inputs[i]);
        } else if (effect == 3) {
          new Effect.Highlight(inputs[i]);
        }
      }
    }
    var inputs = document.getElementsByTagName('textarea');
    for (var i=0; i<inputs.length; i++) {
      if (inputs[i].className=='required' && ! inputs[i].value) {
        req = req + '\n\t' + inputs[i].getAttribute('name');
        if (effect == 1) {
          new Effect.Shake(inputs[i]);
        } else if (effect == 2) {
          new Effect.Pulsate(inputs[i]);
        } else if (effect == 3) {
          new Effect.Highlight(inputs[i]);
        }
      }
    }
    if (req) {
      if (effect == 0) {
        alert('Values for these fields are required:\n' + req);
      }
      return false;
    } else {
      return true; 
    }
  }

  function CommaFormat(amount) {
  
    var samount = new String(amount);

    for (var i = 0; i < Math.floor((samount.length-(1+i))/3); i++) {
      samount = samount.substring(0,samount.length-(4*i+3)) + ',' + samount.substring(samount.length-(4*i+3));
    }

    return samount;
  }

  function fixflash(containerID){
    var msie = ((navigator.appVersion.indexOf("MSIE") != -1) && !window.opera) ? true : false; 
    if (msie) {
      var flashContainer = document.getElementById(containerID);
      var flashMovie = document.createElement("div");
      flashMovie.innerHTML = flashContainer.innerHTML.replace(/</g, "<").replace(/>/g, ">");
      flashContainer.parentNode.insertBefore(flashMovie, flashContainer);
      flashContainer.parentNode.removeChild(flashContainer);
      flashMovie.setAttribute("id",containerID);
    }
  }

  function ShowCookie() {
    var cookies = unescape(document.cookie).split(';');
    var output = '';
    for (var i=0; i<cookies.length; i++) {
      output = output + cookies[i] + '<br><br>';
    }
    document.getElementById("display").innerHTML = output;
  }

  function check_login() {
    var cookies = unescape(document.cookie).split(';');
    for (var i=0; i<cookies.length; i++) {
      if (cookies[i].indexOf(' ') == 0) {
        cookies[i] = cookies[i].substr(1); // This is to strip off leading spaces
      }
      if (cookies[i].substr(0,4) == 'dbtT' && cookies[i].substr(5) != '') {
        document.getElementById("topnav").innerHTML = '<a href="http://destroyer.stellaritsolutions.com/index.html">Home</a> | <a href="http://destroyer.stellaritsolutions.com/functions.php">Functions</a> | <a href="http://destroyer.stellaritsolutions.com/login.php?goto=logout">Logout</a> | <a href="http://destroyer.stellaritsolutions.com/contact.html">Contact Us</a>';
        break;
      }
    }
  }

  function SetCookie(name,value,days,path,domain) {
    var dc = name + '=' + escape(value);
    if (days) {
      var date = new Date();
      date.setDate(date.getDate() + days);
      dc = dc + '; expires=' + date.toGMTString();
    }
    if (path) {
      dc = dc + '; path=' + path;
    }
    if (domain) {
      dc = dc + '; domain=' + domain;
    }
    document.cookie = dc;
  }

  var comLoad = window.onload;
  window.onload = function() {
    if (comLoad) {
      comLoad();
    }
    check_login();
  }

