/**
 * @author YuYang
 */
 jQuery.fn.hoverShow = function(options){
	 //如果是多个元素，循环调用每一个
	 if(this.length > 1)
	 {
		 this.each(function(){
			$(this).hoverShow(options);
		 });
		 return this;
	 }

	if(!options.title)
		 options.title = '';
	if(!options.text)
		 options.text = '';
	if(!options.opacity)
		 options.opacity = 0.6;	//默认透明度，1为不透明

	var o = $(this);
	var panel;

	o.hover(function(){
		//Clear
		$('.hover-show-panel').fadeOut('fast', function(){ $(this).remove(); });

		//Create Div
		panel = $('<div class="hover-show-panel"><div class="title"></div><div class="text"></div><div class="arrow"></div></div>');
		panel.find('.title').html(options.title);
		panel.find('.text').html(options.text);
		panel.hide().appendTo('body');

		//Position (Left, Top)
		var l = o.offset().left - (panel.width() - o.width())/2;	
		//浮动层与页面左边距，还要减去10px的padding

		var t = o.offset().top - panel.height();		//上边距，减去20像素的padding
		
		panel.css({ left: l, top: t}).fadeTo('fast', options.opacity);
	}, function(){
		$('.hover-show-panel').fadeOut('fast', function(){
			$(this).remove();
		});
	});

	return this;
 };