﻿function relative_time(C) { var B = C.split(" "); C = B[1] + " " + B[2] + ", " + B[5] + " " + B[3]; var A = Date.parse(C); var D = (arguments.length > 1) ? arguments[1] : new Date(); var E = parseInt((D.getTime() - A) / 1000); E = E + (D.getTimezoneOffset() * 60); if (E < 60) { return "less than a minute ago" } else { if (E < 120) { return "about a minute ago" } else { if (E < (60 * 60)) { return "" + (parseInt(E / 60)).toString() + " minutes ago" } else { if (E < (120 * 60)) { return "about an hour" } else { if (E < (24 * 60 * 60)) { return "about " + (parseInt(E / 3600)).toString() + " hours ago" } else { if (E < (48 * 60 * 60)) { return "yesterday" } else { return "" + (parseInt(E / 86400)).toString() + " days ago" } } } } } } };


function showPost(id) {
    alert(id);
    if (document.getElementById("post" + id).style.display = 'none') {
        document.getElementById("post" + id).style.display = 'block';
    } else {
        document.getElementById("post" + id).style.display = 'none';
    }
}

function optionsOther() {
    if (document.getElementById("optionsother").style.display == 'none') {
        document.getElementById("optionsother").style.display = 'block';
        document.getElementById("optionsbasic").style.display = 'none';
        document.getElementById("optionother").className = 'optionselected';
        document.getElementById("optionother").innerHTML = 'Less';
    } else {
        document.getElementById("optionsother").style.display = 'none';
        document.getElementById("optionsbasic").style.display = 'block';
        document.getElementById("optionother").className = 'option';
        document.getElementById("optionother").innerHTML = 'More';
    }
}


function imposeMaxLength(Event, Object, MaxLen)
{
    //return (Object.value.length <= MaxLen)||(Event.keyCode == 8 ||Event.keyCode==46||(Event.keyCode>=35&&Event.keyCode<=40))
    if (Object.value.length <= MaxLen) {
        Object.className = "textboxC";
    } else {
        Object.className = "textboxCsmall";
    }
}

function imposeMaxLengthS(Event, Object, MaxLen)
{
    //return (Object.value.length <= MaxLen)||(Event.keyCode == 8 ||Event.keyCode==46||(Event.keyCode>=35&&Event.keyCode<=40))
    if (Object.value.length <= MaxLen) {
        Object.className = "textboxS";
    } else {
        Object.className = "textboxSsmall";
    }
}

function ResetScrollPosition()
{
    setTimeout("window.scrollTo(0,0)",0);
   
}