var PAGE = {
	_IdExist: function(elem){
		if ($(elem) == null) {
			return false;
		}
		return true;
	}
}

var Layout = {
	init:function(){

      var _bar = document.getElementById('bar').getElementsByTagName('ul')[0];
      var _content = document.getElementById('content'); 

      if ((_bar.offsetHeight + 20) > 345 && _content.offsetHeight < (_bar.offsetHeight + 20)) {
         _content.style.paddingBottom = (_bar.offsetHeight - 265) + 'px';
      }


		if ($('toppartneri')) {
			I.init('toppartneri');
		}
	}
}

var Partneri = {
	show:function(elemid, src){
		$(elemid).src = src;
	}
}

var I = {
	count:0,
	counter:0,
	iMenuPage:1,
	menus:null,
	objects:null,
	pe:null,
	elemId:"toppartneri",

	init:function(elemIdName){
		this.menus = this.menus = $A($(elemIdName).select("li"));
	   this.count = this.menus.length-1;
	   this.pe = new PeriodicalExecuter(this.run, 5);
	},

	run:function(){
		this.counter = this.counter ? this.counter + 1 : 1;
		I.counter = this.counter;
		//I.debug(this.counter+ \'>= \'+I.count +" = "+this.counter > I.count);
		if (this.counter > I.count) {
  	   	this.counter = 0;
  	   	//I.debug(\'\');
  		}
		I.set(this.counter);
	},

	call:function(num){
		I.pe.stop();
		I.counter = num;
		this.pe = new PeriodicalExecuter(this.run,5);
	},

	set:function(id){
		if (I.menus[id]) {
		   var iNewXPos = (-440*id);
		   var leftObj = I.elemId;
		   var iNewYPos;
		   var menu_space = Math.round(I.count / 4);

		   if (id == 0) {
			    iNewYPos = 0;
			    I.iMenuPage = 1;
			    new Effect.Move(leftObj,{y:iNewYPos,duration:1,mode:'absolute'});
			}else{
				iNewYPos = -(I.iMenuPage*60);
				I.iMenuPage++;
				new Effect.Move(leftObj,{y:iNewYPos,duration:1,mode:'absolute'});
			}
		}
	},

	play:function(){
		I.init();
	},

	stop:function(){
		I.pe.stop();
	}
}











