
Object.extend(Array.prototype,{withoutAt:function(ix){var a=this.clone();a.splice(ix,1);return a;},equals:function(a){if(this.length!=a.length)return false;for(var i=0,l=this.length;i<l;++i)
if(this[i]!=a[i])
return false;return true;}});var Tabs={OnClick:function(tab)
{if(tab.className=='active')
return;tab=$(tab);var pSibs=tab.previousSiblings();pSibs.concat(tab.nextSiblings()).each(function(t)
{if(t.className=='active')
t.className='inactive';});tab.className="active";var tabNumClicked=pSibs.length-1;tab.up().up().childElements().each(function(el)
{if(el.hasClassName('tab_content')&&!el.hasClassName('tab_content_disabled'))
{if(el.visible())el.hide();if(tabNumClicked--==0)el.show();}});}}
var Button={OnClick:function(button,script)
{if($(button).down().className.match('enabled'))
eval(script);return false;},Enable:function(button,enable)
{button=$(button);button.down().className=enable?'enabled':'disabled';}}
var TFSlider=Class.create();TFSlider.prototype={initialize:function(options)
{this.onChange=this.onChangeHandler.bindAsEventListener(this);var shift=options.shift||0;options=Object.extend({onSlide:this.onChange,onChange:this.onChange,range:$R(shift,shift+90),shift:shift},options);options.segX=[];options.segPoints=[];var a=b=0;for(var i=0,l=options.segWidths.length;i<l;++i)
{var w=options.segWidths[i];a+=w;b+=w*options.segSteps[i];options.segX.push(a);options.segPoints.push(b);}
this.slider=new Control.Slider(options.name+'_handle',options.name+'_track',options);this.value=0;},onChangeHandler:function(val)
{if(!isFinite(val))val=0;if(!this.settingVal&&val==this.getVal())return;var o=this.slider.options;this.value=0
for(var i=0,l=o.segWidths.length;i<l;++i)
if(val<=o.segX[i])
{this.value=o.segPoints[i]-(o.segX[i]-Math.round(val))*o.segSteps[i];break;}
if(this.keepExactValue)
this.keepExactValue=false;else
this.exactValue=null;$(o.name+'_value').update(this.getVal()+o.unit);if(o.onSet)o.onSet(this);},getSliderVal:function(val)
{var o=this.slider.options;for(var i=0,l=o.segWidths.length;i<l;++i)
if(val<=o.segPoints[i])
return o.segX[i]-(o.segPoints[i]-val)/o.segSteps[i];return o.segPoints[o.segWidths.length-1];},setVal:function(val)
{if(!isFinite(val))val=0;this.exactValue=val;this.keepExactValue=true;this.settingVal=true;this.slider.setValue(this.getSliderVal(val));this.settingVal=false;},getVal:function(){return this.exactValue?this.exactValue:this.value;},getMin:function(){return this.slider.shift;},getMax:function(){var o=this.slider.options;return o.segPoints[o.segWidths.length-1];}};Position.getViewPortBounds=function(){var left;var top;var width;var height;if(Prototype.Browser.Opera||Prototype.Browser.WebKit){left=self.pageXOffset;top=self.pageYOffset;width=window.innerWidth;height=window.innerHeight;}
else if(document.documentElement&&document.documentElement.clientHeight){left=document.documentElement.scrollLeft;top=document.documentElement.scrollTop;width=document.documentElement.clientWidth;height=document.documentElement.clientHeight;}
else{var body=TF.body();left=body.scrollLeft;top=body.scrollTop;width=body.clientWidth;height=body.clientHeight;}
return{left:left,top:top,width:width,height:height};};Element.setOpacity=function(element,value){element=$(element);if(value==1){Element.setStyle(element,{opacity:(/Gecko/.test(navigator.userAgent)&&!/Konqueror|Safari|KHTML/.test(navigator.userAgent))?0.999999:1});if(/MSIE/.test(navigator.userAgent))
Element.setStyle(element,{filter:Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')});}else{if(value<0.00001)value=0;Element.setStyle(element,{opacity:value});if(/MSIE/.test(navigator.userAgent))
Element.setStyle(element,{filter:Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')+'alpha(opacity='+value*100+')'});}};var Overlay={offsetTop:0,offsetLeft:0,visibleOpacity:0.7,init:function(){var off=Page.tfPosition();this.offsetTop=-off[1];this.offsetLeft=-off[0]-1;},start:function(options){this.init();if(this.isActive())return;this.options=options||{};if(Prototype.Browser.IE){var selects=document.getElementsByTagName('select');for(var i=0;i<selects.length;++i){selects[i].style.visibility='hidden';}}
if(!this.overlay){this.refreshDisplayEL=this.refreshDisplay.bind(this);this.overlay=$("modal_background");}
this.overlay.setOpacity(this.visibleOpacity);this.overlay.setStyle({visibility:'hidden',width:'0',height:'0',top:this.offsetTop+'px',left:this.offsetLeft+'px',display:''});this.refreshDisplay();this.overlay.setStyle({visibility:''});Event.observe(window,'resize',this.refreshDisplayEL);Event.observe(window,'scroll',this.refreshDisplayEL);},stop:function(){if(!this.overlay||!this.overlay.visible())return;$(this.options.dialog).hide();Event.stopObserving(window,'resize',this.refreshDisplayEL);Event.stopObserving(window,'scroll',this.refreshDisplayEL);this.overlay.hide();if(Prototype.Browser.IE){var selects=document.getElementsByTagName('select');for(var i=0;i<selects.length;i++){selects[i].style.visibility='';}}
this.visibleOpacity=0.7;},refreshDisplay:function(){var vB=Position.getViewPortBounds();this.overlay.setStyle({width:(vB.left+vB.width)+'px',height:(vB.top+vB.height)+'px'});var dialog=$(this.options.dialog);var dimensions=dialog.getDimensions();var left=vB.width>dimensions.width?vB.left+((vB.width-dimensions.width)/2):0;var top=vB.height>dimensions.height?vB.top+((vB.height-dimensions.height)/2):0;dialog.setStyle({left:left+this.offsetLeft+'px',top:top+this.offsetTop+'px'});},isActive:function(){return this.overlay&&this.overlay.visible();}};var Codecs={ToUtf8:function(string)
{string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);}
else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}
else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}
return utftext;},FromUtf8:function(utftext)
{var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}
else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}
else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}
return string;},keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz-!_",ToB64:function(input)
{var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=this.ToUtf8(input);do{chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}
output=output+this.keyStr.charAt(enc1)+this.keyStr.charAt(enc2)+
this.keyStr.charAt(enc3)+this.keyStr.charAt(enc4);}while(i<input.length);return output;},FromB64:function(input)
{var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\!\-\_]/g,"");do{enc1=this.keyStr.indexOf(input.charAt(i++));enc2=this.keyStr.indexOf(input.charAt(i++));enc3=this.keyStr.indexOf(input.charAt(i++));enc4=this.keyStr.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2);}
if(enc4!=64){output=output+String.fromCharCode(chr3);}}while(i<input.length);return this.FromUtf8(output);}};
