			function bannerStatusObject () {
				this.percent		= 0;
				this.currentStep	= 0;
				this.distance		= 33;
				this.Ypos			= new Array;
				this.totalSteps		= 8;
				this.interval		= 10;
				this.opacityInitial	= 0.4;
				this.opacityFinal	= 0.8;
				this.opacityChild	= false;
				this.initialOffset	= 49;
				this.timer			= false;
			}

			function CEyeSlider (MotherElementID, EyeNum, inputWidth, inputHeight) {

				this.slideEyeID			= "slidingEye_" + EyeNum;
				this.slideFilmID		= "slidingFilm_" + EyeNum;

				this.positionXcurrent	= 0;
				this.positionXgoingto	= 0;
				
				this.eyeNum		= 1;
				this.eyeWidth	= inputWidth;
				this.eyeHeight	= inputHeight;
				
				this.numOfCells = 0;

				this.slideTime = 260; //num of miliseconds for slide effect
				this.slideSteps = 20; //num of slides for slide animation effect
				this.slideStepCurrent = 0; //num of slides for slide animation effect
				this.slideTimePerStep = Math.round(this.slideTime / this.slideSteps, 0);
				this.slideXes = new Array(100);
				
				this.Timer = null;
				this.timerCell	= null;
				this.timerCellInterval = 5000;
				this.currentCell = 1;
				_self = this;

				
				this.activateCSS = function(name, localization) {
					var nowySkrypt = document.createElement('link');
					nowySkrypt.setAttribute('rel', 'stylesheet');
					nowySkrypt.setAttribute('type', 'text/css');
					nowySkrypt.setAttribute('href', localization + name + '.css');

					document.getElementsByTagName('head')[0].appendChild(nowySkrypt);
				}
				
				this.run = function () {
					if (this.numOfCells > 1)
						this.timerCell = window.setInterval('_self.changeCell();', this.timerCellInterval);
				}
				
				this.stop = function () {
					clearInterval(this.timerCell);					
				}
				
				this.changeCell = function () {
					if (++this.currentCell > this.numOfCells)
						this.currentCell = 1;
					this.turnTo(this.currentCell);
				}
				
				this.setWidth = function(val) {
					this.eyeWidth = val;
				}
				
				this.turnTo = function(num) {
					if (this.eyeNum == num)
						return;
					else
						this.eyeNum = num;
					if (!this.slideFilmObject)
						return;
						
					//slider is going to...
					this.positionXgoingto = -((this.eyeNum-1)*this.eyeWidth);// this.slideXes[this.slideStepCurrent];
					
					distance = this.positionXcurrent - this.positionXgoingto;
					if (distance < 0)
						side = 1;
					else
						side = -1;
					
					for (i = 0; i < this.slideSteps; i++) {
						angle = (90 / this.slideSteps) * i;
						stepSize = Math.cos((90-angle) * (Math.PI /180)) * Math.abs(distance);
						//stepSize = (Math.abs(distance) / this.slideSteps) * i;
						this.slideXes[i] = this.positionXcurrent + side * Math.round(stepSize, 0);
					}
					//this.slideXes[this.slideSteps] = this.slideXes[this.slideSteps-1]; 
					this.slideXes[this.slideSteps] = this.positionXgoingto; 
					
					this.slideStepCurrent = 0;
					this.Timer = window.setTimeout('_self.turnOneStep();', this.slideTimePerStep);
				}

				this.turnOneStep = function() {
					this.slideFilmObject.style.marginLeft = this.slideXes[this.slideStepCurrent] + 'px';
					this.positionXcurrent = this.slideXes[this.slideStepCurrent];
					
					//document.write(this.positionXcurrent);
					//e = document.getElementById('aaa');
					//e.value=this.positionXcurrent;
					
					if (this.slideStepCurrent < this.slideSteps) {
						this.slideStepCurrent++;
						this.Timer = window.setTimeout('_self.turnOneStep();', this.slideTimePerStep);
					}
					//TODO
					// w przeciwnym razie skasowac zegar
				}
				
				this.create = function () {
					//create eye
					if (eye = document.createElement("div")) {
						this.activateCSS('EyeSlider', './templates/gadgets/');
						if (mother = document.getElementById(MotherElementID))
							if (child = mother.getElementsByTagName('div')) {
								child[0].parentNode.removeChild(child[0]);
							}
						
						eye.style.width		= this.eyeWidth + 'px';
						eye.style.height	= this.eyeHeight + 'px';
						eye.style.overflow	= 'hidden';
						var newAttr = document.createAttribute('style');
						newAttr.nodeValue = 'overflow: hidden; height: ' + this.eyeHeight + 'px; width: ' + this.eyeWidth + 'px;';
						eye.setAttributeNode(newAttr);
						this.slideParent.appendChild(eye);
					//create film
						if (film = document.createElement("div")) {
							var newAttr = document.createAttribute('style');
							newAttr.nodeValue = 'width: 0; height: ' + this.eyeHeight + 'px';
							film.setAttributeNode(newAttr);
							this.slideFilmObject = film;
							eye.appendChild(film);
						}
					}
					
				}
				
				this.slideFilmObject = false;
				this.slideFilmWidth = 0;
				
				
				this.bannerStatus = new Array;
				
				this.redrawBanner = function(num) {
					if (e = document.getElementById('_bannercell_' + EyeNum + '_' + num)) {
						e.style.top		= ((this.eyeHeight - this.bannerStatus[num].initialOffset) - this.bannerStatus[num].Ypos[this.bannerStatus[num].currentStep]) + 'px';
						var opacity = this.bannerStatus[num].opacityInitial + (this.bannerStatus[num].opacityFinal - this.bannerStatus[num].opacityInitial) * (this.bannerStatus[num].currentStep/this.bannerStatus[num].totalSteps);
						opacity = (Math.round(opacity*100))/100;
						this.bannerStatus[num].opacityChild.style.filter	= 'alpha(opacity=' + Math.round(opacity*100) + ')';
						this.bannerStatus[num].opacityChild.style.opacity	= opacity;
//						i = document.getElementById('aaa');
//						i.value = opacity;
					}
				}
				
				this.dynamicUnhideBanner = function(num) {
					//obliczenie kolejnej wartości procentu
					if (this.bannerStatus[num].currentStep < this.bannerStatus[num].totalSteps-1) {
						this.bannerStatus[num].currentStep++;
						this.redrawBanner(num);
						this.bannerStatus[num].timer = window.setTimeout('_self.dynamicUnhideBanner(' + num + ');', this.bannerStatus[num].interval);
						this.stop();
					}
					else
						if (this.bannerStatus[num].timer) {
							clearTimeout(this.bannerStatus[num].timer);
						}
				}
				
				this.dynamicHideBanner = function(num) {
					//obliczenie kolejnej wartości procentu
					if (this.bannerStatus[num].currentStep > 0) {
						this.bannerStatus[num].currentStep--;
						this.redrawBanner(num);
						this.bannerStatus[num].timer = window.setTimeout('_self.dynamicHideBanner(' + num + ');', this.bannerStatus[num].interval);
					}
					else
						if (this.bannerStatus[num].timer) {
							clearTimeout(this.bannerStatus[num].timer);
							this.run();
						}
				}

				this.unhideBanner = function (id, num) {
					if (e = document.getElementById(id)) {
						clearTimeout(this.bannerStatus[num].timer);
						this.dynamicUnhideBanner(num);
					}
				}
				
				this.hideBanner = function (id, num) {
					if (e = document.getElementById(id)) {
						clearTimeout(this.bannerStatus[num].timer);
						this.dynamicHideBanner(num);
					}
				}
				
				this.addEvent = function (node, eventName, func) {
					if(node.addEventListener)
						node.addEventListener(eventName, func, false);
					else
						node.attachEvent('on' + eventName, func);
				}
				
				this.addCell = function (caption, media, title, summary, localization) {
					if (cell = document.createElement('div')) {
						++this.numOfCells;
						var num = this.numOfCells;
						this.bannerStatus[num] = new bannerStatusObject();
						
						for (i = 0; i < this.bannerStatus[num].totalSteps; i++) {
							angle = (90 / this.bannerStatus[num].totalSteps) * i;
							stepSize = Math.cos((90-angle) * (Math.PI /180)) * Math.abs(this.bannerStatus[num].distance);
							//stepSize = (Math.abs(distance) / this.slideSteps) * i;
							this.bannerStatus[num].Ypos[i] = Math.round(stepSize, 0);
						}
						
						
						
						var newAttr = document.createAttribute('style');
						newAttr.nodeValue = 'position: relative; float: left; height: ' + this.eyeHeight + 'px; overflow: hidden; width: ' + this.eyeWidth + 'px !important; background: url(' + media + ') top left no-repeat transparent;';
						cell.setAttributeNode(newAttr);
						
						//utworzenie boksu
						
						//dolny banner
						if (caption != '') {
							var idForThisBanner = '_bannercell_' + EyeNum + '_' + num; 
							banner = document.createElement('div');
							var newAttr = document.createAttribute('style');
							newAttr.nodeValue = 'position: absolute; height: ' + this.eyeHeight + 'px; width: ' + this.eyeWidth + 'px !important; top: ' + (this.eyeHeight - this.bannerStatus[num].initialOffset) + 'px;';
							banner.setAttributeNode(newAttr);
							var newAttr = document.createAttribute('id');
							newAttr.nodeValue = idForThisBanner;
							banner.setAttributeNode(newAttr);
	
							bannerbck = document.createElement('div');
							var newAttr = document.createAttribute('style');
							newAttr.nodeValue = 'color: #fff; position: absolute; height: ' + this.eyeHeight + 'px; width: ' + this.eyeWidth + 'px !important; background-color: #000; top: 0; left: 0;';
							bannerbck.setAttributeNode(newAttr);
							opacity = (Math.round(this.bannerStatus[num].opacityInitial*100))/100;
							bannerbck.style.filter	= 'alpha(opacity=' + Math.round(opacity*100) + ')';
							bannerbck.style.opacity	= opacity;
							this.bannerStatus[num].opacityChild = bannerbck;
							banner.appendChild(bannerbck);
							
							//caption
							captiontext = document.createElement('div');
							captiontext.className = '_eyeslider_cellcaption';
							text = document.createTextNode(caption);
							captiontext.appendChild(text);
							banner.appendChild(captiontext);
							//title
							titletext = document.createElement('div');
							titletext.className = '_eyeslider_celltitle';
							text = document.createTextNode(title);
							titletext.appendChild(text);
							banner.appendChild(titletext);
							//summary
							summarytext = document.createElement('div');
							summarytext.className = '_eyeslider_cellsummary';
							text = document.createTextNode(summary);
							summarytext.appendChild(text);
							banner.appendChild(summarytext);
							
							cell.appendChild(banner);
							//nakładka
							overlayer = document.createElement('a');
							var newAttr = document.createAttribute('style');
							newAttr.nodeValue = 'display: block; position: absolute; height: ' + this.eyeHeight + 'px; width: ' + this.eyeWidth + 'px !important; background: transparent; top: 0; left: 0;';
							overlayer.setAttributeNode(newAttr);
							var newAttr = document.createAttribute('href');
							newAttr.nodeValue = localization;
							overlayer.setAttributeNode(newAttr);
							var newAttr = document.createAttribute('title');
							newAttr.nodeValue = title + ' - kliknij i dowiedz się więcej...';
							overlayer.setAttributeNode(newAttr);
							this.addEvent(overlayer, 'mouseover', function(){_self.unhideBanner(idForThisBanner, num)});
							this.addEvent(overlayer, 'mouseout', function(){_self.hideBanner(idForThisBanner, num)});
							
							cell.appendChild(overlayer);
						}
						if (this.slideFilmObject) {
							this.slideFilmWidth += this.eyeWidth;
							this.slideFilmObject.style.width = this.slideFilmWidth + 'px';
							this.slideFilmObject.appendChild(cell);
						}
					}
				}
				
				this.turnToSimple = function (num) {
					if (!this.slideFilmObject)
						return;
					this.slideFilmObject.style.marginLeft = -((num-1)*this.eyeWidth) + 'px' ;
				}

				if (!(this.slideEyeObject = document.getElementById(this.slideEyeID))) {
					this.slideEyeObject	= false;
				}
				
				if (!(this.slideParent = document.getElementById(MotherElementID))) {
					this.slideParent = false;
				}

/*				
				if (!(this.slideFilmObject = document.getElementById(this.slideFilmID))) {
					this.slideFilmObject	= false;
				}
				else {
					this.turnTo(1);
					//TODO wyliczyc liczbe obiektow
					this.slideFilmObject.style.width = 1000 + 'px';
				}
*/				
			}

