function tooltip(d,E,b,i,a){
  d=document;E=d.documentElement;b=d.body;if(!E)return;
  for(i=0;a=b.getElementsByTagName("a")[i];i++){
    if(a.title){
      with(a.t=d.createElement("div")){
        id="tooltip"
        innerHTML=a.title.replace(/\|/g,"<br />")
      }
      a.onmouseover=function(e){
        with(this){title="";onmousemove(e)}
        b.appendChild(this.t)
      }
      a.onmouseout=function(x){
        with(this){title=t.innerHTML.replace(/<br \/>/g,"\|")}
        if(x=d.getElementById("tooltip"))b.removeChild(x)
      }
      a.onmousemove=function(e){
        e=e||event;with(this.t.style){
         left=e.clientX+(E.scrollLeft||b.scrollLeft)+"px"
         top=e.clientY+(E.scrollTop||b.scrollTop)+"px"
        }
      }
    }
  }
}
function addEvent(O,E,F,x){
  return(x=O.addEventListener)?x(E,F,1):(x=O.attachEvent)?x('on'+E,F):!1
}
addEvent(window,'load',tooltip);





/* bibliteka skryptów a4.pl */
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 obrazki() { //v6.0
  var i,p,v,obj,args=obrazki.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
	

function ph_ImageWindow(address, width, height)
{
	var opt = "toolbar=0,resizable=1,menubar=0,scrollbars=1,location=0,status=0,width="+width+",height="+height+",screenX=0,screenY=0,left=30,top=25";
	window.open(address, "",opt);
}

function ph_ImageWindowScroll(address, width, height)
{
	var opt = "toolbar=1,resizable=0,menubar=1,scrollbars=1,location=0,status=0,width="+width+",height="+height+",screenX=30,screenY=25,left=30,top=25";
	window.open(address, "",opt);
}


testFormularza={
  rodzajePol:{
    niepuste:[/.+/,'Proszę wypełnić pole'],
    email:[/^[\w\.-]{2,}@[\w\.-]+\.[a-z]{2,5}$/,'Proszę podać prawidłowy adres e-mail'],
    liczbacalkowita:[/^\d+$/,'Prawidłow± warto¶ci± tego pola jest liczba całkowita'],
    liczbarzeczywista:[/^(\d+|\d+,\d+)$/,'Proszę podać liczbę rzeczywist± (można użyć przecinka)'],
    data:[/^\d+\-\d+\-\d{4}$/,'Proszę wpisać datę w formacie DD-MM-RRRR (numer dnia-numer miesi±ca-rok) np. 23-02-2003'],
    kodpocztowy:[/^\d{2}\-\d{3}$/,'Proszę podać kod pocztowy np. 06-600'],
    m20m100:[/^.{20,100}$/,'Proszę wpisać nie więcej niż 100 znaków, ale też nie mniej niż 20.'],
    duzelitery:[/^[A-Z]+$/,'Proszę używać wyłącznie dużych liter w tym polu'],
    url:[/^http\:\/\/.+\.[a-z]{2,5}$/i,'Proszę podać prawidłowy adres strony www np. http://strona.pl'] 
  },
  testuj:function(f){
    var i,rodz;
    for(i=0;i<f.elements.length;i++){
      E=f.elements[i];
      if(rodz=this.rodzajePol[E.getAttribute('rodzajpola')])
        if(!rodz[0].test(E.value)){
          E.focus();
          E.select();
          alert(
             (E.getAttribute('komunikat')||rodz[1]));
          return false;          
        }
    }
    return true;
  }
}













// otwiera nowe okienko
function openwin(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

// otwiera WebPanel i w stronie otwierajacej uruchamia strone glowna
function openWebPanel(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	window.location.href='http://www.a4.pl/';	
}


function formHelp(name, output, msg) {
	newwin = window.open('','','width=325,height=300,scrollbars=yes');
	if (!newwin.opener) newwin.opener = self;
	with (newwin.document) {
		open();
		write('<html>');
		write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"><TITLE>a4.pl ::Twój Internetowy Format</TITLE><link rel="stylesheet" type="text/css" href="http://www.a4.pl/css/base.css">');
		write('<body bgcolor="#ffffff"><form name=form>' + msg +  '<br>');
		write('<p><font size=1>Możesz wpisać ' + name + ' tutaj, a dane zostaną wprowadzone do formularza.</font>');
		write('<p><center>' + name + ':  <input type=text name=box size=10 onKeyUp=' + output + '=this.value>');
		write('<p><input type=button value="Zakończ" onClick=window.close()>');
		write('</center></form></body></html>');
		close();
   	}
}
