function gotopage(id)
{
    var nav = document.getElementById('nav');
    nav.elements['p'].value = id;
    nav.submit();
}


function screenHeight()
{
    if (self.innerHeight)
        return self.innerHeight;
    else if (document.documentElement && document.documentElement.clientHeight)
        return document.documentElement.clientHeight;
    else if (document.body)
        return document.body.clientHeight;
    else return;
}


function screenWidth()
{
    if (self.innerWidth)
        return self.innerWidth;
    else if (document.documentElement && document.documentElement.clientWidth)
        return document.documentElement.clientWidth;
    else if (document.body)
        return document.body.clientWidth;
    else return;
}


function pageview(id, width, height)
{
    var popswitch = 1; // 1 = div, 0 = popup
    
    var width = (width*1) + 200;
    
    var left = (screenWidth()/2)-(width/2);
    var top = (screenHeight()/2)-((height*1)/2);
    top = top + document.documentElement.scrollTop;
    
    switch (popswitch)
    {
        case 0:
            window.open('index.php?action=view&id='+id, Date(), 'width='+width+',height='+height+',left='+left+',top='+top+'');
            break;
            
        case 1:
            var container = document.getElementById('viewcontainer');
            container.style.width = width+'px';
            container.style.height = height+'px';
            container.style.left = left+'px';
            container.style.top = top+'px';
            
            
           
            $("#viewcontainer").load('/modules/stock/index.php?action=view', {id: id, method: 'div'}, pageview_show);
            
            
            var bglayer = document.getElementById('viewbackground');
            bglayer.style.height = (document.body.clientHeight)+'px';
            var offset = (document.all) ? 0 : 16;
            bglayer.style.width = (document.body.clientWidth-offset)+'px';
            break;
    }
}


function pageview_show()
{
    $("#viewbackground").show();
    $("#viewcontainer").show();
}
function pageview_close()
{
    $("#viewbackground").hide();
    $("#viewcontainer").hide();
}

function load_diaprojector(method)
{
    var url = 'modules/stock/diaprojector.php?method='+method;
    window.open(url,"","width="+screen.availWidth+", height="+screen.availHeight+", left=0, top=0, taskbar=0, scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no");
}
