var checkboxHeight="25";var radioHeight="25";var selectWidth="190";document.write('<style type="text/css">input.styled-form { display: none; } select.styled-form { position: relative; width: '+selectWidth+"px; opacity: 0; z-index: 5; }</style>");var JQ=jQuery.noConflict();var StyledForm={init:function(){var b=JQ("input"),e=Array(),a,c,f;b.each(function(g,h){if((JQ(h).is(":checkbox")||JQ(h).is(":radio"))&&JQ(h).hasClass("styled-form")){JQ(h).checked=false;e[g]=document.createElement("span");JQ(e[g]).addClass(JQ(h).attr("type"));JQ(e[g]).attr("id","form-span-"+g);if(JQ(h).is(":checked")){if(JQ(h).attr("type")=="checkbox"){position="0 -"+(checkboxHeight*2)+"px";JQ(e[g]).css("background-position",position)}else{position="0 -"+(radioHeight*2)+"px";JQ(e[g]).css("background-position",position)}}JQ(e[g]).insertBefore(JQ(b[g]));JQ(h).change(StyledForm.clear);JQ(e[g]).mousedown(StyledForm.pushed);JQ(e[g]).mouseup(StyledForm.check)}})},pushed:function(){$this=JQ(this);$element=$this.next();console.log("type: ",$element.attr("type"));console.log("this: ",$this);console.log("element: ",$element);console.log("checked: ",$element.is(":checked"));if($element.is(":checked")){console.log("%a element is checked, #",$element.next().html(),$element.attr("value"))}if($element.is(":checked")&&$element.is(":checkbox")){console.log("checkbox element checked");$this.css("background-position","0 -"+checkboxHeight*3+"px")}else{if($element.is(":checked")&&$element.is(":radio")){$this.css("background-position","0 -"+radioHeight*3+"px")}else{if($element.not(":checked")&&$element.is(":checkbox")){console.log("checkbox element not checked");$this.css("background-position","0 -"+checkboxHeight+"px")}else{$this.css("background-position","0 -"+radioHeight+"px")}}}},check:function(){$this=JQ(this);$element=$this.next();if($element.is(":checked")&&$element.is(":checkbox")){$this.css("background-position","0 0");$element.attr("checked","false")}else{if($element.is(":checkbox")){$this.css("background-position","0 -"+checkboxHeight*2+"px")}else{$this.css("background-position","0 -"+radioHeight*2+"px");group=$element.attr("name");value=$element.attr("value");inputs=JQ("input");inputs.each(function(b,c){if(JQ(c).attr("name")==group&&JQ(c).attr("value")!=value){JQ(c).prev().css("background-position","0 0")}})}$element.attr("checked","true")}},clear:function(){inputs=JQ("input");inputs.each(function(a,c){if(JQ(c).is(":checkbox")&&JQ(c).is(":checked")&&JQ(c).hasClass("styled")){JQ(c).prev().css("background-position","0 -"+checkboxHeight*2+"px")}else{if(JQ(c).is(":checkbox")&&JQ(c).hasClass("styled")){JQ(c).prev().css("background-position","0 0")}else{if(JQ(c).is(":radio")&&JQ(c).is(":checked")&&JQ(c).hasClass("styled")){JQ(c).prev().css("background-position","0 -"+radioHeight*2+"px")}else{if(JQ(c).is(":radio")&&JQ(c).is(":checked")&&JQ(c).hasClass("styled")){JQ(c).prev().css("background-position","0 -"+radioHeight*2+"px")}else{if(JQ(c).is(":radio")&&JQ(c).hasClass("styled")){JQ(c).prev().css("background-position","0 0")}}}}}})},choose:function(){option=JQ("option");for(d=0;d<option.length;d++){if(option[d].selected==true){JQ("select"+this.name).childNodes[0].nodeValue=option[d].childNodes[0].nodeValue}}}};JQ(window).load(StyledForm.init);