    /* 
             ganesashop.js
             Implements Javascript functionality for the Ganesa web shop.
             (c) niko popitsch 2003
    */


    var gs_win;
    var gs_thumbnail_max = 70;

    function ganesashop_show( link )

    {
        if ( ! prefix )
            target = 'ganesashop.php?' + link;
            else
            target = prefix + 'ganesashop.php?' + link;
        xx = ( screen.width - 700 ) / 2 ;
        yy = ( screen.height - 425 ) / 2 ;
        gs_win = window.open(target,'GanesaOnlineShop', "screenY="+yy+",screenX="+xx+",top="+yy+",left="+xx+",width=700,height=425,dependent=yes,menubar=no,location=no,toolbar=no,hotkeys=no,resizable=yes,scrollbars");
        gs_win.focus();
    }

    function ganesashop_show( link, prefix )
    {
        if ( ! prefix )
            target = 'ganesashop.php?' + link;
            else
            target = prefix + 'ganesashop.php?' + link;
        xx = ( screen.width - 700 ) / 2 ;
        yy = ( screen.height - 425 ) / 2 ;
        gs_win = window.open(target,'GanesaOnlineShop', "screenY="+yy+",screenX="+xx+",top="+yy+",left="+xx+",width=700,height=425,dependent=yes,menubar=no,location=no,toolbar=no,hotkeys=no,resizable=yes,scrollbars");
        gs_win.focus();
    }

    function ganesashop_add( ISBN, count )
    {
        ganesashop_show( 'gs_command=add_book&gs_ISBN='+ISBN+'&gs_count='+count );    
    }

    function ganesashop_add( ISBN, count, prefix )
    {
        ganesashop_show( 'gs_command=add_book&gs_ISBN='+ISBN+'&gs_count='+count, prefix );    
    }

    function loadImage(name) 
    {    
    img=new Image();
    img.src=name;
    w=img.width;wn=w;
    h=img.height;hn=h;

    if ((w>gs_thumbnail_max) || (h>gs_thumbnail_max)) {
        if (h>w) {
            hn=gs_thumbnail_max;
            wn=(gs_thumbnail_max*hn/h)*w/gs_thumbnail_max;
    
        } else {
            wn=gs_thumbnail_max;
            hn=(gs_thumbnail_max*wn/w)*h/gs_thumbnail_max;
            }
        }

    document.write('<img src="'+name+'" width="'+wn+'" height="'+hn+'" border="0">');
    }

    function ganesashop_showdeliveryconditions()
    {
        xx = ( screen.width - 700 ) / 2 + 20;
        yy = ( screen.height - 425 ) / 2 + 30;
        dc_win = window.open('ganesashop.deliveryconditions.html','GanesaDeliveryConditions', "screenY="+yy+",screenX="+xx+",top="+yy+",left="+xx+",width=700,height=500,dependent=yes,menubar=no,location=no,toolbar=no,hotkeys=no,resizable=yes,scrollbars");
        dc_win.focus();
    }

