<!--
	// Author:	Mariusz Krupiński
	// E-mail:	mkr@cmsmirage.pl
	// Date:	2004-03-24
	// Tested:	IE 5+, Mozilla 1.6 Win32, Opera 7.23
	
	var stepPx = 1;
	var interval = 40;
	var direction = 1;
	
	var layerHeight;
	var initPosTop, posTop;
	var initBClip, initTClip, tClip;
	var totalSteps, cntSteps = 0;
	var scrollLayer;
	var canScroll = true;
	
	function scNews_init(layerName, _interval) {
		interval = _interval;
		scrollLayer = document.all ? document.all[layerName] : document.getElementById(layerName);
		initBClip = parseInt(scrollLayer.style.clip.split("rect(")[1].split(")")[0].split(/[ ,px]+/)[2]);
		initTClip = parseInt(scrollLayer.style.clip.split("rect(")[1].split(")")[0].split(/[ ,px]+/)[0]);
		initPosTop = parseInt(scrollLayer.style.top);
		layerHeight = scrollLayer.offsetHeight;
		totalSteps = Math.ceil((scrollLayer.offsetHeight + initBClip) / stepPx);
		tClip = initTClip - initBClip;
		posTop = initPosTop + initBClip;
		scrollLayer.style.top = posTop + "px";
		scrollLayer.style.clip = "rect(" + tClip + "px" + " auto " + (tClip + initBClip) + "px" + " 0px)";
		scrollLayer.style.visibility = 'visible';
		_scNews_scroll();
	}
	
	function _scNews_scroll() {
		if (canScroll) {
			if (cntSteps < totalSteps) {
				posTop -= direction * stepPx;
				tClip += direction * stepPx;
				cntSteps++;
			} else {
				if (direction == 1) {
					tClip = initTClip - initBClip;
					posTop = initPosTop + initBClip;
				}
				else {
					tClip = layerHeight;
					posTop = initPosTop - layerHeight;
				}
				cntSteps = 0;
			}
			scrollLayer.style.top = posTop + "px";
			scrollLayer.style.clip = "rect(" + tClip + "px" + " auto " + (tClip + initBClip) + "px" + " 0px)";
			setTimeout("_scNews_scroll()", interval);
		}
	}
	
	function scNews_stopstart() {
		canScroll = !canScroll;
		if (canScroll) {
			_scNews_scroll();
		}
	}
	
	function scNews_up() {
		if (direction == -1) {
			direction = 1;
			cntSteps = totalSteps-cntSteps;
		}
		if (!canScroll) {
			canScroll = true;
			_scNews_scroll();
		}
	}
	
	function scNews_down() {
		if (direction == 1) {
			direction = -1;
			cntSteps = totalSteps-cntSteps;
		}
		if (!canScroll) {
			canScroll = true;
			_scNews_scroll();
		}
	}
	function show(fn,fw,fh)
{
 popup(fn,fw,fh,'DSA SA: Mapka dojazdu','#000000','hug image','0');
}
 
function popup(imageName,imageWidth,imageHeight,alt,bgcolor,hugger,hugMargin) {
 

 if (bgcolor=="") {
  bgcolor="#FFFFFF";
 }
 var adj=10
 var w = screen.width;
 var h = screen.height;
 var byFactor=1;
 
 if(w<740){
   var lift=0.90;
 }
 if(w>=740 & w<835){
   var lift=0.91;
 }
 if(w>=835){
   var lift=0.93;
 }
 if (imageWidth>w){ 
   byFactor = w / imageWidth;   
   imageWidth = w;
   imageHeight = imageHeight * byFactor;
 }
 if (imageHeight>h-adj){
   byFactor = h / imageHeight;
   imageWidth = (imageWidth * byFactor);
   imageHeight = h; 
 }
    
 var scrWidth = w-adj;
 var scrHeight = (h*lift)-adj;
 
 if (imageHeight>scrHeight){
     imageHeight=imageHeight*lift;
   imageWidth=imageWidth*lift;
 }
 
 var posLeft=0;
 var posTop=0;
 
 if (hugger == "hug image"){
   if (hugMargin == ""){
     hugMargin = 0;
   }
   var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
   if (scrHeightTemp < scrHeight) {
  scrHeight = scrHeightTemp;
   } 
   var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
   if (scrWidthTemp < scrWidth) {
  scrWidth = scrWidthTemp;
   }
   
   if (scrHeight<100){scrHeight=100;}
   if (scrWidth<100){scrWidth=100;}
 
   posTop =  ((h-(scrHeight/lift)-adj)/2);
   posLeft = ((w-(scrWidth)-adj)/2);
  }
 
 if (imageHeight > (h*lift)-adj || imageWidth > w-adj){
  imageHeight=imageHeight-adj;
  imageWidth=imageWidth-adj;
 }
 
 var agt=navigator.userAgent.toLowerCase(); 
 var is_opera = (agt.indexOf("opera") != -1); 
 
 if (is_opera == true){
   var args= new Array();
   args[0]='parent';
   args[1]=imageName;
   var i ; document.MM_returnValue = false;
   for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
 } else {
 
 newWindow = window.open("popup.htm","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
 newWindow.document.open();
 newWindow.document.write('<html><title>'+alt+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onBlur="self.close()" >');  
 newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+' ><tr><td>');
 newWindow.document.write('<img src="'+imageName+'" width='+imageWidth+'height='+imageHeight+' alt="Zamknij" >'); 
 newWindow.document.write('</td></tr></table></body></html>');
 newWindow.document.close();
 newWindow.focus();
 }
}


// -->
