﻿/*[APLICAÇÃO]
$(document).ready(function(){
	//Onde 'Box' eh o seletor jQuery do elemento que deseja estilizar
	$('Box').megacorner();
});
	
*/


//***********************************************************************
//EMPRESA			:StarCorp
//OBJETIVO			:Estilização de Box com cantos arredondados
//AUTOR				:Cristiano Souza Silva
//Data CRIAÇÃO		:
//MANUTENÇÃO	    :02/06/2011 08:42:54
//OBSERVAÇÃO		:Compatí­vel com jquery-1.4.3.min.js
//************************************************************************


(function ($) {
    var settings = {
        'classPrefix': 'rounded-corner',
        'topLeftSufix': 'top-left',
        'topRightSufix': 'top-right',
        'bottomLeftSufix': 'bottom-left',
        'bottomRightSufix': 'bottom-right'
    };

    var methods = {

        init: function (options) {
            if (options) {
                $.extend(settings, options);
            }

            $this = jQuery(this);

            jQuery("<div/>").addClass('rounded-corner-top-left').appendTo($this);
            jQuery("<div/>").addClass('rounded-corner-top-right').appendTo($this);
            jQuery("<div/>").addClass('rounded-corner-bottom-left').appendTo($this);
            jQuery("<div/>").addClass('rounded-corner-bottom-right').appendTo($this);

            return $this;
        },

        destroy: function () {

            return this.each(function () {

                $this = jQuery(this);

                jQuery("." + settings.classPrefix + "-" + settings.topLeftSufix, $this).remove();
                jQuery("." + settings.classPrefix + "-" + settings.topRightSufix, $this).remove();
                jQuery("." + settings.classPrefix + "-" + settings.bottomLeftSufix, $this).remove();
                jQuery("." + settings.classPrefix + "-" + settings.bottomRightSufix, $this).remove();
            });

        }
    };

    $.fn.megacorner = function (method) {

        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.megacorner');
        }
    };

})(jQuery);


$(document).ready(function(){
	/*-------------------------------------------------------------------------------------------
	Aplica o plugin a div com a classe BoxComBorda,BoxComFundo e CantoArredondado (Aceita qualquer selector jquery)
	--------------------------------------------------------------------------------------------*/
    $('.BoxComBorda,.BoxComFundo,.CantoArredondado').megacorner();
});
