/* JQuery Curvy Corners by Mike Jolley                         *
*	 http://blue-anvil.com                                     *
*  ------------                                                *
*  Version 1.81 Origionaly by: Cameron Cooke and Tim Hutchison.*
*  Website: http://www.curvycorners.net                        *
*  This library is free software; you can redistribute         *
*  it and/or modify it under the terms of the GNU              *
*  Lesser General Public License as published by the           *
*  Free Software Foundation; either version 2.1 of the         *
*  License, or (at your option) any later version.             */

(function ($) {
$.fn.corner = function (options) {
function BlendColour(Col1, Col2, Col1Fraction) { var red1 = parseInt(Col1.substr(1, 2), 16); var green1 = parseInt(Col1.substr(3, 2), 16); var blue1 = parseInt(Col1.substr(5, 2), 16); var red2 = parseInt(Col2.substr(1, 2), 16); var green2 = parseInt(Col2.substr(3, 2), 16); var blue2 = parseInt(Col2.substr(5, 2), 16); if (Col1Fraction > 1 || Col1Fraction < 0) Col1Fraction = 1; var endRed = Math.round((red1 * Col1Fraction) + (red2 * (1 - Col1Fraction))); if (endRed > 255) endRed = 255; if (endRed < 0) endRed = 0; var endGreen = Math.round((green1 * Col1Fraction) + (green2 * (1 - Col1Fraction))); if (endGreen > 255) endGreen = 255; if (endGreen < 0) endGreen = 0; var endBlue = Math.round((blue1 * Col1Fraction) + (blue2 * (1 - Col1Fraction))); if (endBlue > 255) endBlue = 255; if (endBlue < 0) endBlue = 0; return "#" + IntToHex(endRed) + IntToHex(endGreen) + IntToHex(endBlue); } function IntToHex(strNum) { base = strNum / 16; rem = strNum % 16; base = base - (rem / 16); baseS = MakeHex(base); remS = MakeHex(rem); return baseS + '' + remS; } function MakeHex(x) { if ((x >= 0) && (x <= 9)) { return x; } else { switch (x) { case 10: return "A"; case 11: return "B"; case 12: return "C"; case 13: return "D"; case 14: return "E"; case 15: return "F"; }; return "F"; }; } function pixelFraction(x, y, r) { var pixelfraction = 0; var xvalues = new Array(1); var yvalues = new Array(1); var point = 0; var whatsides = ""; var intersect = Math.sqrt((Math.pow(r, 2) - Math.pow(x, 2))); if ((intersect >= y) && (intersect < (y + 1))) { whatsides = "Left"; xvalues[point] = 0; yvalues[point] = intersect - y; point = point + 1; }; var intersect = Math.sqrt((Math.pow(r, 2) - Math.pow(y + 1, 2))); if ((intersect >= x) && (intersect < (x + 1))) { whatsides = whatsides + "Top"; xvalues[point] = intersect - x; yvalues[point] = 1; point = point + 1; }; var intersect = Math.sqrt((Math.pow(r, 2) - Math.pow(x + 1, 2))); if ((intersect >= y) && (intersect < (y + 1))) { whatsides = whatsides + "Right"; xvalues[point] = 1; yvalues[point] = intersect - y; point = point + 1; }; var intersect = Math.sqrt((Math.pow(r, 2) - Math.pow(y, 2))); if ((intersect >= x) && (intersect < (x + 1))) { whatsides = whatsides + "Bottom"; xvalues[point] = intersect - x; yvalues[point] = 0; }; switch (whatsides) { case "LeftRight": pixelfraction = Math.min(yvalues[0], yvalues[1]) + ((Math.max(yvalues[0], yvalues[1]) - Math.min(yvalues[0], yvalues[1])) / 2); break; case "TopRight": pixelfraction = 1 - (((1 - xvalues[0]) * (1 - yvalues[1])) / 2); break; case "TopBottom": pixelfraction = Math.min(xvalues[0], xvalues[1]) + ((Math.max(xvalues[0], xvalues[1]) - Math.min(xvalues[0], xvalues[1])) / 2); break; case "LeftBottom": pixelfraction = (yvalues[0] * xvalues[1]) / 2; break; default: pixelfraction = 1; }; return pixelfraction; } function rgb2Hex(rgbColour) { try { var rgbArray = rgb2Array(rgbColour); var red = parseInt(rgbArray[0]); var green = parseInt(rgbArray[1]); var blue = parseInt(rgbArray[2]); var hexColour = "#" + IntToHex(red) + IntToHex(green) + IntToHex(blue); } catch (e) { alert("There was an error converting the RGB value to Hexadecimal in function rgb2Hex"); }; return hexColour; } function rgb2Array(rgbColour) { var rgbValues = rgbColour.substring(4, rgbColour.indexOf(")")); var rgbArray = rgbValues.split(", "); return rgbArray; } function format_colour(colour) {
var returnColour = "transparent"; if (colour != "" && colour != "transparent") {
if (colour.substr(0, 3) == "rgb") { returnColour = rgb2Hex(colour); } else if (colour.length == 4) { returnColour = "#" + colour.substring(1, 2) + colour.substring(1, 2) + colour.substring(2, 3) + colour.substring(2, 3) + colour.substring(3, 4) + colour.substring(3, 4); } else
{ returnColour = colour; };
}; return returnColour;
}; function strip_px(value) { return parseInt(((value != "auto" && value.indexOf("%") == -1 && value != "" && value.indexOf("px") !== -1) ? value.slice(0, value.indexOf("px")) : 0)) } function drawPixel(box, intx, inty, colour, transAmount, height, newCorner, image, bgImage, cornerRadius, isBorder, borderWidth, boxWidth, settings) {
var $$ = $(box); var pixel = document.createElement("div"); $(pixel).css({ height: height, width: "1px", position: "absolute", "font-size": "1px", overflow: "hidden" }); var topMaxRadius = Math.max(settings.tl ? settings.tl.radius : 0, settings.tr ? settings.tr.radius : 0); if (image == -1 && bgImage != "") {
if (topMaxRadius > 0) $(pixel).css("background-position", "-" + ((boxWidth - cornerRadius - borderWidth) + intx) + "px -" + (($$.height() + topMaxRadius - borderWidth) - inty) + "px"); else
$(pixel).css("background-position", "-" + ((boxWidth - cornerRadius - borderWidth) + intx) + "px -" + (($$.height()) - inty) + "px"); $(pixel).css({ "background-image": bgImage, "background-repeat": $$.css("background-repeat"), "background-color": colour });
} else
{ if (!isBorder) $(pixel).css("background-color", colour).addClass('hasBackgroundColor'); else $(pixel).css("background-color", colour); }; if (transAmount != 100) setOpacity(pixel, transAmount); $(pixel).css({ top: inty + "px", left: intx + "px" }); return pixel;
}; function setOpacity(obj, opacity) { opacity = (opacity == 100) ? 99.999 : opacity; if ($.browser.safari && obj.tagName != "IFRAME") { var rgbArray = rgb2Array(obj.style.backgroundColor); var red = parseInt(rgbArray[0]); var green = parseInt(rgbArray[1]); var blue = parseInt(rgbArray[2]); obj.style.backgroundColor = "rgba(" + red + ", " + green + ", " + blue + ", " + opacity / 100 + ")"; } else if (typeof (obj.style.opacity) != "undefined") { obj.style.opacity = opacity / 100; } else if (typeof (obj.style.MozOpacity) != "undefined") { obj.style.MozOpacity = opacity / 100; } else if (typeof (obj.style.filter) != "undefined") { obj.style.filter = "alpha(opacity:" + opacity + ")"; } else if (typeof (obj.style.KHTMLOpacity) != "undefined") { obj.style.KHTMLOpacity = opacity / 100; } } function applyCorners(box, settings) {
var $$ = $(box); var thebgImage = $$.css("backgroundImage"); var topContainer = null; var bottomContainer = null; var masterCorners = new Array(); var contentDIV = null; var boxHeight = strip_px($$.css("height")) ? strip_px($$.css("height")) : box.scrollHeight; var boxWidth = strip_px($$.css("width")) ? strip_px($$.css("width")) : box.scrollWidth; var borderWidth = strip_px($$.css("borderTopWidth")) ? strip_px($$.css("borderTopWidth")) : 0; var boxPaddingTop = strip_px($$.css("paddingTop")); var boxPaddingBottom = strip_px($$.css("paddingBottom")); var boxPaddingLeft = strip_px($$.css("paddingLeft")); var boxPaddingRight = strip_px($$.css("paddingRight")); var boxColour = format_colour($$.css("backgroundColor")); var bgImage = (thebgImage != "none" && thebgImage != "initial") ? thebgImage : ""; var borderColour = format_colour($$.css("borderTopColor")); var borderString = borderWidth + "px" + " solid " + borderColour; var topMaxRadius = Math.max(settings.tl ? settings.tl.radius : 0, settings.tr ? settings.tr.radius : 0); var botMaxRadius = Math.max(settings.bl ? settings.bl.radius : 0, settings.br ? settings.br.radius : 0); $$.addClass('hasCorners').css({ "padding": "0", "borderColor": box.style.borderColour, 'overflow': 'visible' }); if (box.style.position != "absolute") $$.css("position", "relative"); if (($.browser.msie)) { if ($.browser.version == 6 && box.style.width == "auto" && box.style.height == "auto") $$.css("width", "100%"); $$.css("zoom", "1"); $($$ + " *").css("zoom", "normal"); } for (var t = 0; t < 2; t++) { switch (t) { case 0: if (settings.tl || settings.tr) { var newMainContainer = document.createElement("div"); topContainer = box.appendChild(newMainContainer); $(topContainer).css({ width: "100%", "font-size": "1px", overflow: "hidden", position: "absolute", "padding-left": borderWidth, "padding-right": borderWidth, height: topMaxRadius + "px", top: 0 - topMaxRadius + "px", left: 0 - borderWidth + "px" }).addClass('topContainer'); }; break; case 1: if (settings.bl || settings.br) { var newMainContainer = document.createElement("div"); bottomContainer = box.appendChild(newMainContainer); $(bottomContainer).css({ width: "100%", "font-size": "1px", overflow: "hidden", position: "absolute", "padding-left": borderWidth, "padding-right": borderWidth, height: botMaxRadius, bottom: 0 - botMaxRadius + "px", left: 0 - borderWidth + "px" }).addClass('bottomContainer'); }; break; }; }; if (settings.autoPad == true) { var contentContainer = document.createElement("div"); var contentContainer2 = document.createElement("div"); var clearDiv = document.createElement("div"); $(contentContainer2).css({ margin: "0", "padding-bottom": boxPaddingBottom, "padding-top": boxPaddingTop, "padding-left": boxPaddingLeft, "padding-right": boxPaddingRight, 'overflow': 'visible' }).addClass('hasBackgroundColor content_container'); $(contentContainer).css({ position: "relative", 'float': "left", width: "100%", "margin-top": "-" + (topMaxRadius - borderWidth) + "px", "margin-bottom": "-" + (botMaxRadius - borderWidth) + "px" }).addClass = "autoPadDiv"; $(clearDiv).css("clear", "both"); contentContainer2.appendChild(contentContainer); contentContainer2.appendChild(clearDiv); $$.wrapInner(contentContainer2); }; if (topContainer) $$.css("border-top", 0); if (bottomContainer) $$.css("border-bottom", 0); var corners = ["tr", "tl", "br", "bl"]; for (var i in corners) {
if (i > -1 < 4) {
var cc = corners[i]; if (!settings[cc]) {
if (((cc == "tr" || cc == "tl") && topContainer != null) || ((cc == "br" || cc == "bl") && bottomContainer != null)) {
var newCorner = document.createElement("div"); $(newCorner).css({ position: "relative", "font-size": "1px", overflow: "hidden" }); if (bgImage == "") $(newCorner).css("background-color", boxColour); else
$(newCorner).css("background-image", bgImage).css("background-color", boxColour); ; switch (cc) {
case "tl": $(newCorner).css({ height: topMaxRadius - borderWidth, "margin-right": settings.tr.radius - (borderWidth * 2), "border-left": borderString, "border-top": borderString, left: -borderWidth + "px", "background-repeat": $$.css("background-repeat"), "background-position": borderWidth + "px 0px" }); break; case "tr": $(newCorner).css({ height: topMaxRadius - borderWidth, "margin-left": settings.tl.radius - (borderWidth * 2), "border-right": borderString, "border-top": borderString, left: borderWidth + "px", "background-repeat": $$.css("background-repeat"), "background-position": "-" + (topMaxRadius + borderWidth) + "px 0px" }); break; case "bl": if (topMaxRadius > 0) $(newCorner).css({ height: botMaxRadius - borderWidth, "margin-right": settings.br.radius - (borderWidth * 2), "border-left": borderString, "border-bottom": borderString, left: -borderWidth + "px", "background-repeat": $$.css("background-repeat"), "background-position": "0px -" + ($$.height() + topMaxRadius - borderWidth + 1) + "px" }); else
$(newCorner).css({ height: botMaxRadius - borderWidth, "margin-right": settings.br.radius - (borderWidth * 2), "border-left": borderString, "border-bottom": borderString, left: -borderWidth + "px", "background-repeat": $$.css("background-repeat"), "background-position": "0px -" + ($$.height()) + "px" }); break; case "br": if (topMaxRadius > 0) $(newCorner).css({ height: botMaxRadius - borderWidth, "margin-left": settings.bl.radius - (borderWidth * 2), "border-right": borderString, "border-bottom": borderString, left: borderWidth + "px", "background-repeat": $$.css("background-repeat"), "background-position": "-" + settings.bl.radius + borderWidth + "px -" + ($$.height() + topMaxRadius - borderWidth + 1) + "px" }); else
$(newCorner).css({ height: botMaxRadius - borderWidth, "margin-left": settings.bl.radius - (borderWidth * 2), "border-right": borderString, "border-bottom": borderString, left: borderWidth + "px", "background-repeat": $$.css("background-repeat"), "background-position": "-" + settings.bl.radius + borderWidth + "px -" + ($$.height()) + "px" }); break;
};
};
} else {
if (masterCorners[settings[cc].radius]) { var newCorner = masterCorners[settings[cc].radius].cloneNode(true); } else {
var newCorner = document.createElement("DIV"); $(newCorner).css({ height: settings[cc].radius, width: settings[cc].radius, position: "absolute", "font-size": "1px", overflow: "hidden" }); var borderRadius = parseInt(settings[cc].radius - borderWidth); for (var intx = 0, j = settings[cc].radius; intx < j; intx++) {
if ((intx + 1) >= borderRadius) var y1 = -1; else
var y1 = (Math.floor(Math.sqrt(Math.pow(borderRadius, 2) - Math.pow((intx + 1), 2))) - 1); if (borderRadius != j) {
if ((intx) >= borderRadius) var y2 = -1; else
var y2 = Math.ceil(Math.sqrt(Math.pow(borderRadius, 2) - Math.pow(intx, 2))); if ((intx + 1) >= j) var y3 = -1; else
var y3 = (Math.floor(Math.sqrt(Math.pow(j, 2) - Math.pow((intx + 1), 2))) - 1);
}; if ((intx) >= j) var y4 = -1; else
var y4 = Math.ceil(Math.sqrt(Math.pow(j, 2) - Math.pow(intx, 2))); if (y1 > -1) newCorner.appendChild(drawPixel(box, intx, 0, boxColour, 100, (y1 + 1), newCorner, -1, bgImage, settings[cc].radius, 0, borderWidth, boxWidth, settings)); if (borderRadius != j) { for (var inty = (y1 + 1); inty < y2; inty++) { if (settings.antiAlias) { if (bgImage != "") { var borderFract = (pixelFraction(intx, inty, borderRadius) * 100); if (borderFract < 30) { newCorner.appendChild(drawPixel(box, intx, inty, borderColour, 100, 1, newCorner, 0, bgImage, settings[cc].radius, 1, borderWidth, boxWidth, settings)); } else { newCorner.appendChild(drawPixel(box, intx, inty, borderColour, 100, 1, newCorner, -1, bgImage, settings[cc].radius, 1, borderWidth, boxWidth, settings)); }; } else { var pixelcolour = BlendColour(boxColour, borderColour, pixelFraction(intx, inty, borderRadius)); newCorner.appendChild(drawPixel(box, intx, inty, pixelcolour, 100, 1, newCorner, 0, bgImage, settings[cc].radius, cc, 1, borderWidth, boxWidth, settings)); }; }; }; if (settings.antiAlias) { if (y3 >= y2) { if (y2 == -1) y2 = 0; newCorner.appendChild(drawPixel(box, intx, y2, borderColour, 100, (y3 - y2 + 1), newCorner, 0, bgImage, 0, 1, borderWidth, boxWidth, settings)); } } else { if (y3 >= y1) { newCorner.appendChild(drawPixel(box, intx, (y1 + 1), borderColour, 100, (y3 - y1), newCorner, 0, bgImage, 0, 1, borderWidth, boxWidth, settings)); } }; var outsideColour = borderColour; } else { var outsideColour = boxColour; var y3 = y1; }; if (settings.antiAlias) { for (var inty = (y3 + 1); inty < y4; inty++) { newCorner.appendChild(drawPixel(box, intx, inty, outsideColour, (pixelFraction(intx, inty, j) * 100), 1, newCorner, ((borderWidth > 0) ? 0 : -1), bgImage, settings[cc].radius, 1, borderWidth, boxWidth, settings)); }; };
}; masterCorners[settings[cc].radius] = newCorner.cloneNode(true);
}; if (cc != "br") {
for (var t = 0, k = newCorner.childNodes.length; t < k; t++) {
var pixelBar = newCorner.childNodes[t]; var pixelBarTop = strip_px($(pixelBar).css("top")); var pixelBarLeft = strip_px($(pixelBar).css("left")); var pixelBarHeight = strip_px($(pixelBar).css("height")); if (cc == "tl" || cc == "bl") { $(pixelBar).css("left", settings[cc].radius - pixelBarLeft - 1 + "px"); }; if (cc == "tr" || cc == "tl") { $(pixelBar).css("top", settings[cc].radius - pixelBarHeight - pixelBarTop + "px"); }; switch (cc) {
case "tr": $(pixelBar).css("background-position", "-" + Math.abs((boxWidth - settings[cc].radius + borderWidth) + pixelBarLeft) + "px -" + Math.abs(settings[cc].radius - pixelBarHeight - pixelBarTop - borderWidth) + "px"); break; case "tl": $(pixelBar).css("background-position", "-" + Math.abs((settings[cc].radius - pixelBarLeft - 1) - borderWidth) + "px -" + Math.abs(settings[cc].radius - pixelBarHeight - pixelBarTop - borderWidth) + "px"); break; case "bl": if (topMaxRadius > 0) $(pixelBar).css("background-position", "-" + Math.abs((settings[cc].radius - pixelBarLeft - 1) - borderWidth) + "px -" + Math.abs(($$.height() + topMaxRadius - borderWidth + 1)) + "px"); else
$(pixelBar).css("background-position", "-" + Math.abs((settings[cc].radius - pixelBarLeft - 1) - borderWidth) + "px -" + Math.abs(($$.height())) + "px"); break;
};
};
};
}; if (newCorner) { switch (cc) { case "tl": if ($(newCorner).css("position") == "absolute") $(newCorner).css("top", "0"); if ($(newCorner).css("position") == "absolute") $(newCorner).css("left", "0"); if (topContainer) topContainer.appendChild(newCorner); break; case "tr": if ($(newCorner).css("position") == "absolute") $(newCorner).css("top", "0"); if ($(newCorner).css("position") == "absolute") $(newCorner).css("right", "0"); if (topContainer) topContainer.appendChild(newCorner); break; case "bl": if ($(newCorner).css("position") == "absolute") $(newCorner).css("bottom", "0"); if (newCorner.style.position == "absolute") $(newCorner).css("left", "0"); if (bottomContainer) bottomContainer.appendChild(newCorner); break; case "br": if ($(newCorner).css("position") == "absolute") $(newCorner).css("bottom", "0"); if ($(newCorner).css("position") == "absolute") $(newCorner).css("right", "0"); if (bottomContainer) bottomContainer.appendChild(newCorner); break; }; };
};
}; var radiusDiff = new Array(); radiusDiff["t"] = Math.abs(settings.tl.radius - settings.tr.radius); radiusDiff["b"] = Math.abs(settings.bl.radius - settings.br.radius); for (z in radiusDiff) {
if (z == "t" || z == "b") {
if (radiusDiff[z]) { var smallerCornerType = ((settings[z + "l"].radius < settings[z + "r"].radius) ? z + "l" : z + "r"); var newFiller = document.createElement("div"); $(newFiller).css({ height: radiusDiff[z], width: settings[smallerCornerType].radius + "px", position: "absolute", "font-size": "1px", overflow: "hidden", "background-color": boxColour, "background-image": bgImage }); switch (smallerCornerType) { case "tl": $(newFiller).css({ "bottom": "0", "left": "0", "border-left": borderString, "background-position": "0px -" + (settings[smallerCornerType].radius - borderWidth) }); topContainer.appendChild(newFiller); break; case "tr": $(newFiller).css({ "bottom": "0", "right": "0", "border-right": borderString, "background-position": "0px -" + (settings[smallerCornerType].radius - borderWidth) + "px" }); topContainer.appendChild(newFiller); break; case "bl": $(newFiller).css({ "top": "0", "left": "0", "border-left": borderString, "background-position": "0px -" + ($$.height() + settings[smallerCornerType].radius - borderWidth) }); bottomContainer.appendChild(newFiller); break; case "br": $(newFiller).css({ "top": "0", "right": "0", "border-right": borderString, "background-position": "0px -" + ($$.height() + settings[smallerCornerType].radius - borderWidth) }); bottomContainer.appendChild(newFiller); break; } }; var newFillerBar = document.createElement("div"); $(newFillerBar).css({ position: "relative", "font-size": "1px", overflow: "hidden", "background-color": boxColour, "background-image": bgImage, "background-repeat": $$.css("background-repeat") }); switch (z) {
case "t": if (topContainer) { if (settings.tl.radius && settings.tr.radius) { $(newFillerBar).css({ height: topMaxRadius - borderWidth + "px", "margin-left": settings.tl.radius - borderWidth + "px", "margin-right": settings.tr.radius - borderWidth + "px", "border-top": borderString }).addClass('hasBackgroundColor'); if (bgImage != "") $(newFillerBar).css("background-position", "-" + (topMaxRadius + borderWidth) + "px 0px"); topContainer.appendChild(newFillerBar); }; $$.css("background-position", "0px -" + (topMaxRadius - borderWidth + 1) + "px"); }; break; case "b": if (bottomContainer) {
if (settings.bl.radius && settings.br.radius) {
$(newFillerBar).css({ height: botMaxRadius - borderWidth + "px", "margin-left": settings.bl.radius - borderWidth + "px", "margin-right": settings.br.radius - borderWidth + "px", "border-bottom": borderString }); if (bgImage != "" && topMaxRadius > 0) $(newFillerBar).css("background-position", "-" + (settings.bl.radius - borderWidth) + "px -" + ($$.height() + topMaxRadius - borderWidth + 1) + "px"); else
$(newFillerBar).css("background-position", "-" + (settings.bl.radius - borderWidth) + "px -" + ($$.height()) + "px").addClass('hasBackgroundColor'); bottomContainer.appendChild(newFillerBar);
};
}; break;
};
};
}; $$.prepend(topContainer); $$.prepend(bottomContainer);
} var settings = { tl: { radius: 8 }, tr: { radius: 8 }, bl: { radius: 8 }, br: { radius: 8 }, antiAlias: true, autoPad: true, validTags: ["div"] }; if (options && typeof (options) != 'string') $.extend(settings, options); return this.each(function () { if (!$(this).is('.hasCorners')) { applyCorners(this, settings); } });
};
})(jQuery);


///*
// * jQuery Corners 0.3
// * Copyright (c) 2008 David Turnbull, Steven Wittens
// * Dual licensed under the MIT (MIT-LICENSE.txt)
// * and GPL (GPL-LICENSE.txt) licenses.
// */
//jQuery.fn.corners=function(C){var N="rounded_by_jQuery_corners";var V=B(C);var F=false;try{F=(document.body.style.WebkitBorderRadius!==undefined);var Y=navigator.userAgent.indexOf("Chrome");if(Y>=0){F=false}}catch(E){}var W=false;try{W=(document.body.style.MozBorderRadius!==undefined);var Y=navigator.userAgent.indexOf("Firefox");if(Y>=0&&parseInt(navigator.userAgent.substring(Y+8))<3){W=false}}catch(E){}return this.each(function(b,h){$e=jQuery(h);if($e.hasClass(N)){return }$e.addClass(N);var a=/{(.*)}/.exec(h.className);var c=a?B(a[1],V):V;var j=h.nodeName.toLowerCase();if(j=="input"){h=O(h)}if(F&&c.webkit){K(h,c)}else{if(W&&c.mozilla&&(c.sizex==c.sizey)){M(h,c)}else{var d=D(h.parentNode);var f=D(h);switch(j){case"a":case"input":Z(h,c,d,f);break;default:R(h,c,d,f);break}}}});function K(d,c){var a=""+c.sizex+"px "+c.sizey+"px";var b=jQuery(d);if(c.tl){b.css("WebkitBorderTopLeftRadius",a)}if(c.tr){b.css("WebkitBorderTopRightRadius",a)}if(c.bl){b.css("WebkitBorderBottomLeftRadius",a)}if(c.br){b.css("WebkitBorderBottomRightRadius",a)}}function M(d,c){var a=""+c.sizex+"px";var b=jQuery(d);if(c.tl){b.css("-moz-border-radius-topleft",a)}if(c.tr){b.css("-moz-border-radius-topright",a)}if(c.bl){b.css("-moz-border-radius-bottomleft",a)}if(c.br){b.css("-moz-border-radius-bottomright",a)}}function Z(k,n,l,a){var m=S("table");var i=S("tbody");m.appendChild(i);var j=S("tr");var d=S("td","top");j.appendChild(d);var h=S("tr");var c=T(k,n,S("td"));h.appendChild(c);var f=S("tr");var b=S("td","bottom");f.appendChild(b);if(n.tl||n.tr){i.appendChild(j);X(d,n,l,a,true)}i.appendChild(h);if(n.bl||n.br){i.appendChild(f);X(b,n,l,a,false)}k.appendChild(m);if(jQuery.browser.msie){m.onclick=Q}k.style.overflow="hidden"}function Q(){if(!this.parentNode.onclick){this.parentNode.click()}}function O(c){var b=document.createElement("a");b.id=c.id;b.className=c.className;if(c.onclick){b.href="javascript:";b.onclick=c.onclick}else{jQuery(c).parent("form").each(function(){b.href=this.action});b.onclick=I}var a=document.createTextNode(c.value);b.appendChild(a);c.parentNode.replaceChild(b,c);return b}function I(){jQuery(this).parent("form").each(function(){this.submit()});return false}function R(d,a,b,c){var f=T(d,a,document.createElement("div"));d.appendChild(f);if(a.tl||a.tr){X(d,a,b,c,true)}if(a.bl||a.br){X(d,a,b,c,false)}}function T(j,i,k){var b=jQuery(j);var l;while(l=j.firstChild){k.appendChild(l)}if(j.style.height){var f=parseInt(b.css("height"));k.style.height=f+"px";f+=parseInt(b.css("padding-top"))+parseInt(b.css("padding-bottom"));j.style.height=f+"px"}if(j.style.width){var a=parseInt(b.css("width"));k.style.width=a+"px";a+=parseInt(b.css("padding-left"))+parseInt(b.css("padding-right"));j.style.width=a+"px"}k.style.paddingLeft=b.css("padding-left");k.style.paddingRight=b.css("padding-right");if(i.tl||i.tr){k.style.paddingTop=U(j,i,b.css("padding-top"),true)}else{k.style.paddingTop=b.css("padding-top")}if(i.bl||i.br){k.style.paddingBottom=U(j,i,b.css("padding-bottom"),false)}else{k.style.paddingBottom=b.css("padding-bottom")}j.style.padding=0;return k}function U(f,a,d,c){if(d.indexOf("px")<0){try{console.error("%s padding not in pixels",(c?"top":"bottom"),f)}catch(b){}d=a.sizey+"px"}d=parseInt(d);if(d-a.sizey<0){try{console.error("%s padding is %ipx for %ipx corner:",(c?"top":"bottom"),d,a.sizey,f)}catch(b){}d=a.sizey}return d-a.sizey+"px"}function S(b,a){var c=document.createElement(b);c.style.border="none";c.style.borderCollapse="collapse";c.style.borderSpacing=0;c.style.padding=0;c.style.margin=0;if(a){c.style.verticalAlign=a}return c}function D(b){try{var d=jQuery.css(b,"background-color");if(d.match(/^(transparent|rgba\(0,\s*0,\s*0,\s*0\))$/i)&&b.parentNode){return D(b.parentNode)}if(d==null){return"#ffffff"}if(d.indexOf("rgb")>-1){d=A(d)}if(d.length==4){d=L(d)}return d}catch(a){return"#ffffff"}}function L(a){return"#"+a.substring(1,2)+a.substring(1,2)+a.substring(2,3)+a.substring(2,3)+a.substring(3,4)+a.substring(3,4)}function A(h){var a=255;var d="";var b;var e=/([0-9]+)[, ]+([0-9]+)[, ]+([0-9]+)/;var f=e.exec(h);for(b=1;b<4;b++){d+=("0"+parseInt(f[b]).toString(16)).slice(-2)}return"#"+d}function B(b,d){var b=b||"";var c={sizex:5,sizey:5,tl:false,tr:false,bl:false,br:false,webkit:true,mozilla:true,transparent:false};if(d){c.sizex=d.sizex;c.sizey=d.sizey;c.webkit=d.webkit;c.transparent=d.transparent;c.mozilla=d.mozilla}var a=false;var e=false;jQuery.each(b.split(" "),function(f,j){j=j.toLowerCase();var h=parseInt(j);if(h>0&&j==h+"px"){c.sizey=h;if(!a){c.sizex=h}a=true}else{switch(j){case"no-native":c.webkit=c.mozilla=false;break;case"webkit":c.webkit=true;break;case"no-webkit":c.webkit=false;break;case"mozilla":c.mozilla=true;break;case"no-mozilla":c.mozilla=false;break;case"anti-alias":c.transparent=false;break;case"transparent":c.transparent=true;break;case"top":e=c.tl=c.tr=true;break;case"right":e=c.tr=c.br=true;break;case"bottom":e=c.bl=c.br=true;break;case"left":e=c.tl=c.bl=true;break;case"top-left":e=c.tl=true;break;case"top-right":e=c.tr=true;break;case"bottom-left":e=c.bl=true;break;case"bottom-right":e=c.br=true;break}}});if(!e){if(!d){c.tl=c.tr=c.bl=c.br=true}else{c.tl=d.tl;c.tr=d.tr;c.bl=d.bl;c.br=d.br}}return c}function P(f,d,h){var e=Array(parseInt("0x"+f.substring(1,3)),parseInt("0x"+f.substring(3,5)),parseInt("0x"+f.substring(5,7)));var c=Array(parseInt("0x"+d.substring(1,3)),parseInt("0x"+d.substring(3,5)),parseInt("0x"+d.substring(5,7)));r="0"+Math.round(e[0]+(c[0]-e[0])*h).toString(16);g="0"+Math.round(e[1]+(c[1]-e[1])*h).toString(16);d="0"+Math.round(e[2]+(c[2]-e[2])*h).toString(16);return"#"+r.substring(r.length-2)+g.substring(g.length-2)+d.substring(d.length-2)}function X(f,a,b,d,c){if(a.transparent){G(f,a,b,c)}else{J(f,a,b,d,c)}}function J(k,z,p,a,n){var h,f;var l=document.createElement("div");l.style.fontSize="1px";l.style.backgroundColor=p;var b=0;for(h=1;h<=z.sizey;h++){var u,t,q;arc=Math.sqrt(1-Math.pow(1-h/z.sizey,2))*z.sizex;var c=z.sizex-Math.ceil(arc);var w=Math.floor(b);var v=z.sizex-c-w;var o=document.createElement("div");var m=l;o.style.margin="0px "+c+"px";o.style.height="1px";o.style.overflow="hidden";for(f=1;f<=v;f++){if(f==1){if(f==v){u=((arc+b)*0.5)-w}else{t=Math.sqrt(1-Math.pow(1-(c+1)/z.sizex,2))*z.sizey;u=(t-(z.sizey-h))*(arc-w-v+1)*0.5}}else{if(f==v){t=Math.sqrt(1-Math.pow((z.sizex-c-f+1)/z.sizex,2))*z.sizey;u=1-(1-(t-(z.sizey-h)))*(1-(b-w))*0.5}else{q=Math.sqrt(1-Math.pow((z.sizex-c-f)/z.sizex,2))*z.sizey;t=Math.sqrt(1-Math.pow((z.sizex-c-f+1)/z.sizex,2))*z.sizey;u=((t+q)*0.5)-(z.sizey-h)}}H(z,o,m,n,P(p,a,u));m=o;var o=m.cloneNode(false);o.style.margin="0px 1px"}H(z,o,m,n,a);b=arc}if(n){k.insertBefore(l,k.firstChild)}else{k.appendChild(l)}}function H(c,a,e,d,b){if(d&&!c.tl){a.style.marginLeft=0}if(d&&!c.tr){a.style.marginRight=0}if(!d&&!c.bl){a.style.marginLeft=0}if(!d&&!c.br){a.style.marginRight=0}a.style.backgroundColor=b;if(d){e.appendChild(a)}else{e.insertBefore(a,e.firstChild)}}function G(c,o,l,h){var f=document.createElement("div");f.style.fontSize="1px";var a=document.createElement("div");a.style.overflow="hidden";a.style.height="1px";a.style.borderColor=l;a.style.borderStyle="none solid";var m=o.sizex-1;var j=o.sizey-1;if(!j){j=1}for(var b=0;b<o.sizey;b++){var n=m-Math.floor(Math.sqrt(1-Math.pow(1-b/j,2))*m);if(b==2&&o.sizex==6&&o.sizey==6){n=2}var k=a.cloneNode(false);k.style.borderWidth="0 "+n+"px";if(h){k.style.borderWidth="0 "+(o.tr?n:0)+"px 0 "+(o.tl?n:0)+"px"}else{k.style.borderWidth="0 "+(o.br?n:0)+"px 0 "+(o.bl?n:0)+"px"}h?f.appendChild(k):f.insertBefore(k,f.firstChild)}if(h){c.insertBefore(f,c.firstChild)}else{c.appendChild(f)}}};

