var tlo_okno    ='#c0c0c0';
var tlo_naglowek='#b6b6b6';
var tlo_ramka   ='#bcbcbc';
var tlo_podpis  ='#b6b6b6';
var tlo_puste   ='#a0a0a0';

function kolory_prezentacji( t_okno, t_naglowek, t_ramka, t_podpis ) {
  if(t_okno    !=null) tlo_okno    =t_okno;
  if(t_naglowek!=null) tlo_naglowek=t_naglowek;
  if(t_ramka   !=null) tlo_ramka   =t_ramka;
  if(t_podpis  !=null) tlo_podpis  =t_podpis;
}

function otworz(obrazek,w,h,tytul,naglowek,podpis,osobne) {
  szer=w+22; wys=h+22; tyt=''; if(tytul!=null){tyt+=tytul+' - '}; tyt+='SAMPER';
  x ='<html><head><title>'+tyt+'</title></head>\n';
  x+='<body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0 bgcolor='+tlo_okno+'>';
  x+='<table width=100% height=100% border=0 cellspacing=1 cellpadding=0>';
  if(naglowek!=null){ wys+=51;
    x+='<tr><td align=center>';
    x+='<table border=0 cellspacing=0 cellpadding=0 width=100% height=50><tr><td height=50 bgcolor='+tlo_naglowek+' align=center valign=middle>';
    x+='<font size=+2 face="Arial"><b>'+naglowek+'</b></font></td></tr></table></td></tr>'; }
  x+='<tr><td align=center valign=middle>';
  x+='<table border=0 cellspacing=0 cellpadding=0 width='+(w+20)+' height='+(h+20)+'>';
  x+='<tr><td align=center valign=middle bgcolor='+tlo_ramka+'>';
  x+='<table border=0 cellspacing=0 cellpadding=0 width='+w+' height='+h+'><tr><td bgcolor='+tlo_puste+' background="/g/g_tlopic.gif">';
  x+='<img src="'+obrazek+'" width='+w+' height='+h+' border=0></td></tr></table>';
  x+='</td></tr></table></td></tr>';
  if(podpis!=null){ wys+=51;
    x+='<tr><td align=center valign=top>';
    x+='<table border=0 cellspacing=0 cellpadding=0 width=100% height=50><tr><td height=50 bgcolor='+tlo_podpis+' align=center valign=middle>';
    x+='<font size=-1 face="Arial">'+podpis+'</font></td></tr></table></td></tr>'; }
  x+='</table></body></html>\n';
  ws=640;hs=480;if(window.screen){ws=window.screen.width;hs=window.screen.height}
  wo=szer;if(wo>ws-40){wo=ws-40};ho=wys;if(ho>hs-80){ho=hs-80}
  x0=(ws-wo); y0=((hs-30)-ho)
  nazwa='_blank'; if(osobne==false){nazwa='samper_galeria'}
  win=window.open('',nazwa,'top='+y0+',left='+x0+',screenX='+x0+',screenY='+y0+',status=0,scrollbars=1,resizable=1,menubar=0,width='+wo+',height='+ho)
  javascript:with(win.document){open("text/html");write(x);close()}
  if(document.layers){if(wo==szer && ho!=wys){win.resizeBy(12,0)};if(ho==wys && wo!=szer){win.resizeBy(0,12)}}
  if(document.all){if(wo==szer){win.resizeBy(wo-win.document.body.clientWidth,0)};if(ho==wys){win.resizeBy(0,ho-win.document.body.clientHeight)}}
  if(osobne==false){win.focus()}
  return false
}

function otworzOkno(okno,w,h)
{
  w = window.open(okno,'_blank','width='+w+',height='+h+',scrollbars=yes,resizable=yes');
}

function info( tresc )
{
  w=550; h=450;
  if(window.screen){h=window.screen.height-100;if(h<400){h=400};if(h>800){h=800}};
  x0=50;y0=20;if(window.screen){x0=(window.screen.width-w)/2;y0=(window.screen.height-h)/2};
  win=window.open(tresc,'_blank','top='+(y0-30)+',left='+x0+',screenX='+x0+',screenY='+(y0-30)+',status=0,scrollbars=1,resizable=1,menubar=1,toolbar=1,width='+w+',height='+(h-80));
  win.focus();
}


function externalLinks() { 
 if(!document.getElementsByTagName) return
 var an=document.getElementsByTagName("a") 
 for(var i=0;i<an.length;i++){ 
   var a=an[i]
   if(a.getAttribute("href") && a.getAttribute("rel")=="external"){
     a.setAttribute("target","_blank")
     a.onclick=function(){return link_out(this)}
   }
 }
}

window.onload=externalLinks;
