function openClose(id)
{
   if(document.getElementById) {
      element = document.getElementById(id);
   } else if(document.all) {
      element = document.all[id];
   } else return;

   if(element.style) {
      if(element.style.display == 'block' ){
         element.style.display = 'none';
      } else {
         element.style.display = 'block';
      }
   }
}
function okno(nazwa,width,height)
{ 
okienko=window.open(nazwa, "Zoom", "width="+width+", height="+height+", top=50, left=50, scroolbar=auto");
};

function okno(nazwa,width,height,tytul)
{
okienko=window.open(nazwa, tytul, "width="+width+", height="+height+", top=50, left=50, scroolbar=auto");
};

function okno_oferta(nazwa)
{ 
okienko_oferta=window.open(nazwa, "Podgl±d", "width=500, height=500, top=0, left=0, scrollbars=yes");
};

function usun(tekst)
{
i = CONFIRM("Czy na pewno chcesz usun±æ to zlecenie?");
if (i==true) window.location.replace(tekst);
};

function help()
{ 
okienko=window.open('help.htm','Help', 'width=600, height=500, top=50, left=50, scrollbars=yes,resizable=no,menubar=no, toolbar=no');
};


function okienko(nazwa,adres,img1,img2,frm)
{
  wartosc = window.prompt(nazwa,adres);
   if (wartosc!=false && wartosc!=null)
   {

	if (img1!="img") bbcode('['+img1+wartosc+']','[/'+img2+']');
	else
	{
	tekst=' [img]'+wartosc;
	bbcode(tekst,'[/img]');
       	};
   };
};

function okienko_adres(nazwa,adres,nazwa2,tytul,frm)
{
  wartosc = window.prompt(nazwa,adres);

   if (wartosc!=false && wartosc!=null)
   {
        wartosc2 = window.prompt(nazwa2,tytul);
        if (wartosc2!=false && wartosc2!=null)
        {
                tekst=' [url='+wartosc+']'+wartosc2;
                bbcode(tekst,'[/url]');
	};
   };
};

function bbcode(tag,tag2,z)
{
if (document.selection)
{
	tekst=document.selection.createRange().text;
	document.getElementById('opis').focus();
	document.selection.createRange().text=tag+tekst+tag2;
}
else
{
	tekst=document.getElementById('opis').value.substring(document.getElementById('opis').selectionEnd||0,document.getElementById('opis').selectionStart||0);
        if ((document.getElementById('opis').selectionStart || document.getElementById('opis').selectionStart=='0')) document.getElementById('opis').value=document.getElementById('opis').value.substring(0,document.getElementById('opis').selectionStart)+tag+tekst+tag2+document.getElementById('opis').value.substring(document.getElementById('opis').selectionEnd,document.getElementById('opis').value.length);
	else document.getElementById('opis').value+=tag+tekst+tag2;
};
};

function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=no,menubar=no' );
}

function high(which2)
{
theobject=which2
highlighting=setInterval("highlightit(theobject)",30)
}
function low(which2)
{
clearInterval(highlighting)
if (which2.style.MozOpacity)
which2.style.MozOpacity=0.3
else if (which2.filters)
which2.filters.alpha.opacity=30
}
function highlightit(cur2){
if (cur2.style.MozOpacity<1)
cur2.style.MozOpacity=parseFloat(cur2.style.MozOpacity)+0.1
else if (cur2.filters&&cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=10
else if (window.highlighting)
clearInterval(highlighting)
}

PositionX = 50;
PositionY = 50;

defaultWidth  = 50;
defaultHeight = 50;

var AutoClose = true;

if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;

function popImage(imageURL,imageTitle,altText){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George"  src='+imageURL+' style="display:block"></body></html>');
close();
}}
