function setactive2(a, b) {

   i = 0;
   while(document.getElementById('bid'+i)) {
       var x = document.getElementById('bid'+i);
       x.style.fontWeight="normal";
       i++;
   }

   if (document.getElementById(a)) {

       var x = document.getElementById(a);
       x.style.fontWeight="bold";

   }
   current = b;
}
function change_im(id, image){
document.getElementById(id).src=image;
}
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  = 'Uzmanību! ';
    if (confirmMsg == '' || typeof(window.opera) != 'undefined') {
        return true;
    }

    var is_confirmed = confirm('Uzmanību \ntiešām dzēst?');
    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 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 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 checkFormSendStudio() {
       if (document.form1.TT1.value=='') {

           document.getElementById('divinner').innerHTML='Ievadiet jūsu vārdu';
           document.getElementById('TT1').focus();
           return false;

       }
       if (document.form1.TT4.value=='') {

           //
           document.getElementById('divinner').innerHTML='Ievadiet jūsu e-pastu';
           document.getElementById('TT4').focus();
           return false;

       }
       if (document.form1.SS1.value=='') {

           //
           document.getElementById('divinner').innerHTML='Ievadiet komentāru';
           document.getElementById('SS1').focus();
           return false;

       }

       if (document.form1.TT4.value != '') {
           _ret = checkMail(document.form1.TT4.value);
           if (!_ret) {
              ///
              document.getElementById('divinner').innerHTML='Nepareiza e-pasta adrese';
              document.getElementById('TT4').focus();
              return false;
           }

       }


       return true;
}