function ScrollText(text,seed)
{
var msg = text;
var out = " ";
var c   = 1;
 if (seed > 100)
 {
  seed--;
  var cmd="ScrollText(\"" + msg + "\"," + seed + ")";
  timerTwo=window.setTimeout(cmd,100);
 }
 else if (seed <= 100 && seed > 0)
 {
  for (c=0 ; c < seed ; c++)
  {
   out+=" ";
  }
  out+=msg;
  seed--;
  var cmd="ScrollText(\"" + msg + "\"," + seed + ")";
  window.status=out;
  timerTwo=window.setTimeout(cmd,100);
 }
 else if (seed <= 0)
 {
  if (-seed < msg.length)
  {
   out+=msg.substring(-seed,msg.length);
   seed--;
   var cmd="ScrollText(\"" + msg + "\"," + seed + ")";
   window.status=out;
   timerTwo=window.setTimeout(cmd,100);
  }
  else
  {
   var cmd="ScrollText(\"" + msg + "\",100)";
   window.status=" ";
   timerTwo=window.setTimeout(cmd,75);
  }
 }
}

function obetnij_spacje(Str){
		dlugosc=Str.length;
		while (Str.slice(0,1) == " "){ 
 			 Str = Str.substr(1,dlugosc-1);
		 	 dlugosc = Str.length
		}
		while(Str.slice(dlugosc-1,dlugosc)== " "){ 
		 	 Str = Str.substr(0,dlugosc-1);
		 	 dlugosc = Str.length
	 	}
	return Str;
}

function blank(pole){
	return (pole=="");
	}
	
	
function search(){
		if(blank(obetnij_spacje(sz.search_txt.value))){
			sz.search_txt.value='szukaj...';
			sz.op.value='';
		}	
		else
			sz.op.value='o';
			
}


function test(){
		ok=true;
		if((!sz.op.value.length)||blank(obetnij_spacje(sz.search_txt.value))) 
			ok=false; //szukana nazwa
		(ok==true)?sz.submit():alert("Wprowadź wyszukiwane słowo, frazę!");
}


function zmien(obiekt,numer,link_nr){
	aid=document.getElementById(link_nr)
	if(numer>0){
		obiekt.bgColor = '#FFFFFF';
		aid.style.color='#004185';
	}
	else{
		obiekt.bgColor = '#004185';
		aid.style.color='#FFFFFF';
	}
	return true;
}

function showimg(imgPath,imgFile,imgWidth,imgHeight,imgDescription,imgScale) {
	if(parseInt(imgWidth)>0){
	//document.images.imgImg.src='/edytorimg_new/empty.gif';
document.images.imgImg.src='/pimg/loading.gif';
var MAX_MIN_WIDTH=640;
var MAX_MIN_HEIGHT=480;
imgW=imgWidth;
imgH=imgHeight;
imgS=imgScale;
if ((imgS>0) && (parseInt(imgWidth)>MAX_MIN_WIDTH || parseInt(imgHeight)>MAX_MIN_HEIGHT)) {
	dXY = Math.min(MAX_MIN_WIDTH/imgWidth,MAX_MIN_HEIGHT/imgHeight);
	imgW = parseInt(imgWidth*dXY);
	imgH = parseInt(imgHeight*dXY);
	//alert ("imgWidth="+imgWidth+", imgHeight="+imgHeight+"\nimgW="+imgW+", imgH="+imgH);
}
else
	imgS=0;

//Odległość od lewej krawędzi
if (imgW<document.body.clientWidth)
	document.all.imgTable.style.left=document.body.scrollLeft+((document.body.clientWidth)/2)-(imgW/2)-5;
else
	document.all.imgTable.style.left=document.body.scrollLeft+5;

//Odległość od góry
if (imgH<document.body.clientHeight)
	document.all.imgTable.style.top=document.body.scrollTop+((document.body.clientHeight)/2)-(imgH/2)-15;
else
	document.all.imgTable.style.top=document.body.scrollTop+15;

document.images.imgImg.width=imgW;
document.images.imgImg.height=imgH;
document.images.imgImg.src=imgPath+imgFile;
document.all.imgFooter.width=imgW;
document.all.imgTable.style.visibility='visible';

imgHeader.innerHTML='<img hspace=1 vspace=1 align=right src=/edytorimg_new/close.gif alt="zamknij" style="cursor:pointer" onclick="imgTable.style.visibility=\'hidden\';imgTable2.style.visibility=\'hidden\';document.images.imgImg.src=\'/edytorimg_new/empty.gif\';">';
//imgHeader.innerHTML='<img hspace=1 vspace=1 align=right src=/edytorimg_new/close.gif alt="zamknij" style="cursor:pointer" onclick="imgTable.style.visibility=\'hidden\';imgTable2.style.visibility=\'hidden\';document.images.imgImg.src=\'/pimg/loading.gif\';">';
if (imgS>0) {
	imgHeader.innerHTML+='<img hspace=1 vspace=1 align=right src=/edytorimg_new/max.gif alt="Maksymalizuj" style="cursor:pointer" onclick="showimg(\''+imgPath+'\',\''+imgFile+'\','+imgWidth+','+imgHeight+','+imgDescription+',0);">'; 
}
//imgHeader.innerHTML+='<img src=/edytorimg_new/empty.gif height=13>Ilustracja&nbsp;<b>'+imgFile+'</b>';
imgHeader.innerHTML+='Ilustracja';
if (imgDescription>0)
	imgFooter.innerHTML=eval('imgDesc'+imgDescription+'.innerHTML');
else
	imgFooter.innerHTML="";

document.all.imgTable2.style.left=parseInt(document.all.imgTable.style.left)-1;
document.all.imgTable2.style.top=parseInt(document.all.imgTable.style.top)-1;
document.all.imgTable2.style.width=imgTable.clientWidth+5;
document.all.imgTable2.style.height=imgTable.clientHeight+5;
document.all.imgTable2.style.visibility='visible';
	}
}

