(function($){
var _2=$.browser.mozilla&&/gecko/i.test(navigator.userAgent);
var _3=$.browser.safari&&$.browser.version>=3;
var _4=$.browser.msie&&(function(){
var _5=document.createElement("div");
try{
_5.style.setExpression("width","0+0");
}
catch(e){
return false;
}
return true;
})();
function sz(el,p){
return parseInt($.css(el,p))||0;
}
function hex2(s){
var s=parseInt(s).toString(16);
return (s.length<2)?"0"+s:s;
}
function gpc(_9){
for(;_9&&_9.nodeName.toLowerCase()!="html";_9=_9.parentNode){
var v=$.css(_9,"backgroundColor");
if(v=="rgba(0, 0, 0, 0)"){
continue;
}
if(v.indexOf("rgb")>=0){
var _b=v.match(/\d+/g);
return "#"+hex2(_b[0])+hex2(_b[1])+hex2(_b[2]);
}
if(v&&v!="transparent"){
return v;
}
}
return "#ffffff";
}
function getWidth(fx,i,_e){
switch(fx){
case "round":
return Math.round(_e*(1-Math.cos(Math.asin(i/_e))));
case "cool":
return Math.round(_e*(1+Math.cos(Math.asin(i/_e))));
case "sharp":
return Math.round(_e*(1-Math.cos(Math.acos(i/_e))));
case "bite":
return Math.round(_e*(Math.cos(Math.asin((_e-i-1)/_e))));
case "slide":
return Math.round(_e*(Math.atan2(i,_e/i)));
case "jut":
return Math.round(_e*(Math.atan2(_e,(_e-i-1))));
case "curl":
return Math.round(_e*(Math.atan(i)));
case "tear":
return Math.round(_e*(Math.cos(i)));
case "wicked":
return Math.round(_e*(Math.tan(i)));
case "long":
return Math.round(_e*(Math.sqrt(i)));
case "sculpt":
return Math.round(_e*(Math.log((_e-i-1),_e)));
case "dog":
return (i&1)?(i+1):_e;
case "dog2":
return (i&2)?(i+1):_e;
case "dog3":
return (i&3)?(i+1):_e;
case "fray":
return (i%2)*_e;
case "notch":
return _e;
case "bevel":
return i+1;
}
}
$.fn.corner=function(_f){
if(this.length==0){
if(!$.isReady&&this.selector){
var s=this.selector,c=this.context;
$(function(){
$(s,c).corner(_f);
});
}
return this;
}
return this.each(function(_12){
var _13=$(this);
var o=(_f||_13.attr($.fn.corner.defaults.metaAttr)||"").toLowerCase();
var _15=/keep/.test(o);
var cc=((o.match(/cc:(#[0-9a-f]+)/)||[])[1]);
var sc=((o.match(/sc:(#[0-9a-f]+)/)||[])[1]);
var _18=parseInt((o.match(/(\d+)px/)||[])[1])||10;
var re=/round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/;
var fx=((o.match(re)||["round"])[0]);
var _1b={T:0,B:1};
var _1c={TL:/top|tl|left/.test(o),TR:/top|tr|right/.test(o),BL:/bottom|bl|left/.test(o),BR:/bottom|br|right/.test(o)};
if(!_1c.TL&&!_1c.TR&&!_1c.BL&&!_1c.BR){
_1c={TL:1,TR:1,BL:1,BR:1};
}
if($.fn.corner.defaults.useNative&&fx=="round"&&(_2||_3)&&!cc&&!sc){
if(_1c.TL){
_13.css(_2?"-moz-border-radius-topleft":"-webkit-border-top-left-radius",_18+"px");
}
if(_1c.TR){
_13.css(_2?"-moz-border-radius-topright":"-webkit-border-top-right-radius",_18+"px");
}
if(_1c.BL){
_13.css(_2?"-moz-border-radius-bottomleft":"-webkit-border-bottom-left-radius",_18+"px");
}
if(_1c.BR){
_13.css(_2?"-moz-border-radius-bottomright":"-webkit-border-bottom-right-radius",_18+"px");
}
return;
}
var _1d=document.createElement("div");
_1d.style.overflow="hidden";
_1d.style.height="1px";
_1d.style.backgroundColor=sc||"transparent";
_1d.style.borderStyle="solid";
var pad={T:parseInt($.css(this,"paddingTop"))||0,R:parseInt($.css(this,"paddingRight"))||0,B:parseInt($.css(this,"paddingBottom"))||0,L:parseInt($.css(this,"paddingLeft"))||0};
if(typeof this.style.zoom!=undefined){
this.style.zoom=1;
}
if(!_15){
this.style.border="none";
}
_1d.style.borderColor=cc||gpc(this.parentNode);
var _1f=$.curCSS(this,"height");
for(var j in _1b){
var bot=_1b[j];
if((bot&&(_1c.BL||_1c.BR))||(!bot&&(_1c.TL||_1c.TR))){
_1d.style.borderStyle="none "+(_1c[j+"R"]?"solid":"none")+" none "+(_1c[j+"L"]?"solid":"none");
var d=document.createElement("div");
$(d).addClass("jquery-corner");
var ds=d.style;
bot?this.appendChild(d):this.insertBefore(d,this.firstChild);
if(bot&&_1f!="auto"){
if($.css(this,"position")=="static"){
this.style.position="relative";
}
ds.position="absolute";
ds.bottom=ds.left=ds.padding=ds.margin="0";
if(_4){
ds.setExpression("width","this.parentNode.offsetWidth");
}else{
ds.width="100%";
}
}else{
if(!bot&&$.browser.msie){
if($.css(this,"position")=="static"){
this.style.position="relative";
}
ds.position="absolute";
ds.top=ds.left=ds.right=ds.padding=ds.margin="0";
if(_4){
var bw=sz(this,"borderLeftWidth")+sz(this,"borderRightWidth");
ds.setExpression("width","this.parentNode.offsetWidth - "+bw+"+ \"px\"");
}else{
ds.width="100%";
}
}else{
ds.position="relative";
ds.margin=!bot?"-"+pad.T+"px -"+pad.R+"px "+(pad.T-_18)+"px -"+pad.L+"px":(pad.B-_18)+"px -"+pad.R+"px -"+pad.B+"px -"+pad.L+"px";
}
}
for(var i=0;i<_18;i++){
var w=Math.max(0,getWidth(fx,i,_18));
var e=_1d.cloneNode(false);
e.style.borderWidth="0 "+(_1c[j+"R"]?w:0)+"px 0 "+(_1c[j+"L"]?w:0)+"px";
bot?d.appendChild(e):d.insertBefore(e,d.firstChild);
}
}
}
});
};
$.fn.uncorner=function(){
if(_2||_3){
this.css(_2?"-moz-border-radius":"-webkit-border-radius",0);
}
$("div.jquery-corner",this).remove();
return this;
};
$.fn.corner.defaults={useNative:true,metaAttr:"data-corner"};
})(jQuery);

