if(typeof(Control)=='undefined')
Control={};var $proc=function(proc){return typeof(proc)=='function'?proc:function(){return proc};};var $value=function(value){return typeof(value)=='function'?value():value;};Object.Event={extend:function(object){object._objectEventSetup=function(event_name){this._observers=this._observers||{};this._observers[event_name]=this._observers[event_name]||[];};object.observe=function(event_name,observer){if(typeof(event_name)=='string'&&typeof(observer)!='undefined'){this._objectEventSetup(event_name);if(!this._observers[event_name].include(observer))
this._observers[event_name].push(observer);}else
for(var e in event_name)
this.observe(e,event_name[e]);};object.stopObserving=function(event_name,observer){this._objectEventSetup(event_name);if(event_name&&observer)
this._observers[event_name]=this._observers[event_name].without(observer);else if(event_name)
this._observers[event_name]=[];else
this._observers={};};object.observeOnce=function(event_name,outer_observer){var inner_observer=function(){outer_observer.apply(this,arguments);this.stopObserving(event_name,inner_observer);}.bind(this);this._objectEventSetup(event_name);this._observers[event_name].push(inner_observer);};object.notify=function(event_name){this._objectEventSetup(event_name);var collected_return_values=[];var args=$A(arguments).slice(1);try{for(var i=0;i<this._observers[event_name].length;++i)
collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i],args)||null);}catch(e){if(e==$break)
return false;else
throw e;}
return collected_return_values;};if(object.prototype){object.prototype._objectEventSetup=object._objectEventSetup;object.prototype.observe=object.observe;object.prototype.stopObserving=object.stopObserving;object.prototype.observeOnce=object.observeOnce;object.prototype.notify=function(event_name){if(object.notify){var args=$A(arguments).slice(1);args.unshift(this);args.unshift(event_name);object.notify.apply(object,args);}
this._objectEventSetup(event_name);var args=$A(arguments).slice(1);var collected_return_values=[];try{if(this.options&&this.options[event_name]&&typeof(this.options[event_name])=='function')
collected_return_values.push(this.options[event_name].apply(this,args)||null);for(var i=0;i<this._observers[event_name].length;++i)
collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i],args)||null);}catch(e){if(e==$break)
return false;else
throw e;}
return collected_return_values;};}}};Element.addMethods({observeOnce:function(element,event_name,outer_callback){var inner_callback=function(){outer_callback.apply(this,arguments);Element.stopObserving(element,event_name,inner_callback);};Element.observe(element,event_name,inner_callback);}});Object.extend(Event,(function(){var cache=Event.cache;function getEventID(element){if(element._prototypeEventID)return element._prototypeEventID[0];arguments.callee.id=arguments.callee.id||1;return element._prototypeEventID=[++arguments.callee.id];}
function getDOMEventName(eventName){if(eventName&&eventName.include(':'))return"dataavailable";if(!Prototype.Browser.IE){eventName={mouseenter:'mouseover',mouseleave:'mouseout'}[eventName]||eventName;}
return eventName;}
function getCacheForID(id){return cache[id]=cache[id]||{};}
function getWrappersForEventName(id,eventName){var c=getCacheForID(id);return c[eventName]=c[eventName]||[];}
function createWrapper(element,eventName,handler){var id=getEventID(element);var c=getWrappersForEventName(id,eventName);if(c.pluck("handler").include(handler))return false;var wrapper=function(event){if(!Event||!Event.extend||(event.eventName&&event.eventName!=eventName))
return false;Event.extend(event);handler.call(element,event);};if(!(Prototype.Browser.IE)&&['mouseenter','mouseleave'].include(eventName)){wrapper=wrapper.wrap(function(proceed,event){var rel=event.relatedTarget;var cur=event.currentTarget;if(rel&&rel.nodeType==Node.TEXT_NODE)
rel=rel.parentNode;if(rel&&rel!=cur&&!rel.descendantOf(cur))
return proceed(event);});}
wrapper.handler=handler;c.push(wrapper);return wrapper;}
function findWrapper(id,eventName,handler){var c=getWrappersForEventName(id,eventName);return c.find(function(wrapper){return wrapper.handler==handler});}
function destroyWrapper(id,eventName,handler){var c=getCacheForID(id);if(!c[eventName])return false;c[eventName]=c[eventName].without(findWrapper(id,eventName,handler));}
function destroyCache(){for(var id in cache)
for(var eventName in cache[id])
cache[id][eventName]=null;}
if(window.attachEvent){window.attachEvent("onunload",destroyCache);}
return{observe:function(element,eventName,handler){element=$(element);var name=getDOMEventName(eventName);var wrapper=createWrapper(element,eventName,handler);if(!wrapper)return element;if(element.addEventListener){element.addEventListener(name,wrapper,false);}else{element.attachEvent("on"+name,wrapper);}
return element;},stopObserving:function(element,eventName,handler){element=$(element);var id=getEventID(element),name=getDOMEventName(eventName);if(!handler&&eventName){getWrappersForEventName(id,eventName).each(function(wrapper){element.stopObserving(eventName,wrapper.handler);});return element;}else if(!eventName){Object.keys(getCacheForID(id)).each(function(eventName){element.stopObserving(eventName);});return element;}
var wrapper=findWrapper(id,eventName,handler);if(!wrapper)return element;if(element.removeEventListener){element.removeEventListener(name,wrapper,false);}else{element.detachEvent("on"+name,wrapper);}
destroyWrapper(id,eventName,handler);return element;},fire:function(element,eventName,memo){element=$(element);if(element==document&&document.createEvent&&!element.dispatchEvent)
element=document.documentElement;var event;if(document.createEvent){event=document.createEvent("HTMLEvents");event.initEvent("dataavailable",true,true);}else{event=document.createEventObject();event.eventType="ondataavailable";}
event.eventName=eventName;event.memo=memo||{};if(document.createEvent){element.dispatchEvent(event);}else{element.fireEvent(event.eventType,event);}
return Event.extend(event);}};})());Object.extend(Event,Event.Methods);Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize()});(function(){function wheel(event){var delta;if(event.wheelDelta)
delta=event.wheelDelta/120;else if(event.detail)
delta=-event.detail/3;if(!delta)
return;var custom_event=Event.element(event).fire('mouse:wheel',{delta:delta});if(custom_event.stopped){Event.stop(event);return false;}}
document.observe('mousewheel',wheel);document.observe('DOMMouseScroll',wheel);})();var IframeShim=Class.create({initialize:function(){this.element=new Element('iframe',{style:'position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);display:none',src:'javascript:void(0);',frameborder:0});$(document.body).insert(this.element);},hide:function(){this.element.hide();return this;},show:function(){this.element.show();return this;},positionUnder:function(element){var element=$(element);var offset=element.cumulativeOffset();var dimensions=element.getDimensions();this.element.setStyle({left:offset[0]+'px',top:offset[1]+'px',width:dimensions.width+'px',height:dimensions.height+'px',zIndex:element.getStyle('zIndex')-1}).show();return this;},setBounds:function(bounds){for(prop in bounds)
bounds[prop]+='px';this.element.setStyle(bounds);return this;},destroy:function(){if(this.element)
this.element.remove();return this;}});;if(!window.Modalbox)
var Modalbox=new Object();Modalbox.Methods={overrideAlert:false,focusableElements:new Array,currFocused:0,initialized:false,active:true,options:{title:"ModalBox Window",overlayClose:false,width:450,height:60,overlayOpacity:.75,overlayDuration:.25,slideDownDuration:.25,slideUpDuration:.25,resizeDuration:.25,inactiveFade:true,transitions:true,loadingString:"Please wait. Loading...",closeString:"Close window",closeValue:"&times;",closeEnabled:true,params:{},method:'get',autoFocusing:true,aspnet:false},_options:new Object,setOptions:function(options){Object.extend(this.options,options||{});},_init:function(options){Object.extend(this._options,this.options);this.setOptions(options);this.MBoverlay=new Element("div",{id:"MB_overlay",opacity:"0"});this.MBwindow=new Element("div",{id:"MB_window",style:"display: none"}).update(this.MBframe=new Element("div",{id:"MB_frame"}).update(this.MBheader=new Element("div",{id:"MB_header",style:"display: none"}).update(this.MBcaption=new Element("div",{id:"MB_caption"}))));this.MBcontent=new Element("div",{id:"MB_content"}).update(this.MBloading=new Element("div",{id:"MB_loading"}).update(new Element("div").update(this.options.loadingString)));if(this.options.closeEnabled){this.MBclose=new Element("a",{id:"MB_close",title:this.options.closeString,href:"#"}).update("<span>"+this.options.closeValue+"</span>");this.MBheader.insert({'bottom':this.MBclose});}
this.MBframe.insert({'bottom':this.MBcontent});var injectToEl=$(document.body);injectToEl.insert({'top':this.MBwindow});injectToEl.insert({'top':this.MBoverlay});this.initScrollX=window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft;this.initScrollY=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop;this.hideObserver=this._hide.bindAsEventListener(this);this.kbdObserver=this._kbdHandler.bindAsEventListener(this);this._initObservers();this.initialized=true;},show:function(content,options){if(!this.initialized){this._init(options);}else{$(this.MBheader).hide();}
this.content=content;this.setOptions(options);if(this.options.title)
$(this.MBcaption).update(this.options.title);else{$(this.MBcaption).hide();}
if(this.MBwindow.style.display=="none"){this._appear();this.event("onShow");}
else{this._update();this.event("onUpdate");}},hide:function(options){if(this.initialized){if(options&&typeof options.element!='function')Object.extend(this.options,options);this.event("beforeHide");if(this.options.transitions)
Effect.Fade(this.MBwindow,{duration:this.options.slideUpDuration,transition:Effect.Transitions.sinoidal,afterFinish:this._deinit.bind(this)});else{$(this.MBwindow).hide();this._deinit();}}else throw("Modalbox is not initialized.");},_hide:function(event){event.stop();if(event.element().id=='MB_overlay'&&!this.options.overlayClose)return false;this.hide();},alert:function(message){var html='<div class="MB_alert"><p>'+message+'</p><input type="button" onclick="Modalbox.hide()" value="OK" /></div>';Modalbox.show(html,{title:'Alert: '+document.title,width:300});},_appear:function(){if(Prototype.Browser.IE&&!navigator.appVersion.match(/\b7.0\b/)){window.scrollTo(0,0);this._prepareIE("100%","hidden");}
this._setWidth();this._setPosition();$(this.MBoverlay).setStyle({opacity:this.options.overlayOpacity});if(this.options.transitions){$(this.MBwindow).setStyle({top:Math.round((Element.getHeight(document.viewport)-this.options.height)/2)+"px"});this.MBwindow.appear({duration:0.0125,afterFinish:function(){this.loadContent();}.bind(this)});}else{$(this.MBwindow).appear();this._setPosition();this.loadContent();}
this._setWidthAndPosition=this._setWidthAndPosition.bindAsEventListener(this);Event.observe(window,"resize",this._setWidthAndPosition);},resize:function(byWidth,byHeight,options){var wHeight=$(this.MBwindow).getHeight();var wWidth=$(this.MBwindow).getWidth();var hHeight=$(this.MBheader).getHeight();var cHeight=$(this.MBcontent).getHeight();var newHeight=((wHeight-hHeight+byHeight)<cHeight)?(cHeight+hHeight-wHeight):byHeight;if(options)this.setOptions(options);this.MBwindow.setStyle({width:wWidth+byWidth+"px",height:wHeight+newHeight+"px"});setTimeout(function(){this.event("_afterResize");this.event("afterResize");}.bind(this),1);},resizeToContent:function(options){var byHeight=this.options.height-this.MBwindow.offsetHeight;if(byHeight!=0){if(options)this.setOptions(options);Modalbox.resize(0,byHeight);}},resizeToInclude:function(element,options){var el=$(element);var elHeight=el.getHeight()+parseInt(el.getStyle('margin-top'))+parseInt(el.getStyle('margin-bottom'))+parseInt(el.getStyle('border-top-width'))+parseInt(el.getStyle('border-bottom-width'));if(elHeight>0){if(options)this.setOptions(options);Modalbox.resize(0,elHeight);}},_update:function(){$(this.MBcontent).hide().update("");this.MBcontent.appendChild(this.MBloading);$(this.MBloading).update(new Element("div").update(this.options.loadingString));this.MBwindow.setStyle({width:this.options.width+"px",height:this.options.height+"px"});this._setPosition();$(this.MBcontent).show();this._loadAfterResize();},loadContent:function(){if(this.event("beforeLoad")!=false){if(typeof this.content=='string'){var htmlRegExp=new RegExp(/<\/?[^>]+>/gi);if(htmlRegExp.test(this.content)){if(this.content.stripScripts()){this._insertContent(this.content.stripScripts());this._putContent(function(){this.content.extractScripts().map(function(script){return eval(script.replace("<!--","").replace("// -->",""));}.bind(window));}.bind(this));}else{response.extractScripts().map(function(script){return eval(script.replace("<!--","").replace("// -->",""));}.bind(window));}}else
new Ajax.Request(this.content,{method:this.options.method.toLowerCase(),parameters:this.options.params,onSuccess:function(transport){var response=new String(transport.responseText);new Effect.Fade(this.MBwindow,{duration:0.0125,afterFinish:function(){if(transport.responseText.stripScripts()){this._insertContent(transport.responseText.stripScripts());this._putContent(function(){response.extractScripts().map(function(script){return eval(script.replace("<!--","").replace("// -->",""));}.bind(window));});}else{response.extractScripts().map(function(script){return eval(script.replace("<!--","").replace("// -->",""));}.bind(window));}}.bind(this)});}.bind(this),onException:function(instance,exception){Modalbox.hide();throw('Modalbox Loading Error: '+exception);}});}else if(typeof this.content=='object'){this._insertContent(this.content);this._putContent();}else{Modalbox.hide();throw('Modalbox Parameters Error: Please specify correct URL or HTML element (plain HTML or object)');}}},_insertContent:function(content){$(this.MBcontent).hide().update("");if(typeof content=='string'){setTimeout(function(){var container=new Element("div",{id:"MB_container"}).update(content);this.MBcontent.update(container);}.bind(this),1);}else if(typeof content=='object'){var _htmlObj=content.cloneNode(true);if(content.id)content.id="MB_"+content.id;$(content).select('*[id]').each(function(el){el.id="MB_"+el.id;});var container=new Element("div",{id:"MB_container"});container.appendChild(container);container.down().show();this.MBcontent.update(container);if(Prototype.Browser.IE)
$$("#MB_container select").invoke('setStyle',{'visibility':''});}},_putContent:function(callback){$(this.MBwindow).show();if(this.options.height==this._options.height){setTimeout(function(){this._setPosition();Modalbox.resize(0,$(this.MBcontent).getHeight()-$(this.MBwindow).getHeight()+$(this.MBheader).getHeight(),{afterResize:function(){if(this.options.title){this.MBheader.appear({duration:0.2});}
this.MBcontent.appear({duration:0.2,afterFinish:function(){this.focusableElements=this._findFocusableElements();this._setFocus();setTimeout(function(){if(callback!=undefined)
callback();this.event("afterLoad");}.bind(this),1);}.bind(this)}).makePositioned();}.bind(this)});}.bind(this),1);}else{this._setWidth();this.MBcontent.setStyle({overflow:'auto',height:$(this.MBwindow).getHeight()-$(this.MBheader).getHeight()-13+'px'});if(this.options.title){this.MBheader.appear({duration:0.2});}
this.MBcontent.appear({duration:0.2});this.focusableElements=this._findFocusableElements();this._setFocus();setTimeout(function(){if(callback!=undefined)
callback();this.event("afterLoad");}.bind(this),1);}},activate:function(options){this.setOptions(options);this.active=true;if(this.options.closeEnabled)$(this.MBclose).observe("click",this.hideObserver);if(this.options.overlayClose)
$(this.MBoverlay).observe("click",this.hideObserver);if(this.options.closeEnabled)$(this.MBclose).show();if(this.options.transitions&&this.options.inactiveFade)
new Effect.Appear(this.MBwindow,{duration:this.options.slideUpDuration});},deactivate:function(options){this.setOptions(options);this.active=false;if(this.options.closeEnabled)$(this.MBclose).stopObserving("click",this.hideObserver);if(this.options.overlayClose)
$(this.MBoverlay).stopObserving("click",this.hideObserver);if(this.options.closeEnabled)$(this.MBclose).hide();if(this.options.transitions&&this.options.inactiveFade)
new Effect.Fade(this.MBwindow,{duration:this.options.slideUpDuration,to:.75});},_initObservers:function(){if(this.options.closeEnabled)$(this.MBclose).observe("click",this.hideObserver);if(this.options.overlayClose)
$(this.MBoverlay).observe("click",this.hideObserver);if(Prototype.Browser.IE)
Event.observe(document,"keydown",this.kbdObserver);else
Event.observe(document,"keypress",this.kbdObserver);},_removeObservers:function(){if(this.options.closeEnabled)$(this.MBclose).stopObserving("click",this.hideObserver);if(this.options.overlayClose)
$(this.MBoverlay).stopObserving("click",this.hideObserver);if(Prototype.Browser.IE)
Event.stopObserving(document,"keydown",this.kbdObserver);else
Event.stopObserving(document,"keypress",this.kbdObserver);},_loadAfterResize:function(){this._setWidth();this._setPosition();this.loadContent();},_setFocus:function(){if(this.focusableElements.length>0&&this.options.autoFocusing==true){var firstEl=this.focusableElements.find(function(el){return el.tabIndex==1;})||this.focusableElements.first();this.currFocused=this.focusableElements.toArray().indexOf(firstEl);firstEl.focus();}},_findFocusableElements:function(){this.MBcontent.select('input:not([type~=hidden]), select, textarea, button, a[href]').invoke('addClassName','MB_focusable');return this.MBcontent.select('.MB_focusable');},_kbdHandler:function(event){var node=event.element();switch(event.keyCode){case Event.KEY_TAB:event.stop();if(node!=this.focusableElements[this.currFocused])
this.currFocused=this.focusableElements.toArray().indexOf(node);if(!event.shiftKey){if(this.currFocused==this.focusableElements.length-1){this.focusableElements.first().focus();this.currFocused=0;}else{this.currFocused++;this.focusableElements[this.currFocused].focus();}}else{if(this.currFocused==0){this.focusableElements.last().focus();this.currFocused=this.focusableElements.length-1;}else{this.currFocused--;this.focusableElements[this.currFocused].focus();}}
break;case Event.KEY_ESC:if(this.active)this._hide(event);break;case 32:this._preventScroll(event);break;case 0:if(event.which==32)this._preventScroll(event);break;case Event.KEY_UP:case Event.KEY_DOWN:case Event.KEY_PAGEDOWN:case Event.KEY_PAGEUP:case Event.KEY_HOME:case Event.KEY_END:if(Prototype.Browser.WebKit&&!["textarea","select"].include(node.tagName.toLowerCase()))
event.stop();else if((node.tagName.toLowerCase()=="input"&&["submit","button"].include(node.type))||(node.tagName.toLowerCase()=="a"))
event.stop();break;}},_preventScroll:function(event){if(!["input","textarea","select","button"].include(event.element().tagName.toLowerCase()))
event.stop();},_deinit:function()
{this._removeObservers();Event.stopObserving(window,"resize",this._setWidthAndPosition);if(this.options.transitions){Effect.toggle(this.MBoverlay,'appear',{duration:this.options.overlayDuration,afterFinish:this._removeElements.bind(this)});}else{this.MBoverlay.hide();this._removeElements();}
$(this.MBcontent).setStyle({overflow:'',height:''});},_removeElements:function(){$(this.MBoverlay).remove();$(this.MBwindow).remove();if(Prototype.Browser.IE&&!navigator.appVersion.match(/\b7.0\b/)){this._prepareIE("","");window.scrollTo(this.initScrollX,this.initScrollY);}
if(typeof this.content=='object'){if(this.content.id&&this.content.id.match(/MB_/)){this.content.id=this.content.id.replace(/MB_/,"");}
this.content.select('*[id]').each(function(el){el.id=el.id.replace(/MB_/,"");});}
this.initialized=false;this.event("afterHide");this.setOptions(this._options);},_setWidth:function(){$(this.MBwindow).setStyle({width:this.options.width+"px",height:this.options.height+"px"});},_setPosition:function(){$(this.MBwindow).setStyle({left:Math.round((Element.getWidth(document.body)-Element.getWidth(this.MBwindow))/2)+"px"});var totalHeight=(this.MBcontent.getHeight()+this.MBheader.getHeight());if(totalHeight>0){$(this.MBwindow).setStyle({top:Math.round((Element.getHeight(document.viewport)-totalHeight)/2)+"px"});}},_setWidthAndPosition:function(){$(this.MBwindow).setStyle({width:this.options.width+"px"});this._setPosition();},_getScrollTop:function(){var theTop;if(document.documentElement&&document.documentElement.scrollTop)
theTop=document.documentElement.scrollTop;else if(document.body)
theTop=document.body.scrollTop;return theTop;},_prepareIE:function(height,overflow){$$('html, body').invoke('setStyle',{width:height,height:height,overflow:overflow});$$("select").invoke('setStyle',{'visibility':overflow});},event:function(eventName){if(this.options[eventName]){var returnValue=this.options[eventName]();this.options[eventName]=null;if(returnValue!=undefined)
return returnValue;else
return true;}
return true;}};Object.extend(Modalbox,Modalbox.Methods);if(Modalbox.overrideAlert)window.alert=Modalbox.alert;Effect.ScaleBy=Class.create();Object.extend(Object.extend(Effect.ScaleBy.prototype,Effect.Base.prototype),{initialize:function(element,byWidth,byHeight,options){this.element=$(element)
var options=Object.extend({scaleFromTop:true,scaleMode:'box',scaleByWidth:byWidth,scaleByHeight:byHeight},arguments[3]||{});this.start(options);},setup:function(){this.elementPositioning=this.element.getStyle('position');this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;this.dims=null;if(this.options.scaleMode=='box')
this.dims=[this.element.offsetHeight,this.element.offsetWidth];if(/^content/.test(this.options.scaleMode))
this.dims=[this.element.scrollHeight,this.element.scrollWidth];if(!this.dims)
this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth];this.deltaY=this.options.scaleByHeight;this.deltaX=this.options.scaleByWidth;},update:function(position){var currentHeight=this.dims[0]+(this.deltaY*position);var currentWidth=this.dims[1]+(this.deltaX*position);currentHeight=(currentHeight>0)?currentHeight:0;currentWidth=(currentWidth>0)?currentWidth:0;this.setDimensions(currentHeight,currentWidth);},setDimensions:function(height,width){var d={};d.width=width+'px';d.height=height+'px';var topd=Math.round((height-this.dims[0])/2);var leftd=Math.round((width-this.dims[1])/2);if(this.elementPositioning=='absolute'||this.elementPositioning=='fixed'){if(!this.options.scaleFromTop)d.top=this.originalTop-topd+'px';d.left=this.originalLeft-leftd+'px';}else{if(!this.options.scaleFromTop)d.top=-topd+'px';d.left=-leftd+'px';}
this.element.setStyle(d);}});;if(typeof Effect=='undefined')
throw("accordion.js requires including script.aculo.us' effects.js library!");var accordion=Class.create();accordion.prototype={showAccordion:null,currentAccordion:null,duration:null,effects:[],animating:false,initialize:function(container,options){if(!$(container)){throw(container+" doesn't exist!");return false;}
this.options=Object.extend({resizeSpeed:8,classNames:{toggle:'accordion_toggle',toggleActive:'accordion_toggle_active',content:'accordion_content'},defaultSize:{height:null,width:null},direction:'vertical',onEvent:'click'},options||{});this.duration=((11-this.options.resizeSpeed)*0.15);var accordions=$$('#'+container+' .'+this.options.classNames.toggle);accordions.each(function(accordion){Event.observe(accordion,this.options.onEvent,this.activate.bind(this,accordion),false);if(this.options.onEvent=='click'){accordion.onclick=function(){return false;};}
if(this.options.direction=='horizontal'){var options={width:'0px'};}else{var options={height:'0px'};}
this.currentAccordion=$(accordion.next(0)).setStyle(options);}.bind(this));},activate:function(accordion){if(this.animating){return false;}
this.effects=[];this.currentAccordion=$(accordion.next(0));this.currentAccordion.setStyle({display:'block'});this.currentAccordion.previous(0).addClassName(this.options.classNames.toggleActive);if(this.options.direction=='horizontal'){this.scaling=$H({scaleX:true,scaleY:false});}else{this.scaling=$H({scaleX:false,scaleY:true});}
if(this.currentAccordion==this.showAccordion){this.deactivate();}else{this._handleAccordion();}},deactivate:function(){var options=$H({duration:this.duration,scaleContent:false,transition:Effect.Transitions.sinoidal,queue:{position:'end',scope:'accordionAnimation'},scaleMode:{originalHeight:this.options.defaultSize.height?this.options.defaultSize.height:this.currentAccordion.scrollHeight,originalWidth:this.options.defaultSize.width?this.options.defaultSize.width:this.currentAccordion.scrollWidth},afterFinish:function(){this.showAccordion.setStyle({height:'auto',display:'none'});this.showAccordion=null;this.animating=false;}.bind(this)});this.showAccordion.previous(0).removeClassName(this.options.classNames.toggleActive);new Effect.Scale(this.showAccordion,0,options.update(this.scaling).toObject());},_handleAccordion:function(){var options=$H({sync:true,scaleFrom:0,scaleContent:false,transition:Effect.Transitions.sinoidal,scaleMode:{originalHeight:this.options.defaultSize.height?this.options.defaultSize.height:this.currentAccordion.scrollHeight,originalWidth:this.options.defaultSize.width?this.options.defaultSize.width:this.currentAccordion.scrollWidth}});options.merge(this.scaling);this.effects.push(new Effect.Scale(this.currentAccordion,100,options.update(this.scaling).toObject()));if(this.showAccordion){this.showAccordion.previous(0).removeClassName(this.options.classNames.toggleActive);options=$H({sync:true,scaleContent:false,transition:Effect.Transitions.sinoidal});options.merge(this.scaling);this.effects.push(new Effect.Scale(this.showAccordion,0,options.update(this.scaling).toObject()));}
new Effect.Parallel(this.effects,{duration:this.duration,queue:{position:'end',scope:'accordionAnimation'},beforeStart:function(){this.animating=true;}.bind(this),afterFinish:function(){if(this.showAccordion){this.showAccordion.setStyle({display:'none'});}
$(this.currentAccordion).setStyle({height:'auto'});this.showAccordion=this.currentAccordion;this.animating=false;}.bind(this)});}};Ajax.AutoPopulateSelect=Class.create({initialize:function(targetElement,targetOptionsUrl,observationElement,startingValue,options){this.targetOptionsUrl=targetOptionsUrl;this.targetElement=targetElement;this.observationElement=observationElement;this.startingValue=startingValue;if(this.setOptions){this.setOptions(options);}else{this.options=options||{};}
this.options.useEmptyOptionsCustomField=this.options.useEmptyOptionsCustomField||false;this.options.emptyOptionsCustomField=this.options.emptyOptionsCustomField||'';if($(this.observationElement)==null||$(this.targetElement)==null||(this.options.useEmptyOptionsCustomField==true&&$(this.options.emptyOptionsCustomField)==null)){Event.observe(window,'load',function(){this.populate()
this.setObserver();}.bind(this));}else{this.setObserver();this.populate();}},populate:function(){value=$(this.observationElement).getValue();new Ajax.Request(this.targetOptionsUrl,{method:'post',parameters:{'observationvalue':value},onSuccess:function(transport)
{if(transport.responseText==''){$(this.targetElement).parentNode.hide();$(this.targetElement).update(transport.responseText);if(this.options.useEmptyOptionsCustomField=='true')
{$(this.options.emptyOptionsCustomField).show();}}else{if(this.options.useEmptyOptionsCustomField=='true')
{$(this.options.emptyOptionsCustomField).hide();}
$(this.targetElement).parentNode.show();$(this.targetElement).update(transport.responseText);$(this.targetElement).setValue(this.startingValue);}}.bind(this)});},setObserver:function(){$(this.observationElement).observe('change',this.populate.bind(this));}});;var FlashMessager=new Object();FlashMessager.Methods={activeFlag:false,show:function(messageText)
{if(this.activeFlag==false){this.activeFlag=true;$('flashMessager').setStyle({display:'none'});message=new Element('ul').insert(new Element('li').update(messageText));messagewrapper=new Element('div',{'id':'flashMessagerMessage'}).insert(message);$('flashMessager').insert(messagewrapper);Effect.Appear($('flashMessager'),{duration:1.0});Effect.BlindUp($('flashMessager'),{duration:1.0,delay:5,afterFinish:function(){messagewrapper.remove();this.activeFlag=false;}.bind(this)});}}}
Object.extend(FlashMessager,FlashMessager.Methods);;var Calendar=Class.create()
Calendar.VERSION='1.0'
Calendar.DAY_NAMES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday')
Calendar.SHORT_DAY_NAMES=new Array('S','M','T','W','T','F','S','S')
Calendar.MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December')
Calendar.SHORT_MONTH_NAMES=new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')
Calendar.NAV_PREVIOUS_YEAR=-2
Calendar.NAV_PREVIOUS_MONTH=-1
Calendar.NAV_TODAY=0
Calendar.NAV_NEXT_MONTH=1
Calendar.NAV_NEXT_YEAR=2
Calendar.currentDisplayYear=0
Calendar._checkCalendar=function(event){if(!window._popupCalendar)
return false
if(Element.descendantOf(Event.element(event),window._popupCalendar.container))
return
window._popupCalendar.callCloseHandler()
return Event.stop(event)}
Calendar.handleMouseDownEvent=function(event)
{Event.observe(document,'mouseup',Calendar.handleMouseUpEvent)
Event.stop(event)}
Calendar.handleMouseUpEvent=function(event)
{var el=Event.element(event)
var calendar=el.calendar
var isNewDate=false
if(!calendar)return false
if(typeof el.navAction=='undefined')
{if(calendar.currentDateElement){Element.removeClassName(calendar.currentDateElement,'selected')
Element.addClassName(el,'selected')
calendar.shouldClose=(calendar.currentDateElement==el)
if(!calendar.shouldClose)calendar.currentDateElement=el}
calendar.date.setDateOnly(el.date)
isNewDate=true
calendar.shouldClose=!el.hasClassName('otherDay')
var isOtherMonth=!calendar.shouldClose
if(isOtherMonth)calendar.update(calendar.date)}
else
{var date=new Date(calendar.date)
if(el.navAction==Calendar.NAV_TODAY)
date.setDateOnly(new Date())
var year=date.getFullYear()
var mon=date.getMonth()
function setMonth(m){var day=date.getDate()
var max=date.getMonthDays(m)
if(day>max)date.setDate(max)
date.setMonth(m)}
switch(el.navAction){case Calendar.NAV_PREVIOUS_YEAR:if(year>calendar.minYear)
Calendar.currentDisplayYear=year-1
date.setFullYear(year-1)
break
case Calendar.NAV_PREVIOUS_MONTH:if(mon>0){setMonth(mon-1)}
else if(year>calendar.minYear){Calendar.currentDisplayYear=year-1
date.setFullYear(year-1)
setMonth(11)}
break
case Calendar.NAV_TODAY:break
case Calendar.NAV_NEXT_MONTH:if(mon<11){setMonth(mon+1)}
else if(year<calendar.maxYear){Calendar.currentDisplayYear=year+1
date.setFullYear(year+1)
setMonth(0)}
break
case Calendar.NAV_NEXT_YEAR:if(year<calendar.maxYear)
Calendar.currentDisplayYear=year+1
date.setFullYear(year+1)
break}
if(!date.equalsTo(calendar.date)){calendar.setDate(date)
isNewDate=true}else if(el.navAction==0){isNewDate=(calendar.shouldClose=true)}}
if(isNewDate)event&&calendar.callSelectHandler()
if(calendar.shouldClose)event&&calendar.callCloseHandler()
Event.stopObserving(document,'mouseup',Calendar.handleMouseUpEvent)
return Event.stop(event)}
Calendar.defaultSelectHandler=function(calendar)
{if(!calendar.dateField)return false
if(calendar.dateField.tagName=='DIV')
Element.update(calendar.dateField,calendar.date.print(calendar.dateFormat))
else if(calendar.dateField.tagName=='INPUT'){calendar.dateField.value=calendar.date.print(calendar.dateFormat)}
if(typeof calendar.dateField.onchange=='function')
calendar.dateField.onchange()
if(calendar.shouldClose)calendar.callCloseHandler()}
Calendar.defaultCloseHandler=function(calendar)
{calendar.hide()}
Calendar.setup=function(params)
{function param_default(name,def){if(!params[name])params[name]=def}
param_default('dateField',null)
param_default('triggerElement',null)
param_default('parentElement',null)
param_default('selectHandler',null)
param_default('closeHandler',null)
if(params.parentElement)
{var calendar=new Calendar(params.parentElement)
calendar.setSelectHandler(params.selectHandler||Calendar.defaultSelectHandler)
if(params.dateFormat)
calendar.setDateFormat(params.dateFormat)
if(params.dateField){calendar.setDateField(params.dateField)
calendar.parseDate(calendar.dateField.innerHTML||calendar.dateField.value)}
calendar.show()
return calendar}
else
{var triggerElement=$(params.triggerElement||params.dateField)
triggerElement.onclick=function(){var calendar=new Calendar()
calendar.setSelectHandler(params.selectHandler||Calendar.defaultSelectHandler)
calendar.setCloseHandler(params.closeHandler||Calendar.defaultCloseHandler)
if(params.dateFormat)
calendar.setDateFormat(params.dateFormat)
if(params.dateField){calendar.setDateField(params.dateField)
calendar.parseDate(calendar.dateField.innerHTML||calendar.dateField.value)}
if(params.dateField)
Date.parseDate(calendar.dateField.value||calendar.dateField.innerHTML,calendar.dateFormat)
calendar.showAtElement(triggerElement)
return calendar}}}
Calendar.prototype={container:null,selectHandler:null,closeHandler:null,minYear:1900,maxYear:2100,dateFormat:'%m/%d/%Y',date:new Date(),currentDateElement:null,shouldClose:false,isPopup:true,dateField:null,initialize:function(parent)
{if(parent)
this.create($(parent))
else
this.create()},update:function(date)
{var calendar=this
var today=new Date()
var thisYear=today.getFullYear()
var thisMonth=today.getMonth()
var thisDay=today.getDate()
var month=date.getMonth();var dayOfMonth=date.getDate();if(date.getFullYear()<this.minYear)
date.setFullYear(this.minYear)
else if(date.getFullYear()>this.maxYear)
date.setFullYear(this.maxYear)
this.date=new Date(date)
Calendar.currentDisplayYear=date.getFullYear()
date.setDate(1)
date.setDate(-(date.getDay())+1)
Element.getElementsBySelector(this.container,'tbody tr').each(function(row,i){var rowHasDays=false
row.immediateDescendants().each(function(cell,j){var day=date.getDate()
var dayOfWeek=date.getDay()
var isCurrentMonth=(date.getMonth()==month)
cell.className=''
cell.date=new Date(date)
Element.update(cell,day)
if(!isCurrentMonth)
Element.addClassName(cell,'otherDay')
else
rowHasDays=true
if(isCurrentMonth&&day==dayOfMonth){Element.addClassName(cell,'selected')
calendar.currentDateElement=cell}
if(date.getFullYear()==thisYear&&date.getMonth()==thisMonth&&day==thisDay)
Element.addClassName(cell,'today')
if([0,6].indexOf(dayOfWeek)!=-1)
Element.addClassName(cell,'weekend')
date.setDate(day+1)})
if(!rowHasDays)
Element.hide(row)
else
Element.show(row)})
this.container.getElementsBySelector('td.title')[0].update(Calendar.MONTH_NAMES[month]+' '+Calendar.currentDisplayYear)},create:function(parent)
{if(!parent){parent=document.getElementsByTagName('body')[0]
this.isPopup=true}else{this.isPopup=false}
var table=Builder.node('table')
var thead=Builder.node('thead')
table.appendChild(thead)
var row=Builder.node('tr',[Builder.node('td',{colSpan:7,className:'title'})])
thead.appendChild(row)
row=Builder.node('tr')
this._drawButtonCell(row,'&#x00ab;',1,Calendar.NAV_PREVIOUS_YEAR)
this._drawButtonCell(row,'&#x2039;',1,Calendar.NAV_PREVIOUS_MONTH)
this._drawButtonCell(row,'Today',3,Calendar.NAV_TODAY)
this._drawButtonCell(row,'&#x203a;',1,Calendar.NAV_NEXT_MONTH)
this._drawButtonCell(row,'&#x00bb;',1,Calendar.NAV_NEXT_YEAR)
thead.appendChild(row)
row=Builder.node('tr')
for(var i=0;i<7;++i){cell=Builder.node('th',Calendar.SHORT_DAY_NAMES[i])
if(i==0||i==6)
Element.addClassName(cell,'weekend')
row.appendChild(cell)}
thead.appendChild(row)
var tbody=table.appendChild(Builder.node('tbody'))
for(i=6;i>0;--i){row=tbody.appendChild(Builder.node('tr',{className:'days'}))
for(var j=7;j>0;--j){cell=row.appendChild(Builder.node('td'))
cell.calendar=this}}
this.container=Builder.node('div',{className:'calendar'})
if(this.isPopup){Element.setStyle(this.container,{position:'absolute',display:'none'})
Element.addClassName(this.container,'popup')}
this.container.appendChild(table)
this.update(this.date)
Event.observe(this.container,'mousedown',Calendar.handleMouseDownEvent)
parent.appendChild(this.container)},_drawButtonCell:function(parent,text,colSpan,navAction)
{var cell=Builder.node('td')
if(colSpan>1)cell.colSpan=colSpan
cell.className='button'
cell.calendar=this
cell.navAction=navAction
cell.innerHTML=text
cell.unselectable='on'
parent.appendChild(cell)
return cell},callSelectHandler:function()
{if(this.selectHandler)
this.selectHandler(this,this.date.print(this.dateFormat))},callCloseHandler:function()
{if(this.closeHandler)
this.closeHandler(this)},show:function()
{Element.show(this.container)
if(this.isPopup){window._popupCalendar=this
Event.observe(document,'mousedown',Calendar._checkCalendar)}},showAt:function(x,y)
{Element.setStyle(this.container,{left:x+'px',top:y+'px'})
this.show()},showAtElement:function(element)
{var pos=Position.cumulativeOffset(element)
this.showAt(pos[0],pos[1])},hide:function()
{if(this.isPopup)
Event.stopObserving(document,'mousedown',Calendar._checkCalendar)
Element.hide(this.container)},parseDate:function(str,format)
{if(!format)
format=this.dateFormat
this.setDate(Date.parseDate(str,format))},setSelectHandler:function(selectHandler)
{this.selectHandler=selectHandler},setCloseHandler:function(closeHandler)
{this.closeHandler=closeHandler},setDate:function(date)
{if(!date.equalsTo(this.date))
this.update(date)},setDateFormat:function(format)
{this.dateFormat=format},setDateField:function(field)
{this.dateField=$(field)},setRange:function(minYear,maxYear)
{this.minYear=minYear
this.maxYear=maxYear}}
window._popupCalendar=null
Date.DAYS_IN_MONTH=new Array(31,28,31,30,31,30,31,31,30,31,30,31)
Date.SECOND=1000
Date.MINUTE=60*Date.SECOND
Date.HOUR=60*Date.MINUTE
Date.DAY=24*Date.HOUR
Date.WEEK=7*Date.DAY
Date.parseDate=function(str,fmt){var today=new Date();var y=0;var m=-1;var d=0;var a=str.split(/\W+/);var b=fmt.match(/%./g);var i=0,j=0;var hr=0;var min=0;for(i=0;i<a.length;++i){if(!a[i])continue;switch(b[i]){case"%d":case"%e":d=parseInt(a[i],10);break;case"%m":m=parseInt(a[i],10)-1;break;case"%Y":case"%y":y=parseInt(a[i],10);(y<100)&&(y+=(y>29)?1900:2000);break;case"%b":case"%B":for(j=0;j<12;++j){if(Calendar.MONTH_NAMES[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){m=j;break;}}
break;case"%H":case"%I":case"%k":case"%l":hr=parseInt(a[i],10);break;case"%P":case"%p":if(/pm/i.test(a[i])&&hr<12)
hr+=12;else if(/am/i.test(a[i])&&hr>=12)
hr-=12;break;case"%M":min=parseInt(a[i],10);break;}}
if(isNaN(y))y=today.getFullYear();if(isNaN(m))m=today.getMonth();if(isNaN(d))d=today.getDate();if(isNaN(hr))hr=today.getHours();if(isNaN(min))min=today.getMinutes();if(y!=0&&m!=-1&&d!=0)
return new Date(y,m,d,hr,min,0);y=0;m=-1;d=0;for(i=0;i<a.length;++i){if(a[i].search(/[a-zA-Z]+/)!=-1){var t=-1;for(j=0;j<12;++j){if(Calendar.MONTH_NAMES[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){t=j;break;}}
if(t!=-1){if(m!=-1){d=m+1;}
m=t;}}else if(parseInt(a[i],10)<=12&&m==-1){m=a[i]-1;}else if(parseInt(a[i],10)>31&&y==0){y=parseInt(a[i],10);(y<100)&&(y+=(y>29)?1900:2000);}else if(d==0){d=a[i];}}
if(y==0)
y=today.getFullYear();if(m!=-1&&d!=0)
return new Date(y,m,d,hr,min,0);return today;};Date.prototype.getMonthDays=function(month){var year=this.getFullYear()
if(typeof month=="undefined")
month=this.getMonth()
if(((0==(year%4))&&((0!=(year%100))||(0==(year%400))))&&month==1)
return 29
else
return Date.DAYS_IN_MONTH[month]};Date.prototype.getDayOfYear=function(){var now=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var then=new Date(this.getFullYear(),0,0,0,0,0);var time=now-then;return Math.floor(time/Date.DAY);};Date.prototype.getWeekNumber=function(){var d=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var DoW=d.getDay();d.setDate(d.getDate()-(DoW+6)%7+3);var ms=d.valueOf();d.setMonth(0);d.setDate(4);return Math.round((ms-d.valueOf())/(7*864e5))+1;};Date.prototype.equalsTo=function(date){return((this.getFullYear()==date.getFullYear())&&(this.getMonth()==date.getMonth())&&(this.getDate()==date.getDate())&&(this.getHours()==date.getHours())&&(this.getMinutes()==date.getMinutes()));};Date.prototype.setDateOnly=function(date){var tmp=new Date(date);this.setDate(1);this.setFullYear(tmp.getFullYear());this.setMonth(tmp.getMonth());this.setDate(tmp.getDate());};Date.prototype.print=function(str){var m=this.getMonth();var d=this.getDate();var y=this.getFullYear();var wn=this.getWeekNumber();var w=this.getDay();var s={};var hr=this.getHours();var pm=(hr>=12);var ir=(pm)?(hr-12):hr;var dy=this.getDayOfYear();if(ir==0)
ir=12;var min=this.getMinutes();var sec=this.getSeconds();s["%a"]=Calendar.SHORT_DAY_NAMES[w];s["%A"]=Calendar.DAY_NAMES[w];s["%b"]=Calendar.SHORT_MONTH_NAMES[m];s["%B"]=Calendar.MONTH_NAMES[m];s["%C"]=1+Math.floor(y/100);s["%d"]=(d<10)?("0"+d):d;s["%e"]=d;s["%H"]=(hr<10)?("0"+hr):hr;s["%I"]=(ir<10)?("0"+ir):ir;s["%j"]=(dy<100)?((dy<10)?("00"+dy):("0"+dy)):dy;s["%k"]=hr;s["%l"]=ir;s["%m"]=(m<9)?("0"+(1+m)):(1+m);s["%M"]=(min<10)?("0"+min):min;s["%n"]="\n";s["%p"]=pm?"PM":"AM";s["%P"]=pm?"pm":"am";s["%s"]=Math.floor(this.getTime()/1000);s["%S"]=(sec<10)?("0"+sec):sec;s["%t"]="\t";s["%U"]=s["%W"]=s["%V"]=(wn<10)?("0"+wn):wn;s["%u"]=w+1;s["%w"]=w;s["%y"]=(''+y).substr(2,2);s["%Y"]=y;s["%%"]="%";return str.gsub(/%./,function(match){return s[match]||match});};Date.prototype.__msh_oldSetFullYear=Date.prototype.setFullYear;Date.prototype.setFullYear=function(y){var d=new Date(this);d.__msh_oldSetFullYear(y);if(d.getMonth()!=this.getMonth())
this.setDate(28);this.__msh_oldSetFullYear(y);};Auth={checkUrl:null,failureRedirectUrl:null,periodicalExecuter:null,intervalInSeconds:10,startChecking:function(checkUrl,failureRedirectUrl)
{this.checkUrl=checkUrl;this.failureRedirectUrl=failureRedirectUrl;this.periodicalExecuter=new PeriodicalExecuter(function(pe){this.checkAuth();}.bind(this),this.intervalInSeconds);},checkAuth:function()
{new Ajax.Request(this.checkUrl,{onSuccess:function(transport){if(transport.responseText!='Logged In'){this.alertUser();}}.bind(this),onFailure:function(transport){}.bind(this)});},alertUser:function()
{this.periodicalExecuter.stop();Modalbox.show('<div>You have been logged out due to inactivity.</div> <br /><a href="'+this.failureRedirectUrl+'" class="button">Log Back In</a>',{title:'System Message',width:400,overlayClose:false,closeEnabled:false});}};Ajax.InlineBox=Class.create({initialize:function(element,url,options){this.Element=$(element);this.url=url;this.options=options||{};this.options.method=this.options.method||'get';this.options.params=this.options.params||{};this.options.afterFinish=this.options.afterFinish||function(){};},load:function()
{var loaderDiv=new Element('div',{'class':'inlineBoxLoading'}).update("");this.Element.show().update(loaderDiv);this.Element.setStyle({height:loaderDiv.getHeight()+'px'});new PeriodicalExecuter(function(pe){this._loadContent();pe.stop();}.bind(this),1);return this;},reload:function(params)
{this.options.params=params||this.options.params;this.load();},_loadContent:function()
{new Ajax.Request(this.url,{method:this.options.method.toLowerCase(),parameters:this.options.params,onSuccess:function(transport){var response=new String(transport.responseText);this._insertContent(transport.responseText.stripScripts());}.bind(this),onException:function(instance,exception){throw('Loading Error: '+exception);},onFailure:function(instance,exception){throw('Loading Error: '+exception);}});},_insertContent:function(content){var wrapperDiv=new Element('div',{}).hide().update(content);this.Element.update(wrapperDiv);this.Element.setStyle({height:wrapperDiv.getHeight()+'px'});Effect.Appear(wrapperDiv,{duration:0.5,delay:0.1,afterFinish:this.options.afterFinish()});}});;var Submitter=new Object();var SubmitterDebugMode=true;Form.Submitter={currentErrors:[],formId:'fm',id:0,submit:function()
{$(this.formId).request({onComplete:function(transport)
{if(!transport.responseText.isJSON()){this.showFailMessage(transport.responseText);}else{var responseJson=transport.responseText.evalJSON();var oldErrors=this.currentErrors;this.currentErrors=$H(responseJson.errorMessages).keys();$$('div.errorWrapper').each(function(container)
{var title=container.readAttribute('title');if(!this.currentErrors.include(title))
{Effect.Fade(container,{duration:0.5,afterFinish:function()
{var ul=container.firstDescendant();if(ul)ul.remove();}});}}.bind(this));$H(responseJson.errorMessages).each(function(message)
{$$('div.errorWrapper').each(function(container)
{var title=container.readAttribute('title');if(message.key==title)
{var errorHtml=container.firstDescendant();if(errorHtml){errorHtml.remove();container.insert(message.value);}else{container.setStyle({display:'none'});container.insert(message.value);Effect.Appear(container,{duration:0.5});}}}.bind(this));}.bind(this));if(responseJson.status=='Update'){$(this.formId).fire("form:success");}else if(responseJson.status=='New'){if(responseJson.id!=0){this.id=responseJson.id;}
$(this.formId).fire("form:success");}}}.bind(this),onFailure:function()
{this.showFailMessage(transport);}.bind(this)});},submitWithSuccessMessage:function(formId,successMessage)
{this.formId=formId;$(this.formId).observe("form:success",function(event){replacedSuccessMessage=successMessage.replace("{id}",this.id);FlashMessager.show(replacedSuccessMessage);$(this.formId).stopObserving();}.bind(this));this.submit(this.formId);},submitWithSuccessRedirect:function(formId,url)
{this.formId=formId;$(this.formId).observe("form:success",function(event){$(this.formId).stopObserving();replacedUrl=url.replace("{id}",this.id);window.location=replacedUrl;}.bind(this));this.submit(this.formId);},showFailMessage:function(debugData)
{if(SubmitterDebugMode){document.write(debugData);}else{Modalbox.show('<div>There was an error processing your request.</div>',{title:'System Message',width:400});}}};Object.extend(Submitter,Form.Submitter);;if(typeof(Prototype)=="undefined"){throw"Control.Rating requires Prototype to be loaded.";}
if(typeof(Object.Event)=="undefined"){throw"Control.Rating requires Object.Event to be loaded.";}
Control.Rating=Class.create({initialize:function(container,options){Control.Rating.instances.push(this);this.value=false;this.links=[];this.container=$(container);this.container.update('');this.options={min:1,max:5,rated:false,input:false,reverse:false,capture:true,multiple:false,classNames:{off:'rating_off',half:'rating_half',on:'rating_on',selected:'rating_selected'},updateUrl:false,updateParameterName:'value',updateOptions:{},afterChange:Prototype.emptyFunction};Object.extend(this.options,options||{});if(this.options.value){this.value=this.options.value;delete this.options.value;}
if(this.options.input){this.options.input=$(this.options.input);this.options.input.observe('change',function(input){this.setValueFromInput(input);}.bind(this,this.options.input));this.setValueFromInput(this.options.input,true);}
var range=$R(this.options.min,this.options.max);(this.options.reverse?$A(range).reverse():range).each(function(i){var link=this.buildLink(i);this.container.appendChild(link);this.links.push(link);}.bind(this));this.setValue(this.value||this.options.min-1,false,true);},buildLink:function(rating){var link=$(document.createElement('a'));link.value=rating;if(this.options.multiple||(!this.options.rated&&!this.options.multiple)){link.href='';link.onmouseover=this.mouseOver.bind(this,link);link.onmouseout=this.mouseOut.bind(this,link);link.onclick=this.click.bindAsEventListener(this,link);}else{link.style.cursor='default';link.observe('click',function(event){Event.stop(event);return false;}.bindAsEventListener(this));}
link.addClassName(this.options.classNames.off);return link;},disable:function(){this.links.each(function(link){link.onmouseover=Prototype.emptyFunction;link.onmouseout=Prototype.emptyFunction;link.onclick=Prototype.emptyFunction;link.observe('click',function(event){Event.stop(event);return false;}.bindAsEventListener(this));link.style.cursor='default';}.bind(this));},setValueFromInput:function(input,prevent_callbacks){this.setValue($F(input),true,prevent_callbacks);},setValue:function(value,force_selected,prevent_callbacks){this.value=value;if(this.options.input){if(this.options.input.options){$A(this.options.input.options).each(function(option,i){if(option.value==this.value){this.options.input.options.selectedIndex=i;throw $break;}}.bind(this));}else{this.options.input.value=this.value;}}
this.render(this.value,force_selected);if(!prevent_callbacks){if(this.options.updateUrl){var params={},a;params[this.options.updateParameterName]=this.value;a=new Ajax.Request(this.options.updateUrl,Object.extend(this.options.updateOptions,{parameters:params}));}
this.notify('afterChange',this.value);}},render:function(rating,force_selected){(this.options.reverse?this.links.reverse():this.links).each(function(link,i){if(link.value<=Math.ceil(rating)){link.className=this.options.classNames[link.value<=rating?'on':'half'];if(this.options.rated||force_selected){link.addClassName(this.options.classNames.selected);}}else{link.className=this.options.classNames.off;}}.bind(this));},mouseOver:function(link){this.render(link.value,true);},mouseOut:function(link){this.render(this.value);},click:function(event,link){this.options.rated=true;this.setValue((link.value?link.value:link),true);if(!this.options.multiple){this.disable();}
if(this.options.capture){Event.stop(event);return false;}}});Object.extend(Control.Rating,{instances:[],findByElementId:function(id){return Control.Rating.instances.find(function(instance){return(instance.container.id&&instance.container.id==id);});}});Object.Event.extend(Control.Rating);;if(typeof(Control)=='undefined')
Control={};var $proc=function(proc){return typeof(proc)=='function'?proc:function(){return proc};};var $value=function(value){return typeof(value)=='function'?value():value;};Object.Event={extend:function(object){object._objectEventSetup=function(event_name){this._observers=this._observers||{};this._observers[event_name]=this._observers[event_name]||[];};object.observe=function(event_name,observer){if(typeof(event_name)=='string'&&typeof(observer)!='undefined'){this._objectEventSetup(event_name);if(!this._observers[event_name].include(observer))
this._observers[event_name].push(observer);}else
for(var e in event_name)
this.observe(e,event_name[e]);};object.stopObserving=function(event_name,observer){this._objectEventSetup(event_name);if(event_name&&observer)
this._observers[event_name]=this._observers[event_name].without(observer);else if(event_name)
this._observers[event_name]=[];else
this._observers={};};object.observeOnce=function(event_name,outer_observer){var inner_observer=function(){outer_observer.apply(this,arguments);this.stopObserving(event_name,inner_observer);}.bind(this);this._objectEventSetup(event_name);this._observers[event_name].push(inner_observer);};object.notify=function(event_name){this._objectEventSetup(event_name);var collected_return_values=[];var args=$A(arguments).slice(1);try{for(var i=0;i<this._observers[event_name].length;++i)
collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i],args)||null);}catch(e){if(e==$break)
return false;else
throw e;}
return collected_return_values;};if(object.prototype){object.prototype._objectEventSetup=object._objectEventSetup;object.prototype.observe=object.observe;object.prototype.stopObserving=object.stopObserving;object.prototype.observeOnce=object.observeOnce;object.prototype.notify=function(event_name){if(object.notify){var args=$A(arguments).slice(1);args.unshift(this);args.unshift(event_name);object.notify.apply(object,args);}
this._objectEventSetup(event_name);var args=$A(arguments).slice(1);var collected_return_values=[];try{if(this.options&&this.options[event_name]&&typeof(this.options[event_name])=='function')
collected_return_values.push(this.options[event_name].apply(this,args)||null);for(var i=0;i<this._observers[event_name].length;++i)
collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i],args)||null);}catch(e){if(e==$break)
return false;else
throw e;}
return collected_return_values;};}}};Element.addMethods({observeOnce:function(element,event_name,outer_callback){var inner_callback=function(){outer_callback.apply(this,arguments);Element.stopObserving(element,event_name,inner_callback);};Element.observe(element,event_name,inner_callback);}});Object.extend(Event,(function(){var cache=Event.cache;function getEventID(element){if(element._prototypeEventID)return element._prototypeEventID[0];arguments.callee.id=arguments.callee.id||1;return element._prototypeEventID=[++arguments.callee.id];}
function getDOMEventName(eventName){if(eventName&&eventName.include(':'))return"dataavailable";if(!Prototype.Browser.IE){eventName={mouseenter:'mouseover',mouseleave:'mouseout'}[eventName]||eventName;}
return eventName;}
function getCacheForID(id){return cache[id]=cache[id]||{};}
function getWrappersForEventName(id,eventName){var c=getCacheForID(id);return c[eventName]=c[eventName]||[];}
function createWrapper(element,eventName,handler){var id=getEventID(element);var c=getWrappersForEventName(id,eventName);if(c.pluck("handler").include(handler))return false;var wrapper=function(event){if(!Event||!Event.extend||(event.eventName&&event.eventName!=eventName))
return false;Event.extend(event);handler.call(element,event);};if(!(Prototype.Browser.IE)&&['mouseenter','mouseleave'].include(eventName)){wrapper=wrapper.wrap(function(proceed,event){var rel=event.relatedTarget;var cur=event.currentTarget;if(rel&&rel.nodeType==Node.TEXT_NODE)
rel=rel.parentNode;if(rel&&rel!=cur&&!rel.descendantOf(cur))
return proceed(event);});}
wrapper.handler=handler;c.push(wrapper);return wrapper;}
function findWrapper(id,eventName,handler){var c=getWrappersForEventName(id,eventName);return c.find(function(wrapper){return wrapper.handler==handler});}
function destroyWrapper(id,eventName,handler){var c=getCacheForID(id);if(!c[eventName])return false;c[eventName]=c[eventName].without(findWrapper(id,eventName,handler));}
function destroyCache(){for(var id in cache)
for(var eventName in cache[id])
cache[id][eventName]=null;}
if(window.attachEvent){window.attachEvent("onunload",destroyCache);}
return{observe:function(element,eventName,handler){element=$(element);var name=getDOMEventName(eventName);var wrapper=createWrapper(element,eventName,handler);if(!wrapper)return element;if(element.addEventListener){element.addEventListener(name,wrapper,false);}else{element.attachEvent("on"+name,wrapper);}
return element;},stopObserving:function(element,eventName,handler){element=$(element);var id=getEventID(element),name=getDOMEventName(eventName);if(!handler&&eventName){getWrappersForEventName(id,eventName).each(function(wrapper){element.stopObserving(eventName,wrapper.handler);});return element;}else if(!eventName){Object.keys(getCacheForID(id)).each(function(eventName){element.stopObserving(eventName);});return element;}
var wrapper=findWrapper(id,eventName,handler);if(!wrapper)return element;if(element.removeEventListener){element.removeEventListener(name,wrapper,false);}else{element.detachEvent("on"+name,wrapper);}
destroyWrapper(id,eventName,handler);return element;},fire:function(element,eventName,memo){element=$(element);if(element==document&&document.createEvent&&!element.dispatchEvent)
element=document.documentElement;var event;if(document.createEvent){event=document.createEvent("HTMLEvents");event.initEvent("dataavailable",true,true);}else{event=document.createEventObject();event.eventType="ondataavailable";}
event.eventName=eventName;event.memo=memo||{};if(document.createEvent){element.dispatchEvent(event);}else{element.fireEvent(event.eventType,event);}
return Event.extend(event);}};})());Object.extend(Event,Event.Methods);Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize()});var IframeShim=Class.create({initialize:function(){this.element=new Element('iframe',{style:'position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);display:none',src:'javascript:void(0);',frameborder:0});$(document.body).insert(this.element);},hide:function(){this.element.hide();return this;},show:function(){this.element.show();return this;},positionUnder:function(element){var element=$(element);var offset=element.cumulativeOffset();var dimensions=element.getDimensions();this.element.setStyle({left:offset[0]+'px',top:offset[1]+'px',width:dimensions.width+'px',height:dimensions.height+'px',zIndex:element.getStyle('zIndex')-1}).show();return this;},setBounds:function(bounds){for(prop in bounds)
bounds[prop]+='px';this.element.setStyle(bounds);return this;},destroy:function(){if(this.element)
this.element.remove();return this;}});if(typeof(Prototype)=="undefined")
throw"Control.Tabs requires Prototype to be loaded.";if(typeof(Object.Event)=="undefined")
throw"Control.Tabs requires Object.Event to be loaded.";Control.Tabs=Class.create({initialize:function(tab_list_container,options){if(!$(tab_list_container))
throw"Control.Tabs could not find the element: "+tab_list_container;this.activeContainer=false;this.activeLink=false;this.containers=$H({});this.links=[];Control.Tabs.instances.push(this);this.options={beforeChange:Prototype.emptyFunction,afterChange:Prototype.emptyFunction,hover:false,linkSelector:'li a',setClassOnContainer:false,activeClassName:'active',defaultTab:'first',autoLinkExternal:true,targetRegExp:/#(.+)$/,showFunction:Element.show,hideFunction:Element.hide};Object.extend(this.options,options||{});(typeof(this.options.linkSelector=='string')?$(tab_list_container).select(this.options.linkSelector):this.options.linkSelector($(tab_list_container))).findAll(function(link){return(/^#/).exec((Prototype.Browser.WebKit?decodeURIComponent(link.href):link.href).replace(window.location.href.split('#')[0],''));}).each(function(link){this.addTab(link);}.bind(this));this.containers.values().each(Element.hide);if(this.options.defaultTab=='first')
this.setActiveTab(this.links.first());else if(this.options.defaultTab=='last')
this.setActiveTab(this.links.last());else
this.setActiveTab(this.options.defaultTab);var targets=this.options.targetRegExp.exec(window.location);if(targets&&targets[1]){targets[1].split(',').each(function(target){this.setActiveTab(this.links.find(function(link){return link.key==target;}));}.bind(this));}
if(this.options.autoLinkExternal){$A(document.getElementsByTagName('a')).each(function(a){if(!this.links.include(a)){var clean_href=a.href.replace(window.location.href.split('#')[0],'');if(clean_href.substring(0,1)=='#'){if(this.containers.keys().include(clean_href.substring(1))){$(a).observe('click',function(event,clean_href){this.setActiveTab(clean_href.substring(1));}.bindAsEventListener(this,clean_href));}}}}.bind(this));}},addTab:function(link){this.links.push(link);link.key=link.getAttribute('href').replace(window.location.href.split('#')[0],'').split('/').last().replace(/#/,'');var container=$(link.key);if(!container)
throw"Control.Tabs: #"+link.key+" was not found on the page."
this.containers.set(link.key,container);link[this.options.hover?'onmouseover':'onclick']=function(link){if(window.event)
Event.stop(window.event);this.setActiveTab(link);return false;}.bind(this,link);},setActiveTab:function(link){if(!link&&typeof(link)=='undefined')
return;if(typeof(link)=='string'){this.setActiveTab(this.links.find(function(_link){return _link.key==link;}));}else if(typeof(link)=='number'){this.setActiveTab(this.links[link]);}else{if(this.notify('beforeChange',this.activeContainer,this.containers.get(link.key))===false)
return;if(this.activeContainer)
this.options.hideFunction(this.activeContainer);this.links.each(function(item){(this.options.setClassOnContainer?$(item.parentNode):item).removeClassName(this.options.activeClassName);}.bind(this));(this.options.setClassOnContainer?$(link.parentNode):link).addClassName(this.options.activeClassName);this.activeContainer=this.containers.get(link.key);this.activeLink=link;this.options.showFunction(this.containers.get(link.key));this.notify('afterChange',this.containers.get(link.key));}},next:function(){this.links.each(function(link,i){if(this.activeLink==link&&this.links[i+1]){this.setActiveTab(this.links[i+1]);throw $break;}}.bind(this));},previous:function(){this.links.each(function(link,i){if(this.activeLink==link&&this.links[i-1]){this.setActiveTab(this.links[i-1]);throw $break;}}.bind(this));},first:function(){this.setActiveTab(this.links.first());},last:function(){this.setActiveTab(this.links.last());}});Object.extend(Control.Tabs,{instances:[],findByTabId:function(id){return Control.Tabs.instances.find(function(tab){return tab.links.find(function(link){return link.key==id;});});}});Object.Event.extend(Control.Tabs);;var SWFUpload;if(SWFUpload==undefined){SWFUpload=function(settings){this.initSWFUpload(settings);};}
SWFUpload.prototype.initSWFUpload=function(settings){try{this.customSettings={};this.settings=settings;this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings();this.loadFlash();this.displayDebugInfo();}catch(ex){delete SWFUpload.instances[this.movieName];throw ex;}};SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.version="2.2.0 Beta 5 2008-01-29";SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130};SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290};SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5};SWFUpload.BUTTON_ACTION={SELECT_FILE:-100,SELECT_FILES:-110,START_UPLOAD:-120};SWFUpload.CURSOR={ARROW:-1,HAND:-2};SWFUpload.WINDOW_MODE={WINDOW:"window",TRANSPARENT:"transparent",OPAQUE:"opaque"};SWFUpload.prototype.initSettings=function(){this.ensureDefault=function(settingName,defaultValue){this.settings[settingName]=(this.settings[settingName]==undefined)?defaultValue:this.settings[settingName];};this.ensureDefault("upload_url","");this.ensureDefault("file_post_name","Filedata");this.ensureDefault("post_params",{});this.ensureDefault("use_query_string",false);this.ensureDefault("requeue_on_error",false);this.ensureDefault("http_success",[]);this.ensureDefault("file_types","*.*");this.ensureDefault("file_types_description","All Files");this.ensureDefault("file_size_limit",0);this.ensureDefault("file_upload_limit",0);this.ensureDefault("file_queue_limit",0);this.ensureDefault("flash_url","swfupload.swf");this.ensureDefault("prevent_swf_caching",true);this.ensureDefault("button_image_url","");this.ensureDefault("button_width",1);this.ensureDefault("button_height",1);this.ensureDefault("button_text","");this.ensureDefault("button_text_style","color: #000000; font-size: 16pt;");this.ensureDefault("button_text_top_padding",0);this.ensureDefault("button_text_left_padding",0);this.ensureDefault("button_action",SWFUpload.BUTTON_ACTION.SELECT_FILES);this.ensureDefault("button_disabled",false);this.ensureDefault("button_placeholder_id","");this.ensureDefault("button_cursor",SWFUpload.CURSOR.ARROW);this.ensureDefault("button_window_mode",SWFUpload.WINDOW_MODE.WINDOW);this.ensureDefault("debug",false);this.settings.debug_enabled=this.settings.debug;this.settings.return_upload_start_handler=this.returnUploadStart;this.ensureDefault("swfupload_loaded_handler",null);this.ensureDefault("file_dialog_start_handler",null);this.ensureDefault("file_queued_handler",null);this.ensureDefault("file_queue_error_handler",null);this.ensureDefault("file_dialog_complete_handler",null);this.ensureDefault("upload_start_handler",null);this.ensureDefault("upload_progress_handler",null);this.ensureDefault("upload_error_handler",null);this.ensureDefault("upload_success_handler",null);this.ensureDefault("upload_complete_handler",null);this.ensureDefault("debug_handler",this.debugMessage);this.ensureDefault("custom_settings",{});this.customSettings=this.settings.custom_settings;if(!!this.settings.prevent_swf_caching){this.settings.flash_url=this.settings.flash_url+(this.settings.flash_url.indexOf("?")<0?"?":"&")+"preventswfcaching="+new Date().getTime();}
delete this.ensureDefault;};SWFUpload.prototype.loadFlash=function(){var targetElement,tempParent;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added";}
targetElement=document.getElementById(this.settings.button_placeholder_id);if(targetElement==undefined){throw"Could not find the placeholder element: "+this.settings.button_placeholder_id;}
tempParent=document.createElement("div");tempParent.innerHTML=this.getFlashHTML();targetElement.parentNode.replaceChild(tempParent.firstChild,targetElement);if(window[this.movieName]==undefined){window[this.movieName]=this.getMovieElement();}};SWFUpload.prototype.getFlashHTML=function(){return['<object id="',this.movieName,'" type="application/x-shockwave-flash" data="',this.settings.flash_url,'" width="',this.settings.button_width,'" height="',this.settings.button_height,'" class="swfupload">','<param name="wmode" value="',this.settings.button_window_mode,'" />','<param name="movie" value="',this.settings.flash_url,'" />','<param name="quality" value="high" />','<param name="menu" value="false" />','<param name="allowScriptAccess" value="always" />','<param name="flashvars" value="'+this.getFlashVars()+'" />','</object>'].join("");};SWFUpload.prototype.getFlashVars=function(){var paramString=this.buildParamString();var httpSuccessString=this.settings.http_success.join(",");return["movieName=",encodeURIComponent(this.movieName),"&amp;uploadURL=",encodeURIComponent(this.settings.upload_url),"&amp;useQueryString=",encodeURIComponent(this.settings.use_query_string),"&amp;requeueOnError=",encodeURIComponent(this.settings.requeue_on_error),"&amp;httpSuccess=",encodeURIComponent(httpSuccessString),"&amp;params=",encodeURIComponent(paramString),"&amp;filePostName=",encodeURIComponent(this.settings.file_post_name),"&amp;fileTypes=",encodeURIComponent(this.settings.file_types),"&amp;fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&amp;fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&amp;fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&amp;fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&amp;debugEnabled=",encodeURIComponent(this.settings.debug_enabled),"&amp;buttonImageURL=",encodeURIComponent(this.settings.button_image_url),"&amp;buttonWidth=",encodeURIComponent(this.settings.button_width),"&amp;buttonHeight=",encodeURIComponent(this.settings.button_height),"&amp;buttonText=",encodeURIComponent(this.settings.button_text),"&amp;buttonTextTopPadding=",encodeURIComponent(this.settings.button_text_top_padding),"&amp;buttonTextLeftPadding=",encodeURIComponent(this.settings.button_text_left_padding),"&amp;buttonTextStyle=",encodeURIComponent(this.settings.button_text_style),"&amp;buttonAction=",encodeURIComponent(this.settings.button_action),"&amp;buttonDisabled=",encodeURIComponent(this.settings.button_disabled),"&amp;buttonCursor=",encodeURIComponent(this.settings.button_cursor)].join("");};SWFUpload.prototype.getMovieElement=function(){if(this.movieElement==undefined){this.movieElement=document.getElementById(this.movieName);}
if(this.movieElement===null){throw"Could not find Flash element";}
return this.movieElement;};SWFUpload.prototype.buildParamString=function(){var postParams=this.settings.post_params;var paramStringPairs=[];if(typeof(postParams)==="object"){for(var name in postParams){if(postParams.hasOwnProperty(name)){paramStringPairs.push(encodeURIComponent(name.toString())+"="+encodeURIComponent(postParams[name].toString()));}}}
return paramStringPairs.join("&amp;");};SWFUpload.prototype.destroy=function(){try{this.cancelUpload(null,false);var movieElement=null;movieElement=this.getMovieElement();if(movieElement&&typeof(movieElement.CallFunction)==="unknown"){for(var i in movieElement){try{if(typeof(movieElement[i])==="function"){movieElement[i]=null;}}catch(ex1){}}
try{movieElement.parentNode.removeChild(movieElement);}catch(ex){}}
window[this.movieName]=null;SWFUpload.instances[this.movieName]=null;delete SWFUpload.instances[this.movieName];this.movieElement=null;this.settings=null;this.customSettings=null;this.eventQueue=null;this.movieName=null;return true;}catch(ex2){return false;}};SWFUpload.prototype.displayDebugInfo=function(){this.debug(["---SWFUpload Instance Info---\n","Version: ",SWFUpload.version,"\n","Movie Name: ",this.movieName,"\n","Settings:\n","\t","upload_url:               ",this.settings.upload_url,"\n","\t","flash_url:                ",this.settings.flash_url,"\n","\t","use_query_string:         ",this.settings.use_query_string.toString(),"\n","\t","requeue_on_error:         ",this.settings.requeue_on_error.toString(),"\n","\t","http_success:             ",this.settings.http_success.join(", "),"\n","\t","file_post_name:           ",this.settings.file_post_name,"\n","\t","post_params:              ",this.settings.post_params.toString(),"\n","\t","file_types:               ",this.settings.file_types,"\n","\t","file_types_description:   ",this.settings.file_types_description,"\n","\t","file_size_limit:          ",this.settings.file_size_limit,"\n","\t","file_upload_limit:        ",this.settings.file_upload_limit,"\n","\t","file_queue_limit:         ",this.settings.file_queue_limit,"\n","\t","debug:                    ",this.settings.debug.toString(),"\n","\t","prevent_swf_caching:      ",this.settings.prevent_swf_caching.toString(),"\n","\t","button_placeholder_id:    ",this.settings.button_placeholder_id.toString(),"\n","\t","button_image_url:         ",this.settings.button_image_url.toString(),"\n","\t","button_width:             ",this.settings.button_width.toString(),"\n","\t","button_height:            ",this.settings.button_height.toString(),"\n","\t","button_text:              ",this.settings.button_text.toString(),"\n","\t","button_text_style:        ",this.settings.button_text_style.toString(),"\n","\t","button_text_top_padding:  ",this.settings.button_text_top_padding.toString(),"\n","\t","button_text_left_padding: ",this.settings.button_text_left_padding.toString(),"\n","\t","button_action:            ",this.settings.button_action.toString(),"\n","\t","button_disabled:          ",this.settings.button_disabled.toString(),"\n","\t","custom_settings:          ",this.settings.custom_settings.toString(),"\n","Event Handlers:\n","\t","swfupload_loaded_handler assigned:  ",(typeof this.settings.swfupload_loaded_handler==="function").toString(),"\n","\t","file_dialog_start_handler assigned: ",(typeof this.settings.file_dialog_start_handler==="function").toString(),"\n","\t","file_queued_handler assigned:       ",(typeof this.settings.file_queued_handler==="function").toString(),"\n","\t","file_queue_error_handler assigned:  ",(typeof this.settings.file_queue_error_handler==="function").toString(),"\n","\t","upload_start_handler assigned:      ",(typeof this.settings.upload_start_handler==="function").toString(),"\n","\t","upload_progress_handler assigned:   ",(typeof this.settings.upload_progress_handler==="function").toString(),"\n","\t","upload_error_handler assigned:      ",(typeof this.settings.upload_error_handler==="function").toString(),"\n","\t","upload_success_handler assigned:    ",(typeof this.settings.upload_success_handler==="function").toString(),"\n","\t","upload_complete_handler assigned:   ",(typeof this.settings.upload_complete_handler==="function").toString(),"\n","\t","debug_handler assigned:             ",(typeof this.settings.debug_handler==="function").toString(),"\n"].join(""));};SWFUpload.prototype.addSetting=function(name,value,default_value){if(value==undefined){return(this.settings[name]=default_value);}else{return(this.settings[name]=value);}};SWFUpload.prototype.getSetting=function(name){if(this.settings[name]!=undefined){return this.settings[name];}
return"";};SWFUpload.prototype.callFlash=function(functionName,argumentArray){argumentArray=argumentArray||[];var movieElement=this.getMovieElement();var returnValue,returnString;try{returnString=movieElement.CallFunction('<invoke name="'+functionName+'" returntype="javascript">'+__flash__argumentsToXML(argumentArray,0)+'</invoke>');returnValue=eval(returnString);}catch(ex){throw"Call to "+functionName+" failed";}
if(returnValue!=undefined&&typeof returnValue.post==="object"){returnValue=this.unescapeFilePostParams(returnValue);}
return returnValue;};SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile");};SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles");};SWFUpload.prototype.startUpload=function(fileID){this.callFlash("StartUpload",[fileID]);};SWFUpload.prototype.cancelUpload=function(fileID,triggerErrorEvent){if(triggerErrorEvent!==false){triggerErrorEvent=true;}
this.callFlash("CancelUpload",[fileID,triggerErrorEvent]);};SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload");};SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats");};SWFUpload.prototype.setStats=function(statsObject){this.callFlash("SetStats",[statsObject]);};SWFUpload.prototype.getFile=function(fileID){if(typeof(fileID)==="number"){return this.callFlash("GetFileByIndex",[fileID]);}else{return this.callFlash("GetFile",[fileID]);}};SWFUpload.prototype.addFileParam=function(fileID,name,value){return this.callFlash("AddFileParam",[fileID,name,value]);};SWFUpload.prototype.removeFileParam=function(fileID,name){this.callFlash("RemoveFileParam",[fileID,name]);};SWFUpload.prototype.setUploadURL=function(url){this.settings.upload_url=url.toString();this.callFlash("SetUploadURL",[url]);};SWFUpload.prototype.setPostParams=function(paramsObject){this.settings.post_params=paramsObject;this.callFlash("SetPostParams",[paramsObject]);};SWFUpload.prototype.addPostParam=function(name,value){this.settings.post_params[name]=value;this.callFlash("SetPostParams",[this.settings.post_params]);};SWFUpload.prototype.removePostParam=function(name){delete this.settings.post_params[name];this.callFlash("SetPostParams",[this.settings.post_params]);};SWFUpload.prototype.setFileTypes=function(types,description){this.settings.file_types=types;this.settings.file_types_description=description;this.callFlash("SetFileTypes",[types,description]);};SWFUpload.prototype.setFileSizeLimit=function(fileSizeLimit){this.settings.file_size_limit=fileSizeLimit;this.callFlash("SetFileSizeLimit",[fileSizeLimit]);};SWFUpload.prototype.setFileUploadLimit=function(fileUploadLimit){this.settings.file_upload_limit=fileUploadLimit;this.callFlash("SetFileUploadLimit",[fileUploadLimit]);};SWFUpload.prototype.setFileQueueLimit=function(fileQueueLimit){this.settings.file_queue_limit=fileQueueLimit;this.callFlash("SetFileQueueLimit",[fileQueueLimit]);};SWFUpload.prototype.setFilePostName=function(filePostName){this.settings.file_post_name=filePostName;this.callFlash("SetFilePostName",[filePostName]);};SWFUpload.prototype.setUseQueryString=function(useQueryString){this.settings.use_query_string=useQueryString;this.callFlash("SetUseQueryString",[useQueryString]);};SWFUpload.prototype.setRequeueOnError=function(requeueOnError){this.settings.requeue_on_error=requeueOnError;this.callFlash("SetRequeueOnError",[requeueOnError]);};SWFUpload.prototype.setHTTPSuccess=function(http_status_codes){if(typeof http_status_codes==="string"){http_status_codes=http_status_codes.replace(" ","").split(",");}
this.settings.http_success=http_status_codes;this.callFlash("SetHTTPSuccess",[http_status_codes]);};SWFUpload.prototype.setDebugEnabled=function(debugEnabled){this.settings.debug_enabled=debugEnabled;this.callFlash("SetDebugEnabled",[debugEnabled]);};SWFUpload.prototype.setButtonImageURL=function(buttonImageURL){if(buttonImageURL==undefined){buttonImageURL="";}
this.settings.button_image_url=buttonImageURL;this.callFlash("SetButtonImageURL",[buttonImageURL]);};SWFUpload.prototype.setButtonDimensions=function(width,height){this.settings.button_width=width;this.settings.button_height=height;var movie=this.getMovieElement();if(movie!=undefined){movie.style.width=width+"px";movie.style.height=height+"px";}
this.callFlash("SetButtonDimensions",[width,height]);};SWFUpload.prototype.setButtonText=function(html){this.settings.button_text=html;this.callFlash("SetButtonText",[html]);};SWFUpload.prototype.setButtonTextPadding=function(left,top){this.settings.button_text_top_padding=top;this.settings.button_text_left_padding=left;this.callFlash("SetButtonTextPadding",[left,top]);};SWFUpload.prototype.setButtonTextStyle=function(css){this.settings.button_text_style=css;this.callFlash("SetButtonTextStyle",[css]);};SWFUpload.prototype.setButtonDisabled=function(isDisabled){this.settings.button_disabled=isDisabled;this.callFlash("SetButtonDisabled",[isDisabled]);};SWFUpload.prototype.setButtonAction=function(buttonAction){this.settings.button_action=buttonAction;this.callFlash("SetButtonAction",[buttonAction]);};SWFUpload.prototype.setButtonCursor=function(cursor){this.settings.button_cursor=cursor;this.callFlash("SetButtonCursor",[cursor]);};SWFUpload.prototype.queueEvent=function(handlerName,argumentArray){if(argumentArray==undefined){argumentArray=[];}else if(!(argumentArray instanceof Array)){argumentArray=[argumentArray];}
var self=this;if(typeof this.settings[handlerName]==="function"){this.eventQueue.push(function(){this.settings[handlerName].apply(this,argumentArray);});setTimeout(function(){self.executeNextEvent();},0);}else if(this.settings[handlerName]!==null){throw"Event handler "+handlerName+" is unknown or is not a function";}};SWFUpload.prototype.executeNextEvent=function(){var f=this.eventQueue?this.eventQueue.shift():null;if(typeof(f)==="function"){f.apply(this);}};SWFUpload.prototype.unescapeFilePostParams=function(file){var reg=/[$]([0-9a-f]{4})/i;var unescapedPost={};var uk;if(file!=undefined){for(var k in file.post){if(file.post.hasOwnProperty(k)){uk=k;var match;while((match=reg.exec(uk))!==null){uk=uk.replace(match[0],String.fromCharCode(parseInt("0x"+match[1],16)));}
unescapedPost[uk]=file.post[k];}}
file.post=unescapedPost;}
return file;};SWFUpload.prototype.testExternalInterface=function(){try{return this.callFlash("TestExternalInterface");}catch(ex){return false;}};SWFUpload.prototype.flashReady=function(){var movieElement=this.getMovieElement();if(!movieElement){this.debug("Flash called back ready but the flash movie can't be found.");return;}
this.cleanUp(movieElement);this.queueEvent("swfupload_loaded_handler");};SWFUpload.prototype.cleanUp=function(movieElement){try{if(this.movieElement&&typeof(movieElement.CallFunction)==="unknown"){this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for(var key in movieElement){try{if(typeof(movieElement[key])==="function"){movieElement[key]=null;}}catch(ex){}}}}catch(ex1){}
window["__flash__removeCallback"]=function(instance,name){try{if(instance){instance[name]=null;}}catch(flashEx){}};};SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler");};SWFUpload.prototype.fileQueued=function(file){file=this.unescapeFilePostParams(file);this.queueEvent("file_queued_handler",file);};SWFUpload.prototype.fileQueueError=function(file,errorCode,message){file=this.unescapeFilePostParams(file);this.queueEvent("file_queue_error_handler",[file,errorCode,message]);};SWFUpload.prototype.fileDialogComplete=function(numFilesSelected,numFilesQueued){this.queueEvent("file_dialog_complete_handler",[numFilesSelected,numFilesQueued]);};SWFUpload.prototype.uploadStart=function(file){file=this.unescapeFilePostParams(file);this.queueEvent("return_upload_start_handler",file);};SWFUpload.prototype.returnUploadStart=function(file){var returnValue;if(typeof this.settings.upload_start_handler==="function"){file=this.unescapeFilePostParams(file);returnValue=this.settings.upload_start_handler.call(this,file);}else if(this.settings.upload_start_handler!=undefined){throw"upload_start_handler must be a function";}
if(returnValue===undefined){returnValue=true;}
returnValue=!!returnValue;this.callFlash("ReturnUploadStart",[returnValue]);};SWFUpload.prototype.uploadProgress=function(file,bytesComplete,bytesTotal){file=this.unescapeFilePostParams(file);this.queueEvent("upload_progress_handler",[file,bytesComplete,bytesTotal]);};SWFUpload.prototype.uploadError=function(file,errorCode,message){file=this.unescapeFilePostParams(file);this.queueEvent("upload_error_handler",[file,errorCode,message]);};SWFUpload.prototype.uploadSuccess=function(file,serverData){file=this.unescapeFilePostParams(file);this.queueEvent("upload_success_handler",[file,serverData]);};SWFUpload.prototype.uploadComplete=function(file){file=this.unescapeFilePostParams(file);this.queueEvent("upload_complete_handler",file);};SWFUpload.prototype.debug=function(message){this.queueEvent("debug_handler",message);};SWFUpload.prototype.debugMessage=function(message){if(this.settings.debug){var exceptionMessage,exceptionValues=[];if(typeof message==="object"&&typeof message.name==="string"&&typeof message.message==="string"){for(var key in message){if(message.hasOwnProperty(key)){exceptionValues.push(key+": "+message[key]);}}
exceptionMessage=exceptionValues.join("\n")||"";exceptionValues=exceptionMessage.split("\n");exceptionMessage="EXCEPTION: "+exceptionValues.join("\nEXCEPTION: ");SWFUpload.Console.writeLine(exceptionMessage);}else{SWFUpload.Console.writeLine(message);}}};SWFUpload.Console={};SWFUpload.Console.writeLine=function(message){var console,documentForm;try{console=document.getElementById("SWFUpload_Console");if(!console){documentForm=document.createElement("form");document.getElementsByTagName("body")[0].appendChild(documentForm);console=document.createElement("textarea");console.id="SWFUpload_Console";console.style.fontFamily="monospace";console.setAttribute("wrap","off");console.wrap="off";console.style.overflow="auto";console.style.width="700px";console.style.height="350px";console.style.margin="5px";documentForm.appendChild(console);}
console.value+=message+"\n";console.scrollTop=console.scrollHeight-console.clientHeight;}catch(ex){alert("Exception: "+ex.name+" Message: "+ex.message);}};;var SWFUpload;if(typeof(SWFUpload)==="function"){SWFUpload.queue={};SWFUpload.prototype.initSettings=(function(oldInitSettings){return function(){if(typeof(oldInitSettings)==="function"){oldInitSettings.call(this);}
this.customSettings.queue_cancelled_flag=false;this.customSettings.queue_upload_count=0;this.customSettings.user_upload_complete_handler=this.settings.upload_complete_handler;this.customSettings.user_upload_start_handler=this.settings.upload_start_handler;this.settings.upload_complete_handler=SWFUpload.queue.uploadCompleteHandler;this.settings.upload_start_handler=SWFUpload.queue.uploadStartHandler;this.settings.queue_complete_handler=this.settings.queue_complete_handler||null;};})(SWFUpload.prototype.initSettings);SWFUpload.prototype.startUpload=function(fileID){this.customSettings.queue_cancelled_flag=false;this.callFlash("StartUpload",[fileID]);};SWFUpload.prototype.cancelQueue=function(){this.customSettings.queue_cancelled_flag=true;this.stopUpload();var stats=this.getStats();while(stats.files_queued>0){this.cancelUpload();stats=this.getStats();}};SWFUpload.queue.uploadStartHandler=function(file){var returnValue;if(typeof(this.customSettings.user_upload_start_handler)==="function"){returnValue=this.customSettings.user_upload_start_handler.call(this,file);}
returnValue=(returnValue===false)?false:true;this.customSettings.queue_cancelled_flag=!returnValue;return returnValue;};SWFUpload.queue.uploadCompleteHandler=function(file){var user_upload_complete_handler=this.customSettings.user_upload_complete_handler;var continueUpload;if(file.filestatus===SWFUpload.FILE_STATUS.COMPLETE){this.customSettings.queue_upload_count++;}
if(typeof(user_upload_complete_handler)==="function"){continueUpload=(user_upload_complete_handler.call(this,file)===false)?false:true;}else if(file.filestatus===SWFUpload.FILE_STATUS.QUEUED){continueUpload=false;}else{continueUpload=true;}
if(continueUpload){var stats=this.getStats();if(stats.files_queued>0&&this.customSettings.queue_cancelled_flag===false){this.startUpload();}else if(this.customSettings.queue_cancelled_flag===false){this.queueEvent("queue_complete_handler",[this.customSettings.queue_upload_count]);this.customSettings.queue_upload_count=0;}else{this.customSettings.queue_cancelled_flag=false;this.customSettings.queue_upload_count=0;}}};};function fileQueued(file){try{}catch(ex){this.debug(ex);}}
function fileQueueError(file,errorCode,message){try{if(errorCode===SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){alert("You have attempted to queue too many files.\n"+(message===0?"You have reached the upload limit.":"You may select "+(message>1?"up to "+message+" files.":"one file.")));return;}
switch(errorCode){case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:$('fileDisplay').update('The selected file is too big.');this.debug("Error Code: File too big, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:$('fileDisplay').update('Cannot upload Zero Byte files.');this.debug("Error Code: Zero byte file, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:$('fileDisplay').update('Invalid File Type.');this.debug("Error Code: Invalid File Type, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;default:if(file!==null){}
this.debug("Error Code: "+errorCode+", File name: "+file.name+", File size: "+file.size+", Message: "+message);break;}
$(this.customSettings.fileId).setValue('');}catch(ex){this.debug(ex);}}
function fileDialogComplete(numFilesSelected,numFilesQueued){try{if(numFilesSelected>0){document.getElementById(this.customSettings.cancelButtonId).disabled=false;}
this.startUpload();}catch(ex){this.debug(ex);}}
function uploadStart(file){try{$(this.customSettings.startButtonId).hide();$(this.customSettings.flashStartButtonId).setStyle('margin-left: -10000px;');$(this.customSettings.cancelButtonId).show();}
catch(ex){}
return true;}
function uploadProgress(file,bytesLoaded,bytesTotal){try{var percent=Math.ceil((bytesLoaded/bytesTotal)*100);$(this.customSettings.fileDisplayId).update('Uploading '+percent+'%');}catch(ex){this.debug(ex);}}
function uploadSuccess(file,serverData){$(this.customSettings.fileId).setValue(serverData+file.name);$(this.customSettings.fileDisplayId).update(file.name+' <a href="javascript:void(0);" style="font-size:12px" onclick="$(\''+this.customSettings.fileDisplayId+'\').update(\'\');$(\''+this.customSettings.fileId+'\').setValue(\'\');">Remove</a>');$(this.customSettings.startButtonId).show();$(this.customSettings.flashStartButtonId).setStyle('margin-left: 0px;');$(this.customSettings.cancelButtonId).hide();try{}catch(ex){this.debug(ex);}}
function uploadError(file,errorCode,message){try{switch(errorCode){case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:this.debug("Error Code: HTTP Error, File name: "+file.name+", Message: "+message);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:this.debug("Error Code: Upload Failed, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:this.debug("Error Code: IO Error, File name: "+file.name+", Message: "+message);break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:this.debug("Error Code: Security Error, File name: "+file.name+", Message: "+message);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:this.debug("Error Code: Upload Limit Exceeded, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:this.debug("Error Code: File Validation Failed, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:if(this.getStats().files_queued===0){$(this.customSettings.cancelButtonId).hide();}
$(this.customSettings.fileDisplayId).update('Upload Cancelled');break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:break;default:this.debug("Error Code: "+errorCode+", File name: "+file.name+", File size: "+file.size+", Message: "+message);break;}
$(this.customSettings.fileId).setValue('');}catch(ex){this.debug(ex);}}
function uploadComplete(file){}
function updateFile()
{}
function queueComplete(numFilesUploaded){}