function checkFormSendReg() {

  document.getElementById("T11").style.borderWidth = '1px';
  document.getElementById("T51").style.borderWidth = '1px';
  document.getElementById("T61").style.borderWidth = '1px';
  document.getElementById("T71").style.borderWidth = '1px';
  document.getElementById("S11").style.borderWidth = '1px';
  document.getElementById("T21").style.borderWidth = '1px';
  document.getElementById("T31").style.borderWidth = '1px';
  document.getElementById("T41").style.borderWidth = '1px';
  document.getElementById("security").style.borderWidth = '1px';

  document.getElementById("T11").style.borderColor = '#999999';
  document.getElementById("T51").style.borderColor = '#999999';
  document.getElementById("T61").style.borderColor = '#999999';
  document.getElementById("T71").style.borderColor = '#999999';
  document.getElementById("S11").style.borderColor = '#999999';
  document.getElementById("T21").style.borderColor = '#999999';
  document.getElementById("T31").style.borderColor = '#999999';
  document.getElementById("T41").style.borderColor = '#999999';
  document.getElementById("security").style.borderColor = '#999999';

  document.getElementById("HT11").style.display = 'none';
  document.getElementById("HT51").style.display = 'none';
  document.getElementById("HT61").style.display = 'none';
  document.getElementById("HT71").style.display = 'none';
  document.getElementById("HS11").style.display = 'none';
  document.getElementById("HS12").style.display = 'none';
  document.getElementById("HT21").style.display = 'none';
  document.getElementById("HT311").style.display = 'none';
  document.getElementById("HT312").style.display = 'none';
  document.getElementById("HT41").style.display = 'none';
  document.getElementById("Hsecurity").style.display = 'none';

  if (document.FormNameFeed.T11.value=="") {
      document.getElementById("T11").style.borderWidth = '3px';
      document.getElementById("T11").focus();
      document.getElementById("HT11").style.display = '';
      setColor(1, "T11");
      return false;
  }

  if (document.FormNameFeed.T11.value.length<8) {
      document.getElementById("T11").style.borderWidth = '3px';
      document.getElementById("T11").focus();
      document.getElementById("HT11").style.display = '';
      setColor(1, "T11");
      return false;
  }

  if (document.FormNameFeed.T51.value.length<6) {
      document.getElementById("T51").style.borderWidth = '3px';
      document.getElementById("T51").focus();
      document.getElementById("HT51").style.display = '';
      setColor(1, "T51");
      return false;
  }

  if (document.FormNameFeed.T61.value.length<6) {
      document.getElementById("T61").style.borderWidth = '3px';
      document.getElementById("T61").focus();
      document.getElementById("HT61").style.display = '';
      setColor(1, "T61");
      return false;
  }

  if (document.FormNameFeed.T61.value != document.FormNameFeed.T71.value) {
      document.getElementById("T71").style.borderWidth = '3px';
      document.getElementById("T71").focus();
      document.getElementById("HT71").style.display = '';
      setColor(1, "T61");
      return false;
  }

  if (document.FormNameFeed.S11.value=="") {
      document.getElementById("S11").style.borderWidth = '3px';
      document.getElementById("S11").focus();
      document.getElementById("HS11").style.display = '';
      setColor(1, "S11");
      return false;
  }

  if (document.FormNameFeed.S11.value.indexOf('.') == -1) {
      document.getElementById("S11").style.borderWidth = '3px';
      document.getElementById("S11").focus();
      document.getElementById("HS12").style.display = '';
      setColor(1, "S11");
      return false;
  }

  if (document.FormNameFeed.S11.value.indexOf(',') != -1) {
      var vars = document.FormNameFeed.S11.value.split(',');
      for (var i = 0; i < vars.length; i++) {
          if (vars[i].indexOf('.') == -1) {
              document.getElementById("S11").style.borderWidth = '3px';
              document.getElementById("S11").focus();
              document.getElementById("HS12").style.display = '';
              setColor(1, "S11");
              return false;
          }
      }
  }

  if (document.FormNameFeed.T21.value=="") {
      document.getElementById("T21").style.borderWidth = '3px';
      document.getElementById("T21").focus();
      document.getElementById("HT21").style.display = '';
      setColor(1, "T21");
      return false;
  }

  if (document.FormNameFeed.T31.value=="") {
      document.getElementById("T31").style.borderWidth = '3px';
      document.getElementById("T31").focus();
      document.getElementById("HT311").style.display = '';
      setColor(1, "T31");
      return false;
  }

  if (document.FormNameFeed.T31.value != '') {
      _ret = checkMail(document.FormNameFeed.T31.value);
      if (!_ret) {
         document.getElementById("T31").style.borderWidth = '3px';
         document.getElementById('T31').focus();
         document.getElementById("HT312").style.display  = '';
         setColor(1, "T31");
         return false;
      }
  }

  if (document.FormNameFeed.T41.value=="") {
      document.getElementById("T41").style.borderWidth = '3px';
      document.getElementById("T41").focus();
      document.getElementById("HT41").style.display = '';
      setColor(1, "T41");
      return false;
  }

  if (document.FormNameFeed.security.value=="") {
      document.getElementById("security").style.borderWidth = '3px';
      document.getElementById("security").focus();
      document.getElementById("Hsecurity").style.display = '';
      setColor(1, "security");
      return false;
  }

  return true;
}

function checkMail(x)
{
    var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if (filter.test(x)) return 1;
    else return 0;
}

function setColor(nums, _id){
    document.getElementById(_id).style.borderColor = '#FF0000';
}


function openWin(https,wid,hei,name){
shopWin = open(https, name, "scrollbars=no,resizable=no,width="+wid+",height="+hei+"");
        shopWin.focus();
}

function openWinScroll(https,wid,hei,name){
shopWin = open(https, name, "scrollbars=yes,resizable=no,width="+wid+",height="+hei+"");
        shopWin.focus();
}

function confirmLink()
{
    confirmMsg  = 'Uzmanibu! ';
    if (confirmMsg == '' || typeof(window.opera) != 'undefined') {
        return true;
    }

    var is_confirmed = confirm('Uzmanibu \ntiesam dzest?');
    if (is_confirmed) {
       // theLink.href += '&is_js_confirmed=1';
    }

    return is_confirmed;
}

function chstyle(a, b) {

    var x = document.getElementById(b);
   // alert(x);
    x.className  = a;

}

function windOpen(a) {

    window.open(a, '_self')

}

function replaceAll( str, from, to ) {
    var idx = str.indexOf( from );


    while ( idx > -1 ) {
        str = str.replace( from, to );
        idx = str.indexOf( from );
    }

    return str;
}

function vis(a) {


    if (a == 0) {
        _sel = 'hidden';
        _sel2 = 'none';
    } else {
        _sel = 'visible';
        _sel2 = 'inline';
    }

    document.getElementById('search').style.visibility = _sel;
    document.getElementById('selvis').style.display = _sel2;
    document.getElementById('selvis').style.visibility = _sel;

}


function checkFormSendStudio() {
       if (document.FormNameFeed.T1.value=='') {

           alert('Ievadiet jusu vardu');
           document.getElementById('T1').focus();
           return false;

       }
       if (document.FormNameFeed.T3.value=='') {

           //
           alert('Ievadiet jusu e-pastu');
           document.getElementById('T3').focus();
           return false;

       }
       if (document.FormNameFeed.S1.value=='') {

           //
           alert('Ievadiet komentaru');
           document.getElementById('S1').focus();
           return false;

       }

       if (document.FormNameFeed.T3.value != '') {
           _ret = checkMail(document.FormNameFeed.T3.value);
           if (!_ret) {
              ///
              alert('Nepareiza e-pasta adrese');
              document.getElementById('T3').focus();
              return false;
           }

       }


       return true;
}