var Rico={Version:"1.1.2",prototypeVersion:parseFloat(Prototype.Version.split(".")[0]+"."+Prototype.Version.split(".")[1])};if((typeof Prototype=="undefined")||Rico.prototypeVersion<1.3){throw ("Rico requires the Prototype JavaScript framework >= 1.3")}Rico.ArrayExtensions=new Array();if(Object.prototype.extend){Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend}else{Object.prototype.extend=function(A){return Object.extend.apply(this,[this,A])};Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend}if(Array.prototype.push){Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.push}if(!Array.prototype.remove){Array.prototype.remove=function(A){if(isNaN(A)||A>this.length){return false}for(var B=0,C=0;B<this.length;B++){if(B!=A){this[C++]=this[B]}}this.length-=1};Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.remove}if(!Array.prototype.removeItem){Array.prototype.removeItem=function(B){for(var A=0;A<this.length;A++){if(this[A]==B){this.remove(A);break}}};Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.removeItem}if(!Array.prototype.indices){Array.prototype.indices=function(){var A=new Array();for(index in this){var C=false;for(var B=0;B<Rico.ArrayExtensions.length;B++){if(this[index]==Rico.ArrayExtensions[B]){C=true;break}}if(!C){A[A.length]=index}}return A};Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.indices}if(window.DOMParser&&window.XMLSerializer&&window.Node&&Node.prototype&&Node.prototype.__defineGetter__){if(!Document.prototype.loadXML){Document.prototype.loadXML=function(B){var C=(new DOMParser()).parseFromString(B,"text/xml");while(this.hasChildNodes()){this.removeChild(this.lastChild)}for(var A=0;A<C.childNodes.length;A++){this.appendChild(this.importNode(C.childNodes[A],true))}}}Document.prototype.__defineGetter__("xml",function(){return(new XMLSerializer()).serializeToString(this)})}document.getElementsByTagAndClassName=function(D,E){if(D==null){D="*"}var C=document.getElementsByTagName(D)||document.all;var F=new Array();if(E==null){return C}for(var B=0;B<C.length;B++){var H=C[B];var G=H.className.split(" ");for(var A=0;A<G.length;A++){if(G[A]==E){F.push(H);break}}}return F};Rico.Color=Class.create();Rico.Color.prototype={initialize:function(C,B,A){this.rgb={r:C,g:B,b:A}},setRed:function(A){this.rgb.r=A},setGreen:function(A){this.rgb.g=A},setBlue:function(A){this.rgb.b=A},setHue:function(B){var A=this.asHSB();A.h=B;this.rgb=Rico.Color.HSBtoRGB(A.h,A.s,A.b)},setSaturation:function(B){var A=this.asHSB();A.s=B;this.rgb=Rico.Color.HSBtoRGB(A.h,A.s,A.b)},setBrightness:function(A){var B=this.asHSB();B.b=A;this.rgb=Rico.Color.HSBtoRGB(B.h,B.s,B.b)},darken:function(B){var A=this.asHSB();this.rgb=Rico.Color.HSBtoRGB(A.h,A.s,Math.max(A.b-B,0))},brighten:function(B){var A=this.asHSB();this.rgb=Rico.Color.HSBtoRGB(A.h,A.s,Math.min(A.b+B,1))},blend:function(A){this.rgb.r=Math.floor((this.rgb.r+A.rgb.r)/2);this.rgb.g=Math.floor((this.rgb.g+A.rgb.g)/2);this.rgb.b=Math.floor((this.rgb.b+A.rgb.b)/2)},isBright:function(){var A=this.asHSB();return this.asHSB().b>0.5},isDark:function(){return !this.isBright()},asRGB:function(){return"rgb("+this.rgb.r+","+this.rgb.g+","+this.rgb.b+")"},asHex:function(){return"#"+this.rgb.r.toColorPart()+this.rgb.g.toColorPart()+this.rgb.b.toColorPart()},asHSB:function(){return Rico.Color.RGBtoHSB(this.rgb.r,this.rgb.g,this.rgb.b)},toString:function(){return this.asHex()}};Rico.Color.createFromHex=function(D){if(D.length==4){var B=D;var D="#";for(var C=1;C<4;C++){D+=(B.charAt(C)+B.charAt(C))}}if(D.indexOf("#")==0){D=D.substring(1)}var F=D.substring(0,2);var E=D.substring(2,4);var A=D.substring(4,6);return new Rico.Color(parseInt(F,16),parseInt(E,16),parseInt(A,16))};Rico.Color.createColorFromBackground=function(D){var B=RicoUtil.getElementsComputedStyle($(D),"backgroundColor","background-color");if(B=="transparent"&&D.parentNode){return Rico.Color.createColorFromBackground(D.parentNode)}if(B==null){return new Rico.Color(255,255,255)}if(B.indexOf("rgb(")==0){var A=B.substring(4,B.length-1);var C=A.split(",");return new Rico.Color(parseInt(C[0]),parseInt(C[1]),parseInt(C[2]))}else{if(B.indexOf("#")==0){return Rico.Color.createFromHex(B)}else{return new Rico.Color(255,255,255)}}};Rico.Color.HSBtoRGB=function(G,E,I){var C=0;var D=0;var J=0;if(E==0){C=parseInt(I*255+0.5);D=C;J=C}else{var F=(G-Math.floor(G))*6;var H=F-Math.floor(F);var B=I*(1-E);var A=I*(1-E*H);var K=I*(1-(E*(1-H)));switch(parseInt(F)){case 0:C=(I*255+0.5);D=(K*255+0.5);J=(B*255+0.5);break;case 1:C=(A*255+0.5);D=(I*255+0.5);J=(B*255+0.5);break;case 2:C=(B*255+0.5);D=(I*255+0.5);J=(K*255+0.5);break;case 3:C=(B*255+0.5);D=(A*255+0.5);J=(I*255+0.5);break;case 4:C=(K*255+0.5);D=(B*255+0.5);J=(I*255+0.5);break;case 5:C=(I*255+0.5);D=(B*255+0.5);J=(A*255+0.5);break}}return{r:parseInt(C),g:parseInt(D),b:parseInt(J)}};Rico.Color.RGBtoHSB=function(A,E,J){var F;var D;var I;var K=(A>E)?A:E;if(J>K){K=J}var G=(A<E)?A:E;if(J<G){G=J}I=K/255;if(K!=0){D=(K-G)/K}else{D=0}if(D==0){F=0}else{var B=(K-A)/(K-G);var H=(K-E)/(K-G);var C=(K-J)/(K-G);if(A==K){F=C-H}else{if(E==K){F=2+B-C}else{F=4+H-B}}F=F/6;if(F<0){F=F+1}}return{h:F,s:D,b:I}};Rico.Corner={round:function(D,B){var D=$(D);this._setOptions(B);var A=this.options.color;if(this.options.color=="fromElement"){A=this._background(D)}var C=this.options.bgColor;if(this.options.bgColor=="fromParent"){C=this._background(D.offsetParent)}this._roundCornersImpl(D,A,C)},_roundCornersImpl:function(C,A,B){if(this.options.border){this._renderBorder(C,B)}if(this._isTopRounded()){this._roundTopCorners(C,A,B)}if(this._isBottomRounded()){this._roundBottomCorners(C,A,B)}},_renderBorder:function(D,E){var B="1px solid "+this._borderColor(E);var A="border-left: "+B;var F="border-right: "+B;var C="style='"+A+";"+F+"'";D.innerHTML="<div "+C+">"+D.innerHTML+"</div>"},_roundTopCorners:function(C,A,E){var D=this._createCorner(E);for(var B=0;B<this.options.numSlices;B++){D.appendChild(this._createCornerSlice(A,E,B,"top"))}C.style.paddingTop=0;C.insertBefore(D,C.firstChild)},_roundBottomCorners:function(C,A,E){var D=this._createCorner(E);for(var B=(this.options.numSlices-1);B>=0;B--){D.appendChild(this._createCornerSlice(A,E,B,"bottom"))}C.style.paddingBottom=0;C.appendChild(D)},_createCorner:function(B){var A=document.createElement("div");A.style.backgroundColor=(this._isTransparent()?"transparent":B);return A},_createCornerSlice:function(C,D,G,A){var E=document.createElement("span");var B=E.style;B.backgroundColor=C;B.display="block";B.height="1px";B.overflow="hidden";B.fontSize="1px";var F=this._borderColor(C,D);if(this.options.border&&G==0){B.borderTopStyle="solid";B.borderTopWidth="1px";B.borderLeftWidth="0px";B.borderRightWidth="0px";B.borderBottomWidth="0px";B.height="0px";B.borderColor=F}else{if(F){B.borderColor=F;B.borderStyle="solid";B.borderWidth="0px 1px"}}if(!this.options.compact&&(G==(this.options.numSlices-1))){B.height="2px"}this._setMargin(E,G,A);this._setBorder(E,G,A);return E},_setOptions:function(A){this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false};Object.extend(this.options,A||{});this.options.numSlices=this.options.compact?2:4;if(this._isTransparent()){this.options.blend=false}},_whichSideTop:function(){if(this._hasString(this.options.corners,"all","top")){return""}if(this.options.corners.indexOf("tl")>=0&&this.options.corners.indexOf("tr")>=0){return""}if(this.options.corners.indexOf("tl")>=0){return"left"}else{if(this.options.corners.indexOf("tr")>=0){return"right"}}return""},_whichSideBottom:function(){if(this._hasString(this.options.corners,"all","bottom")){return""}if(this.options.corners.indexOf("bl")>=0&&this.options.corners.indexOf("br")>=0){return""}if(this.options.corners.indexOf("bl")>=0){return"left"}else{if(this.options.corners.indexOf("br")>=0){return"right"}}return""},_borderColor:function(A,B){if(A=="transparent"){return B}else{if(this.options.border){return this.options.border}else{if(this.options.blend){return this._blend(B,A)}else{return""}}}},_setMargin:function(D,E,B){var C=this._marginSize(E);var A=B=="top"?this._whichSideTop():this._whichSideBottom();if(A=="left"){D.style.marginLeft=C+"px";D.style.marginRight="0px"}else{if(A=="right"){D.style.marginRight=C+"px";D.style.marginLeft="0px"}else{D.style.marginLeft=C+"px";D.style.marginRight=C+"px"}}},_setBorder:function(D,E,B){var C=this._borderSize(E);var A=B=="top"?this._whichSideTop():this._whichSideBottom();if(A=="left"){D.style.borderLeftWidth=C+"px";D.style.borderRightWidth="0px"}else{if(A=="right"){D.style.borderRightWidth=C+"px";D.style.borderLeftWidth="0px"}else{D.style.borderLeftWidth=C+"px";D.style.borderRightWidth=C+"px"}}if(this.options.border!=false){D.style.borderLeftWidth=C+"px"}D.style.borderRightWidth=C+"px"},_marginSize:function(E){if(this._isTransparent()){return 0}var D=[5,3,2,1];var A=[3,2,1,0];var C=[2,1];var B=[1,0];if(this.options.compact&&this.options.blend){return B[E]}else{if(this.options.compact){return C[E]}else{if(this.options.blend){return A[E]}else{return D[E]}}}},_borderSize:function(E){var D=[5,3,2,1];var B=[2,1,1,1];var A=[1,0];var C=[0,2,0,0];if(this.options.compact&&(this.options.blend||this._isTransparent())){return 1}else{if(this.options.compact){return A[E]}else{if(this.options.blend){return B[E]}else{if(this.options.border){return C[E]}else{if(this._isTransparent()){return D[E]}}}}}return 0},_hasString:function(B){for(var A=1;A<arguments.length;A++){if(B.indexOf(arguments[A])>=0){return true}}return false},_blend:function(C,A){var B=Rico.Color.createFromHex(C);B.blend(Rico.Color.createFromHex(A));return B},_background:function(A){try{return Rico.Color.createColorFromBackground(A).asHex()}catch(B){return"#ffffff"}},_isTransparent:function(){return this.options.color=="transparent"},_isTopRounded:function(){return this._hasString(this.options.corners,"all","top","tl","tr")},_isBottomRounded:function(){return this._hasString(this.options.corners,"all","bottom","bl","br")},_hasSingleTextChild:function(A){return A.childNodes.length==1&&A.childNodes[0].nodeType==3}};var RicoUtil={getElementsComputedStyle:function(D,A,B){if(arguments.length==2){B=A}var C=$(D);if(C.currentStyle){return C.currentStyle[A]}else{return document.defaultView.getComputedStyle(C,null).getPropertyValue(B)}},createXmlDocument:function(){if(document.implementation&&document.implementation.createDocument){var A=document.implementation.createDocument("","",null);if(A.readyState==null){A.readyState=1;A.addEventListener("load",function(){A.readyState=4;if(typeof A.onreadystatechange=="function"){A.onreadystatechange()}},false)}return A}if(window.ActiveXObject){return Try.these(function(){return new ActiveXObject("MSXML2.DomDocument")},function(){return new ActiveXObject("Microsoft.DomDocument")},function(){return new ActiveXObject("MSXML.DomDocument")},function(){return new ActiveXObject("MSXML3.DomDocument")})||false}return null},getContentAsString:function(A){return A.xml!=undefined?this._getContentAsStringIE(A):this._getContentAsStringMozilla(A)},_getContentAsStringIE:function(A){var C="";for(var B=0;B<A.childNodes.length;B++){var D=A.childNodes[B];if(D.nodeType==4){C+=D.nodeValue}else{C+=D.xml}}return C},_getContentAsStringMozilla:function(B){var A=new XMLSerializer();var D="";for(var C=0;C<B.childNodes.length;C++){var E=B.childNodes[C];if(E.nodeType==4){D+=E.nodeValue}else{D+=A.serializeToString(E)}}return D},toViewportPosition:function(A){return this._toAbsolute(A,true)},toDocumentPosition:function(A){return this._toAbsolute(A,false)},_toAbsolute:function(B,E){if(navigator.userAgent.toLowerCase().indexOf("msie")==-1){return this._toAbsoluteMozilla(B,E)}var A=0;var G=0;var D=B;while(D){var C=0;var F=0;if(D!=B){var C=parseInt(this.getElementsComputedStyle(D,"borderLeftWidth"));var F=parseInt(this.getElementsComputedStyle(D,"borderTopWidth"));C=isNaN(C)?0:C;F=isNaN(F)?0:F}A+=D.offsetLeft-D.scrollLeft+C;G+=D.offsetTop-D.scrollTop+F;D=D.offsetParent}if(E){A-=this.docScrollLeft();G-=this.docScrollTop()}return{x:A,y:G}},_toAbsoluteMozilla:function(B,D){var A=0;var E=0;var C=B;while(C){A+=C.offsetLeft;E+=C.offsetTop;C=C.offsetParent}C=B;while(C&&C!=document.body&&C!=document.documentElement){if(C.scrollLeft){A-=C.scrollLeft}if(C.scrollTop){E-=C.scrollTop}C=C.parentNode}if(D){A-=this.docScrollLeft();E-=this.docScrollTop()}return{x:A,y:E}},docScrollLeft:function(){if(window.pageXOffset){return window.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollLeft){return document.documentElement.scrollLeft}else{if(document.body){return document.body.scrollLeft}else{return 0}}}},docScrollTop:function(){if(window.pageYOffset){return window.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){return document.documentElement.scrollTop}else{if(document.body){return document.body.scrollTop}else{return 0}}}}};
