/********************************** переменные **************************************/
var dirID=0;

/********************************** директория **************************************/



function AjaxSelectDir(span_id, dir_id, module)
{
    var spanizm=document.getElementById(span_id);
    
    $("div.tabloid_id_selected, table.tabloid_id_selected").addClass("tabloid_id");
    $("div.tabloid_id_selected, table.tabloid_id_selected").removeClass("tabloid_id_selected");
    
    spanizm.className="tabloid_id_selected";
    dirID=dir_id;
    
    var path="/production/item.php?dir="+dirID;
    
    $('#temno').show();
    $.ajax(
    {
        url: path,
        cache: false,
        success: function(html)
        {
            $('#desktop').html(html);
            $('#temno').hide();
        }
    });
}

function ExpandCollapse(div, imago)
{
    var parent=document.getElementById(div);
    var img=document.getElementById(imago);
    var children=parent.getElementsByTagName("div");
    var i;
    
    if (img.className=="div_img_minus")
    {
        img.className="div_img_plus";
    }
    else
    {
        img.className="div_img_minus";
    }
    
    for (i=0; i<children.length; i++)
    {
        if (children[i].style.display=="none")
        {
            children[i].style.display="block";   
        }
        else
        {
            children[i].style.display="none";
        }
    }
} 



/********************************** галерея **************************************/
function defPosition(event) 
{ 
      var x = y = 0; 
      if (document.attachEvent != null) 
      { // Internet Explorer & Opera 
            x = window.event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); 
            y = window.event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); 
      } 
      else if (!document.attachEvent && document.addEventListener) 
      { // Gecko 
            x = event.clientX + window.scrollX; 
            y = event.clientY + window.scrollY; 
      } else 
      { 
            // Do nothing 
      } 
      return {x:x, y:y}; 
}

function Pokaji (pozax, pozay)
{
    var div_visible=document.getElementById("poza");
    
    div_visible.style.position="absolute";
    div_visible.style.top=(pozay+5)+"px";
    div_visible.style.left=(pozax-320)+"px";
    $('#poza').show();
}
function NeNado ()
{
    $('#poza').hide();
}

function BuildGallery(ide, skoka)
{
    $(function() 
    {
        $('#'+ide).jcarousel(
        {
            // Explicitly set size. Otherwise, jCarousel will limit the
            // carousel to 3 items (the number of available items on initialization)
            size: skoka
        });
    });
} 

function ShowImago(imgID)
{
    $('#temno').show();
    $('#div_obolochka_fix').show();
    $('#div_telo_fix').html("<div align='center' class='div_loading'></div>");
    $('#div_telo_fix').html("<div align='right' class='div_kopka_close'><img src='/img/close.gif' title='Закрыть' style='cursor: pointer;' onclick='CloseImago();'></div><img src='/UserFiles/Images/gallery/real/"+imgID+".jpg'>");
} 

function CloseImago() 
{
    $('#div_telo_fix').html("");
    $('#div_obolochka_fix').hide();
    $('#temno').hide();    
}
