/****
 * obj可提供参数
 * 	type：提示类型 目前只有success、wrong两个可供选择
 *  text：提示文本
 *  spead：提示关闭速度，单位秒，默认3，设置为0则不关闭提示
 * 	onClose：关闭后的回调函数
 * 调用方法:
 * $().Message(obj)
 * 
 * ****/
(function($,func,name){
		$.fn[name] = func
		// $.extend({[name]:func})
	})(jQuery,function(obj){
		this.extend({
				type:'success',
				text:'这是一个弹窗',
				spead:2
		})
		this.extend(obj);
		this.index = $('.cny-message .cny-contentbg').length
		// console.log(this.index)
		var that = this
		if(this.spead !== 0){
			this.timer = setTimeout(function () {
				var str = 'cnyIndex'+that.index
				$('.'+str).remove()
				that.onClose && that.onClose()
			}, +this.spead * 1000)
		}
		if($('.cny-message').length == 0){
			$('body').append('<div class="cny-message"></div>')
		}

		$('.cny-message').append('<div class="cny-contentbg">' +
			'<div class="cny-content cnyIndex'+this.index+'">' +
			'<div class="icon">' +
			'<img src="../../templets/style3/images_new/icon-' + this.type + '.png" alt="">' +
			'</div>' +
			'<div class="text">' +
			this.text +
			'</div>' +
			'</div>' +
			'</div>')
	},'Message')