function ReInitSelect(e){var c=e.options[e.selectedIndex].text;var f=e.parentNode.getElementsByTagName("SPAN");if(f.length>0){f[0].innerHTML=c}}function addEvent(e,c,f){if(e.addEventListener){e.addEventListener(c,f,false)}else{if(e.attachEvent){e["e"+c+f]=f;e[c+f]=function(){e["e"+c+f](window.event)};e.attachEvent("on"+c,e[c+f])}}}var checkboxHeight="25";var radioHeight="25";var selectWidth="";document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; width: '+selectWidth+"px; opacity: 0; filter: alpha(opacity=0); z-index: 5; }</style>");var Custom={pushed:function(){element=this.nextSibling;if(element.disabled){return}if(element.checked==true&&element.type=="checkbox"){this.style.backgroundPosition="0 -"+checkboxHeight*3+"px"}else{if(element.checked==true&&element.type=="radio"){this.style.backgroundPosition="0 -"+radioHeight*3+"px"}else{if(element.checked!=true&&element.type=="checkbox"){this.style.backgroundPosition="0 -"+checkboxHeight+"px"}else{this.style.backgroundPosition="0 -"+radioHeight+"px"}}}},check:function(){element=this.nextSibling;if(element.disabled){return}if(element.checked==true&&element.type=="checkbox"){this.style.backgroundPosition="0 0";element.checked=false}else{if(element.type=="checkbox"){this.style.backgroundPosition="0 -"+checkboxHeight*2+"px"}else{this.style.backgroundPosition="0 -"+radioHeight*2+"px";group=this.nextSibling.name;inputs=document.getElementsByTagName("input");for(a=0;a<inputs.length;a++){if(inputs[a].name==group&&inputs[a]!=this.nextSibling){inputs[a].previousSibling.style.backgroundPosition="0 0"}}}element.checked=true}if(element.onclick){element.onclick()}},clear:function(){inputs=document.getElementsByTagName("input");for(var e=0;e<inputs.length;e++){try{if(inputs[e].type=="checkbox"&&inputs[e].checked==true&&inputs[e].className=="styled"){inputs[e].previousSibling.style.backgroundPosition="0 -"+checkboxHeight*2+"px"}else{if(inputs[e].type=="checkbox"&&inputs[e].className=="styled"){inputs[e].previousSibling.style.backgroundPosition="0 0"}else{if(inputs[e].type=="radio"&&inputs[e].checked==true&&inputs[e].className=="styled"){inputs[e].previousSibling.style.backgroundPosition="0 -"+radioHeight*2+"px"}else{if(inputs[e].type=="radio"&&inputs[e].className=="styled"){inputs[e].previousSibling.style.backgroundPosition="0 0"}}}}}catch(c){alert("error in clear() : "+c)}}},choose:function(){option=this.getElementsByTagName("option");for(d=0;d<option.length;d++){if(option[d].selected==true){if(option[d].childNodes[0]){document.getElementById("select"+this.name).childNodes[0].nodeValue=option[d].childNodes[0].nodeValue}else{document.getElementById("select"+this.name).childNodes[0].nodeValue=""}return}}}};function InitCustomFormElements(){var c=document.getElementsByTagName("input"),e=Array(),h,f,i;for(a=0;a<c.length;a++){if((c[a].type=="checkbox"||c[a].type=="radio")&&c[a].className=="styled"){e[a]=document.createElement("span");e[a].className=c[a].type;if(c[a].checked==true){if(c[a].type=="checkbox"){position="0 -"+(checkboxHeight*2)+"px";e[a].style.backgroundPosition=position}else{position="0 -"+(radioHeight*2)+"px";e[a].style.backgroundPosition=position}}c[a].parentNode.insertBefore(e[a],c[a]);addEvent(e[a],"mousedown",Custom.pushed);addEvent(e[a],"mouseup",Custom.check);addEvent(document,"mouseup",Custom.clear)}}c=document.getElementsByTagName("select");for(a=0;a<c.length;a++){try{if(c[a].className=="styled"){f=c[a].getElementsByTagName("option");if(f[0].childNodes[0]){i=f[0].childNodes[0].nodeValue}else{i=""}h=document.createTextNode(i);for(b=0;b<f.length;b++){if(f[b].selected==true){if(f[b].childNodes[0]){h=document.createTextNode(f[b].childNodes[0].nodeValue)}else{h=document.createTextNode("")}}}e[a]=document.createElement("span");e[a].className="select";e[a].id="select"+c[a].name;e[a].appendChild(h);c[a].parentNode.insertBefore(e[a],c[a]);addEvent(c[a],"change",Custom.choose)}}catch(g){alert("An Exception Occured in InitCustomFormElements() : "+g)}}};
