/**
 * Sets the height of a given frame by the frame height itself
 */
function setFrameHeight(sFrame) {
    var eFrame = document.getElementById(sFrame);
    
    if (eFrame != null) {
        eFrame.height = frames["content"].document.body.scrollHeight + 20;
    }
}        

/**
 * Returns a parsed date by a given one
 */
function getDateString(dDate) {
    return dDate.getDate() + "/" + (dDate.getMonth() + 1) + "/" + dDate.getFullYear();
}

/**
 * Sets a span text to today's date
 */
function setSpanDate(sSpan) {
    var eSpan = document.getElementById(sSpan);
    if (eSpan != null) {
        eSpan.innerText = getDateString(new Date());
    }
}

/**
 * Returns the trim text with no word cuts
 */
function trim(sText, iNum) {
    if (sText.length > iNum) {
        var iNext = sText.substring(iNum).indexOf(" ") + iNum;
        return sText.substring(0, iNext) + "...";
        
    }
    
    return sText;
}

function getTextFromDB(sDate) {
    var parts = sDate.split("-");
    return parts[2] + "/" + parts[1] + "/" + parts[0];
}
