/*
 * jQuery Plugin: DivCorners
 * http://www.roydukkey.com/divcorners
 *
 * Copyright (c) 2010 Rory Dueck
 *
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Date: 2010-04-19 (Mon, 19 Apr 2010)
 * Version: 1.5.3
 */
(function(e){var o={dcCreate:function(f,c){var a=e.extend({imgPrefix:"/images/",fileType:".gif",expand:10,radius:0,position:"inside",resize:"",exclude:""},f);a.e=a.expand.toString().replace(/[^0-9\. ]/g,"").split(" ");for(var b=0;b<4;b++)a.e[b]=!a.e[b]&&a.e[b]!==0?a.e[Math.max(b-2,0)]:parseInt(a.e[b]);a.r=a.radius.toString().replace(/[^0-9\. ]/g,"").split(" ");for(b=0;b<4;b++)a.r[b]=!a.r[b]&&a.r[b]!==0?a.r[Math.max(b-2,0)]:parseInt(a.r[b])>a.e[b]?parseInt(a.r[b])-a.e[b]:0;a.x=a.exclude.replace(/\s/g,"").split(",");return this.each(function(){var g=e(this),h=g.find(">.dcContent"),d,i=["top","right","bottom","left"],j,k=["left","right"],l,m=[];g.addClass("dCorner").css({height:g.height(),width:g.width()});h.css({height:h.height(),width:h.width()});a.resize!=""&&g.find(a.resize).each(function(){e(this).load(function(){e(this).parents(".dCorner").dcResize("auto")})});for(d in i){h=e('<div class="dcItem dc'+i[d]+'">'+(e.inArray(i[d],a.x)==-1?'<img src="'+a.imgPrefix+i[d]+a.fileType+'" />':"")+"</div>");if(d!=1&&d!=3){a.position=="inside"?h.css("margin-left",a.e[3]+a.r[3]).width(g.innerWidth()-(a.r[3]+a.e[3]+a.r[1]+a.e[1])):h.css(i[d],-a.e[d]).css("margin-left",a.r[3]).width(g.innerWidth()-(a.r[3]+a.r[1]));h.height(a.e[d]).css("display","block");for(j in k){l=e('<div class="dcItem dc'+i[d]+"-"+k[j]+'">'+(e.inArray(i[d]+"-"+k[j],a.x)==-1?'<img src="'+a.imgPrefix+i[d]+"-"+k[j]+a.fileType+'" />':"")+"</div>");a.position!="inside"&&l.css(i[d],-a.e[d]).css(k[j],-a.e[j==1?1:3]);l.height(a.e[d]+a.r[d]).width(a.e[j==1?1:3]+a.r[j==1?1:3]).css("display","block");e.inArray(i[d]+"-"+k[j],a.x)==-1&&n.p(l,a.fileType);m.push(l)}}else{a.position=="inside"?h.css("margin-top",a.e[0]+a.r[0]).height(g.innerHeight()-(a.r[0]+a.e[0]+a.r[2]+a.e[2])):h.css(i[d],-a.e[d]).css("margin-top",a.r[0]).height(g.innerHeight()-(a.r[0]+a.r[2]));h.width(a.e[d]).css("display","block")}e.inArray(i[d],a.x)==-1&&n.p(h,a.fileType);m.push(h)}for(b in m)g.append(m[b]);n.w(g);c!=false&&g.parents(".dCorner").dcResize("auto")})},dcResize:function(f){return this.each(function(){var c=e(this),a=c.find(">.dctop-left"),b=c.find(">.dctop-right");if(c.hasClass("dCorner")){c.css("zoom","0");f=="auto"&&c.css({height:"",width:""});c.find(">.dctop,>.dcbottom").width(c.innerWidth()-(a.width()+parseInt(a.css("left").replace("px"))+b.width()+parseInt(b.css("right").replace("px"))));c.find(">.dcleft,>.dcright").height(c.innerHeight()-(a.height()+parseInt(a.css("top").replace("px"))+(b=c.find(">.dcbottom-left")).height()+parseInt(b.css("bottom").replace("px"))));n.w(c);f=="auto"&&c.css({height:c.height(),width:c.width()});c.css("zoom","1");f!=false&&c.parents(".dCorner").dcResize("auto")}})},dcClear:function(f){return this.each(function(){e(this).removeClass("dCorner").find(">.dcItem").remove();f!=false&&e(this).parents(".dCorner").dcResize("auto")})}};e.each(o,function(f){e.fn[f]=this});var n={p:function(f,c){if(e.browser.msie&&c==".png"){c=(f=e(f)).find("img");f.css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+c.attr("src")+"',sizingMethod='scale')");c.css("filter","alpha(opacity=0)")}},w:function(f){if(e.browser.version<7&&e.browser.msie){f.find(">.dctop-right,>.dcright,>.dcbottom-right").css("margin-right",f.innerWidth()%2!=0?"-1px":"0px");f.find(">.dcbottom-left,>.dcbottom,>.dcbottom-right").css("margin-bottom",f.innerHeight()%2!=0?"-1px":"0px")}}}})(jQuery);
