/*---------------------------------
 **      Made by Renegade        **
 **  http://www.mivlox.com       **
 **   @ webdevrefinery.com       **
 **   				        **
 **   Compressed with YUI comp   **
 **   Free to modify, anything   **
 **   Uncompressed version @     **
 ** http://www.mivlox.com/css3me **
 ---------------------------------*/
 
(function($){
	$.fn.css3Me =  function(options) {
		var	defaults = {
				/* Theme */
				theme: null,
				/*None CSS3 */
				backupBackgroundColor: "#5b5b5b",
				textColor: "#EFEFEF",
				font: "Helvetica, Verdana",
				fontSize: 18,
				border: true,
				borderStyle: "#2F2F2F",
				padding: 6,
				/*Background Gradient */
				gradientTop: "#1F1F1F",
				gradientBottom: "#3F3F3F",
				/*Rounded*/
				rounded: true,
				roundedSize: 8,
				/*Box Shadows*/
				shadowInset: true,
				shadowInsetColor: "#fff",
				dropShadow: false,
				/*Text Shadow*/
				textShadow: true,
				textShadowColor: "#7F7F7F",
				/*Features*/
				button: true
			}
			
		/* @Themes */
		var redTheme = {
				backupBackgroundColor: "#CF0000",
				textColor: "#EFEFEF",
				font: "Helvetica, Verdana",
				fontSize: 18,
				gradientTop: "#FF0000",
				gradientBottom: "#CF0000",
				rounded: true,
				roundedSize: 8,
				shadowInset: true,
				shadowInsetColor: "#fff",
				border: true,
				borderStyle: "#AF0000",
				padding: 6,
				textShadow: true,
				textShadowColor: "#8F0000",
				button: true
			}
			
		var greenTheme = {
				themeColor: null,
				backupBackgroundColor: "#5b5b5b",
				textColor: "#005F28",
				font: "Helvetica, Verdana",
				fontSize: 18,
				gradientTop: "#00FF22",
				gradientBottom: "#00CF1C",
				rounded: true,
				roundedSize: 8,
				shadowInset: true,
				shadowInsetColor: "#fff",
				border: true,
				borderStyle: "#00AF18",
				padding: 6,
				textShadow: false,
				textShadowColor: "#7F7F7F",
				button: true
			}
			
		var blueTheme = {
				themeColor: null,
				backupBackgroundColor: "#0085CF",
				textColor: "#EFEFEF",
				font: "Helvetica, Verdana",
				fontSize: 18,
				gradientTop: "#00A4FF",
				gradientBottom: "#0085CF",
				rounded: true,
				roundedSize: 8,
				shadowInset: true,
				shadowInsetColor: "#fff",
				border: true,
				borderStyle: "#00669F",
				padding: 6,
				textShadow: true,
				textShadowColor: "#7F7F7F",
				button: true
				
			}
			
		var whiteTheme = {
				themeColor: null,
				backupBackgroundColor: "#0085CF",
				textColor: "#5F5F5F",
				font: "Helvetica, Verdana",
				fontSize: 18,
				gradientTop: "#fff",
				gradientBottom: "#CFCFCF",
				rounded: true,
				roundedSize: 8,
				shadowInset: false,
				shadowInsetColor: "#fff",
				dropShadow: true,
				border: true,
				borderStyle: "#9F9F9F",
				padding: 6,
				textShadow: true,
				textShadowColor: "#7F7F7F",
				button: true
				
			}
		/* @end */
		
		var settings = $.extend({}, defaults, options);
		switch(settings.theme) {
			case null:
				break;
			
			case 'red':
				var settings = $.extend({}, redTheme, options);
				break;
				
			case 'blue':
				var settings = $.extend({}, blueTheme, options);
				break;
				
			case 'green':
				var settings = $.extend({}, greenTheme, options);
				break;
				
			case 'white':
				var settings = $.extend({}, whiteTheme, options);
				break;
				}
				
		this.each(function() {
			$(this).css({
				"background" : settings.backupBackgroundColor,
				"padding" : settings.padding + "px",
				"color" : settings.textColor,
				"font-family" : settings.font,
				"font-size" : settings.fontSize,
				"text-decoration" : "none"
			});
			if($.browser.webkit) {
				$(this).css({
				"background" : "-webkit-gradient(linear, 0 0, 0 100%, from(" + settings.gradientTop + "), to(" + settings.gradientBottom + "))"
				});
			}
			if($.browser.mozilla) {
				$(this).css({
				"background" : "-moz-linear-gradient(center bottom, " + settings.gradientTop + " 0%, " + settings.gradientBottom + " 100%)"
				});
			}
				
			if(settings.rounded === true) {
				$(this).css({
					"-moz-border-radius" : settings.roundedSize + "px",
					"-webkit-border-radius" : settings.roundedSize + "px",
					"border-radius" : settings.roundedSize + "px"
				});
			}
			
			if(settings.border === true) {
				$(this).css({
					"border" : "1px solid " + settings.borderStyle
				});
			} 
				
			var shadowSettings, addShadow;
			
			if(settings.shadowInset === true && settings.dropShadow === true) {
				alert("Sorry, You cannot have inset shadow and drop shadow simultaneous");
				addShadow = false;
			}
				
			if(settings.shadowInset === true && settings.dropShadow === false) {
				shadowSettings = "inset 0 0 1px " + settings.shadowInsetColor;
				addShadow = true;
			}
				
			if(settings.shadowInset === false && settings.dropShadow === true) {
				shadowSettings = "0px 1px 2px #000";
				addShadow = true;
			}
			
			if(settings.shadowInset === false && settings.dropShadow === false) {
				addShadow = false;
				}
				
			if(addShadow === true) {
				$(this).css({
					"-moz-box-shadow" : shadowSettings,
					"-webkit-box-shadow" : shadowSettings,
					"box-shadow" : shadowSettings
				});
			}
			
			if(settings.textShadow === true) {
				$(this).css({
					"text-shadow" : "1px 0px 0px "  + settings.textShadowColor
					});
				}
				
			if(settings.button === true) {
				$(this).css({
					"cursor" : "pointer"
					});
				}
			});
		return this;
		}			
})(jQuery);