noweOkienko = null;

function galeria(src, w, h)
{
    if(window.screen)
    {
        aw=screen.availWidth;
        ah=screen.availHeight;
    }else{
        aw=640;
        ah=450;
    }

    if(noweOkienko==null || noweOkienko.closed)
    {
        ustawienia=
            "left=" + (aw-w)/2 + ","
            +"top=" + (ah-h)/2 + ","
            +"screenX=" + (aw-w)/2 + ","
            +"screenY=" + (ah-h)/2 + ","
            +"width=" + w + ","
            +"height=" + h + ","
            +"innerWidth=" + w + ","
            +"innerHeight=" + h + ","
            +"toolbar=no,"
            +"location=no,"
            +"directories=no,"
            +"status=yes,"
            +"menubar=no,"
            +"scrollbars=no,"
            +"resizable=no"
        noweOkienko = window.open("",'obrazek',ustawienia);
    }

    noweOkienko.document.open();
    noweOkienko.document.clear();
    noweOkienko.document.write(
        "<html><head><title>Powiększenie</title>\n"
        +"</head><BODY bgcolor=#000000>\n"
        +"<div class=bgfoto id='wait' style='position:absolute; left:" + (w-120)/2 + "px; top:" + h/2 + "px; width:" + w + "; height=" + h + "; z-index:1'><font size='2' font color='#3C436C' face='sans-serif'><b><br> OTWIERANIE</b> </font></div>\n"
        +"<div id='img' style='position:absolute; left:0; top:0; width:300; height:200px; z-index:2'><a href='javascript:window.close()'><img src="+ src +" width=" + w + " height=" + h + "  alt=' Zamknij ' border=0></a></div>\n"
        +"</body></html>"
    );
    noweOkienko.document.close();
    noweOkienko.focus();
}


/********************************************************************************************/
/*                                  panele edico_texts                                      */
/********************************************************************************************/

function edico_basic_text_editor( file_name )
{
    wdth = 638;
    hght = 506;
    lft  = screen.width/2 - wdth/2;
    tp   = screen.height/2 - hght/2;
    window.open('edico_3/edico_texts/basic_text_editor/panel.php?file_name='+file_name+'',
        'basic_text_editor','width='+wdth+', height='+hght+', left='+lft+', top='+tp+'');
}

function edico_tiny_simple_editor( file_name )
{
    wdth = 638;
    hght = 516;
    lft  = screen.width/2 - wdth/2;
    tp   = screen.height/2 - hght/2;
    window.open('edico_3/edico_texts/tiny_simple_editor/panel.php?file_name='+file_name+'',
        'tiny_simple_editor','width='+wdth+', height='+hght+', left='+lft+', top='+tp+' ');
}

function edico_tiny_advanced_editor( file_name )
{
    wdth = 638;
    hght = 506;
    lft  = screen.width/2 - wdth/2;
    tp   = screen.height/2 - hght/2;
    window.open('edico_3/edico_texts/tiny_advanced_editor/panel.php?file_name='+file_name+'',
        'tiny_advanced_editor','width='+wdth+', height='+hght+', left='+lft+', top='+tp+' ');
}


/********************************************************************************************/
/*                                  panele edico_images                                     */
/********************************************************************************************/

function edico_popup_image( file, w, h, w_s, h_s )
{
    wdth = 640;
    hght = 315;
    lft  = screen.width/2 - wdth/2;
    tp   = screen.height/2 - hght/2;
    window.open('edico_3/edico_images/popup_image/panel.php?file_name='+file+'&w='+w+
        '&h='+h+'&w_s='+w_s+'&h_s='+h_s+'', 'myWindow1','width='+wdth+', height='+hght+
        ', left='+lft+', top='+tp+' ');
}

function edico_single_image( file, w, h )
{
    wdth = 640;
    hght = 315;
    lft  = screen.width/2 - wdth/2;
    tp   = screen.height/2 - hght/2;
    window.open('edico_3/edico_images/single_image/panel.php?file_name='+file+'&w='+w+
        '&h='+h+'', 'myWindow1','width='+wdth+', height='+hght+
        ', left='+lft+', top='+tp+' ');
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function com_database_delete_panel(item_index)
{
    wdth = 210;
    hght = 160;
    lft  = screen.width/2 - wdth/2;
    tp   = screen.height/2 - hght/2;
    window.open('edico_source/components/com_database/delete_panel.php?item_index='+item_index+'','myWindow','width='+wdth+', height='+hght+', left='+lft+', top='+tp+' ');
}

function com_database_edit_panel(item_index)
{
    wdth = 640;
    hght = 320;
    lft  = screen.width/2 - wdth/2;
    tp   = screen.height/2 - hght/2;
    window.open('edico_source/components/com_database/edit_panel.php?item_index='+item_index+'','myWindow','width='+wdth+', height='+hght+', left='+lft+', top='+tp+' ');
}

function com_database_image_panel(current_file)
{
    wdth = 640;
    hght = 295;
    lft  = screen.width/2 - wdth/2;
    tp   = screen.height/2 - hght/2;
    window.open('edico_source/components/com_database/image_panel.php?current_file='+current_file+'','myWindow','width='+wdth+', height='+hght+', left='+lft+', top='+tp+' ');
}

function com_database_text_panel(currentFile)
{
    wdth = 208;
    hght = 230;
    lft  = screen.width/2 - wdth/2;
    tp   = screen.height/2 - hght/2;
    window.open('edico_source/components/com_database/text_panel.php?file_name='+currentFile+'','myWindow','width='+wdth+', height='+hght+', left='+lft+', top='+tp+' '); 
};

