﻿function countChar(str, f) {
    document.getElementById(f).innerHTML = str.toString().length;
}

function formatPhone(f) {
    var txt = document.getElementById(f).value;
    txt = txt.replace(/[^0-9]/g, '');

    if (txt.length == 10) txt = '(' + txt.substr(0, 3) + ') ' + txt.substr(3, 3) + '-' + txt.substr(6, 4);

    document.getElementById(f).value = txt;
}

function formatURL(f) {
    var txt = document.getElementById(f).value;
    txt = txt.replace('http://', '');
    txt = txt.replace('https://', '');
    txt = txt.replace('ftp://', '');
    txt = txt.replace('ftps://', '');

    document.getElementById(f).value = txt;
}