// ***********************************************************************
// яхмнмхлюигеп.пс 2.0
// http://www.sinonymiser.ru
// ***********************************************************************
function hide(nodeId)
{
    var node = document.getElementById(nodeId);
    if (node)
    {
        node.style.display = 'none';
    } 
}
 
function show(nodeId)
{
    var node = document.getElementById(nodeId);
    if (node)
    {
        node.style.display = 'block';
    } 
}

// ***************************************************************
function GetById(id) {
    if(document.getElementById) {
        return document.getElementById(id);
    }else if(document.all) {
        return document.all[id];
    }else if(document.layers) {
        return document.layers[id];
    }

    return null;
}

function setMyShift(id) {
    var newx = 0 - Math.round(Math.round(Math.random() * (231)) / 7) * 7;

    GetById(id).style.backgroundPosition = newx + "px 51px";

    return true;
}

function CheckEmail(email) {
    re = new RegExp("^[A-Za-z0-9_-]{1,20}@(([A-Za-z0-9-]+\.)+([A-Za-z]{2,5})|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})$");

    if(re.exec(email) == null){
        return false;
    }

return true;
}

if('undefined' == typeof String.prototype.trim) {
  String.prototype.trim = function() {
    return this.replace(/^\s+/, '').replace(/\s+$/, '');
  }
}

function CheckSynLen() {
    if(GetById('text').value.length > 0) {
        GetById('text_len').innerHTML = '<span style="color: #990000;">' + GetById('text').value.length + '</span>';
    }else{
        GetById('text_len').innerHTML = GetById('text').value.length;
    }
}

function CheckSyn() {
    if(GetById('text').value.trim() == '') {
        alert("рейярнбне онке ме гюонкмемн!");
        return false;
    }

    

    return true;
}

function CheckForm() {
    if(GetById('email').value.trim() == '') {
        alert("");
        GetById('email').focus();
        return false;
    }

    if(!CheckEmail(GetById('email').value)) {
        alert("");
        GetById('email').focus();
        return false;
    }

    if(GetById('up_file').value.trim() == '') {
        alert("");
        GetById('up_file').focus();
        return false;
    }

    return true;
}