function findPos(obj) {
  var nleft = 0;
  var ntop = 0;
  if (obj.offsetParent) {
  nleft = obj.offsetLeft
  ntop = obj.offsetTop
  while (obj = obj.offsetParent) {
  nleft += obj.offsetLeft
  ntop += obj.offsetTop
  }
  }
   
  pos_left = nleft;
  pos_top = ntop;
	return pos_top;
}
function linkW(warstwa,link,loading){
			var req5 = mint.Request();
			if (loading) {
					var IE = document.all?true:false
					SetOpacity(warstwa,20);

					today = new Date()

					var div = document.createElement('div');
					document.body.appendChild(div);
					Nazwa_d=today.getSeconds();
					div.id=Nazwa_d;
					document.getElementById(Nazwa_d).className="loading";

					he=GetHeight(warstwa);
					var ElemScrollTop=findPos(document.getElementById(warstwa));
					if (he<300) ElemScrollTop+=(he/2);
					else ElemScrollTop+=50;

					document.getElementById(Nazwa_d).style.position="absolute";
					document.getElementById(Nazwa_d).style.left=(GetX(warstwa)+(GetWidth(warstwa)/2)-8)+"px";
					document.getElementById(Nazwa_d).style.top=ElemScrollTop+"px";
			}
			req5.evalScripts=true;
			req5.OnSuccess = function () { 
				$(warstwa).innerHTML = this.responseText;
				SetOpacity(warstwa,100);
				document.body.removeChild(div);
			};
			req5.Send (link);
}
function randomize_(){
      today = new Date();
      num = today.getTime();
      return(num);

}

function foto(plik) {
	new_window =window.open('foto.php?ID='+plik,randomize_(),'width=400,height=400,toolbars=no,resizeble="no",scrollbars=no');
}

function openW(strona,width_,height_){
		new_window = window.open(strona,'st','width='+width_+',height='+height_+',toolbars=no,resizeble=no,scrollbars=no');
}
function openS(strona,width_,height_)
{
	new_window = window.open(strona,randomize_(),'width='+width_+',height='+height_+',toolbars=no,resizeble="no",scrollbars=yes');
}

var WYNIK_K='';

function SendF(formularz,warstwa,loading) {
			var WYNIK='';
			var req = mint.Request();
			if (loading) {
					var IE = document.all?true:false
					SetOpacity(warstwa,20);

					today = new Date()

					var div = document.createElement('div');
					document.body.appendChild(div);
					Nazwa_d=today.getSeconds();
					div.id=Nazwa_d;
					document.getElementById(Nazwa_d).className="loading";

					he=GetHeight(warstwa);
					var ElemScrollTop=findPos(document.getElementById(warstwa));
					if (he<300) ElemScrollTop+=(he/2);
					else ElemScrollTop+=50;

					document.getElementById(Nazwa_d).style.position="absolute";
					document.getElementById(Nazwa_d).style.left=(GetX(warstwa)+(GetWidth(warstwa)/2)-8)+"px";
					document.getElementById(Nazwa_d).style.top=ElemScrollTop+"px";
			}
			req.evalScripts=true;
			req.OnSuccess = function() {
					$(warstwa).innerHTML = this.responseText;
					SetOpacity(warstwa,100);
					document.body.removeChild(div);
			}
			req.SendForm(formularz);
}
