
(function(){window.Juice={Version:'0.1.1.20080325',$:function(){var a=[];var i,e;for(i=0;i<arguments.length;i++){e=arguments[i];if(typeof e=='string'){e=document.getElementById(e);}
if(arguments.length===1){return e;}
a.push(e);}
return a;},Bookmark:function(ele,e){Juice.Event.cancel(e);var w=window;if(w.sidebar){w.sidebar.addPanel(ele.title,ele.href,'');}else if(w.opera&&w.print){ele.rel='sidebar';}else if(w.external){w.external.AddFavorite(ele.href,ele.title);}else{alert('Your Browser does not support dynamic bookmarking, please try bookmarking manually.');}
return false;},Browser:new function(){this.detect=function(){var a=navigator.userAgent,b={};b.opera=(a.indexOf('Opera')!=-1);b.konqueror=(a.indexOf('Konqueror')!=-1);b.safari=(a.indexOf('Safari')!=-1);b.mozilla=(a.indexOf('Gecko')!=-1&&!b.konqueror&&!b.safari);b.ie7=(a.indexOf('MSIE 7')!=-1&&!b.opera);b.ie6=(a.indexOf('MSIE')!=-1&&!b.ie7&&!b.opera);b.ie=(b.ie7||b.ie6);b.quirks=(this.mode()=='quirks'?true:false);return b;};this.details=function(){var n=navigator;return{agent:n.userAgent,code:n.appCodeName,cookies:n.cookieEnabled,name:n.appName,platform:n.platform,version:n.appVersion};};this.dimensions=function(){var s={width:0,height:0};if(typeof window.innerWidth=='number'){s.width=window.innerWidth;s.height=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){s.width=document.documentElement.clientWidth;s.height=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){s.width=document.body.clientWidth;s.height=document.body.clientHeight;}
return s;};this.flash=function(){var c,d,f={enabled:false,version:false},n=navigator;if(n.plugins&&n.plugins.length){c=n.plugins['Shockwave Flash'];if(c){f.enabled=true;if(c.description){d=d.description;f.version=d.charAt(d.indexOf('.')-1);}}}else if(n.mimeTypes&&n.mimeTypes.length){c=n.mimeTypes['application/x-shockwave-flash'];if(c&&d.enabledPlugin){f.enabled=true;}}else{for(var v=9;v>0;v--){try{c=new ActiveXObject('ShockwaveFlash.ShockwaveFlash.'+v);f.enabled=true;f.version=v;break;}catch(e){}}}
return f;};this.inner=function(){var s={x:0,y:0},w=Juice.Browser.dimensions();if(window.innerHeight&&window.scrollMaxY){s.x=document.body.scrollWidth;s.y=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){s.x=document.body.scrollWidth;s.y=document.body.scrollHeight;}else{s.x=document.body.offsetWidth;s.y=document.body.offsetHeight;}
return{width:(s.x<w.width)?w.width:s.x,height:(s.y<w.height)?w.height:s.y};};this.mode=function(){var c,m=false;if(c=document.compatMode){switch(c.toLowerCase()){case'backcompat':m='quirks';break;case'css1compat':m='compliant';break;default:m='hybrid';}}
return m;};},Container:new function(){this.create=function(s){if(!s){s={};}
var c={outer:Juice.Element.create('DIV',null,s.id||null,s.className||null),inner:Juice.Element.create('DIV',s.value||null,null,'inner'),shadow:Juice.Element.create('DIV')};c.outer.style.zIndex=s.zIndex||1;c.outer.style.position=s.fixed===true?'relative':'absolute';if(s.width){c.outer.style.width=s.width+'px';}
c.inner.style.border='1px solid '+(s.border||'#808080');c.inner.style.background=s.background||'white';if(s.padding){c.inner.style.padding=s.padding+'px';}
if(s.height){c.inner.style.height=(s.height-(s.padding?s.padding*2:0)-2)+'px';}
c.shadow.style.position='absolute';c.shadow.style.background=s.shadow||'#999999';c.shadow.style.zIndex=-1;c.shadow.style.top='2px';c.shadow.style.right=c.shadow.style.bottom=c.shadow.style.left='-3px';Juice.Element.opacity(c.shadow,s.opacity||30);Juice.Element.append(c.outer,[c.inner,c.shadow]);return c;};this.render=function(c,e){if(!e){e=document.body;}
e.appendChild(c.outer);Juice.Container.fix(c);};this.fix=function(c){if(c&&(Juice.Browser.detect().ie6||Juice.Browser.detect().quirks)){var d=Juice.Element.dimensions(c.outer);c.shadow.style.width=d.width+6+'px';c.shadow.style.height=d.height+1+'px';Juice.Element.obstructions(c.outer);}};},Convert:new function(){this.namehex=function(n){var c={'aqua':'#00FFFF','black':'#000000','blue':'#0000FF','fuchsia':'#FF00FF','gray':'#808080','green':'#008000','lime':'#00FF00','maroon':'#800000','navy':'#000080','olive':'#808000','purple':'#800080','red':'#FF0000','silver':'#C0C0C0','teal':'#008080','white':'#FFFFFF','yellow':'#FFFF00'};if(c[n]){return c[n];}
return false;};this.hexrgb=function(h){if(!Juice.Type.hexColour(h)){h=this.namehex(h);}
if(!Juice.Type.hexColour(h)){return;}
var x=new RegExp('^#?([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$','i'),m=false;if(m=h.match(x)){return{r:parseInt(m[1],16),g:parseInt(m[2],16),b:parseInt(m[3],16)};}else{Juice.Debug(new Error('Juice.Core: Invalid hex value: '+h));}
return false;};this.hsvrgb=function(h,s,v){var r,g,b;if(s==0){if(v==0){r=g=b=0;}else{r=g=b=parseInt(v*255/100);}}else{if(h==360){h=0;}
h/=60,s/=100,v/=100;var i=parseInt(h);var f=h-i;var p=v*(1-s);var q=v*(1-(s*f));var t=v*(1-(s*(1-f)));switch(i){case 0:r=v;g=t;b=p;break;case 1:r=q;g=v;b=p;break;case 2:r=p;g=v;b=t;break;case 3:r=p;g=q;b=v;break;case 4:r=t;g=p;b=v;break;case 5:r=v;g=p;b=q;break;}
r=parseInt(r*255);g=parseInt(g*255);b=parseInt(b*255);}
return{r:r,g:g,b:b};};this.rgbhex=function(r,g,b){var hex='',i;for(i=0;i<arguments.length;i++){hex+=Juice.Format.pad(parseInt(arguments[i]).toString(16),2);}
if(Juice.Type.hexColour(hex)){return'#'+hex;}else{return false;}};this.rgbhsv=function(r,g,b){var h,s,v,min,delta;min=Math.min(r,g,b);v=Math.max(r,g,b);delta=v-min;s=v==0?0:(delta/v)*100;if(s==0){h=0;}else{if(r==v){h=60*(g-b)/delta;}else{if(g==v){h=120+60*(b-r)/delta;}else{h=240+60*(r-g)/delta;}}}
if(h<0){h=h+360;}
return{h:h,s:s,v:(v/255)*100};};this.fullrgbhex=function(r){var x=new RegExp('^rgb\\(([0-9]{3}), ([0-9]{3}), ([0-9]{3})\\)'),m=false;if(m=r.toLowerCase().match(x)){return this.rgbhex(m[1],m[2],m[3]);}
return false;};},Debug:function(e){if(Juice.Prefs.debug===true){throw e;}},Element:new function(){this.addClassName=function(e,n,c){if((typeof c=='boolean')&&c!==true){alert('not added');return false;}
if(!this.hasClassName(e,n)){e.className+=' '+n;}else{return false;}
return true;};this.append=function(p,c){if(Juice.Type.array(c)){for(var i=0;i<c.length;i++){p.appendChild(c[i]);}}else{p.appendChild(c);}};this.blur=function(){return window.focus();};this.byClassName=function(c,e){if(!e){e=document;}
var a=[];var n=e.getElementsByTagName('*');var i;for(i=0;i<n.length;i++){if(this.hasClassName(n[i],c)){a.push(n[i]);}}
return a;};this.contains=function(p,c){while(c!=document){if(c==p){return true;}
c=c.parentNode;}
return false;};this.create=function(t,h,i,c,n){if(!t){return false;}
var p,s;if((p=t.indexOf(':'))!==-1){s=t.substring(p+1,t.length);t=t.substring(0,p);}
var e=document.createElement(t.toUpperCase());if(i){e.id=i;}
if(c){e.className=c;}
switch(e.nodeName){case'A':if(h){e.innerHTML=h;}
if(n){e.href=n;}
break;case'IFRAME':if(h){e.src=h;}
if(n){e.name=n;}
break;case'IMG':if(h){e.src=h;}
break;case'INPUT':e.type=s;if(h){e.value=h;}
if(n){e.name=n;}
break;case'OPTION':if(h){e.innerHTML=h;e.value=n||n==''?n:h;}
break;case'SELECT':if(n){e.name=n;}
break;default:if(h){e.innerHTML=h;}}
return e;};this.dimensions=function(ele){var s={height:0,width:0};if(ele.offsetHeight){s.height=ele.offsetHeight;s.width=ele.offsetWidth;}else{s.height=ele.style.pixelHeight;s.width=ele.style.pixelWidth;}
return s;};this.empty=function(e){var c=Juice.$(e);if(c.hasChildNodes()){while(c.hasChildNodes()){c.removeChild(c.firstChild);}}};this.hasClassName=function(e,c){var x=new RegExp('\\b'+c+'\\b','ig');if(e.className&&e.className.match(x)){return true;}
return false;};this.insertAtCaret=function(n,b,a){n=Juice.$(n);if(n.nodeName=='TEXTAREA'){n.focus();if(!a){a='';}
if(document.selection){var r=document.selection.createRange();if(r.parentElement()!=n){return false;}
r.text=b+r.text+a;r.moveStart('character',r.text.length-a.length);r.moveEnd('character',r.text.length-(a.length>0?b.length-a.length:0));r.select();}else if(n.selectionStart>=0){var s=n.selectionStart,e=n.selectionEnd,c=b+n.value.substring(s,e)+a;if(c!=b+a){n.value=n.value.substring(0,s)+c+n.value.substring(e,n.value.length);n.setSelectionRange(s+c.length,s+c.length);}else{;n.value=n.value.substring(0,s)+b+a+n.value.substr(e);n.setSelectionRange(s+b.length,s+c.length-a.length);}}else{n.value=n.value+b+a;}
n.focus();}
return;};this.nextNode=function(n,t){n=Juice.$(n);if(n.firstChild){n=n.firstChild;}else if(n.nextSibling){n=n.nextSibling;}else if(n.parentNode!=t){while((n=n.parentNode)&&n!=t){if(n.nextSibling){n=n.nextSibling;break;}}}else{return null;}
if(n==t){return null;}
if(n!=null){if(n.nodeType!=1){n=this.nextNode(n,t);}}
return n;};this.prevNode=function(n,t){n=Juice.$(n);if(n.lastChild){n=n.lastChild;}else if(n.previousSibling){n=n.previousSibling;}else if(n.parentNode!=t){while((n=n.parentNode)&&n!=t){if(n.previousSibling){n=n.previousSibling;break;}}}else{return null;}
if(n==t){return null;}
if(n!=null){if(n.nodeType!=1){n=this.prevNode(n,t);}}
return n;};this.obstructions=function(n){if(Juice.Browser.detect().ie6){if(n.firstChild&&n.firstChild.className=='JuiceObstruction'){n.removeChild(n.firstChild);}
var d=Juice.Element.dimensions(n);var f=Juice.Element.create('IFRAME');f.src='about:blank';f.className='JuiceObstruction';f.scrolling='no';f.frameBorder=0;f.style.width=d.width+'px';f.style.height=d.height+'px';f.style.zIndex=-1;f.style.position='absolute';f.style.filter='filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';if(n.firstChild){n.insertBefore(f,n.firstChild);}else{n.appendChild(f);}
n.style.zIndex=900;}};this.opacity=function(e,o){e.style.opacity=e.style.MozOpacity=e.style.KHTMLOpacity=(o/100);e.style.filter='alpha(opacity='+o+')';return true;};this.output=function(e){if(typeof e=='string'){if(e.indexOf('#')!=-1){return(document.getElementById(e)||false);}else{return(document.getElementsByTagName(e).item(0)||false);}}
return false;};this.position=function(e){if(!e){return false;}
var p={top:0,left:0};if(e.offsetParent){p.top=e.offsetTop;p.left=e.offsetLeft;while(e.offsetParent){e=e.offsetParent;p.top+=e.offsetTop;p.left+=e.offsetLeft;}}
return p;};this.remove=function(a,v){for(var i=0;i<a.length;i++){if(v==a[i]){a.splice(i,1);}}
return a;};this.removeClassName=function(e,c){if(this.hasClassName(e,c)){e.className=Juice.Format.trim(e.className.replace(new RegExp('\\b'+c+'\\b','ig'),''));}else{return false;}
return true;};this.replaceClassName=function(e,c,r){if(this.hasClassName(e,c)){Juice.Element.removeClassName(e,c);Juice.Element.addClassName(e,r);}else{return false;}
return true;};this.scroll=function(e){var p={top:0,left:0};if(e){for(var n=e;n;n=n.offsetParent){p.top+=n.offsetTop;p.left+=n.offsetLeft;}}else{var w=window,d=document;if(typeof w.pageYOffset=='number'){p.top=w.pageYOffset;p.left=w.pageXOffset;}else if(d.body&&d.body.scrollTop){p.top=d.body.scrollTop;p.left=d.body.scrollLeft;}else if(d.documentElement&&d.documentElement.scrollTop){p.top=d.documentElement.scrollTop;p.left=d.documentElement.scrollLeft;}}
return p;};this.scrollTo=function(n,e,p){if(e){Juice.Event.cancel(e);}
var o,a,r=1,d=3,s=this.scroll(),f=this.scroll(Juice.$(n));if(s.top<f.top){o=s.top+Math.max(r,((f.top-s.top)/d));a=(f.top-r<=o);}else{o=s.top-Math.max(r,((s.top-f.top)/d));a=(f.top-r>=o);}
if(a||s.top==f.top||p==o){window.scrollTo(0,f.top);}else{window.scrollTo(0,o);setTimeout(function(){Juice.Element.scrollTo(n,false,o);},50);}};this.search=function(n,h){if(typeof h!='object'){return false;}
for(var i=0;i<h.length;i++){if(h[i]==n){return true;}}
return false;};this.searchReplace=function(t,s,r){return t.replace(new RegExp(s,'ig'),r);};this.style=function(e,s){if(!Juice.Browser.detect().ie){s=s.replace(new RegExp('[A-Z]','g'),function(m,c){return'-'+s.charAt(c).toLowerCase();});}
if(e.currentStyle){return e.currentStyle[s];}else if(window.getComputedStyle){return document.defaultView.getComputedStyle(e,null).getPropertyValue(s);}
return false;};this.toggle=function(e){var c=Juice.$(e);if(c.style.display!='none'){c.style.display='none';}else{c.style.display='';}};},Event:new function(){this.add=function(e,n,o,c){e=Juice.$(e);if(e.addEventListener){e.addEventListener(n,o,c);}else if(e.attachEvent){e.attachEvent('on'+n,o);}else{return false;}
return true;};this.blur=function(e,l){var n=Juice.Event.source(e);while(n!=document){if(n==l){break;}
n=n.parentNode;}
if(n!=l){return true;}
return false;};this.cancel=function(e){if(!e){return false;}
e=e||window.event;if(e.stopPropagation){e.preventDefault();e.stopPropagation();}else{e.returnValue=false;e.cancelBubble=true;}
return true;};this.remove=function(e,n,o,c){e=Juice.$(e);if(e.removeEventListener){e.removeEventListener(n,o,c);}else if(e.detachEvent){e.detachEvent('on'+n,o);}else{return false;}
return true;};this.key=function(e){e=e||window.event;if(!e)return;var k=e.keyCode||e.which||null;return{code:k,value:String.fromCharCode(k).toLowerCase()};};this.mouse=function(e){e=e||window.event,d=document.body;var p={left:0,top:0};if(e.pageX||e.pageY){p.left=e.pageX;p.top=e.pageY;}else if(e.clientX||e.clientY){var s=Juice.Element.scroll();p.left=e.clientX+s.left;p.top=e.clientY+s.top;}
return p;};this.preload=function(s){var image=new Image();if(typeof s=='object'){for(var i in s){image.src=s[i];}}else{image.src=s;}};this.source=function(e){e=e||window.event;return(e.target||e.srcElement);};this.type=function(e){e=e||window.event;return(e.type);};},Format:new function(){this.decode=function(v){return decodeURIComponent(v);};this.email=function(r,d,e){var a=r+'@'+d+e;return'<a href="mailto:'+a+'">'+a+'</a>';};this.encode=function(v){return encodeURIComponent(v);};this.stripTags=function(s){return s.value.replace(/<\S[^><]*>/g,'');};this.entities=function(t){var d=document.createElement('DIV');d.appendChild(document.createTextNode(t));return d.innerHTML;};this.implode=function(s,a){if(Juice.Type.array(a)){return a.join(s);}
return false;};this.ltrim=function(s){while(s.substr(0,1)==' '){s=s.substring(1,s.length);}
return s;};this.number=function(n,d,p,g){var ns=n.toString();var s=n<0?'-':'';if(d){n=this.round(n,d);}
var i=(n>0?Math.floor(n):Math.abs(Math.ceil(n))).toString();p=p?p:'.';var f=n.toString().substring(i.length+s.length);if(f=d||f.length>1?(p+f.substring(1)):''){for(var j=f.length-1;j<d;j++){f+='0';}}
if(g=(g&&g!=p)?g:','){for(var j=i.length-3;j>0;j-=3){i=i.substring(0,j)+g+i.substring(j);}}
return s+i+f;};this.pad=function(v,l,c){var s=''+v;if(!c){c='0';}
while(s.length<l){s=c+s;}
return s;};this.querySting=function(a){var u='';for(var i in a){u+=(!u.length?'?':'&')+this.encode(i)+'='+this.encode(a[i]);}
return u;};this.random=function(l,u){if(!l||!u){l=1;u=99999;}
return Math.floor(Math.random()*(u-l+1)+l);};this.round=function(n,d){if(Juice.Type.number(n)){var m=Math.pow(10,d);return Math.round(n*m)/m;}
return n;};this.rtrim=function(s){while(s.substr(s.length-1,1)==' '){s=s.substring(0,s.length-1);}
return s;};this.trim=function(s){return this.rtrim(this.ltrim(s));};},Type:new function(){this.array=function(o){return(o instanceof Array?true:false);};this.callback=function(v){return(typeof v=='function'?true:false);};this.hexColour=function(v){if(v){return v.match(new RegExp('^#?([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$','i'))?true:false;}
return false;};this.number=function(v){return(!isNaN(v)?true:false);};},Window:new function(){this.open=function(url,focus){var win=window.open(url);if(focus){win.focus();}
return win;};},Prefs:{container:'body',debug:false,image:'/includes/library/juice/images/'}}})();
(function(){if(typeof Juice=='undefined'){throw new Error('ajax.juice.js requires the core.juice.js component.');}
Juice.Ajax=function(){var xhttpo,timer,myself=this;this.setup=function(){try{xhttpo=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{xhttpo=new ActiveXObject('Microsoft.XMLHTTP');}catch(e){xhttpo=false;}}
if((!xhttpo)&&(typeof XMLHttpRequest!='undefined')){try{xhttpo=new XMLHttpRequest();}catch(e){xhttpo=false;myself.error('XHTTP object could not be created');}}};this.request=function(url,method,cache,timeout){if(!xhttpo){return false;}
var params;if(!url){myself.error('No request url supplied');}
if(!method){method='GET';}
method=method.toUpperCase();timeout=typeof timeout=='number'?timeout:false;if(method=='POST'){var position=url.indexOf('?');if(position!==-1){this.page=url.substring(0,position);this.url=cache?this.page:myself.nocache(this.page);this.params=url.substring(position+1,url.length);}else{this.url=allowCache?url:myself.nocache(url);}
this.method='POST';this.contentType='application/x-www-form-urlencoded;';}else{this.method='GET';this.url=cache?url:myself.nocache(url);this.params=false;this.contentType='text/plain';}
try{xhttpo.open(this.method,this.url,true);xhttpo.setRequestHeader('Content-Type',this.contentType);if(this.contentLength)xhttpo.setRequestHeader('Content-Length',this.contentLength);xhttpo.onreadystatechange=myself.response;xhttpo.send(this.params);if(timeout)timer=setTimeout(this.abort,(timeout*1000));}catch(e){myself.error(e);}};this.abort=function(){xhttpo.abort();myself.error('Request aborted');};this.response=function(){if(xhttpo.readyState!=4){return;}
if(timer){clearTimeout(timer);}
try{if(xhttpo.status=='200'){if(xhttpo.responseText){return myself.ready(xhttpo.responseText);}else{myself.error('No response text defined.');}}else{myself.error('Request URL responded with a '+xhttpo.status+' status');}}catch(e){myself.error(e);}};this.evaluate=function(res){try{return eval('res = '+res);}catch(e){myself.error('Response could not be evaluated');}
return false;};this.error=function(err){Juice.Debug(new Error('Juice.Ajax: '+err));};this.nocache=function(url){var preventCache='nocache='+new Date().getTime();if(url.indexOf('?')!==-1){url+='&'+preventCache;}else{url+='?'+preventCache;}
return url;};this.encode=function(values){return Juice.Format.encode(values);};this.setup();}})();
(function(){if(typeof Juice=='undefined'){throw new Error('suggest.juice.js requires the core.juice.js component.');}else if(typeof Juice.Ajax=='undefined'){throw new Error('suggest.juice.js requires the ajax.juice.js component.');}
Juice.Suggest=function(node,url,setup){var suggest,container,previous,xhr,myself=this;this.setup=function(){node=Juice.$(node);suggest={input:node,name:node.name||'value',url:url,items:[],maxHeight:setup.maxHeight||150,current:false,minLength:setup.minLength||0,visible:true};suggest.input.setAttribute('autocomplete','off');container=Juice.Container.create({className:'juiceSuggest'});container.outer.style.visibility='hidden';Juice.Event.add(suggest.input,'keyup',myself.call);Juice.Event.add(suggest.input,'keypress',myself.call);Juice.Event.add(suggest.input,'focus',myself.display);Juice.Event.add(suggest.input,'blur',myself.hide);Juice.Event.add(window,'resize',myself.position);};this.display=function(){if(suggest.items.length>0){Juice.Container.render(container);myself.position();Juice.Container.fix(container);setTimeout(function(){container.outer.style.visibility='visible';},100);suggest.visible=true;}};this.call=function(e){var key=Juice.Event.key(e);if(Juice.Element.search(key.code,[9,13,27,32,38,40])){if(suggest.visible==false){return;}
if(key.code!=32){Juice.Event.cancel(e);}
var current=suggest.items[suggest.current];switch(key.code){case 38:if(Juice.Event.type(e)=='keyup'){var p=suggest.current-1;myself.hover(suggest.items[(p<0?suggest.items.length-1:p)].option);}
break;case 40:if(Juice.Event.type(e)=='keyup'){var n=suggest.current?parseInt(suggest.current)+1:0;myself.hover(suggest.items[(n>=suggest.items.length?0:n)].option);}
break;case 9:case 13:case 32:if(current){myself.select(current.value+(key.code==32?' ':''));}
default:myself.hide();}
return;}
if(suggest.input.value.length>=suggest.minLength){if(xhr){xhr.abort();previous=false;}
container.outer.style.visibility='hidden';setTimeout(function(){if(suggest.input.value!=previous){previous=suggest.input.value;xhr=new Juice.Ajax();xhr.ready=function(res){res=xhr.evaluate(res);myself.clear();myself.show(res.list);}
xhr.request(suggest.url+(suggest.url.indexOf('?')==-1?'?':'&')+suggest.name+'='+xhr.encode(suggest.input.value));}},500);}else{myself.clear();previous=null;}};this.show=function(list){myself.clear();suggest.current=false;if(list.length>0){var option;for(var i in list){option=myself.option(list[i]);}
if(list.length==1){myself.hover(option);}
container.inner.style.height='auto';myself.display();}else{myself.hide();}};this.option=function(option){var value;var item=Juice.Element.create('DIV',null,null,'item');var inner=Juice.Element.create('A',null,null,null,'javascript:void(0);');if(typeof option=='object'){for(var i in option){if(i!='value'){inner.appendChild(Juice.Element.create('SPAN',option[i],null,i));}}
value=option.value;}else{inner.innerHTML=value=option;}
item.appendChild(inner);item.onmousedown=function(e){Juice.Event.cancel(e);myself.select(value);}
item.onmouseover=function(){myself.hover(item);}
suggest.items.push({value:value,option:item});container.inner.appendChild(item);return item;};this.select=function(val){var original=suggest.input.value;suggest.input.value=val;myself.hide();suggest.input.focus();if(Juice.Type.callback(setup.callback)){return setup.callback(val,original);}
return true;};this.hover=function(item){var p={node:Juice.Element.position(suggest.input),dim:Juice.Element.dimensions(suggest.input),inner:Juice.Element.dimensions(container.inner),top:0};for(var i in suggest.items){var height=Juice.Element.dimensions(suggest.items[i].option).height;p.top+=height;if(suggest.items[i].option==item){if(container.inner.scrollTop+p.inner.height<p.top){container.inner.scrollTop=p.top;}else if(container.inner.scrollTop>p.top-height){container.inner.scrollTop=p.top-height;}
suggest.current=i;Juice.Element.addClassName(item,'mouseover');}else{Juice.Element.removeClassName(suggest.items[i].option,'mouseover');}}};this.clear=function(){for(var i in suggest.items){container.inner.removeChild(suggest.items[i].option);}
myself.hide();suggest.items=[];};this.position=function(){var p={node:Juice.Element.position(suggest.input),dim:Juice.Element.dimensions(suggest.input),body:Juice.Browser.inner(),box:Juice.Element.dimensions(container.outer),inner:Juice.Element.dimensions(container.inner)};var l={top:p.node.top+p.dim.height,left:p.node.left};if(l.top+p.box.height>p.body.height){container.outer.style.top=(p.node.top-p.box.height-4)+'px';}else{container.outer.style.top=(l.top+1)+'px';}
container.outer.style.left=(l.left)+'px';container.outer.style.width=(p.inner.width>p.dim.width?'auto':p.dim.width)+'px';if(p.box.height>suggest.maxHeight){container.inner.style.height=suggest.maxHeight+'px';container.inner.style.overflow='auto';}};this.hide=function(){container.outer.style.visibility='hidden';suggest.current=suggest.visible=false;try{container.outer.parentNode.removeChild(container.outer);}catch(e){}};this.setup();}})();
(function(){if(typeof Juice=='undefined'){throw new Error('tooltip.juice.js requires the core.juice.js component.');}
Juice.Tooltip=new function(){var constructor=this;this.init=function(){var ele=Juice.Element.byClassName('juiceTooltip');for(var i=0;i<ele.length;i++){new constructor.create(ele[i]);}};this.create=function(ele){if(!ele||!ele.title){return false;}
var tip,container,pointer,myself=this;this.setup=function(){tip={}
tip.output=Juice.Element.output(Juice.Prefs.container);tip.details=ele.title||ele.alt;tip.offset=5;ele.title=ele.alt='';container=Juice.Element.create('DIV');container.id='tooltip';container.innerHTML=tip.details;container.style.position='absolute';container.style.padding='3px 5px';container.style.background='#222222';container.style.color='white';container.style.fontFamily='arial';container.style.fontSize='11px';container.style.zIndex='999';pointer=Juice.Element.create('DIV');pointer.style.background='url('+Juice.Prefs.image+'tooltip/pointer.gif) 0 0 no-repeat';pointer.style.position='absolute';pointer.style.bottom='-4px';pointer.style.left='5px';pointer.style.width='7px';pointer.style.height='4px';pointer.style.fontSize='0';Juice.Element.append(container,pointer);Juice.Event.add(ele,'mousemove',myself.show);Juice.Event.add(ele,'mouseout',myself.hide);};this.show=function(e){if(!tip.details){return false};myself.check(e);tip.mouse=Juice.Event.mouse(e);tip.output.appendChild(container);var dim=Juice.Element.dimensions(container);var browser=Juice.Browser.dimensions();var scroll=Juice.Element.scroll();var left=tip.mouse.left-(dim.width/2);var top=Juice.Element.position(ele).top-dim.height-tip.offset;if(left<0){left=0;}else if((dim.width+left)>(browser.width+scroll.left)){left=((browser.width+scroll.left)-dim.width)+'px';}
container.style.top=top+'px';container.style.left=left+'px';pointer.style.left=((dim.width/2)-3)+'px';return true;};this.check=function(e){var node=Juice.Event.source(e);while(node!=ele.parentNode){if(node==ele)break;node=node.parentNode;}
if(node!=ele){myself.hide();}};this.hide=function(){Juice.Event.remove(ele,'mousemove',myself.show);Juice.Event.remove(ele,'mouseout',myself.hide);ele.title=ele.alt=tip.details;try{tip.output.removeChild(container);}catch(e){}};Juice.Event.add(ele,'mouseover',myself.setup);return true;};}
Juice.Event.add(window,'load',Juice.Tooltip.init);})();
(function(){if(typeof Juice=='undefined'){throw new Error('crop.juice.js requires the core.juice.js component.');}
Juice.Crop=function(node,setup){var config,click,container,corner={},current,dim,mask={},resize,size={},myself=this;this.setup=function(){node=Juice.$(node);if(!node||node.nodeName!='IMG'){return false;}
if(!setup){setup={};}
dim=Juice.Element.dimensions(node);config={directory:Juice.Prefs.image+'crop/',width:setup.width||Math.floor(dim.width/100*50),height:setup.height||Math.floor(dim.height/100*50),corner:setup.corner||10,fixed:setup.fixed==true?true:false,top:typeof setup.top=='number'?Math.abs(setup.top):false,left:typeof setup.left=='number'?Math.abs(setup.left):false,maxWidth:Math.abs(setup.maxWidth)||false,maxHeight:Math.abs(setup.maxHeight)||false,minWidth:Math.abs(setup.minWidth)||false,minHeight:Math.abs(setup.minHeight)||false};Juice.Event.preload([config.directory+'grab.ico',config.directory+'move.ico']);if(config.minWidth&&config.width<config.minWidth){config.width=config.minWidth;}else if(config.maxWidth&&config.width>config.maxWidth){config.width=config.maxWidth;}
size.top=typeof config.top=='number'?config.top:Math.floor((dim.height-config.height)/2);if(size.top+config.height>dim.height){size.top=dim.height-config.height;}
size.left=typeof setup.left=='number'?setup.left:Math.floor((dim.width-config.width)/2);if(size.left+config.width>dim.width){size.left=dim.width-config.width;}
size.bottom=typeof setup.top=='number'?dim.height-config.height-size.top:Math.floor((dim.height-config.height)/2);size.right=typeof setup.left=='number'?dim.width-config.width-size.left:Math.floor((dim.width-config.width)/2);container=Juice.Element.create('DIV',null,null,'juiceCrop');container.style.position='relative';container.style.width=dim.width+'px';container.style.height=dim.height+'px';container.style.background='url('+node.src+') top left no-repeat';container.style.cursor='url('+config.directory+'grab.ico), default';node.parentNode.insertBefore(container,node);node.parentNode.removeChild(node);mask.top=myself.mask();mask.top.style.top=mask.top.style.left=0;mask.top.style.width=dim.width+'px';mask.right=myself.mask();mask.right.style.right=0;mask.bottom=myself.mask();mask.bottom.style.bottom=mask.bottom.style.left=0;mask.bottom.style.width=dim.width+'px';mask.left=myself.mask();mask.left.style.left=0;mask.top.style.cursor=mask.right.style.cursor=mask.bottom.style.cursor=mask.left.style.cursor='default';Juice.Element.append(container,[mask.top,mask.right,mask.bottom,mask.left]);Juice.Event.add(container,'mousedown',myself.pickup);if(config.fixed==false){corner.tl=myself.corner();corner.tl.style.borderWidth='0 1px 1px 0';corner.tl.style.cursor='nw-resize';corner.tr=myself.corner();corner.tr.style.borderWidth='0 0 1px 1px';corner.tr.style.cursor='ne-resize';corner.br=myself.corner();corner.br.style.borderWidth='1px 0 0 1px';corner.br.style.cursor='se-resize';corner.bl=myself.corner();corner.bl.style.borderWidth='1px 1px 0 0';corner.bl.style.cursor='sw-resize';Juice.Element.append(container,[corner.tl,corner.tr,corner.br,corner.bl]);Juice.Event.add(corner.tl,'mousedown',myself.resize);Juice.Event.add(corner.tr,'mousedown',myself.resize);Juice.Event.add(corner.br,'mousedown',myself.resize);Juice.Event.add(corner.bl,'mousedown',myself.resize);}
myself.position();};this.mask=function(){var mask=Juice.Element.create('DIV');mask.style.backgroundColor='black';mask.style.position='absolute';Juice.Element.opacity(mask,50);return mask;};this.corner=function(){var corner=Juice.Element.create('DIV');corner.style.backgroundColor='white';corner.style.position='absolute';corner.style.borderColor='black';corner.style.borderStyle='solid';corner.style.borderWidth=0;corner.style.width=corner.style.height=config.corner+'px';Juice.Element.opacity(corner,50);return corner;};this.resize=function(e){Juice.Event.cancel(e);var down=Juice.Event.mouse(e);var pos=Juice.Element.position(container);click={left:(down.left-pos.left),top:(down.top-pos.top)};myself.highlight();current=Juice.Event.source(e);Juice.Event.add(document,'mousemove',myself.scale);Juice.Event.add(document,'mouseup',myself.stop);Juice.Event.add(document,'selectstart',myself.noselect);Juice.Event.add(document,'mousedown',myself.noselect);};this.scale=function(e){Juice.Event.cancel(e);var mouse=Juice.Event.mouse(e);var pos=Juice.Element.position(container);var drag={left:(mouse.left-pos.left)-click.left,top:(mouse.top-pos.top)-click.top};resize={top:parseInt(mask.top.style.height),bottom:parseInt(mask.bottom.style.height),left:parseInt(mask.left.style.width),right:parseInt(mask.right.style.width)};var offset=config.corner*2.5;switch(current){case corner.tl:resize.top=size.top+drag.top;if(config.minHeight&&dim.height-resize.top-resize.bottom<config.minHeight){resize.top=dim.height-resize.bottom-config.minHeight;}else if(config.maxHeight&&dim.height-resize.top-resize.bottom>config.maxHeight){resize.top=dim.height-resize.bottom-config.maxHeight;}else if(resize.top<0){resize.top=0;}else if(resize.top>dim.height-resize.bottom-offset){resize.top=dim.height-resize.bottom-offset;}
resize.left=size.left+drag.left;if(config.minWidth&&dim.width-resize.left-resize.right<config.minWidth){resize.left=dim.width-resize.right-config.minWidth;}else if(config.maxWidth&&dim.width-resize.left-resize.right>config.maxWidth){resize.left=dim.width-resize.right-config.maxWidth;}else if(resize.left<0){resize.left=0;}else if(resize.left>dim.width-resize.right-offset){resize.left=dim.width-resize.right-offset;}
break;case corner.tr:resize.top=size.top+drag.top;if(config.minHeight&&dim.height-resize.top-resize.bottom<config.minHeight){resize.top=dim.height-resize.bottom-config.minHeight;}else if(config.maxHeight&&dim.height-resize.top-resize.bottom>config.maxHeight){resize.top=dim.height-resize.bottom-config.maxHeight;}else if(resize.top<0){resize.top=0;}else if(resize.top>dim.height-resize.bottom-offset){resize.top=dim.height-resize.bottom-offset;}
resize.right=size.right-drag.left;if(config.minWidth&&dim.width-resize.left-resize.right<config.minWidth){resize.right=dim.width-resize.left-config.minWidth;}else if(config.maxWidth&&dim.width-resize.right-resize.left>config.maxWidth){resize.right=dim.width-resize.left-config.maxWidth;}else if(resize.right<0){resize.right=0;}else if(resize.right>dim.width-resize.left-offset){resize.right=dim.width-resize.left-offset;}
break;case corner.br:resize.bottom=size.bottom-drag.top;if(config.minHeight&&dim.height-resize.top-resize.bottom<config.minHeight){resize.bottom=dim.height-resize.top-config.minHeight;}else if(config.maxHeight&&dim.height-resize.top-resize.bottom>config.maxHeight){resize.bottom=dim.height-resize.top-config.maxHeight;}else if(resize.bottom<0){resize.bottom=0;}else if(resize.bottom>dim.height-resize.top-offset){resize.bottom=dim.height-resize.top-offset;}
resize.right=size.right-drag.left;if(config.minWidth&&dim.width-resize.left-resize.right<config.minWidth){resize.right=dim.width-resize.left-config.minWidth;}else if(config.maxWidth&&dim.width-resize.right-resize.left>config.maxWidth){resize.right=dim.width-resize.left-config.maxWidth;}else if(resize.right<0){resize.right=0;}else if(resize.right>dim.width-resize.left-offset){resize.right=dim.width-resize.left-offset;}
break;case corner.bl:resize.bottom=size.bottom-drag.top;if(config.minHeight&&dim.height-resize.top-resize.bottom<config.minHeight){resize.bottom=dim.height-resize.top-config.minHeight;}else if(config.maxHeight&&dim.height-resize.top-resize.bottom>config.maxHeight){resize.bottom=dim.height-resize.top-config.maxHeight;}else if(resize.bottom<0){resize.bottom=0;}else if(resize.bottom>dim.height-resize.top-offset){resize.bottom=dim.height-resize.top-offset;}
resize.left=size.left+drag.left;if(config.minWidth&&dim.width-resize.left-resize.right<config.minWidth){resize.left=dim.width-resize.right-config.minWidth;}else if(config.maxWidth&&dim.width-resize.left-resize.right>config.maxWidth){resize.left=dim.width-resize.right-config.maxWidth;}else if(resize.left<0){resize.left=0;}else if(resize.left>dim.width-resize.right-offset){resize.left=dim.width-resize.right-offset;}
break;}
config.height=dim.height-(resize.top+resize.bottom);config.width=dim.width-(resize.left+resize.right);myself.position();myself.corners();};this.stop=function(){size={top:parseInt(mask.top.style.height),bottom:parseInt(mask.bottom.style.height),left:parseInt(mask.left.style.width),right:parseInt(mask.right.style.width)};myself.lowlight();myself.position();Juice.Event.remove(document,'mousemove',myself.scale);Juice.Event.remove(document,'mouseup',myself.stop);Juice.Event.remove(document,'selectstart',myself.noselect);Juice.Event.remove(document,'mousedown',myself.noselect);};this.pickup=function(e){Juice.Event.cancel(e);container.style.cursor='url('+config.directory+'move.ico), default';var down=Juice.Event.mouse(e);var pos=Juice.Element.position(container);click={left:(down.left-pos.left),top:(down.top-pos.top)};myself.highlight();Juice.Event.add(document,'mousemove',myself.drag);Juice.Event.add(document,'mouseup',myself.drop);Juice.Event.add(document,'selectstart',myself.noselect);Juice.Event.add(document,'mousedown',myself.noselect);};this.drag=function(e){var mouse=Juice.Event.mouse(e);var pos=Juice.Element.position(container);var drag={left:(mouse.left-pos.left)-click.left,top:(mouse.top-pos.top)-click.top};resize={top:size.top+drag.top,bottom:size.bottom-drag.top,left:size.left+drag.left,right:(dim.width-config.width-(size.left+drag.left))};myself.position();};this.drop=function(){container.style.cursor='url('+config.directory+'grab.ico), default';size=resize;config.height=dim.height-(size.top+size.bottom);config.width=dim.width-(size.left+size.right);myself.lowlight();Juice.Event.remove(document,'mousemove',myself.drag);Juice.Event.remove(document,'mouseup',myself.drop);Juice.Event.remove(document,'selectstart',myself.noselect);Juice.Event.remove(document,'mousedown',myself.noselect);};this.position=function(){if(!resize){resize=size;}
var max={height:dim.height-config.height,width:dim.width-config.width};if(resize.top<0){resize.top=0;}else if(resize.top>max.height){resize.top=max.height;}
if(resize.bottom<0){resize.bottom=0;}else if(resize.bottom>max.height){resize.bottom=max.height;}
if(resize.left<0){resize.left=0;}else if(resize.left>max.width){resize.left=max.width;}
if(resize.right<0){resize.right=0;}else if(resize.right>max.width){resize.right=max.width;}
mask.top.style.height=mask.left.style.top=mask.right.style.top=Math.floor(resize.top)+'px';mask.bottom.style.height=resize.bottom+'px';mask.left.style.width=resize.left+'px';mask.right.style.width=resize.right+'px';mask.left.style.height=mask.right.style.height=dim.height-(parseInt(mask.top.style.height)+parseInt(mask.bottom.style.height))+'px';myself.corners();if(Juice.Type.callback(setup.callback)){setup.callback({left:Math.floor(resize.left),right:dim.width-parseInt(mask.right.style.width),top:Math.floor(resize.top),bottom:dim.height-Math.floor(resize.bottom)});}};this.corners=function(){if(config.fixed==false){corner.tl.style.top=corner.tr.style.top=parseInt(mask.top.style.height)+'px';corner.tl.style.left=corner.bl.style.left=parseInt(mask.left.style.width)+'px';corner.tr.style.left=corner.br.style.left=dim.width-parseInt(mask.right.style.width)-config.corner-1+'px';corner.br.style.bottom=corner.bl.style.bottom=parseInt(mask.bottom.style.height)+'px';}};this.highlight=function(){for(var i in corner){Juice.Element.opacity(corner[i],90);}};this.lowlight=function(){for(var i in corner){Juice.Element.opacity(corner[i],50);}};this.noselect=function(e){Juice.Event.cancel(e);return false;};this.setup();}})();
(function(){if(typeof Juice=='undefined'){throw new Error('lightbox.juice.js requires the core.juice.js component.');}
Juice.Lightbox=new function(){var constructor=this;this.init=function(setup){var groups=[];var expr=new RegExp('juiceLightbox(?:\\[([^\\]]+)\\])?','i');var nodes=document.getElementsByTagName('A');var thumb=function(group){if(!groups[group]){groups[group]=[];}
if(nodes[i].title){var caption=nodes[i].title;if(caption.length>30){caption=caption.substring(0,30)+'...';}}
groups[group].push({src:nodes[i].href,caption:caption});Juice.Event.add(nodes[i],'click',function(e){Juice.Event.cancel(e);new constructor.create({image:groups[group],current:this.href,autoplay:false});});}
for(var i=0;i<nodes.length;i++){var matches=expr.exec(nodes[i].rel)
if(matches){var group=matches[1]||null;thumb(group);}}};this.create=function(setup,group){var control=lightbox=next=orig=resize=size={},overlay,background,container,content,myself=this;this.setup=function(){lightbox.parent=Juice.Element.output(Juice.Prefs.container);lightbox.top=Juice.Element.scroll(lightbox.parent).top;lightbox.failures=0;lightbox.directory=Juice.Prefs.image+'lightbox/';lightbox.play=false;lightbox.max={};size.width=300;size.height=300;size.padding=6;overlay=Juice.Element.create('DIV',null,'lightbox');overlay.style.position='absolute';overlay.style.top=0;overlay.style.right=0;overlay.style.bottom=0;overlay.style.left=0;overlay.style.height='100%';overlay.style.width='100%';background=Juice.Element.create('DIV');background.style.position='absolute';background.style.top=0;background.style.left=0;background.style.overflow='hidden';background.style.background='black';background.style.width='100%';background.style.height='100%';Juice.Element.opacity(background,80);container=Juice.Element.create('DIV');container.style.position='absolute';container.style.top=0;container.style.left=0;container.style.width=size.width+'px';container.style.height=size.height+'px';container.style.padding=size.padding+'px';container.style.border='1px solid #333333';container.style.backgroundColor='black';container.style.backgroundPosition='center center';container.style.backgroundRepeat='no-repeat';content=Juice.Element.create('DIV');content.style.backgroundRepeat='no-repeat';container.appendChild(content);overlay.appendChild(background);overlay.appendChild(container);lightbox.current={};lightbox.current.fade=false;lightbox.current.delay=false;lightbox.current.id=0;for(var i in setup.image){if((setup.current)&&(setup.image[i].src==setup.current)){lightbox.current.id=i;}}
myself.control();resize.animate=false;resize.interval=8;resize.speed=1;lightbox.center={};lightbox.center.top=0;lightbox.center.left=0;myself.limits();myself.position();Juice.Event.add(overlay,'click',myself.close);Juice.Event.add(window,'resize',myself.limits);Juice.Event.add(document,'keyup',myself.keys);lightbox.parent.style.overflow='hidden';lightbox.parent.scrollTop=0;lightbox.parent.appendChild(overlay);Juice.Element.obstructions(overlay);if(setup.autoplay==true){myself.play();}else{myself.change();}
return false;};this.position=function(){var pos={};pos.screen=Juice.Browser.dimensions();pos.top=(pos.screen.height/2)-((size.height/2)+(size.padding));pos.left=(pos.screen.width/2)-((size.width/2)+(size.padding));container.style.top=pos.top+'px';container.style.left=pos.left+'px';overlay.style.height=pos.screen.height+'px';overlay.style.width=pos.screen.width+'px';};this.limits=function(){var limits=Juice.Browser.dimensions();lightbox.max.width=limits.width-40;lightbox.max.height=limits.height-40;control.container.style.left=((limits.width/2)-(parseInt(control.container.style.width)/2))+'px';myself.change();};this.change=function(id){if(setup.image[lightbox.current.id].loaded!=true){container.style.backgroundImage='url('+lightbox.directory+'loading.gif)';}
resize.speed=1;lightbox.current.fade=clearInterval(lightbox.current.fade);content.style.backgroundImage='none';myself.load(setup.image[lightbox.current.id].src);};this.load=function(src){var image=new Image();image.onload=function(){orig.width=lightbox.current.width=image.width;orig.height=lightbox.current.height=image.height;setup.image[lightbox.current.id].loaded=true;myself.loaded(true);}
image.onerror=function(){myself.error('Image failed to load ('+src+')');myself.loaded(false);}
image.src=src;};this.loaded=function(loaded){if(loaded){container.style.backgroundImage='none';resize.animate=clearInterval(resize.animate);resize.animate=setInterval(function(){myself.resize('x');},resize.interval);}else{lightbox.failures++;if(lightbox.failures==setup.image.length){myself.hide();}else{myself.next();}}};this.show=function(){lightbox.current.opacity=0;Juice.Element.opacity(content,0);control.caption.innerHTML=(parseInt(lightbox.current.id)+1)+'/'+setup.image.length;if(setup.image[lightbox.current.id].caption){control.caption.innerHTML+=' ['+setup.image[lightbox.current.id].caption+']';}
lightbox.center.top=((orig.height-size.height)/2)*-1;lightbox.center.left=((orig.width-size.width)/2)*-1;content.style.backgroundPosition=lightbox.center.left+'px '+lightbox.center.top+'px';content.style.backgroundImage='url('+setup.image[lightbox.current.id].src+')';lightbox.current.fade=setInterval(myself.fade,20);Juice.Event.add(content,'mousedown',myself.move);};this.move=function(e){if(orig.width>size.width||orig.height>size.height){Juice.Event.add(document,'mousemove',myself.drag);Juice.Event.add(document,'mouseup',myself.stopDrag);lightbox.parent.style.cursor='move';var mouse=Juice.Event.mouse(e);lightbox.drag={};lightbox.drag.startX=mouse.left;lightbox.drag.startY=mouse.top;}else{myself.stopDrag();}};this.drag=function(e){var mouse=Juice.Event.mouse(e);var position=Juice.Element.position(content);lightbox.center.left+=(lightbox.drag.startX-mouse.left)/5;lightbox.center.top+=(lightbox.drag.startY-mouse.top)/5;if(lightbox.center.left>0){lightbox.center.left=0;}else if(lightbox.center.left<(orig.width-size.width)*-1){lightbox.center.left=(orig.width-size.width)*-1;}
if(lightbox.center.top>0){lightbox.center.top=0;}else if(lightbox.center.top<(orig.height-size.height)*-1){lightbox.center.top=(orig.height-size.height)*-1;}
content.style.backgroundPosition=lightbox.center.left+'px '+lightbox.center.top+'px';};this.stopDrag=function(){Juice.Event.remove(document,'mousemove',myself.drag);Juice.Event.remove(document,'mouseup',myself.stopDrag);lightbox.parent.style.cursor='auto';};this.fade=function(){lightbox.current.opacity+=10;if(lightbox.current.opacity>=100){Juice.Element.opacity(content,100);lightbox.current.fade=clearInterval(lightbox.current.fade);}else{Juice.Element.opacity(content,lightbox.current.opacity);}};this.resize=function(axis){var stop=false;var current=axis=='y'?lightbox.current.height:lightbox.current.width;var original=axis=='y'?orig.height:orig.width;var image=axis=='y'?size.height:size.width;var max=axis=='y'?lightbox.max.height:lightbox.max.width;if(current<original){current=original;}
if(current>max){current=max;}
if(current>image){image+=(resize.speed*3);if(current<=image){image=current;stop=true;}}else if(current<image){image-=(resize.speed*3);if(current>=image){image=current;stop=true;}}else{stop=true;}
resize.speed++;if(axis=='y'){lightbox.current.height=current;size.height=image;myself.position();container.style.height=size.height+'px';content.style.height=size.height+'px';if(stop==true){myself.show();resize.speed=1;resize.animate=clearInterval(resize.animate);}}else{lightbox.current.width=current;size.width=image;myself.position();container.style.width=size.width+'px';if(stop==true){resize.speed=1;resize.animate=clearInterval(resize.animate);resize.animate=setInterval(function(){myself.resize('y');},resize.interval);}}};this.hide=function(){Juice.Event.remove(overlay,'click',myself.close);Juice.Event.remove(window,'resize',myself.position);Juice.Event.remove(document,'keyup',myself.keys);lightbox.parent.removeChild(overlay);lightbox.parent.style.overflow='auto';lightbox.parent.scrollTop=lightbox.top;};this.close=function(e){var node=Juice.Event.source(e);Juice.Event.cancel(e);while(node!=document){if(node==container||node==control.container){break;}
node=node.parentNode;}
if(node!=container&&node!=control.container){myself.hide();}};this.play=function(){control.pause.style.display='block';control.play.style.display='none';lightbox.play=setInterval(myself.slideshow,5000);};this.slideshow=function(){lightbox.current.id++;if(lightbox.current.id==setup.image.length){lightbox.current.id=0;}
myself.change();return true;};this.next=function(){if(setup.image.length==1){return false;}
lightbox.current.id++;if(lightbox.current.id==setup.image.length){lightbox.current.id=0;}
myself.change();return true;};this.pause=function(){control.pause.style.display='none';control.play.style.display='block';lightbox.play=clearInterval(lightbox.play);};this.prev=function(){myself.pause();if(setup.image.length==1){return false;}
lightbox.current.id--;if(lightbox.current.id<0){lightbox.current.id=setup.image.length-1;}
myself.change();return true;};this.next=function(){myself.pause();if(setup.image.length==1){return false;}
lightbox.current.id++;if(lightbox.current.id==setup.image.length){lightbox.current.id=0;}
myself.change();return true;};this.start=function(){myself.pause();if(lightbox.current.id!=0){lightbox.current.id=0;myself.change();}
return true;};this.end=function(){myself.pause();var last=setup.image.length-1;if(lightbox.current.id!=last){lightbox.current.id=last;myself.change();}
return true;};this.actual=function(){myself.pause();Juice.Window.open(setup.image[lightbox.current.id].src);};this.control=function(){control={};control.container=Juice.Element.create('A');control.container.style.background='url('+lightbox.directory+'bg.png) center center no-repeat';control.container.style.position='absolute';control.container.style.bottom='20px';control.container.style.width='285px';control.container.style.height='70px';control.actual=Juice.Element.create('A');control.actual.style.background='url('+lightbox.directory+'actual.png) center center no-repeat';control.actual.style.position='absolute';control.actual.style.top='15px';control.actual.style.left='20px';control.actual.style.width='26px';control.actual.style.height='26px';control.actual.href='#actual';Juice.Event.add(control.actual,'click',myself.actual);control.start=Juice.Element.create('A');control.start.style.background='url('+lightbox.directory+'start.png) center center no-repeat';control.start.style.position='absolute';control.start.style.top='15px';control.start.style.left='62px';control.start.style.width='26px';control.start.style.height='26px';control.start.href='#first';Juice.Event.add(control.start,'click',myself.start);control.prev=Juice.Element.create('A');control.prev.style.background='url('+lightbox.directory+'prev.png) center center no-repeat';control.prev.style.position='absolute';control.prev.style.top='15px';control.prev.style.left='92px';control.prev.style.width='26px';control.prev.style.height='26px';control.prev.href='#previous';Juice.Event.add(control.prev,'click',myself.prev);control.play=Juice.Element.create('A');control.play.style.background='url('+lightbox.directory+'play.png) center center no-repeat';control.play.style.position='absolute';control.play.style.top='8px';control.play.style.left='122px';control.play.style.width='40px';control.play.style.height='40px';control.play.href='#play';Juice.Event.add(control.play,'click',myself.play);control.pause=Juice.Element.create('A');control.pause.style.background='url('+lightbox.directory+'pause.png) center center no-repeat';control.pause.style.position='absolute';control.pause.style.top='8px';control.pause.style.left='122px';control.pause.style.width='40px';control.pause.style.height='40px';control.pause.style.display='none';control.pause.href='#pause';Juice.Event.add(control.pause,'click',myself.pause);control.next=Juice.Element.create('A');control.next.style.background='url('+lightbox.directory+'next.png) center center no-repeat';control.next.style.position='absolute';control.next.style.top='15px';control.next.style.left='166px';control.next.style.width='26px';control.next.style.height='26px';control.next.href='#next';Juice.Event.add(control.next,'click',myself.next);control.end=Juice.Element.create('A');control.end.style.background='url('+lightbox.directory+'end.png) center center no-repeat';control.end.style.position='absolute';control.end.style.top='15px';control.end.style.left='196px';control.end.style.width='26px';control.end.style.height='26px';control.end.href='#last';Juice.Event.add(control.end,'click',myself.end);control.close=Juice.Element.create('A');control.close.style.background='url('+lightbox.directory+'close.png) center center no-repeat';control.close.style.position='absolute';control.close.style.top='15px';control.close.style.left='236px';control.close.style.width='26px';control.close.style.height='26px';control.close.href='#close';Juice.Event.add(control.close,'click',function(e){Juice.Event.cancel(e);myself.hide();});control.caption=Juice.Element.create('DIV','...');control.caption.style.position='absolute';control.caption.style.bottom='5px';control.caption.style.left='10px';control.caption.style.width='268px';control.caption.style.height='15px';control.caption.style.textAlign='center';control.caption.style.color='#999999';control.caption.style.font='11px arial';control.container.appendChild(control.actual);control.container.appendChild(control.start);control.container.appendChild(control.prev);control.container.appendChild(control.play);control.container.appendChild(control.pause);control.container.appendChild(control.next);control.container.appendChild(control.end);control.container.appendChild(control.close);control.container.appendChild(control.caption);overlay.appendChild(control.container);if(setup.image.length==1){return false;}
lightbox.prev=Juice.Element.create('DIV');lightbox.prev.style.position='absolute';lightbox.prev.style.top=0;lightbox.prev.style.left=0;lightbox.prev.style.width='60px';lightbox.prev.style.height='100%';lightbox.prev.style.cursor='pointer';lightbox.prev.style.backgroundPosition='center center';lightbox.prev.style.backgroundRepeat='no-repeat';Juice.Event.add(lightbox.prev,'mouseover',function(){lightbox.prev.style.backgroundImage='url('+lightbox.directory+'prev.png)';});Juice.Event.add(lightbox.prev,'mouseout',function(){lightbox.prev.style.backgroundImage='';});Juice.Event.add(lightbox.prev,'click',myself.prev);container.appendChild(lightbox.prev);lightbox.next=Juice.Element.create('DIV');lightbox.next.style.position='absolute';lightbox.next.style.top=0;lightbox.next.style.right=0;lightbox.next.style.width='60px';lightbox.next.style.height='100%';lightbox.next.style.cursor='pointer';lightbox.next.style.backgroundPosition='center center';lightbox.next.style.backgroundRepeat='no-repeat';Juice.Event.add(lightbox.next,'mouseover',function(){lightbox.next.style.backgroundImage='url('+lightbox.directory+'next.png)';});Juice.Event.add(lightbox.next,'mouseout',function(){lightbox.next.style.backgroundImage='';});Juice.Event.add(lightbox.next,'click',myself.next);container.appendChild(lightbox.next);};this.keys=function(e){Juice.Event.cancel(e);var key=Juice.Event.key(e);switch(key.code){case 27:case 67:case 88:myself.hide();break;case 36:myself.start();break;case 35:myself.end();break;case 37:case 80:case 190:myself.prev();break;case 39:case 78:case 188:myself.next();break;}};this.error=function(err){Juice.Debug(new Error('Juice.Lightbox: '+err));};this.setup();};}
Juice.Event.add(window,'load',Juice.Lightbox.init);})();
(function(){if(typeof Juice=='undefined'){throw new Error('calendar.juice.js requires the core.juice.js component.');}
Juice.Calendar=function(node,setup){var dates,output,calendar,months,display,myself=this;this.init=function(){if(!setup){setup={};};node=Juice.$(node);months={names:['January','February','March','April','May','June','July','August','September','October','November','December'],days:[31,0,31,30,31,30,31,31,30,31,30,31]};dates={today:this.create.date(),min:this.create.fromdate(setup.min),max:this.create.fromdate(setup.max),current:this.create.fromdate(node.value)};output={element:node,position:Juice.Element.position(node),dimensions:Juice.Element.dimensions(node)};calendar={position:{top:output.position.top,left:output.position.left+output.dimensions.width+4},container:Juice.Container.create({className:'juiceCalendar',padding:10})};calendar.container.outer.style.top=calendar.position.top+'px';calendar.container.outer.style.left=calendar.position.left+'px';Juice.Event.add(output.element,'click',myself.show);};this.show=function(date){myself.clear();var current;if(current=myself.create.fromdate(node.value)){dates.current=current;}
if(!date.year){date=dates.current||dates.today;}
display={};display.date=myself.create.date(date.year,date.month);display.starts=display.date.full.getDay();display.month=months.names[display.date.month];months.days[1]=(((display.date.year%100!=0)&&(display.date.year%4==0))||(display.date.year%400==0))?29:28;calendar.month={container:Juice.Element.create('TABLE'),head:{container:Juice.Element.create('THEAD'),row:Juice.Element.create('TR'),prev:Juice.Element.create('TH'),laquo:Juice.Element.create('A','&laquo;',null,null,'#'),title:Juice.Element.create('TH',display.month+' '+display.date.year),next:Juice.Element.create('TH'),raquo:Juice.Element.create('A','&raquo;',null,null,'#'),days:Juice.Element.create('TR')},body:{container:Juice.Element.create('TBODY'),row:Juice.Element.create('TR')}};Juice.Element.append(calendar.month.head.prev,calendar.month.head.laquo);Juice.Element.append(calendar.month.head.next,calendar.month.head.raquo);Juice.Event.add(calendar.month.head.prev,'click',myself.prev);Juice.Event.add(calendar.month.head.next,'click',myself.next);Juice.Event.add(document,'mouseup',myself.hide);calendar.month.head.title.colSpan='5';for(var i=0;i<7;i++){var day=Juice.Element.create('TH',('SMTWTFS'.substr(i,1)));calendar.month.head.days.appendChild(day);}
Juice.Element.append(calendar.month.head.row,[calendar.month.head.prev,calendar.month.head.title,calendar.month.head.next]);Juice.Element.append(calendar.month.head.container,[calendar.month.head.row,calendar.month.head.days]);Juice.Element.append(calendar.month.container,[calendar.month.head.container,calendar.month.body.container]);for(var day=1;day<=42;day++){myself.create.day(day);}
calendar.container.inner.appendChild(calendar.month.container);Juice.Container.render(calendar.container);};this.hide=function(e){if(Juice.Event.blur(e,calendar.container.outer)){Juice.Event.cancel(e);myself.clear();}};this.clear=function(){Juice.Element.empty(calendar.container.inner);if(calendar.container.outer.parentNode){calendar.container.outer.parentNode.removeChild(calendar.container.outer);}
Juice.Event.remove(document,'mouseup',myself.hide);};this.prev=function(e){Juice.Event.cancel(e);myself.clear();myself.show(myself.create.date(display.date.year,display.date.month-1));};this.next=function(e){Juice.Event.cancel(e);myself.clear();myself.show(myself.create.date(display.date.year,display.date.full.getMonth()+1));};this.set=function(d,m,y){dates.current=myself.create.date(y,m,d);var date={day:Juice.Format.pad(d,2),month:Juice.Format.pad((m+1),2),year:setup.shortyear===true?y.toString().substring(2,4):y,sep:setup.sep||'/'}
if(Juice.Type.callback(setup.callback)){setup.callback(date.day,date.month,date.year,date.sep);}else{output.element.value=date.day+date.sep+date.month+date.sep+date.year;}
if(setup.close!==false){myself.clear();}};this.create={date:function(year,month,day){var date;if(year){date=new Date(year,parseInt(month),day||1);}else{date=new Date();date.setHours(0,0,0,0);}
return{full:date,day:date.getDate(),month:date.getMonth(),year:date.getFullYear(),time:date.getTime()};},day:function(num){var day={date:myself.create.date(display.date.year,display.date.month,(num-display.starts)),label:num-display.starts,month:months.days[display.date.month],prev:(display.date.month==0?months.days[11]:months.days[display.date.month-1])};if((day.label>0)&&(day.label<=day.month)){if(day.date.time<dates.min.time||day.date.time>dates.max.time){day.container=Juice.Element.create('TD',day.label,null,'disabled');}else{day.container=Juice.Element.create('TD');day.option=Juice.Element.create('A',day.label,null,null,'#');day.container.appendChild(day.option);if(day.date.time==dates.current.time){Juice.Element.addClassName(day.option,'selected');}
if(day.date.time==dates.today.time){Juice.Element.addClassName(day.option,'today');}
Juice.Event.add(day.container,'click',function(e){Juice.Event.cancel(e);myself.set(day.label,display.date.month,display.date.year);});}}else{day.label=day.label>=day.month?day.label-day.month:day.prev-display.starts+num;day.container=Juice.Element.create('TD',day.label,null,'unavailable');}
calendar.month.body.row.appendChild(day.container);if(((num%7)==0&&num<36&&num>0)||num==42){calendar.month.body.container.appendChild(calendar.month.body.row);calendar.month.body.row=Juice.Element.create('TR');}},fromdate:function(d){if(!d){return false;}else if(d=='today'){return myself.create.date();}else{var x=new RegExp('^([0-9]{1,2})/([0-9]{1,2})/([0-9]{2,4})'),m=false;if(m=d.match(x)){return myself.create.date(m[3],m[2]-1,m[1]);}}
return false;}};this.select=function(n,h){if(!n||!h){return false;}
var l=h.getElementsByTagName('OPTION');for(var i=0;i<l.length;i++){if(parseFloat(l[i].value)==parseFloat(n)){h.selectedIndex=i;return true;}}
return false;}
this.init();}})();
function wrap_text(wrapper){var output=document.getElementById('topic_message');var open='['+wrapper+']';var close='[/'+wrapper+']';Juice.Element.insertAtCaret(output,open,close);}
function icon(e){var textarea=document.getElementById('topic_message');Juice.Element.insertAtCaret(textarea,' :'+e.alt.toLowerCase()+': ');}
function do_bbcode(bbcode){var textarea=document.getElementById('topic_message');switch(bbcode){case'img':var img=prompt('Please enter the image URL','http://');if(img!=''&&img!='http://'&&img!=null){Juice.Element.insertAtCaret(textarea,'[img]'+img+'[/img]');}
break;case'video':var video=prompt('Please enter the youtube video URL','http://');if(video!=''&&video!='http://'&&video!=null){Juice.Element.insertAtCaret(textarea,'[youtube]'+video+'[/youtube]');}
break;case'link':var href=prompt('Please enter the full website URL','http://');if(href!=''&&href!='http://'&&href!=null){var name=prompt('Please enter the name for the link','');if(name!=''&&name!=null){Juice.Element.insertAtCaret(textarea,'[url='+href+']'+name+'[/url]');}}
break;case'ol':var listItem=prompt('Enter a list item','');if(listItem!=''&&listItem!=null){Juice.Element.insertAtCaret(textarea,'*'+listItem+"\n");}
break;case'ul':var listItem=prompt('Enter a list item','');if(listItem!=''&&listItem!=null){Juice.Element.insertAtCaret(textarea,'#'+listItem+"\n");}
break;}}