/**copyright**/

/**
*
* listing carousel object
*
* @package Flynax
* 
**/

var listingCarousel = function(properties){
	
	/* options */
	this.speed = 'normal';
	this.scroll_by = 1;
	this.delay = 5;
	this.vertical = false;
	
	/* internal variables */
	this.obj = false;
	this.block_width_margin = 70;
	this.min_margin = 8;
	this.block_id = false;
	this.block_key = false;
	this.block_width = false;
	this.block_height = false;
	this.work_width = false;
	this.items_count = false;
	this.item_work_side = 0;
	this.current_pos = 0;
	this.current_item = 0;
	this.items_per_slide = 1;
	this.items_per_slide_tmp = false;
	this.slider_width = 0;
	this.slider_height = 0;
	this.time_out = 0;
	this.visible_items = 0;
	this.new_margin = 0;
	this.back = true;
	this.items = new Array();
	this.max_side = 0;
	this.tmp_work_width = 0;
	this.tmp_work_height = 0;
	this.imgObj = new Image();
	this.progress = new Array();
	
	this.init = function(){
		this.extend();
		
		/* adapt configurations */
		this.scroll_by = this.scroll_by < 1 ? 1 : this.scroll_by;
		this.speed = this.isInteger(this.speed) ? this.speed * 1000 : this.speed;
		this.delay = this.isInteger(this.delay) ? this.delay * 1000 : 5*1000;
		
		/* adapt variables' values */
		this.block_id = $(this.obj).attr('id');
		this.block_key = this.block_id.split('lc_block_')[1];
		this.block_width = $('#lc_width_'+this.block_key).width();
		this.work_width = this.block_width-this.block_width_margin;
		this.items_count = $(this.obj).find('ul li').length;
		this.items_per_slide = this.scroll_by;
		
		var self = this;
		
		/* set current block width */
		$(this.obj).width(this.work_width);
		$(this.obj).children('div.lc_border').width(this.work_width);
		
		/* show content */
		$(this.obj).find('ul').show();
		
		/* pre-loading */			
		for ( var i = 0; i < $(this.obj).find('ul li').length; i++ )
		{
			this.progress[i] = 'in_progress';
		}

		for ( var i = 0; i < $(this.obj).find('ul li').length; i++ )
		{
			eval(" \
			var img_"+i+"_"+this.block_key+" = new Image(); \
			img_"+i+"_"+this.block_key+".onload = function(){ self.loading("+i+"); }; \
			img_"+i+"_"+this.block_key+".src = $(this.obj).find('ul li:eq("+i+") div.contener a img').attr('src'); \
			");
		}
	};
	
	this.loading = function(iteration)
	{
		this.progress[iteration] = 'loaded';
		var parentObj = $(this.obj).find('ul li:eq('+iteration+')');
		
		var item = new Object({
			width: $(parentObj).width(),
			height: $(parentObj).height()
		});
		
		this.items.push(item);
		
		this.max_side += this.vertical ? $(parentObj).height() : $(parentObj).width();
		this.tmp_work_width = $(parentObj).width() > this.tmp_work_width ? $(parentObj).width() : this.tmp_work_width;
		this.tmp_work_height = $(parentObj).height() > this.tmp_work_height ? $(parentObj).height() : this.tmp_work_height;
		
		if ( this.progress.indexOf('in_progress') < 0 )
		{
			this.onLoad();
		}
	};
	
	this.onLoad = function(){
		
		//this.item_work_side = tmp_item_work_side;
		this.work_height = this.tmp_work_height;
		
		/* tmp slider width/height */
		if ( this.vertical )
		{
			this.slider_width = this.work_width;
			this.slider_height = this.max_side;
		}
		else
		{
			this.slider_width = this.max_side;
			this.slider_height = this.work_height;	
		}
		
		this.item_work_side = this.max_side / this.items_count;
		this.item_work_side = Math.floor(this.item_work_side);

		this.proceed();
	};
	
	this.proceed = function(){

		/* stop loading */
		$(this.obj).removeClass('lc_loading');
		$(this.obj).children('div.lc_border').animate({opacity: 1});
		
		if ( (this.item_work_side > this.work_width && !this.vertical) || (this.item_work_side > this.work_height && this.vertical) )
		{
			$(this.obj).find('ul').remove();
			$(this.obj).html('Listing images are bigger then block area, please move this block to wider place.');
			return;
		}
		
		/* detect visible items per block */
		if ( !this.vertical )
		{
			this.visible_items = Math.floor(this.work_width/this.item_work_side);
			
			/* correct height for nav arrows */
			$(this.obj).find('div.lc_nav_prev').css('top', (this.work_height/2)-11);
			$(this.obj).find('div.lc_nav_next').css('top', (this.work_height/2)-11);
		}
		else
		{
			this.visible_items = this.items_per_slide;
			
			/* correct height for nav arrows */
			$(this.obj).find('div.lc_nav_prev').css('left', (this.work_width/2)+(this.block_width_margin/2)-11);
			$(this.obj).find('div.lc_nav_next').css('left', (this.work_width/2)+(this.block_width_margin/2)-11);
		}
		
		var work_side = this.vertical ? this.work_height : this.work_width;
	
		var margin_option = this.vertical ? 'Bottom' : 'Right';
		var margin_diff = 0;
		var index = 0;
		var self = this;
		
		$(this.obj).find('ul li:not(:last)').each(function(){
			if ( self.vertical )
			{
				var margin = self.work_height - $(this).height();
			}
			else
			{
				var margin = ((self.work_width / self.visible_items) - $(this).width());
				margin += (margin / (self.visible_items == 1 ? 1 : self.visible_items - 1));
				
				if ( margin < self.min_margin )
				{
					self.visible_items -= 1;
					margin = ((self.work_width / self.visible_items) - $(this).width());
					
					margin += (margin / (self.visible_items == 1 ? 1 : self.visible_items - 1));
				}
			}
			
			margin = Math.floor(margin);
			self.items[index].margin = margin;
			
			margin_diff += self.vertical ? 0 : margin;
			$(this).css('margin'+margin_option, margin);
			index++;
		});
		
		var c = this.vertical ? this.visible_items : 1;
		
		/* set slider height/width */
		$(this.obj).height(this.work_height * c);
		$(this.obj).children('div.lc_border').height(this.work_height * c);
		$(this.obj).find('ul').height(this.slider_height * c);
		$(this.obj).find('ul').width(this.slider_width + margin_diff);
		
		/* set center */
		if ( this.work_width > this.item_work_side && ( this.vertical || ( !this.vertical && this.visible_items == 1 ) ) )
		{
			var cor = Math.floor( (this.work_width - self.tmp_work_width) / 2 );
			var cur = parseInt($(this.obj).css('paddingLeft'));
			
			if ( this.vertical )
			{
				$(this.obj).find('ul').width(this.work_width - (cor * 2));
			}
			$(this.obj).children('div.lc_border').width(this.work_width - cor);
			$(this.obj).width(this.work_width - cor);
			
			$(this.obj).css('paddingLeft', cur+cor);
			if ( cur-cor > cur )
			{
				$(this.obj).css('paddingRight', cur-cor)
			}
		}
		
		/* sliding */			
		$(this.obj).find('div.lc_nav_prev').click(function(){
			self.stop();
			self.slide('prev');
		});
		
		$(this.obj).find('div.lc_nav_next').click(function(){
			self.stop();
			self.slide('next');
		});
		
		/* automatical start sliding */
		if ( this.delay )
		{
			this.time_out = setTimeout( function() { self.slide('next'); }, self.delay );
		}
		else
		{
			this.back = flase;
		}
	};
	
	this.slide = function( dir ){
		if ( this.items_count <= this.visible_items )
		{
			return;
		}
		
		this.items_per_slide = this.items_per_slide > this.visible_items ? this.visible_items : this.items_per_slide;
		
		var axes = this.vertical ? 'height' : 'width';
		
		if ( dir == 'next' )
		{
			// stop if the item is the latest
			if ( this.current_item == this.items_count - this.visible_items )
			{
				this.reset();
				return;
			}
			
			// calculate next item possition
			var diff = this.items_count - (this.current_item + this.items_per_slide + (this.visible_items - this.items_per_slide));
			
			if ( diff < this.visible_items )
			{
				if ( diff < 0 )
				{
					this.items_per_slide_tmp = this.items_per_slide + diff;
				}
				else if ( diff == 0 )
				{
					this.items_per_slide_tmp = this.items_per_slide;
				}
				else if ( diff <= this.items_per_slide )
				{
					this.items_per_slide_tmp = diff;
				}
				else if ( diff > this.items_per_slide )
				{
					this.items_per_slide_tmp = this.items_per_slide;
				}
				
				//console.log('stp: '+this.items_per_slide_tmp)
				this.current_pos -= (this.items[this.current_item][axes] + this.items[this.current_item].margin) * this.items_per_slide_tmp;
				
				// set current item
				this.current_item += this.items_per_slide_tmp;
			}
			else
			{
				this.current_pos -= (this.items[this.current_item][axes] + this.items[this.current_item].margin) * this.items_per_slide;
				
				// set current item
				this.current_item += this.items_per_slide;
			}
		}
		else if ( dir == 'prev' )
		{
			// stop if we are in beggining
			if ( this.current_item == 0 )
			{
				this.forward();
				return;
			}
			
			// calculate next item possition
			if ( this.items_per_slide_tmp )
			{
				this.current_pos += (this.items[this.current_item][axes] + this.items[this.current_item].margin) * this.items_per_slide_tmp;
				
				// set current item
				this.current_item -= this.items_per_slide_tmp;
				this.items_per_slide_tmp = false;
			}
			else
			{
				this.current_pos += (this.items[this.current_item][axes] + this.items[this.current_item].margin) * this.items_per_slide;
				
				// set current item
				this.current_item -= this.items_per_slide;
			}
		}
		
		/* do slide */
		var o = this.vertical ? {'top': this.current_pos} : {'left': this.current_pos};
		
		$(this.obj).find('ul').animate(o, this.speed);

		if ( this.back )
		{
			var self = this;
			this.time_out = setTimeout( function() { self.slide('next'); }, self.delay );
		}
	};
	
	this.stop = function(){
		clearTimeout(this.time_out);
		$(this.obj).find('ul').stop();
	};
	
	this.reset = function(){
		this.current_pos = 0;
		this.current_item = 0;
		
		var o = this.vertical ? {'top': this.current_pos} : {'left': this.current_pos};
		$(this.obj).find('ul').animate(o, this.speed);
		
		if ( this.back )
		{
    		var self = this;
			this.time_out = setTimeout( function() { self.slide('next'); }, self.delay );
		}
	};
	
	this.forward = function(){
		var axes = this.vertical ? 'height' : 'width';
		this.current_pos = 0;
		
		var to = this.items_count - this.visible_items;
		for ( var i = 0; i < to; i++ )
		{
			this.current_pos -= this.items[i][axes] + this.items[i].margin;
		}
		
		this.current_item = i;
		this.items_per_slide_tmp = this.detectTmp(this.items_count, this.current_item, this.visible_items, this.items_per_slide);
		
		var o = this.vertical ? {'top': this.current_pos} : {'left': this.current_pos};
		$(this.obj).find('ul').animate(o, this.speed);
		
		if ( this.back )
		{
    		var self = this;
			this.time_out = setTimeout( function() { self.slide('next'); }, self.delay );
		}
	};
	
	this.detectTmp = function(total, current, visible, perSlide, tmp){
		tmp = tmp ? tmp : visible;
		tmp += perSlide;
		
		if ( tmp == total )
		{
			return perSlide
		}
		else if ( total - tmp > perSlide)
		{
			return this.detectTmp(total, current, visible, perSlide, tmp);
		}
		else if ( total - tmp < 0)
		{
			return perSlide + (total - tmp);
		}
		else
		{
			return total - tmp;
		}
	};
	
	this.isInteger = function(s)
	{
		return (s.toString().search(/^-?[0-9]+$/) == 0);
	};
	
	this.extend = function(){
		for (var i in properties)
		{
			eval(" \
			if ( typeof(this."+i+") != 'undefined' ) \
			{ \
				this."+i+" = properties[i]; \
			} \
			");
		}
	};
}

/**
*
* autocomplete plugin
*
* @package jQuery
* 
**/
//(function($) {
//	
//	$.fn.flCarousel = function(o) {
//		return this.each(function() {
//			new $flc(this, o);
//		});
//	};
//	
//	options = {
//		speed: 'normal',
//		scroll_by: 1,
//		delay: 5,
//		vertical: false
//	}
//	
//	$.flCarousel = function(e, o) {
//		this.obj = e;
//		this.options = $.extend({}, options, o || {});
//
//		this.setup();
//	};
//	
//	// Create shortcut for internal use
//    var $flc = $.flCarousel;
//
//    $flc.fn = $flc.prototype = {
//        flCarousel: '0.2.3'
//    };
//
//    $flc.fn.extend = $flc.extend = $.extend;
//
//    $flc.fn.extend({
//
//		block_width_margin: 70,
//		min_margin: 8,
//		block_id: false,
//		block_key: false,
//		block_width: false,
//		block_height: false,
//		work_width: false,
//		items_count: false,
//		item_work_side: 0,
//		current_pos: 0,
//		current_item: 0,
//		items_per_slide: 1,
//		items_per_slide_tmp: false,
//		slider_width: 0,
//		slider_height: 0,
//		time_out: 0,
//		visible_items: 0,
//		new_margin: 0,
//		back: true,
//		items: new Array(),
//		max_side: 0,
//		tmp_work_width: 0,
//		tmp_work_height: 0,
//		imgObj: new Image(),
//		progress: new Array(),
//    	
//    	setup: function() {
//    		
//    		/* adapt configurations */
//    		this.options.scroll_by = this.options.scroll_by < 1 ? 1 : this.options.scroll_by;
//			this.options.speed = this.isInteger(this.options.speed) ? this.options.speed * 1000 : this.options.speed;
//			this.options.delay = this.isInteger(this.options.delay) ? this.options.delay * 1000 : 5*1000;
//			
//			/* adapt variables' values */
//			this.block_id = $(this.obj).attr('id');
//			this.block_key = this.block_id.split('lc_block_')[1];
//			this.block_width = $('#lc_width_'+this.block_key).width();
//			this.work_width = this.block_width-this.block_width_margin;
//			this.items_count = $(this.obj).find('ul li').length;
//			this.items_per_slide = this.options.scroll_by;
//			
//			var self = this;
//			
//			/* set current block width */
//			$(this.obj).width(this.work_width);
//			$(this.obj).children('div.lc_border').width(this.work_width);
//			
//			/* show content */
//			$(this.obj).find('ul').show();
//			
//			/* pre-loading */			
//			for ( var i = 0; i < $(this.obj).find('ul li').length; i++ )
//			{
//    			this.progress[i] = 'in_progress';
//			}
//
//			for ( var i = 0; i < $(this.obj).find('ul li').length; i++ )
//			{
////				eval(" \
////				var img_"+i+"_"+this.block_key+" = new Image(); \
////				img_"+i+"_"+this.block_key+".onload = function(){ self.loading('', "+i+"); }; \
////				img_"+i+"_"+this.block_key+".src = $(this.obj).find('ul li:eq("+i+") div.contener a img').attr('src'); \
////				");
//
//			}
//    	},
//    	
//    	proceed: function(){
//
//    		/* stop loading */
//    		$(this.obj).removeClass('lc_loading');
//    		$(this.obj).children('div.lc_border').animate({opacity: 1});
//    		
//			if ( (this.item_work_side > this.work_width && !this.options.vertical) || (this.item_work_side > this.work_height && this.options.vertical) )
//			{
//				$(this.obj).find('ul').remove();
//				$(this.obj).html('Listing images are bigger then block area, please move this block to wider place.');
//				return;
//			}
//			
//			/* detect visible items per block */
//			if ( !this.options.vertical )
//			{
//				this.visible_items = Math.floor(this.work_width/this.item_work_side);
//				
//				/* correct height for nav arrows */
//				$(this.obj).find('div.lc_nav_prev').css('top', (this.work_height/2)-11);
//				$(this.obj).find('div.lc_nav_next').css('top', (this.work_height/2)-11);
//			}
//			else
//			{
//				this.visible_items = this.items_per_slide;
//				
//				/* correct height for nav arrows */
//				$(this.obj).find('div.lc_nav_prev').css('left', (this.work_width/2)+(this.block_width_margin/2)-11);
//				$(this.obj).find('div.lc_nav_next').css('left', (this.work_width/2)+(this.block_width_margin/2)-11);
//			}
//			
//			var work_side = this.options.vertical ? this.work_height : this.work_width;
//		
//			var margin_option = this.options.vertical ? 'Bottom' : 'Right';
//			var margin_diff = 0;
//			var index = 0;
//			var self = this;
//			
//			$(this.obj).find('ul li:not(:last)').each(function(){
//				if ( self.options.vertical )
//				{
//					var margin = self.work_height - $(this).height();
//				}
//				else
//				{
//					var margin = ((self.work_width / self.visible_items) - $(this).width());
//					margin += (margin / (self.visible_items == 1 ? 1 : self.visible_items - 1));
//					
//					if ( margin < self.min_margin )
//					{
//						self.visible_items -= 1;
//						margin = ((self.work_width / self.visible_items) - $(this).width());
//						
//						margin += (margin / (self.visible_items == 1 ? 1 : self.visible_items - 1));
//					}
//				}
//				
//				margin = Math.floor(margin);
//				self.items[index].margin = margin;
//				
//				margin_diff += self.options.vertical ? 0 : margin;
//				$(this).css('margin'+margin_option, margin);
//				index++;
//			});
//			
//			var c = this.options.vertical ? this.visible_items : 1;
//			
//			/* set slider height/width */
//			$(this.obj).height(this.work_height * c);
//			$(this.obj).children('div.lc_border').height(this.work_height * c);
//			$(this.obj).find('ul').height(this.slider_height * c);
//			$(this.obj).find('ul').width(this.slider_width + margin_diff);
//			
//			/* set center */
//			if ( this.work_width > this.item_work_side && ( this.options.vertical || ( !this.options.vertical && this.visible_items == 1 ) ) )
//			{
//				var cor = Math.floor( (this.work_width - self.tmp_work_width) / 2 );
//				var cur = parseInt($(this.obj).css('paddingLeft'));
//				
//				if ( this.options.vertical )
//				{
//					$(this.obj).find('ul').width(this.work_width - (cor * 2));
//				}
//				$(this.obj).children('div.lc_border').width(this.work_width - cor);
//				$(this.obj).width(this.work_width - cor);
//				
//				$(this.obj).css('paddingLeft', cur+cor);
//				if ( cur-cor > cur )
//				{
//					$(this.obj).css('paddingRight', cur-cor)
//				}
//			}
//			
//			/* sliding */			
//			$(this.obj).find('div.lc_nav_prev').click(function(){
//				self.stop();
//				self.slide('prev');
//			});
//			
//			$(this.obj).find('div.lc_nav_next').click(function(){
//				self.stop();
//				self.slide('next');
//			});
//			
//			/* automatical start sliding */
//			if ( this.options.delay )
//			{
//				this.time_out = setTimeout( function() { self.slide('next'); }, self.options.delay );
//			}
//			else
//			{
//				this.back = flase;
//			}
//    	},
//    	
//    	slide: function( dir ){
//			if ( this.items_count <= this.visible_items )
//			{
//				return;
//			}
//			
//			this.items_per_slide = this.items_per_slide > this.visible_items ? this.visible_items : this.items_per_slide;
//			
//			var axes = this.options.vertical ? 'height' : 'width';
//			
//			if ( dir == 'next' )
//			{
//				// stop if the item is the latest
//				if ( this.current_item == this.items_count - this.visible_items )
//				{
//					this.reset();
//					return;
//				}
//				
//				// calculate next item possition
//				var diff = this.items_count - (this.current_item + this.items_per_slide + (this.visible_items - this.items_per_slide));
//				
//				if ( diff < this.visible_items )
//				{
//					if ( diff < 0 )
//					{
//						this.items_per_slide_tmp = this.items_per_slide + diff;
//					}
//					else if ( diff == 0 )
//					{
//						this.items_per_slide_tmp = this.items_per_slide;
//					}
//					else if ( diff <= this.items_per_slide )
//					{
//						this.items_per_slide_tmp = diff;
//					}
//					else if ( diff > this.items_per_slide )
//					{
//						this.items_per_slide_tmp = this.items_per_slide;
//					}
//					
//					//console.log('stp: '+this.items_per_slide_tmp)
//					this.current_pos -= (this.items[this.current_item][axes] + this.items[this.current_item].margin) * this.items_per_slide_tmp;
//					
//					// set current item
//					this.current_item += this.items_per_slide_tmp;
//				}
//				else
//				{
//					this.current_pos -= (this.items[this.current_item][axes] + this.items[this.current_item].margin) * this.items_per_slide;
//					
//					// set current item
//					this.current_item += this.items_per_slide;
//				}
//			}
//			else if ( dir == 'prev' )
//			{
//				// stop if we are in beggining
//				if ( this.current_item == 0 )
//				{
//					this.forward();
//					return;
//				}
//				
//				// calculate next item possition
//				if ( this.items_per_slide_tmp )
//				{
//					this.current_pos += (this.items[this.current_item][axes] + this.items[this.current_item].margin) * this.items_per_slide_tmp;
//					
//					// set current item
//					this.current_item -= this.items_per_slide_tmp;
//					this.items_per_slide_tmp = false;
//				}
//				else
//				{
//					this.current_pos += (this.items[this.current_item][axes] + this.items[this.current_item].margin) * this.items_per_slide;
//					
//					// set current item
//					this.current_item -= this.items_per_slide;
//				}
//			}
//			
//			/* do slide */
//			var o = this.options.vertical ? {'top': this.current_pos} : {'left': this.current_pos};
//			
//			$(this.obj).find('ul').animate(o, this.options.speed);
//
//			if ( this.back )
//			{
//				var self = this;
//				this.time_out = setTimeout( function() { self.slide('next'); }, self.options.delay );
//			}
//    	},
//    	
//    	stop: function(){
//    		clearTimeout(this.time_out);
//    		$(this.obj).find('ul').stop();
//    	},
//    	
//    	reset: function(){
//    		this.current_pos = 0;
//    		this.current_item = 0;
//    		
//    		var o = this.options.vertical ? {'top': this.current_pos} : {'left': this.current_pos};
//			$(this.obj).find('ul').animate(o, this.options.speed);
//    		
//    		if ( this.back )
//    		{
//	    		var self = this;
//				this.time_out = setTimeout( function() { self.slide('next'); }, self.options.delay );
//    		}
//    	},
//    	
//    	forward: function(){
//    		var axes = this.options.vertical ? 'height' : 'width';
//    		this.current_pos = 0;
//    		
//    		var to = this.items_count - this.visible_items;
//    		for ( var i = 0; i < to; i++ )
//    		{
//    			this.current_pos -= this.items[i][axes] + this.items[i].margin;
//    		}
//    		
//    		this.current_item = i;
//    		this.items_per_slide_tmp = this.detectTmp(this.items_count, this.current_item, this.visible_items, this.items_per_slide);
//    		
//    		var o = this.options.vertical ? {'top': this.current_pos} : {'left': this.current_pos};
//			$(this.obj).find('ul').animate(o, this.options.speed);
//    		
//    		if ( this.back )
//    		{
//	    		var self = this;
//				this.time_out = setTimeout( function() { self.slide('next'); }, self.options.delay );
//    		}
//    	},
//    	
//    	detectTmp: function(total, current, visible, perSlide, tmp){
//    		tmp = tmp ? tmp : visible;
//    		tmp += perSlide;
//    		
//			if ( tmp == total )
//    		{
//    			return perSlide
//    		}
//    		else if ( total - tmp > perSlide)
//    		{
//    			return this.detectTmp(total, current, visible, perSlide, tmp);
//    		}
//    		else if ( total - tmp < 0)
//    		{
//    			return perSlide + (total - tmp);
//    		}
//    		else
//    		{
//    			return total - tmp;
//    		}
//    	},
//    	
//    	isInteger: function(s)
//    	{
//    		return (s.toString().search(/^-?[0-9]+$/) == 0);
//    	},
//    	
//    	loading: function(parentObj, iteration)
//    	{
//    		console.log(iteration)
//    		this.progress[iteration] = 'loaded';
//    		console.log(this.progress)
//    		
//    		parentObj = $(this.obj).find('ul li:eq('+iteration+')');
//    		
//    		var item = new Object({
//				width: $(parentObj).width(),
//				height: $(parentObj).height()
//			});
//			console.log(item)
//			this.items.push(item);
//			
//			this.max_side += this.options.vertical ? $(parentObj).height() : $(parentObj).width();
//			this.tmp_work_width = $(parentObj).width() > this.tmp_work_width ? $(parentObj).width() : this.tmp_work_width;
//			this.tmp_work_height = $(parentObj).height() > this.tmp_work_height ? $(parentObj).height() : this.tmp_work_height;
//			
//			if ( this.progress.indexOf('in_progress') < 0 )
//			{
//				this.onLoad();
//			}
//    	},
//    	
//    	loadFail: function(iteration)
//    	{
//			this.progress[iteration] = 'fail';
//    	},
//    	
//    	onLoad: function(parentObj){
//    		
//			//this.item_work_side = tmp_item_work_side;
//			this.work_height = this.tmp_work_height;
//			
//			/* tmp slider width/height */
//			if ( this.options.vertical )
//			{
//				this.slider_width = this.work_width;
//				this.slider_height = this.max_side;
//			}
//			else
//			{
//				this.slider_width = this.max_side;
//				this.slider_height = this.work_height;	
//			}
//			
//			this.item_work_side = this.max_side / this.items_count;
//			this.item_work_side = Math.floor(this.item_work_side);
//
//			this.proceed();
//    	}
//    });
//	
//})(jQuery);
