﻿
function Otworz(nazwa, adres, lewo, gora, szerokosc, wysokosc)
{
	window.open(adres,nazwa,'toolbar=no,menubar=no,location=no,personalbar=no,scrollbars=no,directories=no,status=no,resizable=no,width='+szerokosc+',height='+wysokosc+',left=' + lewo + ',top=' + gora);
}

function DodajDoUlubionych(title, url) {
	if (window.sidebar) {
  		window.sidebar.addPanel(title, url,"");
 	} else if( document.all ) {
 		window.external.AddFavorite( url, title);
 	} else if( window.opera && window.print ) {
 		return true;
	}
}

function fclosepopup(nazwa)
{
	if (document.getElementById(nazwa).style.display != '') {
		document.getElementById(nazwa).style.display='';
	} else {
		document.getElementById(nazwa).style.display='none';
	}
}

function popupSize(lewo,gora,polozenie,tabela, szerokosc, wysokosc, auto) {
	tabgora = gora.split(';');
	tablewo = lewo.split(';');
	tabpolozenie = polozenie.split(';');
	tabtabela = tabela.split(';');
	tabszerokosc = szerokosc.split(';');
	tabwysokosc = wysokosc.split(';');
	tabauto = auto.split(';');
	ilosc=(tabpolozenie.length)-1;
	for (i=0;i<ilosc;i++){
	  var myWidth = 0, myHeight = 0, myScroll = 0;
	  if( typeof( window.innerWidth ) == 'number' ) {
	    //Non-IE
	    myWidth = window.innerWidth;
	    myHeight = window.innerHeight;
		 myScroll = 1000;
		 przesunx = 18;
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	    //IE 6+ in 'standards compliant mode'
	    myWidth = document.documentElement.clientWidth;
	    myHeight = document.documentElement.clientHeight;
		 myScroll = document.documentElement.scrollTop;
		 przesunx = 0;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    //IE 4 compatible
	    myWidth = document.body.clientWidth;
	    myHeight = document.body.clientHeight;
		 myScroll = document.body.scrollTop;
		 przesunx = 0;
	  }
	  if (tabpolozenie[i]==1){
	  		mgora=tabgora[i];
			mlewo=tablewo[i];
	  }
	  if (tabpolozenie[i]==2){
	  		mgora=tabgora[i];
			mlewo=(((myWidth/2)-(tabszerokosc[i]/2))+parseInt(tablewo[i]));
	  }
	  if (tabpolozenie[i]==3){
	  		mgora=tabgora[i];
			mlewo=((myWidth-tabszerokosc[i])+parseInt(tablewo[i]))-przesunx;
	  }
	  if (tabpolozenie[i]==4){
	  		mgora=(((myHeight/2)-(tabwysokosc[i]/2))+parseInt(tabgora[i]));
			mlewo=tablewo[i];
	  }
	  if (tabpolozenie[i]==5){
	  		mgora=(((myHeight/2)-(tabwysokosc[i]/2))+parseInt(tabgora[i]));
			mlewo=(((myWidth/2)-(tabszerokosc[i]/2))+parseInt(tablewo[i]));
	  }
	  if (tabpolozenie[i]==6){
	  		mgora=(((myHeight/2)-(tabwysokosc[i]/2))+parseInt(tabgora[i]));
			mlewo=((myWidth-tabszerokosc[i])+parseInt(tablewo[i]))-przesunx;
	  }
	  if (tabpolozenie[i]==7){
	  		mgora=(((myHeight-tabwysokosc[i]))+parseInt(tabgora[i]-5));
			mlewo=tablewo[i];
	  }
	  if (tabpolozenie[i]==8){
	  		mgora=(((myHeight-tabwysokosc[i]))+parseInt(tabgora[i]-5));
			mlewo=(((myWidth/2)-(tabszerokosc[i]/2))+parseInt(tablewo[i]));
	  }
	  if (tabpolozenie[i]==9){
			mgora=(((myHeight-tabwysokosc[i]))+parseInt(tabgora[i]-5));
			mlewo=((myWidth-(tabszerokosc[i]))+parseInt(tablewo[i]))-przesunx;
	  }
		if (tabauto[i]==1){
		  popupJSFX_FloatDiv(tabtabela[i],parseInt(mlewo),parseInt(mgora)).floatIt();
		} else {
			document.getElementById(tabtabela[i]).style.top=""+parseInt(mgora)+"px";
			document.getElementById(tabtabela[i]).style.left=""+parseInt(mlewo)+"px";
		}
	}
}

var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function popupJSFX_FloatDiv(id, sx, sy)
{
	var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
	var px = document.layers ? "" : "px";
	window[id + "_obj"] = el;
	if(d.layers)el.style=el;
	el.cx = el.sx = sx;el.cy = el.sy = sy;
	el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};

	el.floatIt=function()
	{
		var pX, pY;
		pX = (this.sx >= 0) ? 0 : ns ? innerWidth :
		document.documentElement && document.documentElement.clientWidth ?
		document.documentElement.clientWidth : document.body.clientWidth;
		pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ?
		document.documentElement.scrollTop : document.body.scrollTop;
		if(this.sy<0)
		pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ?
		document.documentElement.clientHeight : document.body.clientHeight;
		this.cx += (pX + this.sx - this.cx)/20;this.cy += (pY + this.sy - this.cy)/20;
		this.sP(this.cx, this.cy);
		setTimeout(this.id + "_obj.floatIt()", 10);
	}
	return el;
}

function Scrolling(o)
{
	// na podstawie skryptu ze strony: www.62kompaniaspecjalna.pl / sierpien 2010
  this.z=document.getElementById(o);
  this.n=document.getElementById(o+'W');
  this.s=this.n.style;
  this.l=0;
  this.y=0;
  wysokosc = this.n.offsetHeight;
  pr = 40;
  this.w=this.n.offsetHeight-this.z.offsetHeight;
  this.obj=o+"Ob";
  eval(this.obj+"=this")
  this.krok=ScrollKrok;
  this.przesun=ScrollPrzesun;
  this.stop=ScrollStop;
	tid=0;
  function ScrollStop()
  {
     clearInterval(this.l)
  }

  function ScrollPrzesun(k,p)
  {
      this.stop();
	  	this.y = p;
      this.l=setInterval(this.obj+'.krok('+k+','+p+')',50)
  }

  function ScrollKrok(k,p)
  {
	tid=1;
	if (k>0 && this.y>=(-document.getElementById(o+'W').offsetHeight)-pr && document.getElementById(o+'W').offsetHeight<p){
      this.y-=k;
		if (this.y<=(-document.getElementById(o+'W').offsetHeight-pr)){
			this.y=p;
	      this.s.top=this.y;
		} else {
	      this.s.top=this.y;
   	}
   }
	if (k>0 && this.y>=(-p+(p-(document.getElementById(o+'W').offsetHeight)))-pr && document.getElementById(o+'W').offsetHeight>p){
      this.y-=k;
		if (this.y<=(-p+(p-(document.getElementById(o+'W').offsetHeight)))-pr){
			this.y=p;
	      this.s.top=this.y;
		} else {
	      this.s.top=this.y;
   	}
	}
  }
  this.clear;
}

function Scrollinginfo24(o)
{
	// na podstawie skryptu ze strony: www.62kompaniaspecjalna.pl / sierpien 2010
  this.z=document.getElementById(o);
  this.n=document.getElementById(o+'W');
  this.s=this.n.style;
  this.l=0;
  this.x=0;
  wysokosc = this.n.offsetWidth;
  pr = 40;
  this.w=this.n.offsetWidth-this.z.offsetWidth;
  this.obj=o+"Ob";
  eval(this.obj+"=this")
  this.krok=ScrollKrokinfo24;
  this.przesun=ScrollPrzesuninfo24;
  this.stop=ScrollStopinfo24;
	tid=0;
  function ScrollStopinfo24()
  {
     clearInterval(this.l)
  }

  function ScrollPrzesuninfo24(k,p)
  {
      this.stop();
	  	this.x = p;
      this.l=setInterval(this.obj+'.krok('+k+','+p+')',50)
  }

  function ScrollKrokinfo24(k,p)
  {
	tid=1;
	if (k>0 && this.x>=(-document.getElementById(o+'W').offsetWidth)-pr && document.getElementById(o+'W').offsetWidth<p){
      this.x-=k;
		if (this.x<=(-document.getElementById(o+'W').offsetWidth-pr)){
			this.x=p;
	      this.s.left=this.x+'px';
		} else {
	      this.s.left=this.x+'px';
   	}
   }
	if (k>0 && this.x>=(-p+(p-(document.getElementById(o+'W').offsetWidth)))-pr && document.getElementById(o+'W').offsetWidth>p){
      this.x-=k;
		if (this.x<=(-p+(p-(document.getElementById(o+'W').offsetWidth)))-pr){
			this.x=p;
	      this.s.left=this.x+'px';
		} else {
	      this.s.left=this.x+'px';
   	}
	}
  }
  this.clear;
}



function fpoziom(nazwa,pozycja)
{
	document.getElementById(nazwa).style.zIndex=pozycja;
}

function ismaxlength(obj){
	var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
	if (obj.getAttribute && obj.value.length>mlength)
	obj.value=obj.value.substring(0,mlength)
}



// Zmiana koloru obrazka
function SkalaSzarosci() {

	var tagidozmiany=new Array("img");
	for(j=0;j<tagidozmiany.length;j++) {
	   var tag = document.getElementsByTagName(tagidozmiany[j]);
	   for(k=0;k<tag.length;k++) {
			if (navigator.userAgent.indexOf('MSIE') !=-1) {
				if (tag[k].id!="imgx" && tag[k].id!="imgprev" && tag[k].id!="imgnext" && tag[k].id!="flash_frame"){
					SkalaSzarosciIE(tag[k]);
				}
			} else {
				if (tag[k].id!="imgx" && tag[k].id!="imgr1" && tag[k].id!="imgr2" && tag[k].id!="imgr3" && tag[k].id!="imgr4" && tag[k].id!="imgr5" && tag[k].id!="imgr6" && tag[k].id!="imgr7" && tag[k].id!="imgr8" && tag[i].id!="imgr9" && tag[i].id!="imgr10" && tag[i].id!="imgr11" && tag[i].id!="imgr12" && tag[k].id!="imgprev" && tag[k].id!="imgnext" && tag[k].id!="flash_frame"){
					tag[k].src = SkalaSzaroscInne(tag[k]);
				}
			}
	   }
	}
}

    function SkalaSzarosciIE(Obraz)
    {
		Obraz.style.filter = 'progid:DXImageTransform.Microsoft.BasicImage(grayScale=1)';
    }

    function SkalaSzaroscInne(Obraz)
    {
        var canvas = document.createElement('canvas');
        var canvasContext = canvas.getContext('2d');
        var imgW = Obraz.width;
        var imgH = Obraz.height;
        canvas.width = imgW;
        canvas.height = imgH;
        canvasContext.drawImage(Obraz, 0, 0);
        var imgPixels = canvasContext.getImageData(0, 0, imgW, imgH);
        for(var y = 0; y < imgPixels.height; y++){
            for(var x = 0; x < imgPixels.width; x++){
                var i = (y * 4) * imgPixels.width + x * 4;
                var avg = (imgPixels.data[i] + imgPixels.data[i + 1] + imgPixels.data[i + 2]) / 3;
                imgPixels.data[i] = avg;
                imgPixels.data[i + 1] = avg;
                imgPixels.data[i + 2] = avg;
            }
        }
        canvasContext.putImageData(imgPixels, 0, 0, 0, 0, imgPixels.width, imgPixels.height);
        return canvas.toDataURL();
    }

// Zmiana wielkości czcionki
function zmienTekst(wielkosc) {
	if (wielkosc==0) {
		window.location.reload(1);
	}
	var plikcss = document.styleSheets;
	for(i=0;i<plikcss.length;i++) {
		var klasacss = plikcss[i].rules || plikcss[i].cssRules;
		for(j=0;j<klasacss.length;j++) {
			var wielkoscczcionki = klasacss[j].style.fontSize.replace("px","");
			if (wielkoscczcionki!='' && wielkoscczcionki!=NaN) {
				wielkoscczcionki = parseInt(wielkoscczcionki);
	         wielkoscczcionki += wielkosc;
				klasacss[j].style.fontSize = wielkoscczcionki+'px';
			}
		}
	}
}

// Zmiana schematu graficznego
function zmienSchemat(schemat) {
	if (schemat != "") {
		var tagidozmiany=new Array("body","table","tr","td","div","span","input");
		for(j=0;j<tagidozmiany.length;j++) {
		   var tag = document.getElementsByTagName(tagidozmiany[j]);
		   for(i=0;i<tag.length;i++) {
				if (navigator.userAgent.indexOf('MSIE') != -1) {
					if(tag[i].currentStyle.backgroundImage) {
						if(tag[i].id!="kir" && tag[i].id!="flash_main" && tag[i].id!="slides" && tag[i].id!="slides2" && tag[i].id!="slides3" && tag[i].id!="slides_1" && tag[i].id!="slides_2" && tag[i].id!="slides_3" && tag[i].id!="slides_4" && tag[i].id!="slides_5" && tag[i].id!="slides_6" && tag[i].id!="slides_7" && tag[i].id!="slides_8" && tag[i].currentStyle.backgroundImage.indexOf("grafika/"+schemat) == -1 && tag[i].currentStyle.backgroundImage.indexOf("pliki/") == -1 && tag[i].currentStyle.backgroundImage.indexOf("spi.prologit.pl") == -1 && tag[i].currentStyle.backgroundImage.indexOf("fsi.prologit.pl") == -1) {
				         var nowyschemat = tag[i].currentStyle.backgroundImage.replace("grafika/","grafika/"+schemat);
							tag[i].style.backgroundImage = nowyschemat;
						}
					}
				} else {
					if(tag[i].style.background) {
						if(tag[i].id!="kir" && tag[i].id!="flash_main" && tag[i].id!="slides" && tag[i].id!="slides2" && tag[i].id!="slides3" && tag[i].id!="slides_1" && tag[i].id!="slides_2" && tag[i].id!="slides_3" && tag[i].id!="slides_4" && tag[i].id!="slides_5" && tag[i].id!="slides_6" && tag[i].id!="slides_7" && tag[i].id!="slides_8" && tag[i].style.background.indexOf("grafika/"+schemat) == -1 && tag[i].style.background.indexOf("pliki/") == -1 && tag[i].style.background.indexOf("spi.prologit.pl") == -1 && tag[i].style.background.indexOf("fsi.prologit.pl") == -1) {
				         var nowyschemat = tag[i].style.background.replace("grafika/","grafika/"+schemat);
			      		tag[i].style.background = nowyschemat;
						}
					}
				}
		   }
		}
		var tagidozmiany=new Array("img");
		for(j=0;j<tagidozmiany.length;j++) {
		   var tag = document.getElementsByTagName(tagidozmiany[j]);
		   for(i=0;i<tag.length;i++) {
				if(tag[i].id!="imgx" && tag[i].id!="imgr1" && tag[i].id!="imgr2" && tag[i].id!="imgr3" && tag[i].id!="imgr4" && tag[i].id!="imgr5" && tag[i].id!="imgr6" && tag[i].id!="imgr7" && tag[i].id!="imgr8" && tag[i].id!="imgr9" && tag[i].id!="imgr10" && tag[i].id!="imgr11" && tag[i].id!="imgr12" && tag[i].id!="imgprev" && tag[i].id!="imgnext" && tag[i].id!="flash_frame" && tag[i].src && tag[i].src.indexOf("grafika/"+schemat) == -1 && tag[i].src.indexOf("pliki/" && tag[i].src.indexOf("spi.prologit.pl") == -1 && tag[i].src.indexOf("fsi.prologit.pl") == -1) == -1) {
		         var nowyschemat = tag[i].src.replace("grafika/","grafika/"+schemat);
			      tag[i].src = nowyschemat;
				}
		   }
		}
	}
	/*
	var tag = document.getElementById('gora');
	alert(tag.style.width);
	alert(so.getQueryParamValue("align"));
	if(tag && schemat != '') {
		var so = new SWFObject("flash/"+schemat+"gora.swf", "gora", tag.style.width, tag.style.height, "9", "#FFFFFF");
		so.addParam("quality", "high");
		so.addParam("menu", "false");
		so.addParam("align", "t");
		so.addParam("bgcolor", "#FFFFFF");
		so.addParam("wmode", "transparent");
		so.useExpressInstall('http://fsi.prologit.pl/asp/flash/expressinstall.swf');
		so.write("gora");
	}
	*/
}

function showevent(e,tresc) {
	var myWidth = 0, myHeight = 0, konfiguratorx = 0, konfiguratory = 30, infox = 0, infoy = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
		myScroll = window.pageYOffset;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
		myScroll = document.documentElement.scrollTop;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
		myScroll = document.body.scrollTop;
	}
	if (!e) e = window.event;
	ch_x = e.clientX;
	ch_x += -10;
	ch_y = e.clientY;
	ch_y = ch_y + myScroll;
	ch_y += -10;
	//alert('x:'+ch_x+'\ny:'+ch_y+'\nwysokosc:'+myHeight+'\nszerokosc:'+myWidth+'\nscrolltop:'+myScroll+'\n');
	//alert('wysokość:' + ch_wysokosc + ', scroll: ' + ch_scroll + ', y:' + ch_y);
	document.getElementById("chmurka").style.left = ch_x+'px';
	document.getElementById("chmurka").style.top = ch_y+'px';
	//document.getElementById("chmurka").innerHTML = "wysokość: "+ch_wysokosc+"<br>scroll: "+ch_scroll+"<br>x: "+ch_x+"<br>y: "+ch_y+"<br>";
	document.getElementById("chmurka").innerHTML = tresc;
	document.getElementById("chmurka").style.display = "block";
	ch_width = document.getElementById('chmurka').offsetWidth;
	if (ch_x>(myWidth/2)){
		document.getElementById("chmurka").style.left = (ch_x-ch_width+20)+'px';
		//alert((ch_x-ch_width));
	}
}

function closeevent() {
	document.getElementById("chmurka").innerHTML = "";
	document.getElementById("chmurka").style.left = -200;
}

function pokaz_chmurke(nazwa)
{
		document.getElementById(nazwa).style.display='';
}

function pokaz_chmurke2(nazwa)
{
		document.getElementById(nazwa).style.display='';
		szer = (document.getElementById(nazwa).offsetWidth)-10;
		wys = (document.getElementById(nazwa).offsetHeight)-10;
		document.getElementById(nazwa).style.margin='-'+wys+'px 0px 0px -'+szer+'px';
}

function ukryj_chmurke(nazwa)
{
		document.getElementById(nazwa).style.display='none';
}

