function DropBox(q,u){var b=100;var s=10;var e="";var j=u||"";var p=null;var E=null;var w=null;var o=null;var B=null;var n=null;var C=null;var h=null;var f=$("#"+q);var k=false;var D=false;if(f.size()==0){return}this.reInitSeoAttr=function(F){f.html(F);f.children("option").each(function(){this.setAttribute("seo",makeSeoString(this.text))});if(f.children("option").length>0){B.val(f.children("option")[0].text)}else{B.val("")}};k=(jQuery.browser.version=="6.0"&&jQuery.browser.msie);y();function y(){h=document.createElement("div");h.id=f[0].id+"wrapper";h.style.cssFloat="left";h.style.position="relative";h=$(h);var H=0;var G=f.css("background-color");f.css("background-color","");if(f[0].style.zIndex!=""){H=parseInt(f[0].style.zIndex)}f[0].style.top="0px";f[0].style.left="0px";f[0].style.zIndex="";a();f.wrap(h);padding_left=4;padding_top=1;width=f.innerWidth()-padding_left;height=f.innerHeight()-(2*padding_top);if(!width){width=230}if(!height){height=24}if(k){n=document.createElement("iframe");n.style.position="absolute";n.frameBorder="0";n.style.top="2px";n.style.left="2px";n.style.width=(width-$.getScrollbarWidth())+"px";n.style.height=(height)+"px";n.style.marginTop=f[0].style.marginTop;n.style.marginLeft=f[0].style.marginLeft;n.style.zIndex=1;n.style.border="none";n.setAttribute("scrolling","no");n=$(n);f.after(n);var F=n[0].contentWindow.document;F.open();F.close();B=F.createElement("input");B.type="text";B.value=f[0].options[f[0].selectedIndex].text;e=B.value;B.autocomplete="off";B.style.position="absolute";B.style.margin="0px";B.style.top="0px";B.style.left="0px";B.style.fontFamily=f.css("font-family");B.style.fontSize=f.css("font-size");B.style.width=n[0].style.width;B.style.height=n[0].style.height;B.style.border="none";B.style.padding=(padding_top)+"px 0px "+(padding_top)+"px "+(padding_left-1)+"px";F.body.appendChild(B);B=$(B)}else{B=document.createElement("input");B.type="text";if(jQuery.browser.msie){B.value=f[0].options[f[0].selectedIndex].text;B.defaultValue=B.value;e=B.value}else{B.defaultValue=f[0].options[f[0].selectedIndex].text;e=B.defaultValue}B.autocomplete="off";B.style.position="absolute";B.style.top="1px";B.style.left="1px";B.style.marginTop=f[0].style.marginTop;B.style.marginLeft=f[0].style.marginLeft;B.style.paddingLeft="4px";B.style.zIndex=f[0].style.zIndex+1;B.style.width=(f[0].offsetWidth-25)+"px";B.style.border="none";B.style.fontFamily=f.css("font-family");B.style.fontSize=f.css("font-size");B=$(B);f.after(B);if(!jQuery.browser.msie){w=A(0,f.height()+2);f.after(w)}}B[0].className="combo_replace_input";o=document.createElement("div");o.style.padding="2px";o=$(o);o.hover(function(){m($(this))},function(){return true});o.mousedown(function(){B.val($(this).text());e=$(this).text();x()});B.focus(function(){i()});B.keyup(function(I){return g(I)});B.keydown(function(I){return r(I)});B.blur(function(I){x();if(B.val().length==0&&j!=""){B.val(j)}if(B.val().length>0){if(!f.children("option[seo='"+makeSeoString(B.val())+"']").eq(0).attr("selected")){f.children("option[seo='"+makeSeoString(B.val())+"']").eq(0).each(function(){f[0].selectedIndex=this.index});f.change()}}else{B.val(e)}});f.change(function(){B.val(f[0].options[f[0].selectedIndex].text);e=f[0].options[f[0].selectedIndex].text});f.focus(function(){i()});f.keypress(function(I){f.blur();B.focus();B.val(String.fromCharCode(I.which));d(B.val());return false});f.keydown(function(I){if(I.keyCode<47){return true}})}function a(){f.children("option").each(function(){this.setAttribute("seo",makeSeoString(this.text))})}function t(F){D=true;if(w){C=null;if(v(F)){z();w.show()}else{x()}}else{if(l(F)){w.show()}}}function x(){D=false;if(jQuery.browser.msie){if(w){w.remove()}w=null;C=null}else{w.hide()}}function z(){if(k){if(C==null){C=document.createElement("iframe");C.src="javascript:'<html></html>';";C.style.position="absolute";C.style.display="block";C.style.left="0px";C.style.top="0px";C.style.zIndex=-1;C.style.width=w.width();C.frameBorder="0";C.setAttribute("scrolling","no");w[0].appendChild(C);C=$(C);C.css("filter","mask()")}C[0].style.height=w.height()}}function c(F){F=makeSeoString(F);return f.children("[seo*='"+F+"']")}function l(G){if(G.length==0){return false}var F=c(G);if(F.size()<1){return false}var I=f.offset();var H=24;if(k){H=parseInt(B[0].style.height);if(!H||H<3){H=18}}else{H=B[0].offsetHeight}w=A(I.left,I.top+H+2);if(v(G,F)){document.body.appendChild(w[0]);height=w.height();w[0].style.height=(height)+"px";z();return true}return false}function A(H,G){width=parseInt(f.css("width"));height=parseInt(f.css("height"));if(!width){width=230}if(!height){height=24}var F=document.createElement("div");F.id=f[0].id+"popup";F.style.display="none";F.style.position="absolute";F.style.zIndex=100;F.style.border="1px solid black";F.style.backgroundColor="white";F.style.left=(H)+"px";F.style.top=(G)+"px";F.style.width=(width-2)+"px";F.style.marginLeft=B[0].style.marginLeft;F=$(F);return F}function v(G,F){w.empty();w[0].style.height="";if(F==undefined){if(G.length==0){return false}F=c(G)}if(F.size()==0){return false}F.slice(0,11).each(function(){var H=f[0].options[this.index].text;var M=removeAccent(H).toLowerCase().indexOf(removeAccent(G).toLowerCase());if(M>=0){var I="";if(M>0){I=H.substr(0,M)}var J=H.substr(M,G.length);var K=I+'<span style="color:#990000; background-color:#F8F0DD"><b>'+J+"</b></span>"+H.substring(M+G.length);var L=o.clone(true).html(K)[0];w[0].appendChild(L)}});if(w.children().size()>0){m(w.children("div:first"),true);height=w.height();if(height>0){w[0].style.height=(height)+"px"}return true}return false}function g(F){if(F.keyCode){switch(F.keyCode){case 27:x();B.val(e);break;case 9:break;case 13:break;case 37:break;case 38:break;case 39:break;case 40:if(!D){d(B.val())}break;default:d(B.val());return false;break}}return true}function r(F){if(F.keyCode){switch(F.keyCode){case 9:if(D){B.val(w.children("#suggestion_selected").text());e=B.val();x()}return true;break;case 13:if(D){B.val(w.children("#suggestion_selected").text());e=B.val();x()}return false;break;case 38:if(D){var G=w.children("#suggestion_selected").prev();if(G.size()==0){G=w.children("div:last")}m(G)}return false;break;case 40:if(D){var G=w.children("#suggestion_selected").next();if(G.size()==0){G=w.children("div:first")}m(G)}return false;break}}return true}function i(){if(B.val()==""){x();e=""}else{if(B.val()==f.children("option:first").text()){B.val("");x()}else{if(B.val()!=e){d(B.val())}}}}function d(F){t(F)}function m(G){var F=w.children("#suggestion_selected");F.css("background-color","white");F.removeAttr("id");G.css("background-color","#DED6C5");G.attr("id","suggestion_selected")}};