﻿
function ToClientLocalTime( dd, MM, yyyy, hh, mm, ss )
{
        var currTime = new Date(yyyy,MM-1,dd,hh,mm,ss);
        var minutes = currTime.getMinutes();
        minutes -= currTime.getTimezoneOffset();
        currTime.setMinutes(minutes);
      
        var hours = currTime.getHours().toString();
        if (hours.length == 1) { hours = '0' + hours; }
        var minutes = currTime.getMinutes().toString();
        if (minutes.length == 1) { minutes = '0' + minutes; }
        var seconds = currTime.getSeconds().toString();
        if (seconds.length == 1) { seconds = '0' + seconds; }
        var day = currTime.getDate().toString();
        if (day.length == 1) { day = '0' + day; }
        var month = currTime.getMonth();
        month = (month+1).toString();
        if (month.length == 1) { month = '0' + month; }
        
        var currTimeOut = month + '/' + day + '/' + currTime.getFullYear().toString() + ' ' + hours + ':' + minutes + ':' + seconds;
      
    return currTimeOut;
}

function speakitlength(obj){
    var mlength=140;
    var count = document.getElementById("speakit-field-counter");
    if (obj.getAttribute)
    count.innerHTML = mlength-obj.value.length;
    
    if (obj.getAttribute && mlength-obj.value.length<=30)
    count.style.color = "black";
    
    if (obj.getAttribute && mlength-obj.value.length<=15)
    count.style.color = "red";
    
    if (obj.getAttribute && obj.value.length>mlength)
    obj.value=obj.value.substring(0,mlength)
}

var showtimer;
function dialog_starttimer(hover, focusItem, title, content) {
    Dialog1.set_alignmentElement(focusItem);

    if (hover) {
        var btn = document.getElementById(focusItem);
        btn.className = 'ButtonTab-hover';
    }

    showtimer = window.setTimeout("Dialog1.Show('" + content + "', '" + title + "');", 500);
}
function dialog_mouseout(hover, focusItem) {
    window.clearTimeout(showtimer);
    Dialog1.Close();
    if (hover) {
        var btn = document.getElementById(focusItem);
        btn.className = 'ButtonTab';
    }
}


