/**
 * jQuery.box - Box with feather and shadow using imgs
 * Written by Adis Mulahmetovic
 * Date: 2008/12/02
 *
 * @author Adis Mulahmetovic
 * @version 1.0.0
 *
 **/
(function($) {

  $.fn.make_fancy_box = function(options) {

    var opts = $.extend({}, $.fn.make_fancy_box.defaults, options);

    return this.each(function() {
		$this = $(this);
		width = $this.attr('class').indexOf('src') ? $this.attr('class').substring(($this.attr('class').indexOf("'")+1), $this.attr('class').lastIndexOf("'")) : opts.width;
	  if (width === '295') {
		$this.attr('style', 'position:relative; overflow:hidden; width:235px; background-image:url(gfx/box/mdl.png); background-repeat:repeat-y; padding:0 30px 0 30px;margin-bottom:15px;overflow:hidden;');
		$this.prepend('<img src="gfx/box/top.png" alt="" border="0" width="295" height="15" style="margin:0 0 5px -30px;" /><br />');        
		$this.append('<br /><img src="gfx/box/btm.png" alt="" border="0" width="295" height="15" style="margin:10px 0 -5px -30px;" />');
	  }
	  else if (width === '620') {
		$this.attr('style', 'position:relative; overflow:hidden; width:560px; background-image:url(gfx/box/mdl_620.png); background-repeat:repeat-y; padding:0 30px 0 30px;margin-bottom:15px;');
		$this.prepend('<img src="gfx/box/top_620.png" alt="" border="0" width="620" height="15" style="margin:0 0 5px -30px;" /><br />');        
		$this.append('<br /><img src="gfx/box/btm_620.png" alt="" border="0" width="620" height="15" style="margin:10px 0 -5px -30px;" />');
	  }
	  else if (width === '960') {
		$this.attr('style', 'position:relative; overflow:hidden; width:900px; background-image:url(gfx/box/mdl_960.png); background-repeat:repeat-y; padding:0 30px 0 30px;margin-bottom:15px;overflow:hidden;');
		$this.prepend('<img src="gfx/box/top_960.png" alt="" border="0" width="960" height="15" style="margin:0 0 5px -30px;" /><br />');        
		$this.append('<br /><img src="gfx/box/btm_960.png" alt="" border="0" width="960" height="15" style="margin:10px 0 -5px -30px;" />');
	  }
    });
  };
 
  $.fn.make_fancy_box.defaults = {
    width: '295'
  };

})(jQuery);