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);
}

function cytuj_fragment(form_tresc)
{
   var txt = '';
   if (window.getSelection) //mozilla safari
   {
      txt = window.getSelection();
   }
   else if (document.getSelection) //mozilla opera
   {
      txt = document.getSelection();
   }
   else if (document.selection) //tylko ie
   {
      txt = document.selection.createRange().text;
   }
   else return;
   form_tresc.value += '[quote]'+txt+'[/quote]\n';
   form_tresc.tresc.focus();
}

function zmien_typ(id,typ,_name){
    document.getElementById(id).type=typ;
}

function openLink(adres,ajax_w,link_w){
		new_window = window.open(adres,'link');
		linkW(ajax_w,link_w);
}

function onof(obj,vis){
		if (vis) document.getElementById(obj).style.display='block';
		else document.getElementById(obj).style.display='none';
}

var xyz = null;
var vFirstStart = true;
var s_ON=true

function scrol()
{
	if (xyz == null)
	{
		vDIV = document.getElementById("div_sc");
		
		if (vFirstStart)
		{
//			xyz = ScrollDIV("div_sc", SCROLL_DIV_ORIEN_VERTICAL, 15, SCROLL_DIV_DIRECTION_BACKWARD, SCROLL_DIV_REPEAT_YOYO, true, 1, 50, 1);
			xyz = ScrollDIV("div_sc", SCROLL_DIV_ORIEN_HORIZONTAL, 35, SCROLL_DIV_DIRECTION_BACKWARD, SCROLL_DIV_REPEAT_YOYO, true, 1, 180, 0, 0, 0, false);
		}
		else
		{
			xyz = ScrollDIV_Start("div_sc");
		}
	}
	else
	{
		ScrollDIV_Stop("div_sc");
		
		xyz = null;
	}
}
