(function ($)
{    
	$.fn.opinion = function(method) 
	{
        
        var data = 
        {
            status : false
        }
        
        var settings = 
		{   
			google_conv: 'default',
			animation_on: {top:'0px'},
			animation_off: {top:'-190px'},
			animation_time: 500
		}
        
		var methods = {
			init : function(options)
			{   
				if (options){   $.extend(settings, options);}

				return this.each(function()
				{
					var id = this.id;
					if (this.id == ''){ return false;}
					
					var div = $('#'+id);
					
					div.click(methods.animate);
					$(document).click(
					    function(event){
					        if(event.target.id != id)
					        {
					            if (data.status){
					                div.click();
					            } 
					        }
					    });
				});
			},
			
			animate: function()
			{
			    if (data.status == false)
			    {
				    data.status = true;
    				
				    $(this).removeClass('unactive').addClass('active').animate(
				    settings.animation_on, 
				    settings.animation_time);
			    }
			    else
			    {
				    data.status = false;
				    $(this).animate(
					    settings.animation_off, 
					    settings.animation_time, 
					    function()
					    {
						    $(this).removeClass('active').addClass('unactive');
					    });
			    }
			    return false;
			}
			
		}


		if (methods[method]) 
		{
			return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
		} 
		else if ( typeof method === 'object' || ! method )
		{ 
			return methods.init.apply( this, arguments );
		} 
		else 
		{
			$.error( 'Method ' +  method + ' does not exist on jQuery.opinion' );
		} 
	}
})(jQuery);
