function ShowHide (id)
{
    el = document.getElementById(id);
    if ( el.style.display == 'none' )
    {
        //el.style.display = 'block';
        $('#'+id).show('slow');
    }
    else
    {
        //el.style.display = 'none';
        $('#'+id).hide('slow');
    }
}

function confirm_del (loc)
{
    if (confirm('Do you realy want to delete this profile?'))
    {
        location.href = loc;
    }
}


function NW (loc)
{
    window.open(loc, "displayWindow", "width=200,height=200,status=no,toolbar=no,menubar=no");
}

function Show(id)
{
    if (document.getElementById(id).style.display == 'block')
    {
        document.getElementById(id).style.display = 'none';
    }
    else
    {
        document.getElementById(id).style.display = 'block';
    }
}

function set_point (field)
{
    d = field;
    r = d.value;
    d.value = r.replace(',', ".");
}
function sub1 ()
{
    error = "";
    if (document.user.number.value == '')
    {
        error += "товарный код\n";    
    }
    if (document.user.title.value == '')
    {
        error += "наименование товара\n";    
    }
    if (document.user.category.value == '')
    {
        error += "категория\n";    
    }
    if (document.user.sale.value == '')
    {
        error += "цена на продажу\n";    
    }
    if (error != "")
    {
        error = "Необходимо заполнить поля:\n" + error;
        alert(error);
        return false;
    }
    
    return true;
}

var x;
var y;

$(document).ready(function()
{    
    $("#abc").click(function(e){
        x = e.pageX;
        y = e.pageY;
    });
        
    $("#adiv").click(function(){
        $("#adiv").hide('scale');
        $("#divtbl").html(""); 
    });    
});

function dlist (letter)
{
    $("#adiv").show('scale');
        document.getElementById('adiv').style.left = x;
        document.getElementById('adiv').style.top  = y;
        $.post(
              '/index.php',
              {
                module: "tools",
                action: "ajaxGetDesignersByLetter",
                letter: letter
              },
              onAjaxSuccess
            );    
}

function onAjaxSuccess(data)
{
  $("#divtbl").html(data);
  // Здесь мы получаем данные, отправленные сервером
  //alert(data);
}
