function ltrim (s)
{
    return s.replace( /^\s*/, "" );
}

function rtrim (s)
{
    return s.replace( /\s*$/, "" );
}

function trim (s)
{
    return rtrim(ltrim(s));
}

function hideselect()
{
    var s = document.getElementsByTagName("SELECT")
    for(var i=0;i<s.length;i++) {
        s[i].style.display="none";
    }
}

function showselect()
{
    var s = document.getElementsByTagName("SELECT")
    for(var i=0;i<s.length;i++) {
        s[i].style.display="block";
        s[i].style.visibility="visible";
    }
}

function clientdisable()
{
    hideselect();
    return false;
}

function clientenable()
{
    showselect();
    return false;
}

function toggleinstruction(o)
{
    var i = document.getElementById("instructions")
    if (i.style.display == 'block') {
        o.src = "sysimages/downarrow.gif"
        i.style.display = 'none';
    }
    else {
        o.src = "sysimages/uparrow.gif"
        i.style.display = 'block';
    }
    return false;
}

function toggleid(id)
{
    var i = document.getElementById(id)
    if (i.style.display == 'block') {
        i.style.display = 'none';
    }
    else {
        i.style.display = 'block';
    }
    return false;
}

function toggleElement(id,o)
{
    var i = document.getElementById(id)
    if (i.style.display == 'block') {
        o.src = "sysimages/expand.gif"
        i.style.display = 'none';
    }
    else {
        o.src = "sysimages/collapse.gif"
        i.style.display = 'block';
    }
    return false;
}

var g_selectedrow = null;
var g_selectedid = null;

function selectrow(o,id)
{

    if (g_selectedrow != null) {
        unselectrow(g_selectedrow);
    }

    g_selectedid = id;
    g_selectedrow = o;
    g_selectedrow.className="selecthighlightcolor";

}

function unselectrow(o)
{
    o.className="unselecthighlightcolor";
    g_selectedrow = null;
    g_selectedid = null;
}

function unselectall()
{
    g_selectedrow = null;
    g_selectedid = null;
}

function selectedid()
{
    return(g_selectedid);
}

function changeheight(id,d)
{
    return changeObjectHeight(id,d,100,950);

}

function changeObjectHeight(id,d,minv,maxv)
{
    var o = document.getElementById(id);
    if (o) {
        var h = parseInt(o.offsetHeight);
        if ( ((h + d) > minv) && ((h + d) < maxv) ) {
            o.style.height = h + d + "px";
        }
    }
    return false;
}

function setObjectHeight(id,d)
{
    var o = document.getElementById(id);
    if (o) {
        o.style.height = parseInt(d) + "px";
    }
    return false;
}

function DateDiff(date1, date2)
{
    var objDate1=new Date(date1);
    var objDate2=new Date(date2);
    return parseInt((objDate1.getTime()-objDate2.getTime())/(1000*60*60*24));
}

function cookies()
{
    var cookieEnabled=(navigator.cookieEnabled)? true : false;

    //if not IE4+ nor NS6+
    if (typeof navigator.cookieEnabled=="undefined" && !cookieEnabled)  {
        document.cookie="testcookie"
        cookieEnabled=(document.cookie.indexOf("testcookie")!=-1)? true : false
    }

    return cookieEnabled;
}

function validEmail (email)
{
    //var filter = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$"
    var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if (!filter.test(email)) {
        return false;
    }

    return true;
}



function checkAll(field)
{
    var e = document.getElementsByName(field)
    if (e) {
        for (i = 0; i < e.length; i++)
            e[i].checked = true;
    }
}

function uncheckAll(field)
{
    var e = document.getElementsByName(field)
    if (e) {
        for (i = 0; i < e.length; i++)
            e[i].checked = false ;
    }
}

function enableAll(field)
{
    var e = document.getElementsByName(field)
    if (e) {
        for (i = 0; i < e.length; i++)
            e[i].disabled = false ;
    }
}

function disableAll(field)
{
    var e = document.getElementsByName(field)
    if (e) {
        for (i = 0; i < e.length; i++)
            e[i].disabled = true ;
    }
}

function isChecked(field)
{
    var e = document.getElementsByName(field)
    if (e) {
        for (i = 0; i < e.length; i++) {
            if (e[i].checked) {
                return true;
            }
        }
    }
    return false;

}

function isCheckedValue(field,v)
{
    var e = document.getElementsByName(field)
    if (e) {
        for (i = 0; i < e.length; i++) {
            if (e[i].value == v) {
                if (e[i].checked) {
                    return true;
                }
            }
        }
    }
    return false;
}

function checkValue(field,v)
{
    var e = document.getElementsByName(field)
    if (e) {
        for (i = 0; i < e.length; i++) {
            if (e[i].value == v+"") {
                e[i].checked = true;
            }
        }
    }
    return false;
}

function numberChecked(field)
{
    var count = 0;
    var e = document.getElementsByName(field);
    if (e) {
        for (i = 0; i < e.length; i++) {
            if (e[i].checked) {
                count = count + 1;
            }
        }
    }
    return count;
}

function isCheckedIndex(field,indx)
{
    var e = document.getElementsByName(field);
    if (e) {
        //alert ("index " + indx + " value: " + e[indx].value);
        if (e[indx].checked) {
            return true;
        }
    }
    return false;

}

function checkedIndexValue(field)
{
    var e = document.getElementsByName(field)
    if (e) {
        for (i = 0; i < e.length; i++) {
            if (e[i].checked) {
                return e[i].value;
            }
        }
    }
    return "";

}

function checkedIndexObject(field)
{
    var e = document.getElementsByName(field)
    if (e) {
        for (i = 0; i < e.length; i++) {
            if (e[i].checked) {
                return e[i];
            }
        }
    }
    return null;
}

function selectedFieldValue(field)
{
    var e = document.getElementsByName(field)
    if (e) {
        for (i = 0; i < e.length; i++) {
            if (e[i].checked) {
                return e[i].value;
            }
        }
    }

    return "";
}


function selectedFieldValues(field)
{
    var s = "";
    var e = document.getElementsByName(field)
    if (e) {
        for (i = 0; i < e.length; i++) {
            if (e[i].checked) {
                s = s + e[i].value + ",";
            }
        }
    }

    if (s != "") {
        s = s.substring(0,s.length-1);
    }

    return s;
}

function toggleSelect(id,field)
{
    if (document.getElementById(id).checked == true) {
        checkAll(field);
    }
    else {
        uncheckAll(field);
    }
}

function openHelp(fh)
{
    var w = window.open (fh,'helpwindow','scrollbars=1,resizeable=1,width=480,height=400,menubar=0,toolbar=1');
    w.focus();
}

function openhelpeditor(fh)
{
    var w = window.open ('helpeditor.asp?f='+fh,'helpeditorwindow','scrollbars=1,resizeable=1,width=640,height=480,menubar=0,toolbar=1');
    w.focus();
}

function openPopup(fh,wn,ws)
{
    var w = window.open (fh,wn,ws);
    w.focus();
}


function createCookie(name,value,days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else {
        var expires = "";
    }
    document.cookie = name+"="+value+expires+";";
}

function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}

function eraseCookie(name) {
    createCookie(name,"",-1);
}

function showarea(id)
{
    if (document.getElementById(id)) {
        document.getElementById(id).style.display = 'block';
    }
}

function printit()
{
    var sniffer = new browsersniffer();

    if (sniffer.op) {
        alert ("This feature is not currently supported in Opera browsers.");
        return false;
    }

    if (document.getElementById("buttonarea")) {
        document.getElementById("buttonarea").style.display = 'none';
    }

    if (window.print) {
        window.print();
    }
    else {
        var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
        document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
        WebBrowser1.ExecWB(6, 2); //Use a 1 vs. a 2 for a prompting dialog box
        WebBrowser1.outerHTML = "";
    }

    delete sniffer;
    setTimeout("showarea('buttonarea')",1000);
}

function browsersniffer()
{
    var exclude=1;
    var agt=navigator.userAgent.toLowerCase();
    this.win=0;
    this.mac=0;
    this.lin=1;

    if(agt.indexOf('win')!=-1){this.win=1;this.lin=0;}
    if(agt.indexOf('mac')!=-1){this.mac=1;this.lin=0;}

    this.lnx=0; if(this.lin){this.lnx=1;}
    this.ice=0;
    this.ie=0;
    this.ie4=0;
    this.ie5=0;
    this.ie6=0;
    this.com=0;
    this.dcm=0;
    this.op=0;
    this.op5=0;
    this.op6=0;
    this.op7=0;
    this.ns4=0;
    this.ns6=0;
    this.ns7=0;
    this.mz7=0;
    this.kde=0;
    this.saf=0;
    if(typeof navigator.vendor!="undefined" && navigator.vendor=="KDE"){
        var thisKDE=agt;
        var splitKDE=thisKDE.split("konqueror/");
        var aKDE=splitKDE[1].split("; ");
        var KDEn=parseFloat(aKDE[0]);
        if(KDEn>=2.2){
            this.kde=1;
            this.ns6=1;
            exclude=0;
            }
        }
    else if(agt.indexOf('webtv')!=-1){exclude=1;}
    else if(typeof window.opera!="undefined"){
        exclude=0;
        this.op=1;
        if(/opera[\/ ][5]/.test(agt)){this.op5=1;}
        if(/opera[\/ ][6]/.test(agt)){this.op6=1;}
        if(/opera[\/ ][7-9]/.test(agt)){this.op7=1;}
        }
    else if(typeof document.all!="undefined"&&!this.kde){
        exclude=0;
        this.ie=1;
        if(typeof document.getElementById!="undefined"){
            this.ie5=1;
            if(agt.indexOf("msie 6")!=-1){
                this.ie6=1;
                this.dcm=document.compatMode;
                if(this.dcm!="BackCompat"){this.com=1;}
                }
            }
        else{this.ie4=1;}
        }
    else if(typeof document.getElementById!="undefined"){
        exclude=0;
        if(agt.indexOf("netscape/6")!=-1||agt.indexOf("netscape6")!=-1){this.ns6=1;}
        else if(agt.indexOf("netscape/7")!=-1||agt.indexOf("netscape7")!=-1){this.ns6=1;this.ns7=1;}
        else if(agt.indexOf("gecko")!=-1){this.ns6=1;this.mz7=1;}
        if(agt.indexOf("safari")!=-1 || (typeof document.childNodes!="undefined" && typeof document.all=="undefined" && typeof navigator.taintEnabled=="undefined")){this.mz7=0;this.ns6=1;this.saf=1;}
        }
    else if((agt.indexOf('mozilla')!=-1)&&(parseInt(navigator.appVersion)>=4)){
        exclude=0;
        this.ns4=1;
        if(typeof navigator.mimeTypes['*']=="undefined"){
            exclude=1;
            this.ns4=0;
            }
        }
    if(agt.indexOf('escape')!=-1){exclude=1;this.ns4=0;}
    if(typeof navigator.__ice_version!="undefined"){exclude=1;this.ie4=0;}
}

function viewall(id,ip)
{
    var cnt = 0;
    var s = document.getElementById(id).getElementsByTagName("A")
    for(var i=0;i<s.length;i++) {
        s[i].style.backgroundColor="#000000";
        s[i].style.color="gold";
        if (s[i].innerHTML.indexOf(ip) != -1) {
            s[i].style.backgroundColor="yellow";
            s[i].style.color="#EE00EE";
            cnt += 1;
        }
    }

    if ($("recordcount")) {
        var rc = $("recordcount").innerHTML;
        rc = rc.replace(/\/.*$/gi,"")
        $("recordcount").innerHTML = rc + "/" + cnt;
    }
}


function getPageDimensions() {

    var dimensions = {width: 0, height: 0};

    var viewportwidth;
    var viewportheight;

    // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight

    if (typeof window.innerWidth != 'undefined')
    {
         viewportwidth = window.innerWidth,
         viewportheight = window.innerHeight
    }

   // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

    else if (typeof document.documentElement != 'undefined'
        && typeof document.documentElement.clientWidth !=
        'undefined' && document.documentElement.clientWidth != 0)
    {
          viewportwidth = document.documentElement.clientWidth,
          viewportheight = document.documentElement.clientHeight
    }

    // older versions of IE

    else
    {
          viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
          viewportheight = document.getElementsByTagName('body')[0].clientHeight
    }

    dimensions.width = viewportwidth;
    dimensions.height = viewportheight;

    return dimensions;

}

var objWorking;
var objImg;
var workingTimer = null;
var cancelTimer = false;

function hideworking()
{
    if (workingTimer != null) {
        clearTimeout (workingTimer);
        cancelTimer = true;
        workingTimer = null;
    }

    setTimeout ("hideworkingcallback()",1000);
}

function hideworkingcallback()
{
    // make select boxes visible
    var selects = document.getElementsByTagName("select");
    for (i = 0; i != selects.length; i++) {
        selects[i].style.visibility = "visible";
    }

    objWorking = document.getElementById('workingoverlay');
    if (objWorking) {
        objImg.style.display = 'none';
        objWorking.style.display = 'none';
    }
}

function showworking()
{
    objWorking = document.getElementById('workingoverlay');
    if (! objWorking) {
        objWorking = document.createElement("div");
        objWorking.setAttribute('id','workingoverlay');
        objWorking.style.display = 'none';
        objWorking.style.position = 'absolute';
        objWorking.style.zIndex = '999';
        document.body.insertBefore(objWorking, document.body.firstChild);


        objImg = document.createElement("div");
        objImg.setAttribute('id','workingimg');
        objImg.style.width = "48px";
        objImg.style.height = "48px";
        objImg.style.textAlign = "center";
        //objImg.style.backgroundColor = "#404040";
        //objImg.style.color = "#000000";
        //objImg.style.color = "#000000";
        objImg.innerHTML = "<img src=\"\\sysimages\\ajax-loader.gif\" width=\"48\" height=\"48\">"

        objImg.style.display = 'none';
        objImg.style.position = 'absolute';
        objImg.style.zIndex = '1000';
        document.body.insertBefore(objImg, document.body.firstChild);
    }


    // set height of Overlay to take up whole page and show

    objWorking.style.top = '0';
    objWorking.style.left = '0'
    objWorking.style.height = parseInt(f_clientHeight()) + parseInt(f_scrollTop()) + 'px';
    //objWorking.style.height = parseInt(window.innerHeight) + 'px';
    objWorking.style.width = '100%';

    objImg.style.top = (parseInt(f_clientHeight()) - 48) / 2 + parseInt(f_scrollTop()) + 'px';
    objImg.style.left = (parseInt(f_clientWidth()) - 48) / 2 + parseInt(f_scrollLeft()) + 'px';

    // make select boxes invisible
    var selects = document.getElementsByTagName("select");
    for (i = 0; i != selects.length; i++) {
        selects[i].style.visibility = "hidden";
    }

    objWorking.style.display = 'block';
    objImg.style.display = 'block';

    if (cancelTimer) {
        workingTimer = setTimeout ("showworking()",100)
    }

}

function showworking1(id)
{

    if (typeof(id) == "undefined" || document.getElementById(id)==null ) {
        return;
    }

    document.getElementById(id).style.position = "relative";
    var parentHeight = document.getElementById(id).offsetHeight < 50 ? 50 : document.getElementById(id).offsetHeight;
    var parentWidth = document.getElementById(id).offsetWidth;

    objWorking = document.getElementById(id+'overlay');
    if (! objWorking) {
        objWorking = document.createElement("div");
        objWorking.setAttribute('id',id+'overlay');
        objWorking.className = 'overlay';
        objWorking.style.display = 'none';
        objWorking.style.position = 'absolute';
        objWorking.style.zIndex = '999';
        objWorking.style.backgroundColor = '#333333';
        objWorking.style.filter = 'alpha(opacity=70)';
        objWorking.style.opacity = '0.70'; /* Safari, Opera and Mozilla */

        document.getElementById(id).appendChild(objWorking);

        objImg = document.createElement("div");
        objImg.setAttribute('id',id+'workingimg');
        objImg.style.width = "48px";
        objImg.style.height = "48px";
        objImg.innerHTML = "<img src=\"\\sysimages\\ajax-loader.gif\" width=\"48\" height=\"48\">"

        objImg.style.display = 'none';
        objImg.style.position = 'absolute';
        objImg.style.zIndex = '1000';
        objImg.style.border = 'none';


        objWorking.appendChild(objImg);
    }

    //
    // set height of Overlay to take up the object inside area
    //
    objWorking.style.top = '0';
    objWorking.style.top = document.getElementById(id).scrollTop + 'px';
    objWorking.style.left = '0'
    objWorking.style.left = document.getElementById(id).scrollLeft + 'px';
    objWorking.style.height = parentHeight + "px";
    objWorking.style.width = '100%';

    //
    // position the working icon
    //
    objImg.style.top = ((parseInt(parentHeight) - 48) / 2) + 'px';
    objImg.style.left = ((parseInt(parentWidth) - 48) / 2) + 'px';

    objWorking.style.display = 'block';
    objImg.style.display = 'block';
}

function hideworking1(id)
{
    if (typeof(id)=="undefined" || document.getElementById(id+"overlay")==null ) {
        return;
    }

    var el = document.getElementById(id+'overlay');
    if (el) {
        el.parentNode.removeChild(el);
    }
}

function f_clientWidth() {
    return f_filterResults (
        window.innerWidth ? window.innerWidth : 0,
        document.documentElement ? document.documentElement.clientWidth : 0,
        document.body ? document.body.clientWidth : 0
    );
}

function f_clientHeight() {
    return f_filterResults (
        window.innerHeight ? window.innerHeight : 0,
        document.documentElement ? document.documentElement.clientHeight : 0,
        document.body ? document.body.clientHeight : 0
    );
}

function f_scrollLeft() {
    return f_filterResults (
        window.pageXOffset ? window.pageXOffset : 0,
        document.documentElement ? document.documentElement.scrollLeft : 0,
        document.body ? document.body.scrollLeft : 0
    );
}

function f_scrollTop() {
    return f_filterResults (
        window.pageYOffset ? window.pageYOffset : 0,
        document.documentElement ? document.documentElement.scrollTop : 0,
        document.body ? document.body.scrollTop : 0
    );
}

function f_filterResults(n_win, n_docel, n_body) {
    var n_result = n_win ? n_win : 0;

    if (n_docel && (!n_result || (n_result > n_docel)))
        n_result = n_docel;
    return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

function isCurrency(txtValue)
{
    bIsValidCurrency = RegExp(/^\$?[0-9\,]+(\.\d{2})?$/).test(String(txtValue).replace(/^\s+|\s+$/g, ""));
    return bIsValidCurrency;
}

function CurrencyFormatted(amount)
{
    var i = parseFloat(amount);
    if(isNaN(i)) { i = 0.00; }
    var minus = '';
    if(i < 0) { minus = '-'; }
    i = Math.abs(i);
    //i = parseInt((i + .005) * 100);
    i = parseInt(i * 100);
    i = i / 100;
    s = new String(i);
    if(s.indexOf('.') < 0) { s += '.00'; }
    if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
    s = minus + s;
    return s;
}

function CommaFormatted(amount)
{
    var delimiter = ","; // replace comma if desired
    var a = amount.split('.',2)
    var d = a[1];
    var i = parseInt(a[0]);
    if(isNaN(i)) { return ''; }
    var minus = '';
    if(i < 0) { minus = '-'; }
    i = Math.abs(i);
    var n = new String(i);
    var a = [];
    while(n.length > 3)
    {
        var nn = n.substr(n.length-3);
        a.unshift(nn);
        n = n.substr(0,n.length-3);
    }
    if(n.length > 0) { a.unshift(n); }
    n = a.join(delimiter);
    if(d.length < 1) { amount = n; }
    else { amount = n + '.' + d; }
    amount = minus + amount;
    return amount;
}

function makebigger(id,p,dh)
{
    var h = parseInt($(id).style.height);
    h = (h+p) < dh ? dh : h + p;
    $(id).style.height = h + "px";
}

function fixtables()
{
    var tags = $("middleSection").getElementsByTagName("td");
    for (var i=0; i < tags.length;i++) {
        tags[i].innerHTML += "&nbsp;";
    }

}

function breadcrumbs(){
  sURL = new String;
  bits = new Object;
  var x = 0;
  var stop = 0;
  var output = "<a href=\"/\">Home</a>  >  ";
  sURL = location.href;
  sURL = sURL.slice(8,sURL.length);
  chunkStart = sURL.indexOf("/");
  sURL = sURL.slice(chunkStart+1,sURL.length)
  while(!stop){
    chunkStart = sURL.indexOf("/");
    if (chunkStart != -1){
      bits[x] = sURL.slice(0,chunkStart)
      sURL = sURL.slice(chunkStart+1,sURL.length);
    }else{
      stop = 1;
    }
    x++;
  }
  for(var i in bits){
    output += "<a href=\"";
    for(y=1;y<x-i;y++){
      output += "../";
    }
    output += bits[i] + "/\">" + bits[i] + "</a>  >  ";
  }
  document.write(output + document.title);
}


function debugtrace(s)
{
    var obj = document.getElementById("tracearea")
    if (obj) {
        obj.innerHTML = s + "<br/>" + obj.innerHTML;
    }
}

function stopPropagation(evt)
{
    var e = (window.event) ? window.event : evt;

    e.cancelBubble = true;
    if (e.stopPropagation) e.stopPropagation();
}

function AttachEvent(obj,evt,fnc,useCapture)
{
    if (!useCapture) useCapture=false;
    if (obj.addEventListener){
        obj.addEventListener(evt,fnc,useCapture);
        return true;
    } else if (obj.attachEvent) return obj.attachEvent("on"+evt,fnc);
    else{
        MyAttachEvent(obj,evt,fnc);
        obj['on'+evt]=function(){ MyFireEvent(obj,evt) };
    }
}

//The following are for browsers like NS4 or IE5Mac which don't support either
//attachEvent or addEventListener
function MyAttachEvent(obj,evt,fnc)
{
    if (!obj.myEvents) obj.myEvents={};
    if (!obj.myEvents[evt]) obj.myEvents[evt]=[];
    var evts = obj.myEvents[evt];
    evts[evts.length]=fnc;
}

function MyFireEvent(obj,evt)
{
    if (!obj || !obj.myEvents || !obj.myEvents[evt]) return;
    var evts = obj.myEvents[evt];
    for (var i=0,len=evts.length;i<len;i++) evts[i]();
}

function textlimit(o,l)
{
    if (o.value.length > l) {
        o.value = o.value.substring(0, l);
    }

    return true;
}

function unique(a)
{
   var r = new Array();
   o:for(var i = 0, n = a.length; i < n; i++)
   {
      for(var x = 0, y = r.length; x < y; x++)
      {
         if(trim(r[x])==trim(a[i])) continue o;
      }
      r[r.length] = a[i];
   }
   return r;
}

function datediff2(date1,date2,interval)
{
    var second=1000, minute=second*60, hour=minute*60, day=hour*24, week=day*7;
    date1 = new Date(date1);
    date2 = new Date(date2);
    var timediff = date2 - date1;
    if (isNaN(timediff)) return NaN;
    switch (interval) {
        case "years": return date2.getFullYear() - date1.getFullYear();
        case "months": return (
            ( date2.getFullYear() * 12 + date2.getMonth() )
            -
            ( date1.getFullYear() * 12 + date1.getMonth() )
        );
        case "weeks"  : return Math.floor(timediff / week);
        case "days"   : return Math.floor(timediff / day);
        case "hours"  : return Math.floor(timediff / hour);
        case "minutes": return Math.floor(timediff / minute);
        case "seconds": return Math.floor(timediff / second);
        default: return undefined;
    }
}

