function Slider()
{
	/**/
	this.Delay			= 200;
	this.MagDelay		= 200;
	
	/**/
	this.MaxImgWidth	= 500;
	
	/**/
	this.Margin			= 281;
	
	/**/
	this.Count			= 10;
	this.PicasSeen		= 0;

	/*
	*
	*/
	this.next = function()
	{
		this.closeMagnify();
		
		if(this.PicasSeen < (this.Count - 1))
		{
			$('.pica_container').animate({'marginLeft' : '-='+this.Margin+'px'}, this.Delay);
			
			this.PicasSeen++;
		}
		else
		{
			$('.pica_container').animate({'marginLeft' : '0px'}, this.Delay);
			
			this.PicasSeen = 0;
		}
	}
	
	/*
	*
	*/
	this.previous = function()
	{
		if(this.PicasSeen < (this.Count) && this.PicasSeen != 0)
		{
			$('.pica_container').animate({'marginLeft' : '+='+this.Margin+'px'}, this.Delay);
			
			this.PicasSeen--;
		}
		else
		{
			$('.pica_container').animate({'marginLeft' : '-='+(this.Margin * (this.Count - 1))+'px'}, this.Delay);
			
			this.PicasSeen = (this.Count - 1);
		}
	}
	
	/*
	*
	*/
	this.magnify = function(e)
	{
		if($('.magnify_container').css('display') != 'block')
		{
			var img 		= $('.magnify_container').find('img');
			var kids 		= $('.pica_container').children();
			
			var dimension	= $(kids[this.PicasSeen]).attr('rel');
			dimension		= dimension.split('x');
			
			img.attr('src', ROOT+'upload/album/'+$(kids[this.PicasSeen]).attr('id'));
			
			var curH = dimension[1];
			var curW = dimension[0];
			
			var newH = ((curH * this.MaxImgWidth) / curW);
			
			img.css('width', this.MaxImgWidth+'px').css('height', newH);
			
			$('.magnify_container').animate(
			{
				opacity: 'toggle',
				marginLeft: '-=250px',
				marginTop: '-=200px'
			}, this.MagDelay);
		}
		else
			this.closeMagnify();
	}
	
	/*
	*
	*/
	this.closeMagnify = function()
	{
		if($('.magnify_container').css('display') != 'none' )
		{
			$('.magnify_container').animate(
			{
				opacity: 'toggle',
				marginLeft: '+=250px',
				marginTop: '+=200px'
			}, this.MagDelay);
		}
	}
	
	
}

var slider = new Slider();