function PennySlide ($preferences) {
	this.$img_group=$($preferences["img_group"]);
	this.$img_group.style.display="none";
	this.$img_list=$$("li",this.$img_group);
	this.$img_length=this.$img_list.length;
	this.current_index=0;
	this.a=[];
	this.$imgs=[];
	var $this = this;
	for (var $index=0; $index<this.$img_length; $index++) {
		this.a[$index] = {};
		var h = this.$img_list[$index];
		var a = this.a[$index];
		
		this.$imgs[$index] = $$("img", h)[0];
	}
	
	this.$img_circle=$($preferences["img_circle"]);
	this.$img_width=$preferences["img_width"];
	this.$img_height=$preferences["img_height"];
	Pennyutils.setCssStyle(this.$img_circle, "width:"+this.$img_width+"px;"+"height:"+this.$img_height+"px;border:0px solid #666;position:relative;");
	
	this.$img_circle_left=document.createElement("div");
	this.$img_circle_left.style.opacity=0.05;
	this.$img_circle_left.style.filter='alpha(opacity=5)';
	Pennyutils.setClassName(this.$img_circle_left, "img_slide_button img_slide_button_left");
	this.$img_circle.appendChild(this.$img_circle_left);
	Pennyutils.events.addEventHandler(this.$img_circle_left, "click", 
			function () {
				var $events = Pennyutils.events.getEvent();
				var $element = $events.target;
				$this.current_index--;
				$this.showItem();
//				$this.current_index=$this.current_index-1<0?$this.$img_length-1:$this.current_index-1;
//				Pennyutils.showPhoto($this.$image, $this.$imgs[$this.current_index].src, $this.$img_width, $this.$img_height);
//				$this.$img_circle_p.childNodes[0].parentNode.replaceChild(document.createTextNode($this.$imgs[$this.current_index].title), $this.$img_circle_p.childNodes[0]);
			});
	Pennyutils.events.addEventHandler(this.$img_circle_left, "mouseover", 
			function () {
//				Pennyutils.setOpacity($this.$img_circle_left, 50, 3);
			});
	Pennyutils.events.addEventHandler(this.$img_circle_left, "mouseout", 
			function () {
//				Pennyutils.setOpacity($this.$img_circle_left, 5, 3);
			});
	
	this.$img_circle_right=document.createElement("div");
	this.$img_circle_right.style.opacity=0.05;
	this.$img_circle_right.style.filter='alpha(opacity=5)';
	Pennyutils.setClassName(this.$img_circle_right, "img_slide_button img_slide_button_right");
	this.$img_circle.appendChild(this.$img_circle_right);
	Pennyutils.events.addEventHandler(this.$img_circle_right, "click", 
			function () {
				var $events = Pennyutils.events.getEvent();
				var $element = $events.target;
				$this.current_index++;
				$this.showItem();
//				$this.current_index=$this.current_index+1>=$this.$img_length?0:$this.current_index+1;
//				Pennyutils.showPhoto($this.$image, $this.$imgs[$this.current_index].src, $this.$img_width, $this.$img_height);
//				$this.$img_circle_p.childNodes[0].parentNode.replaceChild(document.createTextNode($this.$imgs[$this.current_index].title), $this.$img_circle_p.childNodes[0]);
			});
	Pennyutils.events.addEventHandler(this.$img_circle_right, "mouseover", 
			function () {
//				Pennyutils.setOpacity($this.$img_circle_right, 50, 3);
			});
	Pennyutils.events.addEventHandler(this.$img_circle_right, "mouseout", 
			function () {
//				Pennyutils.setOpacity($this.$img_circle_right, 5, 3);
			});
	
	this.$image=new Image();
	this.$image.style.opacity=1;
	this.$image.style.filter='alpha(opacity=100)';
	this.$img_circle_div=document.createElement("div");
	Pennyutils.setCssStyle(this.$img_circle_div, "position:absolute;left:0;top:0;z-index:25;width:auto;border:0px solid #600;");
	this.$img_circle_div.appendChild(this.$image);
	this.$img_circle.appendChild(this.$img_circle_div);
	
	this.$img_circle_text=document.createElement("div");
	Pennyutils.setCssStyle(this.$img_circle_text, "position:absolute;left:0;bottom:0;width:"+this.$img_width+"px;height:20px;background:#000;color:#fff;overflow:hidden;z-index:200;opacity:0.7;filter:alpha(opacity=70);");
	this.$img_circle_p=document.createElement("p");
	Pennyutils.setCssStyle(this.$img_circle_p, "text-align:left;margin:3px!important;padding:0px 8px!important;padding:4px 8px;font-size:14px;font-weight:bold;opacity:1;filter:alpha(opacity=100);");
	this.$img_circle_text.appendChild(this.$img_circle_p);
	this.$img_circle.appendChild(this.$img_circle_text);
	
	this.$img_circle_p.appendChild(document.createTextNode(""));
	
	this.showItem();
	this.$interval_id=null;
	this.setAutoPlay();
}
PennySlide.prototype.showItem=function () {
	this.current_index=this.current_index<0?this.$img_length-1:this.current_index>=this.$img_length?0:this.current_index;
	
	Pennyutils.showPhoto(this.$image, this.$imgs[this.current_index].src, this.$img_width, this.$img_height);
	
	this.$image.style.opacity=1;
	this.$image.style.filter='alpha(opacity=100)';
	
	this.$img_circle_p.childNodes[0].parentNode.replaceChild(document.createTextNode(this.$imgs[this.current_index].title), this.$img_circle_p.childNodes[0]);
}
PennySlide.prototype.setAutoPlay=function () {
	var $this=this;
	this.$interval_id=setInterval(
			function(){
				$this.current_index++;
				$this.showItem();
			}, 5000);
}
