(function(a){a.fn.richFormElement=function(b){var d={selectVisOptions:6,selectionOptionHeight:25,selectOptionBorder:0,selectTextbarBorder:0,selectAutoWide:false};var c=a.extend(d,b);var e=0;return this.each(function(){if(a(this).attr("type")=="radio"){a(this).wrap('<div class="richFormRadio" />');var g=a(this).attr("name");a.fn.richFormElement.updateRadioGroup(g);a(this).hide();a(this).parent().append('<a class="htmlControl">html control</a>');a(this).parent().find(".htmlControl").click(function(){var j=a(this).parent().find("input");a(j).trigger("click");var i=a(j).attr("name");a.fn.richFormElement.updateRadioGroup(i)});a(this).change(function(){var i=a(this).attr("name");a.fn.richFormElement.updateRadioGroup(i)});var f=a(this).attr("id");a("label[for="+f+"]").click(function(){var i=a(this).attr("for");var j=a("input[id="+i+"]").attr("name");a("input[id="+i+"]").attr("checked",true);a.fn.richFormElement.updateRadioGroup(j)})}else{if(a(this).attr("type")=="checkbox"){a(this).wrap('<div class="richFormCheckbox"/>');a(this).parent().append('<a class="htmlControl">html control</a>');a(this).parent().find(".htmlControl").click(function(){var i=a(this).parent().find("input");a(i).trigger("click");if(a(i).attr("checked")==true){a(this).removeClass("unchecked").addClass("checked")}else{a(this).removeClass("checked").addClass("unchecked")}});if(a(this).attr("checked")==true){a(this).parent().find(".htmlControl").addClass("checked")}a(this).hide()}else{if(a(this).attr("type")=="select-one"||a(this).attr("type")=="select-multiple"){a(this).styledSelect()}else{if(a(this).attr("type")=="submit"){a(this).wrap('<span class="richFormButton"/>');var h=a(this).parent();a(h).mouseover(function(){a(this).addClass("buttonHover")});a(h).mouseout(function(){a(this).removeClass("buttonHover")})}else{if(a(this).attr("type")=="text"){a(this).wrap('<div class="richFormInput"/>');var h=a(this).parent();a(h).hover(function(){a(this).addClass("hover")},function(){a(this).removeClass("hover")});a(this).focus(function(){a(this).parent().addClass("focus")});a(this).blur(function(){a(this).parent().removeClass("focus")})}else{alert(a(this).attr("type"))}}}}}})};a.fn.richFormElement.updateRadioGroup=function(b){a("input[name*="+b+"]").each(function(){if(a(this).attr("checked")){a(this).parent().find(".htmlControl").removeClass("unchecked").addClass("checked")}else{a(this).parent().find(".htmlControl").removeClass("checked").addClass("unchecked")}})};a.fn.richFormElement.closeSelectBoxes=function(){a(".richFormSelectOne .button, .richFormSelectMultiple .button").each(function(){a(this).removeClass("menuOpen")});a(".richFormSelectOne .options-container, .richFormSelectMultiple .options-container").each(function(){a(this).hide(1)})};a.fn.richFormElement.trim=function(b){return b.replace(/^\s+|\s+$/g,"")}})(jQuery);jQuery.fn.styledSelect=function(a){a=jQuery.extend({selectClass:"richFormSelectOne",openSelectClass:"open",optionClass:"option",selectedOptionClass:"selected",closedOptionClass:"closed",firstOptionClass:"first",lastOptionClass:"last",zIndexApply:false,zIndexStart:250,deactiveOnBackgroundClick:true},a);var b=a.zIndexStart;this.each(function(){var c=jQuery(this);var d=jQuery(c).css("display")=="none"?"none":"block";jQuery(c).wrap('<div class="richForm_dropdown" style="display:'+d+'">');jQuery(c).before('<span class="selectvalue">'+jQuery("option:selected",c).text()+"</span>");jQuery(c).change(function(){jQuery(this).prev(".selectvalue").text(jQuery("option:selected",c).text())});c.bind("hide",function(f){jQuery(this).parent().hide()});c.bind("show",function(f){jQuery(this).parent().show()})});return this};
