﻿/*
==轮播{对象|对象属性}==
对象属性{宽度|高度|文字大小|自动切换时间}
*/
function dk_slideplayer(object,config){
	this.obj = object;
	this.config = config ? config : {time:"4000"};
	this.pause = false;
	var _this = this;
	this.count = jQuery(this.obj + " li").size();
	this.n =0;
	this.j =0;
	var t;
	this.factory = function(){
		jQuery(this.obj).prepend("<div></div>");
		jQuery(this.obj + " li").css({}).each(function(i){jQuery(_this.obj + " div").append("<a>"+(i+1)+"</a>")});


		//设置P的样式
		this.slide();
		t = setInterval(this.autoplay,this.config.time);
	}
	
	this.slide = function(){
		jQuery(this.obj + " div a").mouseover(function(){
			_this.j = jQuery(this).text() - 1;
			_this.n = _this.j;
			if (_this.j >= _this.count){return;}
			jQuery(_this.obj + " li").hide();
			jQuery(_this.obj + " li").eq(_this.j).fadeIn("slow");
		});
	}

	
	this.autoplay = function(){
		_this.n = _this.n >= (_this.count - 1) ? 0 : ++_this.n;
		jQuery(_this.obj + " div a").eq(_this.n).trigger('mouseover');
	}
	//设置数字样式

	this.factory();
}
