// browser window size functions
// not yet Tested on: IE 4.0, 5.0, 5.5, 6.0 NN 4.04,4.7, 6 - This shold be done

// Copyright (C) 2003 lukas@sdi.net.pl

function ShowVerticalAlign () {
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else {
    if( document.documentElement &&
        ( document.documentElement.clientWidth ) ) {
      //IE 6+ in 'standards compliant mode'
      myWidth = document.documentElement.clientWidth;
    } else {
      if( document.body && ( document.body.clientWidth ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
      }
    }
  }
  window.alert( 'Width = ' + myWidth );
}

function WindowWidth () {
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else {
    if( document.documentElement &&
        ( document.documentElement.clientWidth ) ) {
      //IE 6+ in 'standards compliant mode'
      myWidth = document.documentElement.clientWidth;
    } else {
      if( document.body && ( document.body.clientWidth ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
      }
    }
  }
  return( myWidth );
}

function WindowHeight () {
  var myHeight = 0;
  if( typeof( window.innerHeight ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else {
    if( document.documentElement &&
        ( document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      myHeight = document.documentElement.clientHeight;
    } else {
      if( document.body && ( document.body.clientHeight ) ) {
        //IE 4 compatible
        myHeight = document.body.clientHeight;
      }
    }
  }
  return( myHeight );
}


// ta funkcja zwraca bezwzględą współrzędną poziomą dla tabeli o stałej szerokości  centrowanej na stronie
function AbsXcoord () {
// szerokość tabeli, która jest centrowana
	var tableWidth = 720;
// względna współrzędna pozioma 
	var relCoord = 200;
//	return ( (WindowWidth - tableWidth)/2 + relCoord );
	return ( (WindowWidth () - tableWidth)/2  + relCoord);
}

function PrintAbsXcoord () {
//	document.write (AbsXcoord ());
//	document.write (WindowWidth ());
	document.write ( '<STYLE TYPE="text/css"><!-- #example {left: ',AbsXcoord (),'px;}--></STYLE>'    );
}
function PrintAbsXcoordStyle () {
//	document.write (  '140px'    );
//	document.write ( '<STYLE TYPE="text/css"><!-- #example {left: '.AbsXcoord ().'px;}--></STYLE>'    );
//AbsXcoord ()
	document.write ( '<STYLE TYPE="text/css"><!-- #example {left: ',AbsXcoord (),'px;}--></STYLE>'    );
}

// funkcje do wyliczania bezwzględnej współrzędnej pionowej dla tabeli o stałej wysokości - centrowanej na stronie
function AbsYcoord () {
// wysokość tabeli, która jest centrowana
	var tableHeight = 420;
// względna współrzędna pionowa 
	var relYcoord = 23;
	return ( (WindowHeight () - tableHeight)/2  + relYcoord);
//	return ( (600 - tableHeight)/2  + relCoord);
}

function PrintAbsYcoord () {
	document.write ( AbsYcoord () );
}

function PrintAbsYcoordStyle () {
	document.write ( '<STYLE TYPE="text/css"><!-- #example {top: ',AbsYcoord (),'px;}--></STYLE>'    );
}


function PrintScrollerDiv () {
//	document.write ( '<DIV id=scrollRollerDiv style="left: '+(WindowWidth () /2 + 350)+'px; top: 200px; POSITION: absolute" align="right">' ) ; 
	document.write ( '<h1>'+(WindowWidth () /2  + 350)+'</h1>' ) ; 
}

function PrintContentDiv () {
	document.write ( '<DIV id=scrollWindowDiv  style="CLIP: rect(0px 350px  290px 0px); HEIGHT: 290px; LEFT: '+(WindowWidth () /2 -10)+'px; POSITION: absolute; TOP: 200px; WIDTH: 320px">' ) ; 
}

function Fotosy () {
//	window.open('fotosy.html', 'Warjutkowiey', 'resizable,height=300,width=300');
//	window.open('fotosy.html', 'Fotosy', 'resizable,height=500,width=500'); 
	window.open('fotosy.php', 'Fotosy', 'noresize,height=530,width=530'); 
}


function BrowserCheck() {
	
	if(document.getElementById)
		NVer=5
	else
	{
		NVer=parseInt(navigator.appVersion)	
	}
	//NVer=4
	if(document.all)
		NName="ie"
	else 
		if(document.layers)
			NName="nn"
		else
			NName="un"
		
	
}

//  tu się zaczynają funkcje scroller'a

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
	this.obj = getObjNN4(document,name);
	this.style = this.obj;
  }
}

function getObjNN4(obj,name)
{
	var x = obj.layers;
	var foundLayer;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		 	foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}


var clipTop = 0;
var clipWidth = 500;
var clipBottom = 375;
//var topper = 87;
//var topper = 175;
var lyrheight = 0;
var time,amount,theTime,theHeight,DHTML;
//topper = AbsYcoord ();
//var topper = 0;

function init()
{
	topper = AbsYcoord ();
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	var x = new getObj('example');
	if (document.layers)
	{
		lyrheight = x.style.clip.bottom;
		lyrheight += 20;
		x.style.clip.top = clipTop;
		x.style.clip.left = 0;
		x.style.clip.right = clipWidth;
		x.style.clip.bottom = clipBottom;
	}
	else if (document.getElementById || document.all)
	{
		lyrheight = x.obj.offsetHeight;
		x.style.clip = 'rect('+clipTop+' '+clipWidth+' '+clipBottom+' 0)'
	}
}

function scrollayer(layername,amt,tim)
{
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;
	amount = amt;
	theTime = tim;
	realscroll();
}

function realscroll()
{
	if (!DHTML) return;
	clipTop += amount;
	clipBottom += amount;
	topper -= amount;
	if (clipTop < 0 || clipBottom > lyrheight)
	{
		clipTop -= amount;
		clipBottom -= amount;
		topper += amount;
		return;
	}
	if (document.getElementById || document.all)
	{
		clipstring = 'rect('+clipTop+' '+clipWidth+' '+clipBottom+' 0)'
		thelayer.style.clip = clipstring;
		thelayer.style.top = topper;
	}
	else if (document.layers)
	{
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.top = topper;
	}
	time = setTimeout('realscroll()',theTime);
}

function stopScroll()
{
	if (time) clearTimeout(time);
}
