jQuery.noConflict();

jQuery(document).ready(function() {



	jQuery.fn.easySlider = function(options){

	  

		// default configuration properties

		var defaults = {

			prevId: 		prevId,

			prevText: 		'Previous',

			nextId: 		nextId,	

			nextText: 		'Next',

			orientation:	orientation, //  'vertical' is optional;

			speed: 			800			

		}; 

		

		var options = jQuery.extend(defaults, options);  

		

		return this.each(function() {  

			obj = jQuery(this);

			var s = jQuery("li", obj).length;

			/* if(display_styles_fea =="table"){

				s = ul_width_fea;

			} */

			w_li = jQuery("li", obj).width();

			h_li = jQuery("li", obj).height();

			var w = obj.width(); 

			var h = obj.height(); 

			var ts = s-num_per_slide;

			var t = 0;

			var fs = 0;

			var vertical = (options.orientation == 'vertical');

			//jQuery("ul", obj).css('width',s*w);

			

			if(!vertical){

				jQuery("li", obj).css('float','left');

				jQuery("ul", obj).css('width',s*w_li);

			}else{

				jQuery("li", obj).css('clear','both');

				jQuery("ul", obj).css('width',s*h_li);

			}

			/*jQuery(obj).after('<div><span id="'+ options.prevId +'"><a href=\"javascript:void(0);\">'+ options.prevText +'</a></span> <span id="'+ options.nextId +'"><a href=\"javascript:void(0);\">'+ options.nextText +'</a></span></div>');	

			*/

			jQuery('#slider_pagination').html('<div class="pagination_button" style="float:right;"><span id="'+ options.prevId +'"><a href=\"javascript:void(0);\">'+ options.prevText +'</a></span> <span id="'+ options.nextId +'"><a href=\"javascript:void(0);\">'+ options.nextText +'</a></span></div>');	

			jQuery("a","#"+options.prevId).hide();

			jQuery("a","#"+options.nextId).hide();

			jQuery("a","#"+options.nextId).click(function(){		

				animate("next");

				if (t>ts) { jQuery(this).fadeOut();
				}
				jQuery("a","#"+options.prevId).fadeIn();

			});

			jQuery("a","#"+options.prevId).click(function(){		

				animate("prev");

				if (t<=0){ jQuery(this).fadeOut();
				}
				jQuery("a","#"+options.nextId).fadeIn();

			});	

			function animate(dir){

				if(dir == "next"){

					t = (t>=ts) ? ts : t+num_per_slide;

					fs = (fs>=ts) ? ts : fs+1;

				} else {

					t = (t<=0) ? 0 : t-num_per_slide;

					fs = (fs<=0) ? 0 : fs-1;

				};								

				if(!vertical) {

					//p = (t*w*-1);

					p = (fs*num_per_slide*w_li*-1);

					if(dir == "next"){

						if(p <= (-1*w_li*s +num_per_slide*w_li)){

							p = (-1*w_li*s + num_per_slide*w_li);

							//alert(p);

						}

						tmp = p;

					}else{

						if(p <= (tmp +num_per_slide*w_li)){

							p = (tmp + num_per_slide*w_li);

							//alert(p);

						}

					}

					if(isIE6()){

						p = Math.floor(p/2);

					}

					if(p > 0 ){

						p = 0;

					}

					jQuery("ul",obj).animate(

						{ marginLeft: p },

						options.speed

					);				

				} else {

					p = (t*num_per_slide*h_li*-1);

					jQuery("ul",obj).animate(

						{ marginTop: p }, 

						options.speed

					);					

				}

			};

			if(s>1) jQuery("a","#"+options.nextId).fadeIn();	

		});

	  

	};

})