var newwindow = '';


function ulubione() {
	if (window.external) {
		window.external.AddFavorite(location.href,document.title);
	} else
		alert("Przykro nam, ale Twoja przeglądarka nie obsługuje tej opcji.");
}


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);


//fukncja zlicza ile jeszcze znakow mozna wpisac do pola
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
	field.value = field.value.substring(0, maxlimit);
else
	countfield.value = maxlimit - field.value.length;
}


function popitup(url) {
	if (!newwindow.closed && newwindow.location) {
		newwindow.location.href = url;
	}else {
		//newwindow=window.open(url,'name','height=287,width=250,top=250,left=250');
		newwindow=window.open(url,'name','height=307,width=300,top=100,left=50,scrollbars=0,resizable=0');
		if (!newwindow.opener) newwindow.opener = self;
	}
	if (window.focus)
		{newwindow.focus()}

	return false;
}

function tmpPopitup(url) {
	if (!newwindow.closed && newwindow.location) {
		newwindow.location.href = url;
	}else {
		//newwindow=window.open(url,'name','height=287,width=250,top=250,left=250');
		newwindow=window.open(url,'name','height=307,width=300,top=100,left=50,scrollbars=0,resizable=0');
		if (!newwindow.opener) newwindow.opener = self;
	}
	if (window.focus)
		{newwindow.focus()}

	return false;
}
