(function(b){b.fn.corner=function(B){function K(c,a,d){var f=parseInt(c.substr(1,2),16),h=parseInt(c.substr(3,2),16);c=parseInt(c.substr(5,2),16);var m=parseInt(a.substr(1,2),16),i=parseInt(a.substr(3,2),16);a=parseInt(a.substr(5,2),16);if(d>1||d<0)d=1;f=Math.round(f*d+m*(1-d));if(f>255)f=255;if(f<0)f=0;h=Math.round(h*d+i*(1-d));if(h>255)h=255;if(h<0)h=0;d=Math.round(c*d+a*(1-d));if(d>255)d=255;if(d<0)d=0;return"#"+r(f)+r(h)+r(d)}function r(c){base=c/16;rem=c%16;base-=rem/16;baseS=k(base);remS=k(rem);
return baseS+""+remS}function k(c){if(c>=0&&c<=9)return c;else{switch(c){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 o(c,a,d){var f=0;f=new Array(1);var h=new Array(1),m=0,i="",l=Math.sqrt(Math.pow(d,2)-Math.pow(c,2));if(l>=a&&l<a+1){i="Left";f[m]=0;h[m]=l-a;m+=1}l=Math.sqrt(Math.pow(d,2)-Math.pow(a+1,2));if(l>=c&&l<c+1){i+="Top";f[m]=l-c;h[m]=1;m+=1}l=Math.sqrt(Math.pow(d,2)-Math.pow(c+1,2));if(l>=a&&l<a+1){i+="Right";
f[m]=1;h[m]=l-a;m+=1}l=Math.sqrt(Math.pow(d,2)-Math.pow(a,2));if(l>=c&&l<c+1){i+="Bottom";f[m]=l-c;h[m]=0}switch(i){case "LeftRight":f=Math.min(h[0],h[1])+(Math.max(h[0],h[1])-Math.min(h[0],h[1]))/2;break;case "TopRight":f=1-(1-f[0])*(1-h[1])/2;break;case "TopBottom":f=Math.min(f[0],f[1])+(Math.max(f[0],f[1])-Math.min(f[0],f[1]))/2;break;case "LeftBottom":f=h[0]*f[1]/2;break;default:f=1}return f}function J(c){try{var a=I(c),d=parseInt(a[0]),f=parseInt(a[1]),h=parseInt(a[2]),m="#"+r(d)+r(f)+r(h)}catch(i){alert("There was an error converting the RGB value to Hexadecimal in function rgb2Hex")}return m}
function I(c){c=c.substring(4,c.indexOf(")"));return c=c.split(", ")}function L(c){var a="transparent";if(c!=""&&c!="transparent")a=c.substr(0,3)=="rgb"?J(c):c.length==4?"#"+c.substring(1,2)+c.substring(1,2)+c.substring(2,3)+c.substring(2,3)+c.substring(3,4)+c.substring(3,4):c;return a}function w(c){return parseInt(c!="auto"&&c.indexOf("%")==-1&&c!=""&&c.indexOf("px")!==-1?c.slice(0,c.indexOf("px")):0)}function C(c,a,d,f,h,m,i,l,e,D,j,n,p,x){c=b(c);i=document.createElement("div");b(i).css({height:m,
width:"1px",position:"absolute","font-size":"1px",overflow:"hidden"});m=Math.max(x.tl?x.tl.radius:0,x.tr?x.tr.radius:0);if(l==-1&&e!=""){m>0?b(i).css("background-position","-"+(p-D-n+a)+"px -"+(c.height()+m-n-d)+"px"):b(i).css("background-position","-"+(p-D-n+a)+"px -"+(c.height()-d)+"px");b(i).css({"background-image":e,"background-repeat":c.css("background-repeat"),"background-color":f})}else j?b(i).css("background-color",f):b(i).css("background-color",f).addClass("hasBackgroundColor");h!=100&&O(i,
h);b(i).css({top:d+"px",left:a+"px"});return i}function O(c,a){a=a==100?99.999:a;if(b.browser.safari&&c.tagName!="IFRAME"){var d=I(c.style.backgroundColor),f=parseInt(d[0]),h=parseInt(d[1]);d=parseInt(d[2]);c.style.backgroundColor="rgba("+f+", "+h+", "+d+", "+a/100+")"}else if(typeof c.style.opacity!="undefined")c.style.opacity=a/100;else if(typeof c.style.MozOpacity!="undefined")c.style.MozOpacity=a/100;else if(typeof c.style.filter!="undefined")c.style.filter="alpha(opacity:"+a+")";else if(typeof c.style.KHTMLOpacity!=
"undefined")c.style.KHTMLOpacity=a/100}function P(c,a){var d=b(c),f=d.css("backgroundImage"),h=null,m=null,i=[];w(d.css("height"))&&w(d.css("height"));var l=w(d.css("width"))?w(d.css("width")):c.scrollWidth,e=w(d.css("borderTopWidth"))?w(d.css("borderTopWidth")):0,D=w(d.css("paddingTop")),j=w(d.css("paddingBottom")),n=w(d.css("paddingLeft")),p=w(d.css("paddingRight")),x=L(d.css("backgroundColor"));f=f!="none"&&f!="initial"?f:"";var E=L(d.css("borderTopColor")),t=e+"px solid "+E,u=Math.max(a.tl?a.tl.radius:
0,a.tr?a.tr.radius:0),A=Math.max(a.bl?a.bl.radius:0,a.br?a.br.radius:0);d.addClass("hasCorners").css({padding:"0",borderColor:c.style.borderColour,overflow:"visible"});c.style.position!="absolute"&&d.css("position","relative");if(b.browser.msie){b.browser.version==6&&c.style.width=="auto"&&c.style.height=="auto"&&d.css("width","100%");d.css("zoom","1");b("*",d).css("zoom","normal")}for(var s=0;s<2;s++)switch(s){case 0:if(a.tl||a.tr){var q=document.createElement("div");h=c.appendChild(q);b(h).css({width:"100%",
"font-size":"1px",overflow:"hidden",position:"absolute","padding-left":e,"padding-right":e,height:u+"px",top:0-u+"px",left:0-e+"px"}).addClass("topContainer")}break;case 1:if(a.bl||a.br){q=document.createElement("div");m=c.appendChild(q);b(m).css({width:"100%","font-size":"1px",overflow:"hidden",position:"absolute","padding-left":e,"padding-right":e,height:A,bottom:0-A+"px",left:0-e+"px"}).addClass("bottomContainer")}break}if(a.autoPad==true){s=document.createElement("div");q=document.createElement("div");
var y=document.createElement("div");b(q).css({margin:"0","padding-bottom":j,"padding-top":D,"padding-left":n,"padding-right":p,overflow:"visible"}).addClass("hasBackgroundColor content_container");b(s).css({position:"relative","float":"left",width:"100%","margin-top":"-"+(u-e)+"px","margin-bottom":"-"+(A-e)+"px"}).addClass="autoPadDiv";b(y).css("clear","both");q.appendChild(s);q.appendChild(y);d.wrapInner(q)}h&&d.css("border-top",0);m&&d.css("border-bottom",0);D=["tr","tl","br","bl"];for(var M in D)if(M>
-1<4){j=D[M];if(a[j]){if(i[a[j].radius])g=i[a[j].radius].cloneNode(true);else{g=document.createElement("DIV");b(g).css({height:a[j].radius,width:a[j].radius,position:"absolute","font-size":"1px",overflow:"hidden"});s=parseInt(a[j].radius-e);n=0;for(p=a[j].radius;n<p;n++){q=n+1>=s?-1:Math.floor(Math.sqrt(Math.pow(s,2)-Math.pow(n+1,2)))-1;if(s!=p)var F=n>=s?-1:Math.ceil(Math.sqrt(Math.pow(s,2)-Math.pow(n,2))),G=n+1>=p?-1:Math.floor(Math.sqrt(Math.pow(p,2)-Math.pow(n+1,2)))-1;y=n>=p?-1:Math.ceil(Math.sqrt(Math.pow(p,
2)-Math.pow(n,2)));q>-1&&g.appendChild(C(c,n,0,x,100,q+1,g,-1,f,a[j].radius,0,e,l,a));if(s!=p){for(var v=q+1;v<F;v++)if(a.antiAlias)if(f!=""){var H=o(n,v,s)*100;H<30?g.appendChild(C(c,n,v,E,100,1,g,0,f,a[j].radius,1,e,l,a)):g.appendChild(C(c,n,v,E,100,1,g,-1,f,a[j].radius,1,e,l,a))}else{H=K(x,E,o(n,v,s));g.appendChild(C(c,n,v,H,100,1,g,0,f,a[j].radius,j,1,e,l,a))}if(a.antiAlias){if(G>=F){if(F==-1)F=0;g.appendChild(C(c,n,F,E,100,G-F+1,g,0,f,0,1,e,l,a))}}else G>=q&&g.appendChild(C(c,n,q+1,E,100,G-q,
g,0,f,0,1,e,l,a));H=E}else{H=x;G=q}if(a.antiAlias)for(v=G+1;v<y;v++)g.appendChild(C(c,n,v,H,o(n,v,p)*100,1,g,e>0?0:-1,f,a[j].radius,1,e,l,a))}i[a[j].radius]=g.cloneNode(true)}if(j!="br"){s=0;for(n=g.childNodes.length;s<n;s++){p=g.childNodes[s];q=w(b(p).css("top"));y=w(b(p).css("left"));v=w(b(p).css("height"));if(j=="tl"||j=="bl")b(p).css("left",a[j].radius-y-1+"px");if(j=="tr"||j=="tl")b(p).css("top",a[j].radius-v-q+"px");switch(j){case "tr":b(p).css("background-position","-"+Math.abs(l-a[j].radius+
e+y)+"px -"+Math.abs(a[j].radius-v-q-e)+"px");break;case "tl":b(p).css("background-position","-"+Math.abs(a[j].radius-y-1-e)+"px -"+Math.abs(a[j].radius-v-q-e)+"px");break;case "bl":u>0?b(p).css("background-position","-"+Math.abs(a[j].radius-y-1-e)+"px -"+Math.abs(d.height()+u-e+1)+"px"):b(p).css("background-position","-"+Math.abs(a[j].radius-y-1-e)+"px -"+Math.abs(d.height())+"px");break}}}}else if((j=="tr"||j=="tl")&&h!=null||(j=="br"||j=="bl")&&m!=null){var g=document.createElement("div");b(g).css({position:"relative",
"font-size":"1px",overflow:"hidden"});f==""?b(g).css("background-color",x):b(g).css("background-image",f).css("background-color",x);switch(j){case "tl":b(g).css({height:u-e,"margin-right":a.tr.radius-e*2,"border-left":t,"border-top":t,left:-e+"px","background-repeat":d.css("background-repeat"),"background-position":e+"px 0px"});break;case "tr":b(g).css({height:u-e,"margin-left":a.tl.radius-e*2,"border-right":t,"border-top":t,left:e+"px","background-repeat":d.css("background-repeat"),"background-position":"-"+
(u+e)+"px 0px"});break;case "bl":u>0?b(g).css({height:A-e,"margin-right":a.br.radius-e*2,"border-left":t,"border-bottom":t,left:-e+"px","background-repeat":d.css("background-repeat"),"background-position":"0px -"+(d.height()+u-e+1)+"px"}):b(g).css({height:A-e,"margin-right":a.br.radius-e*2,"border-left":t,"border-bottom":t,left:-e+"px","background-repeat":d.css("background-repeat"),"background-position":"0px -"+d.height()+"px"});break;case "br":u>0?b(g).css({height:A-e,"margin-left":a.bl.radius-e*
2,"border-right":t,"border-bottom":t,left:e+"px","background-repeat":d.css("background-repeat"),"background-position":"-"+a.bl.radius+e+"px -"+(d.height()+u-e+1)+"px"}):b(g).css({height:A-e,"margin-left":a.bl.radius-e*2,"border-right":t,"border-bottom":t,left:e+"px","background-repeat":d.css("background-repeat"),"background-position":"-"+a.bl.radius+e+"px -"+d.height()+"px"});break}}if(g)switch(j){case "tl":b(g).css("position")=="absolute"&&b(g).css("top","0");b(g).css("position")=="absolute"&&b(g).css("left",
"0");h&&h.appendChild(g);break;case "tr":b(g).css("position")=="absolute"&&b(g).css("top","0");b(g).css("position")=="absolute"&&b(g).css("right","0");h&&h.appendChild(g);break;case "bl":b(g).css("position")=="absolute"&&b(g).css("bottom","0");g.style.position=="absolute"&&b(g).css("left","0");m&&m.appendChild(g);break;case "br":b(g).css("position")=="absolute"&&b(g).css("bottom","0");b(g).css("position")=="absolute"&&b(g).css("right","0");m&&m.appendChild(g);break}}c=[];c.t=Math.abs(a.tl.radius-
a.tr.radius);c.b=Math.abs(a.bl.radius-a.br.radius);for(z in c)if(z=="t"||z=="b"){if(c[z]){i=a[z+"l"].radius<a[z+"r"].radius?z+"l":z+"r";l=document.createElement("div");b(l).css({height:c[z],width:a[i].radius+"px",position:"absolute","font-size":"1px",overflow:"hidden","background-color":x,"background-image":f});switch(i){case "tl":b(l).css({bottom:"0",left:"0","border-left":t,"background-position":"0px -"+(a[i].radius-e)});h.appendChild(l);break;case "tr":b(l).css({bottom:"0",right:"0","border-right":t,
"background-position":"0px -"+(a[i].radius-e)+"px"});h.appendChild(l);break;case "bl":b(l).css({top:"0",left:"0","border-left":t,"background-position":"0px -"+(d.height()+a[i].radius-e)});m.appendChild(l);break;case "br":b(l).css({top:"0",right:"0","border-right":t,"background-position":"0px -"+(d.height()+a[i].radius-e)});m.appendChild(l);break}}i=document.createElement("div");b(i).css({position:"relative","font-size":"1px",overflow:"hidden","background-color":x,"background-image":f,"background-repeat":d.css("background-repeat")});
switch(z){case "t":if(h){if(a.tl.radius&&a.tr.radius){b(i).css({height:u-e+"px","margin-left":a.tl.radius-e+"px","margin-right":a.tr.radius-e+"px","border-top":t}).addClass("hasBackgroundColor");f!=""&&b(i).css("background-position","-"+(u+e)+"px 0px");h.appendChild(i)}d.css("background-position","0px -"+(u-e+1)+"px")}break;case "b":if(m)if(a.bl.radius&&a.br.radius){b(i).css({height:A-e+"px","margin-left":a.bl.radius-e+"px","margin-right":a.br.radius-e+"px","border-bottom":t});f!=""&&u>0?b(i).css("background-position",
"-"+(a.bl.radius-e)+"px -"+(d.height()+u-e+1)+"px"):b(i).css("background-position","-"+(a.bl.radius-e)+"px -"+d.height()+"px").addClass("hasBackgroundColor");m.appendChild(i)}break}}d.prepend(h);d.prepend(m)}var N={tl:{radius:8},tr:{radius:8},bl:{radius:8},br:{radius:8},antiAlias:true,autoPad:true,validTags:["div"]};B&&typeof B!="string"&&b.extend(N,B);return this.each(function(){b(this).is(".hasCorners")||P(this,N)})}})(jQuery);
(function(b){var B=b.browser.msie&&parseInt(b.browser.version)==6&&!window.XMLHttpRequest,K=b.browser.msie&&!b.boxModel,r=[];b.modal=function(k,o){return b.modal.impl.init(k,o)};b.modal.close=function(){b.modal.impl.close()};b.fn.modal=function(k){return b.modal.impl.init(this,k)};b.modal.defaults={iframe:false,opacity:50,overlayId:"simplemodal-overlay",overlayCss:{},containerId:"simplemodal-container",containerCss:{},dataCss:{},zIndex:1E3,close:true,closeHTML:'<a class="modalCloseImg" title="Close"></a>',
closeClass:"simplemodal-close",position:null,persist:false,onOpen:null,onShow:null,onClose:null};b.modal.impl={opts:null,dialog:{},init:function(k,o){if(this.dialog.data)return false;this.opts=b.extend({},b.modal.defaults,o);this.zIndex=this.opts.zIndex;this.occb=false;if(typeof k=="object"){k=k instanceof jQuery?k:b(k);if(k.parent().parent().size()>0){this.dialog.parentNode=k.parent();if(!this.opts.persist)this.dialog.orig=k.clone(true)}}else if(typeof k=="string"||typeof k=="number")k=b("<div/>").html(k);
else{alert("SimpleModal Error: Unsupported data type: "+typeof k);return false}this.dialog.data=k.addClass("simplemodal-data").css(this.opts.dataCss);this.create();this.open();b.isFunction(this.opts.onShow)&&this.opts.onShow.apply(this,[this.dialog]);return this},create:function(){r=this.getDimensions();if(this.opts.iframe||B)this.dialog.iframe=b('<iframe src="javascript:false;"/>').css(b.extend(this.opts.iframeCss,{display:"none",opacity:0,position:"fixed",height:r[0],width:r[1],zIndex:this.opts.zIndex,
top:0,left:0})).appendTo("body");this.dialog.overlay=b("<div/>").attr("id",this.opts.overlayId).addClass("simplemodal-overlay").css(b.extend(this.opts.overlayCss,{display:"none",opacity:this.opts.opacity/100,height:r[0],width:r[1],position:"fixed",left:0,top:0,zIndex:this.opts.zIndex+1})).appendTo("body");this.dialog.container=b("<div/>").attr("id",this.opts.containerId).addClass("simplemodal-container").css(b.extend(this.opts.containerCss,{display:"none",position:"fixed",zIndex:this.opts.zIndex+
2})).append(this.opts.close?b(this.opts.closeHTML).addClass(this.opts.closeClass):"").appendTo("body");this.setPosition();if(B||K)this.fixIE();this.dialog.container.append(this.dialog.data.hide())},bindEvents:function(){var k=this;b("."+this.opts.closeClass).bind("click.simplemodal",function(o){o.preventDefault();k.close()});b(window).bind("resize.simplemodal",function(){r=k.getDimensions();k.setPosition();if(!B){k.dialog.iframe&&k.dialog.iframe.css({height:r[0],width:r[1]});k.dialog.overlay.css({height:r[0],
width:r[1]})}})},unbindEvents:function(){b("."+this.opts.closeClass).unbind("click.simplemodal");b(window).unbind("resize.simplemodal")},fixIE:function(){b.each([this.dialog.iframe||null,this.dialog.overlay,this.dialog.container],function(k,o){if(o){o=o[0].style;o.position="absolute";if(k<2){o.setExpression("height",'document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + "px"');o.setExpression("width",'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')}else o.setExpression("top",
'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"')}})},getDimensions:function(){var k=b(window),o=b.browser.opera&&b.browser.version>"9.5"&&b.fn.jquery<="1.2.6"?document.documentElement.clientHeight:k.height();return[o,k.width()]},setPosition:function(){var k=0,o=0,J=r[0]/2-(this.dialog.container.height()||this.dialog.data.height())/2,
I=r[1]/2-(this.dialog.container.width()||this.dialog.data.width())/2;if(this.opts.position&&this.opts.position.constructor==Array){k+=this.opts.position[0]||J;o+=this.opts.position[1]||I}else{k+=J;o+=I}this.dialog.container.css({left:o,top:k})},open:function(){this.dialog.iframe&&this.dialog.iframe.show();if(b.isFunction(this.opts.onOpen))this.opts.onOpen.apply(this,[this.dialog]);else{this.dialog.overlay.show();this.dialog.container.show();this.dialog.data.show()}this.bindEvents()},close:function(){if(!this.dialog.data)return false;
if(b.isFunction(this.opts.onClose)&&!this.occb){this.occb=true;this.opts.onClose.apply(this,[this.dialog])}else{if(this.dialog.parentNode)if(this.opts.persist)this.dialog.data.hide().appendTo(this.dialog.parentNode);else{this.dialog.data.remove();this.dialog.orig.appendTo(this.dialog.parentNode)}else this.dialog.data.remove();this.dialog.container.remove();this.dialog.overlay.remove();this.dialog.iframe&&this.dialog.iframe.remove();this.dialog={}}this.unbindEvents()}}})(jQuery);
