var Phototicker = Class.create();
Phototicker.prototype = {
	initialize: function()
	{
		this.interval = 6000;
		this.pause = 1000;
		this.container = $("photo-ticker");
		this.elements  = $A(this.container.getElementsByTagName("li"));
		//this.number_of_elements = this.elements.length - 7;
		this.number_of_elements = this.elements.length;
		this.number_of_elements = Math.ceil(this.number_of_elements);
		//alert(this.number_of_elements);
		this.current_element = 1;
		this.timer = setInterval(this.tick.bind(this), this.interval);
  	},
	tick: function()
	{
		this.prev_element = this.current_element - 1;
		if(this.current_element > this.number_of_elements){
			this.current_element = 1;
			
		}
		if(this.current_element == 1){
			this.prev_element = this.number_of_elements;
		}
		
		Effect.Fade("pt-elem-" + this.prev_element, { duration: 0.0 });
		Effect.Appear("pt-elem-" + this.current_element, { duration: 1.0 });
		this.current_element = this.current_element + 1;
	},
	slide: function(id)
	{
		clearInterval(this.timer);
		$$('li.slide-element').each(function(link){
			$(link).hide();
		})		
		//$("b_" + this.current_element).hide();
		//Effect.Fade("b_" + this.current_element, { duration: 0.0 });
		this.current_element = id;
		Effect.Appear("pt-elem-" + id, { duration: 1.0 });
	},
	next: function()
	{
		this.timer = setInterval(this.tick.bind(this), this.interval);
	}
}

var Controls = Class.create();

Controls.prototype = {

	initialize: function()
	{
		this.interval = 1000;
		this.pause = 1000;
		this.container = $("partnersbox");
		this.elements  = $A(this.container.getElementsByTagName("li"));
		this.number_of_elements = this.elements.length - 7;
		
		this.current_element = 1;
		this.timer = setInterval(this.tick.bind(this), this.interval);
  	},
  	
  	zoom: function()
  	{
  	
  	}
}




var Photos = Class.create();

Photos.prototype = {

	initialize: function(sid)
	{
		   
		   new Control.Modal(
				$('lightbox_link_one'),
				{
					ajax:true,
					requestOptions:{evalScripts:true},
					opacity: 0.7,
					width: 640, 
					height: 500
				}
			);
		   
		   
		   $$('a.thumbs').each(function(link){
			   new Control.Modal(link,
						{
							ajax:true,
							requestOptions:{evalScripts:true},
							opacity: 0.7,
							width: 640, 
							height: 500
						}	   		
			   );
		   });
		   
		   
		 /*
		$$('a.modalioio').each(function(link){
			new Control.Modal(link,{
					ajax:true,
					requestOptions:{evalScripts:true},
					opacity: 0.7,
					width: 640, 
					height: 500
				}
			);
						
		});
		*/  
		   
	},
	
	zoom: function(id)
	{
		$$('div.photo').each(function(link){
			$(link).hide();
		});
		Effect.Appear("photo_" + id, { duration: 0.5 });
		//$('photo_' + i).show();
	}
}
