/*
jquery.combobox
version 0.1.2.7

Copyright © 2007,2008 Minel Pather|Ahura Mazda|jquery.sanchezsalvador.com
Dual licensed under MIT and GPL licences:
* www.opensource.org/licenses/mit-license.php
* www.gnu.org/licenses/gpl.html
*/
﻿var combobox_dropdwn_button=new Image();combobox_dropdwn_button.src="/images/default-combobox.gif";jQuery.fn.combobox=function(styles,options)
{var _context=this;this.combobox=new Function();var styleSettings={comboboxContainerClass:null,comboboxValueContentContainerClass:null,comboboxValueContentClass:null,comboboxDropDownButtonClass:null,comboboxDropDownClass:null,comboboxDropDownItemClass:null,comboboxDropDownItemHoverClass:null,comboboxDropDownGroupItemHeaderClass:null,comboboxDropDownGroupItemContainerClass:null};var optionSettings={animationType:"slide",animationSpeed:"fast",width:120};if(styles)
{jQuery.extend(styleSettings,styles);}
if(options)
{jQuery.extend(optionSettings,options);}
this.combobox.onChange=null;function getInstance(context)
{return context[0].internalCombobox;}
function makeRemoveFunction(context)
{return function()
{getInstance(context).remove();};}
function makeUpdateFunction(context)
{return function()
{getInstance(context).update();}}
function makeUpdateSelectionFunction(context)
{return function()
{getInstance(context).updateSelection();}}
function makeAddRangeFunction(context)
{return function(dataSource)
{getInstance(context).addRange(dataSource);}}
jQuery.fn.extend(this.combobox,{addRange:makeAddRangeFunction(_context),remove:makeRemoveFunction(_context),update:makeUpdateFunction(_context),updateSelection:makeUpdateSelectionFunction(_context)});return this.each(function()
{this.internalCombobox=new ComboboxClass(this);this.internalCombobox.initialise();function ComboboxClass(elementDOM)
{var _originalElementJQuery=jQuery(elementDOM);var _containerJQuery=null;var _containerDefaultStyle="background-color:#fff;border-left: solid 2px #777;border-top: solid 2px #777;border-right: solid 1px #ccc;border-bottom: solid 1px #ccc;";var _containerEnforcedStyle="padding:0;";var _dropDownListJQuery=null;var _dropDownListEnforcedStyle="list-style-type:none;min-height:15px;padding-top:0;margin:0;overflow:auto";var _dropDownListDefaultStyle="cursor:default;padding:2px;background:#fff;border-right:solid 1px #000;border-bottom:solid 1px #000;border-left:solid 1px #aaa;border-top:solid 1px #aaa;";var _dropDownListItemEnforcedStyle="display:block;";var _dropDownListItemDefaultStyle="cursor:default;padding-left:2px;font-weight:normal;font-style:normal;";var _dropDownListGroupItemContainerEnforcedStyle="list-style-type:none;";var _dropDownListGroupItemContainerDefaultStyle="padding-left:10px;margin-left:0;";var _dropDownListGroupItemHeaderEnforcedStyle="";var _dropDownListGroupItemHeaderDefaultStyle="font-style:italic;font-weight:bold;";var _dropdownListMaximumHeight=300;var _valueContentContainerJQuery=null;var _valueContentContainerEnforcedStyle="position:relative;overflow:hidden;";var _valueContentJQuery=null;var _valueContentEnforcedStyle="float:left;position:absolute;cursor:default;overflow:hidden;";var _valueContentDefaultStyle="padding-left:3px;";var _dropDownButtonJQuery=null;var _dropDownButtonDefaultStyle="overflow:hidden;width:16px;height:18px;color:#000;background:#D6D3CE;font-family:arial;font-size:8px;cursor:default;text-align:center;vertical-align:middle;";var _dropDownButtonEnforcedStyle="background-repeat:no-repeat;float:right;";var _dropDownButtonDefaultUnselectedStyle="padding-left:0px;padding-top:1px;width:12px;height:13px;border-right:solid 2px #404040;border-bottom:solid 2px #404040;border-left:solid 2px #f0f0f0;border-top:solid 2px #f0f0f0";var _dropDownButtonDefaultSelectedStyle="padding-left:1px;padding-top:3px;width:12px;height:13px;border:solid 1px #808080";var _dropDownButtonDefaultCharacter="&#9660;";var _lastItemSelectedJQuery=null;var _lastItemHoveredJQuery=null;var _lastValue=null;var _downdownListPositionIsInverted=false;var _maximumItemLength=0;var _dropDownListOffset=null;var _dropDownListHeight=0;var _dropDownButtonImageDimension=null;var _valueContentContainerImageDimension=null;var _valueContentMaximumHeight=null;String.format=function()
{var currentString=null;if(arguments.length!=0)
{currentString=arguments[0];for(var argumentIndex=1;argumentIndex<arguments.length;argumentIndex++)
{var modifiedString=new RegExp('\\{'+(argumentIndex-1)+'\\}','gm');currentString=currentString.replace(modifiedString,arguments[argumentIndex]);}}
return currentString;};function getPixelValue(object)
{var pixelValue=null;if(object)
{if(object.substr(-2,2)=="px")
{pixelValue=object.substr(0,(object.length-2));}}
return pixelValue;}
function setInnerWidth(elementJQuery,width)
{var differenceWidth=(elementJQuery.outerWidth()-elementJQuery.width());elementJQuery.width(width-differenceWidth);}
function setInnerHeight(elementJQuery,height)
{var differenceheight=(elementJQuery.outerHeight()-elementJQuery.height());elementJQuery.height(height-differenceheight);}
function applyMultipleStyles(elementJQuery,multipleCSSStyles)
{var stylePairArray=multipleCSSStyles.split(";");if(stylePairArray.length>0)
{for(var stylePairArrayIndex=0;stylePairArrayIndex<stylePairArray.length;stylePairArrayIndex++)
{var stylePair=stylePairArray[stylePairArrayIndex];var splitStylePair=stylePair.split(":");elementJQuery.css(splitStylePair[0],splitStylePair[1]);}}}
function getImageDimension(imageURL)
{var dimension=new Object();dimension.width=0;dimension.height=0;sizingImageJQuery=jQuery("<img style='border:none;margin:0;padding:0;'></img>");sizingImageJQuery.attr("src",imageURL);_containerJQuery.append(sizingImageJQuery);dimension.width=sizingImageJQuery.width();dimension.height=sizingImageJQuery.height();sizingImageJQuery.remove();return dimension;}
function calculateIndividualImageDimension(jqueryElement)
{var dimension=null;var backgroundImageURL=jqueryElement.css("background-image");backgroundImageURL=backgroundImageURL.replace("url(","","gi");backgroundImageURL=backgroundImageURL.replace('"','',"gi");backgroundImageURL=backgroundImageURL.replace('\"','',"gi");backgroundImageURL=backgroundImageURL.replace(")","","gi");if(backgroundImageURL!="none")
{dimension=getImageDimension(backgroundImageURL);}
return dimension;}
function calculateImageDimensions()
{_dropDownButtonImageDimension=calculateIndividualImageDimension(_dropDownButtonJQuery);_valueContentContainerImageDimension=calculateIndividualImageDimension(_valueContentContainerJQuery);}
function setValueContentContainerState(state)
{if(styleSettings.comboboxValueContentContainerClass)
{if(_valueContentContainerImageDimension!=null)
{var height=_valueContentContainerJQuery.height();var offset=(state*height);if(_valueContentContainerImageDimension.height>offset)
{var background_positionCSS=String.format("0px -{0}px",offset);_valueContentContainerJQuery.css("background-position",background_positionCSS);}}}}
function setDropDownButtonState(state)
{if(styleSettings.comboboxDropDownButtonClass)
{if(_dropDownButtonImageDimension!=null)
{var width=_dropDownButtonJQuery.width();var offset=(state*width);if(_dropDownButtonImageDimension.width>offset)
{var background_positionCSS=String.format("-{0}px 0px",offset);_dropDownButtonJQuery.css("background-position",background_positionCSS);}}}
else
{var style=_dropDownButtonDefaultUnselectedStyle;if(state==1)
{style=_dropDownButtonDefaultSelectedStyle;}
applyMultipleStyles(_dropDownButtonJQuery,style);}}
function setControlVisualState(state)
{setValueContentContainerState(state);setDropDownButtonState(state);}
function buildValueContent()
{var valueContentContainerHTML="";if(styleSettings.comboboxValueContentContainerClass)
{valueContentContainerHTML=String.format("<div class='{0}' style='{1}'></div>",styleSettings.comboboxValueContentContainerClass,_valueContentContainerEnforcedStyle);}
else
{valueContentContainerHTML=String.format("<div style='{0}'></div>",_valueContentContainerEnforcedStyle);}
var valueContentHTML="";if(styleSettings.comboboxValueContentClass)
{valueContentHTML=String.format("<div class='{0}' style='{1}'></div>",styleSettings.comboboxValueContentClass,_valueContentEnforcedStyle);}
else
{valueContentHTML=String.format("<div style='{0}'></div>",_valueContentEnforcedStyle+_valueContentDefaultStyle);}
var dropdownButtonHTML="";if(styleSettings.comboboxDropDownButtonClass)
{dropdownButtonHTML=String.format("<div class='{1}' style='{0}'></div>",_dropDownButtonEnforcedStyle,styleSettings.comboboxDropDownButtonClass);}
else
{dropdownButtonHTML=String.format("<div style='{0}'>{1}</div>",(_dropDownButtonEnforcedStyle+_dropDownButtonDefaultStyle),_dropDownButtonDefaultCharacter);}
_valueContentJQuery=jQuery(valueContentHTML);_dropDownButtonJQuery=jQuery(dropdownButtonHTML);_valueContentContainerJQuery=jQuery(valueContentContainerHTML);_valueContentContainerJQuery.appendTo(_containerJQuery);_valueContentJQuery.appendTo(_valueContentContainerJQuery);_dropDownButtonJQuery.appendTo(_valueContentContainerJQuery);calculateImageDimensions();_valueContentMaximumHeight=getPixelValue(_valueContentJQuery.css("max-height"));setControlVisualState(0);}
function buildDropDownItem(childJQuery)
{var dataItemHTML="";var dataItemClass=null;var dataItemText="";var dataItemTitle="";var dataItemValue=null;var dataItemStyle="";var dataItemType="option";var childElement=childJQuery[0];if(childElement.title)
{if(childElement.title!="")
{dataItemTitle=childElement.title;}}
if(childJQuery.is('option'))
{if(childElement.dataText)
{dataItemText=childElement.dataText;}
else
{dataItemText=childJQuery.text();}
dataItemValue=childJQuery.val();if(styleSettings.comboboxDropDownItemClass)
{dataItemClass=styleSettings.comboboxDropDownItemClass;dataItemStyle=_dropDownListItemEnforcedStyle;}
else
{dataItemStyle=(_dropDownListItemEnforcedStyle+_dropDownListItemDefaultStyle);}
if(dataItemClass)
{dataItemHTML=String.format("<li style='{0}' class='{1}'>{2}</li>",dataItemStyle,dataItemClass,dataItemText);}
else
{dataItemHTML=String.format("<li style='{0}'>{1}</li>",dataItemStyle,dataItemText);}}
else
{if(childJQuery[0].dataText)
{dataItemText=childJQuery[0].dataText;}
else
{dataItemText=childJQuery.attr('label');}
dataItemValue=childJQuery.attr('class');dataItemType="optgroup";if(styleSettings.comboboxDropDownGroupItemHeaderClass)
{dataItemClass=styleSettings.comboboxDropDownGroupItemHeaderClass;dataItemStyle=_dropDownListGroupItemHeaderEnforcedStyle;}
else
{dataItemStyle=(_dropDownListGroupItemHeaderEnforcedStyle+_dropDownListGroupItemHeaderDefaultStyle);}
if(dataItemClass)
{dataItemHTML=String.format("<li><span style='{0}' class='{1}'>{2}</span></li>",dataItemStyle,dataItemClass,dataItemText);}
else
{dataItemHTML=String.format("<li><span style='{0}'>{1}</span></li>",dataItemStyle,dataItemText);}}
var dataItemJQuery=jQuery(dataItemHTML);dataItemJQuery.css("display","inline");dataItemJQuery[0].dataText=dataItemText;dataItemJQuery[0].dataValue=dataItemValue;dataItemJQuery[0].dataType=dataItemType;if(dataItemTitle=="")
{dataItemTitle=dataItemText}
dataItemJQuery[0].title=dataItemTitle;return dataItemJQuery;}
function recursivelyBuildList(parentJQuery,childrenOptionsJQuery)
{childrenOptionsJQuery.each(function()
{var childJQuery=jQuery(this);var builtDropDownItemJQuery=buildDropDownItem(childJQuery);parentJQuery.append(builtDropDownItemJQuery);var offsetLeft=builtDropDownItemJQuery.offset().left;offsetLeft-=_dropDownListOffset.left;if(offsetLeft<0)
{offsetLeft=0;}
var width=(offsetLeft+builtDropDownItemJQuery.outerWidth());if(width>_maximumItemLength)
{_maximumItemLength=width;}
applyMultipleStyles(builtDropDownItemJQuery,_dropDownListItemEnforcedStyle);if(childJQuery.is('optgroup'))
{var dataGroupItemHTML="";if(styleSettings.comboboxDropDownGroupItemContainerClass)
{dataGroupItemHTML=String.format("<ul style='{0}' class='{1}'></ul>",_dropDownListGroupItemContainerEnforcedStyle,styleSettings.comboboxDropDownGroupItemContainerClass);}
else
{dataGroupItemHTML=String.format("<ul style='{0}'></ul>",(_dropDownListGroupItemContainerEnforcedStyle+_dropDownListGroupItemContainerDefaultStyle));}
var dataGroupItemJQuery=jQuery(dataGroupItemHTML);builtDropDownItemJQuery.append(dataGroupItemJQuery);recursivelyBuildList(dataGroupItemJQuery,childJQuery.children());}});}
function buildDropDownList()
{var originalElementChildrenJQuery=_originalElementJQuery.children();_lastItemSelectedJQuery=null;_lastValue=null;if(_dropDownListJQuery)
{_dropDownListJQuery.empty();}
else
{var dropDownHTML="";if(styleSettings.comboboxDropDownClass)
{dropDownHTML=String.format("<ul class='{0}' style='{1}'></ul>",styleSettings.comboboxDropDownClass,_dropDownListEnforcedStyle);}
else
{dropDownHTML=String.format("<ul style='{0}'></ul>",(_dropDownListEnforcedStyle+_dropDownListDefaultStyle));}
_dropDownListJQuery=jQuery(dropDownHTML);_dropDownListJQuery.appendTo(_containerJQuery);_dropDownListJQuery.attr("tabIndex",0);}
if(originalElementChildrenJQuery.length>0)
{_maximumItemLength=0;_dropDownListOffset=_dropDownListJQuery.offset();recursivelyBuildList(_dropDownListJQuery,originalElementChildrenJQuery);}
var maximumHeight=getPixelValue(_dropDownListJQuery.css("max-height"));if(maximumHeight)
{_dropdownListMaximumHeight=maximumHeight;}
var dropdownListHeight=_dropDownListJQuery.height();if(dropdownListHeight>_dropdownListMaximumHeight)
{_dropDownListJQuery.height(_dropdownListMaximumHeight);}
_dropDownListHeight=_dropDownListJQuery.height();}
function updateDropDownListWidth()
{var dropdownListWidth=_containerJQuery.outerWidth();if(dropdownListWidth<_maximumItemLength)
{dropdownListWidth=_maximumItemLength;}
_dropDownListJQuery.width(dropdownListWidth);}
function positionDisplayValue()
{_valueContentJQuery.height("auto");var displayValueHeight=_valueContentJQuery.outerHeight();var displayContainerHeight=_valueContentContainerJQuery.height();if(_valueContentMaximumHeight)
{if(_valueContentMaximumHeight<displayValueHeight)
{displayValueHeight=_valueContentMaximumHeight;_valueContentJQuery.height(displayValueHeight);}}
var difference=((displayContainerHeight-displayValueHeight)/2);if(difference<0)
{difference=0;}
_valueContentJQuery.css("top",difference);}
function applyLayout()
{_containerJQuery.width(optionSettings.width);var controlWidth=_containerJQuery.width();setInnerWidth(_valueContentContainerJQuery,controlWidth);var displayValueWidth=(_valueContentContainerJQuery.width()-_dropDownButtonJQuery.outerWidth());setInnerWidth(_valueContentJQuery,displayValueWidth);var dropDownButtonHeight=_dropDownButtonJQuery.outerHeight();setInnerHeight(_valueContentContainerJQuery,dropDownButtonHeight);_dropDownListJQuery.css("position","absolute");_dropDownListJQuery.css("z-index","20000");updateDropDownListWidth();var currentLeftPosition=_dropDownListJQuery.offset().left;var leftPosition=(currentLeftPosition-(_containerJQuery.outerWidth()-_containerJQuery.width()));_dropDownListJQuery.hide();}
function setContentDisplay()
{var valueHasChanged=false;var originalElement=_originalElementJQuery[0];var dataItemJQuery;if(originalElement.length>0)
{var selectedDropDownListItemJQuery=jQuery("li[@dataValue='"+_originalElementJQuery.val()+"']",_dropDownListJQuery);_valueContentJQuery.html(selectedDropDownListItemJQuery[0].dataText);_valueContentJQuery.attr("title",selectedDropDownListItemJQuery[0].title);positionDisplayValue();if(_lastValue)
{if(_lastValue!=_originalElementJQuery.val())
{valueHasChanged=true;}}
_lastValue=_originalElementJQuery.val();if(valueHasChanged)
{if(_context.combobox.onChange)
{_context.combobox.onChange();}}
if(_lastItemSelectedJQuery)
{toggleItemHighlight(_lastItemSelectedJQuery,false);}
_lastItemSelectedJQuery=selectedDropDownListItemJQuery;toggleItemHighlight(_lastItemSelectedJQuery,true);}}
function scrollDropDownListItemIntoView(dropdownListItemJQuery)
{if(dropdownListItemJQuery)
{if(_dropDownListHeight>=_dropdownListMaximumHeight)
{var offset=dropdownListItemJQuery.offset();if((offset.top>_dropDownListHeight)||(offset.top<=dropdownListItemJQuery.outerHeight()))
{}}}}
function toggleItemHighlight(elementJQuery,isHighlighted)
{if(elementJQuery)
{if(styleSettings.comboboxDropDownItemHoverClass)
{if(isHighlighted)
{elementJQuery.addClass(styleSettings.comboboxDropDownItemHoverClass);}
else
{elementJQuery.removeClass(styleSettings.comboboxDropDownItemHoverClass);}}
else
{if(isHighlighted)
{elementJQuery.css("background","#000");elementJQuery.css("color","#fff");}
else
{elementJQuery.css("background","");elementJQuery.css("color","");}}}}
function buildContainer()
{var containerHTML="";if(styleSettings.comboboxContainerClass)
{containerHTML=String.format("<div class='{0}' style='{1}'></div>",styleSettings.comboboxContainerClass,_containerEnforcedStyle);}
else
{containerHTML=String.format("<div style='{0}' style='{1}'></div>",_containerDefaultStyle,_containerEnforcedStyle);}
_containerJQuery=jQuery(containerHTML);_originalElementJQuery.before(_containerJQuery);_containerJQuery.append(_originalElementJQuery);_originalElementJQuery.hide();_containerJQuery.attr("tabIndex",0);}
this.initialise=function()
{buildContainer();buildValueContent();buildDropDownList();applyLayout();bindEvents();setContentDisplay();};function postDropDownListShown()
{_dropDownListJQuery.focus();scrollDropDownListItemIntoView(_lastItemSelectedJQuery);}
function setAndBindContainerFocus()
{_containerJQuery.focus();bindContainerClickEvent();}
function slideUp(newTop)
{_dropDownListJQuery.animate({height:"toggle",top:newTop},optionSettings.animationSpeed,postDropDownListShown);}
function slideDown(newTop)
{_dropDownListJQuery.animate({height:"toggle",opacity:"toggle",top:newTop},optionSettings.animationSpeed,setAndBindContainerFocus);}
function slideToggle(callback)
{_dropDownListJQuery.animate({height:"toggle",opacity:"toggle"},optionSettings.animationSpeed,callback);}
function getDropDownListTop()
{var comboboxTop=_containerJQuery.position().top;var dropdownListHeight=_dropDownListJQuery.outerHeight();var comboboxBottom=(comboboxTop+_containerJQuery.outerHeight());var windowScrollTop=jQuery(window).scrollTop();var windowHeight=jQuery(window).height();var availableSpaceBelow=(windowHeight-(comboboxBottom-windowScrollTop));var dropdownListTop;dropdownListTop=comboboxBottom;_downdownListPositionIsInverted=false;if(availableSpaceBelow<dropdownListHeight)
{if((comboboxTop-windowScrollTop)>dropdownListHeight)
{dropdownListTop=(comboboxTop-dropdownListHeight);_downdownListPositionIsInverted=true;}}
return dropdownListTop;}
function toggleDropDownList(isShown)
{if(isShown)
{if(_dropDownListJQuery.is(":hidden"))
{unbindContainerClickEvent();toggleItemHighlight(_lastItemHoveredJQuery,false);toggleItemHighlight(_lastItemSelectedJQuery,true);setControlVisualState(1);var dropdownListTop=getDropDownListTop();_dropDownListJQuery.css("top",dropdownListTop);switch(optionSettings.animationType)
{case"slide":if(_downdownListPositionIsInverted)
{var comboboxTop=_containerJQuery.position().top;var containerHeight=_containerJQuery.outerHeight();_dropDownListJQuery.css("top",(comboboxTop-containerHeight));slideUp(dropdownListTop);}
else
{slideToggle(postDropDownListShown);}
break;case"fade":_dropDownListJQuery.fadeIn(optionSettings.animationSpeed,postDropDownListShown);break;default:_dropDownListJQuery.show(1,postDropDownListShown);}}}
else
{if(_dropDownListJQuery.is(":visible"))
{setControlVisualState(0);switch(optionSettings.animationType)
{case"slide":if(_downdownListPositionIsInverted)
{comboboxTop=_containerJQuery.position().top;dropdownListHeight=_dropDownListJQuery.height();slideDown(comboboxTop-_containerJQuery.outerHeight());}
else
{slideToggle(setAndBindContainerFocus);}
break;case"fade":_dropDownListJQuery.fadeOut(optionSettings.animationSpeed,setAndBindContainerFocus);break;default:_dropDownListJQuery.hide();setAndBindContainerFocus();}}}}
function setOriginalSelectItem(selectedIndex,selectedValue)
{var originalElementDOM=_originalElementJQuery[0];if(selectedValue==null)
{originalElementDOM.selectedIndex=selectedIndex;}
else
{originalElementDOM.value=selectedValue;}
if(originalElementDOM.onchange)
{originalElementDOM.onchange();}
setContentDisplay();}
function selectValue(subSelector)
{var originalElement=_originalElementJQuery[0];var currentIndex=originalElement.selectedIndex;var newIndex=-1;var optionCountZeroBased=originalElement.length-1;switch(subSelector)
{case":next":newIndex=currentIndex+1;if(newIndex>optionCountZeroBased)
{newIndex=optionCountZeroBased;}
break;case":previous":newIndex=currentIndex-1;if(newIndex<0)
{newIndex=0;}
break;case":first":newIndex=0;break;case":last":newIndex=optionCountZeroBased;break;}
setOriginalSelectItem(newIndex,null);scrollDropDownListItemIntoView(_lastItemSelectedJQuery);}
function isDropDownVisible()
{return _dropDownListJQuery.is(":visible");}
function bindItemEvents()
{jQuery("li",_dropDownListJQuery).not("ul").not("span").not("[@dataType='optgroup']").each(function()
{var itemJQuery=jQuery(this);itemJQuery.click(function(clickEvent)
{clickEvent.stopPropagation();dropdownList_onItemClick(itemJQuery);});itemJQuery.mouseover(function()
{dropdownList_onItemMouseOver(itemJQuery);});itemJQuery.mouseout(function()
{dropdownList_onItemMouseOut(itemJQuery);});});}
function bindBlurEvent()
{_dropDownListJQuery.blur(function(blurEvent)
{blurEvent.stopPropagation();dropdownList_onBlur();});}
function bindContainerClickEvent()
{_containerJQuery.click(function()
{container_onClick();});}
function unbindContainerClickEvent()
{_containerJQuery.unbind("click");}
function bindEvents()
{_containerJQuery.keydown(function(keyEvent)
{keyEvent.preventDefault();container_onKeyDown(keyEvent)});bindContainerClickEvent();bindBlurEvent();bindItemEvents();}
function container_onClick()
{if(_dropDownListJQuery.is(":hidden"))
{toggleDropDownList(true);}
else
{toggleDropDownList(false);}}
function dropdownList_onBlur()
{if(_dropDownListJQuery.is(":visible"))
{toggleDropDownList(false);}}
function dropdownList_onItemClick(itemJQuery)
{setOriginalSelectItem(null,itemJQuery[0].dataValue);toggleDropDownList(false);}
function dropdownList_onItemMouseOver(itemJQuery)
{toggleItemHighlight(_lastItemSelectedJQuery,false);toggleItemHighlight(_lastItemHoveredJQuery,false);toggleItemHighlight(itemJQuery,true);}
function dropdownList_onItemMouseOut(itemJQuery)
{_lastItemHoveredJQuery=itemJQuery;}
function container_onKeyDown(keyEvent)
{switch(keyEvent.which)
{case 33:case 36:selectValue(":first");break;case 34:case 35:selectValue(":last");break;case 37:selectValue(":previous");break;case 38:if(keyEvent.altKey)
{toggleDropDownList(!(isDropDownVisible()));}
else
{selectValue(":previous");}
break;case 39:selectValue(":next");break;case 40:if(keyEvent.altKey)
{toggleDropDownList(!(isDropDownVisible()));}
else
{selectValue(":next");}
break;case 27:case 13:toggleDropDownList(false);break;case 9:_dropDownListJQuery.blur();jQuery(window)[0].focus();break;}}
this.updateSelection=function()
{setContentDisplay();};this.update=function()
{buildDropDownList();updateDropDownListWidth();bindItemEvents();setContentDisplay();};this.remove=function()
{_containerJQuery.before(_originalElementJQuery);_containerJQuery.remove();_originalElementJQuery[0].internalCombobox=null;_originalElementJQuery.show();};this.addRange=function(dataSource)
{if(dataSource)
{var originalOptions=_originalElementJQuery[0].options;var optionTotal=originalOptions.length;for(optionIndex in dataSource)
{var option=dataSource[optionIndex];var optionElement=document.createElement("option");optionElement.value=option.value;optionElement.text=option.text;optionElement.dataText=option.text;if(option.title)
{optionElement.title=option.title;}
originalOptions[optionTotal+optionIndex]=optionElement;}
_originalElementJQuery.combobox.update();}};}});}