if(typeof Prototype=="undefined")throw"Rico requires the Prototype JavaScript framework"; var Rico={Version:"1.1.2",prototypeVersion:parseFloat(Prototype.Version.split(".")[0]+"."+Prototype.Version.split(".")[1]),init:function(){for(var a=document.getElementsByTagName("script"),b=0;b<a.length;b++)if(a[b].src){var c=a[b].src.toLowerCase();if(c.indexOf("ricocommon.js")!=-1){this.jsDir=c=c.substring(0,c.lastIndexOf("/")+1);this.cssDir=c.replace(/js\/$/,"css/");this.imgDir=c.replace(/js\/$/,"images/");break}}}}; if(Rico.prototypeVersion<1.3)throw"Rico requires Prototype JavaScript framework version 1.3 or greater";Rico.init();Rico.ArrayExtensions=[];if(!Object.prototype.extend)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(a){for(var b=0;b<this.length;b++)if(this[b]==a){this.remove(b);break}};Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.removeItem} if(!Array.prototype.pushHTMLCollection){Array.prototype.pushHTMLCollection=function(a){for(var b=0;b<a.length;b++)this.push(a.item(b))};Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.pushHTMLCollection} if(!Array.prototype.indices){Array.prototype.indices=function(){var a=[];for(index in this){for(var b=false,c=0;c<Rico.ArrayExtensions.length;c++)if(this[index]==Rico.ArrayExtensions[c]){b=true;break}b||(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(a){for(a=(new DOMParser).parseFromString(a,"text/xml");this.hasChildNodes();)this.removeChild(this.lastChild);for(var b=0;b<a.childNodes.length;b++)this.appendChild(this.importNode(a.childNodes[b],true))};Document.prototype.__defineGetter__("xml",function(){return(new XMLSerializer).serializeToString(this)})} document.getElementsByTagAndClassName=function(a,b){if(a==null)a="*";var c=document.getElementsByTagName(a)||document.all,d=[];if(b==null)return c;for(var f=0;f<c.length;f++)for(var e=c[f],g=e.className.split(" "),i=0;i<g.length;i++)if(g[i]==b){d.push(e);break}return d}; var RicoUtil={getElementsComputedStyle:function(a,b,c){if(arguments.length==2)c=b;var d=$(a);return d.currentStyle?d.currentStyle[b]:document.defaultView.getComputedStyle(d,null).getPropertyValue(c)},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;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},getInnerText:function(a){if(typeof a=="string")return a;if(typeof a=="undefined")return a;var b=a.childNodes,c=b.length;if(a.innerText)return a.innerText;a="";for(var d=0;d<c;d++)switch(b[d].nodeType){case 1:a+= b[d].tagName.toLowerCase()=="img"?b[d].src:ts_getInnerText(b[d]);break;case 3:a+=b[d].nodeValue}return a},getContentAsString:function(a){return a.xml!=undefined?this._getContentAsStringIE(a):this._getContentAsStringMozilla(a)},_getContentAsStringIE:function(a){for(var b="",c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];b+=d.nodeType==4?d.nodeValue:d.xml}return b},_getContentAsStringMozilla:function(a){for(var b=new XMLSerializer,c="",d=0;d<a.childNodes.length;d++){var f=a.childNodes[d];c+=f.nodeType== 4?f.nodeValue:b.serializeToString(f)}return c},docElement:document.compatMode&&document.compatMode.indexOf("CSS")!=-1?document.documentElement:document.body,windowHeight:function(){return window.innerHeight?innerHeight:this.docElement.clientHeight},windowWidth:function(){return window.innerWidth?innerWidth:this.docElement.clientWidth},toViewportPosition:function(a){return a.all&&!window.opera&&a.currentStyle?this._toAbsolute(a,true):this._toAbsoluteMozilla(a,true)},toDocumentPosition:function(a){return this._toAbsolute(a, false)},_toAbsolute:function(a,b){for(var c=0,d=0,f="",e=a;e;){var g=0,i=0;if(e!=a){g=parseInt(this.getElementsComputedStyle(e,"borderLeftWidth"));i=parseInt(this.getElementsComputedStyle(e,"borderTopWidth"));g=isNaN(g)?0:g;i=isNaN(i)?0:i}f+="/"+e.offsetTop;c+=e.offsetLeft-e.scrollLeft+g;d+=e.offsetTop-e.scrollTop+i;e=e.offsetParent}if(b){c-=this.docScrollLeft();d-=this.docScrollTop()}return{x:c,y:d,ie:1,yaudit:f}},_toAbsoluteMozilla:function(a,b){for(var c=0,d=0,f="",e=a;e;){c+=e.offsetLeft;d+=e.offsetTop; f+="/"+e.tagName+"="+e.offsetLeft;e=e.offsetParent}for(e=a;e&&e!=document.body&&e!=document.documentElement;){if(e.scrollLeft)c-=e.scrollLeft;if(e.scrollTop)d-=e.scrollTop;e=e.parentNode}if(b){c-=this.docScrollLeft();d-=this.docScrollTop()}return{x:c,y:d,ie:0,yaudit:f}},docScrollLeft:function(){return window.pageXOffset?window.pageXOffset:document.documentElement&&document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body?document.body.scrollLeft:0},docScrollTop:function(){return window.pageYOffset? window.pageYOffset:document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body?document.body.scrollTop:0},nan2zero:function(a){return isNaN(a)||typeof a==undefined?0:a},eventKey:function(a){if(typeof a.keyCode=="number")return a.keyCode;else if(typeof a.which=="number")return a.which;else if(typeof a.charCode=="number")return a.charCode;return-1},getPreviosSiblingByTagName:function(a,b){for(var c=a.previousSibling;c;){if(c.tagName==b&&c.style.display!= "none")return c;c=c.previousSibling}return null},getParentByTagName:function(a,b){for(var c=a;c;){if(c.tagName==b)return c;c=c.parentNode}return null},wrapChildren:function(a,b,c,d){d=document.createElement(d?d:"div");if(c)d.id=c;if(b)d.className=b;for(;a.firstChild;)d.appendChild(a.firstChild);a.appendChild(d);return d},formatPosNumber:function(a,b,c,d){a=a.toFixed(b).split(/\./);if(c)for(b=/(\d+)(\d{3})/;b.test(a[0]);)a[0]=a[0].replace(b,"$1"+c+"$2");return a.join(d)},DOMNode_insertAfter:function(a, b){var c=b.parentNode;return c.lastChild==b?c.appendChild(a):c.insertBefore(a,b.nextSibling)},isKonqueror:navigator.userAgent.toLowerCase().indexOf("konqueror")>=0,isSafari:navigator.userAgent.toLowerCase().indexOf("safari")>=0,isOpera:typeof window.opera=="object"&&window.opera!=null,isIE:typeof document.all=="object"&&!window.opera,startTime:new Date,timeStamp:function(){return(new Date).getTime()-this.startTime.getTime()+": "}}; Number.prototype.zf=function(a){for(var b=this.toString();b.length<a;)b="0"+b;return b}; Date.prototype.formatDate=function(a){var b=RicoTranslate.dateFmt,c=this;switch(typeof a){case "object":if(typeof a.dateFmt=="string")b=a.dateFmt;break;case "string":b=a}return b.replace(/(yyyy|mmmm|mmm|mm|dddd|ddd|dd|hh|nn|ss|a\/p)/gi,function(d){switch(d.toLowerCase()){case "yyyy":return c.getFullYear();case "mmmm":return RicoTranslate.monthNames[c.getMonth()];case "mmm":return RicoTranslate.monthNames[c.getMonth()].substr(0,3);case "mm":return(c.getMonth()+1).zf(2);case "dddd":return RicoTranslate.dayNames[c.getDay()]; case "ddd":return RicoTranslate.dayNames[c.getDay()].substr(0,3);case "dd":return c.getDate().zf(2);case "hh":return((h=c.getHours()%12)?h:12).zf(2);case "nn":return c.getMinutes().zf(2);case "ss":return c.getSeconds().zf(2);case "a/p":return c.getHours()<12?"a":"p"}})};String.prototype.formatDate=function(a){var b=this.replace(/-/g,"/");b=new Date(b);return isNaN(b)?this:b.formatDate(a)}; String.prototype.formatNumber=function(a){var b=parseFloat(this);if(isNaN(b))return this;if(typeof a.multiplier=="number")b*=a.multiplier;var c=typeof a.decPlaces=="number"?a.decPlaces:0,d=typeof a.thouSep=="string"?a.thouSep:RicoTranslate.thouSep,f=typeof a.decPoint=="string"?a.decPoint:RicoTranslate.decPoint,e=a.prefix||"",g=a.suffix||"";a=typeof a.negSign=="string"?a.negSign:"L";a=a.toUpperCase();if(b<0){b=RicoUtil.formatPosNumber(-b,c,d,f);if(a=="P")b="("+b+")";b=e+b;if(a=="L")b="-"+b;if(a=="T")b+= "-";a="negNumber"}else{a=b==0?"zeroNumber":"posNumber";b=e+RicoUtil.formatPosNumber(b,c,d,f)}return"<span class='"+a+"'>"+b+g+"</span>"}; var RicoTranslate={phrases:[],thouSep:",",decPoint:".",langCode:"en",re:/^(\W*)\b(.*)\b(\W*)$/,dateFmt:"mm/dd/yyyy",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],addPhrase:function(a,b){this.phrases[a]=b},getPhrase:function(a){a=a.split(/\t/);for(var b,c="",d=0;d<a.length;d++)if(this.re.exec(a[d])){b=this.phrases[RegExp.$2];c+=typeof b=="string"? RegExp.$1+b+RegExp.$3:a[d]}else c+=a[d];return c}};Rico.Shim=Class.create(); Rico.Shim.prototype=RicoUtil.isIE?{initialize:function(){this.ifr=document.createElement("iframe");this.ifr.style.position="absolute";this.ifr.style.display="none";document.body.appendChild(this.ifr)},hide:function(){this.ifr.style.display="none"},show:function(a){this.ifr.style.width=a.offsetWidth;this.ifr.style.height=a.offsetHeight;this.ifr.style.top=a.style.top;this.ifr.style.left=a.style.left;this.ifr.style.zIndex=a.currentStyle.zIndex-1;this.ifr.style.display="block"}}:{initialize:function(){}, hide:function(){},show:function(){}};Rico.Menu=Class.create(); Rico.Menu.prototype={initialize:function(a,b,c){this.defaultMenuWidth=typeof a=="string"?a:"15em";this.hideOnEscape=typeof b=="boolean"?b:true;this.hideOnClick=typeof c=="boolean"?c:true;this.hideFunc=null},createDiv:function(){if(!this.div){this.div=document.createElement("div");this.div.className="ricoMenu";this.div.style.position="absolute";this.div.style.width=this.defaultMenuWidth;document.body.appendChild(this.div);this.width=this.div.offsetWidth;this.shim=new Rico.Shim;this.hidemenu();if(this.hideOnClick){Event.observe(this.div, "click",this.ignoreClick.bindAsEventListener(this),false);Event.observe(document,"click",this.cancelmenu.bindAsEventListener(this),false)}this.hideOnEscape&&Event.observe(document,"keyup",this.checkKey.bindAsEventListener(this),false)}},ignoreClick:function(a){Event.stop(a);return false},checkKey:function(a){RicoUtil.eventKey(a)==27&&this.cancelmenu(a);return true},showmenu:function(a,b){Event.stop(a);this.hideFunc=b;if(this.div.childNodes.length==0){this.cancelmenu();return false}var c=RicoUtil.docScrollLeft()+ a.clientX;if(a.clientX+this.width>RicoUtil.windowWidth())c-=this.width;this.div.style.left=c+"px";c=RicoUtil.docScrollTop()+a.clientY;this.div.style.top=c+"px";this.div.style.display="block";var d=this.div.offsetHeight;if(a.clientY+d>RicoUtil.windowHeight()){c=Math.max(c-d,0);this.div.style.top=c+"px"}this.shim.show(this.div);return false},clearMenu:function(){this.div.innerHTML="";this.defaultAction=null},addMenuHeading:function(a,b){var c=document.createElement("div");c.innerHTML=b==null||b==true? RicoTranslate.getPhrase(a):a;c.className="ricoMenuHeading";this.div.appendChild(c)},addMenuBreak:function(){var a=document.createElement("div");a.className="ricoMenuBreak";this.div.appendChild(a)},addMenuItem:function(a,b,c,d,f){var e=document.createElement("a");if(arguments.length<3||c){switch(typeof b){case "function":e.href="#";e.onclick=b;break;case "string":e.href=b}e.className="enabled";if(this.defaultAction==null)this.defaultAction=b}else{e.disabled=true;e.className="disabled"}e.innerHTML= f==null||f==true?RicoTranslate.getPhrase(a):a;if(d!=null)e.title=f==null||f==true?RicoTranslate.getPhrase(d):d;this.div.appendChild(e)},isVisible:function(){return this.div&&this.div.style.display!="none"},cancelmenu:function(){this.hideFunc&&this.hideFunc();this.hidemenu()},hidemenu:function(){if(this.div){this.shim.hide();this.div.style.display="none";this.hideFunc=null}}};
