var drawItalicQuotesSafari, drawQuotesItalicIE;
function drawItalicQuotes(o, color){
	$(o).each(function(){
		$("div.quote_left, div.quote_right", this).length || $(this).prepend('<div class="quote_left"></div>').append('<div class="quote_right"></div>');
	
		var quotes = {
			left: $("div.quote_left", this),
			right: $("div.quote_right", this)
		};
		
		(!jCommon.support.svg || $.browser.safari) || ($("div.quote_left, div.quote_right").svg({
				onLoad: function(svg){
					var lineSettings = {strokeWidth: 15, stroke:color};
					if ($(this).hasClass("quote_left")) {
						svg.line(null, 15, 0, 25, 0, lineSettings);
						svg.line(null, 5, '100%', 16, '100%', lineSettings);
						svg.line(null, 15, 0, 5, '101%', $.extend(lineSettings, {
							strokeWidth: lineSettings.strokeWidth / 2
						}));
					} else {
						svg.line(null, 19, 0, 30, 0, lineSettings);
						svg.line(null, 20, '100%', 10, '100%', lineSettings);
						svg.line(null, 30, 0, 20, '101%', $.extend(lineSettings, {
							strokeWidth: lineSettings.strokeWidth / 2
						}));
					}
				},
				settings: { height:'100%' }
			}));
		(!$.browser.safari) || ((drawItalicQuotesSafari = function(quotes, color){
			var p = $(quotes.left).parent(),
				height = parseInt(document.defaultView.getComputedStyle(p[0]).height) + parseInt(p.css("paddingTop")) + parseInt(p.css("paddingBottom"));
			
			$(quotes.left).add(quotes.right).html('');
			quotes.leftCanvas = $("<canvas></canvas>").attr("height", height).appendTo(quotes.left)[0];
			quotes.rightCanvas = $("<canvas></canvas>").attr("height", height).appendTo(quotes.right)[0];
			
			var context = quotes.leftCanvas.getContext('2d');
			//context.height = height;
			context.beginPath();
			context.moveTo(25,4);
			context.lineTo(15,4);
			context.lineTo(5,height-4);
			context.lineTo(16,height-4);
			context.lineWidth = 8;
			context.strokeStyle = color;
			context.stroke();
			
			context = quotes.rightCanvas.getContext('2d');
			
			context.height = height;
			context.beginPath();
			context.moveTo(19,4);
			context.lineTo(30,4);
			context.lineTo(20,height-4);
			context.lineTo(10,height-4);
			context.lineWidth = 8;
			context.strokeStyle = color;
			context.stroke();
			return true;
		})(quotes, color) && jCommon.measurer.bind(function(){
			drawItalicQuotesSafari(quotes, color);
		}));		

		!jCommon.support.vml || ((drawQuotesItalicIE = function(quotes, color){
			var p = $(quotes.left).parent(),
				height = p.height() + parseInt(p.css("paddingTop")) + parseInt(p.css("paddingBottom"));
			
			$(quotes.left).add(quotes.right).html('').height();
			var path = quotes.left[0].appendChild(document.createElement("v:shape"));
			path.style.position = 'static';
			path.style.display = 'block';
			path.style.width = 35;
			path.style.height = height;
			path.strokecolor = 'none';
			path.coordsize=35+","+height;
			path.coordorigin="0, 0";
			path.path = "m 30,0 l 15,0 5,"+height+" r 16,0 0,-7 -7,0 l 22,7 30,7 e x";
			path.fillcolor = color;

			path = quotes.right[0].appendChild(document.createElement("v:shape"));
			path.style.position = 'static';
			path.style.display = 'block';
			path.style.width = 35;
			path.style.height = height;
			path.strokecolor = 'none';
			path.coordsize=35+","+height;
			path.coordorigin="0, 0";
			path.path = "m 15,0 l 30,0 20,"+height+" r -15,0 0,-7 8,0 l 22,7 15,7 e x";
			path.fillcolor = color;
			
			return true;
		})(quotes, color) && jCommon.measurer.bind(function(){
			drawQuotesItalicIE(quotes, color);
		}));
		/*
		!jCommon.support.vml || (function(){
			$(quotes.left).add(quotes.right).html('');
			
			function addRect(parent, isTop, isLeft){
				rect = parent.appendChild(document.createElement("v:rect"));
				rect.style.position = 'absolute';
				rect.style.left = isLeft ? (isTop ? 15 : 6.5) : (isTop ? 13.5 : 5);
				rect.style[isTop ? 'top' : 'bottom'] = isTop ? -15 : -16;
				rect.style.width = 15;
				rect.style.height = 20;
				rect.strokecolor = 'none';
				rect.fillcolor = color;
				return rect;
			}
			
			function addLine(parent, isLeft){
				var shape = parent.appendChild(document.createElement("v:shape"));
				shape.style.position = 'absolute';
				shape.style.width = '30';
				shape.style.height = '100%';
				shape.strokecolor = 'none';
				shape.coordsize=35+","+'100%';
				shape.coordorigin="0, 0";
				shape.path = isLeft ? "m 15,0 l 5,100% 10,100% 20,0 e x" : "m 30,0 l 20,100% 15,100% 25,0 e x";
				shape.fillcolor = color;
				return shape;
			}
			
			addLine(quotes.left[0], true);
			addRect(quotes.left[0], true, true);
			addRect(quotes.left[0], false, true);
			
			addLine(quotes.right[0], false);
			addRect(quotes.right[0], true, false);
			addRect(quotes.right[0], false, false);
			
		}());*/
	});
}

//$(function(){
//	drawItalicQuotes($("blockquote, div.italicquote"), $('body').hasClass('dark') ? '#ffffff' : '#000000');
//});
