EventListener.addEvent(window,"load",function(){new DesignControls()
});
function DesignControls(){var B=document.getElementsByTagName("input");
var A="";
for(var D=0;
D<B.length;
D++){if(ClassName.contains(B[D],"(noreplace)|(replaced)")){continue
}switch(B[D].type){case"checkbox":new DesignCheckBox(B[D]);
break;
case"radio":if(A.indexOf("*"+B[D].name+"*")==-1){new DesignRadioGroup(document.getElementsByName(B[D].name));
A=A+"*"+B[D].name+"*"
}break;
case"submit":new DesignSubmit(B[D]);
break
}}var C=document.getElementsByTagName("select");
for(var D=0;
D<C.length;
D++){if(!C[D].multiple&&!ClassName.contains(C[D],"(noreplace)|(replaced)")){new DesignSelect(C[D])
}}}function DesignControl(){var A=/safari/i;
this.safari=A.test(navigator.userAgent)
}DesignControl.prototype.transform=function(B){var A=this.create(B);
if(!B.disabled){EventListener.addEvent(B,"focus",this.focus,this);
EventListener.addEvent(B,"blur",this.blur,this);
if(B.tagName=="SELECT"){EventListener.addEvent(B,"keyup",this.updateGUI,this)
}if(document.all&&(B.type=="radio"||B.type=="checkbox")){EventListener.addEvent(B,"click",this.updateGUI,this)
}else{EventListener.addEvent(B,"change",this.updateGUI,this)
}}else{ClassName.add(A,"disabled");
if(B.checked){if(B.type=="radio"){ClassName.add(A,"DCradiodisabledchecked")
}if(B.type=="checkbox"){ClassName.add(A,"DCcheckboxdisabledchecked")
}}else{if(B.type=="radio"){ClassName.add(A,"DCradiodisabled")
}if(B.type=="checkbox"){ClassName.add(A,"DCcheckboxdisabled")
}}}if(B.className!=""){ClassName.add(A,B.className)
}ClassName.add(A,"DCblur");
B.DC=this;
B.parentNode.insertBefore(A,B);
ClassName.add(B,"replaced");
if(this.safari){ClassName.add(B,"safari")
}return A
};
DesignControl.prototype.focus=function(){ClassName.swap(this.GUI,"DCblur","DCfocus")
};
DesignControl.prototype.blur=function(){ClassName.swap(this.GUI,"DCfocus","DCblur")
};
DesignControl.prototype.setDisabledState=function(B,A){if(!B||!A){return 
}this.disabled=B.disabled;
if(this.disabled){ClassName.add(A,"disabled");
switch(B.type){case"radio":ClassName.add(A,B.checked?"DCradiodisabledchecked":"DCradiodisabled");
break;
case"checkbox":ClassName.add(A,B.checked?"DCcheckboxdisabledchecked":"DCcheckboxdisabled");
break
}}else{ClassName.remove(A,"disabled");
A.className=A.className.replace(/(^|\s)DC(checkbox|radio)disabled(checked)?(\s|$)/," ")
}this.updateGUI()
};
DesignControl.prototype.method=function(B){var A=this;
return function(){return B.apply(A,arguments)
}
};
DesignControl.prototype.forwardClick=function(B){if(document.all){var A=document.createEventObject();
if(!(/radio/i.test(this.input.type)&&this.input.checked)){this.input.checked=!this.input.checked
}B.fireEvent("onclick",A)
}else{var A=document.createEvent("MouseEvents");
A.initEvent("click",true,true);
if(this.safari){this.input.checked=!this.input.checked
}this.input.dispatchEvent(A)
}};
DesignControl.prototype.updateGUI=function(){};
DesignControl.prototype.reset=function(){EventListener.removeEvents(this.input,"focus");
EventListener.removeEvents(this.input,"blur");
EventListener.removeEvents(this.input,"click");
EventListener.removeEvents(this.input.DC.GUI,"click");
EventListener.addEvent(this.input,"focus",this.input.DC.focus,this.input.DC);
EventListener.addEvent(this.input,"blur",this.input.DC.blur,this.input.DC);
EventListener.addEvent(this.input,"click",this.input.DC.updateGUI,this.input.DC);
EventListener.addEvent(this.input.DC.GUI,"click",this.input.DC.onclick,this.input.DC);
this.updateGUI()
};
DesignCheckBox.prototype=new DesignControl;
DesignCheckBox.prototype.constructor=DesignCheckBox;
DesignCheckBox.superclass=DesignControl.prototype;
function DesignCheckBox(){if(arguments.length>0){this._constructor.apply(this,arguments)
}}DesignCheckBox.prototype._constructor=function(A){this.input=A;
this.GUI=this.transform(A);
if(A.parentNode.tagName.toUpperCase()!="LABEL"||document.all||this.safari){if(!A.disabled){EventListener.addEvent(this.GUI,"click",this.onclick,this)
}}};
DesignCheckBox.prototype.onclick=function(A){this.input.focus();
this.forwardClick(this.input);
this.updateGUI()
};
DesignCheckBox.prototype.updateGUI=function(){ClassName.remove(this.GUI,"DCcheckboxdisabledchecked");
ClassName.remove(this.GUI,"DCcheckboxchecked");
ClassName.remove(this.GUI,"DCcheckboxdisabled");
if(this.input.checked){if(this.input.disabled){ClassName.add(this.GUI,"DCcheckboxdisabledchecked")
}else{ClassName.add(this.GUI,"DCcheckboxchecked")
}}else{if(this.input.disabled){ClassName.add(this.GUI,"DCcheckboxdisabled")
}}};
DesignCheckBox.prototype.create=function(A){var B=document.createElement("span");
B.className="DCcheckbox";
if(this.input.checked){ClassName.add(B,"DCcheckboxchecked")
}return(B)
};
function DesignRadioGroup(B){this.designRadios=new Array();
for(var A=0;
A<B.length;
A++){if(B[A].type=="radio"){this.designRadios[this.designRadios.length]=new DesignRadio(B[A],this,A)
}}}DesignRadioGroup.prototype.updateGUI=function(){for(var A=0;
A<this.designRadios.length;
A++){if(this.designRadios[A].input.checked){ClassName.add(this.designRadios[A].GUI,"DCradiochecked")
}else{ClassName.remove(this.designRadios[A].GUI,"DCradiochecked")
}}};
DesignRadio.prototype=new DesignControl;
DesignRadio.prototype.constructor=DesignRadio;
DesignRadio.superclass=DesignControl.prototype;
function DesignRadio(){if(arguments.length>0){this._constructor.apply(this,arguments)
}}DesignRadio.prototype._constructor=function(C,B,A){this.input=C;
this.group=B;
this.index=A;
this.GUI=this.transform(C);
if(C.parentNode.tagName.toUpperCase()!="LABEL"||document.all||this.safari){if(!C.disabled){EventListener.addEvent(this.GUI,"click",this.onclick,this)
}}};
DesignRadio.prototype.onclick=function(A){this.input.focus();
this.forwardClick(this.input);
this.updateGUI()
};
DesignRadio.prototype.updateGUI=function(){this.group.updateGUI()
};
DesignRadio.prototype.create=function(A){var B=document.createElement("span");
B.className="DCradio";
if(this.input.checked){ClassName.add(B,"DCradiochecked")
}return(B)
};
function DesignSelect(){}DesignSelect.prototype=new DesignControl;
DesignSelect.prototype.constructor=DesignSelect;
DesignSelect.superclass=DesignControl.prototype;
function DesignSelect(){if(arguments.length>0){this._constructor.apply(this,arguments)
}}DesignSelect.prototype._constructor=function(A){this.input=A;
this.GUI=this.transform(A);
if(!A.disabled){if(this.onclick){EventListener.addEvent(this.GUI,"click",this.onclick,this)
}}};
DesignSelect.prototype.log=function(A){};
DesignSelect.prototype.makeActive=function(){this.log("makeActive");
var A=this;
this.createTextInput();
this.inputElement.tabIndex=-1;
this.inputElement.onkeypress=function(B){if(B.keyCode==27){A.makeActiveClosed()
}A.updateGUI()
}
};
DesignSelect.prototype.makeActiveClosed=function(){this.log("makeActiveClosed");
this.makeActive();
var A=this;
this.GUI.onclick=function(){A.makeActiveOpen()
};
this.setOptionsVisible(false);
this.textInput.style.left="";
this.GUI.style.zIndex=0
};
DesignSelect.prototype.makeActiveOpen=function(){this.log("makeActiveOpen");
this.makeActive();
var A=this;
this.GUI.onclick=null;
this.setOptionsVisible(true);
if(this.isSearch){this.textInput.style.left="0px";
this.log(this.textInput.style.left);
this.log(this.textInput.style.zIndex)
}this.textInput.focus();
this.GUI.style.zIndex=1000
};
DesignSelect.prototype.updateFocusDelayed=function(){this.log("updateFocusDelayed");
if(this.textInputFocused||this.optionsFocused){if(!this.isOptionsVisible()){this.makeActiveOpen()
}}else{if(this.isOptionsVisible()){this.makeActiveClosed()
}}};
DesignSelect.prototype.updateFocus=function(){var A=this;
window.setTimeout(function(){A.updateFocusDelayed()
},200)
};
DesignSelect.prototype.createTextInput=function(){this.log("createTextInput");
this.log(this.textInput);
if(!this.textInput){var A=this;
this.textInput=document.createElement("input");
this.log("created textInput");
this.textInput.type="text";
this.textInput.className="choiceSearchStatus";
this.textInput.value=this.pattern;
this.textInput.ds=this;
this.textInput.onkeydown=function(B){if(!B){B=window.event
}A.log("DOWN key: "+B.keyCode+"  | char: "+B.charCode);
if(B.keyCode==13){A.textInput.blur();
return EventListener.cancelEvent(B)
}if(B.keyCode==27){A.makeActiveClosed()
}if(B.keyCode==38){A.selectOffset(-1,B)
}if(B.keyCode==40){A.selectOffset(1,B)
}};
this.textInput.onkeyup=function(B){if(!B){B=window.event
}A.log("UP key: "+B.keyCode+"  | char: "+B.charCode);
A.pattern=A.isSearch?A.textInput.value:"";
if(B.keyCode!=27&&B.keyCode!=38&&B.keyCode!=40){A.updateOptions()
}};
this.textInput.onfocus=function(){A.log("focus textInput");
A.textInputFocused=true;
A.updateFocus()
};
this.textInput.onblur=function(){A.log("blur textInput");
A.textInputFocused=false;
A.updateFocus()
};
this.GUI.appendChild(this.textInput)
}this.textInput.style.display="none";
this.textInput.style.display="block";
this.textInput.style.display="inline";
this.log("this.textInput.style");
this.log(this.textInput.style.left);
this.log(this.textInput.style.zIndex);
this.log(this.textInput.style.display)
};
DesignSelect.prototype.isOptionsVisible=function(){return this.options.style.display=="block"
};
DesignSelect.prototype.setOptionsVisible=function(A){this.log("visible: "+A);
var B=this.options.style;
B.display=A?"block":"none";
B.marginTop=this.status.parentNode.offsetHeight+"px";
this.GUI.style.left=A?"0pt":"";
if(A){this.setDimensions();
if(!this.safari){var E=(window.innerHeight||document.documentElement.clientHeight)+(window.pageYOffset||document.documentElement.scrollTop);
var D=Utils.calculateTop(this.options);
var C=this.options.offsetHeight;
var B=this.options.style;
if(E-D-C<0){B.marginTop=-(C+1)+"px"
}else{B.marginTop=this.status.parentNode.offsetHeight+"px"
}}}};
DesignSelect.prototype.selectOffset=function(C,B){var A=this.selectOffsetImpl(C,B);
if(A==undefined){A=this.selectOffsetImpl(C,B)
}this.selectIndex(A,B)
};
DesignSelect.prototype.selectOffsetImpl=function(C,B){var A=this.scroller.childNodes.length;
if(A<=0){return 
}if(!this.filteredSelectedIndex){this.filteredSelectedIndex=0
}this.filteredSelectedIndex+=C;
if(this.filteredSelectedIndex<0){this.filteredSelectedIndex=A-1
}if(this.filteredSelectedIndex>=A){this.filteredSelectedIndex=0
}return this.scroller.childNodes[this.filteredSelectedIndex].index
};
DesignSelect.prototype.onselect=function(B){this.log("onselect. e="+B);
var A=(B)?B.target:window.event.srcElement;
this.log("option: "+A);
if(!B){B=window.event
}this.log("event: "+B);
if(A.nodeType!=1){A=A.parentNode
}this.selectIndex(A.index,B);
this.makeActiveClosed();
EventListener.cancelEvent(B)
};
DesignSelect.prototype.selectIndex=function(A,B){if(this.input.selectedIndex!=A){this.input.selectedIndex=A;
if(this.input.onchange){this.input.onchange.call(this.input,B)
}if(this.input.onselect){this.input.onselect.call(this.input,B)
}}this.updateGUI()
};
DesignSelect.prototype.updateGUI=function(){this.log("updateGUI");
if(this.input.options.length>this.input.selectedIndex){this.status.innerHTML=this.input.options[this.input.selectedIndex].innerHTML
}for(var B=0;
B<this.scroller.childNodes.length;
B++){var C=this.scroller.childNodes[B];
var A=C.index==this.input.selectedIndex;
C.className=A?"selected":"";
if(A){this.filteredSelectedIndex=B;
this.scrollIntoView(C)
}}};
DesignSelect.prototype.create=function(C){this.originalTabIndex=C.tabIndex;
this.GUI=document.createElement("span");
this.GUI.className="DCselect";
this.GUI.style.zIndex=100;
this.isSearch=/choiceSearch/.test(C.className);
this.pattern="";
var A=this;
this.inputElement=C;
this.status=document.createElement("span");
this.status.className="status";
this.options=document.createElement("span");
this.options.className="options";
this.options.tabIndex=-1;
this.scroller=document.createElement("div");
this.scroller.className="DCscroller";
this.options.appendChild(this.scroller);
this.scroller.tabIndex=-1;
this.textInputFocused=false;
this.optionsFocused=false;
this.options.onfocus=function(){B.log("options focus");
B.optionsFocused=true;
B.updateFocus()
};
this.options.onblur=function(){B.log("options blur");
B.optionsFocused=false;
B.updateFocus()
};
EventListener.removeEvents(this.inputElement,"keyup");
var B=this;
this.inputElement.onkeypress=function(D){if(!D){D=window.event
}this.log("press"+D.keyCode);
return EventListener.cancelEvent(D)
};
this.inputElement.onkeydown=function(D){if(!D){D=window.event
}this.log("down"+D.keyCode);
if(D.keyCode==38){B.selectOffset(-1,D)
}if(D.keyCode==40){B.selectOffset(1,D)
}return EventListener.cancelEvent(D)
};
this.inputElement.onkeydown=function(D){if(!D){D=window.event
}this.log("down"+D.keyCode);
if(D.keyCode==38){B.selectOffset(-1,D)
}if(D.keyCode==40){B.selectOffset(1,D)
}return EventListener.cancelEvent(D)
};
this.inputElement.onkeyup=function(D){if(!D){D=window.event
}this.log("up"+D.keyCode);
return EventListener.cancelEvent(D)
};
this.GUI.appendChild(this.status);
this.GUI.appendChild(this.options);
this.updateOptions();
this.makeActiveClosed();
return(this.GUI)
};
DesignSelect.prototype.updateOptions=function(){this.log("updateOptions");
var E=this.scroller.style.left;
this.scroller.style.left=-10000;
this.scroller.innerHTML="";
var A=this.input.getElementsByTagName("optgroup");
if(0==A.length){var D=this.input.getElementsByTagName("option");
for(var C=0;
C<D.length;
C++){this.renderOption(C,D[C])
}}else{var F=0;
for(var B=0;
B<A.length;
B++){this.renderGroup(A[B]);
var D=A[B].getElementsByTagName("option");
for(var C=0;
C<D.length;
C++){this.renderOption(F,D[C]);
F=F+1
}}}this.updateGUI();
this.scroller.style.left=E
};
DesignSelect.prototype.optionMouseOver=function(){if(this.className!="selected"){this.className="hover"
}};
DesignSelect.prototype.optionMouseOut=function(){if(this.className!="selected"){this.className=""
}};
DesignSelect.prototype.renderOption=function(B,A){if(!A.innerHTML.match(new RegExp(this.pattern,"i"))){return 
}var C=document.createElement("span");
C.innerHTML=A.innerHTML;
C.tabIndex=-1;
if(!A.disabled){C.index=B;
var D=this;
C.onclick=function(E){D.log("renderOption:onclick, parm="+E);
D.onselect(E)
};
C.onmouseover=this.optionMouseOver;
C.onmouseout=this.optionMouseOut
}this.scroller.appendChild(C)
};
DesignSelect.prototype.renderGroup=function(A){var B=document.createElement("span");
B.innerHTML=A.label;
B.className="group";
this.scroller.appendChild(B)
};
DesignSelect.prototype.setDimensions=function(){this.options.style.overflow="visible";
this.options.style.height="auto";
this.options.style.width="auto";
var A=Math.max(this.scroller.offsetWidth,this.status.offsetWidth)-1;
this.options.style.overflow="";
if(this.scroller.childNodes.length>10){var B=this.scroller.childNodes[0].offsetHeight;
this.options.style.height=(10*B)+"px";
this.options.style.width=(A+18)+"px";
this.options.style.overflow="auto"
}else{if(A>0){this.options.style.width=A+"px"
}}this.scroller.tabIndex=-1
};
DesignSelect.prototype.scrollIntoView=function(D){var G=D.offsetLeft,F=D.offsetTop;
var C=D.offsetWidth,A=D.offsetHeight;
if(D.parentNode!=D.offsetParent){G-=D.parentNode.offsetLeft;
F-=D.parentNode.offsetTop
}var H=D.parentNode;
while(H&&(H.nodeType==1)){if(G<H.scrollLeft){H.scrollLeft=G
}if(G+C>H.scrollLeft+H.clientWidth){H.scrollLeft=(G+C)-H.clientWidth
}if(F<H.scrollTop){H.scrollTop=F
}if(F+A>H.scrollTop+H.clientHeight){H.scrollTop=(F+A)-H.clientHeight
}var E=H.offsetLeft,B=H.offsetTop;
if(H.parentNode!=H.offsetParent){E-=H.parentNode.offsetLeft;
B-=H.parentNode.offsetTop
}G+=E-H.scrollLeft;
F+=B-H.scrollTop;
H=H.parentNode
}};
DesignSubmit.prototype=new DesignControl;
DesignSubmit.prototype.constructor=DesignCheckBox;
DesignSubmit.superclass=DesignControl.prototype;
function DesignSubmit(){if(arguments.length>0){this._constructor.apply(this,arguments)
}}DesignSubmit.prototype._constructor=function(A){this.input=A;
this.GUI=this.transform(A);
if(!A.disabled){EventListener.addEvent(this.GUI,"click",this.onclick,this)
}};
DesignSubmit.prototype.transform=function(C){var A=document.createElement("span");
var B=this.create(C);
A.id=C.id;
C.id=C.id+"_replaced";
EventListener.addEvent(C,"focus",this.focus,this);
EventListener.addEvent(C,"blur",this.blur,this);
ClassName.add(B,"DCblur");
ClassName.add(B,C.className);
A.appendChild(B);
C.DC=this;
C.parentNode.insertBefore(A,C);
ClassName.add(C,"replaced");
A.onfocus=function(){C.focus()
};
return A
};
DesignSubmit.prototype.create=function(D){if(D.disabled){var E=document.createElement("div");
E.className="DCsubmitDisabled";
E.href="#"
}else{var E=document.createElement("a");
E.className="DCsubmit";
E.href="#"
}E.onclick=function(){return false
};
var C=document.createElement("span");
E.appendChild(C);
var B=document.createElement("span");
C.appendChild(B);
var A=document.createElement("span");
B.appendChild(A);
A.innerHTML=D.value;
return(E)
};
DesignSubmit.prototype.onclick=function(A){this.input.focus();
if(this.input.onclick){var B=this.input.onclick.call(this.input,A);
if(B){this.input.click()
}}else{this.input.click()
}EventListener.cancelEvent(A)
};
DesignSubmit.prototype.focus=function(){ClassName.swap(this.GUI,"DCblur","DCfocus")
};
DesignSubmit.prototype.blur=function(){ClassName.swap(this.GUI,"DCfocus","DCblur")
};
DesignSubmit.prototype.updateGUI=function(){replacingInString=this.input.id.slice(0,-9);
replacingInput=document.getElementById(replacingInString);
inner=replacingInput.firstChild;
while(inner){next=inner.nextSibling;
replacingInput.removeChild(inner);
inner=next
}child=this.create(this.input);
inputclasses=this.input.className;
ClassName.add(child,inputclasses.replace(/replaced/,""));
ClassName.add(child,"DCblur");
replacingInput.appendChild(child)
};