var gPicWidth = 0;
var gPicHeight = 0;
var windowHeight = 0;
var timerID;

function P7_HScroller(el,dr,tx,ox,spd) { //v1.6 by PVII
 var g,gg,fr,sp,pa='',slw=true,m=false,w,ww,lx,rx;tx=parseInt(tx);
 if((g=MM_findObj(el))!=null){gg=(document.layers)?g:g.style;}else{return;}
 if(dr=="Stop"){if(g.toMove){clearTimeout(g.p7Magic);}g.toMove=false;}
 if((parseInt(navigator.appVersion)>4 || navigator.userAgent.indexOf("MSIE")>-1)&& !window.opera){pa="px";}
 if(navigator.userAgent.indexOf("NT")>-1 || navigator.userAgent.indexOf("Windows 2000")>-1){slw=false;}
 if(spd=="Slow"){sp=(slw)?2:1;fr=(slw)?40:30;}else if(spd=="Medium"){sp=(slw)?4:1;fr=(slw)?40:10;
 }else{sp=(slw)?8:4;fr=(slw)?40:10;}if(spd=="Warp"){sp=5000;}var xx = parseInt(gg.left);if(isNaN(xx)){
 if(g.currentStyle){xx=parseInt(g.currentStyle.left);}else if(document.defaultView){
 xx=parseInt(document.defaultView.getComputedStyle(g,"").getPropertyValue("left"));}else{xx=0;}}
 if(document.all || document.getElementById){w=parseInt(g.offsetWidth);if(!w){w=parseInt(g.style.pixelWidth);}
 if(g.hasChildNodes){for(wx=0;wx<g.childNodes.length;wx++){ww=parseInt(g.childNodes[wx].offsetWidth);
 if(ww>w){w=ww;}}}}else if(document.layers){w=parseInt(g.clip.width);}lx=tx-w+parseInt(ox);rx=tx;
 if(dr=="Right"){if(xx>lx){m=true;xx-=sp;if(xx<lx){xx=lx;}}}
 if(dr=="Left"){if(xx<rx){m=true;xx+=sp;if(xx>rx){xx=rx;}}}
 if(dr=="Reset"){gg.left=tx+pa;if(g.toMove){clearTimeout(g.p7Magic);}g.toMove=false;}
 if(m){gg.left=xx+pa;if(g.toMove){clearTimeout(g.p7Magic);}g.toMove=true;
  eval("g.p7Magic=setTimeout(\"P7_HScroller('"+el+"','"+dr+"',"+tx+","+ox+",'"+spd+"')\","+fr+")");
 }else{g.toMove=false;}
}

function popImage(imageURL,imageTitle){
	
defaultWidth  = 500;
defaultHeight = 500;

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight;
var optIE='scrollbars=no,width=150,height=100';
	
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
writeln('<sc'+'ript>');
writeln('var isNN,isIE;')
;writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');
writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');
writeln('if (isIE){');
writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width)+20;');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');
writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');
writeln('window.innerHeight=document.images["George"].height+19;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');
writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" bgcolor=FFFFFF scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" bgcolor=FFFFFF scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();		
}
}

function o(identyfikator) {
	return document.getElementById(identyfikator);
}

		
function popPrint2(){
	
	var picLayer = 	"<div class=\"powiekszenie\" id=\"powiekszenie\">"+
					"<div class=\"pasek\"><a href=\"javascript:popClose2()\" class=\"zamknij\">x</a></div>"+
					"<div class=\"ladowanie\" id=\"ladowanie\">"+
					"<div class=\"obrazek\" id=\"obrazek\"></div>"+
					"</div>"+
					"</div>";
	document.body.innerHTML+=picLayer;
	//SET_DHTML("powiekszenie");
}

function popClose2(){
	o('powiekszenie').style.display='none';
	o('obrazek').style.backgroundImage = "";
}

function popImage2old(tPictureHref,tSymbol,tWidth,tHeight) {

	if(o("powiekszenie")==null){

		popPrint2();	
	}
	
	o('obrazek').style.backgroundImage = "url("+tPictureHref+")";
	o('powiekszenie').style.display = "block";
	
	width = tWidth;
	height = tHeight;
	windowHeight = getVisibleHeight();
	
	o('powiekszenie').style.width = (width+20)+"px";
	o('obrazek').style.width = (width)+"px";
	o('obrazek').style.height = (height)+"px";
	o('powiekszenie').style.width = (width)+"px";
	o('powiekszenie').style.height = (height+20)+"px";
	
	if (document.documentElement && document.documentElement.scrollTop)	 theTop = document.documentElement.scrollTop;
	else theTop = document.body.scrollTop;	
	o('powiekszenie').style.top = (theTop/2+((windowHeight)/2)-(height/2)-45)+'px';	
	o('powiekszenie').style.left = (document.body.scrollLeft+((document.body.clientWidth)/2)-(width/2)-5)+'px';
}


function popImage2Close(){
	sshimg.style.visibility='hidden';
	document.images.pshimg.src = "";
}


function popImage2(tPictureHref,tSymbol,tWidth,tHeight) {

	if(o("powiekszenie")==null){
		return;	
	}	
	gPicWidth = tWidth;
	gPicHeight = tHeight;
	
	o('obrazek').style.backgroundImage = "url('"+tPictureHref+"')";
	
	width = tWidth;
	height = tHeight;
	var myWidth = 0, myHeight = 0;
	
	windowHeight = getVisibleHeight();
	updatePopup();
	
	o('powiekszenie').style.display = "block";
	o('obrazek').style.display = "";
}

function popClose2(){
	o('powiekszenie').style.display='none';
	o('obrazek').style.backgroundImage = "";
}


function updatePopup() {
	
	var start = 1;
	//alert(parseInt(timerID));
	if(isNaN(parseInt(timerID)) && o('powiekszenie').style.display=="none"){
		var myWidth = 10;
		var myHeight = 10;
	}
	else{
	   var myWidth = o('obrazek').style.width.replace('px','');
	   var myHeight = o('obrazek').style.height.replace('px','');
	}

   if(myWidth=='')	myWidth = 0;
   if(myHeight=='')	myHeight = 0;
   var desWidth = gPicWidth;
   var desHeight = gPicHeight;
 
   var easingWidth = calcEasing(desWidth , myWidth);
   var easingHeight = calcEasing(desHeight , myHeight);
   width = parseInt(myWidth) + easingWidth;
   height = parseInt(myHeight) + easingHeight;
   
	o('obrazek').style.width = (width)+"px";
	o('obrazek').style.height = (height)+"px";
	
	if (document.documentElement && document.documentElement.scrollTop)	 theTop = document.documentElement.scrollTop;
	else theTop = document.body.scrollTop;	
	o('powiekszenie').style.top = (theTop+(windowHeight/2)-(height/2)-45)+'px';	
	o('powiekszenie').style.left = (document.body.scrollLeft+((document.body.clientWidth)/2)-(width/2)-5)+'px';
	
   if( ((desWidth<=width && easingWidth>=0) || (desWidth>width && easingWidth<=0)) && 
		((desHeight<=height && easingHeight>=0) || (desHeight>height && easingHeight<=0))) {
   		clearTimeout(timerID);
		timerID = '';
		start = 0;
   }
   
   if(start) timerID = setTimeout("updatePopup()", 1);
}

function calcEasing(main, current){
	var Interval = (main - current)/10;
	if(Interval>=0)	Interval = Math.ceil(Interval);
	else Interval = Math.floor(Interval);
	return Interval;
}

function getVisibleHeight(Width, Height) {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return myHeight;
}

function openPage(theUrl,W,H){
    var theWin ="'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width="+W+",height="+H+"'"
	littleWin = window.open(theUrl,'',theWin);
	//littleWin.resizeTo(W+10,H+29);
 	littleWin.focus();
}


function OmnibusZZSubmit(typ){

	var form = document.forms['form_omnibus_zz'];

	form.form_type.value = typ;
	form.submit();
}


/*********************************************************/
/* Web Pages Menu                                        */
/*********************************************************/

function showSubMenu(obj){

	var selectObj = document.getElementById( obj );
	if (selectObj==null)	return;
	
	if (selectObj.style.display != ""){
		//alert('tak');
		selectObj.style.display = "";
	}
	else 
		selectObj.style.display = "none";
	
	return;
}

function hideSubMenu(obj){
	
	if ( obj!="" ){
		var selectObj = document.getElementById( obj );

		if (selectObj != null)
			selectObj.style.display = "none";
	}
}


function dayShow(url){

	location.href = url;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}