/*!
 * jQuery corner plugin: container outer glow using png files
 * Examples and documentation at: http://jquery.malsup.com/corner/
 * version 2.06 (16-FEB-2010)
 * Requires jQuery v1.3.2 or later
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Author: Janusz Kozlowski
 */

/**
 *  outerGlow() 
 */
$.fn.outerGlow = function(options) {
	if (options.replace || options.remove) {
		var element = $(this).attr('id');
		$('#' + element + ' .shadowLeft').remove();
		$('#' + element + ' .shadowLeftInside').remove();
		$('#' + element + ' .shadowTopLeft').remove();
		$('#' + element + ' .shadowTopLeftInner').remove();
		$('#' + element + ' .shadowTopLeftInnerInside').remove();
		$('#' + element + ' .shadowTop').remove();
		$('#' + element + ' .shadowTopInner').remove();
		$('#' + element + ' .shadowTopRight').remove();
		$('#' + element + ' .shadowTopRightInner').remove();
		$('#' + element + ' .shadowTopRightInnerInside').remove();
		$('#' + element + ' .shadowRight').remove();
		$('#' + element + ' .shadowRightInside').remove();
		$('#' + element + ' .shadowBottomRight').remove();
		$('#' + element + ' .shadowBottomRightInner').remove();
		$('#' + element + ' .shadowBottomRightInnerInside').remove();
		$('#' + element + ' .shadowBottom').remove();
		$('#' + element + ' .shadowBottomInner').remove();
		$('#' + element + ' .shadowBottomLeft').remove();
		$('#' + element + ' .shadowBottomLeftInner').remove();
		$('#' + element + ' .shadowBottomLeftInnerInside').remove();
		if (options.remove) {
			return;
		}
	}
	var postfixTop = '';
	if (!options.top) {
		postfixTop = 'Inner';
	}
	var postfixBottom = '';
	if (!options.bottom) {
		postfixBottom = 'Inner';
	}
	var postfixLeft = '';
	if (!options.left) {
		postfixLeft = 'Inside';
	}
	var postfixRight = '';
	if (!options.right) {
		postfixRight = 'Inside';
	}
	
	var incent = false;
	var incentClass = '';
	if (options.incent) {
		incent = true;
		incentClass = 'Incent';
	}
	
	$(this).append('<div class="shadowLeft' + postfixLeft + incentClass + '"></div>');
	$(this).append('<div class="shadowRight' + postfixRight + incentClass + '"></div>');
	
	if (!incent) {
		$(this).append('<div class="shadowTop' + postfixTop + incentClass + '"></div>');
		$(this).append('<div class="shadowTopLeft' + postfixTop + postfixLeft + '"></div>');
		$(this).append('<div class="shadowTopRight' + postfixTop + postfixRight + '"></div>');
		$(this).append('<div class="shadowBottom' + postfixBottom + incentClass + '"></div>');
		$(this).append('<div class="shadowBottomRight' + postfixBottom + postfixRight + '"></div>');
		$(this).append('<div class="shadowBottomLeft' + postfixBottom + postfixLeft + '"></div>');
	}
};
