    $(document).ready(function () {

        window.name = hwnd()

       	$("#search").autocomplete('ajax.php?a=search', {
       		width: 266,
       		multiple: false,
       		matchContains: true
      	})


    })

    function wopen(w,h,path,id,resizable, scrolling){
        t = (screen.height-h-30)/2;
        l = (screen.width-w-30)/2;
        hwnd = window.open(path, 'window'+id, "top="+t+",left="+l+",width="+w+",height="+h+",resizable="+resizable+",scrollbars="+scrolling);
        hwnd.focus()
    }

    function basket(id) {
       $.ajax({
           url: '/ajax.php',
           cache: false,
           async: false,            // для корректной работы кук
           data: {a:'tobask',id:id},
           dataType : "json",
           success: function (data, textStatus) {
            if (data.empty) {
               $("._basket").css({'display':'none'})
               $("._basket_empty").css({'display':'inline'})
            } else {
               $("._basket").css({'display':'inline'})
               $("._basket_empty").css({'display':'none'})
               $("._basket_value").html(data.value)
               $("._basket_price").html(data.price)
            }
          }
       })
    }

    function _to_bask(id) {
        $(".check"+id).html('<div class="checked">В КОРЗИНЕ</div>')
//        $(".check"+id).addClass('checked')
        basket(id)
	}

//Генерация идентификатора окна
   function hwnd() {
     var date = new Date()
     return date.getTime()
   }