$(document).ready(function() {
	
	KODEMALL.tooltip = function(opts){
		
		this.options = {
			'selector'		:	'#toolTip',
			'content'		:	'This is test tooltip',
			'show'			:	'mouseover',
			'hide'			:	'mouseout',
			'position_target':	'topMiddle',
			'position_tooltip':	'bottomMiddle',
			'width'			:	180,
			'padding'		:	5,
			'background'	:	'#f5f5f5 url("../../mall/image/btnGrad.png") repeat-x left bottom',
			'color'			:	'#',
			'textAlign'		:	'left',
			'border_width'	:	1,
			'border_radius'	:	2,
			'tip'			:	'bottomMiddle',
			'name'			:	'red',
			'is_multiple'	:	0
		}
		
		if(typeof(opts) != 'undefined'){
			$.extend(this.options,opts);
		}
		
		if(this.options.is_multiple){
			
			var o = this;
			
			$(this.options.selector).each(function(){
				
				$(this).qtip({
					   content: $(this).find(o.options.content).html(),
					   show: o.options.show,
					   hide: o.options.hide,
					   position: {
						      corner: {
						         target: o.options.position_target,
						         tooltip: o.options.position_tooltip
						      }
							},
					style: { 
							      width: o.options.width,
							      padding: o.options.padding,
							      background: o.options.background,
							      color: o.options.color,
							      textAlign: o.options.textAlign,
							      border: {
							         width: o.options.border_width,
							         radius: o.options.border_radius
							         //color: '#A2D959'
							      },
							      tip: { corner : o.options.tip },
							     // tip: 'bottomLeft',
							      name: o.options.name // Inherit the rest of the attributes from the preset red style
							   }
				
					})
				
			});
			
			
		}else{
			
			$(this.options.selector).qtip({
				   content: this.options.content,
				   show: this.options.show,
				   hide: this.options.hide,
				   position: {
					      corner: {
					         target: this.options.position_target,
					         tooltip: this.options.position_tooltip
					      }
						},
				style: { 
						      width: this.options.width,
						      padding: this.options.padding,
						      background: this.options.background,
						      color: this.options.color,
						      textAlign: this.options.textAlign,
						      border: {
						         width: this.options.border_width,
						         radius: this.options.border_radius
						         //color: '#A2D959'
						      },
						      tip: { corner : this.options.tip },
						     // tip: 'bottomLeft',
						      name: this.options.name // Inherit the rest of the attributes from the preset red style
						   }
			
				})
			
		}
		
	}
	
});


