(function(){$.fn.customSelect=function(){this.each(function(){a(this)});jQuery(document).click(function(c){var b=(window.event)?window.event.srcElement:c.target;if(document.srExpandedList){if((b.srIndex||b.srIndex===0)&&document.srExpandedList==b.parentNode){document.srExpandedList.srCollapse(b)}else{document.srExpandedList.srCollapse()}}else{if(b.srIndex||b.srIndex===0){b.parentNode.srExpand()}}})};function a(h){var d=(navigator.userAgent.search("MSIE 6.0")!=-1);var g=document.createElement("ul");jQuery(g).addClass("srList srCollapsed srBlur");g.srSelect=h;h.srReplacement=g;jQuery(h).addClass("srReplacedSelect");h.onchange=function(){var i=this.srReplacement;i.srSelectLi(i.childNodes[this.selectedIndex])};h.onkeypress=function(l){var k=this.selectedIndex;var j=this.srReplacement;switch(l.keyCode){case 9:this.srReplacement.srCollapse();break;case 37:case 38:if(k-1>=0){j.srSelectLi(j.childNodes[k-1])}break;case 40:if(l.altKey){}case 39:if(k+1<j.childNodes.length){j.srSelectLi(j.childNodes[k+1])}break;case 33:case 36:j.srSelectLi(j.firstChild);break;case 34:case 35:j.srSelectLi(j.lastChild);break}};g.srSelectLi=function(i){var j=i.parentNode;if(j.srSelectesIndex!=null){jQuery(j.childNodes[j.srSelectesIndex]).removeClass()}j.srSelectesIndex=i.srIndex;jQuery(j.childNodes[i.srIndex]).removeClass();jQuery(j.childNodes[i.srIndex]).addClass("srSelectedLi");return i.srIndex};g.srExpand=function(){if(!this.srExpanded){if(document.srExpandedList){document.srExpandedList.srCollapse()}document.srExpandedList=this;jQuery(this).removeClass("srCollapsed");jQuery(this).addClass("srExpanded");this.srExpanded=true;this.srSelect.focus();if(d){var j=this.firstChild;var k=0;var i=j.clientHeight;while(j){j.style.position="absolute";j.style.top=k;k+=i;j=j.nextSibling}}}};g.srCollapse=function(i){if(this.srExpanded){document.srExpandedList=null;if(i){this.srSelect.selectedIndex=this.srSelectLi(i);jQuery("[name=cgid]").val(this.srSelect.options[this.srSelect.selectedIndex].value)}this.srSelect.focus();jQuery(this).trigger("customselectorselected");jQuery(this).removeClass("srExpanded");jQuery(this).addClass("srCollapsed");this.srExpanded=false;if(d){var j=this.firstChild;while(j){j.style.position="";j=j.nextSibling}}}};var e=h.options;var c=e.length;for(var f=0;f<c;f++){var b=document.createElement("li");b.appendChild(document.createTextNode(e[f].text));b.srIndex=f;jQuery(b).mouseover(function(){jQuery(this).toggleClass("srHoverLi")});jQuery(b).mouseout(function(){jQuery(this).toggleClass("srHoverLi")});g.appendChild(b)}if(h.selectedIndex==null){h.selectedIndex=0}jQuery("[name=cgid]").val(h.options[h.selectedIndex].value);g.srSelectLi(g.childNodes[h.selectedIndex]);jQuery(h).after(jQuery(g))}})(jQuery);
