// name - имя cookie
// value - значение cookie
// [expires] - дата окончания действия cookie (по умолчанию - до конца сессии)
// [path] - путь, для которого cookie действительно (по умолчанию - документ, в котором значение было установлено)
// [domain] - домен, для которого cookie действительно (по умолчанию - домен, в котором значение было установлено)
// [secure] - логическое значение, показывающее требуется ли защищенная передача значения cookie

function setCookie(name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) +
                    ((expires) ? "; expires=" + expires.toGMTString() : "") +
                    ((path) ? "; path=" + path : "") +
                    ((domain) ? "; domain=" + domain : "") +
                    ((secure) ? "; secure" : "");
    if ((name + "=" + escape(value)).length <= 4000) {
        document.cookie = curCookie;
    } else {
        if (confirm("Cookie превышает 4KB и будет вырезан !")) {
            document.cookie = curCookie;
        }
    }
}

// name - имя считываемого cookie
function getCookie(name) {
    var prefix = name + "="
    var cookieStartIndex = document.cookie.indexOf(prefix)
    if (cookieStartIndex == -1)
        return null
    var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
    if (cookieEndIndex == -1)
        cookieEndIndex = document.cookie.length
    return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}

// name - имя cookie
// [path] - путь, для которого cookie действительно
// [domain] - домен, для которого cookie действительно
function deleteCookie(name, path, domain) {
    if (getCookie(name)) {
        document.cookie = name + "=" +
                          ((path) ? "; path=" + path : "") +
                          ((domain) ? "; domain=" + domain : "") +
                          "; expires=Thu, 01-Jan-70 00:00:01 GMT"
    }
}


function doPause(millis) {
    var date = new Date();
    var curDate = null;

    do {
        curDate = new Date();
    }
    while (curDate - date < millis);
}

function getDataFromServer(url) {
    var req = createXMLHttpRequest();
    req.open("GET", url, false);

    req.send(null);

    while (req.readyState != 4) {
        doPause(50);
    }

    return req.responseText;
}

function postDataFromServer(url, params) {
    var http = createXMLHttpRequest();

    http.open("POST", url, false);

    //Send the proper header information along with the request
    http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    http.setRequestHeader("Content-length", params.length);
    http.setRequestHeader("Connection", "close");

    http.send(params);

    /*var responseText = "";
    http.onreadystatechange = function() {//Call a function when the state changes.
        if (http.readyState == 4 && http.status == 200) {
            alert(trim(http.responseText));
        }
    }*/

    while (http.readyState != 4) {
        doPause(50);
    }

    return http.responseText;

}

function getAsyncDataFromServer(url, params, callback) {
    var req = createXMLHttpRequest();
    req.open("POST", url, true);
    req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    req.setRequestHeader("Content-length", params.length);
    req.setRequestHeader("Connection", "close");
    req.onreadystatechange = function() {
        if (req.readyState != 4) {
            return;
        }
        if (callback != null) {
            callback(req.responseText);
        }
    };
    req.send(params);
}

function createXMLHttpRequest() {
    try {
        return new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
    }
    try {
        return new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
    }
    try {
        return new XMLHttpRequest();
    } catch(e) {
    }
    alert("XMLHttpRequest not supported");
    return null;
}

function setIBabelCookie(name, value, expires, path, domain, secure) {
    document.cookie = name + "=" + escape(value) +
                      "; expires=Fri, 21 Sep 2007 23:59:59 GMT;" +
                      "; path=/" +
                      ((domain) ? "; domain=" + domain : "") +
                      ((secure) ? "; secure" : "");
}

function writeFile(s) {
    var fso = new ActiveXObject("Scripting.FileSystemObject");
    varFileObject = fso.OpenTextFile("C:\\LogFile.txt", 8, true, 0);
    // 8=append, true=create if not exist, 0 = ASCII
    var d = new Date();
    varFileObject.write(d.toLocaleString() + ": ");
    varFileObject.write(s);
    varFileObject.write("\n");
    varFileObject.close();
}

/**
 * Returns xml document object by xml string
 * @param messagesCountXml
 */
function getXmlDocument(xmlString) {
    var xmlDoc = null;
    // code for IE
    if (window.ActiveXObject) {
        xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
        //xmlDoc.async = false;
        xmlDoc.loadXML(xmlString);
        return xmlDoc;
    }
    // code for Mozilla, Firefox, Opera, etc.
    else if (document.implementation && document.implementation.createDocument) {
        xmlDoc = document.implementation.createDocument("", "", null);
        var domParser = new DOMParser();
        xmlDoc = domParser.parseFromString(xmlString, "text/xml");
        return xmlDoc;
    } else {
        alert('Your browser cannot handle this script');
        return null;
    }

}

function changeCheckBox(formName, checkBoxName) {
    form = document.forms[formName];
    checkBox = form.elements[checkBoxName];

    if (!checkBox.disabled) {
        if (checkBox.checked) {
            checkBox.checked = false;
        } else {
            checkBox.checked = true;
        }
    }
}

function changeCheckBoxWithValue(formName, checkBoxName, valueToSelect) {
    checkBox = document.forms[formName].elements[checkBoxName];
    if (checkBox && !checkBox[0]) {
        checkBox.checked = !checkBox.checked;
    }
    if (!checkBox || !checkBox.length) {
        return;
    }

    for (var i = 0; i < checkBox.length; i++) {
        if (checkBox[i].value == valueToSelect) {
            if (checkBox[i].checked) {
                checkBox[i].checked = false;
            } else {
                checkBox[i].checked = true;
            }
            return;
        }
    }

    return;
}

function changeCheckBoxById(id) {
    checkBox = document.getElementById(id);

    if (checkBox.checked) {
        checkBox.checked = false;
    } else {
        checkBox.checked = true;
    }
}

function getCheckBoxWithValue(formName, checkBoxName, valueToSelect) {
    checkBox = document.forms[formName].elements[checkBoxName];

    if (!checkBox || !checkBox.length) {
        return;
    }

    for (var i = 0; i < checkBox.length; i++) {
        if (checkBox[i].value == valueToSelect) {
            return checkBox[i];
        }
    }

    return null;
}

function getCheckBoxById(id) {
    return document.getElementById(id);
}

function isCheckBoxExistsAndEnabled(id) {
    checkBox = document.getElementById(id);
    if (checkBox) {
        if (!checkBox.disabled) {
            return true;
        }
    }

    return false;
}

/**
 * Returns value of selected option in listbox
 * If there is no options selected - returns null.
 * If multiple options selected - returns first.
 */

function selected(sel) {
    if (!sel.options) {
        return null;
    }
    for (var i = 0; i < sel.options.length; i++) {
        if (sel.options[i].selected) {
            return sel.options[i].value;
        }
    }

    return null;
}

/**
 * Do select #valueToSelect value of #selName option in form with name #formName
 */
function setSelected(formName, selName, valueToSelect) {
    sel = document.forms[formName].elements[selName];
    if (!sel.options) {
        return;
    }
    for (var i = 0; i < sel.options.length; i++) {
        if (sel.options[i].value == valueToSelect) {
            sel.options[i].selected = true;
            return;
        }
    }

    return;
}

/**
 * Do select #valueToSelect value of option given from document by #selId
 */
function setSelectedById(selId, valueToSelect) {
    sel = document.getElementById(selId);
    if (!sel.options) {
        return;
    }
    for (var i = 0; i < sel.options.length; i++) {
        if (sel.options[i].value == valueToSelect) {
            sel.options[i].selected = true;
            return;
        }
    }

    return;
}

/**
 * Returns value of checked radiobutton in radiobuttons group
 * If there is no radiobuttons checked - returns null.
 */

function selectedRadio(sel) {
    if (!sel || !sel.length) {
        return null;
    }
    for (var i = 0; i < sel.length; i++) {
        if (sel[i].checked) {
            return sel[i].value;
        }
    }
    return null;
}

/**
 * Do the same as selectedRadio except single radios
 *
 */
function selectedRadioEx(sel) {
    if (!sel) {
        return null;
    }

    if (sel.length) {
        return selectedRadio(sel);
    }

    if (sel.checked) {
        return sel.value;
    }

    return null;
}

/**
 * Returns true if one of options in radiogroup is checked;
 */
function isChecked(sel) {
    return selectedRadio(sel) != null;
}

function selectRadio(formName, radioName, valueToSelect) {
    radio = document.forms[formName].elements[radioName];

    if (!radio || !radio.length) {
        return;
    }

    for (var i = 0; i < radio.length; i++) {
        if (radio[i].value == valueToSelect) {
            radio[i].checked = true;
            return;
        }
    }

    return;
}

function setPayType() {
    var radio = document.getElementById('webmoney');
    radio.value = document.getElementById('web_money_type').value;
}

function changeRadioState(formName, radioName, valueToDisable, disabled) {
    radio = document.forms[formName].elements[radioName];

    if (!radio || !radio.length) {
        return;
    }

    for (var i = 0; i < radio.length; i++) {
        if (radio[i].value == valueToDisable) {
            if (disabled == 'true') {
                radio[i].disabled = true;
            } else {
                radio[i].disabled = false;
            }
            return;
        }
    }

    return;
}

function isRadioDisabled(formName, radioName, valueToCheck) {
    radio = document.forms[formName].elements[radioName];

    if (!radio || !radio.length) {
        return;
    }

    for (var i = 0; i < radio.length; i++) {
        if (radio[i].value == valueToCheck) {
            if (radio[i].disabled) {
                return true;
            } else {
                return false;
            }
            return;
        }
    }

    return;
}

/**
 * returns string with all leading and trailing characters
 * eliminated.
 */
function trim(str) {
    var s = new String(str);
    //trailing spaces
    while (s.length > 0 && isSpaceCharacter("" + s.charAt(s.length - 1))) {
        s = s.substring(0, s.length - 1);
    }
    //leading spaces
    while (s.length > 0 && isSpaceCharacter("" + s.charAt(0))) {
        s = s.substring(1);
    }
    return s
}

var spaces = " \t\r\n" + String.fromCharCode(160);

function isSpaceCharacter(ch) {
    return spaces.indexOf(ch) > -1;
}

function isEmpty(elem) {
    return trim(elem.value).length == 0;
}

function isEmptyText(text) {
    return trim(text).length == 0;
}

function emptyIfNull(s) {
    if (s == 'null') {
        s = "";
    }
    return s;
}

function Wait() {
    this.splashImage = null;
    this.waitImage = null;
    this.isInProgress = false;
    this.start = function() {
        this.isInProgress = true;
        if (this.splashImage == null) {
            this.splashImage = document.createElement("IMG");
            this.waitImage = document.createElement("IMG");
            this.splashImage.src = WaitNoneImageSRC;
            this.waitImage.src = WaitImageSRC;
            document.body.appendChild(this.splashImage);
            document.body.appendChild(this.waitImage);
            this.splashImage.style.top = 1;
            this.splashImage.style.left = 1;
            this.splashImage.style.position = "absolute";
            this.waitImage.style.position = "absolute";
        }
        this.splashImage.zIndex = 300;
        this.waitImage.zIndex = 301;
        var w = (document.body.scrollWidth > document.body.offsetWidth) ? document.body.scrollWidth : document.body.offsetWidth - (ajax.browser.IE ? 20 : 0);
        var h = (document.body.scrollHeight > document.body.offsetHeight) ? document.body.scrollHeight : document.body.offsetHeight - (ajax.browser.IE ? 20 : 0);
        this.splashImage.width = w - 1;
        this.splashImage.height = h - 1;
        this.splashImage.style.display = "block";
        this.waitImage.style.display = "block";
        var top = Math.round((document.body.offsetHeight - 1 - this.waitImage.offsetHeight) / 2);
        if (top < 0)top = 0;
        var left = Math.round((document.body.scrollWidth - 1 - this.waitImage.offsetWidth) / 2);
        if (left < 0)top = 0;
        this.waitImage.style.top = "50%";
        this.waitImage.style.left = "50%";

        //        this.waitImage.style.top = top;
        //        this.waitImage.style.left = left;
    }
    this.stop = function() {
        this.isInProgress = false;
        if (this.splashImage == null) {
            return;
        }
        this.splashImage.style.display = "none";
        this.waitImage.style.display = "none";
    }
}

//---- WAIT
var WaitNoneImageSRC = "/scripts/images/none.gif";
var WaitImageSRC = "/scripts/images/wait.gif";


function AjaxParameter(name, value) {
    this.name = name;
    this.value = value;
}
function AjaxRequest(name, url, onErrorFunction, onSuccessFunction, action) {
    this.name = name;
    this.url = url;
    this.onErrorFunction = onErrorFunction;
    this.onSuccessFunction = onSuccessFunction;
    this.isComplete = false;
    this.generateBoundary = function() {
        var t = "qwertyuiopasdfghjklzxcvbnm1234567890";
        var ret = "----";
        for (var i = 0; i < 10; i++) {
            var c = Math.round(Math.random() * t.length);
            ret += t.charAt(c);
        }
        ;
        ret += "---";
        return ret;
    };
    this.boundary = this.generateBoundary();
    this.isErrorResponse = false;
    this.action = action;
    this.sendParameters = new Array();
    this.addSendParameters = function(name, value) {
        this.sendParameters[this.sendParameters.length] = new AjaxParameter(name, value);
    };
    this.createSendText = function() {
        var ret = "";
        for (var i = 0; i < this.sendParameters.length; i++) {
            ret += encodeURIComponent(this.sendParameters[i].name) + "=";
            ret += encodeURIComponent(this.sendParameters[i].value) + "&";
        }
        return ret;
    };
    if (this.url.indexOf("?") == -1) {
        this.url += "?action=" + this.action;
    } else {
        this.url += "&action=" + this.action;
    }
    ;
    this.url += "&boundary=" + this.boundary;
    this.url += "&rnd=" + Math.random();
    this.init = function() {
        var st = this.createSendText();
        ajaxTransport.send(st);
    };
    this.parameters = new Array();
    this.getParameter = function(name) {
        for (var i = 0; i < this.parameters.length; i++) {
            if (this.parameters[i].name == name) {
                return this.parameters[i].value;
            }
        }
        return null;
    };
    this.complete = function() {
        this.isComplete = true;
        var t = ajaxTransport.responseText;
        if (t == null) {
            return;
        }
        if (t.trim().replace("\n", "") == "ERROR") {
            this.isErrorResponse = true;
        }
        var tt = t.split(this.boundary + "\n");
        for (var i = 0; i < tt.length; i++) {
            if (tt[i].isEmpty()) {
                continue;
            }
            var name = tt[i].substring(0, tt[i].indexOf("\n"));
            var value = tt[i].substring(name.length + 1, tt[i].length - 1);
            this.parameters[this.parameters.length] = new AjaxParameter(name, value);
        }
    };
    this.isError = function() {
        return this.getParameter("error") != null;
    };
    this.showError = function() {
        alert(this.getParameter("errorMessage"));
        if (document.location.hostname.indexOf("xplorex.dev") != -1 && this.getParameter("debugError") != null) {
            alert(this.getParameter("debugError"));
        }
    };
}
function AjaxObject() {
    this.browser = {IE:!!(window.attachEvent && !window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf('AppleWebKit/') > -1,Gecko:navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)}
    this.request = null;
    this.createTransport = function() {
        var xmlHttp;
        try {
            xmlHttp = new XMLHttpRequest();
        } catch(e) {
            try {
                xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
            } catch(e) {
                try {
                    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                } catch(e) {
                    alert("Your browser does not support AJAX!");
                    return false;
                }
            }
        }
        return xmlHttp;
    };
    this.addRequest = function(req) {
        if (this.request != null && !this.request.isComplete) {
            alert("Please wait");
            return false;
        }
        if (ajaxTransport == null) {
            ajaxTransport = this.createTransport();
        }
        ajaxTransport.open("POST", req.url, true);
        ajaxTransport.onreadystatechange = function() {
            if (ajaxTransport.readyState == 4) {
                var req = ajax.request;
                if (req != null) {
                    if (ajaxTransport.status) {
                        if (ajaxTransport.status != 200) {
                            req.isErrorResponse = true;
                        }
                    }
                    if (!req.isErrorResponse) {
                        req.complete();
                    }
                    if (!req.isErrorResponse) {
                        if (req.onSuccessFunction != null) {
                            req.onSuccessFunction();
                        }
                    } else {
                        if (req.onErrorFunction != null) {
                            req.onErrorFunction();
                        }
                    }
                }

                ajax.deleteRequest(req.name);

            }
        };
        ajaxTransport.setRequestHeader("nameRequest", req.name);
        ajaxTransport.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
        this.request = req;
    };
    this.deleteRequest = function(reqName) {
        this.request = null;
    };
}
var ajax = new AjaxObject();
var ajaxTransport = null;


/**
 * Validates that input's value is correct email address
 */
function validateEmail(elem) {
    var str = "";
    if (elem.value) {
        str = new String(elem.value);
    } else {
        str = new String(elem);
    }
    if (window.RegExp) {
        var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
        var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,4})(\\]?)$";
        var reg1 = new RegExp(reg1str);
        var reg2 = new RegExp(reg2str);
        if (!reg1.test(str) && reg2.test(str)) {
            return true;
        }
        return false;
    } else {
        if (str.indexOf("@") >= 0)
            return true;
        return false;
    }
}


function validateDomain(elem) {
    var str = "";
    if (elem.value) {
        str = new String(elem.value);
    } else {
        str = new String(elem);
    }
    if (window.RegExp) {
        var reg1str = "(@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
        var reg2str = "^[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})$";
        var reg1 = new RegExp(reg1str);
        var reg2 = new RegExp(reg2str);
        if (!reg1.test(str) && reg2.test(str)) {
            return true;
        }
        return false;
    } else {
        return true;
    }
    return true;
}

function validateString(elem) {
    var str = "";
    if (elem.value) {
        str = new String(elem.value);
    } else {
        str = new String(elem);
    }

    if (window.RegExp) {
        var reg1str = "^[a-zA-ZЇїІіЁёА-Яа-я\\-]";

        for (var i = 0; i < str.length; i++) {
            var reg1 = new RegExp(reg1str);
            if (!isSpaceCharacter(str[i])) {
                if (!reg1.test(str[i])) {
                    return false;
                }
            }
        }

        return true;

    } else {
        return true;
    }
}

function validateDigit(elem) {
    var str = "";
    if (elem.value) {
        str = new String(elem.value);
    } else {
        str = new String(elem);
    }

    if (window.RegExp) {
        var reg1str = "^[0-9]";
        var reg1 = new RegExp(reg1str);

        for (var i = 0; i < str.length; i++) {

            var symb = str.substring(i, i + 1);

            if (!reg1.test(symb)) {
                 return false;
            }
        }

        return true;

    } else {
        return true;
    }
}

function validateStringAndDigit(elem) {
    var str = "";
    if (elem.value) {
        str = new String(elem.value);
    } else {
        str = new String(elem);
    }

    if (window.RegExp) {
        var reg1str = "^[a-zA-ZЇїІіЁёА-Яа-я0-9\\-]";

        for (var i = 0; i < str.length; i++) {
            var reg1 = new RegExp(reg1str);

            if (!isSpaceCharacter(str[i])) {
                if (!reg1.test(str[i])) {
                    return false;
                }
            }
        }

        return true;

    } else {
        return true;
    }
}

function validateStrDigSlash(elem) {
    var str = "";
    if (elem.value) {
        str = new String(elem.value);
    } else {
        str = new String(elem);
    }

    if (window.RegExp) {
        var reg1str = "^[a-zA-ZЇїІіЁёА-Яа-я0-9\\-\\/]";

        for (var i = 0; i < str.length; i++) {
            var reg1 = new RegExp(reg1str);
            if (!isSpaceCharacter(str[i])) {
                if (!reg1.test(str[i])) {
                    return false;
                }
            }
        }

        return true;

    } else {
        return true;
    }
}

function isNumber(d, isinteger, ispositive) {
    var data = new String(d);
    var numStr = ".-0123456789";
    var th;
    var counter = 0;

    for (var i = 0; i < data.length; i++) {
        th = data.substring(i, i + 1);

        if (numStr.indexOf(th) != -1) {
            counter++;
        }
    }

    if (counter == data.length) {
        if (data.indexOf(".") != data.lastIndexOf(".")) {
            return false;
        }

        if (data.indexOf("-") > 0) {
            return false;
        }

        if (isinteger && data.indexOf(".") != -1) {
            return false;
        }

        return !(ispositive && data.indexOf("-") != -1);
    }

    return false;
}

function enterPress(event, f) {
    var evt = (event) ? event : (window.event) ? event : null;
    var keyCode = evt.keyCode ? evt.keyCode :
                  evt.charCode ? evt.charCode :
                  evt.which ? evt.which : void 0;
    if (keyCode == 13) {
        f.submit();
//        userEnter2();
        return false;
    }
    return true;
}

function userEnter2() {
    var f = document.forms['loginMenu'];
    if (!isEmpty(f.email) && !isEmpty(f.user_password)) {
        var userId = "";
        var errorEmail = "";
        try {
            userId = getDataFromServer('/user/ajax/check_user.jsp?email=' + f.email.value + '&password=' + f.user_password.value + '&rnd=' + Math.random());
        } catch(ex) {
        }

        if (userId == "0") {

            alert('Неверные Email или пароль. Повторите ввод.');
        } else {
            document.location = 'https://www.ukrnames.com/user/orders.jsp;jsessionid=' + sessionId;
        }
    }
}

function validateWhoisForm(f) {
    return !isEmpty(f.whois);
}

function getMyIP() {
    var checkbox = document.forms['whois_form'].my_ip;
    var myIP = document.forms['whois_form'].ip_address.value;
    var whois = document.forms['whois_form'].whois;
    if (checkbox.checked) {
        whois.value = myIP;
    } else {
        whois.value = '';
    }
}

function postWhois() {
    var whois = document.forms['index_form2'].whois.value;
    document.location = '/domains/whois.jsp?whois=' + whois + '&action=yes' + '&sec_page=yes';
}

function changeCurrency(path) {
    var f = document.forms["index_form"];
    if (path == "/index.jsp") {
        f = document.forms["index_form"];
    } else if (path == "/hosting/tariffs.jsp") {
        f = document.forms["tariffs_form"];    
    } else if (path == "/certs/ssl_certificates.jsp") {
        f = document.forms["sslform"];    
    } else if (path == "/certs/ssl_certificates2.jsp") {
        f = document.forms["sslform2"];
    } else if (path == "/certs/cert_details.jsp") {
        f = document.forms["cur"];
    } else if (path == "/cards/card_tariffs.jsp") {
        f = document.forms["card_tariffs_form"];    
    } else if (path == "/user/my_auctions.jsp") {
        f = document.forms["my_auctions"];
    } else if (path == "/user/auctions_archive.jsp") {
        f = document.forms["auctions_archive"];
    } else if (path == "/user/mass_direct_reg.jsp") {
        f = document.forms["massdirectreg"];
    } else {
        f = document.forms["prices_form"];
    }

    try {
        getDataFromServer('/admin/ajax/set_currency.jsp?currency=' + f.currency.value + '&rnd=' + Math.random());
    } catch(ex) {
    }

    if (path == "/certs/cert_details.jsp") {
        f.submit();
    } else if (path == "/user/mass_direct_reg.jsp") {
        window.location.reload();
    } else {
        if (path == "/certs/ssl_certificates2.jsp") {
            path = "/certs/ssl_certificates.jsp"
        }
        document.location = path;
    }
}

function validChars(input) {
    var value = input.value;
//    var reg1str = "(@)|(\\.)|(\\,)|(\\~)|(\\!)|(\\#)|(\\$)|(\\%)|(\\^)|(\\&)|(\\*)|(\\()|(\\)|(\\_)|(\\+)|(\\|)|(\\})|(\\{)|(\\])|(\\[)|(\\>)|(\\<)|(\\/)|(\\?)|(\\:)|(\\;)|(\')|(\"))";
    var reg1str = "(\\.)|(\\')|(\\')|(\\`)|(\\\")";

    var reg1 = new RegExp(reg1str);
    if (reg1.test(value)) {
        value = value.replace(reg1, '');
        input.value = value;
    }
}