function _get(ident){ return document.getElementById(ident); }

function getPageSize(){	
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { 
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var Width, Height;
	if (self.innerHeight) {	
		Width = self.innerWidth;
		Height = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { 
		Width = document.documentElement.clientWidth;
		Height = document.documentElement.clientHeight;
	} else if (document.body) 
	
	{
		Width = document.body.clientWidth;
		Height = document.body.clientHeight;
	}	
	return new Array(Width,Height,xScroll,yScroll) ;
}


//--------- ROTATOR LOGOTYPÓW --------------
var slidespeed=-1;
//var slidespeed=-3;
var copyspeed=slidespeed;
var actualwidth,width;
var cross_slide;
function fillup(){
    cross_slide=document.getElementById("rotator") ;	
    if(cross_slide==null) return;
    width=document.getElementById("okno").offsetWidth;
    //width=620;
    cross_slide.style.left=width;
    actualwidth=cross_slide.offsetWidth;   
    lefttime=setInterval("slideleft()",50);
}
function slideleft(){
    if(copyspeed>0){
    	if (parseInt(cross_slide.style.left)<(-actualwidth+40) )
	     cross_slide.style.left=parseInt(cross_slide.style.left)+width+actualwidth+"px"
	else
	    cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px";
    }else
	if (parseInt(cross_slide.style.left)>(width) )
	    cross_slide.style.left=parseInt(cross_slide.style.left)-width-actualwidth+"px"
	else
	    cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px";	
}
//----------------------------------------------

function img(ident,nazwa){ if(ident!=null) ident.src="images/"+nazwa;   }
function _getN(ident){ return document.getElementsByName(ident); }

function load_sel(ident,tab,first){
  var l=(first==1)? 0:1;        
  var f = _get(ident);
  if(f!=null && tab!=null){
    f.length=tab.length+l;
    f[0].value='';
    f[0].text='- wybierz -';
    for (var i=0; i<tab.length; i++){
	f[i+l].value=tab[i];
	f[i+l].text =tab[i];
	}
    }
}

function Show(){
    var t=arguments;    
    for(var i=0; i<t.length; i++){
	var ident=_get(t[i]);
	if(ident!=null) ident.style.display='';
    }	
}
function Hide(){
    var t=arguments;
    for(var i=0; i<t.length; i++){
	var ident=_get(t[i]);
	if(ident!=null) ident.style.display='none';
	//else alert(t[i]+' '+ident);
    }
}
 function ImageInit(){
    if (!document.getElementsByTagName){  return; }
   
    var images = document.getElementsByTagName("img");
    // alert(images);
    var pre_images=new Array();
    for (var i=0; i<images.length; i++){
	var image = images[i];
	if (image.getAttribute("highsrc")!="" && (image.getAttribute("rel")=="se")){
		//alert(image.hig);
	    //image.highsrc=image.getAttribute("highsrc");
	    image.lowsrc=image.getAttribute("src");
	    image.high=new Image();
	    image.high.src=image.getAttribute("highsrc");
		//image.onclick = function () { alert(highsrc); return false; }
		image.onmouseover = function () 
		{ 
			 this.src=this.high.src; 
		    var sound= _get('sound');
    		if(sound!=null){
				sound.Play();				
			}
		}
		image.onmouseout = function () { this.src=this.lowsrc; }
	    	
	}
    }
}

function AnchorInit(){
    if (!document.getElementsByTagName){  return; }
    var anchors = document.getElementsByTagName("a");
    for (var i=0; i<anchors.length; i++){
	var anchor = anchors[i];
    	{
	    anchor.onmouseover = function (){ 
	        var sound= _get('sound');
	        if(sound!=null){ sound.play(); sound.GotoFrame(1); }
	    }	
	}
    }	
}
/*
function Tscroller(id,speed,pos){
    this.oBy=0;
    this.anim=0;
    var myThis=this;    
    this.scroll=function(){
	var ident=document.getElementById(id);
	var celY=document.body.scrollTop;
	this.oBy=(speed*this.oBy+celY)/(speed+1);
	ident.style.top=Math.round(this.oBy)+pos;
	var scrollV=(function myTimeOutFunction1() { myThis.scroll(); } );
	this.anim=setTimeout(scrollV,10)      
    }
    this.animuj=function() { if(!this.anim) this.scroll(); }
    var animl = (function myTimeOutFunction(){ myThis.animuj(); } );
    this.init=function(){ setInterval(animl,100);  }
    this.init();
}
*/

function Tscroller(id,speed,pos){
    this.oBy=0;
    this.anim=0;
    var myThis=this;
    this.scroll=function(){
    var ident=document.getElementById(id);
    var celY=document.body.scrollTop;
    this.oBy=(speed*this.oBy+celY)/(speed+1);
    ident.style.top=Math.round(this.oBy)+pos+"px";
    var scrollV=this;
    ///this.anim=setTimeout(scrollV,10)
    }
    this.animuj=function() { if(!this.anim) this.scroll(); }
    var animl = this.animuj;
    this.init=function(){ setInterval(animl,10);  }
    this.init();
    }
